# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1261032889 -7200 # Node ID e6b17d312c8b56b613d677ff58bf94a6bf42dd28 Revision: 200949 Kit: 200951 diff -r 000000000000 -r e6b17d312c8b brandingserver/bsclient/bsclientdefs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/brandingserver/bsclient/bsclientdefs.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,29 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description:CBSClientdefs.h +* +*/ +#ifndef __BRANDINGDEFS_H__ +#define __BRANDINGDEFS_H__ +#include + + +#endif //__BRANDINGDEFS_H__ + +// END OF FILE + + + + + diff -r 000000000000 -r e6b17d312c8b brandingserver/bsclient/bselementfactory.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/brandingserver/bsclient/bselementfactory.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,71 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: bselementfactory.cpp +* +*/ + + +// INCLUDE FILES + +#include "debugtrace.h" +#include "bselementfactory.h" +#include "cbselement.h" + + + +EXPORT_C MBSElement* BSElementFactory::CreateBSElementL( const TDesC8& aElementId, + TBSElementType /*aElementType*/, + TInt aElementData ) + { + return CBSElement::NewL( aElementId, aElementData ); + } + + +EXPORT_C MBSElement* BSElementFactory::CreateBSElementL( const TDesC8& aElementId, + TBSElementType aElementType, + const TDesC& aElementData ) + { + return CBSElement::NewL( aElementId, aElementData, aElementType ); + } + + +EXPORT_C MBSElement* BSElementFactory::CreateBSElementL( const TDesC8& aElementId, + TBSElementType /*aElementType*/, + const TDesC8& aElementData ) + { + return CBSElement::NewL( aElementId, aElementData ); + } + + +EXPORT_C MBSElement* BSElementFactory::CreateBSElementL( const TDesC8& aElementId, + TBSElementType /*aElementType*/, + CBSBitmap* aElementData ) + { + return CBSElement::NewL( aElementId, aElementData ); + } + + + +EXPORT_C MBSElement* BSElementFactory::CreateBSElementL( const TDesC8& aElementId, + TBSElementType /*aElementType*/, + RBSObjOwningPtrArray& aElementData ) + { + return CBSElement::NewL( aElementId, aElementData ); + } + + + + +// END OF FILE + diff -r 000000000000 -r e6b17d312c8b brandingserver/bsclient/bsprocessstarter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/brandingserver/bsclient/bsprocessstarter.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,405 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: bsprocessstarter.cpp +* +*/ +// INCLUDE FILES +#include "bsprocessstarter.h" +#include +#include + + +// CONSTANTS +_LIT( KEka2ExeDir,"\\sys\\bin\\"); +_LIT( KEka2LaunchMutexExt, "[lMtx]" ); +const TInt KEka2SrvConnTries = 7; +const TInt KEka2SrvConnInitialRetryWait = 500; //MicroSeconds => 0.0005s + + + +// ============================================================== +// ====================== HELPER CLASS ========================== +// ============================================================== + +/** + * RSessionBase accessor to give to the ProcessStarter + * access to RSessionBase::CreateSession(). + */ +class REka2SessionBaseAccessor : public RSessionBase + { + public: // Constructor + inline REka2SessionBaseAccessor() + { + } + + public: // New functions + + /** + * Public access to RSessionBase::CreateSession(). + */ + inline TInt CreateSession( const TDesC& aServer, + const TVersion& aVersion, + TInt aAsyncMessageSlots ) + { + return RSessionBase::CreateSession( aServer, + aVersion, + aAsyncMessageSlots ); + } + }; + + + + + +// ============================================================== +// ====================== PROCESSSTARTER ======================== +// ============================================================== + + +// -------------------------------------------------------------- +// BSProcessStarter::FullExePathForClienLocation() +// -------------------------------------------------------------- +// +void BSProcessStarter::FullExePathForClienLocation( + const TDesC& aExeName, + TFileName& aFullExePath ) + { + //Get drive (C:) where this client code is installed + { + TFileName tmp; + Dll::FileName( tmp ); + aFullExePath.Copy( TParsePtrC( tmp ).Drive() ); + } + + //Build the rest from the exe path + aFullExePath.Append( KEka2ExeDir ); + aFullExePath.Append( aExeName ); + } + + + +// -------------------------------------------------------------- +// BSProcessStarter::StartInstance() +// -------------------------------------------------------------- +// +TInt BSProcessStarter::StartInstance( + const TDesC& aFullExePath, + const TDesC& aCommand, + const TArray< TProcessStartupParam >* aParams ) + { + RMutex launchMutex; + TInt error = KErrNotFound; + + { + // Dynamic mutex name used to allow code share + TName launchMutexName( TParsePtrC( aFullExePath ).Name() ); + launchMutexName.Append( KEka2LaunchMutexExt ); + + // Open or Create mutex to serialize to access to server startup code. + // (race condition safe way) + while( error == KErrNotFound ) + { + error = launchMutex.CreateGlobal( launchMutexName ); + if( error != KErrAlreadyExists ) + { + break; + } + error = launchMutex.OpenGlobal( launchMutexName ); + } + + if( error != KErrNone ) + { + return error; + } + } + + + launchMutex.Wait(); + + //Serialized access + error = BSProcessStarter::DoStartInstance( aFullExePath, + aCommand, + aParams ); + + launchMutex.Signal(); + launchMutex.Close(); + + return error; + } + + + +// -------------------------------------------------------------- +// BSProcessStarter::ConnectToServer() +// -------------------------------------------------------------- +// +TInt BSProcessStarter::ConnectToServer( + const TDesC& aFullExePath, + const TDesC& aCommand, + const TArray< TProcessStartupParam >* aParams, + RSessionBase& aSessionToConnect, + const TDesC& aServerName, + const TVersion& aClientVersion, + TInt aAsyncMessageSlots ) + { + if( aSessionToConnect.Handle() != KNullHandle ) + { + return KErrInUse; + } + + TInt err = KErrNone; + TInt startupWait = KEka2SrvConnInitialRetryWait; + + //Server connect and launch loop + for( TInt trie = 0 ; trie < KEka2SrvConnTries ; trie++ ) + { + REka2SessionBaseAccessor acc; + err = acc.CreateSession( aServerName, + aClientVersion, + aAsyncMessageSlots ); + + if( err == KErrNone ) + { + //session ownership is now on client + aSessionToConnect = acc; + return KErrNone; + } + + else if( ( err == KErrNotFound ) || + ( err == KErrServerTerminated ) ) + { + //Server missing or died when connecting + //Start a new server + err = BSProcessStarter::StartInstance( aFullExePath, + aCommand, + aParams ); + + //If process exist already, then all is fine + //(some other process started it between the origical connect and launch trie) + if( err == KErrAlreadyExists ) + { + err = KErrNone; + } + + //If server process start failed, bail out. + if( err != KErrNone ) + { + return err; + } + + //If this is 2nd or subsequent try, + //give some time for server to startup + if( trie > 0 ) + { + // Code scanner warning : Use of User::After (id:92) + // it is required to be used here + User::After( startupWait ); // CSI: 92 # See above + startupWait = 2 * startupWait; + } + } + + else + { + //Server process start failed. Bail out. + return err; + } + } + + return err; + } + + + +// -------------------------------------------------------------- +// BSProcessStarter::DoStartServerInstance() +// -------------------------------------------------------------- +// +TInt BSProcessStarter::DoStartInstance( + const TDesC& aFullExePath, + const TDesC& aCommand, + const TArray< TProcessStartupParam >* aParams ) + { + TInt error = KErrNone; + + //Create process + RProcess process; + error = process.Create( aFullExePath, aCommand ); + + if( error == KErrNone ) + { + //Set process startup parameters + error = ApplyParameters( aParams, process ); + + //And execute the process and wait it's startup + if( error == KErrNone ) + { + TRequestStatus rendezvousStatus; + process.Rendezvous( rendezvousStatus ); + + process.Resume(); + // Codescanner warning: user of User::WaitForRequest (Id:94) + // it is required to use at server startup + User::WaitForRequest( rendezvousStatus ); // CSI: 94 # See above + error = rendezvousStatus.Int(); + + if( process.ExitType() != EExitPending ) + { + //Something failed in server startup + //Force the error code to be always something + //else than KErrNone + if( error == KErrNone ) + { + error = KErrServerTerminated; + } + } + } + } + + process.Close(); + + return error; + } + + + +// -------------------------------------------------------------- +// BSProcessStarter::ApplyParameters() +// -------------------------------------------------------------- +// +TInt BSProcessStarter::ApplyParameters( + const TArray< TProcessStartupParam >* aParams, + RProcess& aProcess ) + { + TInt error = KErrNone; + if( aParams ) + { + const TInt paramCount = aParams->Count(); + for( TInt ix = 0; ix < paramCount; ix++ ) + { + error = (*aParams)[ ix ].ApplyParam( aProcess ); + if( error != KErrNone ) + { + break; + } + } + } + + return error; + } + + + +// ============================================================== +// ================== TPROCESSSTARTUPPARAM ====================== +// ============================================================== + +// -------------------------------------------------------------- +// TProcessStartupParam::TProcessStartupParam() +// -------------------------------------------------------------- +// +TProcessStartupParam::TProcessStartupParam() + : iType( EUnknown ), + iSlot( KErrNotFound ) + { + } + + +// -------------------------------------------------------------- +// TProcessStartupParam::Set() +// -------------------------------------------------------------- +// +void TProcessStartupParam::Set( TInt aSlot, + const RHandleBase& aHandle ) + { + iType = EHandle; + iSlot = aSlot; + iHandle = &aHandle; + } + + +// -------------------------------------------------------------- +// TProcessStartupParam::Set() +// -------------------------------------------------------------- +// +void TProcessStartupParam::Set( TInt aSlot, + const RSubSessionBase& aSubSession ) + { + iType = ESubSession; + iSlot = aSlot; + iSubSession = &aSubSession; + } + + +// -------------------------------------------------------------- +// TProcessStartupParam::Set() +// -------------------------------------------------------------- +// +void TProcessStartupParam::Set( TInt aSlot, + const TDesC16& aDes ) + { + iType = EDes16; + iSlot = aSlot; + iDes16.Set( aDes ); + } + + +// -------------------------------------------------------------- +// TProcessStartupParam::Set() +// -------------------------------------------------------------- +// +void TProcessStartupParam::Set( TInt aSlot, + const TDesC8& aDes ) + { + iType = EDes8; + iSlot = aSlot; + iDes8.Set( aDes ); + } + + +// -------------------------------------------------------------- +// TProcessStartupParam::Set() +// -------------------------------------------------------------- +// +void TProcessStartupParam::Set( TInt aSlot, + TInt aInt ) + { + iType = EInt; + iSlot = aSlot; + iInt = aInt; + } + + +// -------------------------------------------------------------- +// TProcessStartupParam::ApplyParam() +// -------------------------------------------------------------- +// +TInt TProcessStartupParam::ApplyParam( RProcess& aProcess ) const + { + switch( iType ) + { + case EHandle: return aProcess.SetParameter( iSlot, *iHandle ); + case ESubSession: return aProcess.SetParameter( iSlot, *iSubSession ); + case EDes16: return aProcess.SetParameter( iSlot, iDes16 ); + case EDes8: return aProcess.SetParameter( iSlot, iDes8 ); + case EInt: return aProcess.SetParameter( iSlot, iInt ); + } + + return KErrUnknown; + } + + +// END OF FILE + + + diff -r 000000000000 -r e6b17d312c8b brandingserver/bsclient/bsprocessstarter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/brandingserver/bsclient/bsprocessstarter.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,104 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: bsprocessstarter.h +* +*/ +#ifndef __PROCESSSTARTER_H__ +#define __PROCESSSTARTER_H__ + +#include +class TProcessStartupParam; + + + +/** + * Generic process starter. + */ +class BSProcessStarter + { + public: // New methods + + static void FullExePathForClienLocation( + const TDesC& aExeName, + TFileName& aFullExePath ); + + static TInt StartInstance( + const TDesC& aFullExePath, + const TDesC& aCommand, + const TArray< TProcessStartupParam >* aParams ); + + static TInt ConnectToServer( + const TDesC& aFullExePath, + const TDesC& aCommand, + const TArray< TProcessStartupParam >* aParams, + RSessionBase& aSessionToConnect, + const TDesC& aServerName, + const TVersion& aClientVersion, + TInt aAsyncMessageSlots ); + + + + private: // Helpers + static TInt DoStartInstance( + const TDesC& aFullExePath, + const TDesC& aCommand, + const TArray< TProcessStartupParam >* aParams ); + + static TInt ApplyParameters( + const TArray< TProcessStartupParam >* aParams, + RProcess& aProcess ); + + }; + + + + +/** + * Generic process startup parameters. + */ +class TProcessStartupParam + { + public: + + TProcessStartupParam(); + void Set( TInt aSlot, const RHandleBase& aHandle ); + void Set( TInt aSlot, const RSubSessionBase& aSubSession ); + void Set( TInt aSlot, const TDesC16& aDes ); + void Set( TInt aSlot, const TDesC8& aDes ); + void Set( TInt aSlot, TInt aInt ); + TInt ApplyParam( RProcess& aProcess ) const; + + + + private: //data + + enum TParamType{ EUnknown, EHandle, ESubSession, + EDes16, EDes8, EInt }; + + TParamType iType; + TInt iSlot; + const RHandleBase* iHandle; + const RSubSessionBase* iSubSession; + TPtrC16 iDes16; + TPtrC8 iDes8; + TInt iInt; + }; + + +#endif // __PROCESSSTARTER_H__ + + +//END OF FILE + + diff -r 000000000000 -r e6b17d312c8b brandingserver/bsclient/cbsaccess.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/brandingserver/bsclient/cbsaccess.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,291 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: CBSAccess.cpp +* +*/ + + +// INCLUDE FILES + +#include +#include // skins +#include +#include + +#include "cbsaccess.h" +#include "cbsbitmap.h" +#include "debugtrace.h" +#include "mbsaccess.h" +#include "mbsupdater.h" +#include "cbsiconfileprovider.h" + +void Panic(TInt aPanic) + { + _LIT( KPanic, "CBS" ); + User::Panic( KPanic, aPanic ); + } + +// Two-phased constructor. +CBSAccess* CBSAccess::NewL( const TDesC8& aBrandId, + const TDesC8& aAppId, + const TDesC8& aDefaultBrandId, + TLanguage aLanguageId, + TBool aCacheData, + TInt aReserved ) + { + CBSAccess* self = new ( ELeave ) CBSAccess( aLanguageId, aCacheData, aReserved) ; + CleanupStack::PushL( self ); + self->ConstructL( aBrandId, aAppId, aDefaultBrandId ); + CleanupStack::Pop( self ); //self + return self; + } + +// Symbian OS default constructor can leave. +void CBSAccess::ConstructL( const TDesC8& aBrandId, const TDesC8& aAppId, + const TDesC8& aDefaultBrandId ) + { + iBrand = aBrandId.AllocL(); + iDefaultBrand = aDefaultBrandId.AllocL(); + iAppId = aAppId.AllocL(); + User::LeaveIfError( iClient.Connect() ); + + iClient.StartTransactionL( *iAppId, *iBrand, aDefaultBrandId, + iLanguageId, EBSTxAccess, iReserved ); + } + +// Destructor +CBSAccess::~CBSAccess() + { + delete iBrand; + delete iDefaultBrand; + delete iAppId; + iClient.Close(); + } + +// C++ default constructor can NOT contain any code, that +// might leave. +// +CBSAccess::CBSAccess( TLanguage aLanguageId, TBool aCacheData, TInt aReserved ) +: iLanguageId( aLanguageId ), iUseCache( aCacheData ), iReserved( aReserved ) + { + } + +// ----------------------------------------------------------------------------- +// CBSAccess::Close() +// ----------------------------------------------------------------------------- +// +void CBSAccess::Close() + { + delete this; + } + +// ----------------------------------------------------------------------------- +// CBSAccess::GetTextL() +// ----------------------------------------------------------------------------- +// +HBufC* CBSAccess::GetTextL( const TDesC8& aId ) + { + HBufC* buffer = NULL; + + iClient.GetTextL( aId, buffer ); + + TRACE( T_LIT("iClient.GetText( iBrandId, aId, buffer )") ); + return buffer; + } + +// ----------------------------------------------------------------------------- +// CBSAccess::GetTextLC() +// ----------------------------------------------------------------------------- +// +HBufC* CBSAccess::GetTextLC( const TDesC8& aId ) + { + HBufC* buffer = NULL; + iClient.GetTextL( aId, buffer ); + TRACE( T_LIT("iClient.GetText( aBrandId, aId, buffer )") ); + + CleanupStack::PushL( buffer ); + return buffer; + } + + +// ----------------------------------------------------------------------------- +// CBSAccess::GetIntL() +// ----------------------------------------------------------------------------- +// +TInt CBSAccess::GetIntL( const TDesC8& aId ) + { + TInt value = 0; + + iClient.GetIntL( aId, value ); + return value; + } + +TInt CBSAccess :: isBrandUpdateRequiredL () +{ + TInt updateRequired = -1; + iClient.isBrandUpdateRequiredL (updateRequired); + return updateRequired; + +} + +// ----------------------------------------------------------------------------- +// CBSAccess::GetSeveralIntL() +// ----------------------------------------------------------------------------- +// +MBSElement* CBSAccess::GetSeveralL( MDesC8Array& aIds ) + { + MBSElement* returnValue = iClient.GetSeveralL( aIds ); + return returnValue; + } + +// ----------------------------------------------------------------------------- +// CBSAccess::GetFileL() +// ----------------------------------------------------------------------------- +// +void CBSAccess::GetFileL( const TDesC8& aId, + RFile& aFile ) + { + iClient.GetFileL( aId, aFile ); + } + +// ----------------------------------------------------------------------------- +// CBSAccess::GetStructureL() +// ----------------------------------------------------------------------------- +// +MBSElement* CBSAccess::GetStructureL( const TDesC8& aId ) + { + MBSElement* returnValue = NULL; + + returnValue = iClient.GetStructureL( aId ); + + return returnValue; + + } + +// ----------------------------------------------------------------------------- +// CBSAccess::GetBufferL() +// ----------------------------------------------------------------------------- +// +HBufC8* CBSAccess::GetBufferL( const TDesC8& aId ) + { + HBufC8* buffer = NULL; + iClient.GetBufferL( aId, buffer ); + return buffer; + } + +// ----------------------------------------------------------------------------- +// CBSAccess::GetBufferLC() +// ----------------------------------------------------------------------------- +// +HBufC8* CBSAccess::GetBufferLC( const TDesC8& aId ) + { + HBufC8* buffer = GetBufferL( aId ); + CleanupStack::PushL( buffer ); + return buffer; + } + +// ----------------------------------------------------------------------------- +// CBSAccess::RegisterObserverL() +// ----------------------------------------------------------------------------- +// +void CBSAccess::RegisterObserverL( MBSBrandChangeObserver* aObserver, MBSBackupRestoreStateObserver* aBackupObserver) + { + iClient.RegisterObserverL( aObserver, aBackupObserver ); + } + +// ----------------------------------------------------------------------------- +// CBSAccess::UnRegisterObserverL() +// ----------------------------------------------------------------------------- +// +void CBSAccess::UnRegisterObserverL( MBSBrandChangeObserver* aObserver, MBSBackupRestoreStateObserver* aBackupObserver ) + { + iClient.UnRegisterObserverL( aObserver, aBackupObserver ); + } + +// ----------------------------------------------------------------------------- +// CBSAccess::GetBitmapL() +// ----------------------------------------------------------------------------- +// +void CBSAccess::GetBitmapL( const TDesC8& aBitmapId, + CFbsBitmap*& aBitmap, + CFbsBitmap*& aMask ) + { + TBool useSkins = ETrue; + CCoeEnv* coeEnv = CCoeEnv::Static(); + if( !coeEnv ) + { + TRACE( T_LIT("GETBITMAPL NO COE ENV ") ); + // no CONE -> don't try to use skins + useSkins = EFalse; + } + + MBSElement* bitmapItem = NULL; + + // get the structure containing the info for the bitmap + bitmapItem = GetStructureL( aBitmapId ); + CleanupClosePushL( *bitmapItem ); + + // get the list from the bitmap element + const CBSBitmap* bitmap = &bitmapItem->BitmapDataL(); + + RFile bitmapFile; + + // we need to get the bitmap file from where we can load the bitmap + GetFileL( bitmap->BitmapFileId(), bitmapFile ); + + TInt err = KErrNotFound; + CFbsBitmap* skinBitmap = NULL; + if( useSkins ) + { + MAknsSkinInstance* skin = AknsUtils::SkinInstance(); + + TAknsItemID itemId; + itemId.Set( bitmap->SkinIdMajor(), bitmap->SkinIdMinor() ); + + // Codescanner warning: neglected to put variable on cleanup stack (id:35) + // This method cannot leave after this line if the bitmap is created + TRAP( err, skinBitmap = AknsUtils::CreateBitmapL( skin, itemId ) ); // CSI: 35 # See above + } + // if useSkins is TRUE that means there is a COE Env, and icons can be created + // otherwise, without CoeEnv, we cannot create icons, hence leave + if( err == KErrNotFound && useSkins) + { + // no skin bitmap found + + // icon server take ownership of of icon file provider + CBSIconFileProvider* ifp = CBSIconFileProvider::NewL( bitmapFile ); + CleanupStack::PushL( ifp ); + + AknIconUtils::CreateIconLC( aBitmap, aMask, + *ifp, + bitmap->BitmapId(), bitmap->BitmapMaskId() ); + + CleanupStack::Pop( 2 ); // aBitmap, aMask + CleanupStack::Pop(ifp) ; + } + else if( err ) + { + User::Leave( err ); + } + else + { + aBitmap = skinBitmap; + aMask = NULL; + } + bitmapFile.Close() ; + CleanupStack::PopAndDestroy(); // structure + } + +// END OF FILE + diff -r 000000000000 -r e6b17d312c8b brandingserver/bsclient/cbsaccess.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/brandingserver/bsclient/cbsaccess.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,168 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: cbsaccess.h +* +* Description: cbsaccess.h +* +*/ + + +#ifndef __CBSACCESS_H__ +#define __CBSACCESS_H__ +#include +#include "mbsaccess.h" +#include "cbsclient.h" + + +// Forward declarations +class CFbsBitmap; + +/** + * + */ +NONSHARABLE_CLASS( CBSAccess ): public CBase, + public MBSAccess + { + public: + /** + * Two-phased constructor. + */ + static CBSAccess* NewL( const TDesC8& aBrandId, + const TDesC8& aAppId, + const TDesC8& aDefaultBrandId, + TLanguage aLanguageId, + TBool aCacheData, + TInt aReserved = 0 ); + + // destructor + virtual ~CBSAccess(); + + /* + * Close + */ + void Close(); + + private: + + void ConstructL( const TDesC8& aBrandId, + const TDesC8& aAppId, + const TDesC8& aDefaultBrandId ); + CBSAccess( TLanguage aLanguageId, TBool aCacheData, TInt aReserved = 0); + + + private: // from MBranding + + /* + * Get text type item + * @param aId ID of the item + * @return the text item + */ + HBufC* GetTextL( const TDesC8& aId ); + + /* + * Get text type item + * @param aId ID of the item + * @return the text item + */ + HBufC* GetTextLC( const TDesC8& aId ); + + /* + * Get 8-bit data type item + * @param aId ID of the item + * @return the data buffer item + */ + HBufC8* GetBufferL( const TDesC8& aId ); + + /* + * Get 8-bit data type item + * @param aId ID of the item + * @return the data buffer item + */ + HBufC8* GetBufferLC( const TDesC8& aId ); + + /* + * Get integer type item + * @param aId ID of the item + * @return the integer item + */ + TInt GetIntL( const TDesC8& aId ); + + + /* + * Get an array of items + * @param aIds ID's of the items + * @return the items + */ + MBSElement* GetSeveralL( MDesC8Array& aIds ); + + /* + * Get a file item + * @param aId ID of the item + * @param aFile on return will contain an open file handle + * to the file + */ + void GetFileL( const TDesC8& aId, RFile& aFile ); + + /* + * Get a structure type item + * @param aIds ID of the item + * @param aFile on return will contain the strucure type item + * @return structure branding element + */ + MBSElement* GetStructureL( const TDesC8& aId ); + + /* + * Register to observer brand data updates + * @param aObserver the observer interface + */ + void RegisterObserverL( MBSBrandChangeObserver* aObserver, MBSBackupRestoreStateObserver *aBackupObserver ); + + /* + * Unregister a brand data update observer + * @param aObserver the observer interface + */ + void UnRegisterObserverL( MBSBrandChangeObserver* aObserver, MBSBackupRestoreStateObserver *aBackupObserver); + + /* + * Get a bitmap type item + * @param aBitmapId the ID of the bitmap item itself + * @param aBitmap on return will contain the bitmap + * @param aMask on return will contain the mask + */ + void GetBitmapL( const TDesC8& aBitmapId, + CFbsBitmap*& aBitmap, + CFbsBitmap*& aMask ); + + + + TInt isBrandUpdateRequiredL (); + + + public: // New methods + + + + private: // data + HBufC8* iBrand; + HBufC8* iDefaultBrand; + HBufC8* iAppId; + TLanguage iLanguageId; + TBool iUseCache; + RBSClient iClient; + TInt iReserved; + }; + +#endif // __CBSACCESS_H__ + + +// END OF FILE + diff -r 000000000000 -r e6b17d312c8b brandingserver/bsclient/cbsbitmap.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/brandingserver/bsclient/cbsbitmap.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,135 @@ +/* +* Copyright (c) 2006-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: cbsbitmap.cpp +* +*/ + + +// INCLUDE FILES + +#include "e32base.h" +#include "cbsbitmap.h" + +// ----------------------------------------------------------------------------- +// CBSBitmap::NewLC +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +EXPORT_C CBSBitmap* CBSBitmap::NewLC( TInt aBitmapId, + TInt aBitmapMaskId, + TInt aSkinId, + TInt aSkinMaskId, + const TDesC8& aBitmapFileId ) + { + CBSBitmap* self = new ( ELeave ) CBSBitmap( aBitmapId, aBitmapMaskId, + aSkinId, aSkinMaskId ); + CleanupStack::PushL( self ); + self->ConstructL( aBitmapFileId ); + return self; + } + +// ----------------------------------------------------------------------------- +// CBSBitmap::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +EXPORT_C CBSBitmap* CBSBitmap::NewL( TInt aBitmapId, + TInt aBitmapMaskId, + TInt aSkinIdMajor, + TInt aSkinIdMinor, + const TDesC8& aBitmapFileId ) + { + CBSBitmap* self = NewLC( aBitmapId, + aBitmapMaskId, + aSkinIdMajor, + aSkinIdMinor, + aBitmapFileId ); + CleanupStack::Pop(); + return self; + } + + +// Symbian OS default constructor can leave. +void CBSBitmap::ConstructL( const TDesC8& aBitmapFileId ) + { + iBitmapFileId = aBitmapFileId.AllocL(); + } + +// destructor +CBSBitmap::~CBSBitmap() + { + delete iBitmapFileId; + } + +// C++ default constructor can NOT contain any code, that +// might leave. +// +CBSBitmap::CBSBitmap( TInt aBitmapId, + TInt aBitmapMaskId, + TInt aSkinIdMajor, + TInt aSkinIdMinor ) +: iBitmapId( aBitmapId), iBitmapMaskId( aBitmapMaskId ), + iSkinIdMajor( aSkinIdMajor ), iSkinIdMinor( aSkinIdMinor ) + { + } + + +// ----------------------------------------------------------------------------- +// CBSBitmap::BitmapId() +// ----------------------------------------------------------------------------- +// +EXPORT_C TInt CBSBitmap::BitmapId() const + { + return iBitmapId; + } + +// ----------------------------------------------------------------------------- +// CBSBitmap::BitmapMaskId() +// ----------------------------------------------------------------------------- +// +EXPORT_C TInt CBSBitmap::BitmapMaskId() const + { + return iBitmapMaskId; + } + +// ----------------------------------------------------------------------------- +// CBSBitmap::SkinId() +// ----------------------------------------------------------------------------- +// +EXPORT_C TInt CBSBitmap::SkinIdMajor() const + { + return iSkinIdMajor; + } + +// ----------------------------------------------------------------------------- +// CBSBitmap::SkinMaskId() +// ----------------------------------------------------------------------------- +// +EXPORT_C TInt CBSBitmap::SkinIdMinor() const + { + return iSkinIdMinor; + } + +// ----------------------------------------------------------------------------- +// CBSBitmap::BitmapFileId() +// ----------------------------------------------------------------------------- +// +EXPORT_C const TDesC8& CBSBitmap::BitmapFileId() const + { + return *iBitmapFileId; + } + + + +// END OF FILE diff -r 000000000000 -r e6b17d312c8b brandingserver/bsclient/cbsbrandobserver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/brandingserver/bsclient/cbsbrandobserver.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,98 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: cbsbrandobserver.cpp +* +*/ +// INCLUDE FILES + +#include "cbsbrandobserver.h" +#include +#include +#include "mbsbrandobserverregistrar.h" + +CBSBrandObserver* CBSBrandObserver::NewL( MBSBrandChangeObserver* aObserver, + MBSBackupRestoreStateObserver* aBackupObserver, + MBSBrandObserverRegistrar* aRegistrar ) + { + CBSBrandObserver* self = new ( ELeave ) CBSBrandObserver( aObserver, aBackupObserver, aRegistrar ) ; + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); //self + return self; + } + + +void CBSBrandObserver::ConstructL() + { + iContinueBackupStateObserving = ETrue ; + iContinueDataUpdateObserving = ETrue ; + + CActiveScheduler::Add( this ); + iRegistrar->RegisterObserverToServerL( iStatus ); + SetActive(); + } + + +CBSBrandObserver::~CBSBrandObserver() + { + Cancel(); + } + + +CBSBrandObserver::CBSBrandObserver( MBSBrandChangeObserver* aObserver, + MBSBackupRestoreStateObserver* aBackupObserver, + MBSBrandObserverRegistrar* aRegistrar ) +: CActive( CActive::EPriorityIdle ), iObserver( aObserver ), iBackupObserver( aBackupObserver ), + iRegistrar( aRegistrar ) + { + } + +void CBSBrandObserver::RunL() + { + + // Pankaj - chk for what has changed.. + TInt isBackupRestore = iRegistrar->GetBackupRestoreL() ; + if(isBackupRestore) + { + // if client donot want to listen backup state event any more donot call its observer.. + if(iBackupObserver && iContinueBackupStateObserving) + { + TInt activeState = iRegistrar->GetBackupStateL() ; + iContinueBackupStateObserving = iBackupObserver->BackupRestoreActivated(activeState) ; + } + } + else + { + // if client donot want to listen update data event any more donot call its observer.. + if(iObserver && iContinueDataUpdateObserving) + { + TInt newVersion = iRegistrar->GetNewVersionL(); + iContinueDataUpdateObserving = iObserver->BrandUpdateAvailable( newVersion ) ; + } + } + + if(iContinueBackupStateObserving || iContinueDataUpdateObserving) + { + iRegistrar->RegisterObserverToServerL( iStatus ); + SetActive(); + } + } + +void CBSBrandObserver::DoCancel() + { + + } + + +// END OF FILE diff -r 000000000000 -r e6b17d312c8b brandingserver/bsclient/cbsbrandobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/brandingserver/bsclient/cbsbrandobserver.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,78 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: CBSBrandObserver.h +* +*/ + + +#ifndef __CBSBRANDOBSERVER_H__ +#define __CBSBRANDOBSERVER_H__ +#include +#include + +class MBSBrandChangeObserver; +class MBSBackupRestoreStateObserver; +class MBSBrandObserverRegistrar; + +/** + * + */ +NONSHARABLE_CLASS( CBSBrandObserver ): public CActive + { + public: + /** + * Two-phased constructor. + */ + static CBSBrandObserver* NewL( MBSBrandChangeObserver* aObserver, + MBSBackupRestoreStateObserver* aBackupObserver, + MBSBrandObserverRegistrar* aRegistrar ); + + virtual ~CBSBrandObserver(); + + public: // From CActive + + void RunL(); + void DoCancel(); + + private: + CBSBrandObserver( MBSBrandChangeObserver* aObserver, + MBSBackupRestoreStateObserver* aBackupObserver, + MBSBrandObserverRegistrar* aRegistrar ); + + + void ConstructL(); + + private: + + + private: // data + + // doesn't own: observer + MBSBrandChangeObserver* iObserver ; + + // doesn't own: observer + MBSBackupRestoreStateObserver* iBackupObserver ; + + // doesn't own: registrar + MBSBrandObserverRegistrar* iRegistrar; + + TBool iContinueBackupStateObserving ; + TBool iContinueDataUpdateObserving ; + }; + +#endif // __CBSBRANDOBSERVER_H__ + + +// END OF FILE + diff -r 000000000000 -r e6b17d312c8b brandingserver/bsclient/cbsclient.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/brandingserver/bsclient/cbsclient.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,753 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: CBSClient.cpp +* +*/ + + +// INCLUDE FILES +#include "cbsclient.h" +#include "bsclientdefs.h" +#include "bsprocessstarter.h" +#include "bsserverdefs.h" +#include "mbselement.h" +#include "bselementfactory.h" +#include "cbsbitmap.h" +#include "cbsbrandobserver.h" +#include +#include +#include "debugtrace.h" + +// ============================================================== +// ======================== CLIENT ============================== +// ============================================================== + +// Destructor +RBSClient::~RBSClient() + { +#if _BullseyeCoverage + cov_write(); +#endif + } + +// C++ default constructor can NOT contain any code, that +// might leave. +// +RBSClient::RBSClient() + { + } + + +// ----------------------------------------------------------------------------- +// RBSClient::Connect() +// ----------------------------------------------------------------------------- +// +TInt RBSClient::Connect() + { + TRACE( T_LIT("RBSClient::Connect() begin") ); + TFileName fullExePath; + BSProcessStarter::FullExePathForClienLocation( KBSServerExe, + fullExePath ); + + return BSProcessStarter::ConnectToServer( fullExePath, + KNullDesC, + NULL, + *this, + KBSServerName, + TVersion( KBSVersionMajor, + KBSVersionMinor, + KBSVersionBuild ), + KBSMsgSlotCount ); + } + + +// ----------------------------------------------------------------------------- +// RBSClient::Close() +// ----------------------------------------------------------------------------- +// +void RBSClient::Close() + { + TRACE( T_LIT("RBSClient::Close() begin") ); + RSessionBase::Close(); + } + + +// ----------------------------------------------------------------------------- +// RBSClient::Close() +// ----------------------------------------------------------------------------- +// +void RBSClient::StartTransactionL( const TDesC8& aApplicationId, + const TDesC8& aBrandId, + const TDesC8& aDefaultBrandId, + TLanguage aLanguage, + TTransactionType aType, + TInt aReserved ) + { + TRACE( T_LIT("RBSClient::StartTransactionL() begin") ); + InitClientL( aApplicationId, aBrandId, aDefaultBrandId, + aLanguage, aType, aReserved ); + } + +// ----------------------------------------------------------------------------- +// RBSClient::Close() +// ----------------------------------------------------------------------------- +// +TInt RBSClient::StopTransactionL( const TDesC8& /*aApplicationId*/, + const TDesC8& /*aBrandId*/, + TLanguage /*aLanguage*/, + TInt /*aReserved*/ ) + { + TRACE( T_LIT("RBSClient::StopTransactionL() begin") ); + TInt returnValue = 0; + TPckg pack( returnValue ); + TIpcArgs args( &pack ); + TInt err = SendReceive( EBSStopTransaction, args ); + User::LeaveIfError( err ); + return returnValue; + } + +// ----------------------------------------------------------------------------- +// RBSClient::Close() +// ----------------------------------------------------------------------------- +// +void RBSClient::CancelTransactionL( const TDesC8& aApplicationId, + const TDesC8& aBrandId, + TLanguage aLanguage, + TInt aReserved ) + { + TIpcArgs args = CreateArgumentsL( aApplicationId, aBrandId, + aLanguage, aReserved ); + + TInt err = SendReceive( EBSCancelTransaction, args ); + User::LeaveIfError( err ); + } + +// ----------------------------------------------------------------------------- +// RBSClient::InitClientL() +// ----------------------------------------------------------------------------- +// +void RBSClient::InitClientL( const TDesC8& aApplicationId, + const TDesC8& aBrandId, + const TDesC8& aDefaultBrandId, + TLanguage aLanguage, + TTransactionType aType, + TInt aReserved ) + { + TRACE( T_LIT("RBSClient::InitClientL() begin aAppId[%S],aBrandId[%S],TAType[%d]"),&aApplicationId,&aBrandId,aType ); + CBufFlat* flatBuf = CBufFlat::NewL( aDefaultBrandId.Length() + aBrandId.Length() + 2 ); + CleanupStack::PushL( flatBuf ); + + RBufWriteStream stream; + CleanupClosePushL( stream ); + stream.Open( *flatBuf ); + stream.WriteInt16L( aBrandId.Length() ); + stream.WriteL( aBrandId ); + stream.WriteInt16L( aDefaultBrandId.Length() ); + stream.WriteL( aDefaultBrandId ); + + TPtr8 ptrElement( flatBuf->Ptr(0) ); + + // set the arguments for the message + TIpcArgs args( &aApplicationId ); + args.Set( 1, &ptrElement ); + args.Set( 2, aLanguage ); + args.Set( 3, aReserved ); + + TInt operation = 0; + switch( aType ) + { + case EBSTxInstall: + { + operation = EBSInitInstall; + break; + } + case EBSTxUninstall: + { + operation = EBSInitUninstall; + break; + } + case EBSTxAppend: + { + operation = EBSInitAppend; + break; + } + case EBSTxReplace: + { + operation = EBSInitReplace; + break; + } + case EBSTxAccess: + { + operation = EBSInitAccess; + break; + } + default: + { + User::Leave( KErrArgument ); + break; + } + } + TInt err = SendReceive( operation, args ); + TRACE( T_LIT("RBSClient::InitClientL() 1st SendReceive err=%d"),err ); + CleanupStack::PopAndDestroy( 2, flatBuf ); // stream, flatBuf + + User::LeaveIfError( err ); + + User::LeaveIfError( SendReceive( EBSStartTransaction ) ); + TRACE( T_LIT("RBSClient::InitClientL() end") ); + } + +// ----------------------------------------------------------------------------- +// RBSClient::CreateArgumentsL() +// ----------------------------------------------------------------------------- +// +TIpcArgs RBSClient::CreateArgumentsL( const TDesC8& aApplicationId, + const TDesC8& aBrandId, + TLanguage aLanguage, + TInt aReserved ) + { + // set the arguments for the message + TIpcArgs args( &aApplicationId ); + args.Set( 1, &aBrandId ); + args.Set( 2, aLanguage ); + args.Set( 3, aReserved ); + + return args; + } + + +// ----------------------------------------------------------------------------- +// RBSClient::InsertL() +// ----------------------------------------------------------------------------- +// +void RBSClient::InsertL( MBSElement* aElement ) + { + SendUpdateL( aElement, EBSInstall ); + } + + +// ----------------------------------------------------------------------------- +// RBSClient::ReplaceL() +// ----------------------------------------------------------------------------- +// +void RBSClient::ReplaceL( MBSElement* aElement ) + { + SendUpdateL( aElement, EBSReplace ); + } + +// ----------------------------------------------------------------------------- +// RBSClient::AppendL() +// ----------------------------------------------------------------------------- +// +void RBSClient::AppendL( MBSElement* aElement ) + { + SendUpdateL( aElement, EBSAppend ); + } + +// ----------------------------------------------------------------------------- +// RBSClient::SendUpdateL() +// ----------------------------------------------------------------------------- +// +void RBSClient::SendUpdateL( MBSElement* aElement, TBSMessages aMessage ) + { + // FIXME magic number + CBufFlat* flatBuf = CBufFlat::NewL( 128 ); + CleanupStack::PushL( flatBuf ); + + RBufWriteStream elementStream; + CleanupClosePushL( elementStream ); + elementStream.Open( *flatBuf ); + + aElement->ExternalizeL( elementStream ); + + TPtr8 ptrElement( flatBuf->Ptr(0) ); + TIpcArgs args( &ptrElement ); + + TInt err = SendReceive( aMessage, args ); + + CleanupStack::PopAndDestroy(); // elementStream + CleanupStack::PopAndDestroy( flatBuf ); + User::LeaveIfError( err ); + } + +// ----------------------------------------------------------------------------- +// RBSClient::GetTextL() +// ----------------------------------------------------------------------------- +// +void RBSClient::GetTextL( const TDesC8& aId, HBufC*& aValue ) + { + TInt size = 0; + TPckg pack( size ); + + TIpcArgs args( &aId ); + args.Set( 1, &pack ); + TInt err = SendReceive( EBSPrepareText, args ); + User::LeaveIfError( err ); + + aValue = HBufC::NewL( size ); + TPtr ptrBuf( aValue->Des() ); + + args.Set( 2, &ptrBuf ); + err = SendReceive( EBSGetText, args ); + + if( err ) + { + delete aValue; + aValue = NULL; + User::Leave( err ); + } + } + +// ----------------------------------------------------------------------------- +// RBSClient::GetIntL() +// ----------------------------------------------------------------------------- +// +void RBSClient::GetIntL( const TDesC8& aId, TInt& aValue ) + { + TPckg pack( aValue ); + TIpcArgs args( &aId); + args.Set( 1, &pack ); + TInt err = SendReceive( EBSGetInt, args ); + User::LeaveIfError( err ); + } + +void RBSClient :: isBrandUpdateRequiredL (TInt & aUpdateRequired) +{ + //TIpcArgs args; + + TPckg pack (aUpdateRequired); + //args.Set (0, &pack); + TInt err = SendReceive (EBSIsBrandUpdateRequired, TIpcArgs (&pack)); + + User :: LeaveIfError (err); +} +// ----------------------------------------------------------------------------- +// RBSClient::GetTextL() +// ----------------------------------------------------------------------------- +// +void RBSClient::GetBufferL( const TDesC8& aId, HBufC8*& aValue ) + { + TInt size = 0; + TPckg pack( size ); + + TIpcArgs args( &aId ); + args.Set( 1, &pack ); + TInt err = SendReceive( EBSPrepareBuffer, args ); + User::LeaveIfError( err ); + + aValue = HBufC8::NewL( size ); + TPtr8 ptrBuf( aValue->Des() ); + + args.Set( 2, &ptrBuf ); + err = SendReceive( EBSGetBuffer, args ); + + if( err ) + { + delete aValue; + aValue = NULL; + User::Leave( err ); + } + } + +// ----------------------------------------------------------------------------- +// RBSClient::GetSeveralL() +// ----------------------------------------------------------------------------- +// +MBSElement* RBSClient::GetSeveralL( MDesC8Array& aIds ) + { + TInt size = 0; + + TPckg pack( size ); + TIpcArgs args; + args.Set( 0, &pack ); + + + // FIXME magic number + CBufFlat* flatBuf = CBufFlat::NewL( 128 ); + CleanupStack::PushL( flatBuf ); + + RBufWriteStream idStream; + CleanupClosePushL( idStream ); + idStream.Open( *flatBuf ); + + ExternalizeIdArrayL( idStream, aIds ); + + TPtr8 flatPtr = flatBuf->Ptr(0); + args.Set( 1, &flatPtr ); + // get the size of the data + TInt err = SendReceive( EBSPrepareSeveral, args ); + + CleanupStack::PopAndDestroy(); // idStream + CleanupStack::PopAndDestroy( flatBuf ); + User::LeaveIfError( err ); + + HBufC8* buf = HBufC8::NewLC( size ); + TPtr8 ptrBuf( buf->Des() ); + + TIpcArgs msgArgs; + msgArgs.Set( 0, &ptrBuf ); + + err = SendReceive( EBSGetSeveral, msgArgs ); + + TInt length = buf->Size(); + + RDesReadStream readStream; + CleanupClosePushL( readStream ); + readStream.Open( *buf ); + + MBSElement* returnValue = InternalizeElementL( readStream ); + + CleanupStack::PopAndDestroy(); // readStream + CleanupStack::PopAndDestroy( buf ); // buf + + User::LeaveIfError( err ); + return returnValue; + } + + +// ----------------------------------------------------------------------------- +// RBSClient::GetFileL() +// ----------------------------------------------------------------------------- +// +void RBSClient::GetFileL( const TDesC8& aId, RFile& aFile ) + { + TInt fsh; + + TPckgBuf fh; + + TIpcArgs args( &fh ); + args.Set( 2, &aId ); + + fsh = SendReceive( EBSGetFile, args ); + TInt err = aFile.AdoptFromServer( fsh, fh() ); + + User::LeaveIfError( err ); + } + +// ----------------------------------------------------------------------------- +// RBSClient::GetStructureL() +// ----------------------------------------------------------------------------- +// +MBSElement* RBSClient::GetStructureL( const TDesC8& aId ) + { + TInt size = 0; + + TPckg pack( size ); + TIpcArgs args; + args.Set( 0, &pack ); + + args.Set( 1, &aId ); + // get the size of the data + TInt err = SendReceive( EBSPrepareStructure, args ); + + User::LeaveIfError( err ); + + + HBufC8* buf = HBufC8::NewLC( size ); + TPtr8 ptrBuf( buf->Des() ); + + TIpcArgs msgArgs; + msgArgs.Set( 0, &ptrBuf ); + + err = SendReceive( EBSGetStructure, msgArgs ); + + TInt length = buf->Size(); + + RDesReadStream readStream; + CleanupClosePushL( readStream ); + readStream.Open( *buf ); + + MBSElement* returnValue = InternalizeElementL( readStream ); + CleanupStack::PopAndDestroy(); // readStream + CleanupStack::PopAndDestroy( buf ); // buf + + User::LeaveIfError( err ); + + return returnValue; + } + +// ----------------------------------------------------------------------------- +// RBSClient::InternalizeElementL() +// ----------------------------------------------------------------------------- +// +MBSElement* RBSClient::InternalizeElementL( RReadStream& aStream ) + { + MBSElement* returnValue= NULL; + // Write common header for all elements + TBSElementType type = (TBSElementType)aStream.ReadInt16L(); + + TInt idSize = aStream.ReadInt16L(); + + HBufC8* elementId = HBufC8::NewLC( idSize ); + TPtr8 elementIdPtr = elementId->Des(); + + if( idSize > 0 ) + { + // read ID only if it's defined + aStream.ReadL( elementIdPtr, idSize ); + elementIdPtr.SetLength( idSize );// Set length + } + +// Ptr() returns a pointer to the start address of decriptor data, +// TPtrC constructor then parses the data until null terminator met. +// This results in wrong descriptor length & bad data! +// Solution is either +// 1) to use PtrZ() which appends a zero terminator, +// or 2) pass to constructor an object that has length data. +// Option 2) is less prone to errors, so use it. +// In general, assignment operator with descriptors should be avoided! +// So use TPtrC16(const TDesC16 &aDes) instead +// of TPtrC16(const TUint16 *aString)! + TPtrC8 idPtrC( *elementId );//idPtrC creation moved here so it will be updated correctly. + + if( elementId->Length() == 0 ) + { + CleanupStack::PopAndDestroy( elementId ); + elementId = NULL; + idPtrC.Set( KNullDesC8 ); + } + + // Write element type specific data + switch( type ) + { + case EBSInt: + { + TInt intData = aStream.ReadInt16L(); + returnValue = BSElementFactory::CreateBSElementL( idPtrC, + EBSInt, + intData ); + + break; + } + case EBSText: // flowthrough + case EBSFile: + { + TInt textSize = aStream.ReadInt16L(); + HBufC* textData = HBufC::NewLC( textSize ); + + TPtr textPtr = textData->Des(); + aStream.ReadL( textPtr, textSize ); + + returnValue = BSElementFactory::CreateBSElementL( idPtrC, + type, + *textData ); + CleanupStack::PopAndDestroy( textData ); + break; + } + case EBSList: + { + RBSObjOwningPtrArray listData; + CleanupClosePushL( listData ); + TInt count = aStream.ReadInt16L(); + + for( TInt i = 0; i < count; i++ ) + { + MBSElement* subElement = InternalizeElementL( aStream ); + CleanupClosePushL( *subElement ); + listData.AppendL( subElement ); + CleanupStack::Pop(); // subElement + } + + returnValue = BSElementFactory::CreateBSElementL( idPtrC, + EBSList, + listData ); + + CleanupStack::Pop(); // listData + + break; + } + + case EBSBuffer: + { + TInt bufferSize = aStream.ReadInt16L(); + HBufC8* buffeData = HBufC8::NewLC( bufferSize ); + + TPtr8 bufferPtr = buffeData->Des(); + aStream.ReadL( bufferPtr, bufferSize ); + + returnValue = BSElementFactory::CreateBSElementL( idPtrC, + EBSBuffer, + *buffeData ); + + CleanupStack::PopAndDestroy( buffeData ); + break; + } + + case EBSBitmap: + { + TInt length = aStream.ReadInt16L(); + HBufC8* fileId = HBufC8::NewLC( length ); + + TPtr8 fileIdPtr = fileId->Des(); + aStream.ReadL( fileIdPtr, length ); + + TInt bitmapId = aStream.ReadInt16L(); + TInt maskId = aStream.ReadInt16L(); + TInt skinId = aStream.ReadInt16L(); + TInt skinMaskId = aStream.ReadInt16L(); + + CBSBitmap* bitmap = CBSBitmap::NewLC( bitmapId, + maskId, + skinId, + skinMaskId, + fileIdPtr ); + + returnValue = BSElementFactory::CreateBSElementL( idPtrC, + EBSBitmap, + bitmap ); + CleanupStack::Pop( bitmap ); // bitmap + CleanupStack::PopAndDestroy( fileId ); // bitmap + + break; + } + + default: + { + // unknown type! + User::Leave( KErrCorrupt ); + break; + } + } + + if( elementId ) + { + CleanupStack::PopAndDestroy( elementId ); + } + + return returnValue; + } + + +// ----------------------------------------------------------------------------- +// RBSClient::InternalizeElementL() +// ----------------------------------------------------------------------------- +// +void RBSClient::ExternalizeIdArrayL( RWriteStream& aStream, MDesC8Array& aArray ) + { + TInt count = aArray.MdcaCount(); + aStream.WriteInt16L( count ); + + for( TInt i = 0; i < count; i++ ) + { + TPtrC8 ptr = aArray.MdcaPoint(i); + aStream.WriteInt16L( aArray.MdcaPoint( i ).Length() ); + aStream.WriteL( aArray.MdcaPoint( i ) ); + } + + } + +// ----------------------------------------------------------------------------- +// RBSClient::RemoveBrandL() +// ----------------------------------------------------------------------------- +// +void RBSClient::RemoveBrandL( const TDesC8& aApplicationId, + const TDesC8& aBrandId ) + { + // set the arguments for the message + TIpcArgs args( &aApplicationId ); + args.Set( 1, &aBrandId ); + TInt err = SendReceive( EBSRemoveBrand, args ); + User::LeaveIfError( err ); + } + +// ----------------------------------------------------------------------------- +// RBSClient::RemoveBrandsL() +// ----------------------------------------------------------------------------- +// +void RBSClient::RemoveBrandsL( const TDesC8& aApplicationId ) + { + // set the arguments for the message + TIpcArgs args( &aApplicationId ); + + TInt err = SendReceive( EBSRemoveApplication, args ); + User::LeaveIfError( err ); + } + +// ----------------------------------------------------------------------------- +// RBSClient::RegisterObserverL() +// ----------------------------------------------------------------------------- +// +void RBSClient::RegisterObserverL( MBSBrandChangeObserver* aObserver, MBSBackupRestoreStateObserver* aBackupStateObserver ) + { + CBSBrandObserver* tempObserver = CBSBrandObserver::NewL( aObserver, aBackupStateObserver, this ); + if( iObserver ) + { + delete iObserver; + } + iObserver = tempObserver; + } + +// ----------------------------------------------------------------------------- +// RBSClient::UnRegisterObserverL() +// ----------------------------------------------------------------------------- +// +void RBSClient::UnRegisterObserverL( MBSBrandChangeObserver* /*aObserver*/, MBSBackupRestoreStateObserver* /*aBackupStateObserver*/ ) + { + delete iObserver; + iObserver = NULL; + } + +// ----------------------------------------------------------------------------- +// RBSClient::UnRegisterObserverL() +// ----------------------------------------------------------------------------- +// +void RBSClient::RegisterObserverToServerL( TRequestStatus& aStatus ) + { + TIpcArgs args; + SendReceive( EBSObserveBrand, args, aStatus ); + } + +// ----------------------------------------------------------------------------- +// RBSClient::GetNewVersionL() +// ----------------------------------------------------------------------------- +// +TInt RBSClient::GetNewVersionL() + { + return GetValueL( EBSObserveGetNewVersion); + } + +// ----------------------------------------------------------------------------- +// RBSClient::GetValueL() +// ----------------------------------------------------------------------------- +// +TInt RBSClient::GetValueL(TInt msg) + { + TInt returnValue = 0; + TPckg pack( returnValue ); + TIpcArgs args( &pack ); + TInt err = SendReceive( msg, args ); + User::LeaveIfError( err ); + return returnValue; + } + +// ----------------------------------------------------------------------------- +// RBSClient::GetBackupStateL() +// ----------------------------------------------------------------------------- +// +TInt RBSClient::GetBackupStateL() + { + return GetValueL( EBSObserveGetBackupState); + } + +// ----------------------------------------------------------------------------- +// RBSClient::GetBackupRestoreL() +// ----------------------------------------------------------------------------- +// +TInt RBSClient::GetBackupRestoreL() + { + return GetValueL( EBSObserveGetChange); + } + +// END OF FILE + diff -r 000000000000 -r e6b17d312c8b brandingserver/bsclient/cbsclient.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/brandingserver/bsclient/cbsclient.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,143 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: CBSClient.h +* +*/ + + +#ifndef __CBSCLIENT_H__ +#define __CBSCLIENT_H__ +#include +#include +#include +#include +#include "mbsupdater.h" +#include "bsserverdefs.h" +#include "mbsbrandobserverregistrar.h" + +class MBSElement; +class MBSBrandChangeObserver; +class MBSBackupRestoreStateObserver; +class CBSBrandObserver; + +/** + * Simple ClientServer for + * testing and example purposes. + */ +class RBSClient : public RSessionBase, + public MBSBrandObserverRegistrar + { + + public: // Constructor and destructor + RBSClient(); + ~RBSClient(); + + + public: // New methods + + TInt Connect(); + void Close(); + + void StartTransactionL( const TDesC8& aApplicationId, + const TDesC8& aBrandId, + const TDesC8& aDefaultBrandId, + TLanguage aLanguage, + TTransactionType aType, + TInt aReserved = 0 ); + + TInt StopTransactionL( const TDesC8& aApplicationId, + const TDesC8& aBrandId, + TLanguage aLanguage, + TInt aReserved = 0 ); + + void CancelTransactionL( const TDesC8& aApplicationId, + const TDesC8& aBrandId, + TLanguage aLanguage, + TInt aReserved = 0); + + void InsertL( MBSElement* aElement ); + void ReplaceL( MBSElement* aElement ); + void AppendL( MBSElement* aElement ); + + void GetTextL( const TDesC8& aId, HBufC*& aValue ); + void GetBufferL( const TDesC8& aId, HBufC8*& aValue ); + void GetIntL( const TDesC8& aId, TInt& aValue ); + + MBSElement* GetSeveralL( MDesC8Array& aIds ); + MBSElement* GetStructureL( const TDesC8& aId ); + void GetFileL( const TDesC8& aId, RFile& aFile ); + + void RemoveBrandL( const TDesC8& aApplicationId, + const TDesC8& aBrandId ); + + void RemoveBrandsL( const TDesC8& aApplicationId ); + + void isBrandUpdateRequiredL (TInt& aUpdateRequired); + + /* + * Register to observer brand data updates + * @param aObserver the observer interface + */ + void RegisterObserverL( MBSBrandChangeObserver* aObserver, MBSBackupRestoreStateObserver* aBackupStateObserver); + + /* + * Unregister a brand data update observer + * @param aObserver the observer interface + */ + void UnRegisterObserverL( MBSBrandChangeObserver* aObserver, MBSBackupRestoreStateObserver* aBackupStateObserver ); + + + private: + + void InitClientL( const TDesC8& aApplicationId, + const TDesC8& aBrandId, + const TDesC8& aDefaultBrandId, + TLanguage aLanguage, + TTransactionType aType, + TInt aReserved ); + + TIpcArgs CreateArgumentsL( const TDesC8& aApplicationId, + const TDesC8& aBrandId, + TLanguage aLanguage, + TInt aReserved ); + + MBSElement* InternalizeElementL( RReadStream& aStream ); + + void ExternalizeIdArrayL( RWriteStream& aStream, MDesC8Array& aArray ); + + void SendUpdateL( MBSElement* aElement, TBSMessages aMessage ); + + private: // from MBSBrandObserverRegistrar + /* + * Registeres the brand observer to server + */ + void RegisterObserverToServerL( TRequestStatus& aStatus ); + + TInt GetNewVersionL(); + TInt GetValueL(TInt msg) ; + TInt GetBackupStateL() ; + TInt GetBackupRestoreL() ; + + + private: + TTransactionType iType; + CBSBrandObserver* iObserver; + TInt isUpdateRequired; + }; + +#endif // __CBSCLIENT_H__ + + +// END OF FILE + diff -r 000000000000 -r e6b17d312c8b brandingserver/bsclient/cbselement.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/brandingserver/bsclient/cbselement.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,343 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: cbselement.cpp +* +*/ +// INCLUDE FILES + +#include +#include "e32base.h" +#include "s32strm.h" +#include "cbselement.h" +#include "cbsbitmap.h" + + +CBSElement* CBSElement::NewL( + const TDesC8& aElementId, + TInt aData ) + { + + CBSElement* self = new ( ELeave ) CBSElement() ; + CleanupStack::PushL( self ); + self->ConstructL( EBSInt, + aElementId, + aData, + ETrue, + NULL, + KNullDesC, + KNullDesC8, + NULL ); + CleanupStack::Pop( self ); //self + return self; + } + + +CBSElement* CBSElement::NewL( + const TDesC8& aElementId, + const TDesC& aData, + TBSElementType aType /*= EText*/ ) + { + if( aType != EBSFile && aType != EBSText ) + { + User::Leave( KErrArgument ); + } + + CBSElement* self = new ( ELeave ) CBSElement() ; + CleanupStack::PushL( self ); + self->ConstructL( aType, + aElementId, + 0, + EFalse, + NULL, + aData, + KNullDesC8, + NULL); + CleanupStack::Pop( self ); //self + return self; + } + + +CBSElement* CBSElement::NewL( + const TDesC8& aElementId, + const TDesC8& aData ) + { + CBSElement* self = new ( ELeave ) CBSElement() ; + CleanupStack::PushL( self ); + self->ConstructL( EBSBuffer, + aElementId, + 0, + EFalse, + NULL, + KNullDesC, + aData, + NULL); + CleanupStack::Pop( self ); //self + return self; + } + +CBSElement* CBSElement::NewL( + const TDesC8& aElementId, + RBSObjOwningPtrArray& aStructure ) + { + CBSElement* self = new ( ELeave ) CBSElement(); + CleanupStack::PushL( self ); + self->ConstructL( EBSList, + aElementId, + 0, + EFalse, + NULL, + KNullDesC, + KNullDesC8, + &aStructure ); + CleanupStack::Pop( self ); //self + return self; + } + +CBSElement* CBSElement::NewL( + const TDesC8& aElementId, + CBSBitmap* aBitmap ) + { + CBSElement* self = new ( ELeave ) CBSElement() ; + CleanupStack::PushL( self ); + self->ConstructL( EBSBitmap, + aElementId, + 0, + EFalse, + aBitmap, + KNullDesC, + KNullDesC8, + NULL ); + + if( !aBitmap ) + { + User::Leave( KErrArgument ); + } + + CleanupStack::Pop( self ); //self + return self; + } + +void CBSElement::ConstructL( + TBSElementType aElementType, + const TDesC8& aElementId, + TInt aIntData, + TBool aIntDataInitialized, + CBSBitmap* aBitmap, + const TDesC& aTextData, + const TDesC8& aBufferData, + RBSObjOwningPtrArray* aStructure ) + { + iElementType = aElementType; + + iElementId = aElementId.AllocL(); + + iIntData = aIntData; + iIntDataInitialized = aIntDataInitialized; + + iBitmapData = aBitmap; + + if( 0 != aTextData.Compare( KNullDesC() ) ) + { + iTextData = aTextData.AllocL(); + } + if( 0 != aBufferData.Compare( KNullDesC8() ) ) + { + iBufferData = aBufferData.AllocL(); + } + if( aStructure ) + { + iArrayInitialized = ETrue; + iArray = *aStructure; + } + } + + +CBSElement::~CBSElement() + { + delete iTextData; + delete iBufferData; + delete iElementId; + + iArray.Close(); + delete iBitmapData; + } + + +CBSElement::CBSElement() + { + } + +void CBSElement::Close() + { + delete this; + } + + +TBSElementType CBSElement::ElementType() + { + return iElementType; + } + +const TDesC8& CBSElement::ElementId() + { + return *iElementId; + } + +TInt CBSElement::IntDataL() + { + if( !iIntDataInitialized ) + { + User::Leave( KErrArgument ); + } + return iIntData; + } + +const TDesC& CBSElement::TextDataL() + { + if( !iTextData ) + { + User::Leave( KErrArgument ); + } + return *iTextData; + } + +const TDesC8& CBSElement::BufferDataL() + { + if( !iBufferData ) + { + User::Leave( KErrArgument ); + } + return *iBufferData; + } + +const CBSBitmap& CBSElement::BitmapDataL() + { + if( !iBitmapData ) + { + User::Leave( KErrArgument ); + } + return *iBitmapData; + } + +TArray CBSElement::GetStructureL() + { + if( !iArrayInitialized ) + { + User::Leave( KErrArgument ); + } + + return iArray.Array(); + } + +const MBSElement& CBSElement::FindSubEntryL( const TDesC& aElementId ) + { + if ( !iArray.Count() ) + { + User::Leave( KErrNotFound ); + } + + MBSElement* element = NULL; + HBufC8* id = CnvUtfConverter::ConvertFromUnicodeToUtf8L( aElementId ); + User::LeaveIfNull( id ); + CleanupStack::PushL( id ); + for ( TInt i( 0 ) ; i < iArray.Count() ; i++ ) + { + if ( iArray[ i ] ) + { + if ( !iArray[ i ]->ElementId().CompareC( *id ) ) + { + // Match found + element = iArray[ i ]; + i = iArray.Count();// Exit loop. + } + } + } + CleanupStack::PopAndDestroy( id ); + + if ( !element ) + { + User::Leave( KErrNotFound ); + } + + return *element; + } + +void CBSElement::ExternalizeL( RWriteStream& aWriteStream ) + { + // Write common header for all elements + aWriteStream.WriteInt16L( iElementType ); + aWriteStream.WriteInt16L( iElementId->Length() ); + if( iElementId->Length() > 0 ) + { + // Write ID only if it's defined + aWriteStream.WriteL( *iElementId ); + } + + // Write element type specific data + switch( iElementType ) + { + case EBSInt: + { + aWriteStream.WriteInt16L( iIntData ); + break; + } + case EBSText: // flowthrough + case EBSFile: + { + aWriteStream.WriteInt16L( iTextData->Length() ); + aWriteStream.WriteL( *iTextData ); + break; + } + case EBSList: + { + TInt count = iArray.Count(); + aWriteStream.WriteInt16L( count ); + // Write all subitems to stream + for( TInt i = 0; i < count; i++ ) + { + MBSElement* element = iArray[i]; + element->ExternalizeL( aWriteStream ); + } + break; + } + case EBSBitmap: + { + TPtrC8 ptr = iBitmapData->BitmapFileId(); + aWriteStream.WriteInt16L( ptr.Length() ); + aWriteStream.WriteL( ptr ); + + aWriteStream.WriteInt16L( iBitmapData->BitmapId() ); + aWriteStream.WriteInt16L( iBitmapData->BitmapMaskId() ); + aWriteStream.WriteInt16L( iBitmapData->SkinIdMajor() ); + aWriteStream.WriteInt16L( iBitmapData->SkinIdMinor() ); + + break; + } + case EBSBuffer: + { + aWriteStream.WriteInt16L( iBufferData->Length() ); + aWriteStream.WriteL( *iBufferData ); + break; + } + default: + { + // unknown type! + User::Leave( KErrCorrupt ); + break; + } + } + } + + +// END OF FILE diff -r 000000000000 -r e6b17d312c8b brandingserver/bsclient/cbselement.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/brandingserver/bsclient/cbselement.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,112 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: cbselement.h +* +*/ + + +#ifndef __CBSELEMENT_H__ +#define __CBSELEMENT_H__ +#include + +#include "mbselement.h" +#include "rbsobjowningptrarray.h" + +class RWriteStream; + +/** + * + */ +NONSHARABLE_CLASS( CBSElement ): public CBase, + public MBSElement + { + public: + /** + * Two-phased constructor. + */ + static CBSElement* NewL( + const TDesC8& aElementId, + TInt aData ); + + static CBSElement* NewL( + const TDesC8& aElementId, + const TDesC& aData, + TBSElementType aType = EBSText ); + + static CBSElement* NewL( + const TDesC8& aElementId, + const TDesC8& aData ); + + // Transfers ownership + static CBSElement* NewL( + const TDesC8& aElementId, + CBSBitmap* aBitmap ); + + static CBSElement* NewL( + const TDesC8& aElementId, + RBSObjOwningPtrArray& aStructure ); + + void Close(); + + virtual ~CBSElement(); + + private: + CBSElement(); + + + void ConstructL( TBSElementType aElementType, + const TDesC8& aElementId, + TInt aIntData, + TBool aIntDataInitialized, + CBSBitmap* aBitmap, + const TDesC& aTextData, + const TDesC8& aBufferData, + RBSObjOwningPtrArray* aStructure ); + + private: + TBSElementType ElementType(); + const TDesC8& ElementId(); + + // Leaves with KErrArgument if trying to + // get wrong type + TInt IntDataL(); + const TDesC& TextDataL(); + const TDesC8& BufferDataL(); + const CBSBitmap& BitmapDataL(); + TArray GetStructureL(); + + const MBSElement& FindSubEntryL( const TDesC& aElementId ); + + void ExternalizeL( RWriteStream& aWriteStream ); + + + + private: // data + TBSElementType iElementType; + HBufC8* iElementId; + TInt iIntData; + TBool iIntDataInitialized; + HBufC* iTextData; + HBufC8* iBufferData; + TBool iArrayInitialized; + RBSObjOwningPtrArray iArray; + CBSBitmap* iBitmapData; + + }; + +#endif // __CBSELEMENT_H__ + + +// END OF FILE + diff -r 000000000000 -r e6b17d312c8b brandingserver/bsclient/cbsfactory.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/brandingserver/bsclient/cbsfactory.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,130 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Factory for creating branding +* +*/ + +// INCLUDE FILES +#include "cbsfactory.h" +#include "cbsaccess.h" +#include "cbsupdater.h" +#include "mbsaccess.h" +#include "mbsupdater.h" +#include "cbsclient.h" +#include "debugtrace.h" + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// BrandingFactory::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +EXPORT_C CBSFactory* CBSFactory::NewL( const TDesC8& aDefaultBrandId, + const TDesC8& aApplicationId ) + { + TRACE( T_LIT("CBSFactory::NewL begin") ); + CBSFactory* self = new ( ELeave ) CBSFactory() ; + CleanupStack::PushL( self ); + self->ConstructL( aDefaultBrandId, aApplicationId ); + CleanupStack::Pop( self ); //self + TRACE( T_LIT("CBSFactory::NewL end") ); + return self; + } + + +// C++ default constructor can NOT contain any code, that +// might leave. +// +CBSFactory::CBSFactory() + { + } + +// destructor +CBSFactory::~CBSFactory() + { + delete iDefaultBrand; + delete iApplicationId; + if( iServerKeepAlive ) + { + iServerKeepAlive->Close(); + } + delete iServerKeepAlive; + } + +// Symbian OS default constructor can leave. +void CBSFactory::ConstructL( const TDesC8& aDefaultBrandId, + const TDesC8& aApplicationId ) + { + iDefaultBrand = aDefaultBrandId.AllocL(); + iApplicationId = aApplicationId.AllocL(); + iServerKeepAlive = new(ELeave) RBSClient(); // CSI: 74 # this needs to be like this + User::LeaveIfError( iServerKeepAlive->Connect() ); + } + + +// ----------------------------------------------------------------------------- +// CBSFactory::CreateAccessL() +// ----------------------------------------------------------------------------- +// +EXPORT_C MBSAccess* CBSFactory::CreateAccessL( const TDesC8& aBrandId, + TLanguage aLanguageId, + TBool aCacheData, /* = EFalse */ + TInt aReserved /*= 0*/ ) + { + TRACE( T_LIT("CBSFactory::CreateAccessL begin") ); + CBSAccess* access = CBSAccess::NewL( aBrandId, *iApplicationId, *iDefaultBrand, + aLanguageId, aCacheData, aReserved ); + TRACE( T_LIT("CBSFactory::CreateAccessL end") ); + return access; + } + +// ----------------------------------------------------------------------------- +// CBSFactory::CreateAccessL() +// ----------------------------------------------------------------------------- +// +EXPORT_C MBSAccess* CBSFactory::CreateAccessLC( const TDesC8& aBrandId, + TLanguage aLanguageId, + TBool aCacheData, /* = EFalse */ + TInt aReserved /*= 0 */) + { + CBSAccess* access = CBSAccess::NewL( aBrandId, *iApplicationId, *iDefaultBrand, + aLanguageId, aCacheData, aReserved ); + CleanupClosePushL( *access ); + return access; + } + +// ----------------------------------------------------------------------------- +// CBSFactory::CreateUpdaterL() +// ----------------------------------------------------------------------------- +// +EXPORT_C MBSUpdater* CBSFactory::CreateUpdaterL() + { + CBSUpdater* updater = CBSUpdater::NewL( *iApplicationId ); + return updater; + } + +// ----------------------------------------------------------------------------- +// CBSFactory::CreateUpdaterLC() +// ----------------------------------------------------------------------------- +// +EXPORT_C MBSUpdater* CBSFactory::CreateUpdaterLC() + { + CBSUpdater* updater = CBSUpdater::NewL( *iApplicationId ); + CleanupClosePushL( *updater ); + return updater; + } + +// End of File + diff -r 000000000000 -r e6b17d312c8b brandingserver/bsclient/cbsiconfileprovider.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/brandingserver/bsclient/cbsiconfileprovider.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,91 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Icon file provider. + * +*/ + + +// INCLUDE FILES +#include "cbsiconfileprovider.h" +#include +#include + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CBSIconFileProvider::CBSIconFileProvider +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CBSIconFileProvider::CBSIconFileProvider() + { + } +// ----------------------------------------------------------------------------- +// CBSIconFileProvider::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CBSIconFileProvider::ConstructL(RFile& aFile) + { + User::LeaveIfError( iFile.Duplicate( aFile ) ); + } + +// ----------------------------------------------------------------------------- +// CBSIconFileProvider::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CBSIconFileProvider* CBSIconFileProvider::NewL( + RFile& aFile ) + { + CBSIconFileProvider* self = new( ELeave ) CBSIconFileProvider(); + + CleanupStack::PushL( self ); + self->ConstructL(aFile); + CleanupStack::Pop( self ); + return self; + } + + +// Destructor +CBSIconFileProvider::~CBSIconFileProvider() + { + delete iFilename; + iFile.Close(); + } + +// ----------------------------------------------------------------------------- +// CBSIconFileProvider::RetrieveIconFileHandleL +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +void CBSIconFileProvider::RetrieveIconFileHandleL( + RFile& aFile, const TIconFileType /*aType*/ ) + { + aFile.Duplicate( iFile ); + } + +// ----------------------------------------------------------------------------- +// CBSIconFileProvider::Finished +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +void CBSIconFileProvider::Finished() + { + // commit suicide because Avkon Icon Server said so + delete this; + } + +// End of File diff -r 000000000000 -r e6b17d312c8b brandingserver/bsclient/cbsiconfileprovider.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/brandingserver/bsclient/cbsiconfileprovider.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,89 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Icon file provider. + * +*/ + + + +#ifndef CBSICONFILEPROVIDER_H +#define CBSICONFILEPROVIDER_H + +// INCLUDES +#include +#include +#include + + +// FORWARD DECLARATIONS + +// CLASS DECLARATION + +/** + * Icon file provider. + * See MAknIconFileProvider.h for comments. + * + * @lib chat.app + * @since 3.0 + */ +class CBSIconFileProvider : public CBase, public MAknIconFileProvider + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static CBSIconFileProvider* NewL( RFile& aFile ); + /** + * Destructor. + */ + virtual ~CBSIconFileProvider(); + + public: // Functions from base classes + + /** + * @see MAknIconFileProvider + */ + void RetrieveIconFileHandleL( + RFile& aFile, const TIconFileType aType ); + + /** + * @see MAknIconFileProvider + */ + void Finished(); + + private: + + /** + * C++ default constructor. + */ + CBSIconFileProvider(); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(RFile& aFile); + + private: // Data + + // owned. filename of this icon. must be a copy, + // a reference could end up pointing into another file. + HBufC* iFilename; + + RFile iFile; + }; + +#endif // CBSICONFILEPROVIDER_H + +// End of File diff -r 000000000000 -r e6b17d312c8b brandingserver/bsclient/cbsupdater.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/brandingserver/bsclient/cbsupdater.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,538 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: CBSUpdater.cpp +* +*/ + + +// INCLUDE FILES + +#include "e32base.h" + +#include "cbsupdater.h" +#include "debugtrace.h" +#include "mbsaccess.h" +#include "bselementfactory.h" +#include "mbselement.h" +#include "bsserverdefs.h" + +// Two-phased constructor. +CBSUpdater* CBSUpdater::NewL( const TDesC8& aApplicationId ) + { + CBSUpdater* self = new ( ELeave ) CBSUpdater() ; + CleanupStack::PushL( self ); + self->ConstructL( aApplicationId ); + CleanupStack::Pop( self ); //self + return self; + } + +// Symbian OS default constructor can leave. +void CBSUpdater::ConstructL( const TDesC8& aApplicationId ) + { + iApplicationId = aApplicationId.AllocL(); + User::LeaveIfError( iClient.Connect() ); + } + +// Destructor +CBSUpdater::~CBSUpdater() + { + delete iApplicationId; + delete iBrandId; + iClient.Close(); + } + +// C++ default constructor can NOT contain any code, that +// might leave. +// +CBSUpdater::CBSUpdater() + { + } + + +// ----------------------------------------------------------------------------- +// CBSUpdater::Close() +// ----------------------------------------------------------------------------- +// +void CBSUpdater::Close() + { + delete this; + } + +// ----------------------------------------------------------------------------- +// CBSUpdater::StartTransactionL() +// ----------------------------------------------------------------------------- +// +void CBSUpdater::StartTransactionL( const TDesC8& aBrandId, + TLanguage aLanguageId, + TUpdateTransactionType aType, /*EUpdateInstall*/ + TInt aReserved) + { + if( iActive ) + { + User::Leave( KErrAlreadyExists ); + } + + iActive = ETrue; + HBufC8* tmp = aBrandId.AllocL(); + delete iBrandId; + iBrandId = tmp; + iLanguageId = aLanguageId; + iReserved = aReserved; + iTxType = aType; + + TTransactionType operation = EBSTxAccess; + switch( aType ) + { + case EUpdateInstall: + { + operation = EBSTxInstall; + break; + } + case EUpdateAppend: + { + operation = EBSTxAppend; + break; + } + case EUpdateReplace: + { + operation = EBSTxReplace; + break; + } + case EUpdateUninstall: + { + operation = EBSTxUninstall; + break; + } + default: + break; + } + + TRAPD( err, iClient.StartTransactionL( *iApplicationId, aBrandId, KNullDesC8, + aLanguageId, operation, aReserved ) ); + if( err ) + { + iActive = EFalse; + User::Leave( err ); + } + + } +// ----------------------------------------------------------------------------- +// CBSUpdater::StopTransactionL() +// ----------------------------------------------------------------------------- +// +TInt CBSUpdater::StopTransactionL() + { + if( !iActive ) + { + User::Leave( KErrNotFound ); + } + + TInt returnValue = iClient.StopTransactionL( *iApplicationId, + *iBrandId, + iLanguageId, + iReserved ); + iActive = EFalse; + return returnValue; + } + + +// ----------------------------------------------------------------------------- +// CBSUpdater::CancelTransactionL() +// ----------------------------------------------------------------------------- +// +void CBSUpdater::CancelTransactionL() + { + if( !iActive ) + { + User::Leave( KErrNotFound ); + } + + iClient.CancelTransactionL( *iApplicationId, *iBrandId, iLanguageId, iReserved ); + iActive = EFalse; + } + + + +//*** BRAND INSTALLING ***// +// ----------------------------------------------------------------------------- +// CBSUpdater::InsertTextL() +// ----------------------------------------------------------------------------- +// +void CBSUpdater::InsertTextL( const TDesC8& aId, + const TDesC& aText ) + { + if( !iActive ) + { + User::Leave( KErrNotReady ); + } + if( iTxType != EUpdateInstall ) + { + User::Leave( KErrArgument ); + } + MBSElement* element = BSElementFactory::CreateBSElementL( aId, EBSText, aText ); + CleanupClosePushL( *element ); + InsertElementL( element ); + CleanupStack::PopAndDestroy(); // element + } + + +// ----------------------------------------------------------------------------- +// CBSUpdater::InsertBufferL() +// ----------------------------------------------------------------------------- +// +void CBSUpdater::InsertBufferL( const TDesC8& aId, + const TDesC8& aBuffer ) + { + if( !iActive ) + { + User::Leave( KErrNotReady ); + } + if( iTxType != EUpdateInstall ) + { + User::Leave( KErrArgument ); + } + MBSElement* element = BSElementFactory::CreateBSElementL( aId, EBSBuffer, aBuffer ); + CleanupClosePushL( *element ); + InsertElementL( element ); + CleanupStack::PopAndDestroy(); // element + } + + +// ----------------------------------------------------------------------------- +// CBSUpdater::InsertIntL() +// ----------------------------------------------------------------------------- +// +void CBSUpdater::InsertIntL( const TDesC8& aId, + TInt aInt ) + { + if( !iActive ) + { + User::Leave( KErrNotReady ); + } + if( iTxType != EUpdateInstall ) + { + User::Leave( KErrArgument ); + } + MBSElement* element = BSElementFactory::CreateBSElementL( aId, EBSInt, aInt ); + CleanupClosePushL( *element ); + InsertElementL( element ); + CleanupStack::PopAndDestroy(); // element + } + + +// ----------------------------------------------------------------------------- +// CBSUpdater::InsertFileL() +// ----------------------------------------------------------------------------- +// +void CBSUpdater::InsertFileL( const TDesC8& aId, + const TDesC& aFileName ) + { + if( !iActive ) + { + User::Leave( KErrNotReady ); + } + if( iTxType != EUpdateInstall ) + { + User::Leave( KErrArgument ); + } + MBSElement* element = BSElementFactory::CreateBSElementL( aId, EBSFile, aFileName ); + CleanupClosePushL( *element ); + InsertElementL( element ); + CleanupStack::PopAndDestroy(); // element + } + + +// ----------------------------------------------------------------------------- +// CBSUpdater::InsertElementL() +// ----------------------------------------------------------------------------- +// +void CBSUpdater::InsertElementL( MBSElement* aElement ) + { + if( !iActive ) + { + User::Leave( KErrNotReady ); + } + if( iTxType != EUpdateInstall ) + { + User::Leave( KErrArgument ); + } + iClient.InsertL( aElement ); + } + + + + +//*** BRAND UPDATING - replacing ***// +// ----------------------------------------------------------------------------- +// CBSUpdater::ReplaceTextL() +// ----------------------------------------------------------------------------- +// +void CBSUpdater::ReplaceTextL( const TDesC8& aId, + const TDesC& aText ) + { + if( !iActive ) + { + User::Leave( KErrNotReady ); + } + if( iTxType != EUpdateReplace ) + { + User::Leave( KErrArgument ); + } + MBSElement* element = BSElementFactory::CreateBSElementL( aId, EBSText, aText ); + CleanupClosePushL( *element ); + ReplaceElementL( element ); + CleanupStack::PopAndDestroy(); // element + } + + +// ----------------------------------------------------------------------------- +// CBSUpdater::ReplaceBufferL() +// ----------------------------------------------------------------------------- +// +void CBSUpdater::ReplaceBufferL( const TDesC8& aId, + const TDesC8& aBuffer ) + { + if( !iActive ) + { + User::Leave( KErrNotReady ); + } + if( iTxType != EUpdateReplace ) + { + User::Leave( KErrArgument ); + } + MBSElement* element = BSElementFactory::CreateBSElementL( aId, EBSBuffer, aBuffer ); + CleanupClosePushL( *element ); + ReplaceElementL( element ); + CleanupStack::PopAndDestroy(); // element + } + + +// ----------------------------------------------------------------------------- +// CBSUpdater::ReplaceIntL() +// ----------------------------------------------------------------------------- +// +void CBSUpdater::ReplaceIntL( const TDesC8& aId, + TInt aInt ) + { + if( !iActive ) + { + User::Leave( KErrNotReady ); + } + if( iTxType != EUpdateReplace ) + { + User::Leave( KErrArgument ); + } + MBSElement* element = BSElementFactory::CreateBSElementL( aId, EBSInt, aInt ); + CleanupClosePushL( *element ); + ReplaceElementL( element ); + CleanupStack::PopAndDestroy(); // element + } + + +// ----------------------------------------------------------------------------- +// CBSUpdater::ReplaceFileL() +// ----------------------------------------------------------------------------- +// +void CBSUpdater::ReplaceFileL( const TDesC8& aId, + const TDesC& aFileName ) + { + if( !iActive ) + { + User::Leave( KErrNotReady ); + } + if( iTxType != EUpdateReplace ) + { + User::Leave( KErrArgument ); + } + MBSElement* element = BSElementFactory::CreateBSElementL( aId, EBSFile, aFileName ); + CleanupClosePushL( *element ); + ReplaceElementL( element ); + CleanupStack::PopAndDestroy(); // element + } + + +// ----------------------------------------------------------------------------- +// CBSUpdater::ReplaceElementL() +// ----------------------------------------------------------------------------- +// +void CBSUpdater::ReplaceElementL( MBSElement* aElement ) + { + if( !iActive ) + { + User::Leave( KErrNotReady ); + } + if( iTxType != EUpdateReplace ) + { + User::Leave( KErrArgument ); + } + iClient.ReplaceL( aElement ); + } + + + + +//*** BRAND UPDATING - appending ***// +// ----------------------------------------------------------------------------- +// CBSUpdater::AppendTextL() +// ----------------------------------------------------------------------------- +// +void CBSUpdater::AppendTextL( const TDesC8& aId, + const TDesC& aText ) + { + if( !iActive ) + { + User::Leave( KErrNotReady ); + } + if( iTxType != EUpdateAppend ) + { + User::Leave( KErrArgument ); + } + MBSElement* element = BSElementFactory::CreateBSElementL( aId, EBSText, aText ); + CleanupClosePushL( *element ); + AppendElementL( element ); + CleanupStack::PopAndDestroy(); // element + } + + +// ----------------------------------------------------------------------------- +// CBSUpdater::AppendBufferL() +// ----------------------------------------------------------------------------- +// +void CBSUpdater::AppendBufferL( const TDesC8& aId, + const TDesC8& aBuffer ) + { + if( !iActive ) + { + User::Leave( KErrNotReady ); + } + if( iTxType != EUpdateAppend ) + { + User::Leave( KErrArgument ); + } + MBSElement* element = BSElementFactory::CreateBSElementL( aId, EBSBuffer, aBuffer ); + CleanupClosePushL( *element ); + AppendElementL( element ); + CleanupStack::PopAndDestroy(); // element + } + + +// ----------------------------------------------------------------------------- +// CBSUpdater::AppendIntL() +// ----------------------------------------------------------------------------- +// +void CBSUpdater::AppendIntL( const TDesC8& aId, + TInt aInt ) + { + if( !iActive ) + { + User::Leave( KErrNotReady ); + } + if( iTxType != EUpdateAppend ) + { + User::Leave( KErrArgument ); + } + MBSElement* element = BSElementFactory::CreateBSElementL( aId, EBSInt, aInt ); + CleanupClosePushL( *element ); + AppendElementL( element ); + CleanupStack::PopAndDestroy(); // element + } + + +// ----------------------------------------------------------------------------- +// CBSUpdater::AppendFileL() +// ----------------------------------------------------------------------------- +// +void CBSUpdater::AppendFileL( const TDesC8& aId, + const TDesC& aFileName ) + { + if( !iActive ) + { + User::Leave( KErrNotReady ); + } + if( iTxType != EUpdateAppend ) + { + User::Leave( KErrArgument ); + } + MBSElement* element = BSElementFactory::CreateBSElementL( aId, EBSFile, aFileName ); + CleanupClosePushL( *element ); + AppendElementL( element ); + CleanupStack::PopAndDestroy(); // element + } + + +// ----------------------------------------------------------------------------- +// CBSUpdater::AppendElementL() +// ----------------------------------------------------------------------------- +// +void CBSUpdater::AppendElementL( MBSElement* aElement ) + { + if( !iActive ) + { + User::Leave( KErrNotReady ); + } + if( iTxType != EUpdateAppend ) + { + User::Leave( KErrArgument ); + } + iClient.AppendL( aElement ); + } + + +// ----------------------------------------------------------------------------- +// CBSUpdater::AppendElementL() +// ----------------------------------------------------------------------------- +// +void CBSUpdater::RemoveBrandL( const TDesC8& aApplicationId, + const TDesC8& aBrandId ) + { + if( !iActive ) + { + User::Leave( KErrNotReady ); + } + iClient.RemoveBrandL( aApplicationId, aBrandId ); + } + +// ----------------------------------------------------------------------------- +// CBSUpdater::AppendElementL() +// ----------------------------------------------------------------------------- +// +void CBSUpdater:: RemoveBrandsL( const TDesC8& aApplicationId ) + { + if( !iActive ) + { + User::Leave( KErrNotReady ); + } + iClient.RemoveBrandsL( aApplicationId ); + } + +// ----------------------------------------------------------------------------- +// CBSUpdater::RegisterObserverL() +// ----------------------------------------------------------------------------- +// +void CBSUpdater:: RegisterObserverL( MBSBackupRestoreStateObserver* aBackupObserver ) +{ + iClient.RegisterObserverL(NULL, aBackupObserver) ; +} + +// ----------------------------------------------------------------------------- +// CBSUpdater::UnRegisterObserverL() +// ----------------------------------------------------------------------------- +// +void CBSUpdater:: UnRegisterObserverL( MBSBackupRestoreStateObserver* aObserver ) +{ + iClient.UnRegisterObserverL(NULL, aObserver) ; +} + +// END OF FILE + diff -r 000000000000 -r e6b17d312c8b brandingserver/bsclient/cbsupdater.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/brandingserver/bsclient/cbsupdater.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,205 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: CBSUpdater.h +* +*/ + + +#ifndef __CBSUPDATER_H__ +#define __CBSUPDATER_H__ +#include +#include "mbsupdater.h" +#include "cbsclient.h" + +/** + * Simple ClientServer for + * testing and example purposes. + */ +NONSHARABLE_CLASS( CBSUpdater ): public CBase, + public MBSUpdater + { + public: + /** + * Two-phased constructor. + */ + static CBSUpdater* NewL( const TDesC8& aApplicationId ); + + virtual ~CBSUpdater(); + + /* + * @see MBSUpdater + */ + void Close(); + + private: + void ConstructL( const TDesC8& aApplicationId ); + CBSUpdater(); + + + private: // from MBSUpdater + + /* + * @see MBSUpdater + */ + void StartTransactionL( const TDesC8& aBrandId, + TLanguage aLanguageId, + TUpdateTransactionType aType = EUpdateInstall, + TInt aReserved = 0 ); + /* + * @see MBSUpdater + */ + TInt StopTransactionL(); + + /* + * @see MBSUpdater + */ + void CancelTransactionL(); + + + /* + * @see MBSUpdater + */ + void RemoveBrandL( const TDesC8& aApplicationId, + const TDesC8& aBrandId ); + + /* + * @see MBSUpdater + */ + void RemoveBrandsL( const TDesC8& aApplicationId ); + + + //*** BRAND INSTALLING ***// + /* + * @see MBSUpdater + */ + void InsertTextL( const TDesC8& aId, + const TDesC& aText ); + + /* + * @see MBSUpdater + */ + void InsertBufferL( const TDesC8& aId, + const TDesC8& aBuffer ); + + /* + * @see MBSUpdater + */ + void InsertIntL( const TDesC8& aId, + TInt aInt ); + + /* + * @see MBSUpdater + */ + void InsertFileL( const TDesC8& aId, + const TDesC& aFileName ); + + /* + * @see MBSUpdater + */ + void InsertElementL( MBSElement* aElement ); + + + + //*** BRAND UPDATING - replacing ***// + /* + * @see MBSUpdater + */ + void ReplaceTextL( const TDesC8& aId, + const TDesC& aText ); + + /* + * @see MBSUpdater + */ + void ReplaceBufferL( const TDesC8& aId, + const TDesC8& aBuffer ); + + /* + * @see MBSUpdater + */ + void ReplaceIntL( const TDesC8& aId, + TInt aInt ); + + /* + * @see MBSUpdater + */ + void ReplaceFileL( const TDesC8& aId, + const TDesC& aFileName ); + + /* + * @see MBSUpdater + */ + void ReplaceElementL( MBSElement* aElement ); + + + + //*** BRAND UPDATING - appending ***// + /* + * @see MBSUpdater + */ + void AppendTextL( const TDesC8& aId, + const TDesC& aText ); + + /* + * @see MBSUpdater + */ + void AppendBufferL( const TDesC8& aId, + const TDesC8& aBuffer ); + + /* + * @see MBSUpdater + */ + void AppendIntL( const TDesC8& aId, + TInt aInt ); + + /* + * @see MBSUpdater + */ + void AppendFileL( const TDesC8& aId, + const TDesC& aFileName ); + + /* + * @see MBSUpdater + */ + void AppendElementL( MBSElement* aElement ); + + /* + * @see MBSUpdater + */ + void RegisterObserverL( MBSBackupRestoreStateObserver* aBackupObserver ) ; + + /* + * @see MBSUpdater + */ + void UnRegisterObserverL( MBSBackupRestoreStateObserver* aObserver ) ; + + + private: // data + + // tells if a transaction is ongoing or not + TBool iActive; + + HBufC8* iApplicationId; + HBufC8* iBrandId; + TLanguage iLanguageId; + TBool iUseCache; + RBSClient iClient; + TUpdateTransactionType iTxType; + TInt iReserved; + }; + +#endif // __CBSUPDATER_H__ + + +// END OF FILE + diff -r 000000000000 -r e6b17d312c8b brandingserver/bsclient/mbsbrandobserverregistrar.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/brandingserver/bsclient/mbsbrandobserverregistrar.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,58 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MBSBrandObserverRegistrar.h +* +*/ + + + +#ifndef __MBSBRANDOBSERVERREGISTRAR_H +#define __MBSBRANDOBSERVERREGISTRAR_H + +#include + + +/** + * An interface through which client can take into use + * available brand data updates. + * + * @since + */ +class MBSBrandObserverRegistrar + { + public: + + /* + * Registeres the brand observer to server + */ + virtual void RegisterObserverToServerL( TRequestStatus& aStatus) = 0; + + + /* + * Gets the new updated version number + */ + virtual TInt GetNewVersionL() = 0; + + virtual TInt GetBackupRestoreL() = 0; + + virtual TInt GetBackupStateL() = 0; + +protected: + /* + * Destructor + */ + virtual ~MBSBrandObserverRegistrar() {}; + }; + +#endif //__MBSBRANDOBSERVERREGISTRAR_H diff -r 000000000000 -r e6b17d312c8b brandingserver/bsclient/tbselementiterator.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/brandingserver/bsclient/tbselementiterator.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,42 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: tbselementiterator.cpp +* +*/ + + + +// INCLUDE FILES +#include "tbselementiterator.h" +#include + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// TBSElementIterator::TBSElementIterator +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +TBSElementIterator::TBSElementIterator( const TDesC& aElementId ) + : iElementId( aElementId ) + { + } + +MBSElement& TBSElementIterator::Next() + { + } + + +// End of File diff -r 000000000000 -r e6b17d312c8b brandingserver/bsclient/tbsmdescarrayadapter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/brandingserver/bsclient/tbsmdescarrayadapter.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,78 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: One value adapter for MDesCArray. +* +*/ + +// INCLUDES +#include "tbsmdescarrayadapter.h" +#include +#include + + +//LOCAL constants +namespace + { + //Panic + _LIT( KBSMDesArrayAdapterPanic, "BSDesArrAdp" ); + + //Panic reasons + enum TBSMDesArrayAdapterReasons + { + EMdcaPointOutOfBounds + }; + + void BSMDesAdapPanic( TBSMDesArrayAdapterReasons aPanicReason ) + { + User::Panic( KBSMDesArrayAdapterPanic, aPanicReason ); + } + } + + + + +// ================= MEMBER FUNCTIONS ======================= +// C++ default constructor can NOT contain any code, that +// might leave. +// +EXPORT_C TBSMDesCArrayAdapter::TBSMDesCArrayAdapter( const TDesC& aDesc ) + : iDesc( aDesc ) + { + } + +// ----------------------------------------------------------------------------- +// TBSMDesCArrayAdapter::MdcaCount() +// ----------------------------------------------------------------------------- +// +EXPORT_C TInt TBSMDesCArrayAdapter::MdcaCount() const + { + //there is just one adapted descriptor + return 1; + } + +// ----------------------------------------------------------------------------- +// TBSMDesCArrayAdapter::MdcaPoint() +// ----------------------------------------------------------------------------- +// +EXPORT_C TPtrC TBSMDesCArrayAdapter::MdcaPoint( TInt aIndex ) const + { + //there is just one adapted descriptor + __ASSERT_ALWAYS( aIndex == 0, BSMDesAdapPanic( EMdcaPointOutOfBounds ) ); + return iDesc; + } + + + +// End of File + diff -r 000000000000 -r e6b17d312c8b brandingserver/bsserver/bsimportconstants.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/brandingserver/bsserver/bsimportconstants.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,64 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: BrandingServer constants. +* +*/ +// CONSTANTS + +// Characters to strip from xml text values +_LIT( KCommonControlCharacters, "\n\t\r" ); +_LIT( KEndl, "\n\r" ); + +// === Directory & file constants ============================================= +_LIT( KDirSeparator, "\\" ); +_LIT( KDot, "." ); +_LIT( KDefFileName, "brandfile.bin.r" ); +_LIT( KDefEventLogDir, "BSImport" ); +_LIT( KDefEventLogFile, "eventlog.txt" ); +_LIT( KFileElementStore, "files" ); +_LIT( KBSDataStore, "data" ); +_LIT( KAllFilesWildCard, "*.*" ); +_LIT( KBSCDrive, "C:" ); +_LIT( KBSZDrive, "Z:" ); +// Codescanner warning : hard-coded drive letters (id:25) +// this folder is always on c-drive +_LIT( KBSIbyDirectory, "c:\\data\\bs\\" ); // CSI: 25 # See above +_LIT( KBSIbyExtension, ".iby" ); +_LIT( KBSFileLangSuffix, "r" ); +const TInt KMaxVersionLenght = 3; + +const TInt KLeadingZero = 0; +const TInt KLangBufLength = 2; + +// folders inside server's private: "\\private\\102828DD\\" +_LIT( KInstallObservePath, "import\\install\\" ); // new files +_LIT( KInstallPath, "install\\" ); // installed files + +// drive where installation files are saved +_LIT( KInstallDrive, "C:" ); + +// brand installation file extension +_LIT( KBrandInstallExt, ".install" ); + +// Separator which separates brand id from application id in +// uninstall buffer +_LIT( KInstallFileDataSeparator, "$" ); + +_LIT( KDiscardBrandFileName, "discardedbrand.txt" ); + + + + + + diff -r 000000000000 -r e6b17d312c8b brandingserver/bsserver/bsserverdefs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/brandingserver/bsserver/bsserverdefs.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,117 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: server defintions. +* +*/ +#ifndef __BSSERVERDEFS_H__ +#define __BSSERVERDEFS_H__ +#include + +/** + * + * + */ +const TInt KBSVersionMajor = 1; +const TInt KBSVersionMinor = 1; +const TInt KBSVersionBuild = 1; + +/** + * + * + */ +_LIT( KBSServerExe, "bsserver.exe" ); + + +/** + * + * + */ +_LIT( KBSServerName, "bs" ); + + +/** + * + * + */ +const TUint KBSMsgSlotCount = 4; + + +enum TTransactionType + { + EBSTxInstall = 1, + EBSTxUninstall, + EBSTxAppend, + EBSTxReplace, + EBSTxAccess + }; + +/** + * + * + */ +enum TBSMessages + { + // access API + EBSInitInstall = 1, + EBSInitUninstall, + EBSInitAppend, + EBSInitReplace, + EBSInitAccess, + EBSPrepareText, + EBSGetText, + EBSGetInt, + EBSPrepareBuffer, + EBSGetBuffer, + EBSPrepareSeveral, + EBSGetSeveral, + EBSGetFile, + EBSPrepareStructure, + EBSGetStructure, + + EBSStartTransaction, + EBSStopTransaction, + EBSCancelTransaction, + + // installing + EBSInstall, + + // replacing + EBSReplace, + + // appending + EBSAppend, + + // removing + EBSRemoveBrand, + + EBSRemoveApplication, + + // observing + EBSObserveBrand, + EBSObserveGetNewVersion, + EBSObserveGetChange, + EBSObserveGetBackupState, + EBSIsBrandUpdateRequired, + EBSOperationLast + }; + + +#endif //__BSSERVERDEFS_H__ + +// END OF FILE + + + + + diff -r 000000000000 -r e6b17d312c8b brandingserver/bsserver/cbsbackupobserver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/brandingserver/bsserver/cbsbackupobserver.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,195 @@ +/* +* Copyright (c) 2006-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Stores element data and writes it to stream +* +*/ + + +#include + +#include "cbsbackupobserver.h" + + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// CBSBackupObserver::NewL +// --------------------------------------------------------------------------- +// +CBSBackupObserver* CBSBackupObserver::NewL() + { + CBSBackupObserver* self = NewLC(); + CleanupStack::Pop(); + return self; + } + +// --------------------------------------------------------------------------- +// CBSBackupObserver::NewLC +// --------------------------------------------------------------------------- +// +CBSBackupObserver* CBSBackupObserver::NewLC() + { + CBSBackupObserver* self = new (ELeave) CBSBackupObserver(); + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + +// --------------------------------------------------------------------------- +// CBSBackupObserver::ConstructL +// --------------------------------------------------------------------------- +// +void CBSBackupObserver::ConstructL() + { + CActiveScheduler::Add( this ); + iProperty.Attach( KUidSystemCategory, conn::KUidBackupRestoreKey ); + iLatestState = BackupStateL(); + Subscribe(); + } + +// --------------------------------------------------------------------------- +// CBSBackupObserver::CBSBackupObserver +// --------------------------------------------------------------------------- +// +CBSBackupObserver::CBSBackupObserver() : + CActive( EPriorityStandard ) + { + } + +// --------------------------------------------------------------------------- +// CBSBackupObserver::~CBSBackupObserver +// --------------------------------------------------------------------------- +// +CBSBackupObserver::~CBSBackupObserver() + { + Cancel(); + iObservers.Close(); + } + +// --------------------------------------------------------------------------- +// CBSBackupObserver::RunL +// --------------------------------------------------------------------------- +// +void CBSBackupObserver::RunL() + { + MBSBackupObserver::TBackupState newState = BackupStateL(); + if( newState != iLatestState ) + { + // state changed + iLatestState = newState; + NotifyObserversL( iLatestState ); + } + Subscribe(); + } + +// --------------------------------------------------------------------------- +// CBSBackupObserver::DoCancel +// --------------------------------------------------------------------------- +// +void CBSBackupObserver::DoCancel() + { + iProperty.Cancel(); + } + +// --------------------------------------------------------------------------- +// CBSBackupObserver::RunError +// --------------------------------------------------------------------------- +// +TInt CBSBackupObserver::RunError( TInt /*aError*/ ) + { + return KErrNone; + } + +// --------------------------------------------------------------------------- +// CBSBackupObserver::RegisterObserver +// --------------------------------------------------------------------------- +// +TInt CBSBackupObserver::RegisterObserver( MBSBackupObserver* aObserver ) + { + TInt err = iObservers.InsertInAddressOrder( aObserver ); + if( err == KErrAlreadyExists ) + { + // ignore duplicate registration + err = KErrNone; + } + + // if backup is already active -> notify + if( iLatestState == MBSBackupObserver::EBackupActive ) + { + TRAP_IGNORE( aObserver->HandleBackupStateL( iLatestState ) ); + } + + return err; + } + +// --------------------------------------------------------------------------- +// CBSBackupObserver::UnregisterObserver +// --------------------------------------------------------------------------- +// +void CBSBackupObserver::UnregisterObserver( MBSBackupObserver* aObserver ) + { + TInt index = iObservers.FindInAddressOrder( aObserver ); + if( index != KErrNotFound ) + { + iObservers.Remove( index ); + } + } + +// --------------------------------------------------------------------------- +// CBSBackupObserver::Subscribe +// --------------------------------------------------------------------------- +// +void CBSBackupObserver::Subscribe() + { + if( IsActive() ) + { + // already active + return; + } + iStatus = KRequestPending; + iProperty.Subscribe( iStatus ); + SetActive(); + } + +// --------------------------------------------------------------------------- +// CBSBackupObserver::NotifyObservers +// --------------------------------------------------------------------------- +// +void CBSBackupObserver::NotifyObserversL( MBSBackupObserver::TBackupState aState ) + { + TInt count = iObservers.Count(); + for( TInt i = 0; i < count; i++ ) + { + TRAP_IGNORE( iObservers[i]->HandleBackupStateL( aState ) ); + } + } + +// --------------------------------------------------------------------------- +// CBSBackupObserver::BackupState +// --------------------------------------------------------------------------- +// +MBSBackupObserver::TBackupState CBSBackupObserver::BackupStateL() + { + TInt value = 0; + User::LeaveIfError( iProperty.Get( value ) ); + if( value == 0 || + value == ( conn::EBURNormal | conn::ENoBackup ) ) + { + // backup or restore is not active at the moment + return MBSBackupObserver::EBackupNotActive; + } + return MBSBackupObserver::EBackupActive; + } + +// End of file diff -r 000000000000 -r e6b17d312c8b brandingserver/bsserver/cbsbackupobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/brandingserver/bsserver/cbsbackupobserver.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,116 @@ +/* +* Copyright (c) 2006-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Gets and notifies backup and Restore events from system +* +*/ + + +#ifndef CBSBACKUPOBSERVER_H +#define CBSBACKUPOBSERVER_H + +#include +#include + +#include "mbsbackupobserver.h" + +/** + * Gets and notifies backup and Restore events from system + * + * @lib bsserver.exe + * @since S60 v3.2 + */ +class CBSBackupObserver : public CActive +{ +public: + + static CBSBackupObserver* NewL(); + + static CBSBackupObserver* NewLC(); + + ~CBSBackupObserver(); + + +private: // From CActive + + /** + * @see CActive + */ + void RunL(); + + /** + * @see CActive + */ + void DoCancel(); + + /** + * @see CActive + */ + TInt RunError( TInt aError ); + + +private: // Private constructors + + CBSBackupObserver(); + + void ConstructL(); + + +public: // New Methods + + /** + * Register observer to observe backup state changes + * @param aObserver observer to register + * @return KErrNone or some other system wide errorcode + */ + TInt RegisterObserver( MBSBackupObserver* aObserver ); + + /** + * Unregister observer + * @param aObserver observer to remove + */ + void UnregisterObserver( MBSBackupObserver* aObserver ); + + +private: // New methods + + /** + * Subscribes to backup and restore P&S value. + */ + void Subscribe(); + + /** + * Notify registered observers of new backup state + */ + void NotifyObserversL( MBSBackupObserver::TBackupState aState ); + + /** + * Read current backup state + * @return current backup state + */ + MBSBackupObserver::TBackupState BackupStateL(); + + +private: // Data + + // backup state property + RProperty iProperty; + + // Own (array only). Observers + RPointerArray iObservers; + + // latest state of backup and restore; + MBSBackupObserver::TBackupState iLatestState; +}; + +#endif //CBSBACKUPOBSERVER_H diff -r 000000000000 -r e6b17d312c8b brandingserver/bsserver/cbsbrandhandler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/brandingserver/bsserver/cbsbrandhandler.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,611 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: CBSBrandHandler.cpp +* +*/ + + +// INCLUDE FILES + +#include "cbsbrandhandler.h" +#include "bselementfactory.h" +#include "debugtrace.h" +#include "cbsstoragemanager.h" +#include "cbsbitmap.h" +#include "bsimportconstants.h" + +#include +#include +#include + +void Panic(TInt aPanic) + { + _LIT( KPanic, "CBS" ); + User::Panic( KPanic, aPanic ); + } + +// Two-phased constructor. +CBSBrandHandler* CBSBrandHandler::NewL( const TDesC& aApplicationId, + const TDesC& aBrandId, + const TDesC& aDefaultBrandId, + TLanguage aLanguage, + CBSSession* aSession, + TInt aReserved ) + { + CBSBrandHandler* self = new ( ELeave ) CBSBrandHandler( aLanguage, aReserved ) ; + CleanupStack::PushL( self ); + self->ConstructL( aApplicationId, aBrandId, aDefaultBrandId, aSession ); + CleanupStack::Pop( self ); //self + return self; + } + +// Symbian OS default constructor can leave. +void CBSBrandHandler::ConstructL( const TDesC& aApplicationId, + const TDesC& aBrandId, + const TDesC& aDefaultBrandId, + CBSSession* aSession ) + { + iApplicationId = aApplicationId.AllocL(); + iBrandId = aBrandId.AllocL(); + iDefaultBrandId = aDefaultBrandId.AllocL(); + iSession = aSession; + + User::LeaveIfError( iFs.Connect() ); + + iHandle = new(ELeave) RFile(); // CSI: 74 # this needs to be like this + + isDefaultBrandUsed = ETrue; + iStorageManager = CBSStorageManager::NewL( iSession, KNullDesC ); + TInt err = -1; + TRAP (err, iStorageManager->BrandHandleL( *iApplicationId, + *iBrandId, iLanguage, + *iHandle, + iReserved )); + + + if (err != KErrNone) + { + iStorageManager->BrandHandleL( *iApplicationId, + *iDefaultBrandId, iLanguage, + *iHandle, + iReserved ); + } + VerifyVersionL(); + } + +// Destructor +CBSBrandHandler::~CBSBrandHandler() + { + delete iDefaultBrand; + delete iApplicationId; + delete iBrandId; + delete iDefaultBrandId; + if( iHandle ) + { + iHandle->Close(); + delete iHandle; + iHandle = NULL; + } + + delete iStorageManager; + + iFs.Close(); + } + +// C++ default constructor can NOT contain any code, that +// might leave. +// +CBSBrandHandler::CBSBrandHandler( TLanguage aLanguage, + TInt aReserved ) +: iLanguage( aLanguage ), iReserved( aReserved) + { + } + + + +TInt CBSBrandHandler:: isBrandUpdateRequiredL () +{ + TRACE( T_LIT( "isBrandUpdateRequired entered")); + TInt updateRequired = -1; + if (isDefaultBrandUsed) + { + TRACE( T_LIT( "isBrandUpdateRequired isDefaultBrandused is TRUE.")); + /* default brand is used, so can check if the actual brand is installed by anychance or not */ + updateRequired = iStorageManager->isActualBrandInstalledL (*iApplicationId, *iBrandId, iLanguage ); + if (1 == updateRequired) + { + TRACE( T_LIT( "isBrandUpdateRequired isDefaultBrandused returned 1, so update required, setting defaultbrand FALSE.")); + isDefaultBrandUsed = EFalse; + } + } + TRACE( T_LIT( "isBrandUpdateRequired isDefaultBrandused leaving..")); + return updateRequired; +} + +// ----------------------------------------------------------------------------- +// CBSBrandHandler::SetDefaultBrandIdL() +// ----------------------------------------------------------------------------- +// +void CBSBrandHandler::SetDefaultBrandIdL( const TDesC8& aBrandId ) + { + HBufC* temp = CnvUtfConverter::ConvertToUnicodeFromUtf8L( aBrandId ); + delete iDefaultBrand; + iDefaultBrand = temp; + } + +// ----------------------------------------------------------------------------- +// CBSBrandHandler::GetTextL() +// ----------------------------------------------------------------------------- +// +HBufC* CBSBrandHandler::GetTextL( const TDesC8& aId ) + { + TRACE( T_LIT( "CBranding::GetTextL begin [%S]"), &aId); + + MBSElement* element = ReadElementLC( aId ); + + HBufC* returnValue = element->TextDataL().AllocL(); + + CleanupStack::PopAndDestroy(); // element + TRACE( T_LIT( "CBranding::GetTextL end") ); + return returnValue; + } + +// ----------------------------------------------------------------------------- +// CBSBrandHandler::GetBufferL() +// ----------------------------------------------------------------------------- +// +HBufC8* CBSBrandHandler::GetBufferL( const TDesC8& aId ) + { + TRACE( T_LIT( "CBSBrandHandler::GetBufferL begin") ); + + MBSElement* element = ReadElementLC( aId ); + + HBufC8* returnValue = element->BufferDataL().AllocL(); + + CleanupStack::PopAndDestroy(); // element + TRACE( T_LIT( "CBSBrandHandler::GetBufferL end") ); + return returnValue; + } + +// ----------------------------------------------------------------------------- +// CBSBrandHandler::GetIntL() +// ----------------------------------------------------------------------------- +// +TInt CBSBrandHandler::GetIntL( const TDesC8& aId ) + { + TRACE( T_LIT( "CBSBrandHandler::GetIntL begin") ); + TInt value = 0; + + MBSElement* element = ReadElementLC( aId ); + + value = element->IntDataL(); + + CleanupStack::PopAndDestroy(); // element + + TRACE( T_LIT( "CBSBrandHandler::GetIntL end") ); + return value; + } + +// ----------------------------------------------------------------------------- +// CBSBrandHandler::GetFileL() +// ----------------------------------------------------------------------------- +// +void CBSBrandHandler::GetFileL( const TDesC8& aId, RFile& aFile ) + { + TRACE( T_LIT( "CBSBrandHandler::GetFileL begin aId[%S] "), &aId ); + RFile file; + User::LeaveIfError( iFs.ShareProtected() ); + + if (iLanguage >= 100) + User::LeaveIfError (KErrNotFound); + HBufC* fileName = GetTextL( aId ); + + TBuf buffer; +// append leading zero only if language code is <10. + if ( 10 > iLanguage ) + { + buffer.AppendNum( KLeadingZero ); + } + + buffer.AppendNum( iLanguage ); + + TInt err = -1; + TRAP (err, iStorageManager->FileElementHandleL( *iApplicationId, + *iBrandId, + *fileName, + buffer, + file )); + + if (KErrNone != err) + { + /* if the file is not found in the default brand also, then leave */ + iStorageManager->FileElementHandleL( *iApplicationId, + *iDefaultBrandId, + *fileName, + buffer, + file); + + TRACE( T_LIT( "CBSBrandHandler::GetFileL found in default brand") ); + + } + + aFile = file; + TRACE( T_LIT( "CBSBrandHandler::GetFileL end") ); + } + + +// ----------------------------------------------------------------------------- +// CBSBrandHandler::GetSeveralL() +// ----------------------------------------------------------------------------- +// +MBSElement* CBSBrandHandler::GetSeveralL( RBSObjOwningPtrArray& aIds ) + { + MBSElement* returnValue = NULL; + TInt count = aIds.Count(); + + RBSObjOwningPtrArray listData; + CleanupClosePushL( listData ); + for(TInt i = 0; i < count; i++ ) + { + MBSElement* subElement = ReadElementLC( *aIds[ i ] ); + listData.AppendL( subElement ); + CleanupStack::Pop( subElement ); + } + returnValue = BSElementFactory::CreateBSElementL( KNullDesC8, + EBSList, + listData ); + CleanupStack::Pop(); // listData + return returnValue; + } + + +// ----------------------------------------------------------------------------- +// CBSBrandHandler::GetStructureL() +// ----------------------------------------------------------------------------- +// +MBSElement* CBSBrandHandler::GetStructureL( TDesC8& aId ) + { + MBSElement* returnValue = NULL; + + TRACE( T_LIT( "CBSBrandHandler::GetStructureL begin") ); + + returnValue = ReadElementLC( aId ); + + CleanupStack::Pop(); // element + + TRACE( T_LIT( "CBSBrandHandler::GetStructureL end") ); + + return returnValue; + } + + +// ----------------------------------------------------------------------------- +// CBSBrandHandler::ReadElementLC() +// ----------------------------------------------------------------------------- +// +MBSElement* CBSBrandHandler::ReadElementLC( const TDesC8& aId, TBool aForceDefault /*= EFalse*/ ) + { + TRACE( T_LIT( "CBSBrandHandler::ReadElementLC begin aId")); + + if( aForceDefault ) + { + TRACE( T_LIT( "CBSBrandHandler::ReadElementLC default brand")); + iStorageManager->BrandHandleL( *iApplicationId, + *iDefaultBrandId, iLanguage, + *iHandle, + iReserved ); + } + else + { + TInt err = -1; + TRAP (err, iStorageManager->BrandHandleL( *iApplicationId, + *iBrandId, iLanguage, + *iHandle, + iReserved )); + if (KErrNone != err) + { + iStorageManager->BrandHandleL( *iApplicationId, + *iDefaultBrandId, iLanguage, + *iHandle, + iReserved ); + } + } + + RFileReadStream stream; + stream.Attach( *iHandle ); + CleanupClosePushL( stream ); + + VerifyVersionL( stream ); + + TInt count = stream.ReadInt16L(); + + MBSElement* returnValue = NULL; + + for( TInt i = 0; i < count; i++ ) + { + TRAPD( err, returnValue = ReadStreamL( aId, stream ) ); + + if( err == KErrEof ) + { + TRACE( T_LIT( "CBSBrandHandler::ReadElementLC EOF!") ); + // the id is not found in this file + User::Leave( KErrNotFound ); + } + if( returnValue ) + { + TRACE( T_LIT( "CBSBrandHandler::ReadElementLC ELEMENT FOUND.. at position %d"), i); + // we found what we are looking for + break; + } + } + + CleanupStack::PopAndDestroy( &stream ); // stream + + TBool popElementFromCleanupStack( EFalse ); + + /* If retur value is not found and if its read the actual brand, then try in default brand as well. aForceDefault will decide that. */ + if( !returnValue && !aForceDefault) + { + TRACE( T_LIT( "CBSBrandHandler::ReadElementLC force default is true") ); + + // the element was not found + // try the default brand if it's not the same as wanted brand + if( 0 != iBrandId->Compare( *iDefaultBrandId ) ) + { + TRACE( T_LIT( "CBSBrandHandler::ReadElementLC calling READELEMENTLC again") ); + + /* Call ReadElementLC wiht aForceDefault set to TRUE */ + returnValue = ReadElementLC( aId, ETrue ); + + if ( returnValue ) + { + TRACE( T_LIT( "CBSBrandHandler::ReadElementLC VALUE IS FOUND!!!") ); + popElementFromCleanupStack = ETrue; + } + else + { + TRACE( T_LIT( "CBSBrandHandler::ReadElementLC VALUE IS NOT FOUND!!!") ); + CleanupStack :: Pop (returnValue); + } + } + if( !returnValue ) + { + TRACE( T_LIT( "CBSBrandHandler::ReadElementLC VALUE not FOUND LEAVING WITH -1 !!!") ); + User::Leave( KErrNotFound ); + } + } + + CleanupClosePushL( *returnValue ); + // since we make one function call to ReadElementLC in case the default + // brand id is used to retrieved the element, we have to pop one returnValue + // pointer from CleanupStack (otherwise we have two identical pointers on + // the stack!!!) + if ( popElementFromCleanupStack ) + { + CleanupStack::Pop( returnValue ); + } + + TRACE( T_LIT( "CBSBrandHandler::ReadElementLC end ") ); + return returnValue; + } + +// ----------------------------------------------------------------------------- +// CBSBrandHandler::VerifyVersionL() +// ----------------------------------------------------------------------------- +// +void CBSBrandHandler::VerifyVersionL( RFileReadStream& aStream ) + { + TInt version = aStream.ReadInt16L(); + if( version != iReserved ) + { + User::Leave( KErrArgument ); + } + } + + +// ----------------------------------------------------------------------------- +// CBSBrandHandler::VerifyVersionL() +// ----------------------------------------------------------------------------- +// +void CBSBrandHandler::VerifyVersionL() + { + if( !iHandle ) + { + User::Leave( KErrNotReady ); + } + RFileReadStream stream; + stream.Attach( *iHandle ); + CleanupClosePushL( stream ); + + VerifyVersionL( stream ); + + CleanupStack::PopAndDestroy(); // stream + } + +// ----------------------------------------------------------------------------- +// CBSBrandHandler::ReadStreamL() +// ----------------------------------------------------------------------------- +// +MBSElement* CBSBrandHandler::ReadStreamL( const TDesC8& aId, RFileReadStream& aStream, + TBool aAllowEmptyId /* = EFalse */ ) + { + TRACE( T_LIT( "CBSBrandHandler::ReadStreamL BEGIN")); + TBSElementType type = (TBSElementType)aStream.ReadInt16L(); + MBSElement* returnValue = NULL; + + TInt idSize = aStream.ReadInt16L(); + + HBufC8* elementId = HBufC8::NewLC( idSize ); + TPtr8 elementIdPtr = elementId->Des(); + + if( idSize == 0 && aAllowEmptyId ) + { + // we don't read empty ID + } + else + { + aStream.ReadL( elementIdPtr, idSize ); + elementIdPtr.SetLength( idSize );// Set length + } + + + TBool match = EFalse; + if( aAllowEmptyId || ( 0 == elementIdPtr.Compare( aId ) ) ) + { + match = ETrue; + } + + TPtrC8 idPtrC( *elementId );// idPtrC creation moved here so it will be updated correctly. + if( elementId->Length() == 0 ) + { + CleanupStack::PopAndDestroy( elementId ); + elementId = NULL; + idPtrC.Set( KNullDesC8 ); + } + + switch( type ) + { + case EBSInt: + { + TInt intData = aStream.ReadInt16L(); + TRACE( T_LIT( "CBSBrandHandler::ReadStreamL type INT")); + if( match ) + { + // Codescanner warning: neglected to put variable on cleanup stack (id:35) + // This method cannot leave after this line + returnValue = BSElementFactory::CreateBSElementL( idPtrC, // CSI: 35 # See above + EBSInt, + intData ); + } + break; + } + case EBSText: + case EBSFile: // flow through + { + TInt textSize = aStream.ReadInt16L(); + HBufC* textData = HBufC::NewLC( textSize ); + + TPtr textPtr = textData->Des(); + aStream.ReadL( textPtr, textSize ); + + TRACE( T_LIT( "CBSBrandHandler::ReadStreamL type TEXT/ FILE")); + if( match ) + { + // Codescanner warning: neglected to put variable on cleanup stack (id:35) + // This method cannot leave after this line + returnValue = BSElementFactory::CreateBSElementL( idPtrC, // CSI: 35 # See above + type, + *textData ); + } + + CleanupStack::PopAndDestroy( textData ); + break; + } + case EBSList: + { + RBSObjOwningPtrArray listData; + CleanupClosePushL( listData ); + TInt count = aStream.ReadInt16L(); + + for( TInt i = 0; i < count; i++ ) + { + MBSElement* subElement = ReadStreamL( KNullDesC8, aStream, ETrue ); + CleanupDeletePushL( subElement ); + listData.AppendL( subElement ); + CleanupStack::Pop(); // subElement + } + + if( match ) + { + // Codescanner warning: neglected to put variable on cleanup stack (id:35) + // This method cannot leave after this line + returnValue = BSElementFactory::CreateBSElementL( idPtrC, // CSI: 35 # See above + EBSList, + listData ); + } + CleanupStack::Pop(); // listData + break; + } + case EBSBuffer: + { + TInt bufferSize = aStream.ReadInt16L(); + HBufC8* buffeData = HBufC8::NewLC( bufferSize ); + + TPtr8 bufferPtr = buffeData->Des(); + aStream.ReadL( bufferPtr, bufferSize ); + + if( match ) + { + // Codescanner warning: neglected to put variable on cleanup stack (id:35) + // This method cannot leave after this line + returnValue = BSElementFactory::CreateBSElementL( idPtrC, // CSI: 35 # See above + EBSBuffer, + *buffeData ); + } + + CleanupStack::PopAndDestroy( buffeData ); + break; + } + case EBSBitmap: + { + TInt length = aStream.ReadInt16L(); + HBufC8* fileId = HBufC8::NewLC( length ); + + TPtr8 fileIdPtr = fileId->Des(); + aStream.ReadL( fileIdPtr, length ); + + TInt bitmapId = aStream.ReadInt16L(); + TInt maskId = aStream.ReadInt16L(); + TInt skinId = aStream.ReadInt16L(); + TInt skinMaskId = aStream.ReadInt16L(); + + TRACE( T_LIT( "CBSBrandHandler::ReadStreamL type BITMAP .. bitmap ID is [%d]"), bitmapId); + if( match ) + { + CBSBitmap* bitmap = CBSBitmap::NewLC( bitmapId, + maskId, + skinId, + skinMaskId, + fileIdPtr ); + + // Codescanner warning: neglected to put variable on cleanup stack (id:35) + // This method cannot leave after this line + returnValue = BSElementFactory::CreateBSElementL( idPtrC, // CSI: 35 # See above + EBSBitmap, + bitmap ); + CleanupStack::Pop( bitmap ); + } + CleanupStack::PopAndDestroy( fileId ); + + break; + } + default: + { + TRACE( T_LIT( "CBSBrandHandler::ReadStreamL type DEFAULT : corrupt")); + User::Leave( KErrCorrupt ); + break; + } + } + + if( elementId ) + { + CleanupStack::PopAndDestroy( elementId ); + } + + TRACE( T_LIT( "CBSBrandHandler::ReadStreamL END")); + return returnValue; + } + +// END OF FILE + diff -r 000000000000 -r e6b17d312c8b brandingserver/bsserver/cbsbrandhandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/brandingserver/bsserver/cbsbrandhandler.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,116 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: CBSBrandHandler.h +* +*/ + + +#ifndef __CBSBRANDHANDLER_H__ +#define __CBSBRANDHANDLER_H__ + +#include "rbsobjowningptrarray.h" + +#include +#include +#include +#include +#include +#include + +// FORWARD DECLARATIONS +class MBSElement; +class CBSStorageManager; +class CBSSession; + +/** + * + * + */ +NONSHARABLE_CLASS( CBSBrandHandler ): public CBase + { + public: + /** + * Two-phased constructor. + */ + static CBSBrandHandler* NewL( const TDesC& aApplicationId, + const TDesC& aBrandId, + const TDesC& aDefaultBrandId, + TLanguage aLanguage, + CBSSession* aSession, + TInt aReserved = 0); + + + + virtual ~CBSBrandHandler(); + + private: // constructors + + void ConstructL( const TDesC& aApplicationId, + const TDesC& aBrandId, + const TDesC& aDefaultBrandId, + CBSSession* aSession ); + + CBSBrandHandler( TLanguage aLanguage, + TInt aReserved ); + + public: + HBufC* GetTextL( const TDesC8& aId ); + HBufC8* GetBufferL( const TDesC8& aId ); + TInt GetIntL( const TDesC8& aId ); + MBSElement* GetSeveralL( RBSObjOwningPtrArray& aIds ); + void GetFileL( const TDesC8& aId, RFile& aFile ); + MBSElement* GetStructureL( TDesC8& aId ); + void SetDefaultBrandIdL( const TDesC8& aBrandId ); + + + TInt isBrandUpdateRequiredL (); + + private: // New methods + + MBSElement* ReadElementLC( const TDesC8& aId, TBool aForceDefault = EFalse ); + + MBSElement* ReadStreamL( const TDesC8& aId, + RFileReadStream& aStream, + TBool aAllowEmptyId = EFalse ); + + void VerifyVersionL(); + void VerifyVersionL( RFileReadStream& aStream ); + + private: // data + HBufC* iDefaultBrand; + /// +#include +#include + +#include "cbsibywriter.h" +#include "bsimportconstants.h" +//#include "importlogwriter.h" +#include "debugtrace.h" + +// CONSTANTS +_LIT8( KIBYHeader1, "\n#ifndef __BRAND_" ); +_LIT8( KIBYHeader2, "\n#define __BRAND_" ); +_LIT8( KIBYHeaderEnd, "_IBY_" ); +_LIT8( KIBYFileItem, "\nfile=" ); +_LIT8( KIBYEmptyLine, "\n" ); +_LIT8( KIBYSpace, " \t\t " ); +_LIT8( KIBYFooter, "\n#endif //__BRAND_" ); + +// File & dir +_LIT8( KIBYBaseSource, "\\epoc32\\winscw\\c" ); + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// CBSIBYWriter::NewL +// --------------------------------------------------------------------------- +// +CBSIBYWriter* CBSIBYWriter::NewL() + { + CBSIBYWriter* self = NewLC(); + CleanupStack::Pop(); + return self; + } + +// --------------------------------------------------------------------------- +// CBSIBYWriter::NewLC +// --------------------------------------------------------------------------- +// +CBSIBYWriter* CBSIBYWriter::NewLC() + { + CBSIBYWriter* self = new (ELeave) CBSIBYWriter(); + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + +// --------------------------------------------------------------------------- +// CBSIBYWriter::ConstructL +// --------------------------------------------------------------------------- +// +void CBSIBYWriter::ConstructL() + { + } + +// --------------------------------------------------------------------------- +// CBSIBYWriter::CBSIBYWriter +// --------------------------------------------------------------------------- +// +CBSIBYWriter::CBSIBYWriter() + { + } + +// --------------------------------------------------------------------------- +// CBSIBYWriter::~CBSIBYWriter +// --------------------------------------------------------------------------- +// +CBSIBYWriter::~CBSIBYWriter() + { + iSourcePath.ResetAndDestroy(); + iSourceFiles.ResetAndDestroy(); + iDestinations.ResetAndDestroy(); + delete iIbyFile; + } + +// --------------------------------------------------------------------------- +// CBSIBYWriter::SetFileItemL +// --------------------------------------------------------------------------- +// +void CBSIBYWriter::SetFileItemL( const TDesC& aSrc, const TDesC& aDest ) + { + TRACE( T_LIT( "CBSIBYWriter::SetFileItemL begin") ); + // Parse and construct filenames + TParse srcparse; + srcparse.Set( aSrc, NULL, NULL ); + + TParse dstparse; + dstparse.Set( aDest, NULL, NULL ); + + // Path + HBufC8* srcpath = HBufC8::NewLC( srcparse.Path().Length() ); + TPtr8 ptr( srcpath->Des() ); + CnvUtfConverter::ConvertFromUnicodeToUtf8( ptr, srcparse.Path() ); + + HBufC8* src = HBufC8::NewLC( srcparse.NameAndExt().Length() ); + ptr.Set( src->Des() ); + CnvUtfConverter::ConvertFromUnicodeToUtf8( ptr, srcparse.NameAndExt() ); + + HBufC8* dst = HBufC8::NewLC( aDest.Length() ); + ptr.Set( dst->Des() ); + + HBufC* newDst = HBufC::NewLC( aDest.Length() ); + TPtr dstPtr( newDst->Des() ); + TPtrC name = dstparse.NameAndExt(); + TPtrC path = dstparse.Path(); + dstPtr.Append( KBSZDrive ); + dstPtr.Append( path ); + dstPtr.Append( name ); + + CnvUtfConverter::ConvertFromUnicodeToUtf8( ptr, dstPtr ); + + TRACE( T_LIT( "CBSIBYWriter::SetFileItemL - setting source file %S"), &aSrc ); + TRACE( T_LIT( "CBSIBYWriter::SetFileItemL - setting destination file %S"), newDst ); + CleanupStack::PopAndDestroy( newDst ); + CleanupStack::Pop( 3 ); + + // Append filepair + iSourcePath.Append( srcpath ); + iSourceFiles.Append( src ); + iDestinations.Append( dst ); + + TRACE( T_LIT( "CBSIBYWriter::SetFileItemL end") ); + } + +// --------------------------------------------------------------------------- +// CBSIBYWriter::WriteIBYFile() +// --------------------------------------------------------------------------- +// +void CBSIBYWriter::WriteIBYFileL( RFs& aFs, const TDesC& aFileName ) + { + TRACE( T_LIT( "CBSIBYWriter::WriteIBYFileL begin") ); + + TInt count = iSourceFiles.Count(); + if( count == 0 ) + { + TRACE( T_LIT( "CBSIBYWriter::WriteIBYFileL - No file elements, nothing to do.") ); + return; + } + if( count != iDestinations.Count() ) + { + TRACE( T_LIT("Internal error: IBY filename count mismatch ( %d != %d )"), + count, iDestinations.Count() ); + User::Leave( KErrCorrupt ); + } + + RFile outfile; + TInt err = outfile.Open( aFs, aFileName, EFileWrite ); + if( err == KErrNotFound ) + { + TRACE( T_LIT( "CBSIBYWriter::WriteIBYFileL - IBY file not initialized!") ); + // if the file is not initialized -> not ready + err = KErrNotReady; + } + User::LeaveIfError( err ); + + // write data + TInt size = -1; + User::LeaveIfError( outfile.Size( size ) ); + + outfile.Write( size, KIBYEmptyLine ); + + TRACE( T_LIT( "CBSIBYWriter::WriteIBYFileL - start writing files to IBY") ); + + for( TInt i = 0; i < count; i++ ) + { + outfile.Write( KIBYFileItem ); + outfile.Write( KIBYBaseSource ); + outfile.Write( iSourcePath[i]->Des() ); + outfile.Write( iSourceFiles[i]->Des() ); + outfile.Write( KIBYSpace ); + outfile.Write( iDestinations[i]->Des() ); + TRACE( T_LIT( "CBSIBYWriter::WriteIBYFileL - %S"), iDestinations[i] ); + } + + TRACE( T_LIT( "CBSIBYWriter::WriteIBYFileL - writing IBY file footer") ); + outfile.Write( KIBYEmptyLine ); + outfile.Write( KIBYFooter ); + outfile.Write( KIBYHeaderEnd ); + + // cleanup + outfile.Close(); + TRACE( T_LIT( "CBSIBYWriter::WriteIBYFileL end") ); + } + +// --------------------------------------------------------------------------- +// CBSIBYWriter::WriteIBYFile() +// --------------------------------------------------------------------------- +// +void CBSIBYWriter::InitIbyFileL( RFs& aFs, const TDesC& aFileName ) + { + TRACE( T_LIT( "CBSIBYWriter::InitIbyFileL begin") ); + HBufC* temp = aFileName.AllocL(); + delete iIbyFile; + iIbyFile = temp; + + TInt err = aFs.MkDir( KBSIbyDirectory ); + if( err == KErrAlreadyExists ) + { + err = KErrNone; + } + User::LeaveIfError( err ); + + TRACE( T_LIT( "CBSIBYWriter::InitIbyFileL IBY directory (%S) created"), &KBSIbyDirectory() ); + + // Open file for writing + RFile outfile; + User::LeaveIfError( outfile.Replace( aFs, aFileName, EFileWrite ) ); + + TRACE( T_LIT( "CBSIBYWriter::InitIbyFileL IBY file (%S) created"), &aFileName ); + + outfile.Write( KIBYHeader1 ); + outfile.Write( KIBYHeaderEnd ); + outfile.Write( KIBYHeader2 ); + outfile.Write( KIBYHeaderEnd ); + outfile.Close(); + TRACE( T_LIT( "CBSIBYWriter::InitIbyFileL end") ); + } +// End of file diff -r 000000000000 -r e6b17d312c8b brandingserver/bsserver/cbsibywriter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/brandingserver/bsserver/cbsibywriter.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,93 @@ +/* +* Copyright (c) 2006-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Writes IBY files +* +*/ + + +#ifndef CBSIBYWRITER_H +#define CBSIBYWRITER_H + +#include + +class RFs; + +/** + * Writes IBY files + * + * @lib + * @since S60 v3.2 + */ +class CBSIBYWriter : public CBase +{ +public: + + static CBSIBYWriter* NewL(); + + static CBSIBYWriter* NewLC(); + + ~CBSIBYWriter(); + + /** + * Initialize IBY file + * + * @param aFs file system handle + * @param aFileName Full name of the iby file + * @since S60 3.2 + * @return none + */ + void InitIbyFileL( RFs& aFs, const TDesC& aFileName ); + + /** + * File item included in IBY file + * + * @since S60 3.2 + * @param aSrc source file + * @param aDest destination file + * @return none + */ + void SetFileItemL( const TDesC& aSrc, const TDesC& aDest ); + + /** + * Writes Iby file from given file items + * + * @since S60 3.2 + * @param aFs file system handle + * @param aFileName Full name of the iby file + * @return none + */ + void WriteIBYFileL( RFs& aFs, const TDesC& aFileName ); + +private: + + CBSIBYWriter(); + + void ConstructL(); + +private: // Data + + // Own. Source path array + RPointerArray iSourcePath; + + // Own. Source files + RPointerArray iSourceFiles; + + // Own. Destination files + RPointerArray iDestinations; + + // Own. Iby file name + HBufC* iIbyFile; +}; + +#endif //CBSIBYWRITER_H diff -r 000000000000 -r e6b17d312c8b brandingserver/bsserver/cbsinstallhandler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/brandingserver/bsserver/cbsinstallhandler.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,564 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: CBSInstallhandler.cpp +* +*/ + + +// INCLUDE FILES +#include +#include +#include +#include +#include +#include + +#include "cbsinstallhandler.h" +#include "debugtrace.h" +#include "bsimportconstants.h" +#include "cbsstoragemanager.h" + + +// CONSTANTS +// branding installer application +_LIT( KInstallerApp, "bsinstall.exe" ); + + +// wildcard for finding installed brand files +_LIT( KBrandWild, "*" ); + +// Line feed separates uninstalled brands from each other +_LIT( KLineFeed, "\n" ); + + +// Pub&Sub Key for uninstalled brands +const TUint KUninstallKey = 0x01; + + +// METHODS + +// Two-phased constructor. +CBSInstallHandler* CBSInstallHandler::NewL( ) + { + TRACE( T_LIT( "CBSInstallHandler::NewL begin") ); + CBSInstallHandler* self = new ( ELeave ) CBSInstallHandler() ; + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + TRACE( T_LIT( "CBSInstallHandler::NewL end") ); + return self; + } + +// Symbian OS default constructor can leave. +void CBSInstallHandler::ConstructL() + { + User::LeaveIfError( iFs.Connect() ); + CActiveScheduler::Add( this ); + } + +// Destructor +CBSInstallHandler::~CBSInstallHandler() + { + Cancel(); + iFs.Close(); + } + +// C++ default constructor can NOT contain any code, that +// might leave. +// +CBSInstallHandler::CBSInstallHandler() : + CActive( EPriorityIdle ) + { + } + +// ----------------------------------------------------------------------------- +// CBSInstallHandler::InstallNewFilesL() +// ----------------------------------------------------------------------------- +// +void CBSInstallHandler::InstallNewFilesL() + { + TRACE( T_LIT( "CBSInstallHandler::InstallNewFilesL begin") ); + TInt needInstaller = 0; + + + TRAP_IGNORE( needInstaller += CheckForDiscardedBrandsL( KBSDataStore ) ); + + // uninstall removed brands + needInstaller += + SyncFilesL( KInstallPath, KInstallObservePath, EInstallDeleteFromSrc ); + + // install new brands + needInstaller += + SyncFilesL( KInstallObservePath, KInstallPath, EInstallCopyNewToDest ); + + if( needInstaller ) + { + // something new was installed + LaunchInstallerAppL(); + } + TRACE( T_LIT( "CBSInstallHandler::InstallNewFilesL end") ); + } + +// ----------------------------------------------------------------------------- +// CBSInstallHandler::StartObservingL() +// ----------------------------------------------------------------------------- +// +void CBSInstallHandler::StartObservingL() + { + TRACE( T_LIT( "CBSInstallHandler::StartObservingL begin") ); + if( IsActive() ) + { + __ASSERT_DEBUG( EFalse, User::Leave( KErrAlreadyExists ) ); + return; + } + + // observe path: (drive:)[private](/import/install) + TPath path( KNullDesC ); + GetPrivateFolder( path, KInstallObservePath ); + + iFs.NotifyChange( ENotifyEntry, iStatus, path ); + SetActive(); + TRACE( T_LIT( "CBSInstallHandler::StartObservingL end") ); + } + +// ----------------------------------------------------------------------------- +// CBSInstallHandler::StopObserving() +// ----------------------------------------------------------------------------- +// +void CBSInstallHandler::StopObserving() + { + TRACE( T_LIT( "CBSInstallHandler::StopObserving begin") ); + Cancel(); + TRACE( T_LIT( "CBSInstallHandler::StopObserving end") ); + } + +// ----------------------------------------------------------------------------- +// CBSInstallHandler::DoCancel() +// ----------------------------------------------------------------------------- +// +void CBSInstallHandler::DoCancel() + { + iFs.NotifyChangeCancel(); + } + +// ----------------------------------------------------------------------------- +// CBSInstallHandler::RunL() +// ----------------------------------------------------------------------------- +// +void CBSInstallHandler::RunL() + { + TRACE( T_LIT( "CBSInstallHandler::RunL start") ); + if( iStatus == KErrNone ) + { + TRACE( T_LIT( "CBSInstallHandler::RunL installing...") ); + TRAP_IGNORE( InstallNewFilesL() ); + StartObservingL(); + } + else + { + TRACE( T_LIT( "CBSInstallHandler::RunL observing stopped") ); + } + TRACE( T_LIT( "CBSInstallHandler::RunL end") ); + } + +// ----------------------------------------------------------------------------- +// CBSInstallHandler::LaunchInstallerAppL() +// ----------------------------------------------------------------------------- +// +void CBSInstallHandler::LaunchInstallerAppL() + { + TRACE( T_LIT( "CBSInstallHandler::LaunchInstallerAppL start") ); + // initialize RApaLsSession + RApaLsSession apas; + User::LeaveIfError( apas.Connect() ); + CleanupClosePushL( apas ); + apas.GetAllApps(); + + // start installer + CApaCommandLine* command = CApaCommandLine::NewLC(); + command->SetExecutableNameL( KInstallerApp ); + User::LeaveIfError( apas.StartApp( *command ) ); + TRACE( T_LIT( "CBSInstallHandler::LaunchInstallerAppL bsinstall.exe launched OK") ); + + CleanupStack::PopAndDestroy( 2 ); // apas, command + TRACE( T_LIT( "CBSInstallHandler::LaunchInstallerAppL end") ); + } + +// ----------------------------------------------------------------------------- +// CBSInstallHandler::SyncFilesL() +// ----------------------------------------------------------------------------- +// +TBool CBSInstallHandler::SyncFilesL( const TDesC& aSrcDir, const TDesC& aDestDir, + TInstallOperation aOperation ) + { + TRACE( T_LIT( "CBSInstallHandler::SyncFilesL start") ); + + // Check new install folder + HBufC* fileBuf = HBufC::NewLC( KMaxFileName ); + TPtr file( fileBuf->Des() ); + GetPrivateFolder( file, aSrcDir ); + + TBool ret = BaflUtils::PathExists( iFs, file ); + if( !ret ) + { + // install folder doesn't exist. + TRACE( T_LIT( + "CBSInstallHandler::SyncFilesL no src folder!") ); + CleanupStack::PopAndDestroy( fileBuf ); + return EFalse; + } + + // Apply extension filter + file.Append( KBrandWild ); // + file.Append( KBrandInstallExt ); // *.install + + // Get list of src dir files + CDir* dir = NULL; + User::LeaveIfError( iFs.GetDir( file, + KEntryAttNormal, ESortNone, dir ) ); + CleanupStack::PushL( dir ); + + // Create destination directory + GetPrivateFolder( file, aDestDir ); + BaflUtils::EnsurePathExistsL( iFs, file ); + + // Compare source dir to destination + TBool OperationExecuted = EFalse; + TInt count = dir->Count(); + + for( TInt i = 0; i < count; i++ ) + { + GetPrivateFolder( file, aDestDir ); + file.Append( (*dir)[i].iName ); + if( !BaflUtils::FileExists( iFs, file ) ) + { + // file does not exist in destionation dir + // => react according to operation + HBufC* fileSrcBuf = HBufC::NewLC( KMaxFileName ); + TPtr fileSrc( fileSrcBuf->Des() ); + GetPrivateFolder( fileSrc, aSrcDir ); + fileSrc.Append( (*dir)[i].iName ); + + switch( aOperation ) + { + case EInstallCopyNewToDest: + { + // copy new files from src to destination + TRACE( T_LIT( "CBSInstallHandler::SyncFilesL copy") ); + OperationNotifyL( aOperation, file ); + User::LeaveIfError( BaflUtils::CopyFile( + iFs, fileSrc, file ) ); + break; + } + case EInstallDeleteFromSrc: + { + // delete files from src if they are not found from dest + TRACE( T_LIT( "CBSInstallHandler::SyncFilesL del") ); + OperationNotifyL( aOperation, fileSrc ); + User::LeaveIfError( BaflUtils::DeleteFile( iFs, fileSrc ) ); + break; + } + default: + { + // Every operation should have a case! + __ASSERT_DEBUG( EFalse, + User::LeaveIfError( KErrArgument ) ); + } + } + + OperationExecuted = ETrue; + CleanupStack::PopAndDestroy( fileSrcBuf ); + } + } + CleanupStack::PopAndDestroy( 2 ); // fileBuf, dir + TRACE( T_LIT( "CBSInstallHandler::SyncFilesL end") ); + return OperationExecuted; + } + +// ----------------------------------------------------------------------------- +// CBSInstallHandler::OperationNotifyL() +// ----------------------------------------------------------------------------- +// +void CBSInstallHandler::OperationNotifyL( TInstallOperation aOperation, + const TDesC& aSrcFile ) + { + TRACE( T_LIT( "CBSInstallHandler::OperationNotifyL start") ); + if( aOperation == EInstallDeleteFromSrc ) + { + // parse brand id and application id from filename + TParse parse; + parse.Set( aSrcFile, NULL, NULL ); + + // find ids from filename + TInt firstSepar = parse.Name().Find( KInstallFileDataSeparator ); + TInt secondSepar = parse.Name(). + Mid( firstSepar + 1 ).Find( KInstallFileDataSeparator ); + TInt cutlen = 0; + secondSepar == KErrNotFound ? cutlen = parse.Name().Length() : + cutlen = firstSepar + secondSepar + 1; + + // brandString: [brandId]$[appId] + TPtrC brandString ( parse.Name().Left( cutlen ) ); + if( IsBrandInstalled( brandString ) ) + { + TRACE( T_LIT( "CBSInstallHandler::OperationNotifyL %S exists in import\\install =>RProperty NOT UPDATED!"),&aSrcFile ); + // brand still exists, so no need to uninstall. + return; + } + + // Create discardedbrand.txt file in the /appid/brandid path + CreateFlagFile( aSrcFile ); + + UpdateRPropertyL( brandString ); + + TRACE( T_LIT( "CBSInstallHandler::OperationNotifyL uninstall string to pub&sub updated OK") ); + } + TRACE( T_LIT( "CBSInstallHandler::OperationNotifyL end") ); + } + +// ----------------------------------------------------------------------------- +// CBSInstallHandler::IsBrandInstalled() +// ----------------------------------------------------------------------------- +// +TBool CBSInstallHandler::IsBrandInstalled( const TDesC& aBrand ) + { + TRACE( T_LIT( "CBSInstallHandler::IsBrandInstalled start") ); + TFileName file; + GetPrivateFolder( file, KInstallObservePath ); + file.Append( aBrand ); + file.Append( KBrandInstallExt ); + + // check file directly: + // aaa$bbb -> aaa$bbb.install + CDir* dir = NULL; + iFs.GetDir( file, KEntryAttNormal, ESortNone, dir ); + if( dir->Count() > 0 ) + { + // brand is installed + delete dir; + TRACE( T_LIT( "CBSInstallHandler::IsBrandInstalled true") ); + return ETrue; + } + delete dir; + dir = NULL; + + GetPrivateFolder( file, KInstallObservePath ); + file.Append( aBrand ); + file.Append( KInstallFileDataSeparator ); + file.Append( KBrandWild ); + file.Append( KBrandInstallExt ); + + // check file with different versions: + // aaa$bbb -> aaa$bbb$*.install + iFs.GetDir( file, KEntryAttNormal, ESortNone, dir ); + if( dir->Count() > 0 ) + { + // brand is installed + delete dir; + TRACE( T_LIT( "CBSInstallHandler::IsBrandInstalled true") ); + return ETrue; + } + delete dir; + + // brand is not installed + TRACE( T_LIT( "CBSInstallHandler::IsBrandInstalled false") ); + return EFalse; + } + +// ----------------------------------------------------------------------------- +// CBSInstallHandler::GetPrivateFolder() +// ----------------------------------------------------------------------------- +// +void CBSInstallHandler::GetPrivateFolder( TDes& aPath, const TDesC& aAppend ) + { + iFs.PrivatePath( aPath ); + aPath.Insert( 0, KInstallDrive ); + aPath.Append( aAppend ); + } + +void CBSInstallHandler::CreateFlagFile(const TDesC& aSrcFile) + { + TRACE( T_LIT( "CBSInstallHandler::CreateFlagFile begin") ); + // parse brand id and application id from aSrcFile + TParse parse; + parse.Set( aSrcFile, NULL, NULL ); + + // find ids from filename + TInt firstSepar = parse.Name().Find( KInstallFileDataSeparator ); + + // Get the brand Id + HBufC* brandId = (parse.Name().Left(firstSepar)).AllocL(); + + // to get application id + TInt secondSepar = parse.Name(). + Mid( firstSepar + 1 ).Find( KInstallFileDataSeparator ); + + TInt cutlen = 0; + secondSepar == KErrNotFound ? cutlen = parse.Name().Length() : + cutlen = firstSepar + secondSepar + 1; + + + TParse parseAgain; + parseAgain.Set(parse.Name().Left( cutlen ), NULL, NULL ); + HBufC* applicationId = (parseAgain.Name().Right( cutlen - firstSepar - 1)).AllocL(); + + + HBufC *fileName = CBSStorageManager::ConstructDiscardBrandFileNameL(*applicationId, *brandId) ; + CleanupStack::PushL(fileName); + HBufC *fullPath = CBSStorageManager::FullDiscardBrandFileNameLC( *fileName ) ; + + // crate a flag file + RFile file; + file.Create(iFs, *fullPath, EFileWrite); + file.Close() ; + + delete brandId ; + delete applicationId ; + + CleanupStack::PopAndDestroy(fullPath) ; + CleanupStack::PopAndDestroy(fileName) ; + TRACE( T_LIT( "CBSInstallHandler::CreateFlagFile end") ); + } + +// ----------------------------------------------------------------------------- +// CBSInstallHandler::CheckForDiscardedBrandsL() +// ----------------------------------------------------------------------------- +// +TBool CBSInstallHandler::CheckForDiscardedBrandsL( const TDesC& aDir ) + { + TRACE( T_LIT( "CBSInstallHandler::CheckForDiscardedBrandsL begin") ); + TBool discardedBrandExists( EFalse ); + + CDir* appDir = NULL; // will contain all application folders + + TPath path; + iFs.PrivatePath( path ); + path.Insert( 0, KInstallDrive ); + path.Append( aDir ); + path.Append( KDirSeparator ); // "C:\\private\\102828dd\\data\\" + + User::LeaveIfError( + iFs.GetDir( path, KEntryAttDir, ESortNone, appDir ) ); + CleanupStack::PushL( appDir ); + + /*TFileName find( path ); + find.Append( KInstallFiles );*/ + + // create array of files (as text) + TInt count = appDir->Count(); + //for each application do... + for( TInt i = 0; i < count; i++ ) + { + TFileName file( path ); + file.Append( (*appDir)[i].iName ); + file.Append( KDirSeparator ); // "C:\\private\\102828dd\\data\\xsp\\" + + TRACE( T_LIT( "CBSInstallHandler::CheckForDiscardedBrandsL AppDir='%S'"),&file ); + CDir* brandDir = NULL; // will contain all brand folder for each application + User::LeaveIfError( + iFs.GetDir( file, KEntryAttDir, ESortNone, brandDir ) ); + CleanupStack::PushL( brandDir ); + + TInt countBrands = brandDir->Count(); + //for each brand of a certain application do... + for( TInt j(0) ; j < countBrands ; j++ ) + { + TFileName discardedFile( file ); + discardedFile.Append( (*brandDir)[j].iName ); + discardedFile.Append( KDirSeparator ); + discardedFile.Append( KDiscardBrandFileName ); // "C:\\private\\102828dd\\data\\xsp\\branda\\discarded.txt" + + TRACE( T_LIT( "CBSInstallHandler::CheckForDiscardedBrandsL BrandDir='%S'"),&file ); + + // check for the existance of the 'discarded.txt' file + if ( BaflUtils::FileExists( iFs, discardedFile ) ) + { + TRACE( T_LIT( "CBSInstallHandler::CheckForDiscardedBrandsL '%S' found!=>brand is discarded."),&discardedFile ); + discardedBrandExists = ETrue; + + //set RProperty for this brand + + //the string written to RProperty: + //"[brandId]$[applicationId]"(e.g."branda$xsp") + HBufC* writeBuf = HBufC::NewLC( RProperty::KMaxPropertySize ); + TPtr writeData( writeBuf->Des() ); + writeData.Append( (*brandDir)[j].iName ); + writeData.Append( KInstallFileDataSeparator ); + writeData.Append( (*appDir)[i].iName ); + TRACE( T_LIT( "CBSInstallHandler::CheckForDiscardedBrandsL uninstallstring='%S'"),writeBuf ); + + //UpdateProperty here!!! + UpdateRPropertyL( writeData ); + + CleanupStack::PopAndDestroy( writeBuf ); + } + } + CleanupStack::PopAndDestroy( brandDir ); + } + + CleanupStack::PopAndDestroy( appDir ); + TRACE( T_LIT( "CBSInstallHandler::CheckForDiscardedBrandsL end") ); + return discardedBrandExists; + } + + +// ----------------------------------------------------------------------------- +// CBSInstallHandler::UpdateRPropertyL +// ----------------------------------------------------------------------------- +// +void CBSInstallHandler::UpdateRPropertyL( const TDesC& aUninstallationString ) + { + HBufC* dataBuf = HBufC::NewLC( RProperty::KMaxPropertySize ); + TPtr data( dataBuf->Des() ); + + // Update uninstall string to pub&sub (only if the RProperty does not + // contain the unistallation string yet) + RProcess me; + TUid uid = me.Identity(); + TInt ret = RProperty::Define( uid, KUninstallKey, RProperty::EText); + if( ret != KErrAlreadyExists ) + { + TRACE( T_LIT( "CBSInstallHandler::UpdateRPropertyL RProperty does not exist") ); + User::LeaveIfError( ret ); + } + TRACE( T_LIT( "CBSInstallHandler::UpdateRPropertyL RProperty created/exists OK") ); + User::LeaveIfError( RProperty::Get( uid, KUninstallKey, data ) ); + + // don't append the uninstall string in case it already exists + // in the RProperty + if( KErrNotFound == data.Find( aUninstallationString ) ) + { + if( data.Length() > 0 ) + { + data.Append( KLineFeed ); + TRACE( T_LIT( "CBSInstallHandler::UpdateRPropertyL lineFeed appended to RProperty uninstallstring") ); + } + data.Append( aUninstallationString ); + TRACE( T_LIT( "CBSInstallHandler::UpdateRPropertyL '%S' appended to RProperty uninstallstring"), &aUninstallationString ); + if( data.Length() <= RProperty::KMaxPropertySize ) + { + User::LeaveIfError( RProperty::Set( uid, KUninstallKey, data ) ); + TRACE( T_LIT( "CBSInstallHandler::UpdateRPropertyL RProperty::Set OK") ); + } + } + else + { + TRACE( T_LIT( "CBSInstallHandler::UpdateRPropertyL '%S' already exists in RProperty"), &aUninstallationString ); + } + + CleanupStack::PopAndDestroy( dataBuf ); + + } + +// END OF FILE diff -r 000000000000 -r e6b17d312c8b brandingserver/bsserver/cbsinstallhandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/brandingserver/bsserver/cbsinstallhandler.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,176 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: cbsinstallhandler.h +* +*/ + + +#ifndef __CBSINSTALLHANDLER_H__ +#define __CBSINSTALLHANDLER_H__ + +#include + +// FORWARD DECLARATIONS +class RFs; + +/** + * CBSInstallHandler + * + * Handles installation and uninstallation of brand packages. + * Calls external application "bsinstall.exe" to do the actual work. + * Can Observe the installation directory so that any sis installation + * can be detected while the server is running. + * + */ +NONSHARABLE_CLASS( CBSInstallHandler ): public CActive + { + public: + + // Operations for folder synchronization: + enum TInstallOperation + { + // copy files from source to destination if they don't + // already exists. + EInstallCopyNewToDest, + + // Delete files from source directory if the same + // files doesn't exist in destination directory. + EInstallDeleteFromSrc + }; + + public: // constructors + + static CBSInstallHandler* NewL(); + + virtual ~CBSInstallHandler(); + + private: // constructors + + void ConstructL(); + + CBSInstallHandler(); + + public: + + /** + * Uninstall removed brands and installs new brands. + * This should be called right after construction to sync the + * installation state. + */ + void InstallNewFilesL(); + + /** + * Start observing installation folder. Detects new brands if they + * are installed while the server is active. + */ + void StartObservingL(); + + /** + * Stop observing installation folder. All new brands are installed + * only when calling InstallNewFilesL. + */ + void StopObserving(); + + private: // From CActive + + /** + * @see CActive + */ + void RunL(); + + /** + * @see CActive + */ + void DoCancel(); + + private: // new methods + + /** + * Launches external installer application. It should install all + * available brands into server. + */ + void LaunchInstallerAppL(); + + /** + * Sync files between aSrcDir and aDestDir, according to given + * operation. See TInstallOperation for operations. Calls + * OperationNotifyL before every operation. + * + * @param aSrcDir Source directory + * @param aDestDir Destination directory + * @param aOperation Sync operation to execute + * @return ETrue - Something synchronized + * EFalse - Nothing synchronized + */ + TBool SyncFilesL( const TDesC& aSrcDir, const TDesC& aDestDir, + TInstallOperation aOperation ); + + /** + * Notification that file is about to be synchronized. + * + * @param aOperation operation type which will be executed + * @param aSrcFile file under operation + */ + void OperationNotifyL( TInstallOperation aOperation, + const TDesC& aSrcFile ); + + /** + * check if some version of given brand is installed in + * branding server. + * + * @param aBrand brand installation file to check + * this has to be brand file name without extension and + * version information. + */ + TBool IsBrandInstalled( const TDesC& aBrand ); + + /** + * Helper method to get servers private path + * @param aPath contains the path to servers private folder + * @param aAppend text to add into private path. + */ + void GetPrivateFolder( TDes& aPath, const TDesC& aAppend = KNullDesC ); + + /** + * To create a flag file if brand gets discarded + * @param aSrcFile file under operation + */ + void CreateFlagFile(const TDesC& aSrcFile); + + /** + * Checks if an discarded brand exists. + * (It also writes the RProperty for the bsinstall.exe) + * + * @param aDir the folder of the data storages + * @return ETrue, in case a discarded brand was found, EFalse otherwise + */ + TBool CheckForDiscardedBrandsL( const TDesC& aDir ); + + + /** + * Updates the RProperty. The specified string is added to the + * RProperty only if RProperty does not contain the same string yet. + * + * @param aUninstallationString a string + */ + void UpdateRPropertyL( const TDesC& aUninstallationString ); + + private: // data + + // Own. File server session handle. + RFs iFs; + }; + +#endif // __CBSINSTALLHANDLER_H__ +// END OF FILE diff -r 000000000000 -r e6b17d312c8b brandingserver/bsserver/cbsserver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/brandingserver/bsserver/cbsserver.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,664 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: cbsserver.cpp +* +*/ + + +// INCLUDE FILES + +#define __INCLUDE_CAPABILITY_NAMES__ +#define __INCLUDE_ALL_SUPPORTED_CAPABILITIES__ + +#include "cbsserver.h" +#include "cbssession.h" +#include "bsserverdefs.h" +#include "debugtrace.h" +#include "cbsstoragemanager.h" +#include "cbsinstallhandler.h" +#include "cbsbackupobserver.h" + +// CBSFileMapping + +CBSServer::CBSFileMapping* CBSServer::CBSFileMapping::NewL( CBSSession* aSession, + const TDesC& aFile, + TBool aVersioned ) + { + CBSFileMapping* self = new( ELeave ) CBSFileMapping( aVersioned ); + CleanupStack::PushL( self ); + self->ConstructL( aSession, aFile ); + CleanupStack::Pop( self ); + return self; + } +void CBSServer::CBSFileMapping::ConstructL( CBSSession* aSession, + const TDesC& aFile ) + { + iSession = aSession; + iFile = aFile.AllocL(); + } +CBSServer::CBSFileMapping::CBSFileMapping( TBool aVersioned ) +: iVersioned( aVersioned ) + { + } +CBSServer::CBSFileMapping::~CBSFileMapping() + { + delete iFile; + } + +CBSSession* CBSServer::CBSFileMapping::Session() + { + return iSession; + } +const TDesC& CBSServer::CBSFileMapping::File() + { + return *iFile; + } +TBool CBSServer::CBSFileMapping::Versioned() + { + return iVersioned; + } + + +// ============================================================== +// =============== PLATSEC POLICY CONFIGURATION ================= +// ============================================================== + +static const TInt KBSPlatSecRangeCount = 2; + +//Ranges for the Request values +static const TInt KBSPlatSecRanges[ KBSPlatSecRangeCount ] = + { + 0, + EBSOperationLast + }; + + +// Element indexes for the defined ranges +static const TUint8 KBSPlatSecElementsIndex[ KBSPlatSecRangeCount ] = + { + 0, + CPolicyServer::ENotSupported + }; + + +// Policy elements +static const CPolicyServer::TPolicyElement KBSPlatSecElements[] = + { + { + _INIT_SECURITY_POLICY_C2( ECapabilityReadUserData, + ECapabilityWriteUserData ), + -5 //CPolicyServer::EFailClient + } + }; + + +// The platsec policy +static const CPolicyServer::TPolicy KBSPlatSecPolicy = + { + // Shortcut to the index into Elements,that is used to check a connection attempt + 0, + + // Number of ranges in the iRanges array + KBSPlatSecRangeCount, + + // A pointer to an array of ordered ranges of request numbers + KBSPlatSecRanges, + + // A pointer to an array of TUint8 values specifying + // the appropriate action to take for each range in iRanges + KBSPlatSecElementsIndex, + + // A pointer to an array of distinct policy elements + KBSPlatSecElements + }; + + + +// ============================================================== +// ======================= SERVER ============================== +// ============================================================== +void CBSServer::ExecuteL() + { + TRACE( T_LIT( "CBrandingServer::ExecuteL() begin") ); + // start scheduler + CActiveScheduler* pA = new( ELeave )CActiveScheduler; + CleanupStack::PushL( pA ); + CActiveScheduler::Install( pA ); + + + // create server + CBSServer* server = new( ELeave ) CBSServer(); + CleanupStack::PushL( server ); + server->InitializeL(); + server->StartL( KBSServerName ); + + + //Signal client that we are started + RProcess().Rendezvous( KErrNone ); + + //Execute the server + // Codescanner warning: using CActiveScheduler::Start (id:3) + // this has to be called for server starting. + CActiveScheduler::Start(); // CSI: 3 # See above + + + //Cleanup + CleanupStack::PopAndDestroy( server );//server + CleanupStack::PopAndDestroy( pA ); + CActiveScheduler::Install( NULL ); + TRACE( T_LIT( "CBrandingServer::ExecuteL() end") ); + } + + + +CBSServer::~CBSServer() + { + TRACE( T_LIT( "CBrandingServer::~CBSServer() begin") ); + delete iBackupObserver; + delete iInstallHandler; + iSessions.Close(); + iFileMapping.Close(); + delete iStorageManager; + +#if _BullseyeCoverage + cov_write(); +#endif + TRACE( T_LIT( "CBrandingServer::~CBSServer() end") ); + } + + + +CBSServer::CBSServer() + : CPolicyServer( CActive::EPriorityStandard, + KBSPlatSecPolicy ) + { + } + + + +CSession2* CBSServer::NewSessionL( const TVersion &aVersion, + const RMessage2& /*aMessage*/ ) const + { + TRACE( T_LIT( "CBrandingServer::NewSessionL() begin") ); + TVersion srvVersion( KBSVersionMajor, + KBSVersionMinor, + KBSVersionBuild ); + + + if( !User::QueryVersionSupported( aVersion, srvVersion ) ) + { + User::Leave( KErrNotSupported ); + } + + CBSSession* session = CBSSession::NewL(); + //enable backup observer + iBackupObserver->RegisterObserver( session ); + + TRACE( T_LIT( "CBrandingServer::NewSessionL() end session[%d] created"), session ); + return session; + } + + +CPolicyServer::TCustomResult + CBSServer::CustomFailureActionL( const RMessage2& aMsg, + TInt /*aAction*/, + const TSecurityInfo& aMissing ) + { + TRACE( T_LIT( "CBrandingServer::CustomFailureActionL() Request %d to session [%d] failed."), + aMsg.Function(), aMsg.Session() ); + + TBuf<512> diagnosticMsg; + _LIT( KDetails, "Failure details: "); + diagnosticMsg.Append( KDetails ); + _LIT( KFormat, "SecureId[%d] VendorId[%d] Missing caps[" ); + diagnosticMsg.AppendFormat( KFormat, + aMissing.iSecureId.iId, aMissing.iVendorId.iId ); + + const SCapabilitySet& missingCaps = (const SCapabilitySet&) aMissing.iCaps; + TBuf<1> separator; + _LIT( KSeparator, "]" ); + for( TInt ix = 0; ix < ECapability_Limit; ix++ ) + { + if( missingCaps[ix>>5] &(1<<(ix&31))) + { + diagnosticMsg.Append( separator ); + + const char* capName = CapabilityNames[ ix ]; + while( *capName ) + { + TUint16 c = *capName; + diagnosticMsg.Append( &c, 1 ); + ++capName; + } + + separator = KSeparator; + } + } + + diagnosticMsg.Append( KSeparator ); + TRACE( T_LIT( "%S"), &diagnosticMsg ); + + return CPolicyServer::EFail; + } + +void CBSServer::HandleBackupStateL( TBackupState aState ) + { + switch( aState ) + { + case EBackupNotActive: // backup has completed + { + // restart install handler and check for brand changes + iInstallHandler->InstallNewFilesL(); + iInstallHandler->StartObservingL(); + + //notify clients that we're back in business + break; + } + case EBackupActive: // backup activated + { + // stop install handler + iInstallHandler->StopObserving(); + + // Notify clients that branding data is not currently + // available + break; + } + default: + { + // unknown state + } + } + } + +void CBSServer::SessionCreatedL( CBSSession* aSession ) + { + TRACE( T_LIT( "CBSServer::SessionCreatedL begin aSession[%d]"),aSession ); + iSessionCount++; + iSessions.AppendL( aSession ); + } + + +void CBSServer::SessionDied( CBSSession* aSession ) + { + TInt count = iSessions.Count(); + for( TInt i = 0; i < count; i++ ) + { + if( iSessions[i] == aSession ) + { + iSessions.Remove( i ); + break; + } + } + TInt ignore = 0; + TRAP( ignore, UnRegisterSessionL( aSession ) ); + + //enable backup observer + iBackupObserver->UnregisterObserver( aSession ); + + iSessionCount--; + if( iSessionCount == 0 ) + { + // Codescanner warning: using CActiveScheduler::Stop ( Id: 4) + // it is required to stop the server + CActiveScheduler::Stop(); // CSI: 4 # See above + } + } + + + +TBool CBSServer::MatchSessionL( const TDesC& aApplicationId, + const TDesC& aBrandId, + TLanguage aLanguageId, + CBSSession* aSession, + TInt aReserved ) + { + TInt sessionCount = iSessions.Count(); + TBool returnValue = EFalse; + for( TInt i = 0; i < sessionCount; i++ ) + { + if( iSessions[i] == aSession ) + { + // we don't want to report the querying session itself + continue; + } + if( iSessions[i]->MatchSessionL( aApplicationId, + aBrandId, + aLanguageId, + aReserved ) ) + { + // even one match is enough for us + returnValue = ETrue; + break; + } + } + return returnValue; + } + +TBool CBSServer::MatchSessionUninstallL( const TDesC& aApplicationId, + const TDesC& aBrandId, CBSSession* aSession) +{ + TInt sessionCount = iSessions.Count(); + TBool returnValue = EFalse; + for( TInt i = 0; i < sessionCount; i++ ) + { + if( iSessions[i] == aSession ) + { + // we don't want to report the querying session itself + continue; + } + if( iSessions[i]->MatchSessionUninstallL( aApplicationId, + aBrandId )) + { + // even one match is enough for us + returnValue = ETrue; + break; + } + } + return returnValue; + +} + +void CBSServer::RegisterFileForSessionL( CBSSession* aSession, + const TDesC& aFile, + TBool aVersioned ) + { + TRACE( T_LIT( "CBSServer::RegisterFileForSessionL begin aSession[%d],aFile[%S]"),aSession,&aFile ); + TBool found = EFalse; + TInt count = iFileMapping.Count(); + for( TInt i = 0; i < count; i ++ ) + { + if( iFileMapping[i]->Session() == aSession && iFileMapping[i]->File() == aFile && + iFileMapping[i]->Versioned() == aVersioned) + { + found = ETrue; + } + } + + if(!found) + { + + CBSFileMapping* fileMapping = CBSFileMapping::NewL( aSession, aFile, aVersioned ); + CleanupStack::PushL( fileMapping ); + iFileMapping.AppendL( fileMapping ); + CleanupStack::Pop( fileMapping ); + } + TRACE( T_LIT( "CBSServer::RegisterFileForSessionL end") ); + } + +void CBSServer::UnRegisterSessionL( CBSSession* aSession ) + { + TRACE( T_LIT( "CBSServer::RegisterFileForSessionL begin aSession[%d]"),aSession ); + TInt count = iFileMapping.Count(); + for( TInt i = 0; i < count; i ++ ) + { + if( iFileMapping[i]->Session() == aSession ) + { + + if( !iStorageManager ) + { + iStorageManager = CBSStorageManager::NewL( aSession, KNullDesC ); + } + if( !FileStillInUse( aSession, iFileMapping[i]->File() ) ) + { + TPtrC baseFile = KNullDesC(); + if( iFileMapping[i]->Versioned() ) + { + baseFile.Set( iStorageManager->FilenameWithoutVersion( iFileMapping[i]->File() ) ); + } + else + { + baseFile.Set( iFileMapping[i]->File() ); + } + // we found the session, now check if any other + // session is using the same file + if( !FileStillInUse( aSession, baseFile ) ) + { + // no other sessions using the file + // cleanup versioned file + CleanupFileL( iFileMapping[i]->File() ); + } + + } + CBSFileMapping* fileMapping = iFileMapping[i]; + iFileMapping.Remove( i ); + delete fileMapping; + break; + } + } + TRACE( T_LIT( "CBSServer::RegisterFileForSessionL end") ); + } + +TBool CBSServer::FileStillInUse( CBSSession* aSession, + const TDesC& aFile ) + { + TBool returnValue = EFalse; + TInt count = iFileMapping.Count(); + for( TInt i = 0; i < count; i ++ ) + { + if( 0 == iFileMapping[i]->File().Compare( aFile ) ) + { + // file found, check that it's not the same sesion + if( iFileMapping[i]->Session() != aSession ) + { + + // it's not the same session + // so the file is still in use, we can + // return ETrue + returnValue = ETrue; + break; + } + } + } + return returnValue; + } + +void CBSServer::CleanupFileL( const TDesC& aFile ) + { + if( !iStorageManager ) + { + iStorageManager = CBSStorageManager::NewL( NULL, KNullDesC); + } + iStorageManager->CleanupFileL( aFile ); + } + +TArray CBSServer::RegisteredFiles() + { + return iFileMapping.Array(); + } + +void CBSServer::InitializeL() + { + TRACE( T_LIT( "CBSServer::InitializeL begin") ); + // Initialize brand install handler + iInstallHandler = CBSInstallHandler::NewL(); + iInstallHandler->InstallNewFilesL(); + iInstallHandler->StartObservingL(); + + //to enable backup observer + // Initialize backup and restore observer + CBSBackupObserver* tmp = CBSBackupObserver::NewL(); + delete iBackupObserver; + iBackupObserver = tmp; + User::LeaveIfError( iBackupObserver->RegisterObserver( this ) ); + TRACE( T_LIT( "CBSServer::InitializeL end") ); + } + +void CBSServer::BrandUpdatedL( const TDesC& aApplicationId, + const TDesC& aBrandId, + TLanguage aLanguageId, + CBSSession* aSession, + TInt aReserved ) + { + TRACE( T_LIT( "CBSServer::BrandUpdatedL begin aAppid[%S],aBrandId[%S]"),&aApplicationId, &aBrandId ); + TInt sessionCount = iSessions.Count(); + for( TInt i = 0; i < sessionCount; i++ ) + { + if( iSessions[i] == aSession ) + { + // we don't want to report the querying session itself + continue; + } + iSessions[i]->BrandUpdatedL( aApplicationId, + aBrandId, + aLanguageId, + aReserved ); + } + TRACE( T_LIT( "CBSServer::BrandUpdatedL end") ); + } + + + +// --------------------------------------------------------------------------- +// CBSServer::DisplaySessionInfoL display the info for each open session, +// except for the one that called this method +// --------------------------------------------------------------------------- +// +void CBSServer::DisplaySessionInfoL( CBSSession* aSession, TInt aErrorCode ) + { + TRACE( T_LIT( "CBSServer::DisplaySessionInfoL() begin aSession[%d], aErrorCode[%d]"),aSession,aErrorCode ); + + User::LeaveIfNull( aSession ); + // some constants + const TInt KStringLength = 512; + const TInt KNumberLength = 16; + _LIT( KMessage0,"Operation failed.Errorcode:"); + _LIT( KMessage1," Info on open sessions [ProcessFileName|ThreadId|ProcessId|Caption]:"); + _LIT( KBracketOpen, " ["); + _LIT( KBracketClose, "]"); + _LIT( KSeparator, "|"); + + + HBufC* outputString = HBufC::NewLC( KStringLength ); + TPtr outputStringPtr( outputString->Des() ); + + TBuf number; + number.Num( aErrorCode ); + + //make sure the string is long enough + TInt newLength = outputString->Length() + + KMessage0().Length() + + number.Length() + + KMessage1().Length(); + + //reallocate if necessary + if ( outputStringPtr.MaxLength() < newLength ) + { + CleanupStack::Pop( outputString ); + outputString = outputString->ReAllocL( newLength ); + outputStringPtr.Set( outputString->Des() ); + CleanupStack::PushL( outputString ); + } + + outputStringPtr.Append( KMessage0 ); + outputStringPtr.Append( number ); + outputStringPtr.Append( KMessage1 ); + + + TInt count = iSessions.Count(); + TRACE( T_LIT( "CBSServer::DisplaySessionInfoL() numberSessions=%d"),count ); + CBSSession* currentSession; + for( TInt i = 0; i < count; i++ ) + { + currentSession = iSessions[i]; + TRACE( T_LIT( "CBSServer::DisplaySessionInfoL() iteration=%d session=%d"),i,currentSession ); + if ( currentSession + && currentSession->InfoAvailable() + && currentSession != aSession ) + { + TBuf threadIdStr; + TThreadId threadId; + if ( KErrNone == currentSession->ThreadId( threadId ) ) + { + threadIdStr.NumUC( threadId.Id(), EDecimal ); + } + TBuf processIdStr; + TProcessId processId; + if ( KErrNone == currentSession->ProcessId( processId ) ) + { + processIdStr.NumUC( processId.Id(), EDecimal ); + } + + //make sure the string is long enough + newLength = outputString->Length() + + KBracketOpen().Length() + + currentSession->FileName().Length() + + threadIdStr.Length() + + processIdStr.Length() + + currentSession->Caption().Length() + + ( 3 * KSeparator().Length() ) + + KBracketClose().Length(); + + //reallocate if necessary + if ( outputStringPtr.MaxLength() < newLength ) + { + CleanupStack::Pop( outputString ); + outputString = outputString->ReAllocL( newLength ); + outputStringPtr.Set( outputString->Des() ); + CleanupStack::PushL( outputString ); + } + + outputStringPtr.Append( KBracketOpen ); + + //processfilename + outputStringPtr.Append( currentSession->FileName() ); + outputStringPtr.Append( KSeparator ); + + //threadid + outputStringPtr.Append( threadIdStr ); + outputStringPtr.Append( KSeparator ); + + //processid + outputStringPtr.Append( processIdStr ); + outputStringPtr.Append( KSeparator ); + + //caption + outputStringPtr.Append( currentSession->Caption() ); + + outputStringPtr.Append( KBracketClose ); + } + } + + TRACE( T_LIT( "CBSServer::DisplaySessionInfoL() string creation OK") ); + TRACE( T_LIT( "%S"), outputString ); + CleanupStack::PopAndDestroy( outputString ); + TRACE( T_LIT( "CBSServer::DisplaySessionInfoL() end") ); + } + +// ============================================================== +// ====================== ENTRY POINT =========================== +// ============================================================== +GLDEF_C TInt E32Main() + { + TRACE( T_LIT("E32Main - enter") ); + + User::RenameThread( KBSServerName ); + + CTrapCleanup* tc = CTrapCleanup::New(); + if( !tc ) + { + return KErrNoMemory; + } + + TRAPD( err, CBSServer::ExecuteL() ); + delete tc; + + TRACE( T_LIT("E32Main - exit: %d"), err ); + return err; + } + + + +// END OF FILE + + diff -r 000000000000 -r e6b17d312c8b brandingserver/bsserver/cbsserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/brandingserver/bsserver/cbsserver.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,147 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: CBSSERVER.H +* +*/ + + +#ifndef __CBSSERVER_H__ +#define __CBSSERVER_H__ +#include + +#include "rbsobjowningptrarray.h" +#include "mbsbackupobserver.h" + +// FORWARD DECLARATIONS +class CBSSession; +class CBSStorageManager; +class CBSInstallHandler; +class CBSBackupObserver; + +/** + * Service server. + */ +NONSHARABLE_CLASS( CBSServer ): public CPolicyServer, + public MBSBackupObserver + { + public: + NONSHARABLE_CLASS( CBSFileMapping ): public CBase + { + public: + static CBSFileMapping* NewL( CBSSession* aSession, + const TDesC& aFile, + TBool aVersioned ); + + ~CBSFileMapping(); + private: // constructors + void ConstructL( CBSSession* aSession, + const TDesC& aFile ); + CBSFileMapping( TBool aVersioned ); + + public: // new methods + CBSSession* Session(); + const TDesC& File(); + TBool Versioned(); + + private: // data + // doesn't own: session + CBSSession* iSession; + HBufC* iFile; + TBool iVersioned; + }; + + public: // Execution and destructors + static void ExecuteL(); + virtual ~CBSServer(); + + private: // C++ constructor + CBSServer(); + + protected: // Methods from CPolicyServer + + CSession2* NewSessionL( const TVersion& aVersion, + const RMessage2& aMessage ) const; + + + CPolicyServer::TCustomResult CustomFailureActionL( + const RMessage2& aMsg, + TInt aAction, + const TSecurityInfo& aMissing); + + public: // From MBSBackupObserver + + void HandleBackupStateL( TBackupState aState ); + + public: //New methods + void SessionCreatedL( CBSSession* aSession ); + void SessionDied( CBSSession* aSession ); + + TBool MatchSessionL( const TDesC& aApplicationId, + const TDesC& aBrandId, + TLanguage aLanguageId, + CBSSession* aSession, + TInt aReserved = 0 ); + + TBool MatchSessionUninstallL( const TDesC& aApplicationId, + const TDesC& aBrandId, CBSSession* aSession); + + void RegisterFileForSessionL( CBSSession* aSession, + const TDesC& aFile, + TBool aVersioned ); + + TArray RegisteredFiles(); + + TBool FileStillInUse( CBSSession* aSession, + const TDesC& aFile ); + + void BrandUpdatedL( const TDesC& aApplicationId, + const TDesC& aBrandId, + TLanguage aLanguageId, + CBSSession* aSession, + TInt aReserved ); + /** + * Displays the info for each open session - except for the one that + * called this method. + * + * @param aSession the session that called this method + * @param aErrorCode a system-wide errorcode which is simply displayed + * by this method + */ + void DisplaySessionInfoL( CBSSession* aSession, TInt aErrorCode ); + + private: // New methods + void UnRegisterSessionL( CBSSession* aSession ); + + + void CleanupFileL( const TDesC& aFile ); + + void InitializeL(); + + private: //Data + TInt iSessionCount; + RPointerArray iSessions; + RBSObjOwningPtrArray iFileMapping; + CBSStorageManager* iStorageManager; + CBSInstallHandler* iInstallHandler; + + // Own. Observer for backup and restore events + CBSBackupObserver* iBackupObserver; + }; + +#endif // __CBSSERVER_H__ + + +// END OF FILE + + diff -r 000000000000 -r e6b17d312c8b brandingserver/bsserver/cbssession.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/brandingserver/bsserver/cbssession.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,1728 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: CBSSession.cpp +* +*/ + + +// INCLUDE FILES +#include +#include + +#include "cbssession.h" +#include "cbsserver.h" +#include "debugtrace.h" +#include "cbsbrandhandler.h" +#include "cbsstoragemanager.h" +#include "cbsstorage.h" +#include "cbsbitmap.h" +//#include "cbselement.h" +#include "rbsobjowningptrarray.h" +#include "bselementfactory.h" +#include "bsimportconstants.h" +#include +#include +#include +#include +#include + +// ============================================================== +// ======================== SESSION ============================= +// ============================================================== + +// Two-phased constructor. +CBSSession* CBSSession::NewL() + { + TRACE( T_LIT("CBSSession::NewL begin") ); + CBSSession* self = new( ELeave ) CBSSession(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + TRACE( T_LIT("CBSSession::NewL end") ); + return self; + } + +// Symbian OS default constructor can leave. +void CBSSession::ConstructL() + { + } + + +// destructor +CBSSession::~CBSSession() + { + TRACE( T_LIT("CBSSession[%d]::~CBSSession()"), this ); + + if( Server() ) + { + Server()->SessionDied( this ); + } + delete iText; + delete iBuffer; + delete iBranding; + delete iSeveralData; + +#ifdef __WINSCW__ + if( iStorageManager ) + { + iStorageManager->WriteIbyFiles(); + } +#endif + delete iStorageManager; + delete iSessionInfo; + + } + + +// C++ default constructor can NOT contain any code, that +// might leave. +// +CBSSession::CBSSession() + { + } + +// --------------------------------------------------------- +// CBSSession::CreateL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CBSSession::CreateL() + { + TRACE( T_LIT("CBSSession[%d]::CreateL()"), this ); + Server()->SessionCreatedL( this ); + } + +// --------------------------------------------------------- +// CBSSession::ServiceL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CBSSession::ServiceL( const RMessage2 &aMessage ) + { + + /*if( !iSessionInfo ) + { + TRAPD( err, ExtractInfoL( aMessage ) ); + TRACE( T_LIT("CBSSession::ServiceL() ExtractInfoL returned with [%d]"), err ); + } + */ + if( DispatchMessageL( aMessage ) ) + { + if( !iMessageCompleted ) + { + aMessage.Complete( KErrNone ); + } + } + } + +// --------------------------------------------------------- +// CBSSession::ServiceError +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CBSSession::ServiceError( const RMessage2& aMessage, + TInt aError ) + { + aMessage.Complete( aError ); + } + +// --------------------------------------------------------- +// CBSSession::HandleBackupStateL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CBSSession::HandleBackupStateL( TBackupState aState ) + { + iIsBackup = ETrue ; + switch( aState ) + { + case EBackupNotActive: // backup is complete + { + // release session lock + iBackupActive = EFalse; + if( iStorageManager ) + { + iStorageManager->ReleaseLockL(); + } + + // Sending backup active state change event after unlocking it + if( iObserverActive ) + { + iObserverMessage.Complete( KErrNone ); + iObserverActive = EFalse; + } + + break; + } + case EBackupActive: // backup activated + { + + // Lock session. Branding data is not available until + // backup is completed. + iBackupActive = ETrue; + + // Sending backup active state change event before locking it + if( iObserverActive ) + { + iObserverMessage.Complete( KErrNone ); + iObserverActive = EFalse; + } + + if( iStorageManager ) + { + iStorageManager->LockStorage(); + } + break; + } + default: + { + // unknown state + } + } + + + } + +// --------------------------------------------------------- +// CBSSession::DispatchMessageL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +TBool CBSSession::DispatchMessageL( const RMessage2& aMessage ) + { + TRACE( T_LIT("CBrandingSession[%d]::DispatchMessageL() %d"), + this, aMessage.Function() ); + iMessageCompleted = EFalse; + TBool msgNeedsToBeCompleted = ETrue; + + if( iBackupActive ) + { + // if backup is active, we don't take requests. + // We could take some requests which do not require disk + // operations. This is not a good solution and a better one should be + // investigated. I'm running out of time. + TInt msg = aMessage.Function() ; + if( msg == EBSObserveGetChange || + msg == EBSObserveGetBackupState || + msg == EBSObserveBrand) + { + //allow to do the operation + } + else + { + User::Leave( KErrNotReady ); + } + + } + + switch( aMessage.Function() ) + { + case EBSInitInstall: + { + InitUpdateL( aMessage, EBSTxInstall ); + break; + } + case EBSInitUninstall: + { + InitUpdateL( aMessage, EBSTxUninstall ); + break; + } + case EBSInitAppend: + { + InitUpdateL( aMessage, EBSTxAppend ); + break; + } + case EBSInitReplace: + { + InitUpdateL( aMessage, EBSTxReplace ); + break; + } + case EBSInitAccess: + { + InitAccessL( aMessage ); + break; + } + case EBSPrepareText: + { + GetTextL( aMessage ); + break; + } + case EBSGetText: + { + if( iText ) + { + aMessage.WriteL( 2, *iText ); + } + else + { + aMessage.WriteL( 2, KNullDesC() ); + } + break; + } + + case EBSIsBrandUpdateRequired: + isBrandUpdateRequiredL (aMessage); + break; + + case EBSGetInt: + { + GetIntL( aMessage ); + break; + } + + case EBSPrepareBuffer: + { + GetBufferL( aMessage ); + break; + } + + case EBSGetBuffer: + { + if( iBuffer ) + { + aMessage.WriteL( 2, *iBuffer ); + } + else + { + aMessage.WriteL( 2, KNullDesC8() ); + } + break; + } + + case EBSGetFile: + { + GetFileL( aMessage ); + break; + } + + case EBSPrepareSeveral: + { + PrepareSeveralL( aMessage ); + break; + } + + case EBSGetSeveral: + { + GetSeveralL( aMessage ); + break; + } + + case EBSPrepareStructure: + { + PrepareStructureL( aMessage ); + break; + } + + case EBSGetStructure: + { + GetStructureL( aMessage ); + break; + } + + case EBSStartTransaction: + { + StartTransactionL( aMessage ); + break; + } + + case EBSStopTransaction: + { + StopTransactionL( aMessage ); + break; + } + case EBSCancelTransaction: + { + CancelTransactionL( aMessage ); + break; + } + + case EBSInstall: + { + InstallL( aMessage ); + break; + } + + case EBSReplace: + { + ReplaceL( aMessage ); + break; + } + + case EBSAppend: + { + AppendL( aMessage ); + break; + } + + case EBSRemoveBrand: + { + RemoveBrandL( aMessage ); + break; + } + case EBSRemoveApplication: + { + RemoveApplicationL( aMessage ); + break; + } + + case EBSObserveBrand: + { + if( iObserverActive ) + { + // complete the old observer request with KErrCancel + iObserverMessage.Complete( KErrCancel ); + } + iObserverMessage = aMessage; + iObserverActive = ETrue; + msgNeedsToBeCompleted = EFalse; + break; + } + + case EBSObserveGetNewVersion: + { + TInt newVersion = GetNewVersionL(); + TPckgC pack( newVersion ); + aMessage.WriteL( 0, pack ); + break; + } + + // Get what change happen + case EBSObserveGetChange: + { + TPckgC pack( iIsBackup ); + aMessage.WriteL( 0, pack ); + break ; + } + + // Get the backup state + case EBSObserveGetBackupState: + { + TPckgC pack( iBackupActive ); + aMessage.WriteL( 0, pack ); + break ; + } + + default: + { + User::Leave( KErrNotSupported ); + break; + } + } + + return msgNeedsToBeCompleted; + } + + +// --------------------------------------------------------- +// CBSSession::InitUpdateL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CBSSession::InitUpdateL( const RMessage2 &aMessage, TTransactionType aType) + { + TRACE( T_LIT("CBSSession::InitUpdateL: begin TTransactionType[%d] "),aType ); + + // get the application id + TInt bufferSize( aMessage.GetDesLength( 0 ) ); + + HBufC8* appId = HBufC8::NewLC( bufferSize ); + TPtr8 appPtr = appId->Des(); + aMessage.ReadL( 0, appPtr ); + + HBufC* tmpAppId = CnvUtfConverter::ConvertToUnicodeFromUtf8L( *appId ); + CleanupStack::PopAndDestroy( appId ); + + delete iApplicationId; + iApplicationId = tmpAppId; + + // get the brand id + bufferSize = aMessage.GetDesLength( 1 ); + HBufC8* streamBuf = HBufC8::NewLC( bufferSize ); + TPtr8 streamPtr = streamBuf->Des(); + aMessage.ReadL( 1, streamPtr ); + + RDesReadStream stream; + CleanupClosePushL( stream ); + stream.Open( streamPtr ); + + TInt descriptorLength = stream.ReadInt16L(); + HBufC8* brandId = HBufC8::NewLC( descriptorLength ); + TPtr8 brandPtr = brandId->Des(); + stream.ReadL( brandPtr, descriptorLength ); + + HBufC* tmpBrandId = CnvUtfConverter::ConvertToUnicodeFromUtf8L( *brandId ); + CleanupStack::PopAndDestroy( brandId ); + delete iBrandId; + iBrandId = tmpBrandId; + + descriptorLength = stream.ReadInt16L(); + HBufC8* defaultBrandId = HBufC8::NewLC( descriptorLength ); + TPtr8 defaultPtr = defaultBrandId->Des(); + stream.ReadL( defaultPtr, descriptorLength ); + + HBufC* tmpDefaultBrandId = CnvUtfConverter::ConvertToUnicodeFromUtf8L( *defaultBrandId ); + CleanupStack::PopAndDestroy( defaultBrandId ); + delete iDefaultBrandId; + iDefaultBrandId = tmpDefaultBrandId; + + CleanupStack::PopAndDestroy( 2, streamBuf ); // stream, streamBuf + + + // get the language id + iLanguageId = (TLanguage)aMessage.Int2(); + + // get the version + iReserved = aMessage.Int3(); + + // Check if brand is discarded and client is trying to access/append/replace on that + // give error message saying brand not found so that client will not use that brand + if(aType == EBSTxAccess || aType == EBSTxAppend || aType == EBSTxReplace ) + { + if(!iStorageManager) + { + iStorageManager = CBSStorageManager::NewL( this, *iApplicationId ); + } + + TBool brandDiscarded = EFalse ; + brandDiscarded = iStorageManager->CheckBrandDiscarded(*iApplicationId, *iBrandId) ; + + if(brandDiscarded) + { + TRACE( T_LIT("CBSSession::InitUpdateL: Brand discarded!->LeaveWith KErrNotFound") ); + ///Server()->DisplaySessionInfoL( this, KErrNotFound ); + User::Leave( KErrNotFound ); + } + } + + if( aType == EBSTxAppend ) + { + PrepareAppendL(); + } + else if( aType == EBSTxReplace ) + { + PrepareReplaceL(); + } + else if(aType == EBSTxUninstall) + { + if( !iStorageManager ) + { + iStorageManager = CBSStorageManager::NewL( this, *iApplicationId ); + } + // if any client is accessing same brand leave with KErrInUse. + // check if the brand has any active clients + TBool brandActive = EFalse; + CBSServer* server = Server(); + if( server ) + { + brandActive = server->MatchSessionUninstallL( *iApplicationId, *iBrandId, + this); + } + + if(brandActive) + { + TRACE( T_LIT("CBSSession::InitUpdateL: UnInstallation aborted -> LeaveWith KErrInUse") ); + //Server()->DisplaySessionInfoL( this,KErrInUse); + //when changing this errorcode: please read the note in + //UninstallL() ( installer.cpp ) + User::Leave( KErrInUse ); + } + } + else if( aType == EBSTxInstall ) + { + if( !iStorageManager ) + { + iStorageManager = CBSStorageManager::NewL( this, *iApplicationId ); + } + + HBufC* drive = HBufC::NewLC(3); + TRAPD( err, iStorageManager->GetNewestVersionL( *iApplicationId, + *iBrandId, + iLanguageId ) ); + if( ( err == KErrNotFound ) || ( err == KErrPathNotFound ) ) + { + CleanupStack::PopAndDestroy(drive); + // this brand is not yet there, which is the correct situation here + // for starting install. We can just ignore this error + } + + else if( !err ) + { + // there was no error, therefore this brand already exists in the ROM + // (Z drive). + // we leave with KErrAlreadyExists + if( 0 == (drive->Des().Compare(KBSZDrive)) ) + { + CleanupStack::PopAndDestroy(drive); + User::Leave( KErrAlreadyExists ); + } + else + { + //PopAndDestroy drive as it is not needed any longer. + CleanupStack::PopAndDestroy(drive); + + // if any client is accessing same brand leave with KErrInUse. + // check if the brand has any active clients + TBool brandActive = EFalse; + CBSServer* server = Server(); + if( server ) + { + brandActive = server->MatchSessionL( *iApplicationId, *iBrandId, + iLanguageId, this, iReserved ); + } + + if(brandActive == EFalse) + { + TRACE( T_LIT("CBSSession::InitUpdateL: Brand not used -> remove") ); + iStorageManager->RemoveBrandL( *iApplicationId, *iBrandId, + iLanguageId, iReserved ); + } + else + { + TRACE( T_LIT("CBSSession::InitUpdateL: Installation aborted->LeaveWith KErrInUse") ); + //Server()->DisplaySessionInfoL( this,KErrInUse); + //when changing this errorcode: please read the note in + //UninstallL() ( installer.cpp ) + User::Leave( KErrInUse ); + } + } + } + else + { + CleanupStack::PopAndDestroy(drive); + // some other error + TRACE( T_LIT("CBSSession::InitUpdateL: ERROR aType[%d] LeaveWith[%d]"),aType,err ); + User::Leave( err ); + } + } + + + iInitialized = ETrue; + + TRACE( T_LIT("Server initialized") ); + } + + + +// --------------------------------------------------------- +// CBSSession::PrepareAppendL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CBSSession::PrepareAppendL() + { + if( !iStorageManager ) + { + iStorageManager = CBSStorageManager::NewL( this, *iApplicationId ); + } + + RFile brandHandle; + iStorageManager->BrandHandleL( *iApplicationId, + *iBrandId, iLanguageId, brandHandle, iReserved ); + CleanupClosePushL( brandHandle ); + RFileReadStream oldStream; + oldStream.Attach( brandHandle ); + CleanupClosePushL( oldStream ); + TInt version = oldStream.ReadInt16L(); + + TInt count = oldStream.ReadInt16L(); + + if( !iStorageManager->Storage() ) + { + iStorageManager->CreateStorageL(); + } + for( TInt i = 0; i < count; i++ ) + { + MBSElement* element = InternalizeElementL( oldStream, ETrue ); + CleanupDeletePushL( element ); + // transfers ownership + iStorageManager->Storage()->AppendElementsL( element ); + CleanupStack::Pop(); // element + } + + iStorageManager->Storage()->SetVersion( iReserved ); + iStorageManager->Storage()->SetStorageIdL( *iBrandId ); + iStorageManager->Storage()->SetApplicationIdL( *iApplicationId ); + iStorageManager->Storage()->SetLanguageL( iLanguageId ); + + CleanupStack::PopAndDestroy( 2 ); // oldStream, brandHandle + iAppending = ETrue; + } +// --------------------------------------------------------- +// CBSSession::PrepareReplaceL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CBSSession::PrepareReplaceL() + { + PrepareAppendL(); + } + +// --------------------------------------------------------- +// CBSSession::InitAccessL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CBSSession::InitAccessL( const RMessage2 &aMessage ) + { + InitUpdateL( aMessage, EBSTxAccess ); + + iBranding = CBSBrandHandler::NewL( *iApplicationId, *iBrandId, *iDefaultBrandId, + iLanguageId, this, iReserved ); + + + iAccessInit = ETrue; + TRACE( T_LIT("Access initialized") ); + } + + +// --------------------------------------------------------- +// CBSSession::GetTextL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CBSSession::GetTextL( const RMessage2 &aMessage ) + { + if( !iAccessInit ) + { + User::Leave( KErrNotReady ); + } + TInt idSize( aMessage.GetDesLength( 0 ) ); + + HBufC8* idBuffer = HBufC8::NewLC( idSize ); + TPtr8 ptrId = idBuffer->Des(); + aMessage.ReadL( 0, ptrId ); + + HBufC* temp = iBranding->GetTextL( ptrId ); + delete iText; + iText = temp; + + CleanupStack::PopAndDestroy( idBuffer ); + TPckgC pack( iText->Size() ); + aMessage.WriteL( 1, pack ); + TRACE( T_LIT("aMessage.WriteL( 1, %d );"), iText->Size() ); + } + +void CBSSession :: isBrandUpdateRequiredL (const RMessage2 &aMessage) +{ + if( !iAccessInit ) + { + User::Leave( KErrNotReady ); + } + TInt updateRequired = iBranding->isBrandUpdateRequiredL (); +// iValue = updateRequired; + TPckgC pack (updateRequired); + aMessage.WriteL( 0, pack ); +} +// --------------------------------------------------------- +// CBSSession::GetIntL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CBSSession::GetIntL( const RMessage2 &aMessage ) + { + if( !iInitialized ) + { + User::Leave( KErrNotReady ); + } + TInt idSize( aMessage.GetDesLength( 0 ) ); + + HBufC8* idBuffer = HBufC8::NewLC( idSize ); + TPtr8 ptrId = idBuffer->Des(); + aMessage.ReadL( 0, ptrId ); + + iValue = iBranding->GetIntL( ptrId ); + TPckgC pack( iValue ); + aMessage.WriteL( 1, pack ); + CleanupStack::PopAndDestroy( idBuffer ); + } + +// --------------------------------------------------------- +// CBSSession::GetBufferL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CBSSession::GetBufferL( const RMessage2 &aMessage ) + { + if( !iAccessInit ) + { + User::Leave( KErrNotReady ); + } + TInt idSize( aMessage.GetDesLength( 0 ) ); + + HBufC8* idBuffer = HBufC8::NewLC( idSize ); + TPtr8 ptrId = idBuffer->Des(); + aMessage.ReadL( 0, ptrId ); + + HBufC8* temp = iBranding->GetBufferL( ptrId ); + delete iBuffer; + iBuffer = temp; + + CleanupStack::PopAndDestroy( idBuffer ); + TPckgC pack( iBuffer->Size() ); + aMessage.WriteL( 1, pack ); + TRACE( T_LIT("aMessage.WriteL( 1, %d );"), iBuffer->Size() ); + } + + +// --------------------------------------------------------- +// CBSSession::GetFileL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CBSSession::GetFileL( const RMessage2 &aMessage ) + { + TRACE( T_LIT("CBSSession::GetFileL begin") ); + if( !iInitialized ) + { + User::Leave( KErrNotReady ); + } + TInt idSize( aMessage.GetDesLength( 2 ) ); + HBufC8* idBuffer = HBufC8::NewLC( idSize ); + TPtr8 ptrId = idBuffer->Des(); + aMessage.ReadL( 2, ptrId ); + + RFile file; + iBranding->GetFileL( ptrId, file ); + + CleanupStack::PopAndDestroy( idBuffer ); + + User::LeaveIfError( file.TransferToClient( aMessage, 0 ) ); + + iMessageCompleted = ETrue; + + file.Close(); + TRACE( T_LIT("CBSSession::GetFileL end") ); + } + + +// --------------------------------------------------------- +// CBSSession::InternalizeElementIdsL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CBSSession::InternalizeElementIdsL( RReadStream& aStream, RBSObjOwningPtrArray& aArray ) + { + TInt count = aStream.ReadInt16L(); + + for(TInt i = 0; i < count; i++ ) + { + TInt length = aStream.ReadInt16L(); + HBufC8* id = HBufC8::NewLC( length ); + TPtr8 ptrId = id->Des(); + aStream.ReadL( ptrId, length ); + aArray.AppendL( id ); + CleanupStack::Pop( id ); + } + } + +// --------------------------------------------------------- +// CBSSession::PrepareTextL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CBSSession::PrepareSeveralL( const RMessage2 &aMessage ) + { + if( !iInitialized ) + { + User::Leave( KErrNotReady ); + } + + TInt msgSize( aMessage.GetDesLength( 1 ) ); + + HBufC8* idBuffer = HBufC8::NewLC( msgSize ); + TPtr8 ptrId = idBuffer->Des(); + aMessage.ReadL( 1, ptrId ); + + RDesReadStream idStream; + CleanupClosePushL( idStream ); + idStream.Open( ptrId ); + + RBSObjOwningPtrArray idArray; + CleanupClosePushL( idArray ); + + InternalizeElementIdsL( idStream, idArray ); + + + MBSElement* texts = iBranding->GetSeveralL( idArray ); + + CleanupStack::PopAndDestroy(); // idArray + CleanupStack::PopAndDestroy(); // idStream + CleanupStack::PopAndDestroy(); // idBuffer + + CleanupDeletePushL( texts ); + + // FIXME magic number + CBufFlat* data = CBufFlat::NewL( 2000 ); + CleanupStack::PushL( data ); + + RBufWriteStream writeStream; + CleanupClosePushL( writeStream ); + writeStream.Open( *data ); + + texts->ExternalizeL( writeStream ); + + CleanupStack::PopAndDestroy(); // writeStream + + delete iSeveralData; + iSeveralData = data; + CleanupStack::Pop( data ); + + CleanupStack::PopAndDestroy(); // texts + + delete iBuffer; + iBuffer = NULL; + iBuffer = iSeveralData->Ptr(0).AllocL(); + + delete iSeveralData; + iSeveralData = NULL; + TPckgC pack( iBuffer->Size() ); + TRACE( T_LIT("DispatchMessageL - EPlatSecPrepareSeveral writing size %d"), iBuffer->Size() ); + aMessage.WriteL( 0, pack ); + + } + +// --------------------------------------------------------- +// CBSSession::GetSeveralTextL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CBSSession::GetSeveralL( const RMessage2 &aMessage ) + { + if( !iInitialized ) + { + User::Leave( KErrNotReady ); + } + aMessage.WriteL( 0, *iBuffer ); + + delete iBuffer; + iBuffer = NULL; + } + + +// --------------------------------------------------------- +// CBSSession::PrepareStructureL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CBSSession::PrepareStructureL( const RMessage2 &aMessage ) + { + if( !iInitialized ) + { + User::Leave( KErrNotReady ); + } + TInt idSize( aMessage.GetDesLength( 1 ) ); + + RBSObjOwningPtrArray valueArray; + CleanupClosePushL( valueArray ); + + HBufC8* idBuffer = HBufC8::NewLC( idSize ); + TPtr8 ptrId = idBuffer->Des(); + aMessage.ReadL( 1, ptrId ); + + + MBSElement* extElement = iBranding->GetStructureL( ptrId ); + CleanupDeletePushL( extElement ); + // FIXME magic number + CBufFlat* data = CBufFlat::NewL( 2000 ); + CleanupStack::PushL( data ); + + RBufWriteStream writeStream; + CleanupClosePushL( writeStream ); + writeStream.Open( *data ); + + extElement->ExternalizeL( writeStream ); + + CleanupStack::PopAndDestroy(); // writeStream + + delete iSeveralData; + iSeveralData = data; + CleanupStack::Pop( data ); + + CleanupStack::PopAndDestroy( extElement ); + + delete iBuffer; + iBuffer = NULL; + iBuffer = iSeveralData->Ptr(0).AllocL(); + + delete iSeveralData; + iSeveralData = NULL; + TPckgC pack( iBuffer->Size() ); + TRACE( T_LIT("DispatchMessageL - EPlatSecPrepareSeveral writing size %d"), iBuffer->Size() ); + aMessage.WriteL( 0, pack ); + + + CleanupStack::PopAndDestroy(idBuffer); + + CleanupStack::PopAndDestroy(); // valueArray + + } + +// --------------------------------------------------------- +// CBSSession::GetStructureL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CBSSession::GetStructureL( const RMessage2 &aMessage ) + { + if( !iInitialized ) + { + User::Leave( KErrNotReady ); + } + aMessage.WriteL( 0, *iBuffer ); + + delete iBuffer; + iBuffer = NULL; + } + + + +// --------------------------------------------------------- +// CBSSession::InstallL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CBSSession::InstallL( const RMessage2 &aMessage ) + { + TRACE( T_LIT( "CBSSession::InstallL begin") ); + if( !iInitialized || !iStorageManager ) + { + User::Leave( KErrNotReady ); + } + + if( !iStorageManager->Storage() ) + { + iStorageManager->CreateStorageL(); + } + + iStorageManager->ConnectTransactionL( *iApplicationId, + *iBrandId, iLanguageId, EFalse, iReserved ); + + TInt msgSize( aMessage.GetDesLength( 0 ) ); + + HBufC8* buffer = HBufC8::NewLC( msgSize ); + TPtr8 ptr = buffer->Des(); + aMessage.ReadL( 0, ptr ); + + RDesReadStream stream; + CleanupClosePushL( stream ); + stream.Open( ptr ); + + MBSElement* element = InternalizeElementL( stream ); + CleanupDeletePushL( element ); + + iStorageManager->Storage()->SetVersion( iReserved ); + iStorageManager->Storage()->SetStorageIdL( *iBrandId ); + iStorageManager->Storage()->SetApplicationIdL( *iApplicationId ); + iStorageManager->Storage()->SetLanguageL( iLanguageId ); + // transfers ownership + iStorageManager->Storage()->AppendElementsL( element ); + + CleanupStack::Pop(); // element + CleanupStack::PopAndDestroy( 2, buffer ); + iWriteNeeded = ETrue; + TRACE( T_LIT( "CBSSession::InstallL end") ); + } + +// --------------------------------------------------------- +// CBSSession::ReplaceL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CBSSession::ReplaceL( const RMessage2 &aMessage ) + { + TRACE( T_LIT( "CBSSession::ReplaceL begin") ); + if( !iInitialized || !iStorageManager ) + { + User::Leave( KErrNotReady ); + } + + iStorageManager->ConnectTransactionL( *iApplicationId, + *iBrandId, iLanguageId, EFalse, iReserved ); + + TInt msgSize( aMessage.GetDesLength( 0 ) ); + + HBufC8* buffer = HBufC8::NewLC( msgSize ); + TPtr8 ptr = buffer->Des(); + aMessage.ReadL( 0, ptr ); + + RDesReadStream stream; + CleanupClosePushL( stream ); + stream.Open( ptr ); + + MBSElement* element = InternalizeElementL( stream ); + CleanupDeletePushL( element ); + + // transfers ownership + iStorageManager->Storage()->ReplaceElementL( element ); + + CleanupStack::Pop(); // element + CleanupStack::PopAndDestroy( 2, buffer ); + iWriteNeeded = ETrue; + TRACE( T_LIT( "CBSSession::ReplaceL end") ); + } + + +// --------------------------------------------------------- +// CBSSession::AppendL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CBSSession::AppendL( const RMessage2 &aMessage ) + { + TRACE( T_LIT( "CBSSession::AppendL begin") ); + if( !iInitialized || !iStorageManager ) + { + User::Leave( KErrNotReady ); + } + + iStorageManager->ConnectTransactionL( *iApplicationId, + *iBrandId, iLanguageId, EFalse, iReserved ); + + TInt msgSize( aMessage.GetDesLength( 0 ) ); + + HBufC8* buffer = HBufC8::NewLC( msgSize ); + TPtr8 ptr = buffer->Des(); + aMessage.ReadL( 0, ptr ); + + RDesReadStream stream; + CleanupClosePushL( stream ); + stream.Open( ptr ); + + MBSElement* element = InternalizeElementL( stream ); + CleanupDeletePushL( element ); + + iStorageManager->Storage()->SetVersion( iReserved ); + iStorageManager->Storage()->SetStorageIdL( *iBrandId ); + iStorageManager->Storage()->SetApplicationIdL( *iApplicationId ); + iStorageManager->Storage()->SetLanguageL( iLanguageId ); + // transfers ownership + iStorageManager->Storage()->AppendElementsL( element ); + + CleanupStack::Pop(); // element + CleanupStack::PopAndDestroy( 2, buffer ); + iWriteNeeded = ETrue; + TRACE( T_LIT( "CBSSession::AppendL end") ); + } + +// --------------------------------------------------------- +// CBSSession::StartTransactionL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CBSSession::StartTransactionL( const RMessage2& /*aMessage*/ ) + { + if( !iStorageManager ) + { + iStorageManager = CBSStorageManager::NewL( this, *iApplicationId ); + } + // if we are appending or replacing, we don't need to + // create storage + if( !iAppending ) + { + iStorageManager->CreateStorageL(); + } + } + + +// --------------------------------------------------------- +// CBSSession::CancelTransactionL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CBSSession::CancelTransactionL( const RMessage2 &aMessage ) + { + // get the application id + TInt bufferSize( aMessage.GetDesLength( 0 ) ); + + HBufC8* appId = HBufC8::NewLC( bufferSize ); + TPtr8 appPtr = appId->Des(); + aMessage.ReadL( 0, appPtr ); + + + // get the brand id + bufferSize = aMessage.GetDesLength( 1 ); + HBufC8* brandId = HBufC8::NewLC( bufferSize ); + TPtr8 brandPtr = brandId->Des(); + aMessage.ReadL( 1, brandPtr ); + + // get the language id + TLanguage language = (TLanguage)aMessage.Int2(); + + // get the version + TInt version = aMessage.Int3(); + + + HBufC* tmpBrandId = CnvUtfConverter::ConvertToUnicodeFromUtf8L( *brandId ); + CleanupStack::PopAndDestroy( brandId ); + CleanupStack::PushL( tmpBrandId ); + HBufC* tmpAppId = CnvUtfConverter::ConvertToUnicodeFromUtf8L( *appId ); + CleanupStack::PushL( tmpAppId ); + + // check if the transaction is correct + iStorageManager->ConnectTransactionL( *tmpAppId, + *tmpBrandId, iLanguageId, + EFalse, iReserved ); + + CleanupStack::PopAndDestroy( 2, tmpBrandId ); // tmpBrandId, tmpAppId + CleanupStack::PopAndDestroy( appId ); + // cancel the transaction + iStorageManager->CancelTransactionL(); + iWriteNeeded = EFalse; + } + +// --------------------------------------------------------- +// CBSSession::StopTransactionL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CBSSession::StopTransactionL( const RMessage2 &aMessage ) + { + if( !iStorageManager ) + { + // transaction not found + User::Leave( KErrNotFound ); + } + if( iAppending ) + { + // find next available version number + TInt nextVersion = iStorageManager->NextAvailableVersionL(); + iStorageManager->SetVersion( nextVersion ); + iStorageManager->Storage()->SetVersion( nextVersion ); + } + + if( iWriteNeeded ) + { + iReserved = iStorageManager->WriteStorageFilesL(); + iWriteNeeded = EFalse; + } + + delete iStorageManager; + iStorageManager = NULL; + + TPckgC pack( iReserved ); + aMessage.WriteL( 0, pack ); + + } + + +// --------------------------------------------------------- +// CBSSession::InternalizeElementL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +MBSElement* CBSSession::InternalizeElementL( RReadStream& aStream, TBool aAppending /*= EFalse*/ ) + { + MBSElement* returnValue = NULL; + + TBSElementType type = (TBSElementType)aStream.ReadInt16L(); + TInt idSize = aStream.ReadInt16L(); + HBufC8* elementId = HBufC8::NewLC( idSize ); + TPtr8 elementIdPtr = elementId->Des(); + aStream.ReadL( elementIdPtr, idSize ); + + + switch( type ) + { + case EBSInt: + { + TInt intData = aStream.ReadInt16L(); + returnValue = BSElementFactory::CreateBSElementL( *elementId, + EBSInt, + intData ); + break; + } + case EBSText: + { + TInt textSize = aStream.ReadInt16L(); + HBufC* textData = HBufC::NewLC( textSize ); + + TPtr textPtr = textData->Des(); + aStream.ReadL( textPtr, textSize ); + + returnValue = BSElementFactory::CreateBSElementL( *elementId, + type, + *textData ); + + CleanupStack::Pop( textData ); + break; + } + + case EBSFile: + { + TInt nameSize = aStream.ReadInt16L(); + HBufC* fileName = HBufC::NewLC( nameSize ); + + TPtr filePtr = fileName->Des(); + aStream.ReadL( filePtr, nameSize ); + + if( !aAppending ) + { + // we are installing, so the filename is pointing to a file + // that has to be installed + // Install file and get the filename without path + HBufC* strippedName = iStorageManager->InstallFileLC( *fileName ); + returnValue = BSElementFactory::CreateBSElementL( *elementId, + type, + *strippedName ); + CleanupStack::Pop( strippedName ); + CleanupStack::PopAndDestroy( fileName ); + } + else + { + // we are appending, so this is really the filename + returnValue = BSElementFactory::CreateBSElementL( *elementId, + type, + *fileName ); + CleanupStack::Pop( fileName ); + } + break; + } + + case EBSList: + { + RBSObjOwningPtrArray listData; + CleanupClosePushL( listData ); + TInt listCount = aStream.ReadInt16L(); + for( TInt i = 0; i < listCount; i++ ) + { + MBSElement* listElement = InternalizeElementL( aStream ); + CleanupDeletePushL( listElement ); + listData.AppendL( listElement ); + CleanupStack::Pop(); // listElement + } + + returnValue = BSElementFactory::CreateBSElementL( *elementId, + EBSList, + listData ); + CleanupStack::Pop(); // listData + break; + } + case EBSBuffer: + { + TInt bufferSize = aStream.ReadInt16L(); + HBufC8* buffer = HBufC8::NewLC( bufferSize ); + + TPtr8 buffPtr = buffer->Des(); + aStream.ReadL( buffPtr, bufferSize ); + + returnValue = BSElementFactory::CreateBSElementL( *elementId, + EBSBuffer, + *buffer ); + + CleanupStack::Pop( buffer ); + break; + } + case EBSBitmap: + { + TInt length = aStream.ReadInt16L(); + HBufC8* fileId = HBufC8::NewLC( length ); + + TPtr8 fileIdPtr = fileId->Des(); + aStream.ReadL( fileIdPtr, length ); + + TInt bitmapId = aStream.ReadInt16L(); + TInt maskId = aStream.ReadInt16L(); + TInt skinId = aStream.ReadInt16L(); + TInt skinMaskId = aStream.ReadInt16L(); + + + CBSBitmap* bitmap = CBSBitmap::NewLC( bitmapId, + maskId, + skinId, + skinMaskId, + fileIdPtr ); + + returnValue = BSElementFactory::CreateBSElementL( *elementId, + EBSBitmap, + bitmap ); + CleanupStack::Pop( bitmap ); + CleanupStack::PopAndDestroy( fileId ); + break; + } + + default: + { + User::Leave( KErrArgument ); + break; + } + } + + CleanupStack::PopAndDestroy( elementId ); + + return returnValue; + } + + +// --------------------------------------------------------- +// CBSSession::MatchSessionL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +TBool CBSSession::MatchSessionL( const TDesC& aApplicationId, + const TDesC& aBrandId, + TLanguage aLanguageId, + TInt aReserved ) + { + TBool returnValue = EFalse; + if( iApplicationId && iBrandId ) + { + if( ( 0 == iApplicationId->Compare( aApplicationId ) ) && + ( 0 == iBrandId->Compare( aBrandId ) ) && + ( iLanguageId == aLanguageId ) && + ( iReserved == aReserved )) + { + returnValue = ETrue; + } + } + + return returnValue; + } + +// --------------------------------------------------------- +// CBSSession::MatchSessionL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +TBool CBSSession::MatchSessionUninstallL( const TDesC& aApplicationId, + const TDesC& aBrandId) + { + TBool returnValue = EFalse; + if( iApplicationId && iBrandId ) + { + if( ( 0 == iApplicationId->Compare( aApplicationId ) ) && + ( 0 == iBrandId->Compare( aBrandId ) ) ) + { + returnValue = ETrue; + } + } + + return returnValue; + } +// --------------------------------------------------------- +// CBSSession::BrandUpdatedL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CBSSession::BrandUpdatedL( const TDesC& aApplicationId, + const TDesC& aBrandId, + TLanguage aLanguageId, + TInt /*aReserved*/ ) + { + TRACE( T_LIT( "CBSSession::BrandUpdatedL begin aAppId[%S] aBrandId[%S]"), &aApplicationId, &aBrandId ); + iIsBackup = EFalse ; + if( iApplicationId && iBrandId ) + { + if( ( 0 == iApplicationId->Compare( aApplicationId ) ) && + ( 0 == iBrandId->Compare( aBrandId ) ) && + ( iLanguageId == aLanguageId ) ) + { + // this event is for us + // complete the observer request from client + if( iObserverActive ) + { + iObserverMessage.Complete( KErrNone ); + iObserverActive = EFalse; + } + } + } + TRACE( T_LIT( "CBSSession::BrandUpdatedL end") ); + } + + +// --------------------------------------------------------- +// CBSSession::RemoveBrandL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CBSSession::RemoveBrandL( const RMessage2& /*aMessage*/ ) + { + TRACE( T_LIT( "CBSSession::RemoveBrandL begin") ); + if( !iInitialized || !iStorageManager ) + { + User::Leave( KErrNotReady ); + } + + iStorageManager->RemoveBrandL( *iApplicationId, *iBrandId, + iLanguageId, iReserved ); + + + + TRACE( T_LIT( "CBSSession::RemoveBrandL end") ); + } + +// --------------------------------------------------------- +// CBSSession::RemoveApplicationL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CBSSession::RemoveApplicationL( const RMessage2& /*aMessage*/ ) + { + TRACE( T_LIT( "CBSSession::RemoveApplicationL begin") ); + if( !iInitialized || !iStorageManager ) + { + User::Leave( KErrNotReady ); + } + iStorageManager->RemoveApplicationL( *iApplicationId ); + TRACE( T_LIT( "CBSSession::RemoveApplicationL end") ); + } + +// --------------------------------------------------------- +// CBSSession::GetNewVersionL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +TInt CBSSession::GetNewVersionL() + { + if( !iStorageManager ) + { + iStorageManager = CBSStorageManager::NewL( this, KNullDesC ); + } + + return iStorageManager->GetNewestVersionL( *iApplicationId, *iBrandId, iLanguageId ); + } + + +// CBSSessionInfo +CBSSession::CBSSessionInfo* CBSSession::CBSSessionInfo::NewL( const TDesC& aFileName, + const TDesC& aCaption, + TThreadId aThreadId, + TProcessId aProcessId ) + { + CBSSessionInfo* self = new( ELeave ) CBSSessionInfo( aThreadId, aProcessId ); + CleanupStack::PushL( self ); + self->ConstructL( aFileName, aCaption ); + CleanupStack::Pop( self ); + return self; + } +void CBSSession::CBSSessionInfo::ConstructL( const TDesC& aFileName, const TDesC& aCaption ) + { + iFileName = aFileName.AllocL(); + iCaption = aCaption.AllocL(); + } +CBSSession::CBSSessionInfo::CBSSessionInfo( TThreadId aThreadId, TProcessId aProcessId ) +: iThreadId( aThreadId ), + iProcessId( aProcessId ) + { + } +CBSSession::CBSSessionInfo::~CBSSessionInfo() + { + delete iFileName; + delete iCaption; + } + +const TDesC& CBSSession::CBSSessionInfo::FileName() + { + return *iFileName; + } +const TDesC& CBSSession::CBSSessionInfo::Caption() + { + return *iCaption; + } + +TThreadId CBSSession::CBSSessionInfo::ThreadId() + { + return iThreadId; + } +TProcessId CBSSession::CBSSessionInfo::ProcessId() + { + return iProcessId; + } + + +// --------------------------------------------------------------------------- +// CBSSession::ExtractInfoL +// Extracts some information from the specified RMessage2 and saves it. +// --------------------------------------------------------------------------- +// +void CBSSession::ExtractInfoL( const RMessage2& aMessage ) + { + TRACE( T_LIT( "CBSSession::ExtractInfoL begin") ); + //Collect all necessary data + RThread thread; + TInt getProcessErr,getClientThreadErr; + getClientThreadErr = aMessage.Client( thread ); + CleanupClosePushL( thread ); + + if ( KErrNone == getClientThreadErr ) + { + TRACE( T_LIT( "CBSSession::ExtractInfoL Client retrieved OK") ); + TThreadId threadId = thread.Id(); + RProcess process; + getProcessErr = thread.Process( process ); + CleanupClosePushL( process ); + if ( getProcessErr == KErrNone ) + { + TRACE( T_LIT( "CBSSession::ExtractInfoL Processfilename retrieved OK") ); + TFileName fileName = process.FileName(); + TParsePtrC parser( fileName ); + TPtrC processFileNameAndExt( parser.NameAndExt() ); + + RApaLsSession session; + TInt connectErr = session.Connect(); + User :: LeaveIfError (connectErr); + session.GetAllApps(); + CleanupClosePushL( session ); + + TApaAppInfo info; + TPtrC captionPtr( KNullDesC ); + TPtrC printCaptionPtr( KNullDesC ); + TPtrC fullName( KNullDesC ); + while ( KErrNone == session.GetNextApp( info ) ) + { + fullName.Set( info.iFullName ); + printCaptionPtr.Set( info.iCaption ); + if( KErrNotFound != fullName.Find( processFileNameAndExt ) ) + { + captionPtr.Set( info.iCaption ); + TRACE( T_LIT( "CBSSession::ExtractInfoL caption saved: %S"),&captionPtr ); + break; + } + } + + CBSSessionInfo* temp = + CBSSessionInfo::NewL( processFileNameAndExt, + captionPtr, + threadId, + process.Id() ); + TRACE( T_LIT( "CBSSession::ExtractInfoL SessionInfo object creation OK") ); + delete iSessionInfo; + iSessionInfo = NULL; + iSessionInfo = temp; + CleanupStack::PopAndDestroy( &session ); + } + CleanupStack::PopAndDestroy( &process ); + } + CleanupStack::PopAndDestroy( &thread ); + TRACE( T_LIT( "CBSSession::ExtractInfoL end") ); + } + + +// --------------------------------------------------------------------------- +// CBSSession::FileName +// --------------------------------------------------------------------------- +// +const TDesC& CBSSession::FileName() + { + TRACE( T_LIT( "CBSSession::FileName begin") ); + if ( iSessionInfo ) + { + TRACE( T_LIT( "CBSSession::FileName SessionInfo exists") ); + return iSessionInfo->FileName(); + } + else + { + TRACE( T_LIT( "CBSSession::FileName SessionInfo does not exist") ); + return KNullDesC; + } + } + +// --------------------------------------------------------------------------- +// CBSSession::Caption +// --------------------------------------------------------------------------- +// +const TDesC& CBSSession::Caption() + { + TRACE( T_LIT( "CBSSession::Caption begin") ); + if ( iSessionInfo ) + { + TRACE( T_LIT( "CBSSession::Caption SessionInfo exists") ); + return iSessionInfo->Caption(); + } + else + { + TRACE( T_LIT( "CBSSession::Caption SessionInfo does not exist") ); + return KNullDesC; + } + } + + +// --------------------------------------------------------------------------- +// CBSSession::ThreadId +// --------------------------------------------------------------------------- +// +TInt CBSSession::ThreadId( TThreadId& aThreadId ) + { + TRACE( T_LIT( "CBSSession::ThreadId begin") ); + TInt err( KErrNotFound ); + if ( iSessionInfo ) + { + TRACE( T_LIT( "CBSSession::ThreadId SessionInfo exists") ); + aThreadId = iSessionInfo->ThreadId(); + err = KErrNone; + } + return err; + } + + +// --------------------------------------------------------------------------- +// CBSSession::ProcessId +// --------------------------------------------------------------------------- +// +TInt CBSSession::ProcessId( TProcessId& aProcessId ) + { + TRACE( T_LIT( "CBSSession::ProcessId begin") ); + TInt err( KErrNotFound ); + if ( iSessionInfo ) + { + TRACE( T_LIT( "CBSSession::ProcessId SessionInfo exists") ); + aProcessId = iSessionInfo->ProcessId(); + err = KErrNone; + } + return err; + } + + +// --------------------------------------------------------------------------- +// CBSSession::InfoAvailable +// --------------------------------------------------------------------------- +// +TBool CBSSession::InfoAvailable() + { + return iSessionInfo ? ETrue : EFalse; + } + +// END OF FILE + + diff -r 000000000000 -r e6b17d312c8b brandingserver/bsserver/cbssession.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/brandingserver/bsserver/cbssession.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,461 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: cbssession.h +* +*/ + + +#ifndef __CBSSESSION_H__ +#define __CBSSESSION_H__ + +#include +#include +#include "rbsobjowningptrarray.h" +#include "bsserverdefs.h" +#include "mbsbackupobserver.h" + +class CBSServer; +class CBSBrandHandler; +class MBSElement; +class CBSStorageManager; + +/** + * Service side session. + * + * @lib + * @since + */ + class CBSSession : public CSession2, + public MBSBackupObserver + { + + + public: + + /** + * Class for encapsulating the session information. + */ + NONSHARABLE_CLASS( CBSSessionInfo ): public CBase + { + public: + + /** + * Creates a new CBSSessionInfo + * + * @param aFileName the filename of the process, that created + * this session + * @param aCaption a caption of the process, that created this + * session + * @param aThreadId thread id where this session was created + * @param aProcessId processId of the process, that created + * this session + * @return a new CBSSessionInfo instance + */ + static CBSSessionInfo* NewL( const TDesC& aFileName, + const TDesC& aCaption, + TThreadId aThreadId, + TProcessId aProcessId ); + /** + * Destructor. + */ + ~CBSSessionInfo(); + + private: + + /** + * Symbian second-phase constructor + * + * @param aFileName the filename of the process, that created + * this session + * @param aCaption a caption of the process, that created this + * session + */ + void ConstructL( const TDesC& aFileName, + const TDesC& aCaption ); + + /** + * Constructor. + * + * @param aThreadId thread id where this session was created + * @param aProcessId processId of the process, that created + * this session + */ + CBSSessionInfo( TThreadId aThreadId, TProcessId aProcessId ); + + public: + + /** + * Returns the filename of the process, that created this + * session. + * + * @return a filename + */ + const TDesC& FileName(); + + /** + * Returns the caption of the process, that created this + * session. + * + * @return a caption + */ + const TDesC& Caption(); + + /** + * Returns the thread id where this session was created. + * + * @return a thread id + */ + TThreadId ThreadId(); + + /** + * Returns the processId of the process, that created + * this session. + * + * @return a process id + */ + TProcessId ProcessId(); + + private: // data + + /** + * Filename + * Own. + */ + HBufC* iFileName; + + /** + * Caption + * Own. + */ + HBufC* iCaption; + + /** + * Thread Id. + */ + TThreadId iThreadId; + + /** + * Process Id. + */ + TProcessId iProcessId; + }; + + + public: // Constructors and destructors + static CBSSession* NewL(); + virtual ~CBSSession(); + + + protected: // C++ constructors + /** + * C++ default constructor. + */ + CBSSession(); + + /** + * Symbian OS constructor + */ + void ConstructL(); + + public: // Methods derived from CSession2 + /** + * From CSession2 + */ + void CreateL(); + /** + * From CSession2 + */ + void ServiceL( const RMessage2 &aMessage ); + /** + * From CSession2 + */ + void ServiceError( const RMessage2& aMessage, + TInt aError ); + + public: // From MBSBackupObserver + + /* + * @see MBSBackupObserver + */ + void HandleBackupStateL( TBackupState aState ); + + public: // New methods + + /** + * + */ + CBSServer* Server() { return (CBSServer*) CSession2::Server(); } + + + TBool MatchSessionL( const TDesC& aApplicationId, + const TDesC& aBrandId, + TLanguage aLanguageId, + TInt aReserved ); + + TBool MatchSessionUninstallL( const TDesC& aApplicationId, + const TDesC& aBrandId); + + void BrandUpdatedL( const TDesC& aApplicationId, + const TDesC& aBrandId, + TLanguage aLanguageId, + TInt aReserved ); + + + + /** + * Returns the filename of the process, that created this + * session. + * + * @return a filename + */ + const TDesC& FileName(); + + /** + * Returns the caption of the process, that created this + * session. + * + * @return a caption + */ + const TDesC& Caption(); + + /** + * Returns the thread id where this session was created. + * + * @return a thread id + */ + TInt ThreadId( TThreadId& aThreadId ); + + /** + * Returns the processId of the process, that created + * this session. + * + * @return a process id + */ + TInt ProcessId( TProcessId& aProcessId ); + + /** + * Returns, if the session info for this object is available. + * + * @return ETrue, if information about this object is available; + * EFalse otherwise + */ + TBool InfoAvailable(); + + + private: // New methods + + /** + * Dispatch clients message + * + * @since + * @param aMessage client's message + */ + TBool DispatchMessageL( const RMessage2 &aMessage ); + + + /** + * Initializes the server + * @param aMessage client's message + */ + void InitUpdateL( const RMessage2 &aMessage, TTransactionType aType ); + + /** + * Initializes the server + * @param aMessage client's message + */ + void InitAccessL( const RMessage2 &aMessage ); + + + /** + * Get text type branding item + * @param aMessage client's message + */ + void GetTextL( const RMessage2 &aMessage ); + + /** + * Get text type branding item + * @param aMessage client's message + */ + void GetBufferL( const RMessage2 &aMessage ); + + /** + * Get integer type branding item + * @param aMessage client's message + */ + void GetIntL( const RMessage2 &aMessage ); + + /** + * Get file type branding item + * @param aMessage client's message + */ + void GetFileL( const RMessage2 &aMessage ); + + /** + * Prepares several textual type branding items. + * These have to be fetched with GetSeveralText. + * @param aMessage client's message + */ + void PrepareSeveralL( const RMessage2 &aMessage ); + + /** + * Gets the several textual branding items + * previously prepared. + * @param aMessage client's message + */ + void GetSeveralL( const RMessage2 &aMessage ); + + + /** + * Prepares several structure type branding items. + * These have to be fetched with GetStructure. + * @param aMessage client's message + */ + void PrepareStructureL( const RMessage2 &aMessage ); + + /** + * Gets the several structure type branding items + * previously prepared. + * @param aMessage client's message + */ + void GetStructureL( const RMessage2 &aMessage ); + + void isBrandUpdateRequiredL (const RMessage2 &aMessage); + + + + /** + * + * + * @param aMessage client's message + */ + void InstallL( const RMessage2 &aMessage ); + + /** + * + * + * @param aMessage client's message + */ + void ReplaceL( const RMessage2 &aMessage ); + + + /** + * + * + * @param aMessage client's message + */ + void AppendL( const RMessage2 &aMessage ); + + /** + * + * + * @param aMessage client's message + */ + MBSElement* InternalizeElementL( RReadStream& aStream, TBool aAppending = EFalse ); + + + /** + * Cancels the transaction + */ + void StartTransactionL( const RMessage2 &aMessage ); + + + /** + * Cancels the transaction + */ + void CancelTransactionL( const RMessage2 &aMessage ); + + /** + * Finishes the transaction + */ + void StopTransactionL( const RMessage2 &aMessage ); + + + /** + * Internalize element ids + */ + void InternalizeElementIdsL( RReadStream& aStream, RBSObjOwningPtrArray& aArray ); + + /** + * + * + * @param aMessage client's message + */ + void RemoveBrandL( const RMessage2 &aMessage ); + + + /** + * + * + * @param aMessage client's message + */ + void RemoveApplicationL( const RMessage2 &aMessage ); + + void PrepareAppendL(); + + void PrepareReplaceL(); + + TInt GetNewVersionL(); + + + /** + * Extracts some information from the specified RMessage2 + * and saves it. + * + * @param aMessage a message from a client + */ + void ExtractInfoL( const RMessage2& aMessage ); + + private: // Data + TBool iInitialized; + TBool iAppending; + TBool iAccessInit; + TBool iWriteNeeded; + + // is backup process currently active + TBool iBackupActive; + + HBufC* iBrandId; + HBufC* iDefaultBrandId; + HBufC* iApplicationId; + TLanguage iLanguageId; + + TInt iValue; + HBufC* iText; + CBSBrandHandler* iBranding; + CBufFlat* iSeveralData; + HBufC8* iBuffer; + TBool iMessageCompleted; + + CBSStorageManager* iStorageManager; + + TBool iObserverActive; + RMessage2 iObserverMessage; + + // To send backup event to client + TBool iIsBackup ; + TInt iReserved; + + /** + * Contains information about this object. + * Own. + */ + CBSSessionInfo* iSessionInfo; + + }; + +#endif // __CBSSESSION_H__ + + +// END OF FILE + diff -r 000000000000 -r e6b17d312c8b brandingserver/bsserver/cbsstorage.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/brandingserver/bsserver/cbsstorage.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,371 @@ +/* +* Copyright (c) 2006-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Stores element data and writes it to stream +* +*/ + + +#include "cbsstorage.h" +#include "bsimportconstants.h" +#include "debugtrace.h" + + +#include +#include +#include + +//#include "mbsimportlogger.h" +//#include "importlogwriter.h" + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// CBSStorage::NewL +// --------------------------------------------------------------------------- +// +CBSStorage* CBSStorage::NewL() + { + CBSStorage* self = NewLC(); + CleanupStack::Pop(); + return self; + } + +// --------------------------------------------------------------------------- +// CBSStorage::NewLC +// --------------------------------------------------------------------------- +// +CBSStorage* CBSStorage::NewLC() + { + CBSStorage* self = new (ELeave) CBSStorage(); + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + +// --------------------------------------------------------------------------- +// CBSStorage::ConstructL +// --------------------------------------------------------------------------- +// +void CBSStorage::ConstructL() + { + } + +// --------------------------------------------------------------------------- +// CBSStorage::CBSStorage +// --------------------------------------------------------------------------- +// +CBSStorage::CBSStorage() + { + } + +// --------------------------------------------------------------------------- +// CBSStorage::~CBSStorage +// --------------------------------------------------------------------------- +// +CBSStorage::~CBSStorage() + { + iElements.Close(); + delete iAppId; + delete iStorageId; + delete iLanguage; + delete iFilename; + } + +// --------------------------------------------------------------------------- +// CBSStorage::AppendElement +// --------------------------------------------------------------------------- +// +void CBSStorage::AppendElementsL( MBSElement* aElement ) + { + if( !aElement ) + { + // Ignore empty + return; + } + + TPtrC8 id = aElement->ElementId(); + + // check if the id is unique + TInt count = iElements.Count(); + + for( TInt i = 0; i < count; i++ ) + { + if( 0 == iElements[i]->ElementId().Compare( id ) ) + { + // duplicate found + User::Leave( KErrAlreadyExists ); + } + } + + iElements.AppendL( aElement ); + } + + +// --------------------------------------------------------------------------- +// CBSStorage::ReplacesElementL +// --------------------------------------------------------------------------- +// +void CBSStorage::ReplaceElementL( MBSElement* aElement ) + { + if( !aElement ) + { + // Ignore empty + return; + } + + TPtrC8 id = aElement->ElementId(); + + // check if the id is unique + TInt count = iElements.Count(); + + for( TInt i = 0; i < count; i++ ) + { + if( 0 == iElements[i]->ElementId().Compare( id ) ) + { + // item found + MBSElement* element = iElements[i]; + iElements.Remove( i ); + delete element; + // put the new element + iElements.AppendL( aElement ); + return; + } + } + // the element was not found from this storage + User::Leave( KErrNotFound ); + } + + +// --------------------------------------------------------------------------- +// CBSStorage::ElementCount +// --------------------------------------------------------------------------- +// +TInt CBSStorage::ElementCount() + { + return iElements.Count(); + } + +// --------------------------------------------------------------------------- +// CBSStorage::ExternalizeL +// --------------------------------------------------------------------------- +// +void CBSStorage::ExternalizeL( RWriteStream& aWriteStream ) + { + if( !VerifyHeader() || !VerifyDataL( iElements ) ) + { + // Header not complete. Will not write to stream + User::Leave( KErrCorrupt ); + } + // Write header + aWriteStream.WriteInt16L( iVersion ); + + // Write elements + TInt count = iElements.Count(); + aWriteStream.WriteInt16L( count ); + for( TInt i = 0; i < count; i++ ) + { + iElements[i]->ExternalizeL( aWriteStream ); + } + } + +// --------------------------------------------------------------------------- +// CBSStorage::SetVersion +// --------------------------------------------------------------------------- +// +void CBSStorage::SetVersion( TInt aVersion ) + { + iVersion = aVersion; + } + +// --------------------------------------------------------------------------- +// CBSStorage::SetApplicationIdL +// --------------------------------------------------------------------------- +// +void CBSStorage::SetApplicationIdL( const TDesC& aAppId ) + { + HBufC* tmp = aAppId.AllocL(); + + delete iAppId; + iAppId = tmp; + } + +// --------------------------------------------------------------------------- +// CBSStorage::SetStorageIdL +// --------------------------------------------------------------------------- +// +void CBSStorage::SetStorageIdL( const TDesC& aStorageId ) + { + HBufC* tmp = aStorageId.AllocL(); + delete iStorageId; + iStorageId = tmp; + } + +// --------------------------------------------------------------------------- +// CBSStorage::SetLanguageL +// --------------------------------------------------------------------------- +// +void CBSStorage::SetLanguageL( TLanguage aLanguage ) + { + TBuf buffer; + buffer.AppendNum( aLanguage ); + + HBufC* tmp = buffer.AllocL(); + delete iLanguage; + iLanguage = tmp; + } + +// --------------------------------------------------------------------------- +// CBSStorage::VerifyHeader +// --------------------------------------------------------------------------- +// +TBool CBSStorage::VerifyHeader() + { + // not checking version as it is been consider not to use. - Pankaj - 31 may 07 + //return ( iAppId && iStorageId && iVersion > 0 && iLanguage ); + return ( iAppId && iStorageId && iLanguage ); + } + + +// --------------------------------------------------------------------------- +// CBSStorage::VerifyDataL +// --------------------------------------------------------------------------- +// +TBool CBSStorage::VerifyDataL( TArray aArray, + TBool aIgnoreEmptyID /* = EFalse */ ) + { + // Check that elements have unique ID's in their own namespace + TInt count = aArray.Count(); + for( TInt i = 0; i < count; i++ ) + { + // Verify inside list elements + if( aArray[i]->ElementType() == EBSList ) + { + TArray listArray = aArray[i]->GetStructureL(); + if( !VerifyDataL( listArray, ETrue ) ) + { + return EFalse; + } + } + + if( aIgnoreEmptyID && + aArray[i]->ElementId().CompareC( KNullDesC8() ) == 0 ) + { + // ignore empty id + continue; + } + + // Check that sibling elements have unique ID + for( TInt j = i + 1; j < count; j++ ) + { + if( aArray[i]->ElementId().CompareC( aArray[j]->ElementId() ) == 0 ) + { + // convert elementID to 16-bit for event logger + TPtrC8 id( aArray[i]->ElementId() ); + HBufC* conv = HBufC::NewLC( id.Length() ); + TPtr uniptr( conv->Des() ); + CnvUtfConverter::ConvertToUnicodeFromUtf8( uniptr, id ); + TRACE( T_LIT("ERROR: Found duplicate element ID (%S)!"), &uniptr ); + CleanupStack::PopAndDestroy(); + return EFalse; + } + } + } + + // All elements ok + return ETrue; + } + + +// --------------------------------------------------------------------------- +// CBSStorage::VerifyDataL +// --------------------------------------------------------------------------- +// +TBool CBSStorage::VerifyDataL( RBSObjOwningPtrArray& aArray, + TBool aIgnoreEmptyID /* = EFalse */ ) + { + return VerifyDataL( aArray.Array(), aIgnoreEmptyID ); + } + + +// --------------------------------------------------------------------------- +// CBSStorage::ProposeFileNameL +// --------------------------------------------------------------------------- +// +TPtrC CBSStorage::ProposeFileNameL() + { + if( !iFilename ) + { + User::Leave( KErrNotReady ); + } + return iFilename->Des(); + } + +// --------------------------------------------------------------------------- +// CBSStorage::ProposeFileNameL +// --------------------------------------------------------------------------- +// +TPtrC CBSStorage::ProposedDirL() + { + if( !iFilename ) + { + User::Leave( KErrNotReady ); + } + return iDir; + } + + +// --------------------------------------------------------------------------- +// CBSStorage::GetListOfFiles() +// --------------------------------------------------------------------------- +// +void CBSStorage::GetListOfFilesL( RArray& aFileList ) + { + TInt count = iElements.Count(); + for( TInt i = 0; i < count; i++ ) + { + AppendFilesL( iElements[i], aFileList ); + } + } + +// --------------------------------------------------------------------------- +// CBSStorage::AppendFiles() +// --------------------------------------------------------------------------- +// +void CBSStorage::AppendFilesL( MBSElement* aElement, RArray& aFileList ) + { + if( !aElement ) + { + // invalid element + return; + } + + TBSElementType type = aElement->ElementType(); + if( EBSList == type ) + { + TArray list = aElement->GetStructureL(); + + TInt count = list.Count(); + for( TInt i = 0; i < count; i++ ) + { + AppendFilesL( list[i], aFileList ); + } + } + else if( EBSFile == type ) + { + TPtrC ptr( aElement->TextDataL() ); + aFileList.Append( aElement->TextDataL() ); + } + } + +// End of file diff -r 000000000000 -r e6b17d312c8b brandingserver/bsserver/cbsstorage.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/brandingserver/bsserver/cbsstorage.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,171 @@ +/* +* Copyright (c) 2006-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Stores element data and writes it to stream +* +*/ + + +#ifndef CBSSTORAGE_H +#define CBSSTORAGE_H + +#include + +#include "rbsobjowningptrarray.h" + +class MBSElement; +class RWriteStream; +class MBSImportLogger; + + +/** + * Stores element data and writes it to stream + * + * @lib brandimporter.exe + * @since S60 v3.2 + */ +class CBSStorage : public CBase +{ +public: + + static CBSStorage* NewL(); + + static CBSStorage* NewLC(); + + ~CBSStorage(); + + /** + * Set version of brand storage + * + * @since S60 3.2 + * @param aVersion version + */ + void SetVersion( TInt aVersion ); + + /** + * Set application ID of brand storage + * + * @since S60 3.2 + * @param aAppId application ID + * @return none + */ + void SetApplicationIdL( const TDesC& aAppId ); + + /** + * Set storage ID of brand storage + * + * @since S60 3.2 + * @param aStorageId storage ID + * @return none + */ + void SetStorageIdL( const TDesC& aStorageId ); + + /** + * Set language of brand storage + * + * @since S60 3.2 + * @param aLanguage language + * @return none + */ + void SetLanguageL( TLanguage aLanguage ); + + /** + * Store element to storage. Storage takes the ownership of element. + * + * @since S60 3.2 + * @param aElement element to store. + * @return General Symbian errorcode. + */ + void AppendElementsL( MBSElement* aElement ); + + /** + * Return the count of elements in storage + * + * @since S60 3.2 + * @return count of elements + */ + TInt ElementCount(); + + /** + * Externalize storage into stream + * + * @since S60 3.2 + * @param aWriteStream output stream + * @return none + */ + void ExternalizeL( RWriteStream& aWriteStream ); + + /** + * Replaces an element in the storage + * + * @since S60 3.2 + * @param aElement the element to be replaced + */ + void ReplaceElementL( MBSElement* aElement ); + + + TPtrC ProposeFileNameL(); + TPtrC ProposedDirL(); + void GetListOfFilesL( RArray& aFileList ); + +private: + + CBSStorage(); + + void ConstructL(); + + /** + * Check that header information is complete + * + * @since S60 3.2 + * @return ETrue - header information ok + * EFalse - header information missing or incomplete + */ + TBool VerifyHeader(); + + TBool VerifyDataL( TArray aArray, + TBool aIgnoreEmptyID = EFalse ); + TBool VerifyDataL( RBSObjOwningPtrArray& aArray, + TBool aIgnoreEmptyID = EFalse ); + + void HandleIfErrorL( TInt aError, const TDesC& aText ); + + void AppendFilesL( MBSElement* aElement, RArray& aFileList ); + +private: // Data + + // Own. Array of stored elements. + RBSObjOwningPtrArray iElements; + + // Own. Proposed file name + HBufC* iFilename; + + // Proposed directory (points to iFilename) + TPtrC iDir; + + // HEADER DATA + + // Version number of storage + TInt iVersion; + + // Own. Language ID of storage + HBufC* iLanguage; + + // Own. Application ID of storage + HBufC* iAppId; + + // Own. Storage ID.of storage + HBufC* iStorageId; +}; + +#endif //CBSSTORAGE_H diff -r 000000000000 -r e6b17d312c8b brandingserver/bsserver/cbsstoragemanager.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/brandingserver/bsserver/cbsstoragemanager.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,1418 @@ +/* +* Copyright (c) 2006-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Stores element data and writes it to stream +* +*/ + + +#include +#include +#include + +#include +#include + + +#include "bsimportconstants.h" +#include "cbsstoragemanager.h" +#include "cbsstorage.h" +#ifdef __WINSCW__ +#include "cbsibywriter.h" +#endif +#include "cbsserver.h" +#include "cbssession.h" +#include "mbsupdater.h" +//#include "importlogwriter.h" +#include "debugtrace.h" + + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// CBSStorageManager::NewL +// --------------------------------------------------------------------------- +// +CBSStorageManager* CBSStorageManager::NewL( CBSSession* aSession, const TDesC& aAppId ) + { + CBSStorageManager* self = NewLC( aSession, aAppId ); + CleanupStack::Pop(); + return self; + } + +// --------------------------------------------------------------------------- +// CBSStorageManager::NewLC +// --------------------------------------------------------------------------- +// +CBSStorageManager* CBSStorageManager::NewLC( CBSSession* aSession, const TDesC& aAppId ) + { + CBSStorageManager* self = + new (ELeave) CBSStorageManager(); + CleanupStack::PushL( self ); + self->ConstructL( aSession, aAppId ); + return self; + } + +// --------------------------------------------------------------------------- +// CBSStorageManager::ConstructL +// --------------------------------------------------------------------------- +// +void CBSStorageManager::ConstructL( CBSSession* aSession, const TDesC& aAppId ) + { + TRACE( T_LIT( "CBSStorageManager::ConstructL begin aAppId[%S]"), &aAppId ); + User::LeaveIfError( iFs.Connect() ); + +// RFs::ShareProtected() needs to be called for the session +// used to open the handle that is going to be shared. +// ShareProtected() was called to a wrong Fs-session in +// CBSBrandHandler::GetFileL(). + User::LeaveIfError( iFs.ShareProtected() ); + + iFs.CreatePrivatePath( EDriveC ); + + iSession = aSession; + + +#ifdef __WINSCW__ + if( !iWriter ) + { + iWriter = CBSIBYWriter::NewL(); + } + if( aAppId.Compare( KNullDesC ) ) + { + HBufC* temp = HBufC::NewL( KBSIbyDirectory().Length() + + aAppId.Length() + + KBSIbyExtension().Length() ); + TPtr ptr( temp->Des() ); + ptr.Append( KBSIbyDirectory ); + ptr.Append( aAppId ); + ptr.Append( KBSIbyExtension ); + delete iIbyFile; + iIbyFile = temp; + iWriter->InitIbyFileL( iFs, *iIbyFile ); + } +#endif + TRACE( T_LIT( "CBSStorageManager::ConstructL end") ); + } + +// --------------------------------------------------------------------------- +// CBSStorageManager::CBSStorageManager +// --------------------------------------------------------------------------- +// +CBSStorageManager::CBSStorageManager() : + iCurrent( KErrNotFound ) + { + } + +// --------------------------------------------------------------------------- +// CBSStorageManager::~CBSStorageManager +// --------------------------------------------------------------------------- +// +CBSStorageManager::~CBSStorageManager() + { + TRACE( T_LIT( "CBSStorageManager::~CBSStorageManager begin") ); + iStorages.ResetAndDestroy(); + iFs.Close(); + + delete iAppId; + delete iBrandId; + delete iLanguageId; + delete iFilename; + + #ifdef __WINSCW__ + delete iWriter; + #endif + + delete iIbyFile; + TRACE( T_LIT( "CBSStorageManager::~CBSStorageManager end") ); + } + +// --------------------------------------------------------------------------- +// CBSStorageManager::InitTransactionL +// --------------------------------------------------------------------------- +// +void CBSStorageManager::ConnectTransactionL(const TDesC& aAppId, + const TDesC& aBrandId, + TLanguage aLanguageId, + TBool aAppending, /*= EFalse*/ + TInt aReserved /*=0*/) + { + TRACE( T_LIT( "CBSStorageManager::ConnectTransactionL begin AppId[%S],BrandId[%S]"),&aAppId, &aBrandId ); + if( iActive ) + { + TBool transactionOk = ETrue; + + transactionOk = iReserved == aReserved; + + if( transactionOk ) + { + transactionOk = iLanguageIdNum == aLanguageId; + } + + if( transactionOk ) + { + transactionOk != iAppId->Compare( aAppId ); + } + + if( transactionOk ) + { + transactionOk != iBrandId->Compare( aBrandId ); + } + + if( !transactionOk ) + { + User::Leave( KErrArgument ); + } + // the same transaction as is ongoing + return; + } + iActive = ETrue; + + HBufC* tmpAppId = aAppId.AllocL(); + delete iAppId; + iAppId = tmpAppId; + + HBufC* tmpBrandId = aBrandId.AllocL(); + delete iBrandId; + iBrandId = tmpBrandId; + + iLanguageIdNum = aLanguageId; + + TBuf buffer; + if( aLanguageId < 10 ) + { + // we want two digit languageid + buffer.AppendNum( KLeadingZero ); + } + buffer.AppendNum( aLanguageId ); + HBufC* tmp = buffer.AllocL(); + delete iLanguageId; + iLanguageId = tmp; + + iReserved = aReserved; + + HBufC* tempFile = ConstructFileNameL(); + delete iFilename; + iFilename = tempFile; + + iAppending = aAppending; + TRACE( T_LIT( "CBSStorageManager::ConnectTransactionL end") ); + } + + +// --------------------------------------------------------------------------- +// CBSStorageManager::CancelTransactionL +// --------------------------------------------------------------------------- +// +void CBSStorageManager::CancelTransactionL() + { + TRACE( T_LIT( "CBSStorageManager::CancelTransactionL begin") ); + if( !iActive ) + { + User::Leave( KErrNotFound ); + } + // this closes the transaction + CleanupTransaction(); + TRACE( T_LIT( "CBSStorageManager::CancelTransactionL end") ); + } + +// --------------------------------------------------------------------------- +// CBSStorageManager::ConstructFileNameL() +// --------------------------------------------------------------------------- +// +HBufC* CBSStorageManager::ConstructFileNameL( TInt aReserved /* = 0 */ ) + { + HBufC* fileName = NULL; + if( iAppId && iBrandId && iLanguageId ) + { + fileName = ConstructFileNameL( *iAppId, *iBrandId, iLanguageIdNum, aReserved ); + } + return fileName; + } + +// --------------------------------------------------------------------------- +// CBSStorageManager::ConstructFileNameL() +// --------------------------------------------------------------------------- +// +HBufC* CBSStorageManager::ConstructFileNameL( const TDesC& aAppId, + const TDesC& aBrandId, + TLanguage aLanguage, + TInt aReserved /* = 0 */ ) + { + HBufC* fileName = NULL; + + TBuf langBuf; + if (aLanguage >= 100) + User::LeaveIfError (KErrNotFound); + if( aLanguage < 10 ) + { + // we want two digit languageid + langBuf.AppendNum( KLeadingZero ); + } + langBuf.AppendNum( aLanguage ); + + TInt length = aAppId.Length() + aBrandId.Length() + + KDefFileName().Length() + KDirSeparator().Length() * 2 + + langBuf.Length() + KDot().Length() * 3 + KMaxVersionLenght; + fileName = HBufC::NewLC( length ); + + TPtr file( fileName->Des() ); + + // [application_id]\[brand_id]\[def_filename][language_id] + // + + file.Append( aAppId ); + file.Append( KDirSeparator ); + file.Append( aBrandId ); + file.Append( KDirSeparator ); + iDir.Set( file.Left( file.Length() ) ); + file.Append( KDefFileName ); + file.Append( langBuf ); + if( aReserved > 0 ) + { + TBuf versionBuffer; + versionBuffer.AppendNum( aReserved ); + file.Append( KDot() ); + file.Append( versionBuffer ); + } + + if( fileName ) + { + CleanupStack::Pop( fileName ); + } + return fileName; + } + +// --------------------------------------------------------------------------- +// CBSStorageManager::CreateStorageL +// --------------------------------------------------------------------------- +// +void CBSStorageManager::CreateStorageL() + { + CBSStorage* tmp = CBSStorage::NewL(); + iStorages.Append( tmp ); + iCurrent = iStorages.Find( tmp ); + } + +// --------------------------------------------------------------------------- +// CBSStorageManager::StorageCount +// --------------------------------------------------------------------------- +// +TInt CBSStorageManager::StorageCount() + { + return iStorages.Count(); + } + +// --------------------------------------------------------------------------- +// CBSStorageManager::Storage +// --------------------------------------------------------------------------- +// +CBSStorage* CBSStorageManager::Storage( TInt aIndex ) + { + return iStorages[ aIndex ]; + } + +// --------------------------------------------------------------------------- +// CBSStorageManager::Storage +// --------------------------------------------------------------------------- +// +CBSStorage* CBSStorageManager::Storage() + { + if( iStorages.Count() > 0 ) + { + return iStorages[ iCurrent ]; + } + return NULL; + } + +// --------------------------------------------------------------------------- +// CBSStorageManager::WriteStorageFilesL +// --------------------------------------------------------------------------- +// +TInt CBSStorageManager::WriteStorageFilesL() + { + TRACE( T_LIT( "CBSStorageManager::WriteStorageFilesL begin") ); + if( !iActive ) + { + User::Leave( KErrNotFound ); + } + TInt count = iStorages.Count(); + for( TInt i = 0; i < count; i++ ) + { + // get the private path + TBuf path; + User::LeaveIfError( iFs.PrivatePath( path ) ); + + // construct absolute filename + HBufC* fullname = FullFileNameLC( *iFilename, ETrue ); + + TParse filestorename; + iFs.Parse( *fullname, filestorename ); + + RFileWriteStream outstream; + + TInt currentVersion = iReserved; + TInt newVersion = iReserved; + // check if the brand has any active clients + TBool brandActive = ETrue; + if( iSession ) + { + CBSServer* server = iSession->Server(); + if( server ) + { + brandActive = server->MatchSessionL( *iAppId, *iBrandId, + iLanguageIdNum, iSession, currentVersion ); + } + } + + if( BaflUtils::FileExists( iFs, filestorename.FullName() ) ) + { + currentVersion = ReadVersionL( filestorename.FullName() ); + + if( iReserved == KBSAutomaticVersionUpdate && brandActive ) + { + + // the brand has active clients + // check if there is already a versioned file for this version + HBufC* fileName = FindAvailableVersionL( currentVersion + 1, newVersion ); + CleanupStack::PushL( fileName); + + HBufC* newName = FullFileNameLC( *fileName, ETrue ); + + iFs.Parse( *newName, filestorename ); + + if( BaflUtils::FileExists( iFs, filestorename.FullName() ) ) + { + // the file already exists + User::Leave( KErrAlreadyExists ); + } + CleanupStack::PopAndDestroy( 2, fileName ); // newName, fileName + } + + else if( ( iReserved == currentVersion ) ) + { + // this version is already installed + User::Leave( KErrAlreadyExists ); + } + + else + { + // check if the current version brand is active + brandActive = iSession->Server()->MatchSessionL( *iAppId, *iBrandId, + iLanguageIdNum, iSession, currentVersion ); + // new version + if( brandActive ) + { + // brand is active + // check if there is already a versioned file for this version + HBufC* fileName = ConstructFileNameL( iReserved ); + CleanupStack::PushL( fileName ); + + HBufC* newName = FullFileNameLC( *fileName, ETrue ); + + iFs.Parse( *newName, filestorename ); + + if( BaflUtils::FileExists( iFs, filestorename.FullName() ) ) + { + // the file already exists + User::Leave( KErrAlreadyExists ); + } + CleanupStack::PopAndDestroy( 2, fileName ); // newName, fileName + } + } + } + + + // write a new brand file + + // Construct the output file & stream. + iFs.MkDirAll( filestorename.DriveAndPath() ); + + TInt err = outstream.Replace( iFs, filestorename.FullName(), EFileWrite ); + + + if( err ) + { + TRACE( T_LIT("ERROR: Cannot create branding file: '%S'"), fullname ); + + User::Leave( err ); + } + + CleanupClosePushL( outstream ); + + if( iReserved == KBSAutomaticVersionUpdate ) + { + // set the next version + iStorages[i]->SetVersion( newVersion ); + iReserved = newVersion; + } + + // Write data to file + TRAPD( extError, iStorages[i]->ExternalizeL( outstream ) ); + if( extError && !iAppending ) + { + // there was an error externalizing the data and we are installing + // delete the file, since it's not complete + iFs.Delete( filestorename.DriveAndPath() ); + } + User::LeaveIfError( extError ); + + +#ifdef __WINSCW__ + // Add to IBY file + iWriter->SetFileItemL( *fullname, *fullname ); +#endif + + CleanupStack::PopAndDestroy( 2 ); // fullname, outstream + + + // existing brand modified --> inform server + if( iSession ) + { + CBSServer* server = iSession->Server(); + if( server ) + { + server->BrandUpdatedL( *iAppId, *iBrandId, + iLanguageIdNum, iSession, iReserved ); + } + } + } + + // this closes the transaction + CleanupTransaction(); + TRACE( T_LIT( "CBSStorageManager::WriteStorageFilesL end") ); + return iReserved; + } + + +// --------------------------------------------------------------------------- +// CBSStorageManager::ReadVersionL +// --------------------------------------------------------------------------- +// +TInt CBSStorageManager::ReadVersionL( const TDesC& aFilename ) + { + RFile handle; + User::LeaveIfError( handle.Open( iFs, aFilename, EFileRead ) ); + CleanupClosePushL( handle ); + RFileReadStream stream; + stream.Attach( handle ); + CleanupClosePushL( stream ); + TInt version = stream.ReadInt16L(); + CleanupStack::PopAndDestroy( 2 ); // stream, handle + return version; + } + +// --------------------------------------------------------------------------- +// CBSStorageManager::FindAvailableVersionL +// --------------------------------------------------------------------------- +// +HBufC* CBSStorageManager::FindAvailableVersionL( TInt /*aCurrentVersion*/, TInt& aNewVersion ) + { + HBufC* fileName = NULL; + TInt newVersion = GetNewestVersionL( *iAppId, *iBrandId, iLanguageIdNum ); + aNewVersion = newVersion++; + fileName = ConstructFileNameL( aNewVersion ); + + return fileName; + } + + +// --------------------------------------------------------------------------- +// CBSStorageManager::CleanupTransaction +// --------------------------------------------------------------------------- +// +void CBSStorageManager::CleanupTransaction() + { + iActive = EFalse; + delete iAppId; + iAppId = NULL; + delete iBrandId; + iBrandId = NULL; + delete iLanguageId; + iLanguageId = NULL; + delete iFilename; + iFilename = NULL; + + iStorages.ResetAndDestroy(); + } + + +TInt CBSStorageManager :: isActualBrandInstalledL ( const TDesC& aAppId, const TDesC& aBrandId, TLanguage aLanguage) +{ + TInt actualBrandInstalled = -1; + HBufC *actualBrandFileName = ConstructFileNameL(aAppId, aBrandId, aLanguage); + CleanupStack::PushL( actualBrandFileName ); + HBufC* newName = FullFileNameLC( *actualBrandFileName , ETrue ); + if (newName) + { + RFile handle; + TInt err = handle.Open( iFs, *newName, EFileShareAny ); + if (KErrNone == err) + { + actualBrandInstalled = 1; + handle.Close (); + } + } + + CleanupStack::PopAndDestroy (2); + return actualBrandInstalled; +} +// --------------------------------------------------------------------------- +// CBSStorageManager::BrandHandleL +// --------------------------------------------------------------------------- +// +void CBSStorageManager::BrandHandleL( const TDesC& aAppId, + const TDesC& aBrandId, + TLanguage aLanguageId, + RFile& aFile, + TInt aReserved ) + { + TRACE( T_LIT( "CBSStorageManager::BrandHandleL begin AppId[%S],BrandId[%S]"),&aAppId, &aBrandId ); + TBuf langBuf; + if (aLanguageId >= 100) + User::LeaveIfError( KErrNotFound ); + if( aLanguageId < 10 ) + { + // we want two digit languageid + langBuf.AppendNum( KLeadingZero ); + } + langBuf.AppendNum( aLanguageId ); + + TInt length = aAppId.Length() + aBrandId.Length() + + KDefFileName().Length() + KDirSeparator().Length() * 2 + + langBuf.Length(); + + HBufC* fileName = HBufC::NewLC( length ); + + TPtr filePtr( fileName->Des() ); + + // [application_id]\[brand_id]\[def_filename][language_id] + // + filePtr.Append( aAppId ); + filePtr.Append( KDirSeparator ); + filePtr.Append( aBrandId ); + filePtr.Append( KDirSeparator ); + + TPtrC directory; + directory.Set( filePtr.Left( filePtr.Length() ) ); + + filePtr.Append( KDefFileName ); + filePtr.Append( langBuf ); + + HBufC* fullname = FullFileNameLC( filePtr ); + + RFile handle; + + TBool versioned = EFalse; + + TParse findname; + iFs.Parse( *fullname, findname ); + + TFileName fullPtr = fullname->Des(); + + + // seems like nearestlanguagefile is only + // searching from z-drive by default, unless + // some other drive is explicitely defined + // for that reason we first try from + // default drive and then force c-drive if + // not found. + BaflUtils::NearestLanguageFile( iFs, fullPtr ); + + TInt currentVersion = 0; + TRAPD( err, currentVersion = ReadVersionL( fullPtr ) ); + if( ( err == KErrNotFound ) || ( err == KErrPathNotFound ) ) + { + // not found, we try forcing c-drive + HBufC* driveForced = FullFileNameLC( filePtr, ETrue ); + TFileName forcedPtr = driveForced->Des(); + BaflUtils::NearestLanguageFile( iFs, forcedPtr ); + TRAP( err, currentVersion = ReadVersionL( forcedPtr ) ); + + if( err == KErrPathNotFound ) + { + // switching the error code to be more clear + err = KErrNotFound; + } + User::LeaveIfError( err ); + + // this file was found, we can use this + CleanupStack::Pop( driveForced ); + CleanupStack::PopAndDestroy( fullname ); + fullname = driveForced; + CleanupStack::PushL( fullname ); + } + else + { + User::LeaveIfError( err ); + } + err = KErrNone; + if( currentVersion != aReserved ) + { + // not the base version, check if we have a versioned file for this + HBufC* versionedName = ConstructFileNameL( aAppId, aBrandId, + aLanguageId, aReserved ); + CleanupStack::PushL( versionedName ); + HBufC* fullVersionedName = FullFileNameLC( *versionedName, ETrue ); + + err = handle.Open( iFs, *fullVersionedName, EFileShareAny ); + CleanupStack::Pop( fullVersionedName ); + CleanupStack::PopAndDestroy( versionedName ); + CleanupStack::PopAndDestroy( fullname ); + fullname = fullVersionedName; + CleanupStack::PushL( fullname ); + versioned = ETrue; + } + else + { + err = handle.Open( iFs, *fullname, EFileShareAny ); + } + + if( err == KErrBadName ) + { + // change bad name to not found + err = KErrNotFound; + } + User::LeaveIfError( err ); + + aFile = handle; + + if( iSession ) + { + CBSServer* server = iSession->Server(); + if( server ) + { + server->RegisterFileForSessionL( iSession, *fullname, versioned ); + } + } + + CleanupStack::PopAndDestroy( 2, fileName ); // fullname, fileName + TRACE( T_LIT( "CBSStorageManager::BrandHandleL end") ); + } + +// --------------------------------------------------------------------------- +// CBSStorageManager::FileElementHandleL +// --------------------------------------------------------------------------- +// +void CBSStorageManager::FileElementHandleL( const TDesC& aAppId, + const TDesC& aBrandId, + const TDesC& aFileName, + const TDesC& aLanguageBuf, + RFile& aFile ) + { + TRACE( T_LIT( "CBSStorageManager::FileElementHandleL begin AppId[%S],BrandId[%S],Filename[%S]"),&aAppId, &aBrandId, &aFileName ); +// Modified file name format: "r[n].filename.ext", +// where "n" is the language code. +// Format used to be "filename.ext.r[n]". + HBufC* internalFn = HBufC::NewLC( aFileName.Length() + + KBSFileLangSuffix().Length() + + aLanguageBuf.Length() + + KDot().Length() ); + TPtr pInternalFn( internalFn->Des() ); + pInternalFn.Append( KBSFileLangSuffix() ); + pInternalFn.Append( aLanguageBuf ); + pInternalFn.Append( KDot() ); + pInternalFn.Append( aFileName ); + + TInt length = aAppId.Length() + + aBrandId.Length() + + pInternalFn.Length() + + ( KDirSeparator().Length() * 3 ) + + KFileElementStore().Length(); + + HBufC* fileName = HBufC::NewL( length ); // replaced NewLC with NewL + + TPtr filePtr( fileName->Des() ); + + // [application_id]\[brand_id]\files\[aFilename] + // + filePtr.Append( aAppId ); + filePtr.Append( KDirSeparator ); + filePtr.Append( aBrandId ); + filePtr.Append( KDirSeparator ); + filePtr.Append( KFileElementStore ); + filePtr.Append( KDirSeparator ); + filePtr.Append( pInternalFn ); + + CleanupStack::PopAndDestroy( internalFn ); + internalFn = NULL; + pInternalFn.Set( 0, 0, 0 ); + + CleanupStack::PushL( fileName ); + HBufC* fullname = FullFileNameLC( filePtr ); + +// Make a TPtr instead of TFileName because after mod, "fullPtr" +// does not need to be passed to BaflUtils::NearestLanguageFile() +// old implementation: TFileName fullPtr = fullname->Des(); + TPtr fullPtr( fullname->Des() ); + + +// A few thoughts about language suffix of files: +// NOTE: NOT about brand file (e.g. "brandfile.bin.r99" ), +// but about other files which belong to the branding package, +// since language suffix added by branding server to a +// mif-file is not acceptable later when calling +// AknIconUtils::CreateIconLC() on the mif-file. +// Skipped call to BaflUtils::NearestLanguageFile() because "XSP MOD" +// moves language code from suffix to prefix. +// NearestLanguageFile()-call could be replaced by an op where +// manager seeks a file only from c and z, or from all drives, +// but does so only for file matching to current or requested +// language. Meaning will not try to get the nearest language +// file but the matching one. +// If nearest language file is actually needed, then +// manager could for example implement a seek-function similar to +// BaflUtils::NearestLanguageFile(), but with the difference that +// it will inspect file prefix instead of suffix. + + + RFile handle; +// RFs::ShareProtected() needs to be called for the Fs-session +// used to open the handle that is about to be shared. +// ShareProtected() was called to a wrong Fs session in +// CBSBrandHandler::GetFileL()! + TInt err = handle.Open( iFs, fullPtr, EFileShareReadersOnly ); + if( err == KErrPathNotFound ) + { + // not found, we try forcing c-drive + HBufC* driveForced = FullFileNameLC( filePtr, ETrue ); + + TFileName forcedPtr = driveForced->Des(); + + + err = handle.Open( iFs, forcedPtr, EFileShareReadersOnly ); + User::LeaveIfError( err ); + // this file was found, we can use this + CleanupStack::Pop( driveForced ); + CleanupStack::PopAndDestroy( fullname ); + fullname = driveForced; + CleanupStack::PushL( fullname ); + } + else + { + User::LeaveIfError( err ); + } + + CleanupStack::PopAndDestroy( 2, fileName ); // fullname, fileName + aFile = handle; + TRACE( T_LIT( "CBSStorageManager::FileElementHandleL end") ); + } + + +// --------------------------------------------------------------------------- +// CBSStorageManager::FullFileNameLC +// --------------------------------------------------------------------------- +// +HBufC* CBSStorageManager::FullFileNameLC( const TDesC& aFilename, TBool aForceCDrive /*= EFalse*/ ) + { + // get the private path + TBuf path; + User::LeaveIfError( iFs.PrivatePath( path ) ); + + // construct absolute filename + HBufC* fullname = HBufC::NewLC( KBSCDrive().Length() + aFilename.Length() + path.Length() + + KBSDataStore().Length() + KDirSeparator().Length() ); + TPtr fullPtr( fullname->Des() ); + fullPtr.Append( KBSCDrive ); + fullPtr.Append( path ); + fullPtr.Append( KBSDataStore ); + fullPtr.Append( KDirSeparator ); + fullPtr.Append( aFilename ); + + TParse filename; + iFs.Parse( fullPtr, filename ); + + if( !aForceCDrive ) + { + // C-drive not explicitely requested + if( !BaflUtils::FileExists( iFs, fullPtr ) ) + { + // the file does not exist in C-drive, so + // we have to return a path to Z-drive + fullPtr.Zero(); + fullPtr.Append( KBSZDrive ); + fullPtr.Append( path ); + fullPtr.Append( KBSDataStore ); + fullPtr.Append( KDirSeparator ); + fullPtr.Append( aFilename ); + } + } + + return fullname; + } + +// --------------------------------------------------------------------------- +// CBSStorageManager::CleanupFileL +// --------------------------------------------------------------------------- +// +void CBSStorageManager::CleanupFileL( const TDesC& aFileName ) + { + TRACE( T_LIT( "CBSStorageManager::CleanupFileL begin") ); + // we have a versioned file we need to clean up + // get the file name without the version information + if( !IsBaseFileL( aFileName) ) + { + // this is not a basefile + // we need to check if basefile should be replaced + // with this one + TPtrC baseFile = FilenameWithoutVersion( aFileName ); + TInt version = ReadVersionL( aFileName ); + TInt baseVersion = ReadVersionL( baseFile ); + if( version > baseVersion ) + { + // newer version --> replace basefile + TInt err = iFs.Replace( aFileName, baseFile); + User::LeaveIfError( err ); + } + else + { + // same or older version --> delete + TInt err = iFs.Delete( aFileName ); + User::LeaveIfError( err ); + } + } + else + { + // this is a basefile + // we need to check if there are any newer versioned files + // that are not in use + + TParse filename; + iFs.Parse( aFileName, filename ); + TPtrC driveAndPath = filename.DriveAndPath(); + + HBufC* nameWithDrive = HBufC::NewLC( aFileName.Length() + KBSCDrive().Length() ); + TPtr nameWithDrivePtr = nameWithDrive->Des(); + + nameWithDrivePtr.Append( aFileName ); + + CDir* files = NULL; + CDir* directories = NULL; + + User::LeaveIfError( iFs.GetDir( driveAndPath, KEntryAttNormal, ESortByName, files, directories ) ); + + TInt count = files->Count(); + for( TInt i = 0; i < count; i++ ) + { + const TEntry file = (*files)[ i ]; + TBufC name = file.iName; + + HBufC* fullName = HBufC::NewLC( driveAndPath.Length() + name.Length() ); + TPtr fullPtr = fullName->Des(); + + fullPtr.Append( driveAndPath ); + fullPtr.Append( name ); + + TPtrC strippedName = FilenameWithoutVersion( *fullName ); + + if( 0 == strippedName.Compare( nameWithDrivePtr ) ) + { + // there is a versioned file, that might be newer + // than the basefile + TInt baseVersion = ReadVersionL( nameWithDrivePtr ); + + TInt versionedVersion = ReadVersionL( fullPtr ); + if( versionedVersion > baseVersion ) + { + // versioned file newer than base file + // check if the versioned file is still in use + if( !iSession->Server()->FileStillInUse( iSession, fullPtr ) ) + { + // the file is not in use, we can replace the basefile + // with the versioned file + TInt err = iFs.Replace( fullPtr, nameWithDrivePtr ); + User::LeaveIfError( err ); + } + } + } + CleanupStack::PopAndDestroy( fullName ); + } + CleanupStack::PopAndDestroy( nameWithDrive ); + } + TRACE( T_LIT( "CBSStorageManager::CleanupFileL end") ); + } + +// --------------------------------------------------------------------------- +// CBSStorageManager::FilenameWithoutVersionL +// --------------------------------------------------------------------------- +// +TPtrC CBSStorageManager::FilenameWithoutVersion( const TDesC& aFileName ) + { + TParse filename; + iFs.Parse( aFileName, filename ); + TPtrC extension = filename.Ext(); + TPtrC strippedName = aFileName.Left( aFileName.Length() - ( extension.Length() ) ); + return strippedName; + } + + +// --------------------------------------------------------------------------- +// CBSStorageManager::IsBaseFileL +// --------------------------------------------------------------------------- +// +TBool CBSStorageManager::IsBaseFileL( const TDesC& aFileName ) + { + TBool returnValue = ETrue; + TPtrC fileName = FilenameWithoutVersion( aFileName ); + if( BaflUtils::FileExists( iFs, fileName ) ) + { + // file with one extension stripped out exists + // --> the file was not a base file + returnValue = EFalse; + } + return returnValue; + } + +// --------------------------------------------------------------------------- +// CBSStorageManager::InstallFile +// --------------------------------------------------------------------------- +// +HBufC* CBSStorageManager::InstallFileLC( const TDesC& aFileName ) + { + TRACE( T_LIT( "CBSStorageManager::InstallFileLC begin") ); + if( !iAppId || !iBrandId ) + { + User::Leave( KErrNotReady ); + } + TParse filename; + iFs.Parse( aFileName, filename ); + + TInt length = iAppId->Length() + iBrandId->Length() + + aFileName.Length() + KDirSeparator().Length() * 3 + + KFileElementStore().Length() + iLanguageId->Length() + + KDot().Length() + KBSFileLangSuffix().Length(); + + HBufC* fileName = HBufC::NewLC( length ); + + TPtr filePtr( fileName->Des() ); + + filePtr.Append( *iAppId ); + filePtr.Append( KDirSeparator ); + filePtr.Append( *iBrandId ); + filePtr.Append( KDirSeparator ); + filePtr.Append( KFileElementStore ); + filePtr.Append( KDirSeparator ); + filePtr.Append( KBSFileLangSuffix() ); + filePtr.Append( *iLanguageId ); + filePtr.Append( KDot() ); + filePtr.Append( filename.NameAndExt() ); + + HBufC* fullname = FullFileNameLC( filePtr, ETrue ); + + TParse directory; + iFs.Parse( *fullname, directory ); + TPtrC ptr = directory.DriveAndPath(); + TInt dirError = iFs.MkDirAll( directory.DriveAndPath() ); + if( dirError == KErrAlreadyExists ) + { + // ignore already exists + dirError = KErrNone; + } + User::LeaveIfError( dirError ); + + CFileMan* fileMan = CFileMan::NewL( iFs ); + CleanupStack::PushL( fileMan ); + + // copy the file, no overwriting + TInt err = fileMan->Copy( aFileName, *fullname, 1 ); + User::LeaveIfError( err ); + +#ifdef __WINSCW__ + // Add to IBY file + iWriter->SetFileItemL( *fullname, *fullname ); +#endif + + CleanupStack::PopAndDestroy( 3, fileName ); // fileMan, fullname, fileName + + + HBufC* returnValue = filename.NameAndExt().AllocLC(); + TRACE( T_LIT( "CBSStorageManager::InstallFileLC end") ); + return returnValue; + } + + +// --------------------------------------------------------------------------- +// CBSStorageManager::RemoveBrandL +// --------------------------------------------------------------------------- +// +void CBSStorageManager::RemoveBrandL( const TDesC& aAppId, + const TDesC& aBrandId, + TLanguage aLanguageId, + TInt aReserved ) + { + TRACE( T_LIT( "CBSStorageManager::RemoveBrandL begin") ); + HBufC* fileName = ConstructFileNameL( aAppId, + aBrandId, + aLanguageId, + aReserved ); + CleanupStack::PushL( fileName ); + + HBufC* fullname = FullFileNameLC( *fileName, ETrue ); + + TParse parseName; + iFs.Parse( *fullname, parseName ); + + TPtrC directory = parseName.DriveAndPath(); + + CFileMan* fileMan = CFileMan::NewL( iFs ); + CleanupStack::PushL( fileMan ); + + // delete all files under this brand and language + TInt err = fileMan->RmDir( directory ); + TRACE( T_LIT( "CBSStorageManager::RemoveBrandL dir='%S' err=%d "), &directory, err ); + + //in case the removal of the entire brand failed because the brand was + //in use, we set this brand as discarded (since parts of the package + //might have been removed) + if ( KErrInUse == err ) + { + MarkBrandAsDiscardedL( aAppId, aBrandId ); + } + + User::LeaveIfError( err ); + + CleanupStack::PopAndDestroy( 3, fileName ); + TRACE( T_LIT( "CBSStorageManager::RemoveBrandL end ") ); + } + +// --------------------------------------------------------------------------- +// CBSStorageManager::RemoveApplicationL +// --------------------------------------------------------------------------- +// +void CBSStorageManager::RemoveApplicationL( const TDesC& aAppId ) + { + TRACE( T_LIT( "CBSStorageManager::RemoveApplicationL begin") ); + TInt length = aAppId.Length() + + KDefFileName().Length() + KDirSeparator().Length(); + + + HBufC* fileName = HBufC::NewLC( length ); + + TPtr file( fileName->Des() ); + + file.Append( aAppId ); + file.Append( KDirSeparator ); + + HBufC* fullName = FullFileNameLC( *fileName, ETrue ); + + CFileMan* fileMan = CFileMan::NewL( iFs ); + CleanupStack::PushL( fileMan ); + + // delete all files under this brand and language + TInt err = fileMan->RmDir( *fullName ); + User::LeaveIfError( err ); + + CleanupStack::PopAndDestroy( 3, fileName ); + TRACE( T_LIT( "CBSStorageManager::RemoveApplicationL end") ); + } + + +// --------------------------------------------------------------------------- +// CBSStorageManager::NextAvailableVersionL +// --------------------------------------------------------------------------- +// +TInt CBSStorageManager::NextAvailableVersionL() + { + TRACE( T_LIT( "CBSStorageManager::NextAvailableVersionL begin") ); + TInt returnValue = 0; + + if( iAppId && iBrandId ) + { + TInt newVersion = 0; + TRAPD( err, newVersion = GetNewestVersionL( *iAppId, *iBrandId, iLanguageIdNum ) ); + if( err == KErrNotFound ) + { + // ignore not found -> we default to 1 + err = KErrNone; + returnValue = iReserved; + } + else + { + returnValue = newVersion + 1; + } + User::LeaveIfError( err ); + } + TRACE( T_LIT( "CBSStorageManager::NextAvailableVersionL end") ); + return returnValue; + } + + +// --------------------------------------------------------------------------- +// CBSStorageManager::NextAvailableVersionL +// --------------------------------------------------------------------------- +// +void CBSStorageManager::SetVersion( TInt aReserved ) + { + iReserved = aReserved; + } + + +// --------------------------------------------------------------------------- +// CBSStorageManager::GetCurrentVersionL +// --------------------------------------------------------------------------- +// +TInt CBSStorageManager::GetNewestVersionL( const TDesC& aAppId, + const TDesC& aBrandId, + TLanguage aLanguageId, + TPtr* aDrive /*= KNullDesC()*/ ) + { + TRACE( T_LIT( "CBSStorageManager::GetNewestVersionL begin") ); + HBufC* fileName = ConstructFileNameL( aAppId, aBrandId, aLanguageId ); + CleanupStack::PushL( fileName ); + + + // FullFileNameLC returns the file from C-drive if it exists there + // and if not, then from ROM + HBufC* fullFileName = FullFileNameLC( *fileName ); + + TParse parse; + iFs.Parse( *fullFileName, parse ); + TPtrC driveAndPath = parse.DriveAndPath(); + + CDir* files = NULL; + CDir* directories = NULL; + + TInt err = iFs.GetDir( driveAndPath, KEntryAttNormal, ESortByName, files, directories ); + if(KErrNone == err ) + { + if(aDrive) + { + (*aDrive).Copy(KBSZDrive); + } + + } + if( err == KErrPathNotFound ) + { + // not found from Z-drive, try from C-drive + CleanupStack::PopAndDestroy( fullFileName ); + fullFileName = FullFileNameLC( *fileName, ETrue ); + driveAndPath.Set( parse.DriveAndPath() ); + err = iFs.GetDir( driveAndPath, KEntryAttNormal, ESortByName, files, directories ); + if(KErrNone == err ) + { + if(aDrive) + { + (*aDrive).Copy(KBSCDrive); + } + } + if( err == KErrPathNotFound ) + { + // switching error code to make it more clear + err = KErrNotFound; + } + // as we are leaving here cleanup the stack + CleanupStack::PopAndDestroy( 2, fileName ); // fullFileName, fileName + User::LeaveIfError( err ); + } + + // get the base file version + TInt returnValue = ReadVersionL( *fullFileName ); + + TInt count = files->Count(); + for( TInt i = 0; i < count; i++ ) + { + const TEntry file = (*files)[ i ]; + TBufC name = file.iName; + + HBufC* fullName = HBufC::NewLC( driveAndPath.Length() + name.Length() ); + TPtr fullPtr = fullName->Des(); + + fullPtr.Append( driveAndPath ); + fullPtr.Append( name ); + + TPtrC strippedName = FilenameWithoutVersion( *fullName ); + + if( 0 == strippedName.Compare( *fullFileName ) ) + { + // there is a versioned file, that might be newer + // than the basefile + TInt versionedVersion = ReadVersionL( fullPtr ); + if( versionedVersion > returnValue ) + { + // versioned file newer than base file + returnValue = versionedVersion; + } + } + CleanupStack::PopAndDestroy( fullName ); + } + + CleanupStack::PopAndDestroy( 2, fileName ); // fullFileName, fileName + + TRACE( T_LIT( "CBSStorageManager::GetNewestVersionL end") ); + return returnValue; + } + + +// --------------------------------------------------------------------------- +// CBSStorageManager::WriteIbyFiles +// --------------------------------------------------------------------------- +// +TInt CBSStorageManager::WriteIbyFiles() + { + TInt err = KErrNone; +#ifdef __WINSCW__ + if( !iWriter ) + { + return KErrNone; + } + + TRAP( err, iWriter->WriteIBYFileL( iFs, *iIbyFile ) ); + delete iIbyFile; + iIbyFile = NULL; + delete iWriter; + iWriter = NULL; + +#endif + return err; + } + +// --------------------------------------------------------------------------- +// CBSStorageManager::LockStorage +// --------------------------------------------------------------------------- +// +void CBSStorageManager::LockStorage() + { + TRACE( T_LIT( "CBSStorageManager::LockStorage begin") ); + // This will disable all filehandles, so that clients can't use them + iFs.Close(); + TRACE( T_LIT( "CBSStorageManager::LockStorage end") ); + } + +// --------------------------------------------------------------------------- +// CBSStorageManager::ReleaseLockL +// --------------------------------------------------------------------------- +// +void CBSStorageManager::ReleaseLockL() + { + TRACE( T_LIT( "CBSStorageManager::ReleaseLockL begin") ); + User::LeaveIfError( iFs.Connect() ); + TRACE( T_LIT( "CBSStorageManager::ReleaseLockL end") ); + } + +// --------------------------------------------------------------------------- +// CBSStorageManager::CheckBrandDiscarded +// --------------------------------------------------------------------------- +// +TBool CBSStorageManager::CheckBrandDiscarded(const TDesC& aAppId, + const TDesC& aBrandId) +{ + TBool flag = EFalse ; + + HBufC *fileName = ConstructDiscardBrandFileNameL(aAppId, aBrandId) ; + CleanupStack::PushL(fileName); + HBufC *fullPath = FullDiscardBrandFileNameLC( *fileName ) ; + + // crate a flag file + RFile file; + TInt err = file.Open(iFs, *fullPath, EFileWrite); + if(err == KErrNone) + { + // file exists. + file.Close() ; + flag = ETrue ; + } + + CleanupStack::PopAndDestroy(fullPath) ; + CleanupStack::PopAndDestroy(fileName) ; + return flag ; +} + +// --------------------------------------------------------------------------- +// CBSStorageManager::ConstructDiscardBrandFileNameL +// --------------------------------------------------------------------------- +// +HBufC* CBSStorageManager::ConstructDiscardBrandFileNameL( const TDesC& aAppId, + const TDesC& aBrandId ) + { + HBufC* fileName = NULL; + + TInt length = aAppId.Length() + aBrandId.Length() + + KDiscardBrandFileName().Length() + KDirSeparator().Length() * 2 ; + fileName = HBufC::NewLC( length ); + + TPtr file( fileName->Des() ); + + // [application_id]\[brand_id]\discardedbrand.txt + file.Append( aAppId ); + file.Append( KDirSeparator ); + file.Append( aBrandId ); + file.Append( KDirSeparator ); + file.Append( KDiscardBrandFileName ); + + if( fileName ) + { + CleanupStack::Pop( fileName ); + } + + return fileName; + } + +// --------------------------------------------------------------------------- +// CBSStorageManager::FullDiscardBrandFileNameLC +// --------------------------------------------------------------------------- +// +HBufC* CBSStorageManager::FullDiscardBrandFileNameLC( TDesC& aFilename ) + { + // get the private path + TBuf path; + RFs fs ; + User::LeaveIfError( fs.Connect() ); + CleanupClosePushL(fs); + User::LeaveIfError( fs.PrivatePath( path ) ); + + // construct absolute filename + HBufC* fullname = HBufC::NewLC( KBSCDrive().Length() + aFilename.Length() + path.Length() + + KBSDataStore().Length() + KDirSeparator().Length() ); + TPtr fullPtr( fullname->Des() ); + fullPtr.Append( KBSCDrive ); + fullPtr.Append( path ); + fullPtr.Append( KBSDataStore ); + fullPtr.Append( KDirSeparator ); + fullPtr.Append( aFilename ); + + CleanupStack::Pop(); // fullname + CleanupStack::PopAndDestroy() ; //fs + CleanupStack::PushL(fullname) ; + + return fullname; + } + +// --------------------------------------------------------------------------- +// CBSStorageManager::MarkBrandAsDiscardedL +// --------------------------------------------------------------------------- +// +void CBSStorageManager::MarkBrandAsDiscardedL( const TDesC& aAppId, + const TDesC& aBrandId ) + { + TRACE( T_LIT( "CBSStorageManager::MarkBrandAsDiscardedL begin app='%S' brand='%S'"), &aAppId, &aBrandId ); + + HBufC *fileName = ConstructDiscardBrandFileNameL( aAppId, aBrandId ) ; + CleanupStack::PushL( fileName ); + HBufC *fullPath = FullDiscardBrandFileNameLC( *fileName ) ; + TRACE( T_LIT( "CBSStorageManager::MarkBrandAsDiscardedL discardedfile='%S'"), &fullPath ); + + // create flag file + RFile file; + TInt err = file.Replace( iFs, *fullPath, EFileWrite ); + TRACE( T_LIT( "CBSStorageManager::MarkBrandAsDiscardedL discarded file creation result='%d'"), err ); + file.Close(); + + CleanupStack::PopAndDestroy( fullPath ); + fullPath = NULL; + CleanupStack::PopAndDestroy( fileName ); + fileName = NULL; + + TRACE( T_LIT( "CBSStorageManager::MarkBrandAsDiscardedL begin") ); + } + +// End of file diff -r 000000000000 -r e6b17d312c8b brandingserver/bsserver/cbsstoragemanager.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/brandingserver/bsserver/cbsstoragemanager.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,225 @@ +/* +* Copyright (c) 2006-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Storage handler +* +*/ + + +#ifndef CBSSTORAGEMANAGER_H +#define CBSSTORAGEMANAGER_H + +#include +#include + +class CBSSession; +class CBSIBYWriter; +class MBSElement; +class CBSStorage; +class RWriteStream; + + +/** + * Storage handler + * + * @lib .exe + * @since S60 v3.2 + */ +class CBSStorageManager : public CBase +{ +public: + + static CBSStorageManager* NewL( CBSSession* aSession, const TDesC& aAppId ); + + static CBSStorageManager* NewLC( CBSSession* aSession, const TDesC& aAppId ); + + ~CBSStorageManager(); + + + /** + * Initializes the transaction to the + * storagemanager + * + * @since S60 3.2 + * @return none + */ + void ConnectTransactionL(const TDesC& aAppId, + const TDesC& aBrandId, + TLanguage aLanguageId, + TBool aAppending = EFalse, + TInt aReserved = 0 ); + + + /** + * Create a new storage and set it to current. + * + * @since S60 3.2 + * @return none + */ + void CreateStorageL(); + + /** + * Return the count of storages + * + * @since S60 3.2 + * @return count of elements + */ + TInt StorageCount(); + + /** + * Get stored storage at index or current storage. + * + * @since S60 3.2 + * @param aIndex index of storage to fetch. + * @return Stored storage + */ + CBSStorage* Storage( TInt aIndex ); + CBSStorage* Storage(); + + /** + * Externalize storage files into file system + * + * @since S60 3.2 + * @param aFs filesystem handle + * @param aBaseDir Base directory for writing + * @return the new brand version + */ + TInt WriteStorageFilesL(); + + void CancelTransactionL(); + + void BrandHandleL( const TDesC& aAppId, + const TDesC& aBrandId, + TLanguage aLanguageId, + RFile& aFile, + TInt aReserved ); + + void FileElementHandleL( const TDesC& aAppId, + const TDesC& aBrandId, + const TDesC& aFileName, + const TDesC& aLanguageBuf, + RFile& aFile ); + + void CleanupFileL( const TDesC& aFileName ); + + TPtrC FilenameWithoutVersion( const TDesC& aFileName ); + + /** + * Externalize storage files into file system + * + * @since S60 3.2 + * @param aFileName the name of the installed file + * including path + * @return the filename without path component + */ + HBufC* InstallFileLC( const TDesC& aFileName ); + + void RemoveBrandL( const TDesC& aAppId, + const TDesC& aBrandId, + TLanguage aLanguageId, + TInt aReserved = 0); + + void RemoveApplicationL( const TDesC& aAppId ); + + TInt NextAvailableVersionL(); + void SetVersion( TInt aVersionId ); + + TInt GetNewestVersionL( const TDesC& aAppId, + const TDesC& aBrandId, + TLanguage aLanguageId, + TPtr* aDrive = NULL); + TInt WriteIbyFiles(); + + void LockStorage(); + + void ReleaseLockL(); + + TBool CheckBrandDiscarded(const TDesC& aAppId, + const TDesC& aBrandId) ; + static HBufC* ConstructDiscardBrandFileNameL( const TDesC& aAppId, + const TDesC& aBrandId ); + + static HBufC* FullDiscardBrandFileNameLC( TDesC& aFilename ) ; + + TInt isActualBrandInstalledL ( const TDesC& aAppId, const TDesC& aBrandId, TLanguage aLanguage); +private: + + CBSStorageManager(); + + void ConstructL( CBSSession* aSession, const TDesC& aAppId ); + + HBufC* ConstructFileNameL( TInt aVersion = 0 ); + + HBufC* ConstructFileNameL( const TDesC& aAppId, + const TDesC& aBrandId, + TLanguage aLanguage, + TInt aReserved = 0 ); + + void CleanupTransaction(); + + HBufC* FullFileNameLC( const TDesC& aFilename, TBool aForceCDrive = EFalse ); + + TInt ReadVersionL( const TDesC& aFilename ); + + HBufC* FindAvailableVersionL( TInt aCurrentVersion, TInt& aNewVersion ); + + TBool IsBaseFileL( const TDesC& aFileName ); + + + /** + * Mark a brand package as discarded. Future attempts to create an + * access to this brand package will fail. + * + * @since S60 3.2 + * @param aAppId a application id + * @param aBrandId a brand id + */ + void MarkBrandAsDiscardedL( const TDesC& aAppId, + const TDesC& aBrandId ); + +private: // Data + + // Own. Array of stored storages. + RPointerArray iStorages; + + // Index of currently active storage + TInt iCurrent; + + // IBY writer + CBSIBYWriter* iWriter; + + RFs iFs; + TBool iActive; + + HBufC* iAppId; + HBufC* iBrandId; + HBufC* iLanguageId; + TLanguage iLanguageIdNum; + + // Own. Proposed file name + HBufC* iFilename; + + // Proposed directory (points to iFilename) + TPtrC iDir; + + // doesn't own: the server + CBSSession* iSession; + + TBool iAppending; + + HBufC* iIbyFile; + TInt iReserved; + +}; + +#endif //CBSSTORAGEMANAGER_H diff -r 000000000000 -r e6b17d312c8b brandingserver/bwins/bsclientu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/brandingserver/bwins/bsclientu.def Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,21 @@ +EXPORTS + ??1CBSBitmap@@UAE@XZ @ 1 NONAME ; CBSBitmap::~CBSBitmap(void) + ??1CBSFactory@@UAE@XZ @ 2 NONAME ; CBSFactory::~CBSFactory(void) + ?BitmapFileId@CBSBitmap@@QBEABVTDesC8@@XZ @ 3 NONAME ; class TDesC8 const & CBSBitmap::BitmapFileId(void) const + ?BitmapId@CBSBitmap@@QBEHXZ @ 4 NONAME ; int CBSBitmap::BitmapId(void) const + ?BitmapMaskId@CBSBitmap@@QBEHXZ @ 5 NONAME ; int CBSBitmap::BitmapMaskId(void) const + ?CreateAccessL@CBSFactory@@QAEPAVMBSAccess@@ABVTDesC8@@W4TLanguage@@HH@Z @ 6 NONAME ; class MBSAccess * CBSFactory::CreateAccessL(class TDesC8 const &, enum TLanguage, int, int) + ?CreateAccessLC@CBSFactory@@QAEPAVMBSAccess@@ABVTDesC8@@W4TLanguage@@HH@Z @ 7 NONAME ; class MBSAccess * CBSFactory::CreateAccessLC(class TDesC8 const &, enum TLanguage, int, int) + ?CreateBSElementL@BSElementFactory@@SAPAVMBSElement@@ABVTDesC8@@W4TBSElementType@@0@Z @ 8 NONAME ; class MBSElement * BSElementFactory::CreateBSElementL(class TDesC8 const &, enum TBSElementType, class TDesC8 const &) + ?CreateBSElementL@BSElementFactory@@SAPAVMBSElement@@ABVTDesC8@@W4TBSElementType@@AAV?$RBSObjOwningPtrArray@VMBSElement@@@@@Z @ 9 NONAME ; class MBSElement * BSElementFactory::CreateBSElementL(class TDesC8 const &, enum TBSElementType, class RBSObjOwningPtrArray &) + ?CreateBSElementL@BSElementFactory@@SAPAVMBSElement@@ABVTDesC8@@W4TBSElementType@@ABVTDesC16@@@Z @ 10 NONAME ; class MBSElement * BSElementFactory::CreateBSElementL(class TDesC8 const &, enum TBSElementType, class TDesC16 const &) + ?CreateBSElementL@BSElementFactory@@SAPAVMBSElement@@ABVTDesC8@@W4TBSElementType@@H@Z @ 11 NONAME ; class MBSElement * BSElementFactory::CreateBSElementL(class TDesC8 const &, enum TBSElementType, int) + ?CreateBSElementL@BSElementFactory@@SAPAVMBSElement@@ABVTDesC8@@W4TBSElementType@@PAVCBSBitmap@@@Z @ 12 NONAME ; class MBSElement * BSElementFactory::CreateBSElementL(class TDesC8 const &, enum TBSElementType, class CBSBitmap *) + ?CreateUpdaterL@CBSFactory@@QAEPAVMBSUpdater@@XZ @ 13 NONAME ; class MBSUpdater * CBSFactory::CreateUpdaterL(void) + ?CreateUpdaterLC@CBSFactory@@QAEPAVMBSUpdater@@XZ @ 14 NONAME ; class MBSUpdater * CBSFactory::CreateUpdaterLC(void) + ?NewL@CBSBitmap@@SAPAV1@HHHHABVTDesC8@@@Z @ 15 NONAME ; class CBSBitmap * CBSBitmap::NewL(int, int, int, int, class TDesC8 const &) + ?NewL@CBSFactory@@SAPAV1@ABVTDesC8@@0@Z @ 16 NONAME ; class CBSFactory * CBSFactory::NewL(class TDesC8 const &, class TDesC8 const &) + ?NewLC@CBSBitmap@@SAPAV1@HHHHABVTDesC8@@@Z @ 17 NONAME ; class CBSBitmap * CBSBitmap::NewLC(int, int, int, int, class TDesC8 const &) + ?SkinIdMajor@CBSBitmap@@QBEHXZ @ 18 NONAME ; int CBSBitmap::SkinIdMajor(void) const + ?SkinIdMinor@CBSBitmap@@QBEHXZ @ 19 NONAME ; int CBSBitmap::SkinIdMinor(void) const + diff -r 000000000000 -r e6b17d312c8b brandingserver/eabi/bsclientu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/brandingserver/eabi/bsclientu.def Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,25 @@ +EXPORTS + _ZN10CBSFactory13CreateAccessLERK6TDesC89TLanguageii @ 1 NONAME + _ZN10CBSFactory14CreateAccessLCERK6TDesC89TLanguageii @ 2 NONAME + _ZN10CBSFactory14CreateUpdaterLEv @ 3 NONAME + _ZN10CBSFactory15CreateUpdaterLCEv @ 4 NONAME + _ZN10CBSFactory4NewLERK6TDesC8S2_ @ 5 NONAME + _ZN16BSElementFactory16CreateBSElementLERK6TDesC814TBSElementTypeP9CBSBitmap @ 6 NONAME + _ZN16BSElementFactory16CreateBSElementLERK6TDesC814TBSElementTypeR20RBSObjOwningPtrArrayI10MBSElementE @ 7 NONAME + _ZN16BSElementFactory16CreateBSElementLERK6TDesC814TBSElementTypeRK7TDesC16 @ 8 NONAME + _ZN16BSElementFactory16CreateBSElementLERK6TDesC814TBSElementTypeS2_ @ 9 NONAME + _ZN16BSElementFactory16CreateBSElementLERK6TDesC814TBSElementTypei @ 10 NONAME + _ZN9CBSBitmap4NewLEiiiiRK6TDesC8 @ 11 NONAME + _ZN9CBSBitmap5NewLCEiiiiRK6TDesC8 @ 12 NONAME + _ZNK9CBSBitmap11SkinIdMajorEv @ 13 NONAME + _ZNK9CBSBitmap11SkinIdMinorEv @ 14 NONAME + _ZNK9CBSBitmap12BitmapFileIdEv @ 15 NONAME + _ZNK9CBSBitmap12BitmapMaskIdEv @ 16 NONAME + _ZNK9CBSBitmap8BitmapIdEv @ 17 NONAME + _ZTI10CBSFactory @ 18 NONAME ; ## + _ZTI19CBSIconFileProvider @ 19 NONAME ; ## + _ZTI9RBSClient @ 20 NONAME ; ## + _ZTV10CBSFactory @ 21 NONAME ; ## + _ZTV19CBSIconFileProvider @ 22 NONAME ; ## + _ZTV9RBSClient @ 23 NONAME ; ## + diff -r 000000000000 -r e6b17d312c8b brandingserver/group/backup_registration.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/brandingserver/group/backup_registration.xml Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff -r 000000000000 -r e6b17d312c8b brandingserver/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/brandingserver/group/bld.inf Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,49 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: branding server BLD.INF which builds, tools and also server and client. +* +*/ +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_MMPFILES +bsclient.mmp +bsserver.mmp +../tools/bsimport/group/importer.mmp +../tools/bsimport/group/installer.mmp + +PRJ_EXPORTS +// Headers exported to source tree +../inc/cbsfactory.h MW_LAYER_PLATFORM_EXPORT_PATH(cbsfactory.h) +../inc/mbsaccess.h MW_LAYER_PLATFORM_EXPORT_PATH(mbsaccess.h) +../inc/mbsupdater.h MW_LAYER_PLATFORM_EXPORT_PATH(mbsupdater.h) +../inc/mbselement.h MW_LAYER_PLATFORM_EXPORT_PATH(mbselement.h) +../inc/cbsbitmap.h MW_LAYER_PLATFORM_EXPORT_PATH(cbsbitmap.h) +../inc/bselementfactory.h MW_LAYER_PLATFORM_EXPORT_PATH(bselementfactory.h) +../inc/tbselementiterator.h MW_LAYER_PLATFORM_EXPORT_PATH(tbselementiterator.h) +../inc/rbsobjowningptrarray.h MW_LAYER_PLATFORM_EXPORT_PATH(rbsobjowningptrarray.h) +../inc/rbsobjowningptrarray.inl MW_LAYER_PLATFORM_EXPORT_PATH(rbsobjowningptrarray.inl) +../inc/mbsbrandchangeobserver.h MW_LAYER_PLATFORM_EXPORT_PATH(mbsbrandchangeobserver.h) +../inc/mbsbackuprestorestateobserver.h MW_LAYER_PLATFORM_EXPORT_PATH(mbsbackuprestorestateobserver.h) + +../group/backup_registration.xml z:/private/102828dd/backup_registration.xml + +// Exporting iby file + +../rom/brandingserver.iby CORE_MW_LAYER_IBY_EXPORT_PATH(brandingserver.iby) + +// Exporting stubsis file +../sis/bsstub.sis /epoc32/data/Z/System/Install/bsstub.sis diff -r 000000000000 -r e6b17d312c8b brandingserver/group/bsclient.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/brandingserver/group/bsclient.mmp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,55 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Branding server client component project descripton file. +* +*/ +#include "bsuids.h" +#include +#include + +TARGET bsclient.dll +TARGETTYPE dll +UID KStaticInterfaceDllUid2 KBrandingClientUid3 +CAPABILITY CAP_CLIENT_DLL +VENDORID VID_DEFAULT + + +SOURCEPATH ../bsclient +SOURCE cbsclient.cpp +SOURCE bsprocessstarter.cpp +SOURCE cbsfactory.cpp +SOURCE cbsaccess.cpp +SOURCE cbsupdater.cpp +SOURCE cbselement.cpp +SOURCE bselementfactory.cpp +SOURCE cbsbitmap.cpp +SOURCE cbsbrandobserver.cpp +SOURCE cbsiconfileprovider.cpp + + +USERINCLUDE ../group +USERINCLUDE ../bsserver +USERINCLUDE ../bsclient + +APP_LAYER_SYSTEMINCLUDE + + +LIBRARY euser.lib +LIBRARY efsrv.lib +LIBRARY flogger.lib +LIBRARY estor.lib +LIBRARY aknskins.lib +LIBRARY aknicon.lib //avkon icons +LIBRARY cone.lib +LIBRARY charconv.lib diff -r 000000000000 -r e6b17d312c8b brandingserver/group/bsserver.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/brandingserver/group/bsserver.mmp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,67 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Branding server, server comopnent project description file. +* +*/ +#include "bsuids.h" +#include +#include + +TARGET bsserver.exe +TARGETTYPE exe + + +UID 0x0 KBrandingSrvUid3 +VENDORID VID_DEFAULT +CAPABILITY CAP_SERVER +TARGETPATH /system/libs + + +SOURCEPATH ../bsserver +SOURCE cbsserver.cpp +SOURCE cbssession.cpp +SOURCE cbsbrandhandler.cpp +SOURCE cbsibywriter.cpp +SOURCE cbsstoragemanager.cpp +SOURCE cbsstorage.cpp +SOURCE cbsinstallhandler.cpp +SOURCE cbsbackupobserver.cpp + +SOURCEPATH ../bsclient +SOURCE cbselement.cpp +SOURCE cbsbitmap.cpp +SOURCE bselementfactory.cpp + + + +USERINCLUDE ../group +USERINCLUDE ../bsserver +USERINCLUDE ../bsclient +USERINCLUDE ../inc + +APP_LAYER_SYSTEMINCLUDE + + + +LIBRARY euser.lib +LIBRARY flogger.lib +LIBRARY efsrv.lib + +LIBRARY bafl.lib +LIBRARY estor.lib +LIBRARY charconv.lib + +// for install handler +LIBRARY apgrfx.lib +LIBRARY apparc.lib diff -r 000000000000 -r e6b17d312c8b brandingserver/group/bsuids.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/brandingserver/group/bsuids.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,34 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: BRANDINGSERVER UIDs +* +*/ +#ifndef __BRANDINGUIDS_H +#define __BRANDINGUIDS_H + +//Uid2:s +#define KStaticInterfaceDllUid2 0x1000008d // CSI: 8 # + + +//Uid3:s +#define KBrandingClientUid3 0x102828DE // CSI: 8 # +#define KBrandingSrvUid3 0x102828DD // CSI: 8 # + + +#endif // __BRANDINGUIDS_H + + +// END OF FILE + + diff -r 000000000000 -r e6b17d312c8b brandingserver/group/debugtrace.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/brandingserver/group/debugtrace.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,162 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Debug Traces. +* +*/ +#ifndef __DEBUGTRACE_H__ +#define __DEBUGTRACE_H__ + +// INCLUDES +#include "e32std.h" + +// DEFINES +//Undefine: tracing disabled +//Define 1: Traces goes to file log +//Define 2: Traces goes to RDebug output +//Define 3: Trace goes both file and RDebug output +#undef TRACE_MODE +//#define TRACE_MODE 3 + + + +// ----------------------------------------------------------------------------- +// Trace definitions +// ----------------------------------------------------------------------------- +#ifdef TRACE_MODE + + // INCLUDES + #include + #include + + // CONSTANTS + _LIT( KTraceLogDir, "BS" ); + _LIT( KTraceLogFile, "BS.log" ); + + //TRACE INDIRECTION + #define T_LIT(s) _L(s) // CSI: 78 # See above + #define TRACE Trace::Emit + #define IF_TRACE_ON( aStatement ) aStatement +#endif // TRACE_MODE + + +//----------------------------------------------------------------------------- +// Empty trace definitions +//----------------------------------------------------------------------------- +#ifndef TRACE_MODE + struct TEmptyTraceString { }; + #define T_LIT(s) TEmptyTraceString() + #define IF_TRACE_ON( aStatement ) + + inline void TRACE(TEmptyTraceString){} + + template + inline void TRACE(TEmptyTraceString,T1){} + + template + inline void TRACE(TEmptyTraceString,T1,T2){} + + template + inline void TRACE(TEmptyTraceString,T1,T2,T3){} + + template + inline void TRACE(TEmptyTraceString,T1,T2,T3,T4){} + + template + inline void TRACE(TEmptyTraceString,T1,T2,T3,T4,T5){} + + template + inline void TRACE(TEmptyTraceString,T1,T2,T3,T4,T5,T6){} + + template + inline void TRACE(TEmptyTraceString,T1,T2,T3,T4,T5,T6,T7){} + + template + inline void TRACE(TEmptyTraceString,T1,T2,T3,T4,T5,T6,T7,T8){} + +#endif // TRACE_MODE + + + + +// ----------------------------------------------------------------------------- +// Trace implementation +// ----------------------------------------------------------------------------- +#ifdef TRACE_MODE + #include + #include + + // TARGET WARNING + #if !defined(_DEBUG) + + #if defined(__CW32__) + #pragma message("Trace logging on.") // CSI: 68 # See above + #else + //ARMCC warning + #endif + #endif + + namespace Trace + { + class TOverflowHandler : public TDes16Overflow + { + inline void Overflow( TDes16& /*aDes*/ ) {} + }; + + inline void Emit( TRefByValue aFmt, ... ) + { + //Format the log line + TBuf< 250 > buffer; + buffer.Append( _L("[") ); // CSI: 78 # See above + buffer.Append( RThread().Name() ); + buffer.Append( _L("] ") ); // CSI: 78 # See above + + TOverflowHandler overflowHandler; + + VA_LIST list; + VA_START( list, aFmt ); + buffer.AppendFormatList( aFmt, list, &overflowHandler ); + + TInt theTraceMode = TRACE_MODE; + + //Send trace to file + if( ( theTraceMode == 1 ) || + ( theTraceMode == 3 ) ) + { + RFileLogger logger; + if( logger.Connect() == KErrNone ) + { + logger.SetDateAndTime( EFalse, ETrue ); + logger.CreateLog( KTraceLogDir, + KTraceLogFile, + EFileLoggingModeAppend ); + + logger.Write( buffer ); + logger.CloseLog(); + logger.Close(); + } + } + + //Send trace to default debug output + if( ( theTraceMode == 2 ) || + ( theTraceMode == 3 ) ) + { + RDebug::Print( _L("%S"), &buffer ); + } + } + } +#endif //TRACE_MODE + +#endif //__DEBUGTRACE_H__ + +// END OF FILE diff -r 000000000000 -r e6b17d312c8b brandingserver/inc/bselementfactory.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/brandingserver/inc/bselementfactory.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,91 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: bselementfactory.h +* +*/ + + +#ifndef __BSELEMENTFACTORY_H +#define __BSELEMENTFACTORY_H + +#include +#include + + +class CBSElement; + + +/** + * Factory for creating branding elements + * + * @since + */ +class BSElementFactory + { + public: + + /* + * Create integer type element. + * @param aElementId id of the element + * @param aElementType type of the element + * @param aElementData the element data + */ + IMPORT_C static MBSElement* CreateBSElementL( const TDesC8& aElementId, + TBSElementType aElementType, + TInt aElementData ); + + /* + * Create text or file type element. + * @param aElementId id of the element + * @param aElementType type of the element + * @param aElementData the element data, if the element is file type + * then this should contain the file name + */ + IMPORT_C static MBSElement* CreateBSElementL( const TDesC8& aElementId, + TBSElementType aElementType, + const TDesC& aElementData ); + + /* + * Create buffer type element. + * @param aElementId id of the element + * @param aElementType type of the element + * @param aElementData the element data + */ + IMPORT_C static MBSElement* CreateBSElementL( const TDesC8& aElementId, + TBSElementType aElementType, + const TDesC8& aElementData ); + + /* + * Create bitmap type element. + * @param aElementId id of the element + * @param aElementType type of the element + * @param aElementData the element data + */ + IMPORT_C static MBSElement* CreateBSElementL( const TDesC8& aElementId, + TBSElementType aElementType, + CBSBitmap* aElementData ); + + /* + * Create an element containing a list of other elements. + * @param aElementId id of the element + * @param aElementType type of the element + * @param aElementData the element data + */ + IMPORT_C static MBSElement* CreateBSElementL( const TDesC8& aElementId, + TBSElementType aElementType, + RBSObjOwningPtrArray& aElementData ); + + }; + +#endif //__BSELEMENTFACTORY_H diff -r 000000000000 -r e6b17d312c8b brandingserver/inc/cbsbitmap.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/brandingserver/inc/cbsbitmap.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,116 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: cbsbitmap.h +* +*/ + + + +#ifndef __CBSBITMAP_H__ +#define __CBSBITMAP_H__ + +#include + +/** + * + */ +NONSHARABLE_CLASS( CBSBitmap ): public CBase + { + public: + /** + * Two-phased constructor. + * @param aBitmapId the bitmap id + * @param aBitmapMaskId the bitmap mask id + * @param aSkinId the skin id + * @param aSkinMaskId the skin mask id + * @param aBitmapFileId the bitmap file id + */ + IMPORT_C static CBSBitmap* NewL( TInt aBitmapId, + TInt aBitmapMaskId, + TInt aSkinIdMajor, + TInt aSkinIdMinor, + const TDesC8& aBitmapFileId ); + + /** + * Two-phased constructor. + * @see NewL + */ + IMPORT_C static CBSBitmap* NewLC( TInt aBitmapId, + TInt aBitmapMaskId, + TInt aSkinIdMajor, + TInt aSkinIdMinor, + const TDesC8& aBitmapFileId ); + + // destructor + IMPORT_C virtual ~CBSBitmap(); + + private: + /** + * @see NewL + */ + CBSBitmap( TInt aBitmapId, + TInt aBitmapMaskId, + TInt aSkinIdMajor, + TInt aSkinIdMinor ); + + /** + * @see NewL + */ + void ConstructL( const TDesC8& aBitmapFileId ); + + public: + /** + * Getter for bitmap id + * @return the bitmap id + */ + IMPORT_C TInt BitmapId() const; + + /** + * Getter for bitmap mask id + * @return the bitmap mask id + */ + IMPORT_C TInt BitmapMaskId() const; + + /** + * Getter for skin id + * @return the skin id + */ + IMPORT_C TInt SkinIdMajor() const; + + /** + * Getter for skin mask id + * @return the skin mask id + */ + IMPORT_C TInt SkinIdMinor() const; + + /** + * Getter for bitmap file id + * @return bitmap file id + */ + IMPORT_C const TDesC8& BitmapFileId() const; + + + private: // data + TInt iBitmapId; + TInt iBitmapMaskId; + TInt iSkinIdMajor; + TInt iSkinIdMinor; + HBufC8* iBitmapFileId; + }; + +#endif // __CBSBITMAP_H__ + + +// END OF FILE + diff -r 000000000000 -r e6b17d312c8b brandingserver/inc/cbsfactory.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/brandingserver/inc/cbsfactory.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,111 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: cbsfactory.h +* +*/ + +#ifndef __CBSFACTORY_H +#define __CBSFACTORY_H + +// INCLUDES +#include + +// FORWARD DECLARATIONS +class MBSAccess; +class MBSUpdater; +class RBSClient; + + +// CLASS DECLARATION + +class CBSFactory : public CBase + { + + public: + + /** + * Two-phased constructor. + * @param aDefaultBrandId the default brand id for branding interfaces + * that are created through this factory. If this parameter + * is given the branding items will be taken from the given + * default brand if they are not found from the wanted brand. + * brand. + * @param aApplicationId application id + */ + IMPORT_C static CBSFactory* NewL( const TDesC8& aDefaultBrandId, + const TDesC8& aApplicationId ); + + // destructor + IMPORT_C virtual ~CBSFactory(); + + private: + + // constructor + CBSFactory(); + + void ConstructL( const TDesC8& aDefaultBrandId, const TDesC8& aApplicationId ); + + + public: + + /** + * Creates a brand access interface + * @param aBrandId the brand to be used with this interface instance + * @param aLanguageId the language id to be used with this interface instance + * @param aCacheData should the interface cache the branding data + * @param aReserved for further use + * @return the access interface + */ + IMPORT_C MBSAccess* CreateAccessL( const TDesC8& aBrandId, + TLanguage aLanguageId, + TBool aCacheData = EFalse, + TInt aReserved = 0 ); + + /** + * Creates a brand access interface + * @param aBrandId the brand to be used with this interface instance + * @param aLanguageId the language id to be used with this interface instance + * @param aCacheData should the interface cache the branding data + * @param aReserved for further use + * @return the access interface + */ + IMPORT_C MBSAccess* CreateAccessLC( const TDesC8& aBrandId, + TLanguage aLanguageId, + TBool aCacheData = EFalse, + TInt aReserved = 0 ); + + /** + * Creates a brand update interface + * @return the interface + */ + IMPORT_C MBSUpdater* CreateUpdaterL(); + + /** + * Creates a brand update interface + * @return the interface + */ + IMPORT_C MBSUpdater* CreateUpdaterLC(); + + + private: // data + HBufC8* iDefaultBrand; + bool iUseDefaultBrand; + HBufC8* iApplicationId; + RBSClient* iServerKeepAlive; + + }; + +#endif // __CBSFACTORY_H + +// End of File diff -r 000000000000 -r e6b17d312c8b brandingserver/inc/mbsaccess.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/brandingserver/inc/mbsaccess.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,143 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MBSAccess +* +*/ + + + +#ifndef __MBSACCESS_H +#define __MBSACCESS_H + +#include +#include +#include +#include + + +// forward declarations +class MBSBrandChangeObserver; +class MBSBackupRestoreStateObserver; +class CFbsBitmap; + +/** + * An interface for getting branding information + * + * @since + */ +class MBSAccess + { + public: + + /* + * Get text type item + * @param aId ID of the item + * @return the text item + */ + virtual HBufC* GetTextL( const TDesC8& aId ) = 0; + + /* + * Get text type item + * @param aId ID of the item + * @return the text item + */ + virtual HBufC* GetTextLC( const TDesC8& aId ) = 0; + + /* + * Get 8-bit data type item + * @param aId ID of the item + * @return the data buffer item + */ + virtual HBufC8* GetBufferL( const TDesC8& aId ) = 0; + + /* + * Get 8-bit data type item + * @param aId ID of the item + * @return the data buffer item + */ + virtual HBufC8* GetBufferLC( const TDesC8& aId ) = 0; + + /* + * Get integer type item + * @param aId ID of the item + * @return the integer item + */ + virtual TInt GetIntL( const TDesC8& aId ) = 0; + + + /* + * Get an array of items + * @param aIds ID's of the items + * @return the items + */ + virtual MBSElement* GetSeveralL( MDesC8Array& aIds ) = 0; + + + /* + * Get a file item + * @param aId ID of the item + * @param aFile on return will contain an open file handle + * to the file + */ + virtual void GetFileL( const TDesC8& aId, + RFile& aFile ) = 0; + + /* + * Get a structure type item + * @param aIds ID of the item + * @return structure branding element + */ + virtual MBSElement* GetStructureL( const TDesC8& aId ) = 0; + + /* + * Register to observer brand data updates + * @param aObserver the observer interface + */ + virtual void RegisterObserverL( MBSBrandChangeObserver* aObserver, MBSBackupRestoreStateObserver* aBackupObserver ) = 0; + + /* + * Unregister a brand data update observer + * @param aObserver the observer interface + */ + virtual void UnRegisterObserverL( MBSBrandChangeObserver* aObserver, MBSBackupRestoreStateObserver *aBackupObserver ) = 0; + + /* + * Get a bitmap type item. + * Note that this method supports skins, but as skin support + * requires CONE, it will only try to load skin bitmaps if + * CONE is available. Else it will only load normal bitmaps. + * @param aBitmapId the ID of the bitmap item itself + * @param aBitmap on return will contain the bitmap + * @param aMask on return will contain the mask + */ + virtual void GetBitmapL( const TDesC8& aBitmapId, + CFbsBitmap*& aBitmap, + CFbsBitmap*& aMask ) = 0; + + + virtual TInt isBrandUpdateRequiredL () = 0; + /* + * Closes the handle to server and deletes the object. + */ + virtual void Close() = 0; + + protected: + + /* + * Destructor + */ + virtual ~MBSAccess() {}; + }; + +#endif //__MBSACCESS_H diff -r 000000000000 -r e6b17d312c8b brandingserver/inc/mbsbackupobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/brandingserver/inc/mbsbackupobserver.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,51 @@ +/* +* Copyright (c) 2006-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Backup and Restore observer interface +* +*/ + + +#ifndef __MBSBACKUPOBSERVER_H +#define __MBSBACKUPOBSERVER_H + +#include + +/** + * Observer interface for backup and restore events + * @since S60 v3.2 + */ +NONSHARABLE_CLASS( MBSBackupObserver ) + { + public: + + // Backup and restore states + enum TBackupState + { + EBackupNotActive, + EBackupActive + }; + + /* + * Hanlder method to receive observer events + * @param aEvent new state of backup and restore + */ + virtual void HandleBackupStateL( TBackupState aState ) = 0; + + /* + * Destructor + */ + virtual ~MBSBackupObserver() {}; + }; + +#endif //__MBSBACKUPOBSERVER_H diff -r 000000000000 -r e6b17d312c8b brandingserver/inc/mbsbackuprestorestateobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/brandingserver/inc/mbsbackuprestorestateobserver.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,50 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MBS Backup restore observer definition. +* +*/ + + + +#ifndef __MBSBACKUPRESTORESTATEOBSERVER_H +#define __MBSBACKUPRESTORESTATEOBSERVER_H + +#include + + +/** + * An interface through which client gets information + * about available brand data updates. + * + * @since + */ +class MBSBackupRestoreStateObserver + { + public: + + /* + * Gets called when backup restore operation begins or ends + * Client can then decide wether to store accessing date or not + * @return ETrue if observer should continue observing + */ + virtual TBool BackupRestoreActivated(TInt activeState) = 0 ; + +protected: + /* + * Destructor + */ + virtual ~MBSBackupRestoreStateObserver() {}; + }; + +#endif //__MBSBACKUPRESTORESTATEOBSERVER_H diff -r 000000000000 -r e6b17d312c8b brandingserver/inc/mbsbrandchangeobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/brandingserver/inc/mbsbrandchangeobserver.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,52 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MBSBrandChangeObserver +* +*/ + + + +#ifndef __MBSBRANDCHANGEOBSERVER_H +#define __MBSBRANDCHANGEOBSERVER_H + +#include + + +/** + * An interface through which client gets information + * about available brand data updates. + * + * @since + */ +class MBSBrandChangeObserver + { + public: + + /* + * Gets called when brand data update is available. + * Client can then decide wether to use the old one + * or the updated one. + * @return ETrue if observer should continue observing + */ + virtual TBool BrandUpdateAvailable( TInt aNewVersion ) = 0; + + +protected: + /* + * Destructor + */ + virtual ~MBSBrandChangeObserver() {}; + }; + +#endif //__MBSBRANDCHANGEOBSERVER_H diff -r 000000000000 -r e6b17d312c8b brandingserver/inc/mbselement.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/brandingserver/inc/mbselement.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,127 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MBSElement.h +* +*/ + + +#ifndef __MBSELEMENT_H +#define __MBSELEMENT_H + +#include +#include + +enum TBSElementType + { + EBSInt, + EBSText, + EBSList, + EBSBuffer, + EBSBitmap, + EBSFile + }; + +/** + * Class encapsulating the structure type branding items + * + * @since + */ + +class RWriteStream; +class CBSBitmap; + +NONSHARABLE_CLASS( MBSElement ) + { + + public: + + /* + * Element type + * @return the element type + */ + virtual TBSElementType ElementType() = 0; + + /* + * Element id + * @return the element id + */ + virtual const TDesC8& ElementId() = 0; + + /* + * Integer data + * Panics if trying to get wrong type data. + * @return the integer data of the item + */ + virtual TInt IntDataL() = 0; + + /* + * Text data + * Panics if trying to get wrong type data. + * @return the text data of the item + */ + virtual const TDesC& TextDataL() = 0; + + /* + * 8-bit buffer data + * Panics if trying to get wrong type data. + * @return the text data of the item + */ + virtual const TDesC8& BufferDataL() = 0; + + /* + * Bitmap data + * Panics if trying to get wrong type data. + * @return the text data of the item + */ + virtual const CBSBitmap& BitmapDataL() = 0; + + /* + * Structure data + * Panics if trying to get wrong type data. + * @return the list data + */ + virtual TArray GetStructureL() = 0; + + /* + * Finds the first entry from the list of a list type element with + * the given element id. Note that if there are several subelements + * with the same elementId then TBrandingElementIterator should be + * used to iterate through them. + * @param aElementId elementId of the subelement to be found. + * @return the subelement + */ + virtual const MBSElement& FindSubEntryL( const TDesC& aElementId ) = 0; + + /* + * Writes the internal state to stream. + * @param aWriteStream output stream; + */ + virtual void ExternalizeL( RWriteStream& aWriteStream ) = 0; + + /* + * Deletes the element. + */ + virtual void Close() = 0; + + /* + * Destructor + */ + virtual ~MBSElement() {}; + + }; + + + + +#endif //__MBSELEMENT_H diff -r 000000000000 -r e6b17d312c8b brandingserver/inc/mbsupdater.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/brandingserver/inc/mbsupdater.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,244 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MBSUpdater + * +*/ + + + + #ifndef __MBSUPDATER_H + #define __MBSUPDATER_H + + #include + #include + +class MBSBackupRestoreStateObserver ; + +const TInt KBSAutomaticVersionUpdate = -1; + + /** + * An interface for updating branding information + * + * @since + */ + class MBSUpdater + { + public: + + enum TUpdateTransactionType + { + EUpdateInstall = 1, + EUpdateAppend, + EUpdateReplace, + EUpdateUninstall + }; + + //*** TRANSACTION HANDLING ***// + + /* + * Start transaction for installing a brand. + * @param aApplicationId id of the application + * @param aBrandId id of the brand + * @param aLanguageId languageid of the brand + * @param aReserved for further use + */ + virtual void StartTransactionL( const TDesC8& aBrandId, + TLanguage aLanguageId, + TUpdateTransactionType aType = EUpdateInstall, + TInt aReserved = 0 ) = 0; + + /* + * Stop brand installation transaction. + * Calling this will indicate that the brand has + * been updated completely and it will be taken + * into use. + * @return new version of the installed/updated brand + */ + virtual TInt StopTransactionL() = 0; + + /* + * Cancels brand installation transaction. + * All the elements updated in this transaction + * will be discarded. + */ + virtual void CancelTransactionL() = 0; + + + //*** BRAND REMOVING ***// + + /* + * Removes all brand data from the specified brand. + */ + virtual void RemoveBrandL( const TDesC8& aApplicationId, + const TDesC8& aBrandId ) = 0; + + /* + * Removes all brand data from the specified application. + */ + virtual void RemoveBrandsL( const TDesC8& aApplicationId ) = 0; + + + //*** BRAND INSTALLING ***// + + + /* + * Insert text type item into the new brand + * @param aId ID of the item + * @param aText the text item + */ + virtual void InsertTextL( const TDesC8& aId, const TDesC& aText ) = 0; + + /* + * Insert 8-bit data type item into the new brand + * @param aId ID of the item + * @param aBuffer the data item + */ + virtual void InsertBufferL( const TDesC8& aId, const TDesC8& aBuffer ) = 0; + + /* + * Insert integer type item into the new brand + * @param aId ID of the item + * @param aInt the integer item + */ + virtual void InsertIntL( const TDesC8& aId, TInt aInt ) = 0; + + /* + * Insert a file type item into the new brand. + * Note that the this is only the id and file name pair, + * the file itself has to be imported separately. + * @param aId ID of the item + * @param aFile the integer item + */ + virtual void InsertFileL( const TDesC8& aId, + const TDesC& aFileName ) = 0; + + /* + * Inserts an element into the brand that is being installed. + * @param aElement the element + */ + virtual void InsertElementL( MBSElement* aElement ) = 0; + + + + + + //*** BRAND UPDATING - replacing ***// + + + /* + * Insert text type item into the new brand + * @param aId ID of the item + * @param aText the text item + */ + virtual void ReplaceTextL( const TDesC8& aId, const TDesC& aText ) = 0; + + /* + * Insert 8-bit data type item into the new brand + * @param aId ID of the item + * @param aBuffer the data item + */ + virtual void ReplaceBufferL( const TDesC8& aId, const TDesC8& aBuffer ) = 0; + + /* + * Insert integer type item into the new brand + * @param aId ID of the item + * @param aInt the integer item + */ + virtual void ReplaceIntL( const TDesC8& aId, TInt aInt ) = 0; + + /* + * Insert a file type item into the new brand. + * Note that the this is only the id and file name pair, + * the file itself has to be imported separately. + * @param aId ID of the item + * @param aFile the integer item + */ + virtual void ReplaceFileL( const TDesC8& aId, + const TDesC& aFileName ) = 0; + + /* + * Inserts an element into the brand that is being installed. + * @param aElement the element + */ + virtual void ReplaceElementL( MBSElement* aElement ) = 0; + + + + //*** BRAND UPDATING - appending ***// + + + /* + * Insert text type item into the new brand + * @param aId ID of the item + * @param aText the text item + */ + virtual void AppendTextL( const TDesC8& aId, const TDesC& aText ) = 0; + + /* + * Insert 8-bit data type item into the new brand + * @param aId ID of the item + * @param aBuffer the data item + */ + virtual void AppendBufferL( const TDesC8& aId, const TDesC8& aBuffer ) = 0; + + /* + * Insert integer type item into the new brand + * @param aId ID of the item + * @param aInt the integer item + */ + virtual void AppendIntL( const TDesC8& aId, TInt aInt ) = 0; + + /* + * Insert a file type item into the new brand. + * Note that the this is only the id and file name pair, + * the file itself has to be imported separately. + * @param aId ID of the item + * @param aFile the integer item + */ + virtual void AppendFileL( const TDesC8& aId, + const TDesC& aFileName ) = 0; + + /* + * Inserts an element into the brand that is being installed. + * @param aElement the element + */ + virtual void AppendElementL( MBSElement* aElement ) = 0; + + + /* + * Closes the handle to server and deletes the object. + */ + virtual void Close() = 0; + + /* + * Register to observer backup restore state change + * @param aObserver the observer interface + */ + virtual void RegisterObserverL( MBSBackupRestoreStateObserver* aBackupObserver ) = 0; + + /* + * Unregister a backup restore state change observer + * @param aObserver the observer interface + */ + virtual void UnRegisterObserverL( MBSBackupRestoreStateObserver* aObserver ) = 0; + + + protected: + /* + * Destructor + */ + virtual ~MBSUpdater() {}; + }; + + #endif //__MBSUPDATER_H diff -r 000000000000 -r e6b17d312c8b brandingserver/inc/rbsobjowningptrarray.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/brandingserver/inc/rbsobjowningptrarray.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,64 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: RBSOBJOWNINGPTRaRRAY.H +* +*/ + +#ifndef _RBSOBJOWNINGPTRARRAY_H +#define _RBSOBJOWNINGPTRARRAY_H + +#include + + + +/** + * Templated array of pointers. Array owns the pointed objects + * and overwrites the normal RPointerArray::Close() + * behaviour to destroy objects, before reseting the + * array contents. + * + * Array is used with Presence Framework interface objects. + * + * @since S60 v3.2 + */ +template< class T > +class RBSObjOwningPtrArray : public RPointerArray + { + public: + + /** + * Default C++ constructor. + */ + inline RBSObjOwningPtrArray(); + + + /** + * Overwritten Close(). + * + * Calls ResetAndDestroy() to delete holded objects + * before reseting array contents. Thus array can be + * pushed on the cleanup stack with CleanupClosePushL(). + */ + inline void Close(); + }; + + + + +#include "rbsobjowningptrarray.inl" + +#endif // _RBSOBJOWNINGPTRARRAY_H + + + diff -r 000000000000 -r e6b17d312c8b brandingserver/inc/rbsobjowningptrarray.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/brandingserver/inc/rbsobjowningptrarray.inl Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,41 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: rbsobjowningptrarray.inl +* +*/ + + +#include + +// ----------------------------------------------------------------------------- +// RBSObjOwningPtrArray::RBSObjOwningPtrArray() implementation. +// +// ----------------------------------------------------------------------------- +// +template +inline RBSObjOwningPtrArray::RBSObjOwningPtrArray() + { + } + + +// ----------------------------------------------------------------------------- +// RBSObjOwningPtrArray::Close() implementation. +// Calls ResetAndDestroy() to destroy holded objects. +// ----------------------------------------------------------------------------- +// +template +inline void RBSObjOwningPtrArray::Close() + { + RPointerArray::ResetAndDestroy(); + } diff -r 000000000000 -r e6b17d312c8b brandingserver/inc/tbselementiterator.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/brandingserver/inc/tbselementiterator.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,55 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: tbselementiterator.h +* +*/ + + + +#ifndef TBSELEMENTITERATOR_H +#define TBSELEMENTITERATOR_H + +#include + +// CLASS DECLARATION + +/** +* +* +* @lib +* @since +*/ + +class MBSElement; + + +class TBSElementIterator + { + public: // New functions + + IMPORT_C MBSElement& Next(); + + /** + * C++ default constructor. + */ + IMPORT_C TBSElementIterator( const TDesC& aElementId ); + + private: + TInt iIndex; + const TDesC& iElementId; + }; + +#endif // TBSELEMENTITERATOR_H + +// End of File diff -r 000000000000 -r e6b17d312c8b brandingserver/inc/tbsmdescarrayadapter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/brandingserver/inc/tbsmdescarrayadapter.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,62 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: One value adapter for MDesCArray. +* +*/ + +#ifndef TBSMDESCARRAYADAPTER_H__ +#define TBSMDESCARRAYADAPTER_H__ + +// INCLUDES +#include +#include + + +// CLASS DECLARATION +/** + * One value adapter for MDesCArray. + * + * @since 3.0 + */ +class TBSMDesCArrayAdapter : public MDesCArray + { + public: //Constructor & destructor + + /** + * C++ constructor. + * Takes the descriptor to adapt. + */ + IMPORT_C TBSMDesCArrayAdapter( const TDesC& aDesc ); + + + public: //From MDesCArray + + IMPORT_C TInt MdcaCount() const; + IMPORT_C TPtrC MdcaPoint( TInt aIndex ) const; + + + private: //Data + + //OWN: Adapted descriptor + TPtrC iDesc; + }; + + +#endif //TBSMDESCARRAYADAPTER_H__ + +// End of File + + + + diff -r 000000000000 -r e6b17d312c8b brandingserver/rom/brandingserver.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/brandingserver/rom/brandingserver.iby Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,37 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Branding Server IBY +* +*/ +#ifndef __BS_IBY__ +#define __BS_IBY__ + +#include + + +// branding client +file=ABI_DIR\BUILD_DIR\bsclient.dll SHARED_LIB_DIR\bsclient.dll +// branding server +file=ABI_DIR\BUILD_DIR\bsserver.exe PROGRAMS_DIR\bsserver.exe + +// Add bsinstall.exe to rom to get xml importing working. +file=ABI_DIR\BUILD_DIR\bsinstall.exe PROGRAMS_DIR\bsinstall.exe + +// backup registration file +data=ZPRIVATE\102828dd\backup_registration.xml private\102828dd\backup_registration.xml + +// stubsis file +data=DATAZ_/system/install/bsstub.sis system/install/bsstub.sis + +#endif // __BS_IBY__ \ No newline at end of file diff -r 000000000000 -r e6b17d312c8b brandingserver/sis/bs.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/brandingserver/sis/bs.pkg Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,34 @@ +; +; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +; All rights reserved. +; This component and the accompanying materials are made available +; under the terms of "Eclipse Public License v1.0" +; which accompanies this distribution, and is available +; at the URL "http://www.eclipse.org/legal/epl-v10.html". +; +; Initial Contributors: +; Nokia Corporation - initial contribution. +; +; Contributors: +; +; Description: +; +;Language +&EN + +;Header +#{"BS"}, (0x102828DE), 1, 5, 0, TYPE=SA, RU + +;Localised VendorID +%{"Nokia"} + +;VendorID +:"Nokia" + +;Supports Series 60 v 5.2; Needs to be updated when platform is changed +(0x20022E6D ), 0, 0, 0, {"Series60ProductID"} + +;binaries +"\EPOC32\RELEASE\ARMV5\UREL\bsserver.exe"-"!:\sys\bin\bsserver.exe" +"\EPOC32\RELEASE\ARMV5\UREL\bsclient.dll"-"!:\sys\bin\bsclient.dll" + diff -r 000000000000 -r e6b17d312c8b brandingserver/sis/bsstub.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/brandingserver/sis/bsstub.pkg Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,47 @@ +; +; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +; All rights reserved. +; This component and the accompanying materials are made available +; under the terms of "Eclipse Public License v1.0" +; which accompanies this distribution, and is available +; at the URL "http://www.eclipse.org/legal/epl-v10.html". +; +; Initial Contributors: +; Nokia Corporation - initial contribution. +; +; Contributors: +; +; Description: +; +; +; Package file for presencefw SIS stub in ROM +; and a ximp framework upgrade SIS. +; Including the stub in ROM enables components +; defined in stub to be updated by SIS installer. +; When adding or removing components from presencefw +; please update this pkg file and create an updated +; stub to group directory. +; +; To create SIS stub: makesis -s ximpfw_upgrade.pkg ximpfwstub.sis +; Copy ximpfwstub.sis to z:\system\install\ximpfwstub.sis +; or use abld export to export it automatically. +; + +;Language +&EN + +;Header +#{"BS"}, (0x102828DE), 1, 0, 0, TYPE=SA + + +;Localised VendorID +%{"Nokia"} + +;VendorID +:"Nokia" + +;binaries +""-"!:\sys\bin\bsserver.exe" +""-"!:\sys\bin\bsclient.dll" + + diff -r 000000000000 -r e6b17d312c8b brandingserver/sis/bsstub.sis Binary file brandingserver/sis/bsstub.sis has changed diff -r 000000000000 -r e6b17d312c8b brandingserver/sis/metadata.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/brandingserver/sis/metadata.xml Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,56 @@ + + + ABC:ABC + + + + + 1 + + BrandingServer + + Update for BrandingServer + + + + + + S60 + + + 5 + 0 + + + 2007 + 1 + + + + + 5 + 2 + + 2009 + 52 + + + + + + + + diff -r 000000000000 -r e6b17d312c8b brandingserver/tools/bsimport/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/brandingserver/tools/bsimport/group/bld.inf Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,22 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: bld.inf file project inclusions. +* +*/ +// BLD.INF + +PRJ_MMPFILES + +importer.mmp +installer.mmp diff -r 000000000000 -r e6b17d312c8b brandingserver/tools/bsimport/group/brandimporter_UID_.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/brandingserver/tools/bsimport/group/brandimporter_UID_.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,21 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: UID file +* +*/ +// Makmake-generated uid source file +#include +#pragma data_seg(".SYMBIAN") +__EMULATOR_IMAGE_HEADER2(0x1000007a,0x00000000,0x00000000,EPriorityForeground,0x000bf030u,0x00000000u,0x00000000,0x101fb657,0x00010000,0) +#pragma data_seg() diff -r 000000000000 -r e6b17d312c8b brandingserver/tools/bsimport/group/importer.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/brandingserver/tools/bsimport/group/importer.mmp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,51 @@ +/* +* Copyright (c) 2006-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project definition file for project bsimport +* +*/ + + +#include + +TARGET bsimport.exe +TARGETTYPE exe +UID 0x1000008d 0x102828DF + +CAPABILITY CAP_APPLICATION +VENDORID VID_DEFAULT + +SOURCEPATH ../src +SOURCE importer.cpp +SOURCE cbsimportstorage.cpp +SOURCE cbsimportmanager.cpp +SOURCE cbsimportxmlparser.cpp +SOURCE cbsimportfilereader.cpp +SOURCE cbsimportstoragemanager.cpp + +// INCLUDE DIRS +USERINCLUDE ../inc + +APP_LAYER_SYSTEMINCLUDE + +// LIBRARIES +LIBRARY euser.lib +LIBRARY xmlparser.lib +LIBRARY efsrv.lib +LIBRARY xmldom.lib +LIBRARY charconv.lib +LIBRARY avkon.lib +LIBRARY estor.lib // RWriteStream +LIBRARY flogger.lib +LIBRARY bafl.lib +LIBRARY bsclient.lib // branding server diff -r 000000000000 -r e6b17d312c8b brandingserver/tools/bsimport/group/installer.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/brandingserver/tools/bsimport/group/installer.mmp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,53 @@ +/* +* Copyright (c) 2006-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project definition file for project bsinstall +* +*/ + + +#include + +TARGET bsinstall.exe +TARGETTYPE exe +UID 0x1000008d 0x102828E1 + +CAPABILITY CAP_APPLICATION +VENDORID VID_DEFAULT + +SOURCEPATH ../src +SOURCE installer.cpp +SOURCE cbsimportstorage.cpp +SOURCE cbsimportmanager.cpp +SOURCE cbsimportxmlparser.cpp +SOURCE cbsimportfilereader.cpp +SOURCE cbsimportstoragemanager.cpp +SOURCE bsbrandremover.cpp + +// INCLUDE DIRS +USERINCLUDE ../inc + +APP_LAYER_SYSTEMINCLUDE + +// LIBRARIES +LIBRARY euser.lib +LIBRARY xmlparser.lib +LIBRARY efsrv.lib +LIBRARY xmldom.lib +LIBRARY charconv.lib +LIBRARY avkon.lib +LIBRARY estor.lib // RWriteStream +LIBRARY flogger.lib +LIBRARY bafl.lib +LIBRARY bsclient.lib // branding server +LIBRARY cone.lib diff -r 000000000000 -r e6b17d312c8b brandingserver/tools/bsimport/inc/cbsimportconstants.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/brandingserver/tools/bsimport/inc/cbsimportconstants.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,67 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Constants header file +* +*/ +// CONSTANTS + +// default build language +_LIT( KDefaultLanguage, "SC" ); + +// Characters to strip from xml text values +_LIT( KCommonControlCharacters, "\n\t\r" ); +_LIT( KEndl, "\n\r" ); + +// === Directory & file constants ============================================= +_LIT( KDirSeparator, "\\" ); +_LIT( KDefFileName, "brandfile.bin.r" ); +_LIT( KDefEventLogDir, "BSImport" ); +_LIT( KDefEventLogFile, "BS_event_log.txt" ); + + +// === XML tags =============================================================== +_LIT( KBrandingTag, "branding" ); +_LIT( KBrandTag, "brand" ); +_LIT( KBrandIDTag, "brand_id" ); +_LIT( KBrandLanguageTag, "brand_language_id" ); +_LIT( KBrandVersionTag, "brand_version" ); +_LIT( KBrandAppIdTag, "application_id" ); +_LIT( KBrandElementTag, "element" ); +_LIT( KElementValueTag, "element_value" ); + +// Element attributes +// e.g. +// +_LIT( KElementTypeName, "type" ); +_LIT( KElementTypeID, "id" ); + +// Element type attributes +_LIT( KElementTypeList, "list" ); +_LIT( KElementTypeBitmap, "bitmap" ); +_LIT( KElementTypeBuffer, "buffer" ); +_LIT( KElementTypeInt, "integer" ); +_LIT( KElementTypeText, "text" ); +_LIT( KElementTypeFile, "file" ); + +// Bitmap element XML tags +_LIT( KBitmapIdTag, "bitmap_id" ); +_LIT( KBitmapFileIdTag, "bitmap_file_id" ); /// XSP MOD +_LIT( KBitmapMaskIdTag, "mask_id" ); +_LIT( KBitmapSkinIdTag, "skin_id_major" ); +_LIT( KBitmapSkinMaskIdTag, "skin_id_minor" ); + +// File element XML tags +_LIT( KFileFileNameTag, "file_name" ); + +// end of file diff -r 000000000000 -r e6b17d312c8b brandingserver/tools/bsimport/inc/cbsimportfilereader.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/brandingserver/tools/bsimport/inc/cbsimportfilereader.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,163 @@ +/* +* Copyright (c) 2006-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Import reader opens and reads the XML file to CMDXMLDocument + +* object + +* +*/ + + +#ifndef CBSIMPORTFILEREADER_H + +#define CBSIMPORTFILEREADER_H + + + +#include + +#include + + + +class CMDXMLDocument; + +class CActiveScheduler; + + + +/** + + * Import reader opens and reads the XML file to CMDXMLDocument object + + * + + * @lib brandimporter.exe + + * @since S60 v3.2 + + */ + +class CBSImportFileReader : public CBase, + + public MMDXMLParserObserver + + { + +public: + + + + static CBSImportFileReader* NewL( TBool aUseScheduler ); + + + + static CBSImportFileReader* NewLC( TBool aUseScheduler ); + + + + ~CBSImportFileReader(); + + + + /** + + * Reads XML file to CMDXMLDocument object + + * + + * @since S60 v3.2 + + * @param aFs file system handle + + * @param aFileName XML file to read + + */ + + CMDXMLDocument* ReadXMLFileL( RFs& aFs, const TDesC& aFileName ); + + + +private: + + + + void ConstructL(); + + + + CBSImportFileReader( TBool aUseScheduler ); + + + +// from base class MMDXMLParserObserver + + + + /** + + * From MMDXMLParserObserver. + + * Writes text to log + + * + + * @since S60 v3.2 + + * @param aText text to write + + */ + + void ParseFileCompleteL(); + + + +private: // Data + + + + // Own. XML parser + + CMDXMLParser* iParser; + + + + // Own. XML document from parser + + CMDXMLDocument* iDocument; + + + + // Own. ActiveScheduler + + CActiveScheduler* iScheduler; + + + + // Own. Scheduler waiter. Used when we can't use scheduler directly. + + CActiveSchedulerWait* iWaiter; + + + + // Wheter we use CActiveScheduler or CActiveSchedulerWait + + TBool iUseScheduler; + + }; + + + +#endif //CBSIMPORTFILEREADER_H + diff -r 000000000000 -r e6b17d312c8b brandingserver/tools/bsimport/inc/cbsimportmanager.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/brandingserver/tools/bsimport/inc/cbsimportmanager.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,71 @@ +/* +* Copyright (c) 2006-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Import manager handles the reading, parsing and writing of +* Brand data. +* +*/ + +#ifndef CBSIMPORTMANAGER_H +#define CBSIMPORTMANAGER_H + +#include +#include + +class CMDXMLDocument; +class MDesCArray; + +/** + * Import manager handles the reading, parsing and writing of + * Brand data. + * + * @lib brandimporter.exe + * @since S60 v3.2 + */ +class CBSImportManager : public CBase +{ +public: + + static CBSImportManager* NewL(); + + static CBSImportManager* NewLC(); + + ~CBSImportManager(); + + /** + * Import XML file and write binary brand file from it. + * Overloaded function takes multiple xml files. + * + * @since S60 v3.2 + * @param aSrcFile source xml file + * @return none + */ + void ImportFileL( const TDesC& aSrcFile ); + void ImportFileL( const MDesCArray& aSrcFiles ); + +private: + + void ConstructL(); + + CBSImportManager(); + +private: // data + + // Own. Filesystem handle + RFs iFs; + + // Own. Parsed source XML document + CMDXMLDocument* iDocument; +}; + +#endif //CBSIMPORTMANAGER_H diff -r 000000000000 -r e6b17d312c8b brandingserver/tools/bsimport/inc/cbsimportstorage.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/brandingserver/tools/bsimport/inc/cbsimportstorage.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,221 @@ +/* +* Copyright (c) 2006-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Stores element data and writes it to stream +* +*/ + + +#ifndef CBSIMPORTSTORAGE_H +#define CBSIMPORTSTORAGE_H + +#include + +class MBSElement; +class RWriteStream; + + +/** + * Stores element data and writes it to stream + * + * @lib brandimporter.exe + * @since S60 v3.2 + */ +class CBSImportStorage : public CBase +{ +public: + + static CBSImportStorage* NewL(); + + static CBSImportStorage* NewLC(); + + ~CBSImportStorage(); + + /** + * Set version of brand storage + * + * @since S60 3.2 + * @param aVersion version + */ + void SetVersion( TInt aVersion ); + + /** + * Set application ID of brand storage + * + * @since S60 3.2 + * @param aAppId application ID + * @return none + */ + void SetApplicationIdL( const TDesC& aAppId ); + + /** + * Set storage ID of brand storage + * + * @since S60 3.2 + * @param aStorageId storage ID + * @return none + */ + void SetStorageIdL( const TDesC& aStorageId ); + + /** + * Set language of brand storage + * + * @since S60 3.2 + * @param aLanguage language + * @return none + */ + void SetLanguageL( TLanguage aLanguage ); + + /** + * Store element to storage. Storage takes the ownership of element. + * + * @since S60 3.2 + * @param aElement element to store. + * @return General Symbian errorcode. + */ + TInt AppendElement( MBSElement* aElement ); + + /** + * Return the count of elements in storage + * + * @since S60 3.2 + * @return count of elements + */ + TInt ElementCount(); + + /** + * Return one element + * + * @since S60 3.2 + * @return requested element + */ + MBSElement* Element( TInt aIndex ); + + /** + * Externalize storage into stream + * + * @since S60 3.2 + * @param aWriteStream output stream + * @return none + */ + void ExternalizeL( RWriteStream& aWriteStream ); + void FlushToServerL(); + + /** + * Gives a full filename which is constructed from header data + * + * @since S60 3.2 + * @return filename + */ + TPtrC ProposeFileNameL(); + + /** + * Scan through all elements in storage and find EFile items. + * Appends all found items to aFileList array. + * + * @since S60 3.2 + * @param aFileList filelist array + */ + void GetListOfFiles( RArray& aFileList ); + + /** + * Compare storages header data to another storage. + * + * @since S60 3.2 + * @param aStorage storage to compare + * @return ETrue - storages match + * EFalse - storages don't match + */ + TBool Compare( const CBSImportStorage* aStorage ) const; + + /** + * Take content of one storage into this storage. Will delete + * elements in aStorage! + * + * @since S60 3.2 + * @param aStorage storage to append + */ + void TakeElements( CBSImportStorage* aStorage ); + +private: + + CBSImportStorage(); + + void ConstructL(); + + /** + * Check that header information is complete + * + * @since S60 3.2 + * @return ETrue - header information ok + * EFalse - header information missing or incomplete + */ + TBool VerifyHeader(); + + /** + * Check that data information is correct. + * - verify that elements have unique ID's + * + * @since S60 3.2 + * @param aArray array of elements to check + * @param aIgnoreEmptyID ETrue: empty id's are considered as unique + * EFalse: 2 empty id's will fail this check + * @return ETrue - data ok. + * EFalse - bad data. + */ + TBool VerifyDataL( TArray aArray, + TBool aIgnoreEmptyID = EFalse ); + + /** + * Creates a filename from given header data. + * \[application_id]\[brand_id]\[def_filename][language_id] + * + * @since S60 3.2 + */ + void ConstructFileNameL(); + + + /** + * Check element for EFile items. + * Appends all found items to aFileList array. + * + * @since S60 3.2 + * @param aElement element to check + * @param aFileList filelist array + */ + void AppendFiles( MBSElement* aElement, RArray& aFileList ); + +private: // Data + + // Own. Array of stored elements. + RPointerArray iElements; + + // Own. Proposed file name + HBufC* iFilename; + + // HEADER DATA + + // Version number of storage + TInt iVersion; + + // Language ID of storage + TLanguage iLanguage; + + // Own. Application ID of storage + HBufC8* iAppId; + + // Own. Storage ID.of storage + HBufC8* iStorageId; +}; + +#endif //CBSIMPORTSTORAGE_H diff -r 000000000000 -r e6b17d312c8b brandingserver/tools/bsimport/inc/cbsimportstoragemanager.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/brandingserver/tools/bsimport/inc/cbsimportstoragemanager.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,103 @@ +/* +* Copyright (c) 2006-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Storage handler +* +*/ + + +#ifndef CBSIMPORTSTORAGEMANAGER_H +#define CBSIMPORTSTORAGEMANAGER_H + +#include + +class CBSImportStorage; +class RWriteStream; +class RFs; + +/** + * Storage handler + * + * @lib brandimporter.exe + * @since S60 v3.2 + */ +class CBSImportStorageManager : public CBase +{ +public: + + static CBSImportStorageManager* NewL(); + + static CBSImportStorageManager* NewLC(); + + ~CBSImportStorageManager(); + + /** + * Create a new storage and set it to current. + * + * @since S60 3.2 + * @return none + */ + void CreateStorageL(); + + /** + * Return the count of storages + * + * @since S60 3.2 + * @return count of elements + */ + TInt StorageCount(); + + /** + * Get stored storage at index or current storage. + * + * @since S60 3.2 + * @param aIndex index of storage to fetch. + * @return Stored storage + */ + CBSImportStorage* Storage( TInt aIndex ); + CBSImportStorage* Storage(); + + /** + * Write stored data to Branding server + * + * @since S60 3.2 + * @return none + */ + void WriteDataToServerL(); + + +private: + + CBSImportStorageManager(); + + void ConstructL(); + + /** + * Merge storages with same header data + * + * @since S60 3.2 + * @return none + */ + void MergeStorages(); + +private: // Data + + // Own. Array of stored storages. + RPointerArray iStorages; + + // Index of currently active storage + TInt iCurrent; + +}; + +#endif //CBSIMPORTSTORAGEMANAGER_H diff -r 000000000000 -r e6b17d312c8b brandingserver/tools/bsimport/inc/cbsimportxmlparser-1.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/brandingserver/tools/bsimport/inc/cbsimportxmlparser-1.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,16 @@ +/* +* Copyright (c) 2006-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Parses XML content and stores data to storage* +*/ +#ifndef CBSIMPORTXMLPARSER_H#define CBSIMPORTXMLPARSER_H// INCLUDE FILES#include #include #include #include #include class CMDXMLNode;class CBSImportStorageManager;// CLASS DEFINITIONclass CBSImportXMLParser : public CBase {private: // Definitions struct TImportBitmap { TInt iBitmapId; TInt iBitmapMaskId; TInt iSkinId; TInt iSkinMaskId; }; enum TXMLBaseTagTypes { EBrandUnknown, EBrandAppID, EBrandID, EBrandLanguage, EBrandVersion, EBrandElement }; public: static CBSImportXMLParser* NewL( CBSImportStorageManager* aStorage ); static CBSImportXMLParser* NewLC( CBSImportStorageManager* aStorage ); ~CBSImportXMLParser(); /** * Parse XML document and store data to storage * * @since S60 3.2 * @param aDocument XML document to parse * @return none */ void ParseDocumentL( CMDXMLDocument& aDocument );private: CBSImportXMLParser( CBSImportStorageManager* aStorage ); void ConstructL(); /** * Parses full the base element and it's child elements. * * @since S60 v3.2 * @param aElement to parse */ void ParseDocumentBaseL( CMDXMLNode* aElement ); /** * Analyzes a child node of and stores the value to storage. * Ignores undetected XML nodes. * * @since S60 v3.2 * @param aElement to parse */ void AnalyzeNodeL( CMDXMLNode* aNode ); /** * Converts a given node to TXMLBaseTagTypes. This can handle all * child nodes of * * @since S60 v3.2 * @param aNode node to check * @return corresponding TXMLBaseTagTypes value (or EBrandUnknown). */ TXMLBaseTagTypes SolveTagTypeL( CMDXMLNode* aNode ); /** * Parses full node. Returns a newly constructed MBSElement * from the content of teh node. * Ownership is transferred! * * @since S60 v3.2 * @param aNode node * @return Concrete element constructed from node. */ MBSElement* ParseBrandElementL( CMDXMLNode* aNode ); /** * Converts elements type attribute value to TBSElementType * (see MBSElement). * * @since S60 v3.2 * @param aType value of type attribute * @return corresponding TBrandingElementType value or KErrNotFound. */ TInt SolveElementType( const TDesC& aType ); /** * Search a child node with name inside another node. Returns the first match * * @since S60 v3.2 * @param aNode parent node to search * @param aTagName Child nodes name * @return found node or NULL if not found; */ CMDXMLNode* SearchChild( CMDXMLNode* aNode, const TDesC& aChildName ); /** * Parse value from tag. Leaves if parse fails. * Ownership is transferred to caller (NodeTextLC) * * @since S60 3.2 * @param aNode XML node to parse. should be . * @return value from */ HBufC* NodeTextLC( CMDXMLNode* elNode ); TInt NodeIntL ( CMDXMLNode* elNode ); /** * Parse tag for given value type. Leaves if parsing fails. * * @since S60 3.2 * @param aNode XML node to parse * @param aValue Parsed value * @return none */ void DoParseIntegerL( CMDXMLNode* aNode, TInt& aValue ); void DoParseTextL ( CMDXMLNode* aNode, HBufC*& aText ); void DoParseFileL ( CMDXMLNode* aNode, HBufC*& aText ); void DoParseListL ( CMDXMLNode* aNode, RBSObjOwningPtrArray& aElementArray ); void DoParseBitmapL ( CMDXMLNode* aNode, CBSBitmap*& aBitmap ); private: // Data // Not owned. Storage where to put parsed elements CBSImportStorageManager* iStorage; };#endif //CBSIMPORTXMLPARSER_H \ No newline at end of file diff -r 000000000000 -r e6b17d312c8b brandingserver/tools/bsimport/inc/cbsimportxmlparser.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/brandingserver/tools/bsimport/inc/cbsimportxmlparser.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,317 @@ +/* +* Copyright (c) 2006-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Parses XML content and stores data to storage + +* +*/ + + +#ifndef CBSIMPORTXMLPARSER_H + +#define CBSIMPORTXMLPARSER_H + + + +// INCLUDE FILES + +#include + +#include + +#include + +#include + +#include + + + +class CMDXMLNode; + +class CBSImportStorageManager; + + + +// CLASS DEFINITION + +class CBSImportXMLParser : public CBase + + { + +private: // Definitions + + + + struct TImportBitmap + + { + + TInt iBitmapId; + + TInt iBitmapMaskId; + + TInt iSkinId; + + TInt iSkinMaskId; + + }; + + + + enum TXMLBaseTagTypes + + { + + EBrandUnknown, + + EBrandAppID, + + EBrandID, + + EBrandLanguage, + + EBrandVersion, + + EBrandElement + + }; + + + +public: + + + + static CBSImportXMLParser* NewL( CBSImportStorageManager* aStorage ); + + + + static CBSImportXMLParser* NewLC( CBSImportStorageManager* aStorage ); + + + + ~CBSImportXMLParser(); + + + + /** + + * Parse XML document and store data to storage + + * + + * @since S60 3.2 + + * @param aDocument XML document to parse + + * @return none + + */ + + void ParseDocumentL( CMDXMLDocument& aDocument ); + + + +private: + + + + CBSImportXMLParser( CBSImportStorageManager* aStorage ); + + + + void ConstructL(); + + + + /** + + * Parses full the base element and it's child elements. + + * + + * @since S60 v3.2 + + * @param aElement to parse + + */ + + void ParseDocumentBaseL( CMDXMLNode* aElement ); + + + + /** + + * Analyzes a child node of and stores the value to storage. + + * Ignores undetected XML nodes. + + * + + * @since S60 v3.2 + + * @param aElement to parse + + */ + + void AnalyzeNodeL( CMDXMLNode* aNode ); + + + + /** + + * Converts a given node to TXMLBaseTagTypes. This can handle all + + * child nodes of + + * + + * @since S60 v3.2 + + * @param aNode node to check + + * @return corresponding TXMLBaseTagTypes value (or EBrandUnknown). + + */ + + TXMLBaseTagTypes SolveTagTypeL( CMDXMLNode* aNode ); + + + + /** + + * Parses full node. Returns a newly constructed MBSElement + + * from the content of teh node. + + * Ownership is transferred! + + * + + * @since S60 v3.2 + + * @param aNode node + + * @return Concrete element constructed from node. + + */ + + MBSElement* ParseBrandElementL( CMDXMLNode* aNode ); + + + + /** + + * Converts elements type attribute value to TBSElementType + + * (see MBSElement). + + * + + * @since S60 v3.2 + + * @param aType value of type attribute + + * @return corresponding TBrandingElementType value or KErrNotFound. + + */ + + TInt SolveElementType( const TDesC& aType ); + + + + /** + + * Search a child node with name inside another node. Returns the first match + + * + + * @since S60 v3.2 + + * @param aNode parent node to search + + * @param aTagName Child nodes name + + * @return found node or NULL if not found; + + */ + + CMDXMLNode* SearchChild( CMDXMLNode* aNode, const TDesC& aChildName ); + + + + /** + + * Parse value from tag. Leaves if parse fails. + + * Ownership is transferred to caller (NodeTextLC) + + * + + * @since S60 3.2 + + * @param aNode XML node to parse. should be . + + * @return value from + + */ + + HBufC* NodeTextLC( CMDXMLNode* elNode ); + + TInt NodeIntL ( CMDXMLNode* elNode ); + + + + /** + + * Parse tag for given value type. Leaves if parsing fails. + + * + + * @since S60 3.2 + + * @param aNode XML node to parse + + * @param aValue Parsed value + + * @return none + + */ + + void DoParseIntegerL( CMDXMLNode* aNode, TInt& aValue ); + + void DoParseTextL ( CMDXMLNode* aNode, HBufC*& aText ); + + void DoParseFileL ( CMDXMLNode* aNode, HBufC*& aText ); + + void DoParseListL ( CMDXMLNode* aNode, RBSObjOwningPtrArray& aElementArray ); + + void DoParseBitmapL ( CMDXMLNode* aNode, CBSBitmap*& aBitmap ); + + + +private: // Data + + + + // Not owned. Storage where to put parsed elements + + CBSImportStorageManager* iStorage; + + }; + + + +#endif //CBSIMPORTXMLPARSER_H + diff -r 000000000000 -r e6b17d312c8b brandingserver/tools/bsimport/inc/importlogwriter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/brandingserver/tools/bsimport/inc/importlogwriter.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,127 @@ +/* +* Copyright (c) 2006-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Log writer macros +* +*/ + + + +/* +* +* Description: +* +* Logging tools. Uniforms style to write debug data to +* file with RFileLogger. +* +* Usage: +* +* following directory must be manually done before logging +* (no directory, not logs). +* Epoc32\Winscw\c\logs\bsimport\ +* +* +* 2.Printing: +* +* // normal string output: +* IMPORT_DP( D_IMPORT_LIT( "Some text." ) ); >> CHAT: Some text. +* IMPORT_DP( D_PLAIN_LIT( "Some text." ) ); >> Some text. +* IMPORT_DP_TXT( "Some text." ); >> CHAT: Some text. +* +* // string with variables +* TInt index( 99 ); +* _LIT( KExample, "Example" ); +* IMPORT_DP( D_IMPORT_LIT( "Some text: %d" ), 100 ); >> CHAT: Some text: 100 +* IMPORT_DP( D_IMPORT_LIT( "Some text: %d" ), index ); >> CHAT: Some text: 99 +* IMPORT_DP( D_IMPORT_LIT( "Some text: %S" ), &KExample ); >> CHAT: Some text: Example +* +* IMPORT_DP( D_PLAIN_LIT( "Some text: %d" ), 100 ); >> Some text: 100 +* IMPORT_DP( D_PLAIN_LIT( "Some text: %d" ), index ); >> Some text: 99 +* IMPORT_DP( D_PLAIN_LIT( "Some text: %S" ), &KExample ); >> Some text: Example +* +* +* 3.Known issues: +* +* - If you use macros from .mmp file remember to abld makefile to +* change flags from project. +* - In statements like IMPORT_DP( D_IMPORT_LIT("Some text: %S"), &KExample ); +* parameters causes still some code to generated in release builds. +* Propably it is best to #ifdef all debugprint blocks +* with CHAT_ENABLE_DEBUG_PRINT statement. +* +* ============================================================================ +*/ + + +#ifndef __IMPORTLOGWRITER_H__ +#define __IMPORTLOGWRITER_H__ + + +// no include files if no debug printing --> faster compile time +// INCLUDES +#include +#include +#include + +/** + * Depending if the build is UNICODE or not, define the + * helper macros that insert CHAT prefix. + */ +#ifdef _UNICODE + //#define IMPORT_TOKEN_PASTING( s ) L##s + //#define IMPORT_TO_UNICODE( s ) CHAT_TOKEN_PASTING( s ) + #define IMPORT_DEBUG_STR( m ) L##m +#else + #define IMPORT_DEBUG_STR "CHAT: " +#endif // _UNICODE + + +/** + * Helper macro for defining debug strings with plain debug text. + */ +#define D_PLAIN_LIT( s ) _L( s ) // CSI: 78 # Debug print + + +/** + * Helper macro for defining debug strings with "CHAT:" prefix. + */ +#define D_IMPORT_LIT( s ) TPtrC( ( const TText * ) L ## s ) + + +/** + * Method to handle file writing + */ +inline void ImportDebugWriteFormat( TRefByValue aFmt,... ) + { + _LIT( KDir, "BSImport" ); + _LIT( KName, "Importlog.txt" ); + + // take the ellipsis parameters + VA_LIST args; + VA_START( args,aFmt ); + RFileLogger::WriteFormat( KDir, KName, EFileLoggingModeAppend, + aFmt, args ); + VA_END( args ); + } + +/** + * Actual debug printters. + * Output to log file. + */ +#define IMPORT_DP ImportDebugWriteFormat +#define IMPORT_DP_TXT( s ) ImportDebugWriteFormat( D_IMPORT_LIT( s ) ) + +#endif // __IMPORTLOGWRITER_H__ + + +// End of File diff -r 000000000000 -r e6b17d312c8b brandingserver/tools/bsimport/src/bsbrandremover.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/brandingserver/tools/bsimport/src/bsbrandremover.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,57 @@ +/* +* Copyright (c) 2006-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Removes brands from branding server +* +*/ + +#include + +#include +#include + +#include "bsbrandremover.h" + + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// BSBrandRemover::RemoveBrand +// --------------------------------------------------------------------------- +// +void BSBrandRemover::RemoveBrandL( const TDesC& aBrandId, + const TDesC& aApplicationId ) + { + // 16bit -> 8bit conversion + HBufC8* brandBuf = HBufC8::NewLC( aBrandId.Length() ); + HBufC8* appBuf = HBufC8::NewLC( aApplicationId.Length() ); + TPtr8 brand( brandBuf->Des() ); + TPtr8 app( appBuf->Des() ); + + CnvUtfConverter::ConvertFromUnicodeToUtf8( brand, aBrandId ); + CnvUtfConverter::ConvertFromUnicodeToUtf8( app, aApplicationId ); + + // Remove brand + CBSFactory* factory = CBSFactory::NewL( brand, app ); + CleanupStack::PushL( factory ); + MBSUpdater* updater = factory->CreateUpdaterLC(); + //updater->StartTransactionL( brand, ELangOther, KBSAutomaticVersionUpdate ); + updater->StartTransactionL( brand, ELangOther, MBSUpdater::EUpdateUninstall); + + updater->RemoveBrandL( brand, app ); + + updater->StopTransactionL(); + CleanupStack::PopAndDestroy( 4 ); // updater, factory, brandBuf, appBuf + } + +// End of file diff -r 000000000000 -r e6b17d312c8b brandingserver/tools/bsimport/src/bsbrandremover.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/brandingserver/tools/bsimport/src/bsbrandremover.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,42 @@ +/* +* Copyright (c) 2006-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Helper class for removing brands +* +*/ + +#ifndef BSBRANDREMOVER_H +#define BSBRANDREMOVER_H + + +/** + * Brand remover helper + * + * @lib bsinstall.exe + * @since S60 v3.2 + */ +class BSBrandRemover + { +public: + + /** + * Removes brand from branding server + * @aBrandId brand id of removed brand + * @aApplicationId application id of removed brand + */ + static void RemoveBrandL( const TDesC& aBrandId, + const TDesC& aApplicationId ); + + }; + +#endif //CBSBRANDREMOVER_H diff -r 000000000000 -r e6b17d312c8b brandingserver/tools/bsimport/src/cbsimportfilereader.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/brandingserver/tools/bsimport/src/cbsimportfilereader.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,145 @@ +/* +* Copyright (c) 2006-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Import reader opens and reads the XML file to CMDXMLDocument +* object +* +*/ + + +#include +#include + +#include "cbsimportfilereader.h" +#include "importlogwriter.h" + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// CBSImportManager::NewL +// --------------------------------------------------------------------------- +// +CBSImportFileReader* CBSImportFileReader::NewL( TBool aUseScheduler ) + { + CBSImportFileReader* self = NewLC( aUseScheduler ); + CleanupStack::Pop(); + return self; + } + +// --------------------------------------------------------------------------- +// CBSImportManager::NewLC +// --------------------------------------------------------------------------- +// +CBSImportFileReader* CBSImportFileReader::NewLC( TBool aUseScheduler ) + { + CBSImportFileReader* self = new (ELeave) CBSImportFileReader( aUseScheduler ); + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + +// --------------------------------------------------------------------------- +// CBSImportManager::ConstructL +// --------------------------------------------------------------------------- +// +void CBSImportFileReader::ConstructL() + { + if( iUseScheduler ) + { + // Install active scheduler + iScheduler = new (ELeave) CActiveScheduler(); + CActiveScheduler::Install( iScheduler ); + } + else + { + iWaiter = new (ELeave) CActiveSchedulerWait(); + } + + // Create XML parser + iParser = CMDXMLParser::NewL( this ); + } + +// --------------------------------------------------------------------------- +// CBSImportManager::~CBSImportFileReader +// --------------------------------------------------------------------------- +// +CBSImportFileReader::~CBSImportFileReader() + { + delete iParser; + delete iDocument; + delete iWaiter; + delete iScheduler; + if( iUseScheduler ) + { + CActiveScheduler::Install( NULL ); + } + } + +// --------------------------------------------------------------------------- +// CBSImportManager::CBSImportFileReader +// --------------------------------------------------------------------------- +// +CBSImportFileReader::CBSImportFileReader( TBool aUseScheduler ) : + iUseScheduler( aUseScheduler ) + { + } + +// --------------------------------------------------------------------------- +// CBSImportManager::ReadXMLFileL +// --------------------------------------------------------------------------- +// +CMDXMLDocument* CBSImportFileReader::ReadXMLFileL( RFs& aFs, const TDesC& aFileName ) + { + RFile file; + TInt err = file.Open( aFs, aFileName, EFileRead ); + if( err ) + { + IMPORT_DP( D_IMPORT_LIT( "ERROR: Unable to open XML file (%S)!" ), &aFileName ); + User::Leave( err ); + } + + // takes ownership of file + err = iParser->ParseFile( file ); + if( err ) + { + IMPORT_DP( D_IMPORT_LIT( "ERROR: Unable to read XML file (%S)!" ), &aFileName ); + User::Leave( err ); + } + + // Start waiting, so that parser can start working + // Code scanner warning active object called without checking whether it is active + // or cancelling it first (id:10 ) + // The active object cannot be active at this point. + // Code scanner warning using CActiveScheduler::Start (Id:3) + // It is required to use here + iUseScheduler ? CActiveScheduler::Start() : iWaiter->Start(); // CSI: 10,3 # See above + + CMDXMLDocument* tmp = iDocument; + iDocument = NULL; + return tmp; + } + +// --------------------------------------------------------------------------- +// From class MMDXMLParserObserver. +// CBSImportManager::ParseFileCompleteL +// --------------------------------------------------------------------------- +// +void CBSImportFileReader::ParseFileCompleteL() + { + iDocument = iParser->DetachXMLDoc(); + // Codescanner warning using CActiveScheduler::Start (Id:4) + // It is required to use here + iUseScheduler ? CActiveScheduler::Stop() : iWaiter->AsyncStop(); // CSI: 4 # See above + } + +// End of file diff -r 000000000000 -r e6b17d312c8b brandingserver/tools/bsimport/src/cbsimportmanager.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/brandingserver/tools/bsimport/src/cbsimportmanager.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,153 @@ +/* +* Copyright (c) 2006-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Import manager handles the reading, parsing and writing of +* Brand data. +* +*/ + + +#include +#include +#include +#include + +#include "cbsimportmanager.h" +#include "cbsimportxmlparser.h" +#include "cbsimportfilereader.h" +#include "cbsimportstoragemanager.h" +#include "cbsimportconstants.h" +#include "importlogwriter.h" + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// CBSImportManager::NewL +// --------------------------------------------------------------------------- +// +CBSImportManager* CBSImportManager::NewL() + { + CBSImportManager* self = NewLC(); + CleanupStack::Pop(); + return self; + } + +// --------------------------------------------------------------------------- +// CBSImportManager::NewLC +// --------------------------------------------------------------------------- +// +CBSImportManager* CBSImportManager::NewLC() + { + CBSImportManager* self = new (ELeave) CBSImportManager(); + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + +// --------------------------------------------------------------------------- +// CBSImportManager::ConstructL +// --------------------------------------------------------------------------- +// +void CBSImportManager::ConstructL() + { + // Open filesystem handle + User::LeaveIfError( iFs.Connect() ); + } + +// --------------------------------------------------------------------------- +// CBSImportManager::~CBSImportManager +// --------------------------------------------------------------------------- +// +CBSImportManager::~CBSImportManager() + { + delete iDocument; + iFs.Close(); + } + +// --------------------------------------------------------------------------- +// CBSImportManager::CBSImportManager +// --------------------------------------------------------------------------- +// +CBSImportManager::CBSImportManager() + { + } + +// --------------------------------------------------------------------------- +// CBSImportManager::ImportFileL +// --------------------------------------------------------------------------- +// +void CBSImportManager::ImportFileL( const TDesC& aSrcFile ) + { + // Read XML File + IMPORT_DP( D_IMPORT_LIT("Reading XML file: %S"), &aSrcFile ); + + CBSImportFileReader* reader = CBSImportFileReader::NewLC( ETrue ); + iDocument = reader->ReadXMLFileL( iFs, aSrcFile ); + CleanupStack::PopAndDestroy(); + IMPORT_DP( D_IMPORT_LIT("Reading done") ); + + // Parse XML file + IMPORT_DP( D_IMPORT_LIT("Parsing XML content...") ); + CBSImportStorageManager* storage = CBSImportStorageManager::NewLC(); + + CBSImportXMLParser* parser = CBSImportXMLParser::NewLC( storage ); + parser->ParseDocumentL( *iDocument ); + CleanupStack::PopAndDestroy( parser ); + IMPORT_DP( D_IMPORT_LIT("Parsing done.") ); + + // Write output files + IMPORT_DP( D_IMPORT_LIT("Writing Branding files...") ); + storage->WriteDataToServerL(); + IMPORT_DP( D_IMPORT_LIT("Writing done.") ); + + // Cleanup + CleanupStack::PopAndDestroy( storage ); + } + +// --------------------------------------------------------------------------- +// CBSImportManager::ImportFileL +// --------------------------------------------------------------------------- +// +void CBSImportManager::ImportFileL( const MDesCArray& aSrcFiles ) + { + // Read XML Files + CBSImportStorageManager* storage = CBSImportStorageManager::NewLC(); + CBSImportXMLParser* parser = CBSImportXMLParser::NewLC( storage ); + CBSImportFileReader* reader = CBSImportFileReader::NewLC( ETrue ); + + TInt count = aSrcFiles.MdcaCount(); + for( TInt i = 0; i < count; i++ ) + { + TPtrC file( aSrcFiles.MdcaPoint( i ) ); + IMPORT_DP( D_IMPORT_LIT("Reading XML file: %S"), &file ); + iDocument = reader->ReadXMLFileL( iFs, file ); + IMPORT_DP( D_IMPORT_LIT("Reading done") ); + + // Parse XML file + IMPORT_DP( D_IMPORT_LIT("Parsing XML content...") ); + parser->ParseDocumentL( *iDocument ); + IMPORT_DP( D_IMPORT_LIT("Parsing done.") ); + } + + CleanupStack::PopAndDestroy( 2, parser ); // reader, parser + + // Write output files + IMPORT_DP( D_IMPORT_LIT("Writing branding data to server...") ); + storage->WriteDataToServerL(); + IMPORT_DP( D_IMPORT_LIT("Writing done.") ); + + // Cleanup + CleanupStack::PopAndDestroy( storage ); + } + +// End of file diff -r 000000000000 -r e6b17d312c8b brandingserver/tools/bsimport/src/cbsimportstorage.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/brandingserver/tools/bsimport/src/cbsimportstorage.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,297 @@ +/* +* Copyright (c) 2006-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Stores element data and writes it to stream +* +*/ + + +#include +#include +#include +#include +#include + +#include "cbsimportstorage.h" +#include "cbsimportconstants.h" +#include "importlogwriter.h" + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// CBSImportStorage::NewL +// --------------------------------------------------------------------------- +// +CBSImportStorage* CBSImportStorage::NewL() + { + CBSImportStorage* self = NewLC(); + CleanupStack::Pop(); + return self; + } + +// --------------------------------------------------------------------------- +// CBSImportStorage::NewLC +// --------------------------------------------------------------------------- +// +CBSImportStorage* CBSImportStorage::NewLC() + { + CBSImportStorage* self = new (ELeave) CBSImportStorage(); + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + +// --------------------------------------------------------------------------- +// CBSImportStorage::ConstructL +// --------------------------------------------------------------------------- +// +void CBSImportStorage::ConstructL() + { + } + +// --------------------------------------------------------------------------- +// CBSImportStorage::CBSImportStorage +// --------------------------------------------------------------------------- +// +CBSImportStorage::CBSImportStorage() + { + } + +// --------------------------------------------------------------------------- +// CBSImportStorage::~CBSImportStorage +// --------------------------------------------------------------------------- +// +CBSImportStorage::~CBSImportStorage() + { + iElements.ResetAndDestroy(); + delete iAppId; + delete iStorageId; + delete iFilename; + } + +// --------------------------------------------------------------------------- +// CBSImportStorage::AppendElement +// --------------------------------------------------------------------------- +// +TInt CBSImportStorage::AppendElement( MBSElement* aElement ) + { + if( aElement ) + { + return iElements.Append( aElement ); + } + // Ignore empty + return KErrNone; + } + +// --------------------------------------------------------------------------- +// CBSImportStorage::ElementCount +// --------------------------------------------------------------------------- +// +TInt CBSImportStorage::ElementCount() + { + return iElements.Count(); + } + +// --------------------------------------------------------------------------- +// CBSImportStorage::Element +// --------------------------------------------------------------------------- +// +MBSElement* CBSImportStorage::Element( TInt aIndex ) + { + return iElements[ aIndex ]; + } + +// --------------------------------------------------------------------------- +// CBSImportStorage::FlushtoServerL +// --------------------------------------------------------------------------- +// +void CBSImportStorage::FlushToServerL() + { + if( !VerifyHeader() || !VerifyDataL( iElements.Array() ) ) + { + // Header not complete. Will not flush + User::Leave( KErrCorrupt ); + } + + // Create access to server + CBSFactory* factory = CBSFactory::NewL( *iStorageId, *iAppId ); + CleanupStack::PushL( factory ); + MBSUpdater* updater = factory->CreateUpdaterLC(); + //updater->StartTransactionL( *iStorageId, iLanguage, iVersion ); + updater->StartTransactionL( *iStorageId, iLanguage ); + + // Flush data + TInt count = iElements.Count(); + for( TInt i = 0; i < count; i++ ) + { + TRAPD( err, updater->InsertElementL( iElements[i] ) ); + if( err == KErrAlreadyExists ) + { + err = KErrNone; + TRAP( err, updater->ReplaceElementL( iElements[i] ) ); + } + User::LeaveIfError( err ); + } + + // Cleanup + updater->StopTransactionL(); + CleanupStack::PopAndDestroy( 2 ); // factory, updater + } + +// --------------------------------------------------------------------------- +// CBSImportStorage::SetVersion +// --------------------------------------------------------------------------- +// +void CBSImportStorage::SetVersion( TInt aVersion ) + { + iVersion = aVersion; + } + +// --------------------------------------------------------------------------- +// CBSImportStorage::SetApplicationIdL +// --------------------------------------------------------------------------- +// +void CBSImportStorage::SetApplicationIdL( const TDesC& aAppId ) + { + HBufC8* id = HBufC8::NewLC( aAppId.Length() ); + TPtr8 idPtr( id->Des() ); + CnvUtfConverter::ConvertFromUnicodeToUtf8( idPtr, aAppId ); + CleanupStack::Pop( id ); + delete iAppId; + iAppId = id; + } + +// --------------------------------------------------------------------------- +// CBSImportStorage::SetStorageIdL +// --------------------------------------------------------------------------- +// +void CBSImportStorage::SetStorageIdL( const TDesC& aStorageId ) + { + HBufC8* id = HBufC8::NewLC( aStorageId.Length() ); + TPtr8 idPtr( id->Des() ); + CnvUtfConverter::ConvertFromUnicodeToUtf8( idPtr, aStorageId ); + CleanupStack::Pop( id ); + delete iStorageId; + iStorageId = id; + } + +// --------------------------------------------------------------------------- +// CBSImportStorage::SetLanguageL +// --------------------------------------------------------------------------- +// +void CBSImportStorage::SetLanguageL( TLanguage aLanguage ) + { + iLanguage = aLanguage; + } + +// --------------------------------------------------------------------------- +// CBSImportStorage::VerifyHeader +// --------------------------------------------------------------------------- +// +TBool CBSImportStorage::VerifyHeader() + { + // not checking version as it is been consider not to use. - Pankaj - 31 may 07 + //return ( iAppId && iStorageId && iVersion > 0 && iLanguage >= ELangTest ); + return ( iAppId && iStorageId && iLanguage >= ELangTest ); + + } + + +// --------------------------------------------------------------------------- +// CBSImportStorage::VerifyDataL +// --------------------------------------------------------------------------- +// +TBool CBSImportStorage::VerifyDataL( TArray aArray, + TBool aIgnoreEmptyID /* = EFalse */ ) + { + // Check that elements have unique ID's in their own namespace + TInt count = aArray.Count(); + for( TInt i = 0; i < count; i++ ) + { + // Verify inside list elements + if( aArray[i]->ElementType() == EBSList ) + { + if( !VerifyDataL( aArray[i]->GetStructureL(), ETrue ) ) + { + return false; + } + } + + if( aIgnoreEmptyID && + aArray[i]->ElementId().CompareC( KNullDesC8() ) == 0 ) + { + // ignore empty id + continue; + } + + // Check that sibling elements have unique ID + for( TInt j = i + 1; j < count; j++ ) + { + if( aArray[i]->ElementId().CompareC( aArray[j]->ElementId() ) == 0 ) + { + // convert elementID to 16-bit for event logger + TPtrC8 id( aArray[i]->ElementId() ); + HBufC* conv = HBufC::NewLC( id.Length() ); + TPtr uniptr( conv->Des() ); + CnvUtfConverter::ConvertToUnicodeFromUtf8( uniptr, id ); + IMPORT_DP( D_IMPORT_LIT("ERROR: Found duplicate element ID (%S)!"), &uniptr ); + CleanupStack::PopAndDestroy(); + return false; + } + } + } + + // All elements ok + return true; + } + +// --------------------------------------------------------------------------- +// CBSImportStorage::Compare +// --------------------------------------------------------------------------- +// +TInt CBSImportStorage::Compare( const CBSImportStorage* aStorage ) const + { + if( iVersion != aStorage->iVersion || iLanguage != aStorage->iLanguage ) + { + // no match + return EFalse; + } + if( iAppId->Compare( aStorage->iAppId->Des() ) != 0 ) + { + // no match + return EFalse; + } + if( iStorageId->Compare( aStorage->iStorageId->Des() ) != 0 ) + { + // no match + return EFalse; + } + // they match + return ETrue; + } + +// --------------------------------------------------------------------------- +// CBSImportStorage::TakeElementsL +// --------------------------------------------------------------------------- +// +void CBSImportStorage::TakeElements( CBSImportStorage* aStorage ) + { + TInt count = aStorage->iElements.Count(); + for( TInt i = 0; i < count; i++ ) + { + iElements.Append( aStorage->iElements[i] ); + } + aStorage->iElements.Reset(); + } + +// End of file diff -r 000000000000 -r e6b17d312c8b brandingserver/tools/bsimport/src/cbsimportstoragemanager.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/brandingserver/tools/bsimport/src/cbsimportstoragemanager.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,159 @@ +/* +* Copyright (c) 2006-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Stores element data and writes it to stream +* +*/ + + +#include +#include +#include +#include +#include +#include + +#include "cbsimportstoragemanager.h" +#include "cbsimportstorage.h" +#include "importlogwriter.h" + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// CBSImportStorageManager::NewL +// --------------------------------------------------------------------------- +// +CBSImportStorageManager* CBSImportStorageManager::NewL() + { + CBSImportStorageManager* self = NewLC(); + CleanupStack::Pop(); + return self; + } + +// --------------------------------------------------------------------------- +// CBSImportStorageManager::NewLC +// --------------------------------------------------------------------------- +// +CBSImportStorageManager* CBSImportStorageManager::NewLC() + { + CBSImportStorageManager* self = + new (ELeave) CBSImportStorageManager(); + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + +// --------------------------------------------------------------------------- +// CBSImportStorageManager::ConstructL +// --------------------------------------------------------------------------- +// +void CBSImportStorageManager::ConstructL() + { + } + +// --------------------------------------------------------------------------- +// CBSImportStorageManager::CBSImportStorageManager +// --------------------------------------------------------------------------- +// +CBSImportStorageManager::CBSImportStorageManager() : + iCurrent( KErrNotFound ) + { + } + +// --------------------------------------------------------------------------- +// CBSImportStorageManager::~CBSImportStorageManager +// --------------------------------------------------------------------------- +// +CBSImportStorageManager::~CBSImportStorageManager() + { + iStorages.ResetAndDestroy(); + } + +// --------------------------------------------------------------------------- +// CBSImportStorageManager::CreateStorageL +// --------------------------------------------------------------------------- +// +void CBSImportStorageManager::CreateStorageL() + { + CBSImportStorage* tmp = CBSImportStorage::NewL(); + iStorages.Append( tmp ); + iCurrent = iStorages.Find( tmp ); + } + +// --------------------------------------------------------------------------- +// CBSImportStorageManager::StorageCount +// --------------------------------------------------------------------------- +// +TInt CBSImportStorageManager::StorageCount() + { + return iStorages.Count(); + } + +// --------------------------------------------------------------------------- +// CBSImportStorageManager::Storage +// --------------------------------------------------------------------------- +// +CBSImportStorage* CBSImportStorageManager::Storage( TInt aIndex ) + { + return iStorages[ aIndex ]; + } + +// --------------------------------------------------------------------------- +// CBSImportStorageManager::Storage +// --------------------------------------------------------------------------- +// +CBSImportStorage* CBSImportStorageManager::Storage() + { + return iStorages[ iCurrent ]; + } + +// --------------------------------------------------------------------------- +// CBSImportStorageManager::WriteDataToServerL +// --------------------------------------------------------------------------- +// +void CBSImportStorageManager::WriteDataToServerL() + { + // Merge storages + MergeStorages(); + + // Flush each storage + TInt count = iStorages.Count(); + for( TInt i = 0; i < count; i++ ) + { + iStorages[i]->FlushToServerL(); + } + } + +// --------------------------------------------------------------------------- +// CBSImportStorageManager::MergeStoragesL +// --------------------------------------------------------------------------- +// +void CBSImportStorageManager::MergeStorages() + { + for( TInt i = 0; i < iStorages.Count(); i++ ) + { + for( TInt j = i + 1; j < iStorages.Count(); j++ ) + { + if( iStorages[i]->Compare( iStorages[j] ) ) + { + // they have same header data -> merge them + iStorages[i]->TakeElements( iStorages[j] ); + delete iStorages[j]; + iStorages.Remove( j ); + j--; // correct index + } + } + } + } + +// End of file diff -r 000000000000 -r e6b17d312c8b brandingserver/tools/bsimport/src/cbsimportxmlparser.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/brandingserver/tools/bsimport/src/cbsimportxmlparser.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,779 @@ +/* +* Copyright (c) 2006-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Parses XML content and stores data to storage +* +*/ + + +#include +#include +#include +#include +#include +#include +#include + +#include "cbsimportxmlparser.h" +#include "cbsimportstoragemanager.h" +#include "cbsimportstorage.h" +#include "cbsimportconstants.h" +#include "importlogwriter.h" + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// CBSImportXMLParser::NewL +// --------------------------------------------------------------------------- +// +CBSImportXMLParser* CBSImportXMLParser::NewL( CBSImportStorageManager* aStorage ) + { + CBSImportXMLParser* self = NewLC( aStorage ); + CleanupStack::Pop(); + return self; + } + +// --------------------------------------------------------------------------- +// CBSImportXMLParser::NewLC +// --------------------------------------------------------------------------- +// +CBSImportXMLParser* CBSImportXMLParser::NewLC( CBSImportStorageManager* aStorage ) + { + CBSImportXMLParser* self = new (ELeave) CBSImportXMLParser( aStorage ); + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + +// --------------------------------------------------------------------------- +// CBSImportXMLParser::ConstructL +// --------------------------------------------------------------------------- +// +void CBSImportXMLParser::ConstructL() + { + } + +// --------------------------------------------------------------------------- +// CBSImportXMLParser::~CBSImportXMLParser +// --------------------------------------------------------------------------- +// +CBSImportXMLParser::~CBSImportXMLParser() + { + } + +// --------------------------------------------------------------------------- +// CBSImportXMLParser::CBSImportXMLParser +// --------------------------------------------------------------------------- +// +CBSImportXMLParser::CBSImportXMLParser( CBSImportStorageManager* aStorage ) : + iStorage( aStorage ) + { + } + +// --------------------------------------------------------------------------- +// CBSImportXMLParser::ParseDocumentL +// --------------------------------------------------------------------------- +// +void CBSImportXMLParser::ParseDocumentL( CMDXMLDocument& aDocument ) + { + if( !iStorage ) + { + // No storage --> can't continue + User::Leave( KErrNotReady ); + } + + CMDXMLElement* element = aDocument.DocumentElement(); + ParseDocumentBaseL( element ); + } + +// --------------------------------------------------------------------------- +// CBSImportXMLParser::ParseDocumentBaseL +// --------------------------------------------------------------------------- +// +void CBSImportXMLParser::ParseDocumentBaseL( CMDXMLNode* aElement ) + { + if( aElement->HasChildNodes() ) + { + // Verify that element is the first one + CMDXMLNode* brandingNode = aElement->FirstChild(); + if( !brandingNode->HasChildNodes() ) + { + IMPORT_DP_TXT("ERROR: empty tag found" ); + User::Leave( KErrCorrupt ); + } + + // Parse through all elements + CMDXMLNode* brandNode = brandingNode->FirstChild(); + while( brandNode ) + { + if( 0 == brandNode->NodeName().CompareC( KBrandTag ) ) + { + if( !brandNode->HasChildNodes() ) + { + IMPORT_DP_TXT("ERROR: empty tag found" ); + User::Leave( KErrCorrupt ); + } + + // Create a new storage for each element + iStorage->CreateStorageL(); + + // Scan through all elements inside tags + // and store them to storage + CMDXMLNode* kidNode = brandNode->FirstChild(); + while( kidNode ) + { + TRAPD( err, AnalyzeNodeL( kidNode ) ); + if( err ) + { + IMPORT_DP( D_IMPORT_LIT("ERROR: Error parsing content of (%d)"), err ); + User::Leave( err ); + } + kidNode = kidNode->NextSibling(); + } + } + + // move to next brand package + brandNode = brandNode->NextSibling(); + } + } + else + { + // no elements in file --> corrupt + IMPORT_DP_TXT("ERROR: Empty XML content" ); + User::Leave( KErrCorrupt ); + } + } + +// --------------------------------------------------------------------------- +// CBSImportXMLParser::AnalyzeNodeL +// --------------------------------------------------------------------------- +// +void CBSImportXMLParser::AnalyzeNodeL( CMDXMLNode* aNode ) + { + switch( SolveTagTypeL( aNode ) ) + { + case EBrandID: + { + if( aNode->HasChildNodes() ) + { + HBufC* id = NodeTextLC( aNode ); + iStorage->Storage()->SetStorageIdL( *id ); + CleanupStack::PopAndDestroy(); + } + else + { + IMPORT_DP_TXT("WARNING: BrandID has no value" ); + User::Leave( KErrNotFound ); + } + break; + } + case EBrandAppID: + { + if( aNode->HasChildNodes() ) + { + HBufC* id = NodeTextLC( aNode ); + iStorage->Storage()->SetApplicationIdL( *id ); + CleanupStack::PopAndDestroy(); + } + else + { + IMPORT_DP_TXT("WARNING: ApplicationID has no value" ); + User::Leave( KErrNotFound ); + } + break; + } + case EBrandLanguage: + { + if( aNode->HasChildNodes() ) + { + TInt lang = ELangTest; + TRAPD( err, lang = NodeIntL( aNode ) ); + if( err ) + { + // not a number. Check if language is "SC" + HBufC* langBuf = NodeTextLC( aNode ); + TPtr langText( langBuf->Des() ); + langText.UpperCase(); + if( 0 != langText.CompareC( KDefaultLanguage ) ) + { + IMPORT_DP_TXT("ERROR: Language field has invalid value (has to be a number or 'SC')" ); + User::Leave( KErrArgument ); + } + CleanupStack::PopAndDestroy( langBuf ); + } + iStorage->Storage()->SetLanguageL( (TLanguage)lang ); + } + else + { + IMPORT_DP_TXT("WARNING: Language field has no value" ); + User::Leave( KErrNotFound ); + } + break; + } + case EBrandVersion: + { + if( aNode->HasChildNodes() ) + { + iStorage->Storage()->SetVersion( NodeIntL( aNode ) ); + } + else + { + IMPORT_DP_TXT("WARNING: Version field has no value" ); + User::Leave( KErrNotFound ); + } + break; + } + case EBrandElement: + { + if( aNode->HasChildNodes() ) + { + iStorage->Storage()->AppendElement( ParseBrandElementL( aNode ) ); + } + else + { + IMPORT_DP_TXT("WARNING: Empty tag found" ); + User::Leave( KErrNotFound ); + } + break; + } + case EBrandUnknown: // flowthrough + default: + { + TPtrC ptr( aNode->NodeName() ); + IMPORT_DP( D_IMPORT_LIT("WARNING: Unknown XML tag encountered: <%S>"), &ptr ); + break; + } + } + } + +// --------------------------------------------------------------------------- +// CBSImportXMLParser::SolveTagTypeL +// --------------------------------------------------------------------------- +// +CBSImportXMLParser::TXMLBaseTagTypes CBSImportXMLParser::SolveTagTypeL( CMDXMLNode* aNode ) + { + TPtrC node( aNode->NodeName() ); + if( 0 == node.CompareF( KBrandElementTag ) ) + return EBrandElement; + + if( 0 == node.CompareF( KBrandIDTag ) ) + return EBrandID; + + if( 0 == node.CompareF( KBrandLanguageTag ) ) + return EBrandLanguage; + + if( 0 == node.CompareF( KBrandVersionTag ) ) + return EBrandVersion; + + if( 0 == node.CompareF( KBrandAppIdTag ) ) + return EBrandAppID; + + return EBrandUnknown; + } + +// --------------------------------------------------------------------------- +// CBSImportXMLParser::ParseBrandElementL +// --------------------------------------------------------------------------- +// +MBSElement* CBSImportXMLParser::ParseBrandElementL( CMDXMLNode* aNode ) + { + if( !aNode->HasChildNodes() || + 0 != aNode->NodeName().CompareC( KBrandElementTag )) + { + // invalid element block + User::Leave( KErrCorrupt ); + } + + // Check tag attributes + CMDXMLElement* elNode = (CMDXMLElement*)(aNode); + TInt elType( KErrNotFound ); + HBufC8* elID = NULL; + TInt attrNum = elNode->NumAttributes(); + for( TInt i = 0; i < attrNum; i++ ) + { + TPtrC name; + TPtrC value; + elNode->AttributeDetails( i, name, value ); + + // + if( 0 == name.CompareC( KElementTypeName ) ) + { + elType = SolveElementType( value ); + } + // + else if( 0 == name.CompareC( KElementTypeID ) && !elID ) + { + elID = HBufC8::NewL( value.Length() ); + CleanupStack::PushL( elID ); + TPtr8 ptrID( elID->Des() ); + CnvUtfConverter::ConvertFromUnicodeToUtf8( ptrID, value ); + } + } + + // Verify type + if( elType == KErrNotFound ) + { + // Element type missing! + IMPORT_DP_TXT("ERROR: Element's 'type' attribute is missing!" ); + User::Leave( KErrCorrupt ); + } + + // Create empty ID if element didn't have one + if( !elID ) + { + elID = KNullDesC8().AllocL(); + CleanupStack::PushL( elID ); + } + + // Parse element according to type + MBSElement* elem = NULL; + switch( elType ) + { + case EBSInt: + { + TInt intValue; + TRAPD( err, DoParseIntegerL( elNode, intValue ) ) + if( !err ) + { + TPtr8 ptr( elID->Des() ); + // Codescanner warning: neglected to put variable on cleanup stack (id:35) + // This method cannot leave after this line + elem = BSElementFactory::CreateBSElementL( ptr, EBSInt, intValue ); // CSI: 35 # See above + } + else + { + IMPORT_DP_TXT("ERROR: Invalid value in integer element!" ); + User::Leave( err ); + } + break; + } + case EBSFile: + { + HBufC* text = NULL; + TRAPD( err, DoParseFileL( elNode, text ) ) + if( !err ) + { + TPtr8 ptr( elID->Des() ); + CleanupStack::PushL( text ); + elem = BSElementFactory::CreateBSElementL( ptr, EBSFile, *text ); + CleanupStack::PopAndDestroy( text ); + } + else + { + IMPORT_DP_TXT("ERROR: Invalid value in file element!" ); + User::Leave( err ); + } + + break; + } + case EBSBuffer: + case EBSText: + { + HBufC* text = NULL; + TRAPD( err, DoParseTextL( elNode, text ) ) + if( !err ) + { + TPtr8 ptr( elID->Des() ); + CleanupStack::PushL( text ); + + if( EBSText == elType ) // 16-bit descriptor + { + // Element takes ownership of text + elem = BSElementFactory::CreateBSElementL( ptr, EBSText, *text ); + } + else // EBuffer: 8-bit descriptor + { + // convert to 8-bit + HBufC8* conv = HBufC8::NewLC( text->Length() ); + TPtr8 ptrconv( conv->Des() ); + CnvUtfConverter::ConvertFromUnicodeToUtf8( ptrconv, *text ); + elem = BSElementFactory::CreateBSElementL( ptr, EBSBuffer, *conv ); + CleanupStack::PopAndDestroy( conv ); + } + CleanupStack::PopAndDestroy( text ); + } + else + { + // Error parsing text element + IMPORT_DP_TXT("ERROR: Invalid value in text element!" ); + User::Leave( err ); + } + break; + } + case EBSList: + { + RBSObjOwningPtrArray elementArray; + CleanupClosePushL( elementArray ); + TRAPD( err, DoParseListL( aNode, elementArray ) ); + if( !err ) + { + // Create list element + TPtr8 ptr( elID->Des() ); + // Codescanner warning: neglected to put variable on cleanup stack (id:35) + // This method cannot leave after this line + elem = BSElementFactory::CreateBSElementL( ptr, EBSList, elementArray ); // CSI: 35 # See above + CleanupStack::Pop(); // elementArray + } + else + { + IMPORT_DP_TXT("ERROR: List element parse failed!" ); + User::Leave( err ); + } + break; + } + case EBSBitmap: + { + CBSBitmap* bitmap = NULL; + TRAPD( err, DoParseBitmapL( elNode, bitmap ) ) + if( !err ) + { + CleanupStack::PushL( bitmap ); + // Create list element + TPtr8 ptr( elID->Des() ); + elem = BSElementFactory::CreateBSElementL( ptr, EBSBitmap, bitmap ); + CleanupStack::Pop( bitmap ); + } + break; + } + default: + { + // Invalid element type + break; + } + } + + // return parsed element + CleanupStack::PopAndDestroy( elID ); + return elem; + } + +// --------------------------------------------------------------------------- +// CBSImportXMLParser::SolveElementType +// --------------------------------------------------------------------------- +// +TInt CBSImportXMLParser::SolveElementType( const TDesC& aType ) + { + if( 0 == aType.CompareC( KElementTypeList ) ) + return EBSList; + + if( 0 == aType.CompareC( KElementTypeBitmap ) ) + return EBSBitmap; + + if( 0 == aType.CompareC( KElementTypeBuffer ) ) + return EBSBuffer; + + if( 0 == aType.CompareC( KElementTypeInt ) ) + return EBSInt; + + if( 0 == aType.CompareC( KElementTypeText ) ) + return EBSText; + + if( 0 == aType.CompareC( KElementTypeFile ) ) + return EBSFile; + + return KErrNotFound; + } + +// --------------------------------------------------------------------------- +// CBSImportXMLParser::DoParseIntegerL +// --------------------------------------------------------------------------- +// +void CBSImportXMLParser::DoParseIntegerL( CMDXMLNode* aNode, TInt& aValue ) + { + // Integer element has only one child element. e.g: + // + // 12345 + // + // + CMDXMLNode* kidNode = aNode->FirstChild(); + while( kidNode ) + { + if( 0 == KElementValueTag().CompareC( kidNode->NodeName() ) ) + { + aValue = NodeIntL( kidNode ); + return; + } + kidNode = kidNode->NextSibling(); + } + User::Leave( KErrNotFound ); + } + +// --------------------------------------------------------------------------- +// CBSImportXMLParser::DoParseTextL +// --------------------------------------------------------------------------- +// +void CBSImportXMLParser::DoParseTextL( CMDXMLNode* aNode, HBufC*& aText ) + { + // Text element has only one valuable child element. e.g: + // + // some important text + // + // + CMDXMLNode* kidNode = SearchChild( aNode, KElementValueTag ); + if( kidNode ) + { + aText = NodeTextLC( kidNode ); + CleanupStack::Pop( aText ); + return; + } + + // didn't find a valid value + IMPORT_DP_TXT( "ERROR: Text element is missing it's value" ); + User::Leave( KErrNotFound ); + } + +// --------------------------------------------------------------------------- +// CBSImportXMLParser::DoParseFileL +// --------------------------------------------------------------------------- +// +void CBSImportXMLParser::DoParseFileL( CMDXMLNode* aNode, HBufC*& aText ) + { + // File element has only one valuable text value element. e.g: + // + // c:\data\file.txt + // + // + CMDXMLNode* kidNode = SearchChild( aNode, KElementValueTag ); + if( kidNode ) + { + // check tag + CMDXMLNode* subKidNode = SearchChild( kidNode, KFileFileNameTag ); + if( subKidNode ) + { + // Get filename from tag + aText = NodeTextLC( subKidNode ); + CleanupStack::Pop( aText ); + return; + } + } + + // didn't find a valid value + IMPORT_DP_TXT( "ERROR: File element is missing it's value" ); + User::Leave( KErrNotFound ); + } + +// --------------------------------------------------------------------------- +// CBSImportXMLParser::DoParseListL +// --------------------------------------------------------------------------- +// +void CBSImportXMLParser::DoParseListL( + CMDXMLNode* aNode, + RBSObjOwningPtrArray& aElementArray ) + { + // Scan trough elements inside this list element + // + // + // ... + // + // + // ... + // + // + // + CMDXMLNode* kidNode = SearchChild( aNode, KElementValueTag ); + if( kidNode ) + { + CMDXMLNode* subKidNode = kidNode->FirstChild(); + while( subKidNode ) + { + // verify that this really is node. + if( 0 == subKidNode->NodeName().CompareC( KBrandElementTag ) ) + { + MBSElement* el = ParseBrandElementL( subKidNode ); + if( el ) + { + aElementArray.Append( el ); + } + } + subKidNode = subKidNode->NextSibling(); + } + } + else + { + // No elements found inside list! + IMPORT_DP_TXT( "ERROR: List element is missing it's value" ); + User::Leave( KErrNotFound ); + } + } + +// --------------------------------------------------------------------------- +// CBSImportXMLParser::DoParseBitmapL +// --------------------------------------------------------------------------- +// +void CBSImportXMLParser::DoParseBitmapL( + CMDXMLNode* aNode, + CBSBitmap*& aBitmap ) + { +/// XSP MOD: added support for + // Bitmap element has 5 child elements. e.g: + // + // + // 65 + // 66 + // 190 + // 191 + // + // + TInt bmpId = KErrNotFound; + TInt bmpMaskId = KErrNotFound; + TInt skinId = KErrNotFound; + TInt skinMaskId = KErrNotFound; + HBufC8* fileId = NULL; + + CMDXMLNode* kidNode = SearchChild( aNode, KElementValueTag ); + if( kidNode ) + { + CMDXMLNode* subKidNode = kidNode->FirstChild(); + TInt readCheck = 0; + while( subKidNode ) + { + TPtrC ptr = subKidNode->NodeName(); + if( 0 == KBitmapIdTag().CompareC( subKidNode->NodeName() ) ) + { + bmpId = NodeIntL( subKidNode ); + readCheck |= 0x1; + } + else if( 0 == KBitmapMaskIdTag().CompareC( subKidNode->NodeName() ) ) + { + bmpMaskId = NodeIntL( subKidNode ); + readCheck |= 0x2; + } + else if( 0 == KBitmapSkinIdTag().CompareC( subKidNode->NodeName() ) ) + { + skinId = NodeIntL( subKidNode ); + readCheck |= 0x4; + } + else if( 0 == KBitmapSkinMaskIdTag().CompareC( subKidNode->NodeName() ) ) + { + skinMaskId = NodeIntL( subKidNode ); + readCheck |= 0x8; + } +/// XSP MOD: added support for madatory KBitmapFileIdTag field + else if( 0 == KBitmapFileIdTag().CompareC( subKidNode->NodeName() ) ) + { + // Ignore following file id elements if + // bitmap element has more than one of them. + if ( !fileId ) + { + HBufC* tmp = NodeTextLC( subKidNode ); + fileId = CnvUtfConverter::ConvertFromUnicodeToUtf8L( *tmp ); + CleanupStack::PopAndDestroy( tmp ); + tmp = NULL; + CleanupStack::PushL( fileId ); + readCheck |= 0x10; + } + } + + subKidNode = subKidNode->NextSibling(); + } + + if( readCheck != 0x1F )/// XSP MOD:check that all 5 values were found + { + // Some bitmap elements are missing! + IMPORT_DP_TXT( "ERROR: Bitmap element is missing some mandatory values" ); + User::Leave( KErrNotFound ); + } + + // create bitmap + TPtrC8 pFileId( KNullDesC8 ); + if ( fileId ) + { + pFileId.Set( *fileId ); + } + aBitmap = CBSBitmap::NewL( bmpId, bmpMaskId, skinId, skinMaskId, pFileId ); + if ( fileId ) + { + CleanupStack::PopAndDestroy( fileId ); + fileId = NULL; + } + } + else + { + IMPORT_DP_TXT( "ERROR: Bitmap element is missing it's value" ); + User::Leave( KErrNotFound ); + } + } + +// --------------------------------------------------------------------------- +// CBSImportXMLParser::NodeTextLC +// --------------------------------------------------------------------------- +// +HBufC* CBSImportXMLParser::NodeTextLC( CMDXMLNode* aNode ) + { + CMDXMLNode* kidNode = aNode->FirstChild(); + if( !kidNode ) + { + // empty content + return KNullDesC().AllocLC(); + } + + if( kidNode->HasChildNodes() ) + { + // not a valid text element! + User::Leave( KErrCorrupt ); + } + + HBufC* text = static_cast(kidNode)->Data().AllocL(); + CleanupStack::PushL( text ); + + // Remove extra characters from text + TPtr ptr( text->Des() ); + AknTextUtils::StripCharacters( ptr, KCommonControlCharacters ); + ptr.TrimAll(); + + return text; + } + +// --------------------------------------------------------------------------- +// CBSImportXMLParser::NodeIntL +// --------------------------------------------------------------------------- +// +TInt CBSImportXMLParser::NodeIntL( CMDXMLNode* aNode ) + { + CMDXMLNode* kidNode = aNode->FirstChild(); + if( !kidNode || kidNode->HasChildNodes() ) + { + // not a valid text element! + User::Leave( KErrCorrupt ); + } + + TLex lex( static_cast(kidNode)->Data() ); + TInt value; + User::LeaveIfError( lex.Val( value ) ); + return value; + } + +// --------------------------------------------------------------------------- +// CBSImportXMLParser::FindTag +// --------------------------------------------------------------------------- +// +CMDXMLNode* CBSImportXMLParser::SearchChild( CMDXMLNode* aNode, const TDesC& aChildName ) + { + if( aNode->HasChildNodes() ) + { + CMDXMLNode* kidNode = aNode->FirstChild(); + while( kidNode ) + { + if( 0 == aChildName.CompareC( kidNode->NodeName() ) ) + { + // found it + return kidNode; + } + kidNode = kidNode->NextSibling(); + } + } + // not found + return NULL; + } + +// End of file diff -r 000000000000 -r e6b17d312c8b brandingserver/tools/bsimport/src/importer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/brandingserver/tools/bsimport/src/importer.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,234 @@ +/* +* Copyright (c) 2006-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Global methods for brandimporter +* +*/ + + +#include +#include +#include +#include + +#include "cbsimportmanager.h" +#include "importlogwriter.h" + +namespace +{ + +// CONSTANTS +// +_LIT( KProcessName, "BSImport" ); +_LIT( KTxtTitle, "BrandServer XML importer" ); +_LIT( KTxtFormatFailed, "\nimport failed: leave code = %d" ); +_LIT( KTxtOK, "\nok"); +_LIT( KTxtPressAnyKey, "\n [press any key]" ); +_LIT( KInstallFiles, "*.xml"); +_LIT( KDirSeparator, "\\" ); + +// SETTING SWITCHES (use uppercase) +// +_LIT( KInputDir, "-D" ); + +} + +// ======== GLOBAL FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// DeleteRPtrArray +// --------------------------------------------------------------------------- +// +LOCAL_C void DeleteRPtrArray( TAny* aArray ) + { + RPointerArray* array = static_cast< RPointerArray* >(aArray); + TInt count = array->Count(); + for( TInt i = 0; i < count; i++ ) + { + delete (*array)[i]; + } + array->Reset(); + } + +// --------------------------------------------------------------------------- +// ParseInstallableBrandsL +// --------------------------------------------------------------------------- +// +LOCAL_C void ParseInstallableBrandsL( RFs& aFs, + RPointerArray& aFiles, + const TDesC& aDirectory ) + { + // list import content + TParse file; + file.Set( KInstallFiles, &aDirectory, NULL ); + + CDir* dir = NULL; + User::LeaveIfError( + aFs.GetDir( file.FullName(), KEntryAttNormal, ESortNone, dir ) ); + CleanupStack::PushL( dir ); + + // create array of files (with full path) + TInt count = dir->Count(); + for( TInt i = 0; i < count; i++ ) + { + file.Set( (*dir)[i].iName, &aDirectory, NULL ); + aFiles.Append( file.FullName().AllocL() ); + } + + CleanupStack::PopAndDestroy( dir ); + } + +// --------------------------------------------------------------------------- +// ParseCommandLineArgumentsL +// --------------------------------------------------------------------------- +// +LOCAL_C void ParseCommandLineArgumentsL( RPointerArray& aFiles, + CConsoleBase* aConsole ) + { + // Get arguments + CCommandLineArguments *pCmd = CCommandLineArguments::NewL(); + CleanupStack::PushL( pCmd ); + + // check arguments + if( pCmd->Count() == 1 ) + { + aConsole->Printf( _L("Error: No files to import!\nGive import files as arguments") ); // CSI: 78 # See above + aConsole->Printf( KTxtPressAnyKey ); + aConsole->Getch(); + User::Leave( KErrArgument ); + } + + // open file session + // Codescanner warning: use of non-pointer/reference RFs + // this code cannot get file server handle from anywhere so it has to be created here + RFs fs; // CSI: 76 # See above + User::LeaveIfError( fs.Connect() ); + CleanupClosePushL( fs ); + + // Check all arguments for switches + // Skip first argument since it only contains the name of the executable + TInt i = 0; + while( ++i < pCmd->Count() ) + { + RBuf arg; + arg.CreateL( pCmd->Arg( i ) ); + arg.CleanupClosePushL(); + arg.UpperCase(); + + // Input directory: "-D [directory]" + if ( arg.CompareF( KInputDir ) == 0 ) + { + if( pCmd->Count() > i + 1 ) + { + // get all files from given directory + TPath path( pCmd->Arg( i + 1 ) ); + if( path.Right( 1 ).Compare( KDirSeparator ) != 0 ) + { + path.Append( KDirSeparator ); + } + ParseInstallableBrandsL( fs, aFiles, path ); + i++; // skip to next argument + } + else + { + // no content after -d switch + aConsole->Printf( _L("Argument missing after '-d' switch") ); // CSI: 78 # debug print + aConsole->Printf( KTxtPressAnyKey ); + aConsole->Getch(); + User::Leave( KErrArgument ); + } + } + else // argument is just plain file - add it. + { + aFiles.Append( pCmd->Arg( i ).AllocL() ); + } + + CleanupStack::PopAndDestroy(); // arg + } + + CleanupStack::PopAndDestroy( 2 ); // pCmd, fs + } + +// --------------------------------------------------------------------------- +// MainL +// --------------------------------------------------------------------------- +// +LOCAL_C void MainL( CConsoleBase* aConsole ) + { + // Read settings + RPointerArray files; + CleanupStack::PushL( TCleanupItem( DeleteRPtrArray, &files ) ); + ParseCommandLineArgumentsL( files, aConsole ); + + // convert PointerArray to MDesCArray + TInt count = files.Count(); + CDesCArrayFlat* importArray = new (ELeave) CDesCArrayFlat( count ); + CleanupStack::PushL( importArray ); + for( TInt i = 0; i < count; i++ ) + { + importArray->AppendL( files[i]->Des() ); + } + + // Do import + CBSImportManager* importer = CBSImportManager::NewLC(); + importer->ImportFileL( *importArray ); + CleanupStack::PopAndDestroy( 3 ); //importer, importarray, files + } + +// --------------------------------------------------------------------------- +// doMainL +// --------------------------------------------------------------------------- +// +LOCAL_C TInt doMainL() + { + CConsoleBase* console = Console::NewL( KTxtTitle, TSize( KConsFullScreen, KConsFullScreen ) ); + CleanupStack::PushL( console ); + TRAPD( error, MainL( console ) ); + if( error ) + { + IMPORT_DP( D_IMPORT_LIT( "ERROR importing brand: %d" ), error ); + console->Printf( KTxtFormatFailed, error ); + } + else + { + console->Printf( KTxtOK ); + } + + // Pause for development use. + // Disable this when releasing + //----------------------------------------------------- + console->Printf( KTxtPressAnyKey ); + //----------------------------------------------------- + + CleanupStack::PopAndDestroy(); // console + return error; + } + +// --------------------------------------------------------------------------- +// Main function of the application executable. +// --------------------------------------------------------------------------- +// +GLDEF_C TInt E32Main() + { + __UHEAP_MARK; + IMPORT_DP_TXT("----- NEW IMPORT SESSION ------( IMPORTER )---"); + CTrapCleanup* cleanup = CTrapCleanup::New(); + TInt returnCode( KErrNone ); + User::RenameThread( KProcessName ); + TRAPD( error, returnCode = doMainL() ); + IMPORT_DP_TXT("-----------------------------------------------"); + __ASSERT_ALWAYS( !error, User::Panic( KProcessName, error ) ); + delete cleanup; + __UHEAP_MARKEND; + return returnCode; + } diff -r 000000000000 -r e6b17d312c8b brandingserver/tools/bsimport/src/installer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/brandingserver/tools/bsimport/src/installer.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,259 @@ +/* +* Copyright (c) 2006-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Global methods for brandinstaller +* +*/ + + +#include +#include +#include +#include + +#include "cbsimportmanager.h" +#include "importlogwriter.h" +#include "bsbrandremover.h" + +namespace +{ + +// CONSTANTS +// +_LIT( KProcessName, "BSInstall" ); + +// Search these files for processing +_LIT( KInstallFiles, "*.xml" ); + +// Path to installed xml files inside own private folder. +_LIT( KInstallPath, "import\\" ); +_LIT( KInstallDrive, "C:" ); + +// separators for uninstalled brands +_LIT( KLineFeed, "\n" ); +_LIT( KBrandSeparator, "$" ); + +// Pub & sub keys for uninstall buffer +const TInt KBrandingServerUid = 0x102828DD; +const TUint KUninstallKey = 0x01; +} + +// ======== GLOBAL FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// DeleteRPtrArray +// --------------------------------------------------------------------------- +// +LOCAL_C void DeleteRPtrArray( TAny* aArray ) + { + RPointerArray* array = static_cast< RPointerArray* >(aArray); + TInt count = array->Count(); + for( TInt i = 0; i < count; i++ ) + { + delete (*array)[i]; + } + array->Reset(); + } + +// --------------------------------------------------------------------------- +// ParseInstallableBrandsL +// --------------------------------------------------------------------------- +// +LOCAL_C void ParseInstallableBrandsL( RFs& aFs, RPointerArray& aFiles ) + { + IMPORT_DP_TXT("ParseInstallableBrandsL begin"); + // list import content + CDir* dir = NULL; + TPath privatePath; + aFs.PrivatePath( privatePath ); + privatePath.Insert( 0, KInstallDrive ); + privatePath.Append( KInstallPath ); + + TFileName find( privatePath ); + find.Append( KInstallFiles ); + User::LeaveIfError( + aFs.GetDir( find, KEntryAttNormal, ESortNone, dir ) ); + CleanupStack::PushL( dir ); + + // create array of files (as text) + TInt count = dir->Count(); + for( TInt i = 0; i < count; i++ ) + { + TFileName file( privatePath ); + file.Append( (*dir)[i].iName ); + aFiles.Append( file.AllocL() ); + } + + CleanupStack::PopAndDestroy( dir ); + IMPORT_DP_TXT("ParseInstallableBrandsL end"); + } + +// --------------------------------------------------------------------------- +// Uninstall +// --------------------------------------------------------------------------- +// +LOCAL_C void UninstallL() + { + + // Get uninstalled brands + HBufC* dataBuf = HBufC::NewLC( RProperty::KMaxPropertySize ); + + HBufC* newDataBuf = HBufC::NewLC( RProperty::KMaxPropertySize ); + TPtr newData( newDataBuf->Des() ); + TBool error( EFalse ); + + TPtr data( dataBuf->Des() ); + RProperty::Get( TUid::Uid( KBrandingServerUid ), KUninstallKey, data ); + + //IMPORT_DP( D_IMPORT_LIT( "Property data='%S'" ), &data ); + + TPtrC processing( data ); + while( processing.Length() > 0 ) + { + // get first brand from buffer + TInt pos = processing.Find( KLineFeed ); + TPtrC brand( (pos >= 0) ? processing.Left( pos ) : processing ); + if( pos == KErrNotFound ) + { + // this was last item. reset process. + processing.Set( KNullDesC ); + } + else + { + // cut out the brand part from processing + processing.Set( processing.Mid( brand.Length() + 1 ) ); + } + + // divide brand + TInt sepPos = brand.Find( KBrandSeparator ); + if( sepPos != KErrNotFound ) + { + // remove brand + TRAPD( err, BSBrandRemover::RemoveBrandL( + brand.Left( sepPos ), brand.Mid( sepPos + 1 ) ) ); + //If the brand removal failed and due to a KErrInUse errorcode, + //it must not be deleted from the property-->try to delete next + //time again! in any other case, we simply delete the un- + //uninstallation string from the RProperty. + //NOTE also: Since we check here for an errorcode that is (probably) + //raised in CBSSession.cpp by calling User::Leave, it has to be + //considered whether the condition of the following if statement + //has to be updated or not, if the errorcode of that User::Leave + //in CBSSession.cpp is modified. + if ( KErrInUse == err ) + { + error = ETrue; + if( newData.Length() > 0 ) + { + newData.Append( KLineFeed ); + } + newData.Append( brand ); + } + } + } + + // Reset uninstall buffer + if ( error ) + { + if( newData.Length() <= RProperty::KMaxPropertySize ) + { + User::LeaveIfError( RProperty::Set( TUid::Uid( KBrandingServerUid ), + KUninstallKey, + newData ) ); + } + } + else + { + RProperty::Set( TUid::Uid( KBrandingServerUid ), + KUninstallKey, + KNullDesC ); + } + CleanupStack::PopAndDestroy( newDataBuf ); + CleanupStack::PopAndDestroy( dataBuf ); + + IMPORT_DP_TXT("UninstallL end"); + } + +// --------------------------------------------------------------------------- +// MainL +// --------------------------------------------------------------------------- +// +LOCAL_C void MainL() + { + IMPORT_DP_TXT("MainL begin"); + // Codescanner warning: User of non-pointer/refer3ence RFs (Id:76) + // this code cannot get file server handle from anywhere, so it has to be + // created here + RFs fs; // CSI: 76 # See above + User::LeaveIfError( fs.Connect() ); + CleanupClosePushL( fs ); + + // Uninstall removed brands + TRAP_IGNORE( UninstallL() ); + + // find new xml files + RPointerArray files; + CleanupStack::PushL( TCleanupItem( DeleteRPtrArray, &files ) ); + ParseInstallableBrandsL( fs, files); + + // convert PointerArray to MDesCArray + + TInt count = files.Count(); + if(count) + { + + // Do install + CBSImportManager* installer = CBSImportManager::NewLC(); + + for( TInt i = 0; i < count; i++ ) + { + TRAPD( err, installer->ImportFileL( *(files[i]) ) ); + // only delete the xml file if the installation succeeded; ignore errors. + // If there is a reason to save these files, then change this to + // move operation. + if ( KErrNone == err ) + { + fs.Delete( *(files[i]) ); + } + } + + //User::LeaveIfError( err ); //TODO: should we still leave at this point? + CleanupStack::PopAndDestroy( installer ); + + } + CleanupStack::PopAndDestroy( 2 ); // files, fs + IMPORT_DP_TXT("MainL end"); + } + +// --------------------------------------------------------------------------- +// Main function of the application executable. +// --------------------------------------------------------------------------- +// +GLDEF_C TInt E32Main() + { + __UHEAP_MARK; + CTrapCleanup* cleanup = CTrapCleanup::New(); + TInt returnCode( KErrNone ); + IMPORT_DP_TXT("----- NEW IMPORT SESSION ------( INSTALLER )---"); + User::RenameThread( KProcessName ); + TRAPD( error, MainL() ); + if( error ) + { + IMPORT_DP( D_IMPORT_LIT( "ERROR installing brand: %d" ), error ); + } + IMPORT_DP_TXT("-----------------------------------------------"); + __ASSERT_ALWAYS( !error, User::Panic( KProcessName, error ) ); + delete cleanup; + __UHEAP_MARKEND; + return returnCode; + } diff -r 000000000000 -r e6b17d312c8b brandingserver/tools/makefile/import.mk --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/brandingserver/tools/makefile/import.mk Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,114 @@ +# +# Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: make file +# + + +# ---------------------------------------------------------------------------- +# Application ID +# This should be the same string as is used as the application ID +# of this application in the brand data. +# This is used for cleaning the brand data when calling abld clean. +# +# !!IMPORTANT!! +# +# Note that all the brands for this application will be wiped! +# If this is not wanted, change the rule in CLEAN to do_nothing, but +# then you will get errors when recompiling, since the same brand data +# cannot be entered twice. +# ---------------------------------------------------------------------------- + +APPID=app_id + + +# ---------------------------------------------------------------------------- +# Brand ID +# Name of the created brand +# ---------------------------------------------------------------------------- +BRAND=default + +# ---------------------------------------------------------------------------- +# Brand version +# ---------------------------------------------------------------------------- +VERSION=1 + +# ---------------------------------------------------------------------------- +# Source directory of the brand XML:s. +# Just put every XML you want to import into this directory. +# Note that this directory is for emulator, so c-drive is pointing to +# \epoc32\winscw\c. +# ---------------------------------------------------------------------------- +SOURCEDIR=c:\xml + + +# ---------------------------------------------------------------------------- +# Directory to clean when abld clean is called +# ---------------------------------------------------------------------------- +CLEANED_DIR=\epoc32\winscw\c\private\102828dd\data\$(APPID) + +# ---------------------------------------------------------------------------- +# Language definition +# This should stay unchanged. Build script will change this when needed +# ---------------------------------------------------------------------------- +LANGUAGE=sc + +# ---------------------------------------------------------------------------- +# empty rules +# ---------------------------------------------------------------------------- +do_nothing : + @rem do_nothing + +# ---------------------------------------------------------------------------- +# Build rules +# ---------------------------------------------------------------------------- + +MAKMAKE : do_nothing + +# ---------------------------------------------------------------------------- +# Resources +# Runs the parsers and importer. Note that this will cause an error when +# compiling more than once with the same brand data without calling abld +# clean in between +# +# Note! Edit these to suit our application +# ---------------------------------------------------------------------------- +RESOURCE : + perl -- \s60\brandingserver\tools\xml\loc2xml.pl \S60\someapp\Group\someapp.loc \epoc32\winscw\c\xml\someapp_loc_$(LANGUAGE).xml $(BRAND) $(APPID) $(LANGUAGE) $(VERSION) + perl -- \s60\brandingserver\tools\xml\mbg2xml.pl \epoc32\include\someapp.mbg \epoc32\winscw\c\xml\someapp_gfx.xml $(BRAND) $(APPID) SC $(VERSION) + \epoc32\release\winscw\udeb\bsimport.exe -dtextshell -- -D $(SOURCEDIR) + +# ---------------------------------------------------------------------------- +# Build +# ---------------------------------------------------------------------------- +BLD : do_nothing + +# ---------------------------------------------------------------------------- +# Cleans all brand data for the given application. +# ---------------------------------------------------------------------------- +CLEAN : + if exist $(CLEANED_DIR) rd /S /Q $(CLEANED_DIR) + + +LIB : do_nothing + +CLEANLIB : do_nothing + +FREEZE : do_nothing + +SAVESPACE : do_nothing + +RELEASABLES : + do_nothing + +FINAL : do_nothing diff -r 000000000000 -r e6b17d312c8b brandingserver/tools/sis/brand-example.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/brandingserver/tools/sis/brand-example.pkg Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,71 @@ +; +; Copyright (c) 2006-2006 Nokia Corporation and/or its subsidiary(-ies). +; All rights reserved. +; This component and the accompanying materials are made available +; under the terms of "Eclipse Public License v1.0" +; which accompanies this distribution, and is available +; at the URL "http://www.eclipse.org/legal/epl-v10.html". +; +; Initial Contributors: +; Nokia Corporation - initial contribution. +; +; Contributors: +; +; Description: Example PKG file for branding installer +; + +; -------- general -------- + +; Languages +&EN + +; Package header (one name for each supported language) +#{"?Example Brand 1?"}, (0x102828E0), 1, 0, 0 + +; Localised Vendor name +%{"Nokia"} + +; Unique Vendor name +:"Nokia" + +; -------- files -------- + +;------------------------------------------------------------------------------ +; Brand XML Data +; +; Add branding XML files here. All xml files must go to: +; "c:\private\102828E1\import\" +;------------------------------------------------------------------------------ +; +"import_data\brand_data.xml" -"c:\private\102828E1\import\brand.xml" + + +;------------------------------------------------------------------------------ +; Brand files +; +; Add physical brand files here. Files should go to: +; "c:\private\102828DD\import\", but any publicly readable directory is valid. +;------------------------------------------------------------------------------ +; +"import_data\file.jpg" -"c:\private\102828DD\import\file.jpg" + + +;------------------------------------------------------------------------------ +; Brand installer notifier +; +; This file notifies the server to install new brands! This file also contains +; the information of which brands to remove when this sis package is +; uninstalled. Content of this file is not important, and it's adviced to +; leave it empty. Only the name of the file makes the difference. +; +; NOTE! name of this file needs to be unique. Use version section in the file +; below to install updates to previous packages. +; +; HINT! Sis package can contain multiple install files. it's possible to +; install and remove multiple brands with single sis file. +; +; Format of this file: "[brand_id]$[application_id]$[version].install". +; version part is optional. +;------------------------------------------------------------------------------ +; +"import_data\install.txt" -"c:\private\102828DD\import\install\brand_id$app_id$001.install" diff -r 000000000000 -r e6b17d312c8b brandingserver/tools/sis/import_data/brand_data.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/brandingserver/tools/sis/import_data/brand_data.xml Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,20 @@ + + + + APP_ID + BRAND_ID + 99 + 1 + + + 10 + + + + + c:\private\102828DD\import\file.jpg + + + + + \ No newline at end of file diff -r 000000000000 -r e6b17d312c8b brandingserver/tools/sis/import_data/file.JPG Binary file brandingserver/tools/sis/import_data/file.JPG has changed diff -r 000000000000 -r e6b17d312c8b brandingserver/tools/sis/import_data/install.txt diff -r 000000000000 -r e6b17d312c8b brandingserver/tools/sis/make-example.cmd --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/brandingserver/tools/sis/make-example.cmd Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,22 @@ +rem +rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +rem All rights reserved. +rem This component and the accompanying materials are made available +rem under the terms of "Eclipse Public License v1.0" +rem which accompanies this distribution, and is available +rem at the URL "http://www.eclipse.org/legal/epl-v10.html". +rem +rem Initial Contributors: +rem Nokia Corporation - initial contribution. +rem +rem Contributors: +rem +rem Description: Example to make the brand sis file +rem + +@echo off +call t:\epoc32\tools\makesis brand-example.pkg +call t:\epoc32\tools\signsis brand-example.sis brand.sis rd.cer rd-key.pem +del brand-example.sis +ren brand.sis brand-example.sis +pause diff -r 000000000000 -r e6b17d312c8b brandingserver/tools/xml/loc2xml.pl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/brandingserver/tools/xml/loc2xml.pl Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,142 @@ +# +# Copyright (c) 2006-2006 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: Converts loc file into branding xml file +# + +#------------------------------------------------------------------------------ +# Trim string +#------------------------------------------------------------------------------ +# +sub trim($) +{ + my $string = shift; + $string =~ s/^[ ]+//; + $string =~ s/[ ]+$//; + return $string; +} + + +#------------------------------------------------------------------------------ +# Prints usage information +#------------------------------------------------------------------------------ +# +sub UsageInformation +{ + print < ) + { + $_ = trim( $_ ); + if( /^\#define\s+qtn.+\s+\".+\"/i ) + { + # find ID + /(qtn[\w\d_]+)/i; + $id = $1; + $id =~ s/_//g; # remove all '_' chars + + #find value + /\"(.+)\"/i; + $value = $1; + + $array{$id} = $value; +# print "$id \t: \'$value\'\n\r" + } + } +close(INPUT); # Close the file + +return %array; +} + +#------------------------------------------------------------------------------ +# Write XML file from given array +#------------------------------------------------------------------------------ +# +sub WriteXmlFile +{ +my %strings = @_; +open( OUTPUT, ">$ARGV[1]" ) || die "Can't open file: '$ARGV[1]'"; + + +print OUTPUT < + + + $ARGV[3] + $ARGV[2] + $ARGV[4] + $ARGV[5] + +EOF + +while( ($key, $value) = each(%strings) ) + { + print OUTPUT < + $value + + +EOF + } + +print OUTPUT " \n"; +print OUTPUT "\n"; + +close( OUTPUT ); +} + +#------------------------------------------------------------------------------ +# Main function +#------------------------------------------------------------------------------ +# + +# Check parameters +my $count = @ARGV; +if( $count != 6 ) + { + UsageInformation(); + } + +# Parse LOC file +my %strings = &ReadLocFile( $ARGV[0] ); + +# Write XML file +WriteXmlFile( %strings ); + +# Done! +my @list = %strings; +$count = @list / 2; +print "Processed succesfully $count strings." + +# end of file diff -r 000000000000 -r e6b17d312c8b brandingserver/tools/xml/mbg2xml.pl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/brandingserver/tools/xml/mbg2xml.pl Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,298 @@ +# +# Copyright (c) 2006-2006 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: Converts mbg file into branding xml file +# + +# SETUP +# +my $skinidconstants = 'epoc32\include\middleware\aknsconstants.h'; +my $skiniddefinitions = 'epoc32\include\middleware\aknsconstants.hrh'; +my $version = 'v0.1'; + +# GLOBALS +# + +# these hashes store the data for each bitmap. +# each data can be accessed with same key value. +my %bitmaps = (); # bitmapname => bitmap id +my %masks = (); # bitmapname => mask id +my %skinidmajor = (); # bitmapname => major skin id +my %skinidminor = (); # bitmapname => minor skin id + +my $commonpart; # common part of every mbg + +#------------------------------------------------------------------------------ +# Trim string +#------------------------------------------------------------------------------ +# +sub trim($) +{ + my $string = shift; + $string =~ s/^[ ]+//; + $string =~ s/[ ]+$//; + return $string; +} + +#------------------------------------------------------------------------------ +# Determines, validates, and returns EPOCROOT. +#------------------------------------------------------------------------------ +# +sub getEpocroot +{ + my $epocroot = $ENV{EPOCROOT}; + die "ERROR: Must set the EPOCROOT environment variable.\n" + if (!defined($epocroot)); + $epocroot =~ s-/-\\-go; # for those working with UNIX shells + die "ERROR: EPOCROOT must be an absolute path, " . + "not containing a drive letter.\n" if ($epocroot !~ /^\\/); + die "ERROR: EPOCROOT must not be a UNC path.\n" if ($epocroot =~ /^\\\\/); + die "ERROR: EPOCROOT must end with a backslash.\n" if ($epocroot !~ /\\$/); + die "ERROR: EPOCROOT must specify an existing directory.\n" + if (!-d $epocroot); + return $epocroot; +} + +#------------------------------------------------------------------------------ +# Prints usage information +#------------------------------------------------------------------------------ +# +sub UsageInformation +{ + print <; +close( F ); +my $longbuf = join( "", @readbuffer ); + +# try to find each bitmap from file +foreach $item( keys( %bitmaps ) ) + { + $searchitem = $item; + $searchitem =~ s/$commonpart//; + $searchitem =~ s/_//g; + $_ = $longbuf; + #print "\n - Seaching: ".$searchitem." = \t"; + if( /static\s+const\s+TAknsItemID\s+KAknsIID($searchitem)\s*=\s*{\s*(\w+)\s*,\s*(\w+)\s*}\s*;/i ) + { + #print $2." - ".$3; + $skinidmajor{$item} = $2; + $skinidminor{$item} = $3; + } + else + { + #print "not found"; + } + } +} + +#------------------------------------------------------------------------------ +# Parse Avkon skin id definition file and find values for ids +#------------------------------------------------------------------------------ +# +sub ParseAvkonSkinDefFile +{ +# read file +print "\nParsing file: ".&getEpocroot.$skiniddefinitions; +open( F, &getEpocroot.$skiniddefinitions ) || die "Can't open avkon skin def file!"; +my @readbuffer = ; +close( F ); + +my $longbuf = join( "", @readbuffer ); + +# Parse major ids +print "\nParsing major skin ids"; +while( ( $key, $id ) = each( %skinidmajor ) ) + { + $searchitem = $id; + $_ = $longbuf; + #print "\n - Seaching: ".$searchitem." = \t"; + if( /\s+$searchitem\s*=\s*([a-fx0-9]+)/i ) + { + #print $1; + $skinidmajor{$key} = hex($1); + } + else + { + #print "not found"; + } + } + +# Parse minor ids +print "\nParsing minor skin ids"; +while( ( $key, $id ) = each( %skinidminor ) ) + { + $searchitem = $id; + $_ = $longbuf; + #print "\n - Seaching: ".$searchitem." = \t"; + if( /\s+$searchitem\s*=\s*([a-fx0-9]+)/i ) + { + #print $1; + $skinidminor{$key} = hex($1); + } + else + { + #print "not found"; + } + } + +} + +#------------------------------------------------------------------------------ +# Reads MBG file and constructs associative array +#------------------------------------------------------------------------------ +# +sub ReadMbgFile +{ +# Parse LOC file +my $infile = shift; +open(INPUT, $infile) || die "Can't open file: '$infile'"; # Open the file + + +while( ) + { + $_ = trim( $_ ); + if( /^\s*(E[\w_]*) [=] ([0-9]+),/i ) + { + $_ = $1; + $value = $2; + if( /(E[\w_]*)_mask/ ) + { + $masks{$1} = $value; + } + else + { + $bitmaps{$1} = $value; + } + #$id =~ s/_//g; # remove all '_' chars + } + elsif( /^\s*(E[\w]*)LastElement\s*/ ) + { + print "\nCommon part for bitmaps: '$1'\n"; + $commonpart = $1; + } + } +close(INPUT); # Close the file +} + +#------------------------------------------------------------------------------ +# Write branding XML file +#------------------------------------------------------------------------------ +# +sub WriteXmlFile +{ +my %strings = @_; +$len = length $ARGV[0]; +$bitmap_file_id = substr($ARGV[0], 0, $len - 4); +$bitmap_file = $bitmap_file_id . "." . $ARGV[6]; +$bitmap_file_id = $bitmap_file_id . "_" . $ARGV[6]; + +open( OUTPUT, ">$ARGV[1]" ) || die "Can't open file: '$ARGV[1]'"; + +print OUTPUT < + + + $ARGV[3] + $ARGV[2] + $ARGV[4] + $ARGV[5] + + + c:\\private\\102828DD\\import\\$bitmap_file + + + +EOF + + +while( ($key, $value) = each(%bitmaps) ) + { + # strip underscores + $modifkey = $key; + $modifkey =~ s/_//g; + + print OUTPUT < + + $bitmap_file_id + $value + $masks{$key} + $skinidmajor{$key} + $skinidminor{$key} + + + +EOF + } + +print OUTPUT " \n"; +print OUTPUT "\n"; + +close( OUTPUT ); +} + +#------------------------------------------------------------------------------ +# Main function +#------------------------------------------------------------------------------ +# + +# Check parameters +my $count = @ARGV; +if( $count != 7 ) + { + UsageInformation(); + } + +# Parse MBG file for bitmaps +print "\nParsing input file: $ARGV[0]"; +ReadMbgFile( $ARGV[0] ); + +# Parse avkon skin files and find skin id's for all the found bitmaps +ParseAvkonSkinFile(); +ParseAvkonSkinDefFile(); + +# Write XML file +WriteXmlFile(); + +# Done! +my @list = %bitmaps; +$count = @list / 2; +print "\n\nProcessed succesfully $count bitmaps.\nDone!\n" + +# end of file diff -r 000000000000 -r e6b17d312c8b brandingserver/tools/xml/xml2h.pl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/brandingserver/tools/xml/xml2h.pl Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,111 @@ +# +# Copyright (c) 2006-2006 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: Writes a header file based on brand xml file +# + +#------------------------------------------------------------------------------ +# Prints usage information +#------------------------------------------------------------------------------ +# +sub UsageInformation +{ + print < ); + close(INPUT); + + # remove all comments + $xmlcontent =~ s///g; + + # find elements id's + $_ = $xmlcontent; + my @elements = /<.*element[. ]* id="([\w\d_]+)".*>/g; + + #debug print +# foreach $item (@elements) print "$item\n"; + return @elements; +} + +#------------------------------------------------------------------------------ +# Write Header file +#------------------------------------------------------------------------------ +# +sub WriteHeaderFile +{ + my @ids = @_; + open( OUTPUT, ">$ARGV[1]" ) || die "Can't open file: '$ARGV[1]'"; + + # Write header + print OUTPUT < + +// Project exports + +// MMP files for project components +PRJ_MMPFILES +#include "../imfeatureplugin/group/bld.inf" +#include "../searchfeatureplugin/group/bld.inf" +#include "../xmppsettingsapi/group/bld.inf" +#include "../xmppsettingsfetcher/group/bld.inf" +#include "../ossprotocoladaptation/group/bld.inf" +#include "../instantmessagingcache/group/bld.inf" + +PRJ_TESTMMPFILES + diff -r 000000000000 -r e6b17d312c8b imservices/imfeatureplugin/bwins/imdatamodelhooku.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/imfeatureplugin/bwins/imdatamodelhooku.def Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + ?ImplementationGroupProxy@@YAPBUTImplementationProxy@@AAH@Z @ 1 NONAME ; struct TImplementationProxy const * ImplementationGroupProxy(int &) + diff -r 000000000000 -r e6b17d312c8b imservices/imfeatureplugin/bwins/imdatamodelu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/imfeatureplugin/bwins/imdatamodelu.def Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,18 @@ +EXPORTS + ??1CConversationSubscriptionItem@@UAE@XZ @ 1 NONAME ; CConversationSubscriptionItem::~CConversationSubscriptionItem(void) + ?CleanExpired@CImDataCache@@QAEXXZ @ 2 NONAME ; void CImDataCache::CleanExpired(void) + ?CleanResources@CImDataCache@@QAEXAAVMXIMPPscContext@@@Z @ 3 NONAME ; void CImDataCache::CleanResources(class MXIMPPscContext &) + ?ConversationSubscriptionItemLC@CImDataCache@@QAEAAVCConversationSubscriptionItem@@XZ @ 4 NONAME ; class CConversationSubscriptionItem & CImDataCache::ConversationSubscriptionItemLC(void) + ?IdentityImp@CImConversationInfoImp@@QBEABVCXIMPIdentityImp@@XZ @ 5 NONAME ; class CXIMPIdentityImp const & CImConversationInfoImp::IdentityImp(void) const + ?InternalizeL@CImConversationInfoImp@@QAEXAAVRReadStream@@@Z @ 6 NONAME ; void CImConversationInfoImp::InternalizeL(class RReadStream &) + ?NewFromStreamLC@CImConversationInfoImp@@SAPAVCXIMPApiDataObjBase@@AAVRReadStream@@@Z @ 7 NONAME ; class CXIMPApiDataObjBase * CImConversationInfoImp::NewFromStreamLC(class RReadStream &) + ?NewL@CImApiDataObjFactoryAccessor@@SAPAV1@XZ @ 8 NONAME ; class CImApiDataObjFactoryAccessor * CImApiDataObjFactoryAccessor::NewL(void) + ?NewL@CImConversationInfoImp@@SAPAV1@XZ @ 9 NONAME ; class CImConversationInfoImp * CImConversationInfoImp::NewL(void) + ?NewL@CImDataCache@@SAPAV1@AAVMXIMPHost@@@Z @ 10 NONAME ; class CImDataCache * CImDataCache::NewL(class MXIMPHost &) + ?NewL@CImObjectFactoryImp@@SAPAV1@XZ @ 11 NONAME ; class CImObjectFactoryImp * CImObjectFactoryImp::NewL(void) + ?NewLC@CImConversationEventImp@@SAPAV1@PAVCImConversationInfoImp@@@Z @ 12 NONAME ; class CImConversationEventImp * CImConversationEventImp::NewLC(class CImConversationInfoImp *) + ?NewLC@CImConversationInfoImp@@SAPAV1@XZ @ 13 NONAME ; class CImConversationInfoImp * CImConversationInfoImp::NewLC(void) + ?RemoveMe@?$@VCConversationSubscriptionItem@@@CImDataCache@@CAXAAPAV1@PAV1@@Z @ 14 NONAME ; void CImDataCache::RemoveMe(class CConversationSubscriptionItem * &, class CConversationSubscriptionItem *) + ?SetConversationInfoL@CConversationSubscriptionItem@@QAEXPAVCImConversationInfoImp@@@Z @ 15 NONAME ; void CConversationSubscriptionItem::SetConversationInfoL(class CImConversationInfoImp *) + ?SetIdentity@CImConversationInfoImp@@QAEXPAVCXIMPIdentityImp@@@Z @ 16 NONAME ; void CImConversationInfoImp::SetIdentity(class CXIMPIdentityImp *) + diff -r 000000000000 -r e6b17d312c8b imservices/imfeatureplugin/bwins/imecomhooku.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/imfeatureplugin/bwins/imecomhooku.def Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + ?ImplementationGroupProxy@@YAPBUTImplementationProxy@@AAH@Z @ 1 NONAME ; struct TImplementationProxy const * ImplementationGroupProxy(int &) + diff -r 000000000000 -r e6b17d312c8b imservices/imfeatureplugin/bwins/immanageru.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/imfeatureplugin/bwins/immanageru.def Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + ?NewL@CImFeaturesImp@@SAPAV1@PAVMXIMPContext@@@Z @ 1 NONAME ; class CImFeaturesImp * CImFeaturesImp::NewL(class MXIMPContext *) + diff -r 000000000000 -r e6b17d312c8b imservices/imfeatureplugin/bwins/imoperationshooku.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/imfeatureplugin/bwins/imoperationshooku.def Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + ?ImplementationGroupProxy@@YAPBUTImplementationProxy@@AAH@Z @ 1 NONAME ; struct TImplementationProxy const * ImplementationGroupProxy(int &) + diff -r 000000000000 -r e6b17d312c8b imservices/imfeatureplugin/bwins/imoperationu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/imfeatureplugin/bwins/imoperationu.def Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,6 @@ +EXPORTS + ??0COperationLaunchCleaner@@QAE@XZ @ 1 NONAME ; COperationLaunchCleaner::COperationLaunchCleaner(void) + ??0COperationReceiveMessage@@QAE@XZ @ 2 NONAME ; COperationReceiveMessage::COperationReceiveMessage(void) + ??0COperationSendMessage@@QAE@XZ @ 3 NONAME ; COperationSendMessage::COperationSendMessage(void) + ?NewL@CImOperationFactory@@SAPAV1@XZ @ 4 NONAME ; class CImOperationFactory * CImOperationFactory::NewL(void) + diff -r 000000000000 -r e6b17d312c8b imservices/imfeatureplugin/bwins/improcessorhooku.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/imfeatureplugin/bwins/improcessorhooku.def Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + ?ImplementationGroupProxy@@YAPBUTImplementationProxy@@AAH@Z @ 1 NONAME ; struct TImplementationProxy const * ImplementationGroupProxy(int &) + diff -r 000000000000 -r e6b17d312c8b imservices/imfeatureplugin/bwins/improcessoru.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/imfeatureplugin/bwins/improcessoru.def Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,5 @@ +EXPORTS + ?NewL@CProtocolDataHostImp@@SAPAV1@AAVMXIMPHost@@@Z @ 1 NONAME ; class CProtocolDataHostImp * CProtocolDataHostImp::NewL(class MXIMPHost &) + ?NewL@CProtocolImConversationDataHostImp@@SAPAV1@AAVMXIMPHost@@@Z @ 2 NONAME ; class CProtocolImConversationDataHostImp * CProtocolImConversationDataHostImp::NewL(class MXIMPHost &) + ?NewLC@CProtocolDataHostImp@@SAPAV1@AAVMXIMPHost@@@Z @ 3 NONAME ; class CProtocolDataHostImp * CProtocolDataHostImp::NewLC(class MXIMPHost &) + diff -r 000000000000 -r e6b17d312c8b imservices/imfeatureplugin/eabi/imdatamodelhooku.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/imfeatureplugin/eabi/imdatamodelhooku.def Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + _Z24ImplementationGroupProxyRi @ 1 NONAME + diff -r 000000000000 -r e6b17d312c8b imservices/imfeatureplugin/eabi/imdatamodelu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/imfeatureplugin/eabi/imdatamodelu.def Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,28 @@ +EXPORTS + _ZN12CImDataCache12CleanExpiredEv @ 1 NONAME + _ZN12CImDataCache14CleanResourcesER15MXIMPPscContext @ 2 NONAME + _ZN12CImDataCache30ConversationSubscriptionItemLCEv @ 3 NONAME + _ZN12CImDataCache4NewLER9MXIMPHost @ 4 NONAME + _ZN12CImDataCache8RemoveMeI29CConversationSubscriptionItemEEvRPT_S3_ @ 5 NONAME + _ZN19CImObjectFactoryImp4NewLEv @ 6 NONAME + _ZN22CImConversationInfoImp11SetIdentityEP16CXIMPIdentityImp @ 7 NONAME + _ZN22CImConversationInfoImp12InternalizeLER11RReadStream @ 8 NONAME + _ZN22CImConversationInfoImp15NewFromStreamLCER11RReadStream @ 9 NONAME + _ZN22CImConversationInfoImp4NewLEv @ 10 NONAME + _ZN22CImConversationInfoImp5NewLCEv @ 11 NONAME + _ZN23CImConversationEventImp5NewLCEP22CImConversationInfoImp @ 12 NONAME + _ZN28CImApiDataObjFactoryAccessor4NewLEv @ 13 NONAME + _ZN29CConversationSubscriptionItem20SetConversationInfoLEP22CImConversationInfoImp @ 14 NONAME + _ZN29CConversationSubscriptionItemD0Ev @ 15 NONAME + _ZN29CConversationSubscriptionItemD1Ev @ 16 NONAME + _ZN29CConversationSubscriptionItemD2Ev @ 17 NONAME + _ZNK22CImConversationInfoImp11IdentityImpEv @ 18 NONAME + _ZTI12CImDataCache @ 19 NONAME ; ## + _ZTI19CImObjectFactoryImp @ 20 NONAME ; ## + _ZTI29CConversationSubscriptionItem @ 21 NONAME ; ## + _ZTV12CImDataCache @ 22 NONAME ; ## + _ZTV19CImObjectFactoryImp @ 23 NONAME ; ## + _ZTV29CConversationSubscriptionItem @ 24 NONAME ; ## + _ZThn28_N29CConversationSubscriptionItemD0Ev @ 25 NONAME ; ## + _ZThn28_N29CConversationSubscriptionItemD1Ev @ 26 NONAME ; ## + diff -r 000000000000 -r e6b17d312c8b imservices/imfeatureplugin/eabi/imecomhooku.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/imfeatureplugin/eabi/imecomhooku.def Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + _Z24ImplementationGroupProxyRi @ 1 NONAME + diff -r 000000000000 -r e6b17d312c8b imservices/imfeatureplugin/eabi/immanageru.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/imfeatureplugin/eabi/immanageru.def Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + _ZN14CImFeaturesImp4NewLEP12MXIMPContext @ 1 NONAME + diff -r 000000000000 -r e6b17d312c8b imservices/imfeatureplugin/eabi/imoperationshooku.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/imfeatureplugin/eabi/imoperationshooku.def Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + _Z24ImplementationGroupProxyRi @ 1 NONAME + diff -r 000000000000 -r e6b17d312c8b imservices/imfeatureplugin/eabi/imoperationu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/imfeatureplugin/eabi/imoperationu.def Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,15 @@ +EXPORTS + _ZN19CImOperationFactory4NewLEv @ 1 NONAME + _ZN21COperationSendMessageC1Ev @ 2 NONAME + _ZN21COperationSendMessageC2Ev @ 3 NONAME + _ZN23COperationLaunchCleanerC1Ev @ 4 NONAME + _ZN23COperationLaunchCleanerC2Ev @ 5 NONAME + _ZN24COperationReceiveMessageC1Ev @ 6 NONAME + _ZN24COperationReceiveMessageC2Ev @ 7 NONAME + _ZTI21COperationSendMessage @ 8 NONAME ; ## + _ZTI23COperationLaunchCleaner @ 9 NONAME ; ## + _ZTI24COperationReceiveMessage @ 10 NONAME ; ## + _ZTV21COperationSendMessage @ 11 NONAME ; ## + _ZTV23COperationLaunchCleaner @ 12 NONAME ; ## + _ZTV24COperationReceiveMessage @ 13 NONAME ; ## + diff -r 000000000000 -r e6b17d312c8b imservices/imfeatureplugin/eabi/improcessorhooku.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/imfeatureplugin/eabi/improcessorhooku.def Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + _Z24ImplementationGroupProxyRi @ 1 NONAME + diff -r 000000000000 -r e6b17d312c8b imservices/imfeatureplugin/eabi/improcessoru.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/imfeatureplugin/eabi/improcessoru.def Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,7 @@ +EXPORTS + _ZN20CProtocolDataHostImp4NewLER9MXIMPHost @ 1 NONAME + _ZN20CProtocolDataHostImp5NewLCER9MXIMPHost @ 2 NONAME + _ZN34CProtocolImConversationDataHostImp4NewLER9MXIMPHost @ 3 NONAME + _ZTI34CProtocolImConversationDataHostImp @ 4 NONAME ; ## + _ZTV34CProtocolImConversationDataHostImp @ 5 NONAME ; ## + diff -r 000000000000 -r e6b17d312c8b imservices/imfeatureplugin/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/imfeatureplugin/group/bld.inf Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,42 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Build information file for project IM Feature Plugin +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS +../rom/imfeatureplugin.iby CORE_MW_LAYER_IBY_EXPORT_PATH(imfeatureplugin.iby) +// ROM SIS stubs +../sis/imfeaturepluginstub.sis /epoc32/data/Z/System/Install/imfeaturepluginstub.sis + +PRJ_MMPFILES +../srcimdatamodel/group/imdatamodel.mmp +../srcimdatamodel/group/imdatamodelhook.mmp +../srcimfrontend/group/immanager.mmp +../srcimfrontend/group/imecomhook.mmp +../srcimoperations/group/imoperation.mmp +../srcimoperations/group/imoperationshook.mmp +../srcimprocessor/group/improcessor.mmp +../srcimprocessor/group/improcessorhook.mmp + +PRJ_TESTMMPFILES + +PRJ_TESTEXPORTS + diff -r 000000000000 -r e6b17d312c8b imservices/imfeatureplugin/group/imdlluids.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/imfeatureplugin/group/imdlluids.hrh Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,73 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework IM DLL uids +* +*/ + +#ifndef IMDLLUIDS_HRH +#define IMDLLUIDS_HRH + + +// ----------------------------------------------------------------------------- +// Common dll uids +// ----------------------------------------------------------------------------- +// +#define XIMP_IM_DLL_UID_STATIC_INTERFACE 0x1000008d +#define XIMP_IM_DLL_UID_ECOM_PLUGIN 0x10009D8D + +// ----------------------------------------------------------------------------- +// Common UID 3 for the XIMP Framework dlls. +// ----------------------------------------------------------------------------- +// +#define XIMP_IM_DLL_UID_COMMON 0x10282DD8 +// ----------------------------------------------------------------------------- +// ECOM implementation UID +// ----------------------------------------------------------------------------- +// +#define XIMP_ECOM_IMPLEMENTATION_UID_IM_INTERFACE 0x2000B5ED + +//#define XIMP_ECOM_IMPL_UID_IM_CACHE_INTERFACE 0x2000B5EE + +// Factory interface for internal data structures +#define XIMP_ECOM_IMPL_UID_IM_DATAMODEL_INTERFACE 0x2000B5EF + +#define XIMP_ECOM_IMPL_UID_IM_PROCESSOR_INTERFACE 0x20015A10 +#define XIMP_ECOM_IMPL_UID_IM_OPERATION_INTERFACE 0x20015A0F + +// ----------------------------------------------------------------------------- +// Other dll uids +// ----------------------------------------------------------------------------- +// +#define XIMP_DLL_UID_IM_HOOK 0x2000B5F0 +#define XIMP_DLL_UID_IM_MANAGER 0x2000B5F1 +#define XIMP_DLL_UID_IM_DATAMODEL_HOOK 0x2000B5F2 +//#define XIMP_DLL_UID_IM_CACHE_HOOK 0x2000B5F3 +#define XIMP_DLL_UID_IM_PROCESSOR 0x2000B5F4 +#define XIMP_DLL_UID_IM_PROCESSOR_HOOK 0x20015A12 +#define XIMP_DLL_UID_IM_OPERATIONS_HOOK 0x20015A13 + + +#define XIMP_DLL_UID_IM_OPERATION 0x20015A11 + + +//#define XIMP_ECOM_IMPLEMENTATION_UID_IM_INTERFACE 0x2000B5EA +//#define XIMP_DLL_UID_IM_HOOK 0x2000B5EB +//#define XIMP_DLL_UID_IM_MANAGER 0x2000B5EC + + + + +#endif // IMDLLUIDS_HRH + + diff -r 000000000000 -r e6b17d312c8b imservices/imfeatureplugin/rom/imfeatureplugin.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/imfeatureplugin/rom/imfeatureplugin.iby Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,39 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: IBY file for imfeatureplugin +* +*/ + +#ifndef __IMFEATUREPLUGIN_IBY__ +#define __IMFEATUREPLUGIN_IBY__ + +// imfeature plugin : (ximpfw.iby contains commented dlls, remove from there) +//dlls +file=ABI_DIR/BUILD_DIR/immanager.dll SHARED_LIB_DIR/immanager.dll +file=ABI_DIR/BUILD_DIR/imdatamodel.dll SHARED_LIB_DIR/imdatamodel.dll +file=ABI_DIR/BUILD_DIR/imoperation.dll SHARED_LIB_DIR/imoperation.dll +file=ABI_DIR/BUILD_DIR/improcessor.dll SHARED_LIB_DIR/improcessor.dll + +//ECom hook +ECOM_PLUGIN( imecomhook.dll, imecomhook.rsc) +ECOM_PLUGIN( imdatamodelhook.dll, imdatamodelhook.rsc) +ECOM_PLUGIN( imoperationshook.dll, imoperationshook.rsc) +ECOM_PLUGIN( improcessorhook.dll, improcessorhook.rsc) + +// stub SIS, provides support for SIS upgrading +data=DATAZ_/system/install/imfeaturepluginstub.sis system/install/imfeaturepluginstub.sis + +#endif + + diff -r 000000000000 -r e6b17d312c8b imservices/imfeatureplugin/sis/imfeatureplugin.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/imfeatureplugin/sis/imfeatureplugin.pkg Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,46 @@ +; +; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +; All rights reserved. +; This component and the accompanying materials are made available +; under the terms of "Eclipse Public License v1.0" +; which accompanies this distribution, and is available +; at the URL "http://www.eclipse.org/legal/epl-v10.html". +; +; Initial Contributors: +; Nokia Corporation - initial contribution. +; +; Contributors: +; +; Description: +; +;Language +&EN + +;Header +#{"imfeatureplugin"}, (0x2000B5F1), 1, 1, 0, TYPE=SA, RU + +;Supports Series 60 v 5.2; Needs to be updated when platform is changed +(0x20022E6D ), 0, 0, 0, {"Series60ProductID"} + +;Localised VendorID +%{"Nokia"} + +;VendorID +:"Nokia" + + +;imfeatureplugin libs +"\EPOC32\RELEASE\ARMV5\UREL\imdatamodelhook.dll" -"!:\sys\bin\imdatamodelhook.dll" +"\EPOC32\RELEASE\ARMV5\UREL\imdatamodel.dll" -"!:\sys\bin\imdatamodel.dll" +"\EPOC32\RELEASE\ARMV5\UREL\immanager.dll" -"!:\sys\bin\immanager.dll" +"\EPOC32\RELEASE\ARMV5\UREL\imecomhook.dll" -"!:\sys\bin\imecomhook.dll" +"\EPOC32\RELEASE\ARMV5\UREL\imoperationshook.dll" -"!:\sys\bin\imoperationshook.dll" +"\EPOC32\RELEASE\ARMV5\UREL\imoperation.dll" -"!:\sys\bin\imoperation.dll" +"\EPOC32\RELEASE\ARMV5\UREL\improcessorhook.dll" -"!:\sys\bin\improcessorhook.dll" +"\EPOC32\RELEASE\ARMV5\UREL\improcessor.dll" -"!:\sys\bin\improcessor.dll" +"\EPOC32\DATA\Z\Resource\Plugins\imdatamodelhook.rsc" -"!:\Resource\Plugins\imdatamodelhook.rsc" +"\EPOC32\DATA\Z\Resource\Plugins\imecomhook.rsc" -"!:\Resource\Plugins\imecomhook.rsc" +"\EPOC32\DATA\Z\Resource\Plugins\imoperationshook.rsc" -"!:\Resource\Plugins\imoperationshook.rsc" +"\EPOC32\DATA\Z\Resource\Plugins\improcessorhook.rsc" -"!:\Resource\Plugins\improcessorhook.rsc" + +; end of file diff -r 000000000000 -r e6b17d312c8b imservices/imfeatureplugin/sis/imfeaturepluginstub.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/imfeatureplugin/sis/imfeaturepluginstub.pkg Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,42 @@ +; +; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +; All rights reserved. +; This component and the accompanying materials are made available +; under the terms of "Eclipse Public License v1.0" +; which accompanies this distribution, and is available +; at the URL "http://www.eclipse.org/legal/epl-v10.html". +; +; Initial Contributors: +; Nokia Corporation - initial contribution. +; +; Contributors: +; +; Description: +; +;Language +&EN + +;Header +#{"imfeatureplugin"}, (0x2000B5F1), 1, 0, 0, TYPE=SA + +;Localised VendorID +%{"Nokia"} + +;VendorID +:"Nokia" + +;imfeature plugin +"" -"z:\sys\bin\imdatamodelhook.dll" +"" -"z:\resource\plugins\imdatamodelhook.rsc" +"" -"z:\sys\bin\imdatamodel.dll" +"" -"z:\sys\bin\immanager.dll" +"" -"z:\sys\bin\imecomhook.dll" +"" -"z:\resource\plugins\imecomhook.rsc" +"" -"z:\sys\bin\imoperationshook.dll" +"" -"z:\resource\plugins\imoperationshook.rsc" +"" -"z:\sys\bin\imoperation.dll" +"" -"z:\sys\bin\improcessorhook.dll" +"" -"z:\resource\plugins\improcessorhook.rsc" +"" -"z:\sys\bin\improcessor.dll" + +; end of file diff -r 000000000000 -r e6b17d312c8b imservices/imfeatureplugin/sis/imfeaturepluginstub.sis Binary file imservices/imfeatureplugin/sis/imfeaturepluginstub.sis has changed diff -r 000000000000 -r e6b17d312c8b imservices/imfeatureplugin/sis/metadata.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/imfeatureplugin/sis/metadata.xml Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,72 @@ + + + ABC:ABC + + + + + 1 + + IMFeaturePlugin + + Update for IMFeaturePlugin + + + + + + S60 + + + 5 + 2 + + + 2007 + 1 + + + + + 5 + 2 + + 2009 + 52 + + + + + + + + 0x2000B5F1 + + + 1 + 0 + 0 + + + + 2 + 2 + 2 + + + + + diff -r 000000000000 -r e6b17d312c8b imservices/imfeatureplugin/srcimdatamodel/apidataobjfactory.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/imfeatureplugin/srcimdatamodel/apidataobjfactory.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,37 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MApiDataObjFactory Declaration +* +*/ + + + +#ifndef M_APIOBJFACTORY_H +#define M_APIOBJFACTORY_H + +#include + +class CXIMPApiDataObjBase; + +class MApiDataObjFactory + { +public: + + virtual CXIMPApiDataObjBase* NewFromStreamLC( TInt32 aDataObjInterfaceId, + RReadStream& aStream ) = 0; + + }; + +#endif // M_APIOBJFACTORY_H + diff -r 000000000000 -r e6b17d312c8b imservices/imfeatureplugin/srcimdatamodel/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/imfeatureplugin/srcimdatamodel/group/bld.inf Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Build information file for project IM Feature Plugin +* +*/ + + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +PRJ_MMPFILES +imdatamodel.mmp +imdatamodelhook.mmp + + +PRJ_TESTMMPFILES + +PRJ_TESTEXPORTS + diff -r 000000000000 -r e6b17d312c8b imservices/imfeatureplugin/srcimdatamodel/group/imdatamodel.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/imfeatureplugin/srcimdatamodel/group/imdatamodel.mmp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,80 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project definition file for IM Feature Plugin +* +*/ + +#include +#include +#include "../../group/imdlluids.hrh" + +TARGET imdatamodel.dll +TARGETTYPE dll +UID XIMP_IM_DLL_UID_STATIC_INTERFACE XIMP_IM_DLL_UID_COMMON + +CAPABILITY CAP_GENERAL_DLL +VENDORID VID_DEFAULT + +VERSION 10.0 + +// --------------------------------------------------------------------------- +SOURCEPATH ../imconversation +// --------------------------------------------------------------------------- +// Subscription items +SOURCE conversationsubscriptionitem.cpp + +// API data objects +SOURCE imconversationinfoimp.cpp + +// API data events +SOURCE imconversationeventimp.cpp + + + +// --------------------------------------------------------------------------- +SOURCEPATH ../../srcimdatamodel +// --------------------------------------------------------------------------- +SOURCE imdatacacheimp.cpp +SOURCE imobjectfactoryimp.cpp +//SOURCE ximpimsubscriptionitembase.cpp +SOURCE imapidataobjfactory.cpp +SOURCE imeventcodec.cpp +SOURCE imapidataobjfactoryaccessor.cpp + + +USERINCLUDE ../../srcimdatamodel +USERINCLUDE ../../srcimdatamodel/imconversation +USERINCLUDE ../../group + + +MW_LAYER_SYSTEMINCLUDE + + +LIBRARY euser.lib +LIBRARY bafl.lib +LIBRARY estor.lib +LIBRARY ximputils.lib +LIBRARY ximpdatamodel.lib +LIBRARY ecom.lib +LIBRARY flogger.lib + +//EXPORTUNFROZEN + +#if defined( ARMCC ) +DEFFILE ../../eabi/ +#elif defined ( WINSCW ) +deffile ../../bwins/ +#endif + +// End of file diff -r 000000000000 -r e6b17d312c8b imservices/imfeatureplugin/srcimdatamodel/group/imdatamodelhook.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/imfeatureplugin/srcimdatamodel/group/imdatamodelhook.mmp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,59 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project definition file for IM Feature Plugin +* +*/ + + +#include +#include +#include "../../group/imdlluids.hrh" + + +TARGET imdatamodelhook.dll +CAPABILITY CAP_ECOM_PLUGIN +TARGETTYPE PLUGIN +UID XIMP_IM_DLL_UID_ECOM_PLUGIN XIMP_DLL_UID_IM_DATAMODEL_HOOK +VENDORID VID_DEFAULT + +VERSION 10.0 + +SOURCEPATH ../imdatamodelhook +START RESOURCE imdatamodelhook.rss +TARGET imdatamodelhook.rsc +END + + +SOURCEPATH ../imdatamodelhook +SOURCE imdatamodelhook.cpp + + +USERINCLUDE ../../group +USERINCLUDE ../imdatamodelhook +USERINCLUDE ../../srcimdatamodel + + +MW_LAYER_SYSTEMINCLUDE + + +LIBRARY euser.lib +LIBRARY imdatamodel.lib +LIBRARY ecom.lib + + +#if defined( ARMCC ) +DEFFILE ../../eabi/ +#elif defined ( WINSCW ) +deffile ../../bwins/ +#endif \ No newline at end of file diff -r 000000000000 -r e6b17d312c8b imservices/imfeatureplugin/srcimdatamodel/imapidataobjfactory.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/imfeatureplugin/srcimdatamodel/imapidataobjfactory.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,153 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Base class for API implementations. +* +*/ + +#include "imapidataobjfactory.h" +#include "ximpapidataobjbase.h" + +#include + + +// ============================ MEMBER FUNCTIONS ============================= + + +// --------------------------------------------------------------------------- +// CImEventCodec::NewL() +// --------------------------------------------------------------------------- +// +CImApiDataObjFactory* CImApiDataObjFactory::NewL() + { + CImApiDataObjFactory* self = new( ELeave ) CImApiDataObjFactory() ; + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + + +// --------------------------------------------------------------------------- +// CImEventCodec::ConstructL() +// --------------------------------------------------------------------------- +// +void CImApiDataObjFactory::ConstructL() + { + } + + +/** + * Method to instantiate new data object object + * of requested type and construct it from the stream. + * + * @param aDataObjInterfaceId + * @return Data object constructor function. + */ +CXIMPApiDataObjBase* CImApiDataObjFactory::NewFromStreamLC( + TInt32 aDataObjInterfaceId, + RReadStream& aStream ) + { + return NewDataObjectFromStreamLC( aDataObjInterfaceId, aStream ); + } + +// --------------------------------------------------------------------------- +// CImApiDataObjFactory::CImApiDataObjFactory() +// --------------------------------------------------------------------------- +// +CImApiDataObjFactory::CImApiDataObjFactory() + { + } + +// --------------------------------------------------------------------------- +// CImApiDataObjFactory::~CImApiDataObjFactory() +// --------------------------------------------------------------------------- +// +CImApiDataObjFactory::~CImApiDataObjFactory() + { + } + + +// --------------------------------------------------------------------------- +// ImApiDataObjFactory::InternalizeL +// --------------------------------------------------------------------------- +// +void CImApiDataObjFactory::InternalizeL( + RReadStream& aStream, + RImReqParamArray& aArray ) + { + TInt32 arrLen = aStream.ReadInt32L(); + + for ( TInt i = 0; i < arrLen; i++ ) + { + SImReqParam param; + param.iParamType = aStream.ReadInt32L(); + CXIMPApiDataObjBase* dataObject = NewDataObjectFromStreamLC( param.iParamType, aStream ); + param.iParam = dataObject; + aArray.AppendL( param ); + CleanupStack::Pop( dataObject ); + } + } + +// --------------------------------------------------------------------------- +// ImApiDataObjFactory::ExternalizeL +// --------------------------------------------------------------------------- +// +void CImApiDataObjFactory::ExternalizeL( + RWriteStream& aWs, + const RImReqParamArray& aArray ) + { + // write array length + aWs.WriteInt32L( aArray.Count() ); + + for ( TInt i = 0; i < aArray.Count(); i++ ) + { + // trust the type within the param struct + aWs.WriteInt32L( aArray[ i ].iParamType ); + + // write the actual object + CXIMPApiDataObjBase* theBase = aArray[ i ].iParam; + theBase->ExternalizeL( aWs ); + } + + aWs.CommitL(); + } + +// --------------------------------------------------------------------------- +// ImApiDataObjFactory::InternalizeLC +// --------------------------------------------------------------------------- +// +CXIMPApiDataObjBase* CImApiDataObjFactory::InternalizeLC( + RReadStream& aStream ) + { + TInt32 objType = aStream.ReadInt32L(); + CXIMPApiDataObjBase* dataObject = NewDataObjectFromStreamLC( objType, aStream ); + return dataObject; + } + +// --------------------------------------------------------------------------- +// ImApiDataObjFactory::ExternalizeL +// --------------------------------------------------------------------------- +// +void CImApiDataObjFactory::ExternalizeL( + RWriteStream& aWs, + const CXIMPApiDataObjBase& aDataObj ) + { + aWs.WriteInt32L( aDataObj.Base().GetInterfaceId() ); + aDataObj.ExternalizeL( aWs ); + aWs.CommitL(); + } + + +// End of file + diff -r 000000000000 -r e6b17d312c8b imservices/imfeatureplugin/srcimdatamodel/imapidataobjfactory.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/imfeatureplugin/srcimdatamodel/imapidataobjfactory.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,125 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Codec to pack and unpack data objects. +* +*/ + +#ifndef IMAPIDATAOBJFACTORY_H +#define IMAPIDATAOBJFACTORY_H + +#include +#include "imtypehelpers.h" +#include "ximpapidataobjbase.h" + +// internal interface for the factory +#include "apidataobjfactory.h" + +class RReadStream; +class RWriteStream; + + +/** + * Codec to pack and unpack data object arrays. + * + * @lib ximpdatamodel.dll + * @since S60 v3.2 + */ +NONSHARABLE_CLASS( CImApiDataObjFactory ) : public CBase, + public MApiDataObjFactory + { +public: + + static CImApiDataObjFactory* NewL(); + + // From base class + CXIMPApiDataObjBase* NewFromStreamLC( TInt32 aDataObjInterfaceId, + RReadStream& aStream ); + /** + * Unpacks a request parameter array from a + * descriptor back to array format. + * @param aDataObjArrayData The packed array + * @param aArray The array which to fill + */ + static void InternalizeL( + RReadStream& aStream, + RImReqParamArray& aArray + ); + + /** + * Packs a given request parameter array into + * a stream. + * @param aWs The stream to pack into + * @param aArray The array to pack + */ + static void ExternalizeL( + RWriteStream& aWs, + const RImReqParamArray& aArray + ); + + /** + * Internalize a CXIMPApiDataObjBase-derived object + * from the given stream, ownership is returned to the caller. + * @param aStream The stream + * @return The object instance + */ + static CXIMPApiDataObjBase* InternalizeLC( + RReadStream& aStream ); + + /** + * Externalize a CXIMPApiDataObjBase-derived object + * to the given stream. + * @param aWs The write stream + * @param aDataObj The data object + */ + static void ExternalizeL( + RWriteStream& aWs, + const CXIMPApiDataObjBase& aDataObj ); + + + /* + * Packs a given array into a stream. + * @param aStream The stream + * @param aArray The array + */ + template< class INFOIMP> + static inline void InternalizeL( + RReadStream& aStream, + RPointerArray& aArray + ); + + /** + * Unpacks an array of info fields back to array format. + * @param aWs The stream + * @param aArray The array which to fill + */ + template< class INFOIMP > + static inline void ExternalizeL( + RWriteStream& aWs, + const RPointerArray& aArray + ); + + + ~CImApiDataObjFactory(); +private: + + CImApiDataObjFactory(); + + void ConstructL(); + + }; + +// template methods need inline implementation +#include "imapidataobjfactory.inl" + +#endif // IMAPIDATAOBJFACTORY_H diff -r 000000000000 -r e6b17d312c8b imservices/imfeatureplugin/srcimdatamodel/imapidataobjfactory.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/imfeatureplugin/srcimdatamodel/imapidataobjfactory.inl Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,187 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Inline methods for codec to pack and unpack data objects. +* +*/ + + +#include + +#include "imtypehelpers.h" +#include "imobjectfactory.h" +#include "ximpapidataobjbase.h" +#include "imconversationinfoimp.h" + + +//DATA TYPES + + +// ============================ MEMBER FUNCTIONS ============================= + +/** + * Type definition for exact API data object constructor signature. + */ +typedef CXIMPApiDataObjBase* (*TApiDataObjConstructor)( RReadStream& ); + + + +/** + * Structure for mapping data object interface IDs to + * to corect API data object constructors. + */ +struct SApiDataObjConstructorMap + { + //Interface id + TInt32 iInterfaceId; + + //Function pointer to data object interface implementation + TApiDataObjConstructor iConstructorPtr; + } ; + + + +/** + * Helper macro to initialise KApiDataObjConstructorTable members. + * + * Macro forces that each data object implementation class to have static + * NewFromStreamLC() member function to instantiate the object. + * + * See TApiDataObjConstructor type definition for exact constructor + * signature. + */ +#define CONSTRUCTOR_ENTRY( TheImplementedIf, TheClass ) \ + { TheImplementedIf::KInterfaceId, TheClass::NewFromStreamLC } \ + +/** + * Constructor function mapping for data object interface implementations. + * + * When new data object types are implemented, add them here. + */ + +const SApiDataObjConstructorMap KApiDataObjConstructorTable[] = + { + CONSTRUCTOR_ENTRY( MImConversationInfo, CImConversationInfoImp ), + }; + + +/** + * Count of constructor mappings. + */ +const TInt KApiDataObjConstructorCount = sizeof( KApiDataObjConstructorTable ) + / sizeof( SApiDataObjConstructorMap ); + + + +// ============================ HELPER FUNCTIONS ============================= + + +namespace { + + /** + * Helper function to locate constructor function for + * data object interface ID. + * + * @param aDataObjInterfaceId The data object interface ID. + * @return Data object constructor function. + */ + TApiDataObjConstructor ConstructorForInterface( TInt32 aDataObjInterfaceId ) + { + //Locate correct constructor + for( TInt ix = 0; ix < KApiDataObjConstructorCount; ix++ ) + { + const SApiDataObjConstructorMap map = KApiDataObjConstructorTable[ ix ]; + if( map.iInterfaceId == aDataObjInterfaceId ) + { + return map.iConstructorPtr; + } + } + + + //If assertion below fails, check that data object implementation + //class implementing requested data object interface (aDataObjInterfaceId) + //is registered to KApiDataObjConstructorTable + __ASSERT_DEBUG( EFalse, + User::Panic( _L("ImObjectFactory"), KErrUnknown ) ); + + return NULL; + } + + /** + * Helper function to instantiate new data object object + * of requested type and construct it from the stream. + * + * @param aDataObjInterfaceId + * @return Data object constructor function. + */ + CXIMPApiDataObjBase* NewDataObjectFromStreamLC( TInt32 aDataObjInterfaceId, + RReadStream& aStream ) + { + TApiDataObjConstructor newFromStreamLC = NULL; + + //Locate correct constructor for interface ID + newFromStreamLC = ConstructorForInterface( aDataObjInterfaceId ); + + //Instantiate the object + CXIMPApiDataObjBase* dataObject = newFromStreamLC( aStream ); + + return dataObject; + } + +} // namespace + +// --------------------------------------------------------------------------- +// ImApiDataObjFactory::InternalizeL +// --------------------------------------------------------------------------- +// +template< class INFOIMP > +inline void CImApiDataObjFactory::InternalizeL( + RReadStream& aStream, + RPointerArray& aArray ) + { + TInt32 arrLen = aStream.ReadInt32L(); + + for ( TInt i = 0; i < arrLen; i++ ) + { + TInt paramType = aStream.ReadInt32L(); + INFOIMP* infoObj = ( INFOIMP* ) NewDataObjectFromStreamLC( paramType, aStream ); + aArray.AppendL( infoObj ); + CleanupStack::Pop( infoObj ); + } + } + +// --------------------------------------------------------------------------- +// ImApiDataObjFactory::ExternalizeL +// --------------------------------------------------------------------------- +// +template +inline void CImApiDataObjFactory::ExternalizeL( + RWriteStream& aWs, + const RPointerArray& aArray ) + { + aWs.WriteInt32L( aArray.Count() ); // array length + + for ( TInt i = 0; i < aArray.Count(); i++ ) + { + INFOIMP* infoField = aArray[ i ]; + + // write the type + aWs.WriteInt32L( infoField->Base().GetInterfaceId() ); + + // write the actual object + infoField->ExternalizeL( aWs ); + } + + aWs.CommitL(); + } + diff -r 000000000000 -r e6b17d312c8b imservices/imfeatureplugin/srcimdatamodel/imapidataobjfactoryaccessor.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/imfeatureplugin/srcimdatamodel/imapidataobjfactoryaccessor.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,99 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Base class for API implementations. +* +*/ + +#include "imapidataobjfactoryaccessor.h" +#include "imeventcodec.h" +#include "imapidataobjfactory.h" + +//DATA TYPES + + +// ============================ MEMBER FUNCTIONS ============================= + +// --------------------------------------------------------------------------- +// CImApiDataObjFactoryAccessor::NewL() +// --------------------------------------------------------------------------- +// +EXPORT_C CImApiDataObjFactoryAccessor* CImApiDataObjFactoryAccessor::NewL() + { + CImApiDataObjFactoryAccessor* self = new( ELeave ) CImApiDataObjFactoryAccessor() ; + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + + +// --------------------------------------------------------------------------- +// CImApiDataObjFactoryAccessor::ConstructL() +// --------------------------------------------------------------------------- +// +void CImApiDataObjFactoryAccessor::ConstructL() + { + // FIXME: would be probably better to have the Event Codec and other factories as singleton + iImEventCodec = CImEventCodec::NewL(); + iImApiDataObjFactory = CImApiDataObjFactory::NewL(); + } + + +// --------------------------------------------------------------------------- +// CImApiDataObjFactoryAccessor::CImApiDataObjFactoryAccessor() +// --------------------------------------------------------------------------- +// +CImApiDataObjFactoryAccessor::CImApiDataObjFactoryAccessor() + { + } + +// --------------------------------------------------------------------------- +// CImApiDataObjFactoryAccessor::~CImApiDataObjFactoryAccessor() +// --------------------------------------------------------------------------- +// +CImApiDataObjFactoryAccessor::~CImApiDataObjFactoryAccessor() + { + delete iImEventCodec; + delete iImApiDataObjFactory; + } + + +// --------------------------------------------------------------------------- +// CImApiDataObjFactoryAccessor::EventCodec() +// --------------------------------------------------------------------------- +// +MEventCodec& CImApiDataObjFactoryAccessor::EventCodec() + { + return *iImEventCodec; + } + +// --------------------------------------------------------------------------- +// CImApiDataObjFactoryAccessor::ApiDataObjFactory() +// --------------------------------------------------------------------------- +// +MApiDataObjFactory& CImApiDataObjFactoryAccessor::ApiDataObjFactory() + { + return *iImApiDataObjFactory; + } + + + +// End of file + + + + + + + diff -r 000000000000 -r e6b17d312c8b imservices/imfeatureplugin/srcimdatamodel/imapidataobjfactoryaccessor.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/imfeatureplugin/srcimdatamodel/imapidataobjfactoryaccessor.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,66 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Codec to pack and unpack data objects. +* +*/ + +#ifndef IMAPIDATAOBJFACTORYACCESSOR_H +#define IMAPIDATAOBJFACTORYACCESSOR_H + +#include "apidataobjfactoryaccessor.h" + +class MEventCodec; +class CImEventCodec; +class MApiDataObjFactory; +class CImApiDataObjFactory; +class MApiDataObjFactoryAccessor; +/** + * Class to access the different object factories in the datamodel + * + * @lib ximpdatamodel.dll + * @since S60 v3.2 + */ +NONSHARABLE_CLASS( CImApiDataObjFactoryAccessor ) : public MApiDataObjFactoryAccessor + { +public: + IMPORT_C static CImApiDataObjFactoryAccessor* NewL(); + + MApiDataObjFactory& ApiDataObjFactory(); + + MEventCodec& EventCodec(); + + ~CImApiDataObjFactoryAccessor(); + +private: + + CImApiDataObjFactoryAccessor(); + void ConstructL(); + +//data +private: + // Own + CImEventCodec* iImEventCodec; + + // Own + CImApiDataObjFactory* iImApiDataObjFactory; + + }; + +#endif // IMAPIDATAOBJFACTORYACCESSOR_H + + + + + + diff -r 000000000000 -r e6b17d312c8b imservices/imfeatureplugin/srcimdatamodel/imapiobjbase.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/imfeatureplugin/srcimdatamodel/imapiobjbase.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,59 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Base class for XIMP API implementations. +* +*/ + +#ifndef IMAPIOBJBASE_H +#define IMAPIOBJBASE_H + + +/** + * IM plugin class implementation UIDs. + * + * These do not have to be "real" Symbian UIDs, but such ID's, + * that they do not overlap with XIMP or IM Plugin API interface IDs. + */ + +// 90xx - ximp related +// 91xx - im related +// 92xx - instant messaging related + + +const TInt KArrayGranularity( 2 ); + +// IM plugin events +#define IMIMP_CLSID_CPROTOCOLIMCONVERSATIONDATAHOST 9200 + +// Im datamodel classes +#define IMIMP_CLSID_CIMDATACACHE 9210 +#define IMIMP_CLSID_CIMCONVERSATIONINFOIMP 9211 +#define IMIMP_CLSID_CIMCONVERSATIONEVENTIMP 9212 +#define IMIMP_CLSID_CIMOBJECTFACTORYIMP 9213 +#define IMIMP_CLSID_CIMOPERATIONFACTORYIMP 9214 +// Im plugin host environment classes +#define IMIMP_CLSID_CPROTOCOLIMDATAHOSTIMP 9230 + + +// IM Management classes + +#define IMIMP_CLSID_CIMSEARCHIMP 9240 +#define IMIMP_CLSID_CONVERSATIONIMP 9241 +#define IMIMP_CLSID_CIMGROUPSIMP 9242 +#define IMIMP_CLSID_CIMINVITATIONIMP 9243 +#define IMIMP_CLSID_CIMFEATURESIMP 9244 + + + +#endif // IMAPIOBJBASE_H diff -r 000000000000 -r e6b17d312c8b imservices/imfeatureplugin/srcimdatamodel/imconversation/conversationsubscriptionitem.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/imfeatureplugin/srcimdatamodel/imconversation/conversationsubscriptionitem.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,111 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: IM Service Connection Conversation subscription implementation. +* +*/ + + +#include + +#include "ximpimitemparent.h" +//#include "ximppanics.h" +//#include "ximppsccontext.h" +//#include "ximpobjecthelpers.h" +#include "imtypehelpers.h" +#include "imconversationeventimp.h" +//#include "ximpidentityimp.h" +//#include "ximpdatasubscriptionstateimp.h" +#include "conversationsubscriptionitem.h" + +// --------------------------------------------------------------------------- +// CConversationSubscriptionItem::CConversationSubscriptionItem() +// --------------------------------------------------------------------------- +// +CConversationSubscriptionItem::CConversationSubscriptionItem( MXIMPItemParentBase& aParent ) +: CXIMPSubscriptionItemBase( aParent ) + { + } + + +// --------------------------------------------------------------------------- +// CConversationSubscriptionItem::ConstructL() +// --------------------------------------------------------------------------- +// +void CConversationSubscriptionItem::ConstructL() + { + } + + +// --------------------------------------------------------------------------- +// CConversationSubscriptionItem::NewL() +// --------------------------------------------------------------------------- +// +CConversationSubscriptionItem* CConversationSubscriptionItem::NewLC( MXIMPItemParentBase& aParent ) + { + CConversationSubscriptionItem* self = new( ELeave ) CConversationSubscriptionItem( aParent ); + CleanupClosePushL( *self ); + self->ConstructL(); + return self; + } + + +// --------------------------------------------------------------------------- +// CConversationSubscriptionItem::~CConversationSubscriptionItem() +// --------------------------------------------------------------------------- +// +EXPORT_C CConversationSubscriptionItem::~CConversationSubscriptionItem() + { + MXIMPIMItemParent* imCache = static_cast(iParent.GetInterface(IM_ITEM_PARENT)); + imCache->RemoveMe( this ); + } + +// --------------------------------------------------------------------------- +// From MXIMPSubscriptionItem class. +// CConversationSubscriptionItem::SynthesiseSubscriptionEventTo() +// --------------------------------------------------------------------------- +// +void CConversationSubscriptionItem::SynthesiseSubscriptionEventToL( + MXIMPPscContext* aContext, TBool /*aForceEvent*/ ) + { + + CImConversationEventImp* newEvent = CImConversationEventImp::NewLC( iConvinfo ); + if( newEvent ) + { + MXIMPIMItemParent* imCache = static_cast(iParent.GetInterface(IM_ITEM_PARENT)); + //static_cast(iParent).AddEventL( *newEvent, aContext ); + imCache->AddEventL( *newEvent, aContext ); + } + CleanupStack::PopAndDestroy( newEvent ); //newEvent + } + + +// --------------------------------------------------------------------------- +// CConversationSubscriptionItem::SetNewListL() +// --------------------------------------------------------------------------- +// +EXPORT_C void CConversationSubscriptionItem::SetConversationInfoL(CImConversationInfoImp* aConvinfo) + { + iConvinfo = aConvinfo; + } +// --------------------------------------------------------------------------- +// CGroupListSubscriptionItem::CleanExpired() +// --------------------------------------------------------------------------- +// +void CConversationSubscriptionItem::CleanExpired() + { + + } + + +// End of file diff -r 000000000000 -r e6b17d312c8b imservices/imfeatureplugin/srcimdatamodel/imconversation/conversationsubscriptionitem.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/imfeatureplugin/srcimdatamodel/imconversation/conversationsubscriptionitem.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,104 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: IM Service Connection IM conversation subscription implementation. +* +*/ + +#ifndef CPSCCONVERSATIONSUBSCRIPTIONITEM_H +#define CPSCCONVERSATIONSUBSCRIPTIONITEM_H + +#include +#include "ximpsubscriptionitem.h" +#include "imtypehelpers.h" +#include "ximpsubscriptionitembase.h" + +class MXIMPIMItemParent; +class MXIMPPscContext; +class CXIMPPscContext; +class CDesC16Array; +class CImConversationInfoImp; +class MImConversationInfo; +/** + * PSC group list subscription implementation + * + * @since S60 v3.2 + */ +class CConversationSubscriptionItem : public CXIMPSubscriptionItemBase + { + +public: // Construction and destruction + + /** + * Construction + * @param aParent. Parent has to be informed when this object is deleted by RemoveMe method. + */ + static CConversationSubscriptionItem* NewLC( MXIMPItemParentBase& aParent ); + + /** + * Destruction + * - Remember to inform parent about delete. + */ + IMPORT_C virtual ~CConversationSubscriptionItem(); + +private: // Construction and destruction + + /** + * Construction + * @param aParent. Parent has to be informed when this object is deleted by RemoveMe method. + */ + CConversationSubscriptionItem( MXIMPItemParentBase& aParent ); + + /** + * Construction + */ + void ConstructL(); + +public: // New methods + + /** + * Resolves deltas from new list and replaces old current. + * Ownership is transferred! + * @param aList New blocklist. + */ + void SetConversationInfoL(CImConversationInfoImp* aImMessage); +public: // From MXIMPSubscriptionItem + + /** + * @see MXIMPSubscriptionItem + */ + void SynthesiseSubscriptionEventToL( MXIMPPscContext* aContext, TBool aForceEvent ); +private: // From CXIMPSubscriptionItemBase + + /** + * @see CXIMPSubscriptionItemBase + */ + void CleanExpired(); + +private : + /** + * conversation info :Not owned + */ + + CImConversationInfoImp* iConvinfo; + + //MXIMPItemParentBase& iParent; + + }; + + +/* ======================================================================== */ + + + +#endif // CPSCCONVERSATIONSUBSCRIPTIONITEM_H diff -r 000000000000 -r e6b17d312c8b imservices/imfeatureplugin/srcimdatamodel/imconversation/imconversationeventimp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/imfeatureplugin/srcimdatamodel/imconversation/imconversationeventimp.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,162 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MImConversationEvent API object implementation. + * +*/ + +#include "imconversationeventimp.h" +#include "ximpapiobjbase.h" +#include "ximpapieventbase.h" +#include "imconversationinfoimp.h" +#include +//#include "ximpobjecthelpers.h" +// --------------------------------------------------------------------------- +// CImConversationEventImp::NewLC() +// --------------------------------------------------------------------------- +// +EXPORT_C CImConversationEventImp* CImConversationEventImp::NewLC(CImConversationInfoImp* aConvinfo) + { + CImConversationEventImp* self = new( ELeave ) CImConversationEventImp(); + CleanupStack::PushL( self ); + self->ConstructL( aConvinfo ); + return self; + } + +// --------------------------------------------------------------------------- +// CImConversationEventImp::NewFromStreamLC() +// --------------------------------------------------------------------------- +// +CXIMPApiEventBase* CImConversationEventImp::NewFromStreamLC( RReadStream& aStream ) + { + CImConversationEventImp* self = new( ELeave ) CImConversationEventImp; + CleanupStack::PushL( self ); + self->ConstructL( aStream ); + return self; + } +// --------------------------------------------------------------------------- +// CImConversationEventImp::EqualsContent +// --------------------------------------------------------------------------- +// +TBool CImConversationEventImp::EqualsContent( + const CXIMPApiEventBase& /*aOtherInstance */) const + { + return ETrue; + } + +// --------------------------------------------------------------------------- +// From class CXIMPApiEventBase +// CImConversationEventImp::ExternalizeL +// --------------------------------------------------------------------------- +// +void CImConversationEventImp::ExternalizeL( RWriteStream& aStream ) const + { + iConvInfo->ExternalizeL( aStream ); + } + + +// --------------------------------------------------------------------------- +// CImConversationEventImp::~CImConversationEventImp() +// --------------------------------------------------------------------------- +// +CImConversationEventImp::~CImConversationEventImp() + { + delete iConvInfo; + } + + +// --------------------------------------------------------------------------- +// CImConversationEventImp::CImConversationEventImp() +// --------------------------------------------------------------------------- +// +CImConversationEventImp::CImConversationEventImp() + { + } + + +// --------------------------------------------------------------------------- +// CImConversationEventImp::ConstructL() +// --------------------------------------------------------------------------- +// +void CImConversationEventImp::ConstructL(CImConversationInfoImp* aConvinfo) + { + iConvInfo = aConvinfo; // ownership is transfered here, need to delete iConvInfo + } + + +// --------------------------------------------------------------------------- +// CImConversationEventImp::ConstructL() +// --------------------------------------------------------------------------- +// +void CImConversationEventImp::ConstructL( RReadStream& aStream ) + { + iConvInfo=CImConversationInfoImp::NewL(); + iConvInfo->InternalizeL( aStream ); + } + +// --------------------------------------------------------------------------- +// Implement supported interface access. +// --------------------------------------------------------------------------- +// +XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CImConversationEventImp, + MImConversationEvent ) + XIMPIMP_IF_BASE_GET_CLASS( CXIMPApiEventBase, this ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + +XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CImConversationEventImp, + MImConversationEvent ) + XIMPIMP_IF_BASE_GET_CONST_CLASS( CXIMPApiEventBase, this ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + + + +// --------------------------------------------------------------------------- +// Implement methods from base event interface and base event class +// --------------------------------------------------------------------------- +// +XIMPIMP_IMPLEMENT_EVENT_BASE_METHODS( CImConversationEventImp, + MImConversationEvent ) + + + + +// --------------------------------------------------------------------------- +// CImConversationEventImp::InternalizeL( ) +// --------------------------------------------------------------------------- +// + +void CImConversationEventImp::InternalizeL( RReadStream& aStream ) + { + iConvInfo->InternalizeL( aStream ); + } + +// --------------------------------------------------------------------------- +// CImConversationEventImp::NewTextMessage() +// --------------------------------------------------------------------------- +// +const MImConversationInfo& CImConversationEventImp:: NewTextMessage( TInt /*aIndex*/ ) const + { + return *iConvInfo; + } + +// --------------------------------------------------------------------------- +// CImConversationEventImp::NewTextMessageCount() +// --------------------------------------------------------------------------- +// + +TInt CImConversationEventImp::NewTextMessageCount() const + { + return 1; // since the count is always 1 + } +// End of file + diff -r 000000000000 -r e6b17d312c8b imservices/imfeatureplugin/srcimdatamodel/imconversation/imconversationeventimp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/imfeatureplugin/srcimdatamodel/imconversation/imconversationeventimp.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,124 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MImConversationEvent API object implementation. + * +*/ + +#ifndef CIMCONVERSATIONEVENTIMP_H +#define CIMCONVERSATIONEVENTIMP_H + +#include +#include "ximpapieventbase.h" +#include +//#include "ximpdatasubscriptionstateimp.h" +#include "imapiobjbase.h" + + +class RReadStream; +class CXIMPIdentityImp; +class CImConversationInfoImp; +class CXIMPDataSubscriptionStateImp; + + +/** + * MImConversationEvent API object implementation. + * + * @lib Imdatamodel.dll + * + */ +NONSHARABLE_CLASS( CImConversationEventImp ): public CXIMPApiEventBase,public MImConversationEvent + { +public: + /** The class ID. */ + enum { KClassId = IMIMP_CLSID_CIMCONVERSATIONEVENTIMP }; + +public: + /** + * Exported instantiation method for initializing + * new event object. + */ + IMPORT_C static CImConversationEventImp* NewLC( + CImConversationInfoImp* aConvinfo + ); + + /** + * Instantiation method for event automation. + * Method signature must be exactly this to work + * with event delivery automation system. + * + * Event implementation must be registered to + * ImEventCodec KImEventConstructorTable. + */ + static CXIMPApiEventBase* NewFromStreamLC( RReadStream& aStream ); + + virtual ~CImConversationEventImp(); + +private: + CImConversationEventImp(); + + void ConstructL( CImConversationInfoImp* aConvinfo ); + + + void ConstructL( RReadStream& aStream ); + + + + /** + * Helper for internalize + */ + void InternalizeL( RReadStream& aStream ) ; + + + +public: // From API base interfaces + + /** + * Implementation of MXIMPBase interface methods + * @see MXIMPBase + */ + XIMPIMP_DECLARE_IF_BASE_METHODS + + /** + * Implementation of MImEventBase interface and + * CImApiEventBase methods + * + * @see MImEventBase + * @see CImApiEventBase + */ + XIMPIMP_DECLARE_EVENT_BASE_METHODS + + +public: // From MImConversationEvent + /** + * + * @see MImConversationEvent + */ + + TInt NewTextMessageCount() const; + const MImConversationInfo& NewTextMessage( TInt aIndex ) const ; + + + +private: // data + + /** + * Conversation Info + * Own. + */ + CImConversationInfoImp* iConvInfo; + + }; + + +#endif // CIMCONVERSATIONEVENTIMP_H diff -r 000000000000 -r e6b17d312c8b imservices/imfeatureplugin/srcimdatamodel/imconversation/imconversationinfoimp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/imfeatureplugin/srcimdatamodel/imconversation/imconversationinfoimp.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,247 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MImConversationInfo API object implementation. +* +*/ + +#include "imconversationinfoimp.h" +#include "ximpidentityimp.h" +#include "ximprbufhelpers.h" +//#include "ximpobjecthelpers.h" + +// ============================ MEMBER FUNCTIONS ============================= + +// --------------------------------------------------------------------------- +// CImConversationInfoImp::NewLC() +// --------------------------------------------------------------------------- +// +EXPORT_C CImConversationInfoImp* CImConversationInfoImp::NewLC() + { + CImConversationInfoImp* self = new( ELeave ) CImConversationInfoImp; + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + + +// --------------------------------------------------------------------------- +// CImConversationInfoImp::NewL() +// --------------------------------------------------------------------------- +// +EXPORT_C CImConversationInfoImp* CImConversationInfoImp::NewL() + { + CImConversationInfoImp* self = NewLC(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// CImConversationInfoImp::NewFromStreamLC() +// --------------------------------------------------------------------------- +// +XIMPIMP_IMPLEMENT_DATAOBJ_NEWFROMSTREAM( CImConversationInfoImp ) + +// --------------------------------------------------------------------------- +// Implement supported interface access. +// --------------------------------------------------------------------------- +// +XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CImConversationInfoImp, MImConversationInfo ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() +XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CImConversationInfoImp, MImConversationInfo ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + +// --------------------------------------------------------------------------- +// CImConversationInfoImp::~CImConversationInfoImp() +// --------------------------------------------------------------------------- +// +CImConversationInfoImp::~CImConversationInfoImp() + { + iTextMessage.Close(); + if(iIdentity != NULL) + { + delete iIdentity; + } + if(iRecipients != NULL) + { + iRecipients->Reset(); + delete iRecipients; + } + + } + +// --------------------------------------------------------------------------- +// CImConversationInfoImp::CImConversationInfoImp() +// --------------------------------------------------------------------------- +// +CImConversationInfoImp::CImConversationInfoImp() + { + } + + +// --------------------------------------------------------------------------- +// CImConversationInfoImp::ConstructL() +// --------------------------------------------------------------------------- +// +void CImConversationInfoImp::ConstructL() + { + iTextMessage.CreateL( 0 ); + iRecipients = new( ELeave ) CDesCArrayFlat( KArrayGranularity ); + iIdentity = CXIMPIdentityImp::NewLC(); + CleanupStack::Pop( iIdentity ); + } + +// --------------------------------------------------------------------------- +// CImConversationInfoImp::ExternalizeL() +// --------------------------------------------------------------------------- +// +void CImConversationInfoImp::ExternalizeL( RWriteStream& aStream ) const + { + iIdentity->ExternalizeL( aStream ); + XIMPRBuf16Helper::ExternalizeL( iTextMessage, aStream ); + for(TInt index=0;indexMdcaCount();index++) + { + RBuf16 userId; + userId.Create(iRecipients->MdcaPoint(index)); + XIMPRBuf16Helper::ExternalizeL(userId, aStream ); + userId.Close(); + } + } + +// --------------------------------------------------------------------------- +// CImConversationInfoImp::InternalizeL() +// --------------------------------------------------------------------------- +// +EXPORT_C void CImConversationInfoImp::InternalizeL( RReadStream& aStream ) + { + iIdentity->InternalizeL( aStream ); + XIMPRBuf16Helper::InternalizeL( iTextMessage, aStream ); + TInt length = 0; + + TRAP_IGNORE(length = aStream.ReadInt32L()); + for ( TInt i = 0; i < length; i++ ) + { + RBuf16 userId; + XIMPRBuf16Helper::GrowIfNeededL( userId, length ); + aStream.ReadL( userId, length ); + iRecipients->AppendL(userId); + userId.Close(); + TRAPD(leavecode,length = aStream.ReadInt32L()); + if(leavecode != KErrNone) // if end of the Stream leavecode = KErrEof(-25) + break; + } + } + + +// --------------------------------------------------------------------------- +// From MImConversationInfo class. +// CImConversationInfoImp::GroupId() +// --------------------------------------------------------------------------- +// +const MXIMPIdentity& CImConversationInfoImp::MessageId() const + { + return *iIdentity; + } + + +// --------------------------------------------------------------------------- +// From MImConversationInfo class. +// CImConversationInfoImp::TextMessage() +// --------------------------------------------------------------------------- +// +const TDesC16& CImConversationInfoImp::TextMessage() const + { + return iTextMessage; + } + +// --------------------------------------------------------------------------- +// From MImConversationInfo class. +// CImConversationInfoImp::RecipientL() +// --------------------------------------------------------------------------- +// +const MDesCArray& CImConversationInfoImp::RecipientL() const + { + return *iRecipients; + } + +// --------------------------------------------------------------------------- +// From MImConversationInfo class. +// CImConversationInfoImp::SetMessageIdL() +// --------------------------------------------------------------------------- +// +void CImConversationInfoImp::SetMessageIdL( MXIMPIdentity* aIdentity ) + { + CXIMPIdentityImp* identityImp = + TXIMPGetImpClassOrPanic< CXIMPIdentityImp>::From( *aIdentity ); + + delete iIdentity; + iIdentity = identityImp; + } + + +// --------------------------------------------------------------------------- +// From MImConversationInfo class. +// CImConversationInfoImp::SetTextMessageL() +// --------------------------------------------------------------------------- +// +void CImConversationInfoImp::SetTextMessageL( + const TDesC16& aTextMessage ) + { + HBufC16* TextMessageBuf = aTextMessage.AllocL(); + iTextMessage.Close(); + iTextMessage.Assign( TextMessageBuf ); + } + +// --------------------------------------------------------------------------- +// From MImConversationInfo class. +// CImConversationInfoImp::SetRecipientL() recipient +// --------------------------------------------------------------------------- +// +void CImConversationInfoImp::SetRecipientL(const MDesCArray* aRecipients) + { + for(TInt index=0;indexMdcaCount();index++) + { + HBufC* userId = aRecipients->MdcaPoint( index ).AllocL(); + CleanupStack::PushL( userId ); + iRecipients->AppendL(*userId); + CleanupStack::PopAndDestroy( userId ); // buf + } + } +// --------------------------------------------------------------------------- +// CImConversationInfoImp::Identity +// --------------------------------------------------------------------------- +// +EXPORT_C const CXIMPIdentityImp& CImConversationInfoImp::IdentityImp() const + { + return *iIdentity; + } +// --------------------------------------------------------------------------- +// CImConversationInfoImp::SetIdentityL() +// --------------------------------------------------------------------------- +// +EXPORT_C void CImConversationInfoImp::SetIdentity( CXIMPIdentityImp* aIdentity ) + { + delete iIdentity; + iIdentity = aIdentity; + } +// --------------------------------------------------------------------------- +// CImConversationInfoImp::EqualsContent() +// --------------------------------------------------------------------------- +// +TBool CImConversationInfoImp::EqualsContent( + const CXIMPApiDataObjBase& /*aOtherInstance*/ ) const + { + return ETrue; + } + +// End of file diff -r 000000000000 -r e6b17d312c8b imservices/imfeatureplugin/srcimdatamodel/imconversation/imconversationinfoimp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/imfeatureplugin/srcimdatamodel/imconversation/imconversationinfoimp.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,139 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MImConversationInfo API object implementation. +* +*/ + +#ifndef CIMCONVERSATIONINFOIMP_H +#define CIMCONVERSATIONINFOIMP_H + + +#include +#include +#include +#include "ximpapidataobjbase.h" +#include "imapiobjbase.h" + + +class CImConversationInfoImp; +class CXIMPIdentityImp; +/** + * MImConversationInfo API object implementation. + * + * @lib Imdatamodel.dll + * + */ +NONSHARABLE_CLASS( CImConversationInfoImp ): public CXIMPApiDataObjBase,public MImConversationInfo + { + public: + /** The class ID. */ + enum { KClassId = IMIMP_CLSID_CIMCONVERSATIONINFOIMP }; + +public: + IMPORT_C static CImConversationInfoImp* NewLC(); + IMPORT_C static CImConversationInfoImp* NewL(); + virtual ~CImConversationInfoImp(); + +private: + + CImConversationInfoImp(); + void ConstructL(); + +public: // From CXIMPApiDataObjBase + + /** + * @see CXIMPApiDataObjBase + */ + XIMPIMP_DECLARE_DATAOBJ_BASE_METHODS + XIMPIMP_DECLARE_IF_BASE_METHODS + +public: // From MImConversationInfo + + const MXIMPIdentity& MessageId() const; + const TDesC16& TextMessage() const; + const MDesCArray& RecipientL() const; +/* const TDesC16& TextMessageSubject() const; + const TMessageTypes& MessageType() const; + const TDesC16& ContentMessage() const; + const TInt DeliveryReportResult() const; + const TDesC16& DeliveryReportDescription() const; + const MXIMPIdentity& ExtConvId() const; + const TDesC16& ExtConvGroupId() const; + const MXIMPIdentity& BlockedEntityId() const; + const TDesC16& BlockedEntityDisplayName() const; +*/ + + void SetMessageIdL( MXIMPIdentity* aIdentity ); + void SetTextMessageL( const TDesC16& aMessage ); + void SetRecipientL(const MDesCArray* aRecipients); + + /*void SetMessageSubjectL( const TDesC16& aMessageSubject ); + void SetMessageTypeL( const TDesC16& aMessageType ); + void SetContentMessageL( const TDesC16& aContMessage ); + void SetExtConvIdL( MXIMPIdentity* aExIdentity ); + void SetDeliveryReportResultL( const TInt aResult ); + void SetDeliveryReportDescriptionL( const TDesC16& aDescription ); + void SetExtConvGroupIdL( const TDesC16& aGroupId ); + void SetBlockedEntityIdL( MXIMPIdentity* aBlkIdentity ); + void SetBlockedEntityDisplayNameL( const TDesC16& aDisplayName ); + */ +public: // New functions + + /** + * Internalizes object data from given stream. + * @param aStream Stream to read. + */ + IMPORT_C void InternalizeL( RReadStream& aStream ); + + /** + * Set identity + */ + IMPORT_C void SetIdentity( CXIMPIdentityImp* aIdentity ); + + /** + * TLinearOrder for ordering based on stored group id, + * when this class is used within an RPointerArray or derivatives. + */ + IMPORT_C static TInt IdLinearOrder( + const CImConversationInfoImp& aA, + const CImConversationInfoImp& aB ); + + /** + * Access to identity object + * @return Identity + */ + IMPORT_C const CXIMPIdentityImp& IdentityImp() const; + +private: // data + + /** + * Identity + */ + CXIMPIdentityImp* iIdentity; + + /** + * TextMessage + */ + RBuf16 iTextMessage; + + /** + * Receipient(s) of the Message + */ + CDesCArray* iRecipients ; + + + }; + + +#endif // CIMCONVERSATIONINFOIMP_H diff -r 000000000000 -r e6b17d312c8b imservices/imfeatureplugin/srcimdatamodel/imdatacacheimp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/imfeatureplugin/srcimdatamodel/imdatacacheimp.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,171 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: IM Service Connection data cache implementation. + * +*/ + + +#include +#include + +#include "imdatacacheimp.h" +//#include "ximpidentityimp.h" +//#include "ximpobjecthelpers.h" +#include "ximphost.h" +//#include "ximppsccontext.h" +//#include "ximpoperationdefs.h" +#include "ximpapieventbase.h" +//#include "ximptrace.h" +#include "conversationsubscriptionitem.h" +#include "imconversationeventimp.h" + +// --------------------------------------------------------------------------- +// CImDataCache::CImDataCache() +// --------------------------------------------------------------------------- +// +CImDataCache::CImDataCache( MXIMPHost& aHost ) +:iHost( aHost ) + { + } +// --------------------------------------------------------------------------- +// CImDataCache::ConstructL() +// --------------------------------------------------------------------------- +// +void CImDataCache::ConstructL() + { + + } +// --------------------------------------------------------------------------- +// CImDataCache::NewL() +// --------------------------------------------------------------------------- +// +EXPORT_C CImDataCache* CImDataCache::NewL( MXIMPHost& aHost ) + { + CImDataCache* self = new( ELeave ) CImDataCache( aHost ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } +// --------------------------------------------------------------------------- +// CImDataCache::~CImDataCache() +// --------------------------------------------------------------------------- +// +CImDataCache::~CImDataCache() + { + + } +// --------------------------------------------------------------------------- +// CImDataCache::RemoveMe +// --------------------------------------------------------------------------- +// +template< class Type > +EXPORT_C void CImDataCache::RemoveMe( Type*& aItem, Type* aChild ) + { + if( aChild == aItem ) + { + aItem = NULL; + } + } +// --------------------------------------------------------------------------- +// CImDataCache::AddEventL +// --------------------------------------------------------------------------- +// +void CImDataCache::AddEventL( CXIMPApiEventBase& aEvent, MXIMPPscContext* aContext ) + { + iHost.AddEventL( aEvent, aContext ); + } + +// --------------------------------------------------------------------------- +// CImDataCache::RegisterExpiringItemL +// --------------------------------------------------------------------------- +// +void CImDataCache::RegisterExpiringItemL( CXIMPSubscriptionItemBase* /*aExpireItem*/ ) + { + + } +// --------------------------------------------------------------------------- +// CImDataCache::UnregisterExpiringItemL +// --------------------------------------------------------------------------- +// +void CImDataCache::UnregisterExpiringItem( CXIMPSubscriptionItemBase* /*aExpireItem*/ ) + { + + } +// --------------------------------------------------------------------------- +// CImDataCache::ItemLC +// --------------------------------------------------------------------------- +// +template< class Type > +Type& CImDataCache::ItemLC( Type*& aItem ) + { + if( !aItem ) + { + aItem = Type::NewLC( *this ); + } + else + { + User::LeaveIfError( aItem->Open() ); + CleanupClosePushL( *aItem ); + } + return *aItem; + } +// --------------------------------------------------------------------------- +// CImDataCache::CleanResources +// --------------------------------------------------------------------------- +// +EXPORT_C void CImDataCache::CleanResources( MXIMPPscContext& /*aContext*/ ) + { + + } +// --------------------------------------------------------------------------- +// CImDataCache::CleanExpired +// --------------------------------------------------------------------------- +// +EXPORT_C void CImDataCache::CleanExpired() + { + + } +// --------------------------------------------------------------------------- +// CImDataCache::RemoveMe +// --------------------------------------------------------------------------- +// +void CImDataCache::RemoveMe( CConversationSubscriptionItem* aChild ) + { + RemoveMe< CConversationSubscriptionItem >( + iConversationSubscriptionItem, aChild ); + } +// --------------------------------------------------------------------------- +// CImDataCache::ConversationSubscriptionItemLC +// --------------------------------------------------------------------------- +// +EXPORT_C CConversationSubscriptionItem& CImDataCache::ConversationSubscriptionItemLC() + { + return ItemLC< CConversationSubscriptionItem >( iConversationSubscriptionItem ); + } + +TAny* CImDataCache::GetInterface(TInt aInterfaceId) + { + if(aInterfaceId == IM_ITEM_PARENT) + { + return static_cast(this) ; + } + else + { + User::Panic( _L("CXIMPIMCache"), KErrExtensionNotSupported ); + } + return NULL ; + } + +// End of file diff -r 000000000000 -r e6b17d312c8b imservices/imfeatureplugin/srcimdatamodel/imdatacacheimp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/imfeatureplugin/srcimdatamodel/imdatacacheimp.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,142 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: IM data cache implementation. +* +*/ + +#ifndef CIMDATACACHEIMP_H +#define CIMDATACACHEIMP_H + +#include "ximpapiobjbase.h" +#include "imapiobjbase.h" +//#include "ximpitemparent.h" +#include "ximpimitemparent.h" +#include "imtypehelpers.h" +//#include "ximpoperationdefs.h" +#include "ximpapieventbase.h" + +class MXIMPHost; +class CConversationSubscriptionItem; +class CXIMPIdentityImp; +class MXIMPPscContext; +class CXIMPIMSubscriptionItemBase; +class MXIMPStatus; +class MXIMPIdentity; +class MXIMPDataSubscriptionState; +class CXIMPDataSubscriptionStateImp; + + +/** + * PSC Im Data Cache implementation. + * + * @since S60 v3.2 + */ +class CImDataCache : public CBase, + public MXIMPIMItemParent + { +public: // Definitions + + /** The class ID. */ + enum { KClassId = IMIMP_CLSID_CIMDATACACHE }; + + +public: // Construction and destruction + + /** + * Construction + */ + IMPORT_C static CImDataCache* NewL( MXIMPHost& aHost ); + + /** + * Destruction + */ + virtual ~CImDataCache(); + +private: + + CImDataCache( MXIMPHost& aHost ); + void ConstructL(); + +private: // MXIMPIMItemParentBase + + TAny* GetInterface(TInt aInterfaceId); + // Expiring items + void RegisterExpiringItemL( CXIMPSubscriptionItemBase* aExpireItem ); + void UnregisterExpiringItem( CXIMPSubscriptionItemBase* aExpireItem ); + +private: // From MXIMPIMItemParent + + /** + * @see MXIMPIMItemParent + */ + void RemoveMe( CConversationSubscriptionItem* aChild ); + + // Other methods + void AddEventL( CXIMPApiEventBase& aEvent, MXIMPPscContext* aContext ); + +public: // New methods + + /** + * - If CConversationSubscriptionItem is not found, data cache + * initializes new one and returns ownership to caller + * - If CConversationSubscriptionItem is found, data cache increases + * refcount by one, and returns the old object + */ + IMPORT_C CConversationSubscriptionItem& ConversationSubscriptionItemLC(); + /** + * Clean resources concerning context. + */ + IMPORT_C void CleanResources( MXIMPPscContext& aContext ); + + /** + * + */ + IMPORT_C void CleanExpired(); + +private: // Helper methods + + /** + * Template method for removeMe when one subscription item is target. + * @param aItem Reference to subscription item pointer to remove. + * @param Pointer of item to remove. + */ + template< class Type > + IMPORT_C static void RemoveMe( Type*& aItem, Type* aChild ); + + + /** + * Templated item instance creation. If item is not found it is created. + * @param aItem Reference to pointer where new item should be saved. + * @return Reference to item created. + */ + template< class Type > + Type& ItemLC( Type*& aItem ); + + + +private: // Data + + /** + * Access to host. + */ + MXIMPHost& iHost; + + /** + * Does not own. Removed when RemoveMe called. + */ + CConversationSubscriptionItem* iConversationSubscriptionItem; + + }; + +#endif // CIMDATACACHEIMP_H diff -r 000000000000 -r e6b17d312c8b imservices/imfeatureplugin/srcimdatamodel/imdatamodelhook/imdatamodelhook.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/imfeatureplugin/srcimdatamodel/imdatamodelhook/imdatamodelhook.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,46 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework's IM Data Model Hook implementation. +* +*/ + + +#include "imdlluids.hrh" +#include "imapidataobjfactoryaccessor.h" +#include +#include + + +// --------------------------------------------------------------------------- +// Key value pair table to identify correct constructor +// function for the requested interface. +// --------------------------------------------------------------------------- +// +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY( XIMP_ECOM_IMPL_UID_IM_DATAMODEL_INTERFACE, + CImApiDataObjFactoryAccessor::NewL ) + }; + + +// --------------------------------------------------------------------------- +// Exported function to return the implementation proxy table +// --------------------------------------------------------------------------- +// +EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount ) + { + aTableCount = sizeof( ImplementationTable ) / sizeof( TImplementationProxy ); + return ImplementationTable; + } + diff -r 000000000000 -r e6b17d312c8b imservices/imfeatureplugin/srcimdatamodel/imdatamodelhook/imdatamodelhook.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/imfeatureplugin/srcimdatamodel/imdatamodelhook/imdatamodelhook.rss Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,52 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ECom registery info for ECom hook +* +*/ + + +#include +#include "imdlluids.hrh" +#include +#include + +// --------------------------------------------------------------------------- +// ECom registery info for XIMP IM Manager ECom hook +// --------------------------------------------------------------------------- +// +RESOURCE REGISTRY_INFO theInfo + { + resource_format_version = RESOURCE_FORMAT_VERSION_2; + dll_uid = XIMP_DLL_UID_IM_DATAMODEL_HOOK; + + interfaces = + { + INTERFACE_INFO + { + interface_uid = XIMP_ECOM_IF_UID_PROTOCOL_DATAMODEL_CODEC_INTERFACE; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = XIMP_ECOM_IMPL_UID_IM_DATAMODEL_INTERFACE; + version_no = 1; + display_name = "S60 Default XIMP"; + default_data = XIMP_ECOM_DEFAULT_DATA_IM_INTERFACE; + opaque_data = ""; + } + }; + } + }; + } + diff -r 000000000000 -r e6b17d312c8b imservices/imfeatureplugin/srcimdatamodel/imeventcodec.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/imfeatureplugin/srcimdatamodel/imeventcodec.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,251 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Base class for API implementations. +* +*/ + +#include "imeventcodec.h" +#include "imconversationeventimp.h" +#include "ximpapieventbase.h" +#include +#include + +/** + * Type definition for exact API event constructor signature. + */ +typedef CXIMPApiEventBase* (*TApiEventConstructor)( RReadStream& ); + +/** + * Structure for mapping event interface IDs to + * to corect API event constructors. + */ +struct SApiEventConstructorMap + { + //Interface id + TInt32 iInterfaceId; + + //Function pointer to event interface implementation + TApiEventConstructor iConstructorPtr; + } ; + +/** + * Helper macro to initialise KApiEventConstructorTable members. + * + * Macro forces that each event implementation class to have static + * NewFromStreamLC() memeber function to instantiate the object. + * + * See TApiEventConstructor type definition for exact constructor + * signature. + */ +#define CONSTRUCTOR_ENTRY( TheImplementedIf, TheClass ) \ + { TheImplementedIf::KInterfaceId, TheClass::NewFromStreamLC } \ + + +/** + * Constructor function mapping for event interface implementations. + * + * When new event types are implemented, add them here. + */ + +const SApiEventConstructorMap KApiEventConstructorTable[] = + { + CONSTRUCTOR_ENTRY( MImConversationEvent, CImConversationEventImp ), + }; + + +/** + * Count of constructor mappings. + */ +const TInt KApiEventConstructorCount = sizeof( KApiEventConstructorTable ) + / sizeof( SApiEventConstructorMap ); + + + +// ============================ HELPER FUNCTIONS ============================= + + +/** + * Helper function to locate constructor function for + * event interface ID. + * + * @param aEventInterfaceId The event interface ID. + * @return Event object constructor function. + */ +TApiEventConstructor ConstructorForInterface( TInt32 aEventInterfaceId ) + { + //Locate correct constructor + for( TInt ix = 0; ix < KApiEventConstructorCount; ix++ ) + { + const SApiEventConstructorMap map = KApiEventConstructorTable[ ix ]; + if( map.iInterfaceId == aEventInterfaceId ) + { + return map.iConstructorPtr; + } + } + return NULL; + } + + +/** + * Helper function to instantiate new event object + * of requested type and construct it from the stream. + * + * @param aEventInterfaceId + * @return Event object constructor function. + */ +CXIMPApiEventBase* NewEventObjectFromStreamLC( TInt32 aEventInterfaceId, + RReadStream& aStream ) + { + TApiEventConstructor newFromStreamLC = NULL; + + //Locate correct constructor for interface ID + newFromStreamLC = ConstructorForInterface( aEventInterfaceId ); + + if( ! newFromStreamLC ) + { + return NULL; + } + //Instantiate the object + CXIMPApiEventBase* eventObject = newFromStreamLC( aStream ); + + return eventObject; + } + + +// ============================ MEMBER FUNCTIONS ============================= + + +// --------------------------------------------------------------------------- +// CImEventCodec::NewL() +// --------------------------------------------------------------------------- +// +CImEventCodec* CImEventCodec::NewL() + { + CImEventCodec* self = new( ELeave ) CImEventCodec() ; + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + + +// --------------------------------------------------------------------------- +// CImEventCodec::ConstructL() +// --------------------------------------------------------------------------- +// +void CImEventCodec::ConstructL() + { + } +// --------------------------------------------------------------------------- +// CImEventCodec::CImEventCodec() +// --------------------------------------------------------------------------- +// +CImEventCodec::CImEventCodec() + { + } + +// --------------------------------------------------------------------------- +// CImEventCodec::~CImEventCodec() +// --------------------------------------------------------------------------- +// +CImEventCodec::~CImEventCodec() + { + } + +// --------------------------------------------------------------------------- +// CImEventCodec::PackL() +// --------------------------------------------------------------------------- +// +HBufC8* CImEventCodec::PackL( CXIMPApiEventBase& aEventObj, + TInt32& aTypeOfEvent ) + { + CBufFlat* buffer = CBufFlat::NewL( 10 ); // initial granularity to 10 + CleanupStack::PushL( buffer ); + + RBufWriteStream ws; + CleanupClosePushL( ws ); + ws.Open( *buffer ); // CSI: 65 # + + //Ask real event type through the event base interface + TInt32 eventIfId = aEventObj.Base().GetInterfaceId(); + + //And write both event type and data + ws.WriteInt32L( eventIfId ); + aEventObj.ExternalizeL( ws ); + ws.CommitL(); + CleanupStack::PopAndDestroy(); //ws + + HBufC8* heapBuf = buffer->Ptr( 0 ).AllocL(); + + CleanupStack::PopAndDestroy( buffer ); + + + aTypeOfEvent = eventIfId; + return heapBuf; + } + + +// --------------------------------------------------------------------------- +// CImEventCodec::PackL() +// --------------------------------------------------------------------------- +// +void CImEventCodec::PackL( CXIMPApiEventBase& aEventObj, + TInt32& aTypeOfEvent, + CBufFlat* aBuffer ) + { + RBufWriteStream ws; + CleanupClosePushL( ws ); + ws.Open( *aBuffer ); // CSI: 65 # + + //Ask real event type through the event base interface + TInt32 eventIfId = aEventObj.Base().GetInterfaceId(); + + //And write both event type and data + ws.WriteInt32L( eventIfId ); + aEventObj.ExternalizeL( ws ); + ws.CommitL(); + CleanupStack::PopAndDestroy( ); //ws + + aTypeOfEvent = eventIfId; + } + + +// --------------------------------------------------------------------------- +// CImEventCodec::UnPackL() +// --------------------------------------------------------------------------- +// +CXIMPApiEventBase* CImEventCodec::UnPackL( const TDesC8& aEventData, + TInt32& aTypeOfEvent ) + { + RDesReadStream rs; + rs.Open( aEventData ); // CSI: 65 # + CleanupClosePushL( rs ); + + TInt32 eventIfId = rs.ReadInt32L(); + CXIMPApiEventBase* eventObject = NewEventObjectFromStreamLC( eventIfId, rs ); + if( eventObject ) + { + CleanupStack::Pop( eventObject ); //eventObject + } + + CleanupStack::PopAndDestroy( ); // rs + + + aTypeOfEvent = eventIfId; + return eventObject; + } + + +// End of file + diff -r 000000000000 -r e6b17d312c8b imservices/imfeatureplugin/srcimdatamodel/imeventcodec.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/imfeatureplugin/srcimdatamodel/imeventcodec.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,104 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Codec to pack and unpack event objects. +* +*/ + +#ifndef IMEVENTCODEC_H +#define IMEVENTCODEC_H + +#include + +#include "eventcodec.h" + +class CXIMPApiEventBase; +class RReadStream; + + +/** + * Codec to pack and unpack event objects. + * + * @lib ximpdatamodel.dll + * @since S60 v3.2 + */ +NONSHARABLE_CLASS( CImEventCodec ): public MEventCodec + { + +public: + static CImEventCodec* NewL(); + + ~CImEventCodec(); + + + /** + * packs and allocates memory for the + * event object and event type + * + * @param aEventObj + * event object derived from CXIMPApiEventBase + * + * @param aTypeOfEvent + * holds type of the event after execution from aEventObj + * + * @return + * heap allocated which contains both + * event and event type + */ + HBufC8* PackL( CXIMPApiEventBase& aEventObj, + TInt32& aTypeOfEvent ); + + /** + * packs + * event object and event type into the buffer + * + * @param aEventObj + * event object derived from CXIMPApiEventBase + * + * @param aTypeOfEvent + * holds type of the event after execution from aEventObj + * + * @param + * buffer to be packed with + * event and event type + */ + + void PackL( CXIMPApiEventBase& aEventObj, + TInt32& aTypeOfEvent, + CBufFlat* aBuffer ); + + /** + * + * @param aEventData + * data desc which has the event type and id + * + * @param aTypeOfEvent + * holds type of the event after execution from aEventData + * + * @return new eventbase object constructed from aEventData + * + */ + CXIMPApiEventBase* UnPackL( const TDesC8& aEventData, + TInt32& aTypeOfEvent ); +protected: + void ConstructL(); + +private: + + CImEventCodec(); + + + }; + + +#endif // IMEVENTCODEC_H diff -r 000000000000 -r e6b17d312c8b imservices/imfeatureplugin/srcimdatamodel/imobjectfactoryimp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/imfeatureplugin/srcimdatamodel/imobjectfactoryimp.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,110 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of ImManagement + * +*/ + + +//#include "ximpstatusimp.h" +//#include "ximprestrictedobjectcollectionimp.h" +//#include "ximpobjectcollectionimp.h" +//#include "ximpidentityimp.h" +//#include "ximpdatasubscriptionstateimp.h" +#include "imobjectfactoryimp.h" +#include "imconversationinfoimp.h" + + +// ============================ MEMBER FUNCTIONS ============================= + +// --------------------------------------------------------------------------- +// CImObjectFactoryImp::NewL() +// --------------------------------------------------------------------------- +// +EXPORT_C CImObjectFactoryImp* CImObjectFactoryImp::NewL() + { + CImObjectFactoryImp* self = new( ELeave ) CImObjectFactoryImp; + return self; + + } + +// --------------------------------------------------------------------------- +// Implement supported interface access. +// --------------------------------------------------------------------------- +// +XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CImObjectFactoryImp, + MImObjectFactory ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + + +XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CImObjectFactoryImp, + MImObjectFactory ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + +// --------------------------------------------------------------------------- +// CImObjectFactoryImp::~CImObjectFactoryImp() +// --------------------------------------------------------------------------- +// +CImObjectFactoryImp::~CImObjectFactoryImp() + { + } + + +// --------------------------------------------------------------------------- +// CImObjectFactoryImp::CImObjectFactoryImp() +// --------------------------------------------------------------------------- +// +CImObjectFactoryImp::CImObjectFactoryImp() + { + } + + +// --------------------------------------------------------------------------- +// CImObjectFactoryImp::NewImConversationInfoLC() +// --------------------------------------------------------------------------- +// +MImConversationInfo* CImObjectFactoryImp::NewImConversationInfoLC() + { + return CImConversationInfoImp::NewLC(); + } + // --------------------------------------------------------------------------- +// CImObjectFactoryImp::NewImGroupInfoLC() +// --------------------------------------------------------------------------- +// +//MImGroupInfo* CImObjectFactoryImp::NewImGroupInfoLC() + //{ + //return CImConversationInfoImp::NewLC(); + //} + + +// --------------------------------------------------------------------------- +// CImObjectFactoryImp::NewImInvitationInfoLC() +// --------------------------------------------------------------------------- +// +//MImInvitationInfo* CImObjectFactoryImp::NewImInvitationInfoLC() + //{ + //return CImConversationInfoImp::NewLC(); + //} + + // --------------------------------------------------------------------------- +// CImObjectFactoryImp::NewImSearchInfoLC() +// --------------------------------------------------------------------------- +// +//MImSearchInfo* CImObjectFactoryImp::NewImSearchInfoLC() + //{ + //return CImConversationInfoImp::NewLC(); + //} + + + + diff -r 000000000000 -r e6b17d312c8b imservices/imfeatureplugin/srcimdatamodel/imobjectfactoryimp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/imfeatureplugin/srcimdatamodel/imobjectfactoryimp.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,73 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of MImObjectFactory + * +*/ + +#ifndef CIMOBJECTFACTORYIMP_H +#define CIMOBJECTFACTORYIMP_H + +#include +#include "ximpapiobjbase.h" +#include "imapiobjbase.h" + +class MImGroupInfo; +class MImConversationInfo; +class MImInvitationInfo; +class MImSearchInfo; + +/** + * MImObjectFactory API object implementation. + * + * @lib immanager.dll + * @since S60 v3.2 + */ +class CImObjectFactoryImp: public CXIMPApiObjBase, + public MImObjectFactory + { + public: + /** The class ID. */ + enum { KClassId = IMIMP_CLSID_CIMOBJECTFACTORYIMP }; + + +public: + + IMPORT_C static CImObjectFactoryImp* NewL(); + ~CImObjectFactoryImp(); + +private: + CImObjectFactoryImp(); + + + +public: // From MXIMPBase + + /** + * Implementation of MXIMPBase interface methods + * @see MXIMPBase + */ + XIMPIMP_DECLARE_IF_BASE_METHODS + + +public: //From MImObjectFactory + + MImConversationInfo* NewImConversationInfoLC(); + //MImGroupInfo* NewImGroupInfoLC(); + //MImInvitationInfo* NewImInvitationInfoLC(); + //MImSearchInfo* NewImSearchInfoLC(); + + }; + + +#endif // CIMOBJECTFACTORYIMP_H diff -r 000000000000 -r e6b17d312c8b imservices/imfeatureplugin/srcimdatamodel/imtypehelpers.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/imfeatureplugin/srcimdatamodel/imtypehelpers.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,48 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Typedef helpers for really long typenames. + * +*/ + +#ifndef IMTYPEHELPERS_H +#define IMTYPEHELPERS_H + +#include "ximpapiobjbase.h" +#include "imapiobjbase.h" +#include + +class CXIMPApiDataObjBase; + +// Key for opening up the typedefs: +// +// R(Xyz)Array = RXIMPObjOwningPtrArray +// Im = IM +// GrpInfo = GroupInfo +// GrpMemInfo = GroupMemberInfo +// WatLstInfo = WatcherListInfo +// +// When adding new types, follow these conventions. +// + +struct SImReqParam + { + CXIMPApiDataObjBase* iParam; + TInt iParamType; + }; + +typedef RArray RImReqParamArray; + +#endif // IMTYPEHELPERS_H + + diff -r 000000000000 -r e6b17d312c8b imservices/imfeatureplugin/srcimdatamodel/ximpimitemparent.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/imfeatureplugin/srcimdatamodel/ximpimitemparent.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,70 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Item parent interface. +* +*/ + +#ifndef CXIMPIMITEMPARENT_H +#define CXIMPIMITEMPARENT_H + +#include + +class CConversationSubscriptionItem; +class CXIMPIMSubscriptionItemBase; +class CXIMPApiEventBase; +class MXIMPPscContext; +class CXIMPIdentityImp; +class CXIMPConfigurationItemBase; + +//FIX ME +#define IM_ITEM_PARENT 0xE0000008 + +/** + * Item parent interface. + * + * @since S60 v3.2 + */ +class MXIMPIMItemParent : public MXIMPItemParentBase + { + + public: + enum { KInterfaceId = IM_ITEM_PARENT}; + + public: // Definitions + + /** + * Remove item + * @param aChild Item pointer to remove. + */ + virtual void RemoveMe( CConversationSubscriptionItem* aChild ) = 0; + + /** + * Add event + */ + virtual void AddEventL( CXIMPApiEventBase& aEvent, MXIMPPscContext* aContext ) = 0; + + +protected: // Destruction + + /** + * Object cannot be delted through this interface + */ + virtual ~MXIMPIMItemParent(){} + }; + +/* ======================================================================== */ + + + +#endif // CXIMPIMITEMPARENT_H diff -r 000000000000 -r e6b17d312c8b imservices/imfeatureplugin/srcimdatamodel/ximpimsubscriptionitembase.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/imfeatureplugin/srcimdatamodel/ximpimsubscriptionitembase.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,460 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: IM Service Connection subscription item base implementation. +* +*/ + + +#include "ximpimsubscriptionitembase.h" +#include "ximpimitemparent.h" +#include "ximppanics.h" +//#include "ximppsccontext.h" +//#include "ximpdatasubscriptionstateimp.h" +//#include "ximpobjecthelpers.h" + +//#include "ximptrace.h" + +const TInt KXIMPContentAutoExpiryTime = 15; // Seconds + + +// --------------------------------------------------------------------------- +// CXIMPIMSubscriptionItemBase::OrderOfContexts() +// --------------------------------------------------------------------------- +// +TInt CXIMPIMSubscriptionItemBase::OrderOfContexts( const MXIMPPscContext& aFirst, + const MXIMPPscContext& aSecond ) + { + if( &aFirst < &aSecond ) + { + return -1; + } + else if( &aFirst == &aSecond ) + { + return 0; + } + else + { + return 1; + } + } + +// --------------------------------------------------------------------------- +// CXIMPIMSubscriptionItemBase::OrderOfItems() +// --------------------------------------------------------------------------- +// +TInt CXIMPIMSubscriptionItemBase::OrderOfItems( const CXIMPIMSubscriptionItemBase& aFirst, + const CXIMPIMSubscriptionItemBase& aSecond ) + { + if( &aFirst < &aSecond ) + { + return -1; + } + else if( &aFirst == &aSecond ) + { + return 0; + } + else + { + return 1; + } + } + + +// --------------------------------------------------------------------------- +// CXIMPIMSubscriptionItemBase::CXIMPIMSubscriptionItemBase() +// --------------------------------------------------------------------------- +// +EXPORT_C CXIMPIMSubscriptionItemBase::CXIMPIMSubscriptionItemBase( MXIMPIMItemParent& aParent ) +: iParent( aParent ) + { + } + +// --------------------------------------------------------------------------- +// CXIMPIMSubscriptionItemBase::BaseConstructL() +// --------------------------------------------------------------------------- +// +EXPORT_C void CXIMPIMSubscriptionItemBase::BaseConstructL() + { + iSubscriptionState = CXIMPDataSubscriptionStateImp::NewL(); + } + +// --------------------------------------------------------------------------- +// CXIMPIMSubscriptionItemBase::~CXIMPIMSubscriptionItemBase() +// --------------------------------------------------------------------------- +// +EXPORT_C CXIMPIMSubscriptionItemBase::~CXIMPIMSubscriptionItemBase() + { + __ASSERT_ALWAYS( !CountOfSubscribers(), + User::Panic( NXIMPPrivPanic::KCategory, NXIMPPrivPanic::EArrayCountNotValid ) ); + iContexts.Close(); + iPreContexts.Close(); + iItems.Close(); + iPreItems.Close(); + + delete iSubscriptionState; + } + +// --------------------------------------------------------------------------- +// CXIMPIMSubscriptionItemBase::SubscriptionStatus() +// --------------------------------------------------------------------------- +// +EXPORT_C CXIMPIMSubscriptionItemBase::TSubscriptionStatus + CXIMPIMSubscriptionItemBase::SubscriptionStatus( MXIMPPscContext* aContext ) + { + // Calculate situation + TInt count = iContexts.Count() + iItems.Count(); + + if( count == 0 ) + { + return ENotSubscribedAtAll; + } + if( IsContext( aContext ) ) + { + if( count == 1 ) + { + return ESubscribedForCtxOnly; + } + return ESubscribedForCtxAndOthers; + } + return ESubscribedForOtherCtxOnly; + } + +// --------------------------------------------------------------------------- +// CXIMPIMSubscriptionItemBase::AddSubscriberL() +// --------------------------------------------------------------------------- +// +EXPORT_C void CXIMPIMSubscriptionItemBase::AddSubscriberL( MXIMPPscContext* aContext ) + { + TLinearOrder< MXIMPPscContext > order( OrderOfContexts ); + if( IsContext( aContext ) ) + { + User::Leave( KErrAlreadyExists ); + } + TInt index = iPreContexts.FindInOrder( aContext, order ); + if( index != KErrNotFound ) + { + User::Leave( KErrAlreadyExists ); + } + + iPreContexts.InsertInOrderL( aContext, order ); + User::LeaveIfError( Open() ); + ChangeStatusAfterAdd(); + } + +// --------------------------------------------------------------------------- +// CXIMPIMSubscriptionItemBase::RemoveSubscriber() +// --------------------------------------------------------------------------- +// +EXPORT_C void CXIMPIMSubscriptionItemBase::RemoveSubscriber( MXIMPPscContext* aContext ) + { + TLinearOrder< MXIMPPscContext > order( OrderOfContexts ); + TInt index = iContexts.FindInOrder( aContext, order ); + TInt preIndex = iPreContexts.FindInOrder( aContext, order ); + if( index >= 0 ) + { + iContexts.Remove( index ); + ChangeStatusAfterRemove(); + Close(); + } + else if( preIndex >= 0 ) + { + iPreContexts.Remove( preIndex ); + ChangeStatusAfterRemove(); + Close(); + } + else + { + iParent.UnregisterExpiringItem( this ); + } + } + +// --------------------------------------------------------------------------- +// CXIMPIMSubscriptionItemBase::AddSubscriberL() +// --------------------------------------------------------------------------- +// +EXPORT_C void CXIMPIMSubscriptionItemBase::AddSubscriberL( CXIMPIMSubscriptionItemBase* aItem ) + { + TLinearOrder< CXIMPIMSubscriptionItemBase > order( OrderOfItems ); + TInt index = iItems.FindInOrder( aItem, order ); + if( index != KErrNotFound ) + { + return; + } + index = iPreItems.FindInOrder( aItem, order ); + if( index != KErrNotFound ) + { + return; + } + + iPreItems.InsertInOrderL( aItem, order ); + User::LeaveIfError( Open() ); + ChangeStatusAfterAdd(); + } + +// --------------------------------------------------------------------------- +// CXIMPIMSubscriptionItemBase::RemoveSubscriber() +// --------------------------------------------------------------------------- +// +EXPORT_C void CXIMPIMSubscriptionItemBase::RemoveSubscriber( CXIMPIMSubscriptionItemBase* aItem ) + { + TLinearOrder< CXIMPIMSubscriptionItemBase > order( OrderOfItems ); + TInt index = iItems.FindInOrder( aItem, order ); + TInt preIndex = iPreItems.FindInOrder( aItem, order ); + if( index >= 0 ) + { + iItems.Remove( index ); + ChangeStatusAfterRemove(); + Close(); + } + else if( preIndex >= 0 ) + { + iPreItems.Remove( index ); + ChangeStatusAfterRemove(); + Close(); + } + else + { + iParent.UnregisterExpiringItem( this ); + } + } + +// --------------------------------------------------------------------------- +// CXIMPIMSubscriptionItemBase::ForceClose() +// --------------------------------------------------------------------------- +// +EXPORT_C void CXIMPIMSubscriptionItemBase::ForceClose() + { + TInt count = iContexts.Count(); + for( TInt a = 0; a < count; ++a ) + { + // RemoveSubscriber removes first one every time. + RemoveSubscriber( iContexts[ 0 ] ); + } + count = iItems.Count(); + for( TInt a = 0; a < count; ++a ) + { + RemoveSubscriber( iItems[ 0 ] ); + } + } + +// --------------------------------------------------------------------------- +// CXIMPIMSubscriptionItemBase::CleanIfExpired() +// --------------------------------------------------------------------------- +// +EXPORT_C TBool CXIMPIMSubscriptionItemBase::CleanIfExpired() + { + TTime timeNow; + timeNow.UniversalTime(); + TBool expired = + ( iExpireTime + TTimeIntervalSeconds( KXIMPContentAutoExpiryTime ) ) < timeNow; + if( expired ) + { + CleanExpired(); + } + return expired; + } + +// --------------------------------------------------------------------------- +// CXIMPIMSubscriptionItemBase::UpdateSubscriptionStateL() +// --------------------------------------------------------------------------- +// +EXPORT_C void CXIMPIMSubscriptionItemBase::UpdateSubscriptionStateL( TSubscriptionEvent aUpdateState ) + { + switch( aUpdateState ) + { + case ECompleteDataReceived: + { + if( CountOfSubscribers() == 0 ) + { + UpdateExpirationL(); + } + break; + } + default: + { + User::Panic( NXIMPPrivPanic::KCategory, NXIMPPrivPanic::ESubscriptionItemLogicError ); + break; + } + } + } + + +// --------------------------------------------------------------------------- +// CXIMPIMSubscriptionItemBase::DataSubscriptionState() +// --------------------------------------------------------------------------- +// +EXPORT_C const MXIMPDataSubscriptionState& CXIMPIMSubscriptionItemBase::DataSubscriptionState() + { + return *iSubscriptionState; + } + +// --------------------------------------------------------------------------- +// CXIMPIMSubscriptionItemBase::ContextCount() +// --------------------------------------------------------------------------- +// +EXPORT_C TInt CXIMPIMSubscriptionItemBase::ContextCount() const + { + return iContexts.Count(); + } + +// --------------------------------------------------------------------------- +// CXIMPIMSubscriptionItemBase::Context() +// --------------------------------------------------------------------------- +// +EXPORT_C MXIMPPscContext& CXIMPIMSubscriptionItemBase::Context( TInt aIndex ) + { + return *iContexts[ aIndex ]; + } + +// --------------------------------------------------------------------------- +// CXIMPIMSubscriptionItemBase::Context() +// --------------------------------------------------------------------------- +// +EXPORT_C TBool CXIMPIMSubscriptionItemBase::IsContext( MXIMPPscContext* aContext ) const + { + TLinearOrder< MXIMPPscContext > order( OrderOfContexts ); + return iContexts.FindInOrder( aContext, order ) != KErrNotFound; + } + +// --------------------------------------------------------------------------- +// CXIMPIMSubscriptionItemBase::SynthesiseSubscriptionEventToAllCtxsL() +// --------------------------------------------------------------------------- +// +EXPORT_C void CXIMPIMSubscriptionItemBase::SynthesiseSubscriptionEventToAllCtxsL() + { + //TRACE( _L("CXIMPIMSubscriptionItemBase::SynthesiseSubscriptionEventToAllCtxsL()" ) ); + RPointerArray< MXIMPPscContext > contextArray; + CleanupClosePushL( contextArray ); + TLinearOrder< MXIMPPscContext > order( OrderOfContexts ); + + TInt contextCount = iContexts.Count(); + for( TInt a = 0; a < contextCount; ++a ) + { + contextArray.InsertInOrderL( iContexts[ a ], order ); + } + + TInt itemCount = iItems.Count(); + for( TInt a = 0; a < itemCount; ++a ) + { + TInt contextCount = iItems[ a ]->ContextCount(); + for( TInt b = 0; b < contextCount; ++b ) + { + TInt error = contextArray.InsertInOrder( &iItems[ a ]->Context( b ), order ); + if( error != KErrNotFound ) + { + User::LeaveIfError( error ); + } + } + } + + TInt count = contextArray.Count(); + for( TInt a = 0; a < count; ++a ) + { + SynthesiseSubscriptionEventToL( contextArray[ a ], ETrue ); + } + CleanupStack::PopAndDestroy(); // contextArray + } + +// --------------------------------------------------------------------------- +// CXIMPIMSubscriptionItemBase::ActivateSubscriberL() +// --------------------------------------------------------------------------- +// +EXPORT_C void CXIMPIMSubscriptionItemBase::ActivateSubscriberL( MXIMPPscContext* aContext ) + { + TLinearOrder< MXIMPPscContext > order( OrderOfContexts ); + TInt index = iPreContexts.FindInOrder( aContext, order ); + if( index != KErrNotFound && index < iPreContexts.Count()) + { + iContexts.InsertInOrderL( iPreContexts[ index ], order ); + iPreContexts.Remove( index ); + } + } + +// --------------------------------------------------------------------------- +// CXIMPIMSubscriptionItemBase::ActivateSubscriberL() +// --------------------------------------------------------------------------- +// +EXPORT_C void CXIMPIMSubscriptionItemBase::ActivateSubscriberL( CXIMPIMSubscriptionItemBase* aItem ) + { + TLinearOrder< CXIMPIMSubscriptionItemBase > order( OrderOfItems ); + TInt index = iPreItems.FindInOrder( aItem, order ); + if( index != KErrNotFound && index < iPreItems.Count()) + { + iItems.InsertInOrderL( iPreItems[ index ], order ); + iPreItems.Remove( index ); + } + } + +// --------------------------------------------------------------------------- +// CXIMPIMSubscriptionItemBase::Status() +// --------------------------------------------------------------------------- +// +EXPORT_C void CXIMPIMSubscriptionItemBase::SetDataSubscriptionStateL( CXIMPDataSubscriptionStateImp& aNewState ) + { + // Some handle logic for terminating subscribers, data expiration etc. missing. + delete iSubscriptionState; + iSubscriptionState = &aNewState; + } + +// --------------------------------------------------------------------------- +// CXIMPIMSubscriptionItemBase::Status() +// --------------------------------------------------------------------------- +// +EXPORT_C CXIMPDataSubscriptionStateImp* CXIMPIMSubscriptionItemBase::StatusLC( MXIMPPscContext* /*aContext*/ ) const + { + // not implemented as of now + } + +// --------------------------------------------------------------------------- +// CXIMPIMSubscriptionItemBase::UpdateExpirationL() +// --------------------------------------------------------------------------- +// +EXPORT_C void CXIMPIMSubscriptionItemBase::UpdateExpirationL() + { + if( CountOfSubscribers() == 0 ) + { + iParent.RegisterExpiringItemL( this ); + } + iExpireTime.UniversalTime(); + } + + +// --------------------------------------------------------------------------- +// CXIMPIMSubscriptionItemBase::ChangeStatusAfterRemove() +// --------------------------------------------------------------------------- +// +EXPORT_C void CXIMPIMSubscriptionItemBase::ChangeStatusAfterRemove() + { + // not implemented as of now + } + + +// --------------------------------------------------------------------------- +// CXIMPIMSubscriptionItemBase::ChangeStatusAfterAdd() +// --------------------------------------------------------------------------- +// +EXPORT_C void CXIMPIMSubscriptionItemBase::ChangeStatusAfterAdd() + { + // not implemented as of now + } + +// --------------------------------------------------------------------------- +// CXIMPIMSubscriptionItemBase::CountOfSubscribers() +// --------------------------------------------------------------------------- +// +EXPORT_C TInt CXIMPIMSubscriptionItemBase::CountOfSubscribers() + { + return iItems.Count() + iPreItems.Count() + iContexts.Count() + iPreContexts.Count(); + } +// End of file diff -r 000000000000 -r e6b17d312c8b imservices/imfeatureplugin/srcimdatamodel/ximpimsubscriptionitembase.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/imfeatureplugin/srcimdatamodel/ximpimsubscriptionitembase.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,243 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: IM Service Connection subscription item base. +* +*/ + +#ifndef CXIMPPSCSUBSCRIPTIONITEMBASE_H +#define CXIMPPSCSUBSCRIPTIONITEMBASE_H + +#include +#include +#include "ximpsubscriptionitem.h" + + +class MXIMPIMItemParent; +class MXIMPPscContext; +class CXIMPDataSubscriptionStateImp; + +/** + * PSC subscription implementation + * + * @since S60 v3.2 + */ +class CXIMPIMSubscriptionItemBase : public CObject, public MXIMPSubscriptionItem + { +public: // Definitions + + /** + * Subscription status + */ + enum TSubscriptionStatus + { + ENotSubscribedAtAll, + ESubscribedForOtherCtxOnly, + ESubscribedForCtxOnly, + ESubscribedForCtxAndOthers + }; + + /** + * Subscription update event. + * Update subscription based on event. + */ + enum TSubscriptionEvent + { + ECompleteDataReceived + }; + /** + * For linear ordering by pointers + */ + static TInt OrderOfContexts( const MXIMPPscContext& aFirst, + const MXIMPPscContext& aSecond ); + + /** + * For linear ordering by pointers + */ + static TInt OrderOfItems( const CXIMPIMSubscriptionItemBase& aFirst, + const CXIMPIMSubscriptionItemBase& aSecond ); + +protected: // Construction and destruction + + /** + * Destruction + * - Remember to inform parent about delete. + */ + IMPORT_C virtual ~CXIMPIMSubscriptionItemBase(); + +public: // Construction and destruction + + /** + * Construction + * @param aParent. Parent has to be informed when this object is deleted by RemoveMe method. + */ + IMPORT_C CXIMPIMSubscriptionItemBase( MXIMPIMItemParent& aParent ); + + /** + * Base construction. Must be called from inherited classes ConstructL + */ + IMPORT_C void BaseConstructL(); + + +public: // New methods + + IMPORT_C TSubscriptionStatus SubscriptionStatus( MXIMPPscContext* aContext ); + + /** + * Add subscriber for item. + * @param aContext. Context to be added. + */ + IMPORT_C void AddSubscriberL( MXIMPPscContext* aContext ); + + /** + * Remove subscriber from item + * @param aContext. Context to be removed. + */ + IMPORT_C void RemoveSubscriber( MXIMPPscContext* aContext ); + + /** + * Add subscriber for item. + * @param aItem. Item to be added. + */ + IMPORT_C void AddSubscriberL( CXIMPIMSubscriptionItemBase* aItem ); + + /** + * Remove subscriber from item + * @param aContext. Item to be removed. + */ + IMPORT_C void RemoveSubscriber( CXIMPIMSubscriptionItemBase* aItem ); + + /** + * Activate subscriber for item. + * @param aItem. Item to be activated. + */ + IMPORT_C void ActivateSubscriberL( CXIMPIMSubscriptionItemBase* aItem ); + + /** + * Call RemoveSubscriber for all contexts registered to item. + */ + IMPORT_C void ForceClose(); + + /** + * Clean item if expired. + * @return ETrue if expired and cleaned.EFalse if not. + */ + IMPORT_C TBool CleanIfExpired(); + + /** + * Update subscription based on event happened. + * @param aUpdateState. Event which happened. + */ + IMPORT_C void UpdateSubscriptionStateL( TSubscriptionEvent aUpdateState ); + + /** + * + */ + IMPORT_C const MXIMPDataSubscriptionState& DataSubscriptionState(); + + /** + * Count of subscribed contexts. + */ + IMPORT_C TInt ContextCount() const; + + /** + * Reference to context in index. + */ + IMPORT_C MXIMPPscContext& Context( TInt aIndex ); + + /** + * Can context be found from contexts. + */ + IMPORT_C TBool IsContext( MXIMPPscContext* aContext ) const; + +public: // From MXIMPSubscriptionItem + + /** + * @see MXIMPSubscriptionItem + */ + IMPORT_C void SynthesiseSubscriptionEventToAllCtxsL(); + + /** + * @see MXIMPSubscriptionItem + */ + IMPORT_C void ActivateSubscriberL( MXIMPPscContext* aContext ); + + /** + * @see MXIMPSubscriptionItem + */ + IMPORT_C void SetDataSubscriptionStateL( CXIMPDataSubscriptionStateImp& aNewState ); + +public: // Helpers + + /** + * Status for context + */ + IMPORT_C CXIMPDataSubscriptionStateImp* StatusLC( MXIMPPscContext* aContext ) const; + + /** + * Update time to new expire time. + */ + IMPORT_C void UpdateExpirationL(); + + /** + * Change status after subscriber is added/removed. + */ + IMPORT_C void ChangeStatusAfterAdd(); + IMPORT_C void ChangeStatusAfterRemove(); + + /** + * Count of subscribers. Items counted as 1. + */ + IMPORT_C TInt CountOfSubscribers(); + +protected: // New interface methods. + + /** + * Clean data because expiration + */ + virtual void CleanExpired() = 0; + +protected: // Data + + /** + * Parent object to inform when object is deleted. + * Used also for sending events. + */ + MXIMPIMItemParent& iParent; + + + /** + * Subscribed contexts. + */ + RPointerArray< MXIMPPscContext > iContexts; + RPointerArray< MXIMPPscContext > iPreContexts; + RPointerArray< CXIMPIMSubscriptionItemBase > iItems; + RPointerArray< CXIMPIMSubscriptionItemBase > iPreItems; + + /** + * Current IM info status. + */ + CXIMPDataSubscriptionStateImp* iSubscriptionState; + + /** + * Time when ready for expire. + */ + TTime iExpireTime; + }; + + +/* ======================================================================== */ + + + +#endif // CXIMPPSCSUBSCRIPTIONITEMBASE_H diff -r 000000000000 -r e6b17d312c8b imservices/imfeatureplugin/srcimfrontend/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/imfeatureplugin/srcimfrontend/group/bld.inf Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Build information file for project IM Feature Plugin +* +*/ + + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +PRJ_MMPFILES +immanager.mmp +imecomhook.mmp + + +PRJ_TESTMMPFILES + +PRJ_TESTEXPORTS + diff -r 000000000000 -r e6b17d312c8b imservices/imfeatureplugin/srcimfrontend/group/imecomhook.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/imfeatureplugin/srcimfrontend/group/imecomhook.mmp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,61 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project definition file for IM Feature Plugin +* +*/ + +#include +#include +#include "../../group/imdlluids.hrh" + + +TARGET imecomhook.dll +CAPABILITY CAP_ECOM_PLUGIN +TARGETTYPE PLUGIN +UID XIMP_IM_DLL_UID_ECOM_PLUGIN XIMP_DLL_UID_IM_HOOK +VENDORID VID_DEFAULT + +VERSION 10.0 + +SOURCEPATH ../srcecomhook +START RESOURCE imecomhook.rss +TARGET imecomhook.rsc +END + + +SOURCEPATH ../srcecomhook +SOURCE imecomhook.cpp + + +USERINCLUDE ../srcecomhook +USERINCLUDE ../srcimmanager +USERINCLUDE ../../srcimdatamodel +USERINCLUDE ../../group + + + +MW_LAYER_SYSTEMINCLUDE + + +LIBRARY euser.lib +LIBRARY immanager.lib +LIBRARY ecom.lib + + + +#if defined( ARMCC ) +DEFFILE ../../eabi/ +#elif defined ( WINSCW ) +deffile ../../bwins/ +#endif \ No newline at end of file diff -r 000000000000 -r e6b17d312c8b imservices/imfeatureplugin/srcimfrontend/group/immanager.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/imfeatureplugin/srcimfrontend/group/immanager.mmp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,76 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project definition file for IM Manager +* +*/ + +#include +#include +#include "../../group/imdlluids.hrh" + + +TARGET immanager.dll +TARGETTYPE dll +UID XIMP_IM_DLL_UID_STATIC_INTERFACE XIMP_DLL_UID_IM_MANAGER + +CAPABILITY CAP_GENERAL_DLL +VENDORID VID_DEFAULT + +VERSION 10.0 + +SOURCEPATH ../srcimmanager + + +SOURCE imconversationimp.cpp +SOURCE imfeaturesimp.cpp + + +SOURCEPATH ../../srcutils +SOURCE imlogutils.cpp + + +USERINCLUDE ../../group + + +USERINCLUDE ../../srcutils +USERINCLUDE ../../srcimdatamodel +USERINCLUDE ../../srcimoperations +USERINCLUDE ../srcimmanager +USERINCLUDE ../../srcimdatamodel/imconversation + +MW_LAYER_SYSTEMINCLUDE + + + +LIBRARY euser.lib +LIBRARY ecom.lib +LIBRARY bafl.lib +LIBRARY estor.lib +LIBRARY ximputils.lib +LIBRARY ximpdatamodel.lib +LIBRARY imdatamodel.lib +LIBRARY ximpsrvclient.lib +LIBRARY flogger.lib + + +//EXPORTUNFROZEN + + +#if defined( ARMCC ) +DEFFILE ../../eabi/ +#elif defined ( WINSCW ) +deffile ../../bwins/ +#endif + +// End of file diff -r 000000000000 -r e6b17d312c8b imservices/imfeatureplugin/srcimfrontend/srcecomhook/imecomhook.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/imfeatureplugin/srcimfrontend/srcecomhook/imecomhook.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,46 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework's IM Manager Ecom Hook implementation. +* +*/ + + +#include "imdlluids.hrh" +#include "imfeaturesimp.h" +#include +#include + + +// --------------------------------------------------------------------------- +// Key value pair table to identify correct constructor +// function for the requested interface. +// --------------------------------------------------------------------------- +// +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY( XIMP_ECOM_IMPLEMENTATION_UID_IM_INTERFACE, + CImFeaturesImp::NewL ) + }; + + +// --------------------------------------------------------------------------- +// Exported function to return the implementation proxy table +// --------------------------------------------------------------------------- +// +EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount ) + { + aTableCount = sizeof( ImplementationTable ) / sizeof( TImplementationProxy ); + return ImplementationTable; + } + diff -r 000000000000 -r e6b17d312c8b imservices/imfeatureplugin/srcimfrontend/srcecomhook/imecomhook.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/imfeatureplugin/srcimfrontend/srcecomhook/imecomhook.rss Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,52 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ECom registery info for ECom hook +* +*/ + + +#include +#include +#include "imdlluids.hrh" + + +// --------------------------------------------------------------------------- +// ECom registery info for XIMP IM Manager ECom hook +// --------------------------------------------------------------------------- +// +RESOURCE REGISTRY_INFO theInfo + { + resource_format_version = RESOURCE_FORMAT_VERSION_2; + dll_uid = XIMP_DLL_UID_IM_HOOK; + + interfaces = + { + INTERFACE_INFO + { + interface_uid = XIMP_ECOM_IF_UID_IM_INTERFACE; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = XIMP_ECOM_IMPLEMENTATION_UID_IM_INTERFACE; + version_no = 1; + display_name = "S60 Default XIMP"; + default_data = XIMP_ECOM_DEFAULT_DATA_IM_INTERFACE; + opaque_data = ""; + } + }; + } + }; + } + diff -r 000000000000 -r e6b17d312c8b imservices/imfeatureplugin/srcimfrontend/srcimmanager/imconversationimp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/imfeatureplugin/srcimfrontend/srcimmanager/imconversationimp.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,164 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of MImConversationImp +* +*/ + + +#include "imconversationimp.h" +#include "ximpobjecthelpers.h" +#include "imoperationdefs.h" +//#include "ximpidentityimp.h" +#include "ximpcontextinternal.h" +#include "imconversationinfoimp.h" + +// ============================ MEMBER FUNCTIONS ============================= + +// --------------------------------------------------------------------------- +// CImConversationImp::NewL() +// --------------------------------------------------------------------------- +// + +CImConversationImp* CImConversationImp::NewL( MXIMPContextInternal& aContext ) + { + XImLogger::Log(_L("CImConversationImp::NewL Started")); + CImConversationImp* self = new( ELeave ) CImConversationImp( aContext ); + XImLogger::Log(_L("CImConversationImp::NewL Completed")); + return self; + } + + +// --------------------------------------------------------------------------- +// Implement supported interface access. +// --------------------------------------------------------------------------- +// +XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CImConversationImp, + MImConversation ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + + +XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CImConversationImp, + MImConversation ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + + + +// --------------------------------------------------------------------------- +// CImConversationImp::~CImConversationImp() +// --------------------------------------------------------------------------- +// +CImConversationImp::~CImConversationImp() + { + XImLogger::Log(_L("CImConversationImp::~CImConversationImp Started - Completed")); + } +// --------------------------------------------------------------------------- +// CImConversationImp::CImConversationImp() +// --------------------------------------------------------------------------- +// +CImConversationImp::CImConversationImp(MXIMPContextInternal& aContext ) + : iContext( aContext ) + { + } + +// --------------------------------------------------------------------------- +// CImConversationImp::PackConvInfoLC() +// --------------------------------------------------------------------------- +// +HBufC8* CImConversationImp::PackConvInfoLC(const MImConversationInfo& aImMessage ) + { + XImLogger::Log(_L("CImConversationImp::PackConvInfoLC Started")); + const CImConversationInfoImp* convImp = + TXIMPGetImpClassOrPanic< const CImConversationInfoImp >::From( aImMessage ); + HBufC8* pack = TXIMPObjectPacker< const CImConversationInfoImp >::PackL( *convImp ); + CleanupStack::PushL( pack ); + XImLogger::Log(_L("CImConversationImp::PackConvInfoLC Completed")); + return pack; + } + +// --------------------------------------------------------------------------- +// CImConversationImp::SendMessageL() +// --------------------------------------------------------------------------- +// +TXIMPRequestId CImConversationImp::SendMessageL( const MImConversationInfo& aImMessage) + { + XImLogger::Log(_L("CImConversationImp::SendMessageL Started")); + HBufC8* infoPack = PackConvInfoLC( aImMessage ); + TXIMPRequestId reqId = iContext.QueueOperationL( NImOps::ESendImMessage, *infoPack ); + CleanupStack::PopAndDestroy( infoPack ); + XImLogger::Log(_L("CImConversationImp::SendMessageL Completed")); + return reqId; + } + +// --------------------------------------------------------------------------- +// CImConversationImp::ForwardMessageL() +// --------------------------------------------------------------------------- +// + +//TXIMPRequestId CImConversationImp::ForwardMessageL( const MImConversationInfo& /*aImMessage*/) +// { +// } + +// --------------------------------------------------------------------------- +// CImConversationImp::SendMessageToGroupL() +// --------------------------------------------------------------------------- +// +//TXIMPRequestId CImConversationImp::SendMessageToGroupL( const MImConversationInfo& /*aImMessage*/, +// const TDesC* /*aGroupId*/ ) +// { +// } + +// --------------------------------------------------------------------------- +// CImConversationImp::BlockUsersL() +// --------------------------------------------------------------------------- +// +//TXIMPRequestId CImConversationImp::BlockUsersL(const MDesCArray* /*aUserIds*/ ) +// { +// } + +// --------------------------------------------------------------------------- +// CImConversationImp::UnBlockUsersL() +// --------------------------------------------------------------------------- +// +//TXIMPRequestId CImConversationImp::UnBlockUsersL(const MDesCArray* /*aUserIds*/) +// { +// } + +// --------------------------------------------------------------------------- +// CImConversationImp::GetBlockedUsersListL() +// --------------------------------------------------------------------------- +// +//TXIMPRequestId CImConversationImp::GetBlockedUsersListL(void ) +// { +// } + +// --------------------------------------------------------------------------- +// CImConversationImp::GetMessageListL() +// --------------------------------------------------------------------------- +// +//TXIMPRequestId CImConversationImp::GetMessageListL( const MXIMPIdentity& /*aImMessageId*/, +// const TDesC* /*aGroupId*/, +// const TInt /*aMessageCount*/, +// TBool /*aDeliveryReportWanted*/) +// { +// } + +// --------------------------------------------------------------------------- +// CImConversationImp::RejectMessageL() +// --------------------------------------------------------------------------- +// +//TXIMPRequestId CImConversationImp::RejectMessageL( const MXIMPIdentity& /*aImMessageId*/) +// { +// } + +// End of file diff -r 000000000000 -r e6b17d312c8b imservices/imfeatureplugin/srcimfrontend/srcimmanager/imconversationimp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/imfeatureplugin/srcimfrontend/srcimmanager/imconversationimp.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,95 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of MImConversationImp +* +*/ + +#ifndef CIMCONVERSATIONIMP_H +#define CIMCONVERSATIONIMP_H + +#include +#include "imlogutils.h" +#include "imapiobjbase.h" +#include "ximpapiobjbase.h" +// FORWARD DECLARATIONS +class MXIMPContextInternal; + +/** + * MImConversation API object implementation. + * + * @lib Immanager.dll + * + */ +NONSHARABLE_CLASS( CImConversationImp ): public CXIMPApiObjBase,public MImConversation + { + public: + /** The class ID. */ + enum { KClassId = IMIMP_CLSID_CONVERSATIONIMP }; + + +public: + static CImConversationImp* NewL( MXIMPContextInternal& aContext ); + ~CImConversationImp(); + + +public: + CImConversationImp( MXIMPContextInternal& aContext ); + + +public: // From MXIMPBase + + /** + * Implementation of MXIMPBase interface methods + * @see MXIMPBase + */ + XIMPIMP_DECLARE_IF_BASE_METHODS + + +public: //From MImConversation + + TXIMPRequestId SendMessageL( const MImConversationInfo& aImMessage); + //TXIMPRequestId ForwardMessageL( const MImConversationInfo& aImMessage); + //TXIMPRequestId SendMessageToGroupL( const MImConversationInfo& aImMessage, + // const TDesC* aGroupId ); + + //TXIMPRequestId BlockUsersL(const MDesCArray* aUserIds ); + + //TXIMPRequestId UnBlockUsersL(const MDesCArray* aUserIds ); + + //TXIMPRequestId GetBlockedUsersListL(void ); + + //TXIMPRequestId GetMessageListL( const MXIMPIdentity& aImMessageId, + // const TDesC* aGroupId, + // const TInt aMessageCount, + // TBool aDeliveryReportWanted); + + //TXIMPRequestId RejectMessageL( const MXIMPIdentity& aImMessageId); + + +private: //Helpers + + HBufC8* PackConvInfoLC(const MImConversationInfo& aImMessage ); +private: // data + + /** + * Context session proxy for accessing context server. + * Ref. + */ + MXIMPContextInternal& iContext; + + + }; + + +#endif // CIMCONVERSATIONIMP_H diff -r 000000000000 -r e6b17d312c8b imservices/imfeatureplugin/srcimfrontend/srcimmanager/imfeaturesimp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/imfeatureplugin/srcimfrontend/srcimmanager/imfeaturesimp.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,148 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of MImFeatures + * +*/ + + +#include +#include "imapiobjbase.h" +//#include "ximpidentityimp.h" +#include "ximpcontextinternal.h" +#include "imfeaturesimp.h" +#include "imconversationimp.h" +#include "imobjectfactoryimp.h" + + + + +// ============================ MEMBER FUNCTIONS ============================= + +// --------------------------------------------------------------------------- +// CImFeaturesImp::NewL() +// --------------------------------------------------------------------------- +// +EXPORT_C CImFeaturesImp* CImFeaturesImp::NewL(MXIMPContext* aContext) + { + CImFeaturesImp* self = new( ELeave ) CImFeaturesImp(); + CleanupStack::PushL( self ); + self->ConstructL(aContext); + CleanupStack::Pop(); + return self; + } + +// --------------------------------------------------------------------------- +// Implement supported interface access. +// --------------------------------------------------------------------------- +// + +XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CImFeaturesImp, + MImFeatures ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + + +XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CImFeaturesImp, + MImFeatures ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + +// --------------------------------------------------------------------------- +// CImFeaturesImp::~CImFeaturesImp() +// --------------------------------------------------------------------------- +// +CImFeaturesImp::~CImFeaturesImp() + { + delete iImConv; + delete iImObjFactory; + iCtxInternal = NULL; + } + + +// --------------------------------------------------------------------------- +// CImFeaturesImp::CImFeaturesImp( CXIMPContextClientProxy& aCtxProxy ) +// --------------------------------------------------------------------------- +// +CImFeaturesImp::CImFeaturesImp() + { + } + +// --------------------------------------------------------------------------- +// CImFeaturesImp::SetCtxL(MXIMPContext* aContext) +// --------------------------------------------------------------------------- +// +void CImFeaturesImp::SetCtxL(MXIMPContext* aContext) + { + if(!aContext) + User::Leave(KErrArgument); + iCtxInternal = TXIMPGetInterface::From(*aContext,EReturnNullIfUnknown); + + } + +// --------------------------------------------------------------------------- +// CImFeaturesImp::ConstructL(MXIMPContext* aContext) +// --------------------------------------------------------------------------- +// +void CImFeaturesImp::ConstructL(MXIMPContext* aContext) + { + SetCtxL(aContext); + iImObjFactory = CImObjectFactoryImp::NewL(); + iImConv = CImConversationImp::NewL( *iCtxInternal ); + + } + + +// --------------------------------------------------------------------------- +// CImFeaturesImp::ImObjectFactory() +// --------------------------------------------------------------------------- + MImObjectFactory& CImFeaturesImp::ImObjectFactory() const + { + return *iImObjFactory; + } + + +// --------------------------------------------------------------------------- +// CImFeaturesImp::ImConversation() +// --------------------------------------------------------------------------- +// + MImConversation& CImFeaturesImp::ImConversation() const + { + return *iImConv; + } + +// --------------------------------------------------------------------------- +// CImFeaturesImp::ImGroups() +// --------------------------------------------------------------------------- +// +// MImGroups& CImFeaturesImp::ImGroups() const +// { + //return *iImConv; +// } + + // --------------------------------------------------------------------------- +// CImFeaturesImp::ImInvtation() +// --------------------------------------------------------------------------- +// +// MImInvitation& CImFeaturesImp::ImInvtation() const +// { + //return *iImConv; +// } + + // --------------------------------------------------------------------------- +// CImFeaturesImp::ImSearch() +// --------------------------------------------------------------------------- +// +// MImSearch& CImFeaturesImp::ImSearch() const +// { + //return *iImConv; +// } + diff -r 000000000000 -r e6b17d312c8b imservices/imfeatureplugin/srcimfrontend/srcimmanager/imfeaturesimp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/imfeatureplugin/srcimfrontend/srcimmanager/imfeaturesimp.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,98 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of MXIMPContext +* +*/ + +#ifndef CIMFEATURESIMP_H +#define CIMFEATURESIMP_H + +#include +#include "ximpapiobjbase.h" +#include "imapiobjbase.h" + +class CImConversationImp; +class CImObjectFactoryImp; +class MXIMPContext; +class MXIMPContextInternal; + + +/** + * MXIMPContext API object implementation. + * + * @lib ximpmanager.dll + * @since S60 v3.2 + */ +NONSHARABLE_CLASS( CImFeaturesImp ): public MImFeatures, + public CXIMPApiObjBase + { + public: + /** The class ID. */ + enum { KClassId = IMIMP_CLSID_CIMFEATURESIMP }; + + +public: + + IMPORT_C static CImFeaturesImp* NewL( MXIMPContext* aContext ); + virtual ~CImFeaturesImp(); + + +private: + + CImFeaturesImp(); + void SetCtxL(MXIMPContext* aContext); + void ConstructL(MXIMPContext* aContext); + + +public: // From MXIMPBase + + /** + * Implementation of MXIMPBase interface methods + * @see MXIMPBase + */ + XIMPIMP_DECLARE_IF_BASE_METHODS + + +public: //From MImFeatures + + + MImObjectFactory& ImObjectFactory() const; + MImConversation& ImConversation() const; + //MImGroups& ImGroups() const; + //MImInvitation& ImInvtation() const; + //MImSearch& ImSearch() const; + + + +private: // data + + /** + * Context for having a connection context server. + */ + MXIMPContextInternal* iCtxInternal; + + + /** + * Object factory sub interface. + */ + CImObjectFactoryImp* iImObjFactory; + + /** + * Im Conversation management sub interface. + */ + CImConversationImp* iImConv; + }; + + +#endif // CIMFEATURESIMP_H diff -r 000000000000 -r e6b17d312c8b imservices/imfeatureplugin/srcimoperations/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/imfeatureplugin/srcimoperations/group/bld.inf Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Build information file for project IM Feature Plugin +* +*/ + + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +PRJ_MMPFILES + +imoperation.mmp +imoperationshook.mmp + +PRJ_TESTMMPFILES + +PRJ_TESTEXPORTS + diff -r 000000000000 -r e6b17d312c8b imservices/imfeatureplugin/srcimoperations/group/imoperation.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/imfeatureplugin/srcimoperations/group/imoperation.mmp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,83 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project definition file for IM Feature Plugin +* +*/ + +#include +#include +#include "../../group/imdlluids.hrh" + + +TARGET imoperation.dll +TARGETTYPE dll +UID XIMP_IM_DLL_UID_STATIC_INTERFACE XIMP_DLL_UID_IM_OPERATION + +CAPABILITY CAP_GENERAL_DLL +VENDORID VID_DEFAULT + +VERSION 10.0 + +// --------------------------------------------------------------------------- +SOURCEPATH ../../srcimoperations +// --------------------------------------------------------------------------- +SOURCE operationlaunchcleaner.cpp + +SOURCE imoperationfactoryimp.cpp + +// --------------------------------------------------------------------------- +SOURCEPATH ../imconversation +// --------------------------------------------------------------------------- +// Client - +SOURCE operationsendmessage.cpp +SOURCE operationreceivemessage.cpp +// Adaptation - + + +// --------------------------------------------------------------------------- +SOURCEPATH ../../srcutils +// --------------------------------------------------------------------------- +SOURCE imlogutils.cpp + + +USERINCLUDE ../../srcutils +USERINCLUDE ../../srcimdatamodel +USERINCLUDE ../../srcimdatamodel/imconversation +USERINCLUDE ../../srcimprocessor +USERINCLUDE ../../srcimoperations +USERINCLUDE ../imconversation + + +MW_LAYER_SYSTEMINCLUDE + +LIBRARY euser.lib +LIBRARY ecom.lib +LIBRARY estor.lib +LIBRARY ximputils.lib +LIBRARY imdatamodel.lib +LIBRARY ximpprocessor.lib +LIBRARY improcessor.lib +LIBRARY flogger.lib + +//EXPORTUNFROZEN + + +#if defined( ARMCC ) +DEFFILE ../../eabi/ +#elif defined ( WINSCW ) +deffile ../../bwins/ +#endif + +// End of file + diff -r 000000000000 -r e6b17d312c8b imservices/imfeatureplugin/srcimoperations/group/imoperationshook.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/imfeatureplugin/srcimoperations/group/imoperationshook.mmp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,61 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project definition file for IM Feature Plugin +* +*/ + + +#include +#include +#include "../../group/imdlluids.hrh" + + +TARGET imoperationshook.dll +CAPABILITY CAP_ECOM_PLUGIN +TARGETTYPE PLUGIN +UID XIMP_IM_DLL_UID_ECOM_PLUGIN XIMP_DLL_UID_IM_OPERATIONS_HOOK +VENDORID VID_DEFAULT + +VERSION 10.0 + +SOURCEPATH ../imoperationshook +START RESOURCE imoperationshook.rss +TARGET imoperationshook.rsc +END + + +SOURCEPATH ../imoperationshook +SOURCE imoperationshook.cpp + + +USERINCLUDE ../imoperationshook +USERINCLUDE ../../srcimoperations +USERINCLUDE ../../srcimdatamodel + + + + +MW_LAYER_SYSTEMINCLUDE + + +LIBRARY euser.lib +LIBRARY imoperation.lib +LIBRARY ecom.lib + + +#if defined( ARMCC ) +DEFFILE ../../eabi/ +#elif defined ( WINSCW ) +deffile ../../bwins/ +#endif \ No newline at end of file diff -r 000000000000 -r e6b17d312c8b imservices/imfeatureplugin/srcimoperations/imconversation/operationreceivemessage.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/imfeatureplugin/srcimoperations/imconversation/operationreceivemessage.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,149 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Concrete im receive message operation + * +*/ + + +#include +#include +#include +#include +#include "imconversationinfoimp.h" +#include "operationreceivemessage.h" +//#include "ximpoperationbase.h" +//#include "ximpidentityimp.h" +#include "conversationsubscriptionitem.h" +#include "imdatacacheimp.h" + +#include "ximpobjecthelpers.h" +#include "ximprestrictedobjectcollection.h" +#include "ximphost.h" +//#include "ximpstatusimp.h" +//#include "ximprequestcompleteeventimp.h" +#include "protocolimdatahostimp.h" +#include "imlogutils.h" + +#include "protocolimdatahost.h" + +//#include "ximpsubscriptionitem.h" +//#include "ximppsccontextimp.h" + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// COperationReceiveMessage::COperationReceiveMessage() +// --------------------------------------------------------------------------- +// +EXPORT_C COperationReceiveMessage::COperationReceiveMessage() + { + XImLogger::Log(_L("COperationReceiveMessage::COperationReceiveMessage Started")); + XImLogger::Log(_L("COperationReceiveMessage::COperationReceiveMessage Completed")); + } + + +// --------------------------------------------------------------------------- +// COperationReceiveMessage::ConstructL() +// --------------------------------------------------------------------------- +// +void COperationReceiveMessage::ConstructL( const TDesC8& /*aParamPck */) + { + XImLogger::Log(_L("COperationReceiveMessage::ConstructL Started")); + XImLogger::Log(_L("COperationReceiveMessage::ConstructL Completed")); + } + +// --------------------------------------------------------------------------- +// COperationReceiveMessage::~COperationReceiveMessage() +// --------------------------------------------------------------------------- +// +COperationReceiveMessage::~COperationReceiveMessage() + { + XImLogger::Log(_L("COperationReceiveMessage::~COperationReceiveMessage Started")); + delete iConvInfo; + XImLogger::Log(_L("COperationReceiveMessage::~COperationReceiveMessage Completed")); + } + + +// --------------------------------------------------------------------------- +// COperationReceiveMessage::ProcessL() +// --------------------------------------------------------------------------- +// +void COperationReceiveMessage::ProcessL() + { + XImLogger::Log(_L("COperationReceiveMessage::ProcessL Started")); + CXIMPOperationBase::ProcessL(); + MXIMPBase* object = NULL; + TBool force = ETrue; + + //iObjCollection->GetByType( object, MImConversationInfo::KInterfaceId ); + MXIMPRestrictedObjectCollection *objCollection = CXIMPOperationBase::GetObjCollection() ; + + objCollection->GetByType( object, MImConversationInfo::KInterfaceId ); + + if( object ) + { + iConvInfo = TXIMPGetImpClassOrPanic< CImConversationInfoImp >::From( *object ); + } + else + { + User::Leave( KErrArgument ); + } + + + //CConversationSubscriptionItem& conversationItem = + //iMyHost->ImDataAccess().ImDataCache().ConversationSubscriptionItemLC(); + + //CConversationSubscriptionItem& conversationItem = + // iMyHost->GetProtocolHost(0).ImDataCache().ConversationSubscriptionItemLC() ; + + MProtocolImDataHost* imProtocolHost = + static_cast (iMyHost->GetProtocolHost(MProtocolImDataHost::KInterfaceId) ); + + CConversationSubscriptionItem& conversationItem = + imProtocolHost->ImDataCache().ConversationSubscriptionItemLC() ; + + conversationItem.SetConversationInfoL( iConvInfo ); + + iConvInfo = NULL; // set to NULL since ownership is transfered + + //conversationItem.SynthesiseSubscriptionEventToL( iContext, force ); + conversationItem.SynthesiseSubscriptionEventToL( CXIMPOperationBase::GetContext(), force ); + + CleanupStack::PopAndDestroy(); // conversationItem + iMyHost->HandleAdaptationRequestCompleted( iReqId, KErrNone ); + XImLogger::Log(_L("COperationReceiveMessage::ProcessL Completed")); + } + +// --------------------------------------------------------------------------- +// COperationReceiveMessage::RequestCompleted() +// --------------------------------------------------------------------------- +// +void COperationReceiveMessage::RequestCompletedL() + { + XImLogger::Log(_L("COperationReceiveMessage::RequestCompletedL Started")); + CXIMPOperationBase::RequestCompletedL(); + XImLogger::Log(_L("COperationReceiveMessage::RequestCompletedL Completed")); + } + +// --------------------------------------------------------------------------- +// COperationReceiveMessage::Type() +// --------------------------------------------------------------------------- +// +TInt COperationReceiveMessage::Type() const + { + return NImOps::EHandleReceiveMessage; + } + + +// End of file diff -r 000000000000 -r e6b17d312c8b imservices/imfeatureplugin/srcimoperations/imconversation/operationreceivemessage.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/imfeatureplugin/srcimoperations/imconversation/operationreceivemessage.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,65 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Im receive message operation + * +*/ + +#ifndef C_OPERATIONRECEIVEMESSAGE_H +#define C_OPERATIONRECEIVEMESSAGE_H + +#include +#include + +#include "ximpoperationbase.h" +#include "imoperationdefs.h" + +class CImConversationInfoImp; + +/** + * Im receive message operation + * + * @lib imoperation.lib + * @since S60 + */ +class COperationReceiveMessage : public CXIMPOperationBase + { + + public: + + IMPORT_C COperationReceiveMessage(); + + void ConstructL( const TDesC8& aParamPck ); + + ~COperationReceiveMessage(); + + public: // from CXIMPOperationBase + + void ProcessL(); + + void RequestCompletedL(); + + TInt Type() const; + + private: // data + + /** + * convinfo + */ + CImConversationInfoImp* iConvInfo; + + + }; + + +#endif // C_OPERATIONRECEIVEMESSAGE_H diff -r 000000000000 -r e6b17d312c8b imservices/imfeatureplugin/srcimoperations/imconversation/operationsendmessage.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/imfeatureplugin/srcimoperations/imconversation/operationsendmessage.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,115 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Concrete im send message operation + * +*/ + + + +#include +#include +#include +#include "imconversationinfoimp.h" +#include "operationsendmessage.h" +#include "ximpobjecthelpers.h" +//#include "ximprestrictedobjectcollectionimp.h" +//#include "ximphost.h" +//#include "ximpstatusimp.h" +//#include "ximprequestcompleteeventimp.h" +#include "protocolimdatahostimp.h" +#include "imlogutils.h" +#include + + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// COperationSendMessage::COperationSendMessage() +// --------------------------------------------------------------------------- +// +EXPORT_C COperationSendMessage::COperationSendMessage() + { + } +// --------------------------------------------------------------------------- +// COperationSendMessage::ConstructL +// --------------------------------------------------------------------------- +// +void COperationSendMessage::ConstructL( const TDesC8& aParamPck ) + { + XImLogger::Log(_L("COperationSendMessage::ConstructL Started")); + CImConversationInfoImp* convInfo = CImConversationInfoImp::NewLC(); + TXIMPObjectPacker< CImConversationInfoImp >::UnPackL( *convInfo, + aParamPck ); + CleanupStack::Pop( convInfo ); + iConvInfo = convInfo; + XImLogger::Log(_L("COperationSendMessage::ConstructL Completed")); + } + +// --------------------------------------------------------------------------- +// COperationSendMessage::~COperationSendMessage() +// --------------------------------------------------------------------------- +// +COperationSendMessage::~COperationSendMessage() + { + XImLogger::Log(_L("COperationSendMessage::~COperationSendMessage Started")); + delete iConvInfo; + XImLogger::Log(_L("COperationSendMessage::~COperationSendMessage Completed")); + } + + +// --------------------------------------------------------------------------- +// COperationSendMessage::ProcessL() +// --------------------------------------------------------------------------- +// +void COperationSendMessage::ProcessL() + { + XImLogger::Log(_L("COperationSendMessage::ProcessL Started")); + CXIMPOperationBase::ProcessL(); + + // Call to Adaptation. + //MProtocolImConversation& imconversation = iMyHost->GetConnection().ProtocolImFeatures()->ImConversation(); + + + // Pankaj : added to support dynamic resolution + CProtocolImFeatures* imProtocolFeature =static_cast< CProtocolImFeatures*> (iMyHost->GetConnection().GetProtocolInterface(CProtocolImFeatures::KInterfaceId)); + + MProtocolImConversation& imconversation = imProtocolFeature->ImConversation() ; + + + imconversation.DoSendMessageL(*iConvInfo,iReqId ); + XImLogger::Log(_L("COperationSendMessage::ProcessL Completed")); + } + +// --------------------------------------------------------------------------- +// COperationSendMessage::RequestCompleted() +// --------------------------------------------------------------------------- +// +void COperationSendMessage::RequestCompletedL() + { + XImLogger::Log(_L("COperationSendMessage::RequestCompletedL Started")); + CXIMPOperationBase::RequestCompletedL(); + XImLogger::Log(_L("COperationSendMessage::RequestCompletedL Completed")); + } + +// --------------------------------------------------------------------------- +// COperationSendMessage::Type() +// --------------------------------------------------------------------------- +// +TInt COperationSendMessage::Type() const + { + return NImOps::ESendImMessage; + } + + +// End of file diff -r 000000000000 -r e6b17d312c8b imservices/imfeatureplugin/srcimoperations/imconversation/operationsendmessage.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/imfeatureplugin/srcimoperations/imconversation/operationsendmessage.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,63 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Im send message operation + * +*/ + +#ifndef C_OPERATIONSENDMESSAGE_H +#define C_OPERATIONSENDMESSAGE_H + +#include +#include + +#include "ximpoperationbase.h" +#include "imoperationdefs.h" + +class CImConversationInfoImp; + +/** + * Im send message operation + * + * @lib imoperation.lib + * @since S60 + */ +class COperationSendMessage : public CXIMPOperationBase + { + + public: + + IMPORT_C COperationSendMessage(); + + void ConstructL( const TDesC8& aParamPck ); + + ~COperationSendMessage(); + + public: // from CXIMPOperationBase + + void ProcessL(); + + void RequestCompletedL(); + + TInt Type() const; + + private: // data + + /** + * convinfo + */ + CImConversationInfoImp* iConvInfo; + }; + + +#endif // C_OPERATIONSENDMESSAGE_H diff -r 000000000000 -r e6b17d312c8b imservices/imfeatureplugin/srcimoperations/imoperationdefs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/imfeatureplugin/srcimoperations/imoperationdefs.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,50 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP framework im operation definitions. + * +*/ + +#ifndef IMOPERATIONDEFS_H +#define IMOPERATIONDEFS_H + +#include + +// TODO: use ranges for operations types, that will make sure that +// the core, Presence and IM operations won't overlap + +/** + * PSC operations. + */ +namespace NImOps + { + enum TImOpTypes + { + // ----------------------------------------------- + // From client + // + ESendImMessage = 200, // 200 + ESendImMessageToGroup, // 201 + EHandleSentMessage, + EHandleReceiveMessage, + ESynthesiseImSubscription = 280, + EIMCleaner = 290 + }; + } + +#endif //IMOPERATIONDEFS_H + + + + + diff -r 000000000000 -r e6b17d312c8b imservices/imfeatureplugin/srcimoperations/imoperationfactoryimp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/imfeatureplugin/srcimoperations/imoperationfactoryimp.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,116 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Im Service Connection operation factory + * +*/ + + +#include "imoperationfactoryimp.h" +#include "imoperationdefs.h" +#include "operationlaunchcleaner.h" +//#include "ximpoperationbase.h" +//#include "ximppanics.h" +#include "imlogutils.h" +#include "operationsendmessage.h" +#include "operationreceivemessage.h" +using namespace NImOps; + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CXIMPOperationFactory::NewL() +// Singleton access method. +// ----------------------------------------------------------------------------- +// +EXPORT_C CImOperationFactory* CImOperationFactory::NewL() + { + XImLogger::Log(_L("CImOperationFactory::NewL Started")); + CImOperationFactory* self = new ( ELeave ) CImOperationFactory(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + XImLogger::Log(_L("CImOperationFactory::NewL Completed")); + return self; + } + +// ----------------------------------------------------------------------------- +// CXIMPOperationFactory::CXIMPOperationFactory() +// ----------------------------------------------------------------------------- +// +CImOperationFactory::CImOperationFactory() + { + } + +// ----------------------------------------------------------------------------- +// CXIMPOperationFactory::~CXIMPOperationFactory() +// ----------------------------------------------------------------------------- +// +CImOperationFactory::~CImOperationFactory() + { + XImLogger::Log(_L("CImOperationFactory::~CImOperationFactory Started")); + XImLogger::Log(_L("CImOperationFactory::~CImOperationFactory Completed")); + } + + +// ----------------------------------------------------------------------------- +// CXIMPOperationFactory::ConstructL() +// ----------------------------------------------------------------------------- +// +void CImOperationFactory::ConstructL() + { + XImLogger::Log(_L("CImOperationFactory::ConstructL Started")); + XImLogger::Log(_L("CImOperationFactory::ConstructL Completed")); + } + + +// ----------------------------------------------------------------------------- +// CXIMPOperationFactory::CreateOperationL() +// ----------------------------------------------------------------------------- +// +CXIMPOperationBase* CImOperationFactory::CreateOperationL( TInt aOperation ) +{ + XImLogger::Log(_L("CImOperationFactory::CreateOperationL Started")); + CXIMPOperationBase* op = NULL; + NImOps::TImOpTypes operation = ( NImOps::TImOpTypes ) aOperation; + switch( operation ) + { + case ESendImMessage: + { + XImLogger::Log(_L("CImOperationFactory::CreateOperationL = ESendImMessage")); + op = new ( ELeave ) COperationSendMessage(); + break; + } + case EIMCleaner: + { + XImLogger::Log(_L("CImOperationFactory::CreateOperationL = EIMCleaner")); + op = new ( ELeave ) COperationLaunchCleaner(); + break; + } + case EHandleReceiveMessage: + { + XImLogger::Log(_L("CImOperationFactory::CreateOperationL = EHandleReceiveMessage")); + op = new ( ELeave ) COperationReceiveMessage(); + break; + } + default: + { + break; + } + } + XImLogger::Log(_L("CImOperationFactory::CreateOperationL Completed")); + return op; +} +// End of file + + diff -r 000000000000 -r e6b17d312c8b imservices/imfeatureplugin/srcimoperations/imoperationfactoryimp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/imfeatureplugin/srcimoperations/imoperationfactoryimp.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,76 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Im Service Connection operation factory + * +*/ + + +#ifndef IMCOPERATIONFACTORYIMP_H +#define IMCOPERATIONFACTORYIMP_H + + +#include +class CXIMPOperationBase; +#include "imapiobjbase.h" +#include + +/** + * Operation factory + * Class is owned by and handled as singleton by CXIMPGlobals. + * + * @lib imoperation.dll + * @since S60 v4.0 + */ + +NONSHARABLE_CLASS(CImOperationFactory): public MXIMPOperationFactory1 + { + + public: + /** The class ID. */ + //enum { KClassId = IMIMP_CLSID_CIMOPERATIONFACTORYIMP }; + + + + public: // Construction and desctruction + + IMPORT_C static CImOperationFactory* NewL(); + + virtual ~CImOperationFactory(); + + private: // Construction + + /** + * C++ default constructor. + */ + CImOperationFactory(); + + /** + * Symbian 2nd phase constructor + */ + void ConstructL(); + + + public: // From MXIMPOperationFactory1 + + /** + * @see MXIMPOperationFactory1 + */ + CXIMPOperationBase* CreateOperationL( TInt aOperation ); + + private: // Data + + }; + +#endif // IMCOPERATIONFACTORYIMP_H + diff -r 000000000000 -r e6b17d312c8b imservices/imfeatureplugin/srcimoperations/imoperationshook/imoperationshook.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/imfeatureplugin/srcimoperations/imoperationshook/imoperationshook.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,44 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework's IM Processor Hook implementation. +* +*/ + + +#include +#include +#include +#include "imoperationfactoryimp.h" +// --------------------------------------------------------------------------- +// Key value pair table to identify correct constructor +// function for the requested interface. +// --------------------------------------------------------------------------- +// +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY( XIMP_ECOM_IMPL_UID_IM_OPERATION_INTERFACE, + CImOperationFactory::NewL) + }; + + +// --------------------------------------------------------------------------- +// Exported function to return the implementation proxy table +// --------------------------------------------------------------------------- +// +EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount ) + { + aTableCount = sizeof( ImplementationTable ) / sizeof( TImplementationProxy ); + return ImplementationTable; + } + diff -r 000000000000 -r e6b17d312c8b imservices/imfeatureplugin/srcimoperations/imoperationshook/imoperationshook.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/imfeatureplugin/srcimoperations/imoperationshook/imoperationshook.rss Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,54 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ECom registery info for ECom hook +* +*/ + + +#include +#include +#include "imdlluids.hrh" +#include +#include + + +// --------------------------------------------------------------------------- +// ECom registery info for XIMP IM Manager ECom hook +// --------------------------------------------------------------------------- +// +RESOURCE REGISTRY_INFO theInfo + { + resource_format_version = RESOURCE_FORMAT_VERSION_2; + dll_uid = XIMP_DLL_UID_IM_OPERATIONS_HOOK; + + interfaces = + { + INTERFACE_INFO + { + interface_uid = XIMP_ECOM_IF_UID_OPERATIONS_INTERFACE; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = XIMP_ECOM_IMPL_UID_IM_OPERATION_INTERFACE; + version_no = 1; + display_name = "S60 Default XIMP"; + default_data = XIMP_ECOM_DEFAULT_DATA_IM_EVENT_CODEC; + opaque_data = ""; + } + }; + } + }; + } + diff -r 000000000000 -r e6b17d312c8b imservices/imfeatureplugin/srcimoperations/operationlaunchcleaner.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/imfeatureplugin/srcimoperations/operationlaunchcleaner.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,100 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Internal operation for launching cleaner + * +*/ + + +#include "operationlaunchcleaner.h" +#include "protocolimdatahostimp.h" +#include "imdatacacheimp.h" +#include "ximphost.h" +#include "imlogutils.h" +// ============================ MEMBER FUNCTIONS ============================= + +// --------------------------------------------------------------------------- +// COperationLaunchCleaner::COperationLaunchCleaner() +// --------------------------------------------------------------------------- +// +EXPORT_C COperationLaunchCleaner::COperationLaunchCleaner() + { + } +// --------------------------------------------------------------------------- +// COperationLaunchCleaner::~COperationLaunchCleaner() +// --------------------------------------------------------------------------- +// +COperationLaunchCleaner::~COperationLaunchCleaner() + { + } + +// --------------------------------------------------------------------------- +// COperationLaunchCleaner::ConstructL() +// --------------------------------------------------------------------------- +// +void COperationLaunchCleaner::ConstructL( const TDesC8& /*aParamPck*/ ) + { + } + +// --------------------------------------------------------------------------- +// COperationLaunchCleaner::ProcessL() +// --------------------------------------------------------------------------- +// +void COperationLaunchCleaner::ProcessL() + { + + XImLogger::Log(_L("COperationLaunchCleaner::ProcessL Started")); + CXIMPOperationBase::ProcessL(); + + // modified by pankaj + //iMyHost->ImDataAccess().ImDataCache().CleanExpired(); + MProtocolImDataHost* imProtocolHost = + static_cast (iMyHost->GetProtocolHost(MProtocolImDataHost::KInterfaceId) ); + imProtocolHost->ImDataCache().CleanExpired() ; + + iMyHost->HandleInternalRequestCompleted( iReqId, KErrNone ); + XImLogger::Log(_L("COperationLaunchCleaner::ProcessL Completed")); + } + +// --------------------------------------------------------------------------- +// COperationLaunchCleaner::RequestCompleted() +// --------------------------------------------------------------------------- +// +void COperationLaunchCleaner::RequestCompletedL() + { + XImLogger::Log(_L("COperationLaunchCleaner::RequestCompletedL Started")); + CXIMPOperationBase::RequestCompletedL(); + XImLogger::Log(_L("COperationLaunchCleaner::RequestCompletedL Completed")); + } +// --------------------------------------------------------------------------- +// COperationLaunchCleaner::Type() +// --------------------------------------------------------------------------- +// +TInt COperationLaunchCleaner::Type() const + { + return NImOps::EIMCleaner; + } + +// --------------------------------------------------------------------------- +// COperationLaunchCleaner::EndOperation() +// --------------------------------------------------------------------------- +// +void COperationLaunchCleaner::EndOperation() + { + XImLogger::Log(_L("COperationLaunchCleaner::EndOperation Started")); + CXIMPOperationBase::EndOperation(); + iMyHost->StartCleanerTimer(); + XImLogger::Log(_L("COperationLaunchCleaner::EndOperation Completed")); + } + +// End of file diff -r 000000000000 -r e6b17d312c8b imservices/imfeatureplugin/srcimoperations/operationlaunchcleaner.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/imfeatureplugin/srcimoperations/operationlaunchcleaner.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,60 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Internal operation for launching cleaner + * +*/ + +#ifndef COPERATIONLAUNCHCLEANER_H +#define COPERATIONLAUNCHCLEANER_H + + +#include +#include +#include "ximpoperationbase.h" +#include "imoperationdefs.h" + + +/** + * Internal synthesise own subscription event operation + * + * @lib impoperations.lib + * @since S60 v4.0 + */ +class COperationLaunchCleaner : public CXIMPOperationBase + { + public: + + IMPORT_C COperationLaunchCleaner(); + + void ConstructL( const TDesC8& aParamPck ); + + ~COperationLaunchCleaner(); + + + public: // from CXIMPOperationBase + + void ProcessL(); + + void RequestCompletedL(); + + TInt Type() const; + + void EndOperation(); + + private: // data + + }; + + +#endif // COPERATIONLAUNCHCLEANER_H diff -r 000000000000 -r e6b17d312c8b imservices/imfeatureplugin/srcimprocessor/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/imfeatureplugin/srcimprocessor/group/bld.inf Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Build information file for project IM Feature Plugin +* +*/ + + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +PRJ_MMPFILES +improcessor.mmp +improcessorhook.mmp + + +PRJ_TESTMMPFILES + +PRJ_TESTEXPORTS + diff -r 000000000000 -r e6b17d312c8b imservices/imfeatureplugin/srcimprocessor/group/improcessor.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/imfeatureplugin/srcimprocessor/group/improcessor.mmp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,72 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project definition file for IM Feature Plugin +* +*/ + +#include +#include +#include "../../group/imdlluids.hrh" + + +TARGET improcessor.dll +TARGETTYPE dll +UID XIMP_IM_DLL_UID_STATIC_INTERFACE XIMP_DLL_UID_IM_PROCESSOR + +CAPABILITY CAP_GENERAL_DLL +VENDORID VID_DEFAULT + +VERSION 10.0 + +SOURCEPATH ../../srcimprocessor +SOURCE protocoldatahostimp.cpp +SOURCE protocolimdatahostimp.cpp + +SOURCEPATH ../imconversationdatahost +SOURCE protocolimconversationdatahostimp.cpp + +SOURCEPATH ../../srcutils +SOURCE imlogutils.cpp + + + +USERINCLUDE ../../group +USERINCLUDE ../../srcimprocessor +USERINCLUDE ../../srcimoperations +USERINCLUDE ../../srcimdatamodel +USERINCLUDE ../../srcutils +USERINCLUDE ../imconversationdatahost + +MW_LAYER_SYSTEMINCLUDE + + +LIBRARY euser.lib +LIBRARY ecom.lib +LIBRARY estor.lib +LIBRARY centralrepository.lib +LIBRARY bafl.lib +LIBRARY ximputils.lib +LIBRARY ximpdatamodel.lib +LIBRARY imdatamodel.lib +LIBRARY flogger.lib + +//EXPORTUNFROZEN + +#if defined( ARMCC ) +DEFFILE ../../eabi/ +#elif defined ( WINSCW ) +deffile ../../bwins/ +#endif + +// End of file diff -r 000000000000 -r e6b17d312c8b imservices/imfeatureplugin/srcimprocessor/group/improcessorhook.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/imfeatureplugin/srcimprocessor/group/improcessorhook.mmp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,61 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project definition file for IM Feature Plugin +* +*/ + + +#include +#include +#include "../../group/imdlluids.hrh" + + +TARGET improcessorhook.dll +CAPABILITY CAP_ECOM_PLUGIN +TARGETTYPE PLUGIN +UID XIMP_IM_DLL_UID_ECOM_PLUGIN XIMP_DLL_UID_IM_PROCESSOR_HOOK +VENDORID VID_DEFAULT + +VERSION 10.0 + +SOURCEPATH ../improcessorhook +START RESOURCE improcessorhook.rss +TARGET improcessorhook.rsc +END + + +SOURCEPATH ../improcessorhook +SOURCE improcessorhook.cpp + + +USERINCLUDE ../../group +USERINCLUDE ../improcessorhook +USERINCLUDE ../../srcimdatamodel +USERINCLUDE ../../srcimprocessor + + + +MW_LAYER_SYSTEMINCLUDE + + +LIBRARY euser.lib +LIBRARY improcessor.lib +LIBRARY ecom.lib + + +#if defined( ARMCC ) +DEFFILE ../../eabi/ +#elif defined ( WINSCW ) +deffile ../../bwins/ +#endif \ No newline at end of file diff -r 000000000000 -r e6b17d312c8b imservices/imfeatureplugin/srcimprocessor/imconversationdatahost/protocolimconversationdatahostimp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/imfeatureplugin/srcimprocessor/imconversationdatahost/protocolimconversationdatahostimp.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation for managing cached Invite information. +* +*/ + + +#include +#include +#include +#include +//#include "ximprestrictedobjectcollectionimp.h" +//#include "ximpoperationbase.h" +//#include "ximpglobals.h" +//#include "ximpoperationfactory.h" +#include "ximphost.h" +#include "imdatacacheimp.h" +#include "imoperationdefs.h" +//#include "ximptrace.h" +#include "imlogutils.h" +#include "protocolimdatahostimp.h" +#include "protocolimconversationdatahostimp.h" +#include + + +// ============================ MEMBER FUNCTIONS ============================= + + +// --------------------------------------------------------------------------- +// CProtocolImConversationDataHostImp::CProtocolImConversationDataHostImp() +// --------------------------------------------------------------------------- +// +CProtocolImConversationDataHostImp::CProtocolImConversationDataHostImp( MXIMPHost& aHost ) +:iHost( aHost ) + { + } + + +// --------------------------------------------------------------------------- +// CProtocolImConversationDataHostImp::ConstructL() +// --------------------------------------------------------------------------- +// +void CProtocolImConversationDataHostImp::ConstructL() + { + } + + +// --------------------------------------------------------------------------- +// CProtocolImConversationDataHostImp::NewL() +// --------------------------------------------------------------------------- +// +EXPORT_C CProtocolImConversationDataHostImp* CProtocolImConversationDataHostImp::NewL( MXIMPHost& aHost ) + { + CProtocolImConversationDataHostImp* self = new( ELeave ) CProtocolImConversationDataHostImp( aHost ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// Implement supported interface access. +// --------------------------------------------------------------------------- +// +XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CProtocolImConversationDataHostImp, + MProtocolImConversationDataHost ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + + +XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CProtocolImConversationDataHostImp, + MProtocolImConversationDataHost ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + +// --------------------------------------------------------------------------- +// CProtocolImConversationDataHostImp::~CProtocolImConversationDataHostImp() +// --------------------------------------------------------------------------- +// +CProtocolImConversationDataHostImp::~CProtocolImConversationDataHostImp() + { + } + +// --------------------------------------------------------------------------- +// CProtocolImConversationDataHostImp::HandleSentMessageL() +// --------------------------------------------------------------------------- +// +//TXIMPRequestId CProtocolImConversationDataHostImp::HandleSentMessageL(MXIMPIdentity* /*aMessageId*/) +// { +// } + +// --------------------------------------------------------------------------- +// CProtocolImConversationDataHostImp::HandleNewTextMessageL() +// --------------------------------------------------------------------------- +// +TXIMPRequestId CProtocolImConversationDataHostImp::HandleNewTextMessageL( MImConversationInfo* aImMessage) + { + XImLogger::Log(_L("CProtocolImConversationDataHostImp::HandleNewTextMessageL Started")); + XImLogger::Log(_L("CProtocolImConversationDataHostImp::HandleNewTextMessageL Completed")); + return iHost.AddNewOperationL( NImOps::EHandleReceiveMessage, aImMessage ); + } + +// --------------------------------------------------------------------------- +// CProtocolImConversationDataHostImp::HandleNewContentMessageL() +// --------------------------------------------------------------------------- +// +//TXIMPRequestId CProtocolImConversationDataHostImp::HandleNewContentMessageL( MXIMPIdentity* /*aMessageId*/, +// const TDesC& /*aSender*/, +// const TDesC& /*aScreenName*/, +// const MDesCArray& /*aRecipients*/, +// const MDesCArray& /*aScreenNames*/, +// const TDesC& /*aContentType*/, +// const TDesC8& /*aContent*/) +// { +// XImLogger::Log(_L("CProtocolImConversationDataHostImp::HandleNewContentMessageL Started")); +// XImLogger::Log(_L("CProtocolImConversationDataHostImp::HandleNewContentMessageL Completed")); +// } + +// --------------------------------------------------------------------------- +// CProtocolImConversationDataHostImp::HandleBlockedListResponseL() +// --------------------------------------------------------------------------- +// +//TXIMPRequestId CProtocolImConversationDataHostImp::HandleBlockedListResponseL( const MDesCArray* /*aBlockedList*/, +// TBool /*aBlockedListInUse*/, +// const MDesCArray* /*aGrantedList*/, +// TBool /*aGrantedListInUse*/) +// { +// XImLogger::Log(_L("CProtocolImConversationDataHostImp::HandleBlockedListResponseL Started")); +// XImLogger::Log(_L("CProtocolImConversationDataHostImp::HandleBlockedListResponseL Completed")); +// } + +// --------------------------------------------------------------------------- +// CProtocolImConversationDataHostImp::HandleForwardMessageCompletionL() +// --------------------------------------------------------------------------- +// +//TXIMPRequestId CProtocolImConversationDataHostImp::HandleForwardMessageCompletionL(MXIMPIdentity* /*aMessageId*/) +// { +// XImLogger::Log(_L("CProtocolImConversationDataHostImp::HandleForwardMessageCompletionL Started")); +// XImLogger::Log(_L("CProtocolImConversationDataHostImp::HandleForwardMessageCompletionL Completed")); +// } + +// --------------------------------------------------------------------------- +// CProtocolImConversationDataHostImp::HandleGetMessageListL() +// --------------------------------------------------------------------------- +// +//TXIMPRequestId CProtocolImConversationDataHostImp::HandleGetMessageListL( /*MImFtpPluginObjectCollection* aMessageList */) +//{ +// XImLogger::Log(_L("CProtocolImConversationDataHostImp::HandleForwardMessageCompletionL Started")); +// XImLogger::Log(_L("CProtocolImConversationDataHostImp::HandleForwardMessageCompletionL Completed")); + +//} +// --------------------------------------------------------------------------- +// CProtocolImConversationDataHostImp::HandleRejectMessageL() +// --------------------------------------------------------------------------- +// +//TXIMPRequestId CProtocolImConversationDataHostImp::HandleRejectMessageL( MXIMPIdentity* /*aMessageId*/) +//{ +// XImLogger::Log(_L("CProtocolImConversationDataHostImp::HandleForwardMessageCompletionL Started")); +// XImLogger::Log(_L("CProtocolImConversationDataHostImp::HandleForwardMessageCompletionL Completed")); + +//} + +//End of file diff -r 000000000000 -r e6b17d312c8b imservices/imfeatureplugin/srcimprocessor/imconversationdatahost/protocolimconversationdatahostimp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/imfeatureplugin/srcimprocessor/imconversationdatahost/protocolimconversationdatahostimp.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,100 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation for managing cached Invite information. +* +*/ + +#ifndef CPROTOCOLIMCONVERSATIONDATAHOSTIMP_H +#define CPROTOCOLIMCONVERSATIONDATAHOSTIMP_H + +#include + +#include "ximpapiobjbase.h" +#include "imapiobjbase.h" +//#include "ximpitemparent.h" +#include "imtypehelpers.h" +//#include "ximpoperationdefs.h" + +class MXIMPHost; +class MXIMPObjectCollection; +/** + * Implementation for managing cached Invitation information + * + * @since S60 + */ +class CProtocolImConversationDataHostImp : public CXIMPApiObjBase, + public MProtocolImConversationDataHost + { +public: // Definitions + + /** The class ID. */ + enum { KClassId = IMIMP_CLSID_CPROTOCOLIMCONVERSATIONDATAHOST }; + +public: // Construction and destruction + + /** + * Construction + */ + IMPORT_C static CProtocolImConversationDataHostImp* NewL( MXIMPHost& aHost ); + + /** + * Destruction + */ + virtual ~CProtocolImConversationDataHostImp(); + +private: + + CProtocolImConversationDataHostImp( MXIMPHost& aHost ); + void ConstructL(); + +public: // From MXIMPBase + + /** + * Implementation of MXIMPBase interface methods + * @see MXIMPBase + */ + XIMPIMP_DECLARE_IF_BASE_METHODS + +public: //From CProtocolImConversationDataHost + + //TXIMPRequestId HandleSentMessageL(MXIMPIdentity* aMessageId); + TXIMPRequestId HandleNewTextMessageL( MImConversationInfo* aImMessage); + //TXIMPRequestId HandleNewContentMessageL( MXIMPIdentity* aMessageId, + // const TDesC& aSender, + // const TDesC& aScreenName, + // const MDesCArray& aRecipients, + // const MDesCArray& aScreenNames, + // const TDesC& aContentType, + // const TDesC8& aContent); + // TXIMPRequestId HandleBlockedListResponseL( const MDesCArray* aBlockedList, + // TBool aBlockedListInUse, + // const MDesCArray* aGrantedList, + // TBool aGrantedListInUse); + //TXIMPRequestId HandleForwardMessageCompletionL(MXIMPIdentity* aMessageId); + //TXIMPRequestId HandleGetMessageListL( /*MImFtpPluginObjectCollection* aMessageList */); + //TXIMPRequestId HandleRejectMessageL( MXIMPIdentity* aMessageId); + + private: // Data + + /** + * Access to host. + */ + MXIMPHost& iHost; + }; + + + + +#endif // CPROTOCOLIMCONVERSATIONDATAHOSTIMP_H + diff -r 000000000000 -r e6b17d312c8b imservices/imfeatureplugin/srcimprocessor/improcessorhook/improcessorhook.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/imfeatureplugin/srcimprocessor/improcessorhook/improcessorhook.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,46 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework's IM Processor Hook implementation. +* +*/ + + +#include +//#include "imapidataobjfactoryaccessor.h" +#include +#include +#include "protocoldatahostimp.h" + +// --------------------------------------------------------------------------- +// Key value pair table to identify correct constructor +// function for the requested interface. +// --------------------------------------------------------------------------- +// +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY( XIMP_ECOM_IMPL_UID_IM_PROCESSOR_INTERFACE, + CProtocolDataHostImp::NewL) + }; + + +// --------------------------------------------------------------------------- +// Exported function to return the implementation proxy table +// --------------------------------------------------------------------------- +// +EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount ) + { + aTableCount = sizeof( ImplementationTable ) / sizeof( TImplementationProxy ); + return ImplementationTable; + } + diff -r 000000000000 -r e6b17d312c8b imservices/imfeatureplugin/srcimprocessor/improcessorhook/improcessorhook.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/imfeatureplugin/srcimprocessor/improcessorhook/improcessorhook.rss Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,54 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ECom registery info for ECom hook +* +*/ + + +#include +#include "imdlluids.hrh" +#include +#include +#include + + +// --------------------------------------------------------------------------- +// ECom registery info for XIMP IM Manager ECom hook +// --------------------------------------------------------------------------- +// +RESOURCE REGISTRY_INFO theInfo + { + resource_format_version = RESOURCE_FORMAT_VERSION_2; + dll_uid = XIMP_DLL_UID_IM_PROCESSOR_HOOK; + + interfaces = + { + INTERFACE_INFO + { + interface_uid = XIMP_ECOM_IF_UID_PROTOCOL_DATA_HOST_INTERFACE; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = XIMP_ECOM_IMPL_UID_IM_PROCESSOR_INTERFACE; + version_no = 1; + display_name = "S60 Default XIMP"; + default_data = XIMP_ECOM_DEFAULT_DATA_IM_EVENT_CODEC; + opaque_data = ""; + } + }; + } + }; + } + diff -r 000000000000 -r e6b17d312c8b imservices/imfeatureplugin/srcimprocessor/protocoldatahostimp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/imfeatureplugin/srcimprocessor/protocoldatahostimp.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,151 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Im connection host + * +*/ + + +//#include +#include +#include +#include +#include +#include "ximpapiobjbase.h" +#include "imapiobjbase.h" +#include "imobjectfactoryimp.h" + +#include "protocoldatahostimp.h" +#include "protocolimdatahostimp.h" +#include "protocolimconversationdatahostimp.h" +//#include "ximpprotocolrequestcompleteeventimp.h" +#include "imlogutils.h" +#include +#include "imoperationdefs.h" + +// ======== MEMBER FUNCTIONS ======== + + +// This should be variated. Branding variation can be one +// possibility. One is to leave adaptation deside how soon +// cleanup will be done. +// Now 5 sec used for testing purposes. Better value could be +// some minutes. + +// --------------------------------------------------------------------------- +// CProtocolDataHostImp::CProtocolDataHostImp() +// --------------------------------------------------------------------------- +// +CProtocolDataHostImp::CProtocolDataHostImp( MXIMPHost& aHost ) +:iHost( aHost ) + { + XImLogger::Log(_L("CProtocolDataHostImp::CProtocolDataHostImp Started")); + XImLogger::Log(_L("CProtocolDataHostImp::CProtocolDataHostImp Completed")); + } + + +// --------------------------------------------------------------------------- +// CProtocolDataHostImp::ConstructL() +// --------------------------------------------------------------------------- +// +void CProtocolDataHostImp::ConstructL() + { + XImLogger::Log(_L("CProtocolDataHostImp::ConstructL Started")); + + //iImObjFactory = CImObjectFactoryImp::NewL(); + //iConvDataHost = CProtocolImConversationDataHostImp::NewL( iHost ); + iImDataHost = CProtocolImDataHostImp::NewL(iHost) ; + XImLogger::Log(_L("CProtocolDataHostImp::ConstructL Completed")); + } + + +// --------------------------------------------------------------------------- +// CProtocolDataHostImp::NewLC() +// --------------------------------------------------------------------------- +// +EXPORT_C CProtocolDataHostImp* CProtocolDataHostImp::NewLC( MXIMPHost& aHost ) + { + XImLogger::Log(_L("CProtocolDataHostImp::NewLC Started")); + CProtocolDataHostImp* self = new( ELeave ) CProtocolDataHostImp( aHost ); + CleanupStack::PushL( self ); + self->ConstructL(); + XImLogger::Log(_L("CProtocolDataHostImp::NewLC Completed")); + return self; + } + +// --------------------------------------------------------------------------- +// CProtocolDataHostImp::NewL() +// --------------------------------------------------------------------------- +// +EXPORT_C CProtocolDataHostImp* CProtocolDataHostImp::NewL( MXIMPHost& aHost ) + { + XImLogger::Log(_L("CProtocolDataHostImp::NewL Started")); + CProtocolDataHostImp* self = new( ELeave ) CProtocolDataHostImp( aHost ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + XImLogger::Log(_L("CProtocolDataHostImp::NewL Completed")); + return self; + } +// --------------------------------------------------------------------------- +// CProtocolDataHostImp::~CProtocolDataHostImp() +// --------------------------------------------------------------------------- +// +CProtocolDataHostImp::~CProtocolDataHostImp() + { + XImLogger::Log(_L("CProtocolDataHostImp::~CProtocolDataHostImp Started")); + + //delete iImObjFactory; + //delete iConvDataHost; + delete iImDataHost ; + XImLogger::Log(_L("CProtocolDataHostImp::~CProtocolDataHostImp Completed")); + } + +// --------------------------------------------------------------------------- +// CProtocolDataHostImp::SetHostToProtocol() +// --------------------------------------------------------------------------- +// +void CProtocolDataHostImp::SetHostToProtocol() + { + CProtocolImFeatures* imProtocolFeature = static_cast< CProtocolImFeatures*> + (iHost.GetConnection().GetProtocolInterface(CProtocolImFeatures::KInterfaceId) ); + + if(imProtocolFeature) + { + imProtocolFeature->SetHost(*iImDataHost); + } + } + +// --------------------------------------------------------------------------- +// CProtocolDataHostImp::GetInterface() +// --------------------------------------------------------------------------- +// +TAny* CProtocolDataHostImp::GetInterface(TInt aInterfaceId) + { + if(aInterfaceId == MProtocolImDataHost::KInterfaceId ) + return iImDataHost ; + else + return NULL ; + + } + +// --------------------------------------------------------------------------- +// CProtocolDataHostImp::GetInterface() +// --------------------------------------------------------------------------- +// +TInt CProtocolDataHostImp::GetCleanupOperation() + { + return NImOps::EIMCleaner ; + } +// End of file + diff -r 000000000000 -r e6b17d312c8b imservices/imfeatureplugin/srcimprocessor/protocoldatahostimp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/imfeatureplugin/srcimprocessor/protocoldatahostimp.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,106 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Im connection host + * +*/ + +#ifndef CPROTOCOLDATAHOSTIMP_H +#define CPROTOCOLDATAHOSTIMP_H + +#include +//#include +//#include +#include +#include +#include "imapiobjbase.h" +#include "ximpapiobjbase.h" +//#include "ximpitemparent.h" +#include "ximphost.h" +//#include "ximpoperationdefs.h" +//#include "ximprequestidbuilder.h" + + +class MXIMPHost; +class MImObjectFactory; +class CImObjectFactoryImp; + +class CXIMPPscContext; +class MImDataCache; +class CImDataCache; +class CXIMPContextStateEventImp; +class CPeriodic; +class MXIMPProtocolConnection; +class CProtocolImConversationDataHostImp; +class CXIMPOperationBase ; + +class CProtocolImDataHostImp ; + +/** + * Im connection host. + * + * @lib ximpprocessor.lib + * @since S60 v3.2 + */ +//class CProtocolImDataHostImp : public CXIMPApiObjBase, +// public MProtocolImDataHost +NONSHARABLE_CLASS(CProtocolDataHostImp): public MProtocolDataHost + { +public: + /** The class ID. */ + enum { KClassId = IMIMP_CLSID_CPROTOCOLIMDATAHOSTIMP }; + +public: + + IMPORT_C static CProtocolDataHostImp* NewL( MXIMPHost& aHost ); + + IMPORT_C static CProtocolDataHostImp* NewLC( MXIMPHost& aHost ); + + virtual ~CProtocolDataHostImp(); + +private: + + CProtocolDataHostImp( MXIMPHost& aHost ); + void ConstructL(); + +public: // From MXIMPBase + + /** + * Implementation of MXIMPBase interface methods + * @see MXIMPBase + */ + //XIMPIMP_DECLARE_IF_BASE_METHODS + + +public: // MProtocolImDataHost + + void SetHostToProtocol() ; + TAny* GetInterface(TInt aInterfaceId) ; + TInt GetCleanupOperation() ; + + +private: // data + // not owned + MXIMPHost& iHost; + + //CImObjectFactoryImp* iImObjFactory; + + //CProtocolImConversationDataHostImp* iConvDataHost; + + CProtocolImDataHostImp *iImDataHost ; + + }; + + +#endif // CPROTOCOLDATAHOSTIMP_H + diff -r 000000000000 -r e6b17d312c8b imservices/imfeatureplugin/srcimprocessor/protocolimdatahostimp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/imfeatureplugin/srcimprocessor/protocolimdatahostimp.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,200 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Im connection host + * +*/ + + +#include +#include +#include +#include +#include +#include "ximpapiobjbase.h" +#include "imapiobjbase.h" +#include "imobjectfactoryimp.h" +#include "imdatacacheimp.h" +#include "protocolimdatahostimp.h" +#include "protocolimconversationdatahostimp.h" +//#include "ximpprotocolrequestcompleteeventimp.h" +#include "imlogutils.h" +#include "imdatacacheimp.h" + + + +// ======== MEMBER FUNCTIONS ======== + + +// This should be variated. Branding variation can be one +// possibility. One is to leave adaptation deside how soon +// cleanup will be done. +// Now 5 sec used for testing purposes. Better value could be +// some minutes. + +// --------------------------------------------------------------------------- +// CProtocolImDataHostImp::CProtocolImDataHostImp() +// --------------------------------------------------------------------------- +// +CProtocolImDataHostImp::CProtocolImDataHostImp( MXIMPHost& aHost ) +:iHost( aHost ) + { + XImLogger::Log(_L("CProtocolImDataHostImp::CProtocolImDataHostImp Started")); + XImLogger::Log(_L("CProtocolImDataHostImp::CProtocolImDataHostImp Completed")); + } + + +// --------------------------------------------------------------------------- +// CProtocolImDataHostImp::ConstructL() +// --------------------------------------------------------------------------- +// +void CProtocolImDataHostImp::ConstructL() + { + XImLogger::Log(_L("CProtocolImDataHostImp::ConstructL Started")); + iConvDataHost = CProtocolImConversationDataHostImp::NewL( iHost ); + iImObjFactory = CImObjectFactoryImp::NewL(); + iImDataCache = CImDataCache::NewL( iHost ); + + XImLogger::Log(_L("CProtocolImDataHostImp::ConstructL Completed")); + } + + +// --------------------------------------------------------------------------- +// CProtocolImDataHostImp::NewLC() +// --------------------------------------------------------------------------- +// +CProtocolImDataHostImp* CProtocolImDataHostImp::NewLC( MXIMPHost& aHost ) + { + XImLogger::Log(_L("CProtocolImDataHostImp::NewLC Started")); + CProtocolImDataHostImp* self = new( ELeave ) CProtocolImDataHostImp( aHost ); + CleanupStack::PushL( self ); + self->ConstructL(); + XImLogger::Log(_L("CProtocolImDataHostImp::NewLC Completed")); + return self; + } + +// --------------------------------------------------------------------------- +// CProtocolImDataHostImp::NewL() +// --------------------------------------------------------------------------- +// +CProtocolImDataHostImp* CProtocolImDataHostImp::NewL( MXIMPHost& aHost ) + { + XImLogger::Log(_L("CProtocolImDataHostImp::NewL Started")); + CProtocolImDataHostImp* self = new( ELeave ) CProtocolImDataHostImp( aHost ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + XImLogger::Log(_L("CProtocolImDataHostImp::NewL Completed")); + return self; + } +// --------------------------------------------------------------------------- +// CProtocolImDataHostImp::~CProtocolImDataHostImp() +// --------------------------------------------------------------------------- +// +CProtocolImDataHostImp::~CProtocolImDataHostImp() + { + XImLogger::Log(_L("CProtocolImDataHostImp::~CProtocolImDataHostImp Started")); + delete iConvDataHost; + delete iImDataCache; + delete iImObjFactory; + XImLogger::Log(_L("CProtocolImDataHostImp::~CProtocolImDataHostImp Completed")); + } + +// --------------------------------------------------------------------------- +// Implement supported interface access. +// --------------------------------------------------------------------------- +// +//XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CProtocolImDataHostImp, MProtocolImDataHost ) +//XIMPIMP_IF_BASE_GET_INTERFACE_END() +//XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CProtocolImDataHostImp, MProtocolImDataHost ) +//XIMPIMP_IF_BASE_GET_INTERFACE_END() + + +// --------------------------------------------------------------------------- +// CProtocolImDataHostImp::ImObjectFactory() +// --------------------------------------------------------------------------- +// +MImObjectFactory& CProtocolImDataHostImp::ImObjectFactory() + { + XImLogger::Log(_L("CProtocolImDataHostImp::ImObjectFactory Started")); + XImLogger::Log(_L("CProtocolImDataHostImp::ImObjectFactory Completed")); + return *iImObjFactory; + } + +// --------------------------------------------------------------------------- +// CProtocolImDataHostImp::ConversationDataHost() +// --------------------------------------------------------------------------- +// +MProtocolImConversationDataHost& CProtocolImDataHostImp::ConversationDataHost() + { + XImLogger::Log(_L("CProtocolImDataHostImp::ConversationDataHost Started")); + XImLogger::Log(_L("CProtocolImDataHostImp::ConversationDataHost Completed")); + return *iConvDataHost; + } + +// --------------------------------------------------------------------------- +// CProtocolImDataHostImp::SearchDataHost() +// --------------------------------------------------------------------------- +// +//MProtocolImSearchDataHost& CProtocolImDataHostImp::SearchDataHost() +// { +// XImLogger::Log(_L("CProtocolImDataHostImp::ConversationDataHost Started")); + //return *iSearchDataHost; +// XImLogger::Log(_L("CProtocolImDataHostImp::ConversationDataHost Completed")); +// } + +// --------------------------------------------------------------------------- +// CProtocolImDataHostImp::GroupDataHost() +// --------------------------------------------------------------------------- +// +//MProtocolImGroupDataHost& CProtocolImDataHostImp::GroupDataHost() +// { +// XImLogger::Log(_L("CProtocolImDataHostImp::ConversationDataHost Started")); + //return *iGroupDataHost; +// XImLogger::Log(_L("CProtocolImDataHostImp::ConversationDataHost Completed")); +// } + +// --------------------------------------------------------------------------- +// CProtocolImDataHostImp::InvitationDataHost() +// --------------------------------------------------------------------------- +// +//MProtocolImInvitationDataHost& CProtocolImDataHostImp::InvitationDataHost() +// { +// XImLogger::Log(_L("CProtocolImDataHostImp::ConversationDataHost Started")); + //return *iInvitationDataHost; +// XImLogger::Log(_L("CProtocolImDataHostImp::ConversationDataHost Completed")); +// } + + +// --------------------------------------------------------------------------- +// CProtocolImDataHostImp::ConversationDataAccess() +// --------------------------------------------------------------------------- +// +CProtocolImConversationDataHostImp& CProtocolImDataHostImp::ConversationDataAccess() + { + return *iConvDataHost; + } + +// --------------------------------------------------------------------------- +// CProtocolDataHostImp::ImDataCache() +// --------------------------------------------------------------------------- +// +CImDataCache& CProtocolImDataHostImp::ImDataCache() + { + return *iImDataCache; + } + + + +// End of file + diff -r 000000000000 -r e6b17d312c8b imservices/imfeatureplugin/srcimprocessor/protocolimdatahostimp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/imfeatureplugin/srcimprocessor/protocolimdatahostimp.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,129 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Im connection host + * +*/ + +#ifndef CPROTOCOLIMDATAHOSTIMP_H +#define CPROTOCOLIMDATAHOSTIMP_H + +#include +#include +#include +#include +#include +#include "imapiobjbase.h" +#include "ximpapiobjbase.h" +//#include "ximpitemparent.h" +#include "ximphost.h" +//#include "ximpoperationdefs.h" +//#include "ximprequestidbuilder.h" + + +class MXIMPHost; +class MImObjectFactory; +class CImObjectFactoryImp; + +class CXIMPPscContext; +class MImDataCache; +class CImDataCache; +class CXIMPContextStateEventImp; +class CPeriodic; +class MXIMPProtocolConnection; +class CProtocolImConversationDataHostImp; +class MProtocolImConversationDataHost; +class CProtocolImGroupDataHostImp; +class CProtocolImInvitationDataHostImp; +class CProtocolImSearchDataHostImp; + + +/** + * Im connection host. + * + * @lib ximpprocessor.lib + * @since S60 v3.2 + */ +//class CProtocolImDataHostImp : public CXIMPApiObjBase, +// public MProtocolImDataHost +NONSHARABLE_CLASS(CProtocolImDataHostImp): public MProtocolImDataHost + { +public: + /** The class ID. */ + enum { KClassId = IMIMP_CLSID_CPROTOCOLIMDATAHOSTIMP }; + +public: + + static CProtocolImDataHostImp* NewL( MXIMPHost& aHost ); + + static CProtocolImDataHostImp* NewLC( MXIMPHost& aHost ); + + virtual ~CProtocolImDataHostImp(); + +private: + + CProtocolImDataHostImp( MXIMPHost& aHost ); + void ConstructL(); + +public: // From MXIMPBase + + /** + * Implementation of MXIMPBase interface methods + * @see MXIMPBase + */ + //XIMPIMP_DECLARE_IF_BASE_METHODS + + +public: // MProtocolImDataHost + + MImObjectFactory& ImObjectFactory(); + + MProtocolImConversationDataHost& ConversationDataHost(); + + //MProtocolImGroupDataHost& GroupDataHost(); + + //MProtocolImInvitationDataHost& InvitationDataHost(); + + //MProtocolImSearchDataHost& SearchDataHost(); + + CProtocolImConversationDataHostImp& ConversationDataAccess() ; + + + CImDataCache& ImDataCache(); + + +private: // data + + //not owned + MXIMPHost& iHost; + + /** + * Data cache + */ + CImDataCache* iImDataCache; + + /** + * Data hosts + */ + CImObjectFactoryImp* iImObjFactory; + CProtocolImConversationDataHostImp* iConvDataHost; + CProtocolImGroupDataHostImp* iGroupDataHost; + CProtocolImInvitationDataHostImp* iInvitationDataHost; + CProtocolImSearchDataHostImp* iSearchDataHost; + + + }; + + +#endif // CPROTOCOLIMDATAHOSTIMP_H + diff -r 000000000000 -r e6b17d312c8b imservices/imfeatureplugin/srcutils/imlogutils.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/imfeatureplugin/srcutils/imlogutils.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,38 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description:file for generating XImLogger +* +*/ + + + +// INCLUDE FILES +#include "imlogutils.h" + +// CONSTANTS +const TInt KLogBufferLength = 256; +_LIT(KImLogDir, "ximpim"); +_LIT(KImLogFile, "im.txt"); + +void XImLogger::Log(TRefByValue aFmt,...) + { + VA_LIST list; + VA_START(list, aFmt); + // Print to log file + TBuf buf; + buf.FormatList(aFmt, list); + RFileLogger::Write(KImLogDir, KImLogFile, EFileLoggingModeAppend, buf); + } + +// End of File diff -r 000000000000 -r e6b17d312c8b imservices/imfeatureplugin/srcutils/imlogutils.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/imfeatureplugin/srcutils/imlogutils.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,49 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: header for IM logs +* +*/ + + + +#ifndef IMLOGUTILS_H +#define IMLOGUTILS_H + +// INCLUDES +#include +#include + + +/** +* Debug log writer +* @lib +* +*/ +class XImLogger + { + public: // New functions + + /** + * Writes log to log file + * @param + * @return + */ + static void Log(TRefByValue aFmt,...); + + + }; + +#endif // IMLOGUTILS_H + +// End of File diff -r 000000000000 -r e6b17d312c8b imservices/instantmessagingcache/group/backup_registration.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/instantmessagingcache/group/backup_registration.xml Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff -r 000000000000 -r e6b17d312c8b imservices/instantmessagingcache/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/instantmessagingcache/group/bld.inf Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: build definition file +* +*/ + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS +../rom/instantmessagingcache.iby CORE_MW_LAYER_IBY_EXPORT_PATH(instantmessagingcache.iby) + +// ROM SIS stubs +../sis/imcachestub.sis /epoc32/data/Z/System/Install/imcachestub.sis +// module include +#include "../imcacheserver/group/bld.inf" +#include "../imcacheclient/group/bld.inf" + +// end of file \ No newline at end of file diff -r 000000000000 -r e6b17d312c8b imservices/instantmessagingcache/imcacheclient/bwins/imcacheclientu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/instantmessagingcache/imcacheclient/bwins/imcacheclientu.def Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,6 @@ +EXPORTS + ?CreateUpdaterL@CIMCacheFactory@@QAEPAVMIMCacheUpdater@@HABVTDesC16@@H@Z @ 1 NONAME ; class MIMCacheUpdater * CIMCacheFactory::CreateUpdaterL(int, class TDesC16 const &, int) + ?Release@CIMCacheFactory@@SAXXZ @ 2 NONAME ; void CIMCacheFactory::Release(void) + ?InstanceL@CIMCacheFactory@@SAPAV1@XZ @ 3 NONAME ; class CIMCacheFactory * CIMCacheFactory::InstanceL(void) + ?CreateAccessorL@CIMCacheFactory@@QAEPAVMIMCacheAccessor@@HABVTDesC16@@@Z @ 4 NONAME ; class MIMCacheAccessor * CIMCacheFactory::CreateAccessorL(int, class TDesC16 const &) + diff -r 000000000000 -r e6b17d312c8b imservices/instantmessagingcache/imcacheclient/eabi/imcacheclientu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/instantmessagingcache/imcacheclient/eabi/imcacheclientu.def Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,10 @@ +EXPORTS + _ZN15CIMCacheFactory14CreateUpdaterLEiRK7TDesC16i @ 1 NONAME + _ZN15CIMCacheFactory15CreateAccessorLEiRK7TDesC16 @ 2 NONAME + _ZN15CIMCacheFactory7ReleaseEv @ 3 NONAME + _ZN15CIMCacheFactory9InstanceLEv @ 4 NONAME + _ZTI14CIMCacheClient @ 5 NONAME ; ## + _ZTI15CIMCacheFactory @ 6 NONAME ; ## + _ZTV14CIMCacheClient @ 7 NONAME ; ## + _ZTV15CIMCacheFactory @ 8 NONAME ; ## + diff -r 000000000000 -r e6b17d312c8b imservices/instantmessagingcache/imcacheclient/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/instantmessagingcache/imcacheclient/group/bld.inf Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,26 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: build definition file +* +*/ + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_MMPFILES +imcacheclient.mmp + +// end of file diff -r 000000000000 -r e6b17d312c8b imservices/instantmessagingcache/imcacheclient/group/imcacheclient.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/instantmessagingcache/imcacheclient/group/imcacheclient.mmp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,55 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: mmp file +* +*/ + + +#include +#include +#include "../../inc/imcacheuids.h" + +TARGET imcacheclient.dll +TARGETTYPE dll +UID KStaticInterfaceDllUid2 KIMCacheClientUid3 +CAPABILITY CAP_CLIENT_DLL +VENDORID VID_DEFAULT + +VERSION 10.0 +SOURCEPATH ../src + +SOURCE cimcachefactory.cpp +SOURCE cimcacheupdater.cpp +SOURCE cimcacheaccessor.cpp +SOURCE cimcacheclient.cpp +SOURCE imcacheprocessstarter.cpp +SOURCE cimcacheeventhandler.cpp +SOURCE cimcacheaccesseventhandler.cpp + + +USERINCLUDE ../inc +USERINCLUDE ../../inc + +APP_LAYER_SYSTEMINCLUDE + + +LIBRARY euser.lib +LIBRARY efsrv.lib +LIBRARY flogger.lib +LIBRARY estor.lib +LIBRARY cone.lib +LIBRARY charconv.lib + + +// end of file \ No newline at end of file diff -r 000000000000 -r e6b17d312c8b imservices/instantmessagingcache/imcacheclient/inc/cimcacheaccesseventhandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/instantmessagingcache/imcacheclient/inc/cimcacheaccesseventhandler.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,138 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: cache message change observer +* +*/ + + +#ifndef __CIMCACHEACCESSEVENTHANDLER_H__ +#define __CIMCACHEACCESSEVENTHANDLER_H__ + +#include +#include +#include + +#include + +class MIMCacheClient; +class MIMCacheEventHandler; + +/** + * a class to listen to server cache message change + */ +NONSHARABLE_CLASS( CIMCacheAccessEventHandler ): public CActive + { + public: + /** + * Two-phased constructor. + * @param aRegistrar ,client refence + * @param aHandler a handler to send data to ui client + */ + static CIMCacheAccessEventHandler* NewL( MIMCacheClient& aRegistrar , + MIMCacheEventHandler& aHandler ); + /** + * ~CIMCacheAccessEventHandler. + */ + virtual ~CIMCacheAccessEventHandler(); + + public: // From CActive + + /** + * RunL + */ + void RunL(); + + /** + * DoCancel + */ + void DoCancel(); + + /** + * RunError + */ + TInt RunError( TInt /* aError */); + + + + + + public : // new functions + /** + * UnRegisterObserver from server + */ + void UnRegisterObserver(); + private: + + /** + * default CIMCacheAccessEventHandler + * @param aRegistrar ,client refence + * @param aHandler a handler to send data to ui client + */ + CIMCacheAccessEventHandler( MIMCacheClient& aRegistrar, + MIMCacheEventHandler& aHandler); + /** + * default ConstructL + */ + void ConstructL(); + + + /** + * Gets called when data update is available. + * Client can then decide wether to use the old one + * @param aBuffer structure of SIMCacheMessageData type + */ + void GetBufferChatDataL(); + + + /** + * Gets called when data update is available. + * extract the chat data and send to client + * @param aChatDataBuffer ,buffer containing number of chat data + * @param aMore, indicate that there is still pending packets + */ + void InternalizeChatDataL( TPtr8 aChatDataBuffer , TBool& aMore ); + + + /** + * Gets called when data update is available. + * get data buffer from server + * @param aEventType, type of data + */ + void GetBufferedChatItemL( TIMCacheEventType aEventType ); + + /** + * read the stream and write into buffer + * @param aEventType, type of data + * @param aChatItemBuffer structure of SIMCacheContactData type + */ + + void InternalizeChatItemL( TIMCacheEventType aEventType, + TPtr8 aChatItemBuffer ); + + private: // data + + // doesn't own: registrar + MIMCacheClient& iRegistrar; + // owned , need to observer to server or not + TBool iContinueObserving ; + // client side observer event + MIMCacheEventHandler& iAccessHandler; + + }; + +#endif // __CIMCACHEACCESSEVENTHANDLER_H__ + + +// END OF FILE + diff -r 000000000000 -r e6b17d312c8b imservices/instantmessagingcache/imcacheclient/inc/cimcacheaccessor.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/instantmessagingcache/imcacheclient/inc/cimcacheaccessor.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,151 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: class declaration for accessing the cache +* +*/ + + + +#ifndef __CIMCACHEACCESSOR_H__ +#define __CIMCACHEACCESSOR_H__ + +#include +#include "mimcacheaccessor.h" +#include "cimcacheclient.h" + +class MIMCacheEventHandler; + +/** + * write right class declaration + */ + +NONSHARABLE_CLASS( CIMCacheAccessor ): public CBase, + public MIMCacheAccessor + { + public: + /** + * Two-phased constructor. + * @param aServiceId, service id to used + * @param aUserId, user id who is conversing + */ + static CIMCacheAccessor* NewL(TInt aServiceId, + const TDesC& aUserId ); + /** + * virtual destructor. + */ + virtual ~CIMCacheAccessor(); + + + private: + + /** + * ConstructL. + * @param aUserId, user id who is conversing + */ + + void ConstructL( const TDesC& aUserId ); + + /** + * default constructor. + * @param aServiceId, service id to used + */ + CIMCacheAccessor(TInt aServiceId); + + + private: // from MIMCacheAccessor + + /** + * Register to observer instantmessagingcache data updates + * @param aObserver the observer interface + */ + void RegisterObserverL( MIMCacheEventHandler& aObserver ); + + /** + * Unregister a instantmessagingcache data update observer + * @param aObserver the observer interface + */ + void UnRegisterObserver( MIMCacheEventHandler& aObserver); + + + /** + * to get the unread message count from server + * @param aOwnUserId , logged in user id + * @return number of unread msg count + */ + TInt GetUnreadMessageCountL(const TDesC& aBuddyId ); + + /** + * to get the all unread message count from server + * @param , aOwnUserId logged in user id + * @return number of all unread msg count + */ + TInt GetAllUnreadMessageCountL(); + + /** + * check if already conversation opened + * @param aServiceId, serviceid to use + * @param aOwnUserId, own user id + * @param aRecipientId, the selected user id with whom conversation is started + * @return ETrue if already exist else EFlase. + */ + TBool IsConversationExistL( const TDesC& aBuddyId ) ; + + /** + * closes conversation and commit operation + * @param aServiceId service id. + * @param aOwnId own user id. + * @param aRecipientId recipient's user id. + */ + void CloseConversationL( const TDesC& aBuddyId ); + + + /** + * get the chat list corresponding to service + * @param aServiceId service id + * @return Array of chats + */ + RArray GetChatListL( const TInt aServiceId ); + + private : + /** + * default constructor. + * @param aServiceId, service id to used + */ + void InternalizeChatListL( RArray& aChatArray, TPtr8 aChatListBuffer, TBool& aMore ); + + public : // new api + + /** + * return the serviceid + */ + TInt ServiceId() const ; + + private: // data + + // owned , user id + HBufC* iUserId; + + // not owned , client + CIMCacheClient iClient; + + // owned, service id + TInt iServiceId; + + }; + +#endif // __CIMCACHEUPDATER_H__ + + +// END OF FILE + diff -r 000000000000 -r e6b17d312c8b imservices/instantmessagingcache/imcacheclient/inc/cimcacheclient.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/instantmessagingcache/imcacheclient/inc/cimcacheclient.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,218 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: client class to connect to server +* +*/ + + + +#ifndef __CIMCACHECLIENT_H__ +#define __CIMCACHECLIENT_H__ + +#include +#include +#include "mimcacheclient.h" + +class MIMCacheEventHandler; +class CIMCacheEventHandler; +class MIMCacheEventHandler; +class CIMCacheAccessEventHandler; +/** + * CIMCacheClient ClientServer + */ +class CIMCacheClient : public CBase, + public RSessionBase, + public MIMCacheClient + { + + public: // Constructor and destructor + /* + * CIMCacheClient + */ + CIMCacheClient(); + + /* + * ~CIMCacheClient + */ + ~CIMCacheClient(); + + + public: // New methods + + /** + * Connect + */ + TInt Connect(); + + /** + * Register to observer converstaionitems data updates + * @param aObserver the observer interface + */ + void RegisterUpdateObserverL( MIMCacheEventHandler& aObserver ); + + /** + * Unregister a converstaionitems data update observer + * @param aObserver the observer interface + */ + void UnRegisterUpdateObserver( MIMCacheEventHandler& aObserver ); + /** + * Register to observer converstaionitems data access + * @param aObserver the observer interface + */ + void RegisterAccessObserverL( MIMCacheEventHandler& aObserver ); + + /** + * Unregister a converstaionitems data access observer + * @param aObserver the observer interface + */ + void UnRegisterAccessObserver( MIMCacheEventHandler& aObserver); + + /** + * start the transaction and perform the operation + * @param aOperationType , operation to perform + */ + TInt StartTransactionL( EIMCacheOperations aOperationType ); + + /** + * start the transaction and perform the operation + * @param aText ,text to send to server + * @param aOperationType operation to perform + */ + void StartTransactionL( EIMCacheOperations aOperationType, + const TDesC& aText + ) ; + + /** + * start the transaction and perform the operation + * @param aServiceId service id to use + * @param aUserId user id to use + * @param aOperationType operation to perform + */ + void StartTransactionL( EIMCacheOperations aOperationType , + TInt aServiceId, + const TDesC& aText + ); + + /** + * start the transaction and perform the operation + * @param aServiceId service id to use + * @param aSender user id to use + * @param aRecipient,recipient user id + * @param aOperationType operation to perform + */ + void StartTransactionL( EIMCacheOperations aOperationType, + TInt aServiceId, + const TDesC& aText1 , + const TDesC& aText2 + ) ; + + + /** + * to get the all unread message count from server + * @param , aOwnUserId logged in user id + * @return number of unread msg count + */ + TInt GetInformationL(EIMCacheOperations aOperationType , TInt aServiceId,const TDesC& aBuddyId ); + + /** + * to get the count from server + * @param aOperationType operation to perform + * @param aServiceId, service id used + * @param , aOwnUserId logged in user id + * @return number of all unread msg count + */ + TInt GetInformationL(EIMCacheOperations aOperationType, TInt aServiceId ); + + + /** + * to get the list of availabe chats from server + * @param aServiceId, service id used + * @return list buffer + */ + TPtr8 GetChatListL( const TInt& aServiceId = -1); + +private: + + /** + * CreateArgumentsL pack the given parameters + * @param aServiceId service id to use + * @param aUserId user id to use + * @param aText,a text to send + * @return TIpcArgs, packed arguments + */ + TIpcArgs CreateArgumentsL( TInt aServiceId, const TDesC& aText1 , + const TDesC& aText2 ); + + /** + * CreateArgumentsL pack the given parameters + * @param aServiceId service id to use + * @param aUserId user id to use + * @return TIpcArgs, packed arguments + */ + TIpcArgs CreateArgumentsL( TInt aServiceId , + const TDesC& aText ); + + + + +public: // MIMCacheClient + + /** + * Registeres the cache update observer to server + * @param aStatus status message to regisetr + * @param aRight,right is operations + */ + void RegisterObserverToServerL( TRequestStatus& aStatus,EIMCacheOperations aRight ) ; + + + /** + * unRegisteres the cache update observer to server + * @param aStatus status message to regisetr + * @param aRight,right is operations + */ + void UnRegisterObserverToServerL( TRequestStatus& aStatus, EIMCacheOperations aRight ) ; + + /** + * cancels any outstanding requests pending from the server + * @param aStatus status message to regisetr + * @param aRight,right is operations + */ + void CancelRequestL( TRequestStatus& aStatus, EIMCacheOperations aRight); + + /** + * Gets called when data update is available. + * Client can then decide wether to use the old one + * @param aRight, operations + * @param abuuferptr + */ + TPtr8 GetBufferedDataL(EIMCacheOperations aOperationType ); + + private: + + // owned , a array for all client who has + // register update data change event + CIMCacheEventHandler* iUpdateObserver; + // owned , a array for all client who has + // register update data change event + CIMCacheAccessEventHandler* iAccessObserver; + //owned buffer to get chats from server. + HBufC8* iChatBuffer; + + }; + +#endif // __CIMCACHECLIENT_H__ + + +// END OF FILE + diff -r 000000000000 -r e6b17d312c8b imservices/instantmessagingcache/imcacheclient/inc/cimcacheeventhandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/instantmessagingcache/imcacheclient/inc/cimcacheeventhandler.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,134 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: cache message change observer +* +*/ + + +#ifndef __CIMCACHEEVENTHANDLER_H__ +#define __CIMCACHEEVENTHANDLER_H__ + +#include +#include +#include + +#include + +class MIMCacheClient; +class MIMCacheEventHandler; + +/** + * a class to listen to server cache message change + */ +NONSHARABLE_CLASS( CIMCacheEventHandler ): public CActive + { + public: + /** + * Two-phased constructor. + * @param aRegistrar ,client refence + * @param aHandler a handler to send data to ui client + */ + static CIMCacheEventHandler* NewL( MIMCacheClient& aRegistrar , + MIMCacheEventHandler& aHandler ); + /** + * ~CIMCacheEventHandler. + */ + virtual ~CIMCacheEventHandler(); + + public: // From CActive + + /** + * RunL + */ + void RunL(); + + /** + * DoCancel + */ + void DoCancel(); + + /** + * RunError + */ + TInt RunError( TInt /* aError */); + + + public : // new functions + /** + * UnRegisterObserver from server + */ + void UnRegisterObserver(); + private: + + /** + * default CIMCacheEventHandler + * @param aRegistrar ,client refence + * @param aHandler a handler to send data to ui client + */ + CIMCacheEventHandler( MIMCacheClient& aRegistrar, + MIMCacheEventHandler& aHandler ); + /** + * default ConstructL + */ + void ConstructL(); + + /** + * Gets called when data update is available. + * get data buffer from server + */ + void GetBufferChatDataL() ; + + /** + * Gets called when data update is available. + * extract the data and send to client + * @param aChatDataBuffer structure of SIMCacheMessageData type + * @param aMore indicate more packets pending at server side + */ + void InternalizeChatDataL( TPtr8 aChatDataBuffer , + TBool& aMore ); + + /** + * Gets called when data update is available. + * get data buffer from server + * @param aEventType, type of data + */ + void GetBufferedChatItemL( TIMCacheEventType aEventType ); + + /** + * read the stream and write into buffer + * @param aEventType, type of data + * @param aChatItemBuffer structure of SIMCacheContactData type + */ + + void InternalizeChatItemL( TIMCacheEventType aEventType, + TPtr8 aChatItemBuffer ); + + private: // data + + + // doesn't own: registrar + MIMCacheClient& iRegistrar; + // owned , need to observer to server or not + TBool iContinueObserving ; + // client side observer event + MIMCacheEventHandler& iUpdateHandler; + + + }; + +#endif // __CIMCACHEEVENTHANDLER_H__ + + +// END OF FILE + diff -r 000000000000 -r e6b17d312c8b imservices/instantmessagingcache/imcacheclient/inc/cimcacheupdater.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/instantmessagingcache/imcacheclient/inc/cimcacheupdater.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,167 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: class declaration for updating the cache +* +*/ + + + +#ifndef __CIMCACHEUPDATER_H__ +#define __CIMCACHEUPDATER_H__ + +#include +#include "mimcacheupdater.h" +#include "cimcacheclient.h" + +class MIMCacheEventHandler; + +/** + * write right class declaration + */ + +NONSHARABLE_CLASS( CIMCacheUpdater ): public CBase, + public MIMCacheUpdater + { + public: + /** + * Two-phased constructor. + * @param aServiceId, service id to used + * @param aUserId, user id who is conversing + */ + static CIMCacheUpdater* NewL(TInt aServiceId, + const TDesC& aUserId, + TBool aRegistrationNeeded ); + /** + * virtual destructor. + */ + virtual ~CIMCacheUpdater(); + + + private: + + /** + * ConstructL. + * @param aUserId, user id who is conversing + */ + + void ConstructL( const TDesC& aUserId, TBool aRegistrationNeeded ); + + /** + * default constructor. + * @param aServiceId, service id to used + */ + CIMCacheUpdater(TInt aServiceId); + + /** + * default constructor. + * @param aServiceId, service id to used + */ + void InternalizeChatListL( RArray& aChatArray, TPtr8 aChatListBuffer, TBool& aMore ); + + private: // from MIMCacheUpdater + + /** + * Register to observer instantmessagingcache data updates + * @param aObserver the observer interface + */ + void RegisterObserverL( MIMCacheEventHandler& aObserver ); + + /** + * Unregister a instantmessagingcache data update observer + * @param aObserver the observer interface + */ + void UnRegisterObserver( MIMCacheEventHandler& aObserver); + + + /** + * start a new conversation + * @param aBuddyId a recipient user id + */ + void StartNewConversationL(const TDesC& aBuddyId ) ; + + /** + * append the new recieve message + * @param aSender a sender user id + * @param aRecipient a recipient user id + * @param aText a text to append + */ + void AppendReceiveMessageL( const TDesC& aBuddyId, + const TDesC& aText ) ; + + /** + * append the new send message + * @param aText a text to append + */ + void AppendSendMessageL(const TDesC& aText ) ; + + /** + * append the normal information message + * @param aBuddyId buddy id. + * @param aText a text to append + */ + void AppendMessageL(const TDesC& aBuddyId, const TDesC& aText) ; + + + /** + * closes conversation and commit operation + * @param aServiceId service id. + * @param aBuddyId buddy id. + * @param aRecipientId recipient's user id. + */ + void CloseConversationL( const TDesC& aBuddyId ) ; + + /* + * close all conversation in service Id + */ + void CloseAllConversationL(); + + /** + * Deactivate all open conversations and commit operation + */ + TInt DeactivateConversationL() ; + + + /** + * get the chat list corresponding to service + * @param aServiceId service id + * @return Array of chats + */ + RArray GetChatListL( const TInt aServiceId ); + + + public : // new api + + /** + * return the serviceid + */ + TInt ServiceId() const ; + + private: // data + + // owned , user id + HBufC* iUserId; + + // not owned , client + CIMCacheClient iClient; + + // owned, service id + TInt iServiceId; + + }; + +#endif // __CIMCACHEUPDATER_H__ + + +// END OF FILE + diff -r 000000000000 -r e6b17d312c8b imservices/instantmessagingcache/imcacheclient/inc/imcacheprocessstarter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/instantmessagingcache/imcacheclient/inc/imcacheprocessstarter.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,92 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: start the server +* +*/ + + + +#ifndef __IMCACHEPROCESSSTARTER_H__ +#define __IMCACHEPROCESSSTARTER_H__ + +#include + +/** + * Generic process starter. + */ +class IMCacheProcessStarter + { + public: // New methods + + /** + * read full path for client + * @param aExeName the , name of server exe + * @param aFullExePath path of server exe + */ + static void FullExePathForClientLocation( + const TDesC& aExeName, + TFileName& aFullExePath ); + + /** + * StartInstance the instance of server + * @param aFullExePath path of server exe + * @param aCommand the , to excute + * @param aParams, starter parameter + */ + static TInt StartInstance( + const TDesC& aFullExePath, + const TDesC& aCommand + ); + + /** + * connect to the server + * @param aFullExePath path of server exe + * @param aCommand the , to excute + * @param aSessionToConnect, sesion to be used + * @param aServerName, server name + * @param aClientVersion, client version + * @param aAsyncMessageSlots, slots number + */ + static TInt ConnectToServer( + const TDesC& aFullExePath, + const TDesC& aCommand, + RSessionBase& aSessionToConnect, + const TDesC& aServerName, + const TVersion& aClientVersion, + TInt aAsyncMessageSlots ); + + + + private: // Helpers + + /** + * DoStartInstance + * @param aFullExePath path of server exe + * @param aCommand the , to excute + * @param aParams, starter parameter + */ + static TInt DoStartInstance( + const TDesC& aFullExePath, + const TDesC& aCommand ); + + + + }; + +#endif // __IMCACHEPROCESSSTARTER_H__ + + +//END OF FILE + + diff -r 000000000000 -r e6b17d312c8b imservices/instantmessagingcache/imcacheclient/inc/mimcacheclient.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/instantmessagingcache/imcacheclient/inc/mimcacheclient.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,75 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: message change observer +* +*/ + + + +#ifndef __MIMCACHECLIENT_H +#define __MIMCACHECLIENT_H + +#include +#include + +/** + * An interface through which client gets information + * about available data updates. + * + * @since + */ +class MIMCacheClient + { + public: + + + /** + * Registeres the cache update observer to server + * @param aStatus status message to regisetr + * @param aRight, operations + */ + virtual void RegisterObserverToServerL( TRequestStatus& aStatus, EIMCacheOperations aRight ) = 0; + + /** + * unRegisteres the cache update observer to server + * @param aStatus status message to regisetr + * @param aRight, operations + */ + virtual void UnRegisterObserverToServerL( TRequestStatus& aStatus, EIMCacheOperations aRight ) = 0 ; + + /** + * Gets called when data update is available. + * Client can then decide wether to use the old one + * @param aRight, operations + * @param abuuferptr + */ + virtual TPtr8 GetBufferedDataL(EIMCacheOperations aOperationType ) = 0 ; + + /** + * cancels any outstanding requests pending from the server + * @param aStatus status message to regisetr + * @param aRight,right is operations + */ + virtual void CancelRequestL( TRequestStatus& aStatus, EIMCacheOperations aRight) = 0; + +protected: + /** + * Destructor + */ + virtual ~MIMCacheClient() {}; + }; + +#endif //__MIMCACHECLIENT_H + + diff -r 000000000000 -r e6b17d312c8b imservices/instantmessagingcache/imcacheclient/src/cimcacheaccesseventhandler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/instantmessagingcache/imcacheclient/src/cimcacheaccesseventhandler.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,333 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: cache message change observer +* +*/ + + +// INCLUDE FILES + +#include "cimcacheaccesseventhandler.h" +#include "mimcacheclient.h" +#include "mimcacheeventhandler.h" +// logs +#include "imcachedebugtrace.h" + +// ----------------------------------------------------------------------------- +// CIMCacheAccessEventHandler::NewL +// ----------------------------------------------------------------------------- +// +CIMCacheAccessEventHandler* CIMCacheAccessEventHandler::NewL( + MIMCacheClient& aRegistrar, + MIMCacheEventHandler& aHandler ) + { + TRACE( T_LIT("CIMCacheAccessEventHandler::NewL() begin") ); + CIMCacheAccessEventHandler* self = new ( ELeave ) CIMCacheAccessEventHandler( aRegistrar ,aHandler ) ; + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); //self + TRACE( T_LIT("CIMCacheAccessEventHandler::NewL() end") ); + return self; + } + +// ----------------------------------------------------------------------------- +// CIMCacheAccessEventHandler::ConstructL +// ----------------------------------------------------------------------------- +// +void CIMCacheAccessEventHandler::ConstructL() + { + TRACE( T_LIT("CIMCacheAccessEventHandler::ConstructL() begin") ); + iContinueObserving = ETrue ; + CActiveScheduler::Add( this ); + iRegistrar.RegisterObserverToServerL( iStatus ,EIMCacheObserveMessageAccessRegister ); + SetActive(); + TRACE( T_LIT("CIMCacheAccessEventHandler::ConstructL() end") ); + } + +// ----------------------------------------------------------------------------- +// CIMCacheAccessEventHandler::~CIMCacheAccessEventHandler +// ----------------------------------------------------------------------------- +// +CIMCacheAccessEventHandler::~CIMCacheAccessEventHandler() + { + TRACE( T_LIT("CIMCacheAccessEventHandler::~CIMCacheAccessEventHandler() begin") ); + Cancel(); + TRACE( T_LIT("CIMCacheAccessEventHandler::~CIMCacheAccessEventHandler() end") ); + } + +// ----------------------------------------------------------------------------- +// CIMCacheAccessEventHandler::CIMCacheAccessEventHandler( +// ----------------------------------------------------------------------------- +// +CIMCacheAccessEventHandler::CIMCacheAccessEventHandler( + MIMCacheClient& aRegistrar , + MIMCacheEventHandler& aHandler) : + CActive( CActive::EPriorityIdle ), + iRegistrar( aRegistrar ), + iAccessHandler( aHandler ) + { + TRACE( T_LIT("CIMCacheAccessEventHandler::CIMCacheAccessEventHandler()") ); + } +// ----------------------------------------------------------------------------- +// CIMCacheAccessEventHandler::RunL +// ----------------------------------------------------------------------------- +// +void CIMCacheAccessEventHandler::RunL() + { + TRACE( T_LIT("CIMCacheAccessEventHandler::RunL() begin") ); + TRACE( T_LIT("CIMCacheAccessEventHandler::RunL() iStatus code = "),iStatus.Int() ); + + switch( iStatus.Int() ) + { + case EIMOperationUnreadMessage : + { + TRACE( T_LIT("CIMCacheAccessEventHandler::RunL() EIMOperationUnreadMessage") ); + GetBufferChatDataL(); + break; + } + case EIMOperationUnreadChange : + { + // message data available get the data + GetBufferedChatItemL(EIMCacheUnreadChange); + break; + } + case EIMOperationChatStarted : + { + // message data available get the data + GetBufferedChatItemL(EIMCacheChatStarted); + break; + } + case EIMOperationChatDeleted : + { + // message data available get the data + GetBufferedChatItemL(EIMCacheChatClosed ); + break; + } + case EIMOperationAllChatDeleted: + { + iAccessHandler.HandleIMCacheEventL( EIMCacheAllChatClosed, NULL ); + break; + } + case EIMOperationUnRegistered: + { + TRACE( T_LIT("CIMCacheEventHandler::RunL() EIMOperationUnRegistered") ); + iContinueObserving = EFalse; + break; + } + default : + { + TRACE( T_LIT("CIMCacheEventHandler::RunL() default") ); + break; + } + } + + TRACE( T_LIT("CIMCacheAccessEventHandler::RunL() iContinueObserving iContinueObserving = %d") ,iContinueObserving); + // check need to continue observing to server + if( iContinueObserving ) + { + iRegistrar.RegisterObserverToServerL( iStatus ,EIMCacheObserveMessageAccessRegister ); + SetActive(); + } + TRACE( T_LIT("CIMCacheAccessEventHandler::RunL() end") ); + } +// ----------------------------------------------------------------------------- +// CIMCacheAccessEventHandler::DoCancel +// ----------------------------------------------------------------------------- +// +void CIMCacheAccessEventHandler::DoCancel() + { + TRACE( T_LIT("CIMCacheAccessEventHandler::DoCancel() ") ); + if( IsActive() ) + { + TRAP_IGNORE(iRegistrar.CancelRequestL( iStatus ,EIMCacheCancelRequest )); + } + } + +// --------------------------------------------------------- +// CIMCacheAccessEventHandler::RunError() +// --------------------------------------------------------- +// +TInt CIMCacheAccessEventHandler::RunError( TInt /* aError */) + { + TRACE( T_LIT("CVIMPSTEngineCVListener::RunError() start")); + return KErrNone; + } +// ----------------------------------------------------------------------------- +// CIMCacheAccessEventHandler::UnRegisterObserver +// ----------------------------------------------------------------------------- +// +void CIMCacheAccessEventHandler::UnRegisterObserver() + { + TRACE( T_LIT("CIMCacheAccessEventHandler::UnRegisterObserver() begin") ); + if( IsActive() ) + { + TRACE( T_LIT("CIMCacheAccessEventHandler::UnRegisterObserver() active") ); + TRAP_IGNORE(iRegistrar.UnRegisterObserverToServerL( iStatus ,EIMCacheObserveMessageAccessUnRegister )); + } + TRACE( T_LIT("CIMCacheAccessEventHandler::UnRegisterObserver() end") ); + } + +// ----------------------------------------------------------------------------- +// CIMCacheAccessEventHandler::GetBufferChatDataL +// ----------------------------------------------------------------------------- +// +void CIMCacheAccessEventHandler::GetBufferChatDataL() + { + TRACE( T_LIT("CIMCacheAccessEventHandler::GetBufferChatDataL() begin") ); + + TBool more = ETrue; + while(more) + { + TPtr8 bufferPtr = iRegistrar.GetBufferedDataL( EIMCacheGetBufferedPackets ); + InternalizeChatDataL( bufferPtr , more ); + } + TRACE( T_LIT("CIMCacheAccessEventHandler::GetBufferChatDataL() end") ); + } + +// ----------------------------------------------------------------------------- +// CIMCacheAccessEventHandler::InternalizeChatDataL +// ----------------------------------------------------------------------------- +void CIMCacheAccessEventHandler::InternalizeChatDataL( TPtr8 aChatDataBuffer , TBool& aMore ) + { + TRACE( T_LIT("CIMCacheAccessEventHandler::InternalizeChatDataL() Start") ); + if( 0 == aChatDataBuffer.Length()) + { + TRACE( T_LIT("CIMCacheAccessEventHandler::InternalizeChatItemL() aChatDataBuffer is zeor, hence returning ") ); + return; + } + RDesReadStream readAllStream ; + RDesReadStream readStream ; + + readAllStream.Open( aChatDataBuffer ); + CleanupClosePushL(readAllStream); + + TInt messageCount = readAllStream.ReadInt16L(); + + for( TInt i=0; i< messageCount; i++) + { + SIMCacheMessageData chatData = + { + TIMCacheMessageType(0), + }; + + TInt size = readAllStream.ReadInt16L() ; + HBufC8* mBuffer = HBufC8::NewLC( size ); + TPtr8 mBufferPtr = mBuffer->Des(); + + readAllStream.ReadL( mBufferPtr , size ); + + readStream.Open( *mBuffer ); + CleanupClosePushL(readStream) ; + + chatData.iMessageType = static_cast( readStream.ReadInt16L() ); + chatData.iMessagerType = static_cast( readStream.ReadInt16L() ); + chatData.iContentType = static_cast( readStream.ReadInt16L() ); + chatData.iTime = static_cast( readStream.ReadReal64L() ); + + TInt buddyLength = readStream.ReadInt16L(); + HBufC* buddy = HBufC::NewLC( buddyLength ); + TPtr buddyPtr = buddy->Des(); + readStream.ReadL( buddyPtr , buddyLength ); + chatData.iBuddyId = buddy; + + TInt textSize = readStream.ReadInt16L(); + HBufC* text = HBufC::NewLC( textSize ); + TPtr textPtr = text->Des(); + readStream.ReadL( textPtr , textSize); + chatData.iText = text; + + iAccessHandler.HandleIMCacheEventL(EIMCacheUnreadMessage , &chatData); + + CleanupStack::PopAndDestroy(4);//close read stream, delete mBuffer, text, buddy + } + + aMore = static_cast( readAllStream.ReadInt16L() ); + + CleanupStack::PopAndDestroy();//readAllStream. + + TRACE( T_LIT("CIMCacheAccessEventHandler::InternalizeChatDataL() End") ); + } + +// ----------------------------------------------------------------------------- +// CIMCacheAccessEventHandler::GetBufferedChatItemL +// ----------------------------------------------------------------------------- +// +void CIMCacheAccessEventHandler::GetBufferedChatItemL( TIMCacheEventType aEventType ) + { + TRACE( T_LIT("CIMCacheAccessEventHandler::GetBufferedChatItemL() begin") ); + + TPtr8 bufferPtr = iRegistrar.GetBufferedDataL( EIMCacheGetBufferedPackets ); + + InternalizeChatItemL( aEventType, bufferPtr ); + + TRACE( T_LIT("CIMCacheAccessEventHandler::GetBufferedChatItemL() end") ); + } +// ----------------------------------------------------------------------------- +// CIMCacheAccessEventHandler::InternalizeChatItemL +// ----------------------------------------------------------------------------- +// +void CIMCacheAccessEventHandler::InternalizeChatItemL( TIMCacheEventType aEventType, + TPtr8 aContactBuffer ) + { + TRACE( T_LIT("CIMCacheAccessEventHandler::InternalizeChatItemL() begin") ); + if( 0 == aContactBuffer.Length()) + { + TRACE( T_LIT("CIMCacheAccessEventHandler::InternalizeChatItemL() aChatDataBuffer is zeor, hence returning ") ); + return; + } + RDesReadStream readAllStream ; + RDesReadStream readStream ; + + readAllStream.Open( aContactBuffer ); + CleanupClosePushL(readAllStream); + + TInt messageCount = readAllStream.ReadInt16L(); + + for( TInt i=0; i< messageCount; i++) + { + SIMCacheChatItem chatItem = + { + 0, + }; + + TInt size = readAllStream.ReadInt16L() ; + HBufC8* mBuffer = HBufC8::NewLC( size ); + TPtr8 mBufferPtr = mBuffer->Des(); + + readAllStream.ReadL( mBufferPtr , size ); + + readStream.Open( *mBuffer ); + CleanupClosePushL(readStream) ; + + chatItem.iServiceId = static_cast( readStream.ReadInt16L() ); + + TInt textSize = readStream.ReadInt16L(); + HBufC* buddyId = HBufC::NewLC( textSize ); + TPtr buddyIdPtr = buddyId->Des(); + readStream.ReadL( buddyIdPtr , textSize); + + chatItem.iBuddyId = buddyId; + + iAccessHandler.HandleIMCacheEventL( aEventType , &chatItem ); + + CleanupStack::PopAndDestroy(3);//buddyId , close read stream, delete mBuffer. + + } + CleanupStack::PopAndDestroy();//readAllStream. + TRACE( T_LIT("CIMCacheAccessEventHandler::InternalizeChatItemL() End") ); + } + + +// end of file + diff -r 000000000000 -r e6b17d312c8b imservices/instantmessagingcache/imcacheclient/src/cimcacheaccessor.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/instantmessagingcache/imcacheclient/src/cimcacheaccessor.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,248 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: access right class implemetation +* +*/ + + +// INCLUDE FILES +#include "cimcacheaccessor.h" +#include +#include +// logs +#include "imcachedebugtrace.h" + +// ----------------------------------------------------------------------------- +// CIMCacheAccessor::NewL() +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CIMCacheAccessor* CIMCacheAccessor::NewL(TInt aServiceId, + const TDesC& aSenderId ) + { + TRACE( T_LIT("CIMCacheAccessor::NewL begin") ); + CIMCacheAccessor* self = new ( ELeave ) CIMCacheAccessor( aServiceId ) ; + CleanupStack::PushL( self ); + self->ConstructL( aSenderId ); + CleanupStack::Pop( self ); //self + TRACE( T_LIT("CIMCacheAccessor::NewL end") ); + return self; + } +// ----------------------------------------------------------------------------- +// CIMCacheAccessor::ConstructL() +// Symbian OS default constructor can leave. +// ----------------------------------------------------------------------------- +// +void CIMCacheAccessor::ConstructL( const TDesC& aSenderId ) + { + TRACE( T_LIT("CIMCacheAccessor::ConstructL begin") ); + iUserId = aSenderId.AllocL(); + User::LeaveIfError( iClient.Connect() ); + iClient.StartTransactionL( EIMCacheInitAccess, + iServiceId, + *iUserId + ); + + TRACE( T_LIT("CIMCacheAccessor::ConstructL end") ); + } +// ----------------------------------------------------------------------------- +// CIMCacheAccessor::~CIMCacheAccessor() +// Destructor +// ----------------------------------------------------------------------------- +// +CIMCacheAccessor::~CIMCacheAccessor() + { + TRACE( T_LIT("CIMCacheAccessor::~CIMCacheAccessor begin") ); + delete iUserId; + //do not close the client session here. since there is also updater class which is closing the session + //moved this part of code which is common to both udpater and Accessor i.e, client ~CIMCacheClient() + //iClient.Close(); + TRACE( T_LIT("CIMCacheAccessor::~CIMCacheAccessor end") ); + } +// ----------------------------------------------------------------------------- +// CIMCacheAccessor::CIMCacheAccessor() +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CIMCacheAccessor::CIMCacheAccessor(TInt aServiceId ) + :iServiceId( aServiceId ) + { + TRACE( T_LIT("CIMCacheAccessor::CIMCacheAccessor ") ); + } + +// ----------------------------------------------------------------------------- +// CIMCacheAccessor::ServiceId() +// ----------------------------------------------------------------------------- +// +TInt CIMCacheAccessor::ServiceId() const + { + return iServiceId; + } + +// ----------------------------------------------------------------------------- +// CIMCacheAccess::RegisterObserverL() +// ----------------------------------------------------------------------------- +// +void CIMCacheAccessor::RegisterObserverL( MIMCacheEventHandler& aObserver ) + { + TRACE( T_LIT("CIMCacheAccess::RegisterObserverL begin") ); + // update case ETrue says CV is active + // cch need not to register + iClient.RegisterAccessObserverL( aObserver ); + TRACE( T_LIT("CIMCacheAccess::RegisterObserverL end") ); + } + +// ----------------------------------------------------------------------------- +// CIMCacheAccess::UnRegisterObserverL() +// ----------------------------------------------------------------------------- +// +void CIMCacheAccessor::UnRegisterObserver( MIMCacheEventHandler& aObserver ) + { + TRACE( T_LIT("CIMCacheAccess::UnRegisterObserverL begin") ); + iClient.UnRegisterAccessObserver( aObserver ); + TRACE( T_LIT("CIMCacheAccess::UnRegisterObserverL end") ); + } +// ----------------------------------------------------------------------------- +// CIMCacheAccess::GetUnreadMessageCountL() +// ----------------------------------------------------------------------------- +// +TInt CIMCacheAccessor::GetUnreadMessageCountL(const TDesC& aBuddyId) + { + TRACE( T_LIT("CIMCacheAccess::GetUnreadMessageCount") ); + if( !aBuddyId.Length() ) + { + User::Leave( KErrArgument ) ; + } + return iClient.GetInformationL(EIMCacheGetUnreadCount, iServiceId,aBuddyId ); + } +//----------------------------------------------------------------------------- +// CIMCacheAccessor::IsConversationExistL +// ( Other items commented in header ) +//----------------------------------------------------------------------------- +TBool CIMCacheAccessor::IsConversationExistL( const TDesC& aBuddyId ) + { + TRACE( T_LIT("CIMCacheAccess::IsConversationExistL Start ") ); + if( !aBuddyId.Length() ) + { + User::Leave( KErrArgument ) ; + } + TBool ret = iClient.GetInformationL(EIMCacheIsConversationExist,iServiceId, aBuddyId ); + TRACE( T_LIT("CIMCacheAccess::IsConversationExistL End ") ); + return ret; + } + + // ----------------------------------------------------------------------------- +// CIMCacheAccess::GetAllUnreadMessageCountL() +// ----------------------------------------------------------------------------- +// +TInt CIMCacheAccessor::GetAllUnreadMessageCountL() + { + TRACE( T_LIT("CIMCacheAccess::GetAllUnreadMessageCountL") ); + return iClient.GetInformationL( EIMCacheGetAllUnreadCount,iServiceId ); + } + + +// ----------------------------------------------------------------------------- +// CIMCacheAccessor::CloseConversationL() +// ----------------------------------------------------------------------------- +// +void CIMCacheAccessor::CloseConversationL( const TDesC& aBuddyId ) + { + TRACE( T_LIT("CIMCacheAccessor::CloseConversationL begin") ); + if( !aBuddyId.Length() ) + { + User::Leave( KErrArgument ) ; + } + iClient.StartTransactionL( EIMCacheCloseConversation, + iServiceId, + aBuddyId + ); + TRACE( T_LIT("CIMCacheAccessor::CloseConversationL end") ); + } + +// ----------------------------------------------------------------------------- +// CIMCacheAccessor::GetChatListL() +// ----------------------------------------------------------------------------- +// +RArray CIMCacheAccessor::GetChatListL( const TInt aServiceId ) + { + TRACE( T_LIT("CIMCacheUpdater::GetChatListL") ); + RArray chatListArray;//array to hold chat item + TBool more = EFalse; + TPtr8 bufferPtr = iClient.GetChatListL( aServiceId ); + InternalizeChatListL( chatListArray, bufferPtr, more ); + + while( more) + { + bufferPtr = iClient.GetBufferedDataL( EIMCacheGetBufferedPackets ); + InternalizeChatListL( chatListArray, bufferPtr, more ); + } + return chatListArray; + } + +// ----------------------------------------------------------------------------- +// CIMCacheAccessor::InternalizeChatListL +// ----------------------------------------------------------------------------- +// +void CIMCacheAccessor::InternalizeChatListL(RArray& aChatArray, TPtr8 aChatListBuffer ,TBool& aMore ) + { + TRACE( T_LIT("CIMCacheAccessor::InternalizeChatListL() begin") ); + + RDesReadStream readAllStream ; + RDesReadStream readStream ; + + readAllStream.Open( aChatListBuffer ); + CleanupClosePushL(readAllStream); + + TInt messageCount = readAllStream.ReadInt16L(); + + for( TInt i=0; i< messageCount; i++) + { + SIMCacheChatItem chatItem = + { + 0, + }; + + TInt size = readAllStream.ReadInt16L() ; + HBufC8* mBuffer = HBufC8::NewLC( size ); + TPtr8 mBufferPtr = mBuffer->Des(); + + readAllStream.ReadL( mBufferPtr , size ); + + readStream.Open( *mBuffer ); + CleanupClosePushL(readStream) ; + + chatItem.iServiceId = static_cast( readStream.ReadInt16L() ); + + TInt textSize = readStream.ReadInt16L(); + HBufC* buddyId = HBufC::NewLC( textSize ); + TPtr buddyIdPtr = buddyId->Des(); + readStream.ReadL( buddyIdPtr , textSize); + + chatItem.iBuddyId = buddyId; + CleanupStack::Pop(buddyId); // ownership to structure variable + aChatArray.Insert(chatItem, 0); + CleanupStack::PopAndDestroy(2);//close read stream, delete mBuffer. + + } + + aMore = static_cast( readAllStream.ReadInt16L() ); + CleanupStack::PopAndDestroy();//readAllStream. + TRACE( T_LIT("CIMCacheAccessor::InternalizeChatListL() End") ); + } + +// END OF FILE + + diff -r 000000000000 -r e6b17d312c8b imservices/instantmessagingcache/imcacheclient/src/cimcacheclient.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/instantmessagingcache/imcacheclient/src/cimcacheclient.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,373 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: client class implementation to connect to server +* +*/ + + + +// INCLUDE FILES +#include "cimcacheclient.h" + +#include "imcacheprocessstarter.h" +#include +#include "mimcacheclient.h" +// logs +#include "imcachedebugtrace.h" +#include "cimcacheeventhandler.h" + +#include "cimcacheaccesseventhandler.h" + +// ============================================================== +// ======================== CLIENT ============================== +// ============================================================== + +// Destructor +CIMCacheClient::~CIMCacheClient() + { + TRACE( T_LIT("CIMCacheClient::~CIMCacheClient() begin") ); + if( iUpdateObserver ) + { + delete iUpdateObserver; + } + + if( iAccessObserver ) + { + delete iAccessObserver; + } + if( iChatBuffer ) + { + delete iChatBuffer; + } + //finally close the session. + RSessionBase::Close(); + #if _BullseyeCoverage + cov_write(); + #endif + TRACE( T_LIT("CIMCacheClient::~CIMCacheClient() end") ); + } +// ----------------------------------------------------------------------------- +// CIMCacheClient::CIMCacheClient() +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CIMCacheClient::CIMCacheClient( ) + { + TRACE( T_LIT("CIMCacheClient::CIMCacheClient()") ); + } + + +// ----------------------------------------------------------------------------- +// CIMCacheClient::Connect() +// ----------------------------------------------------------------------------- +// +TInt CIMCacheClient::Connect() + { + TRACE( T_LIT("CIMCacheClient::Connect() begin") ); + TFileName fullExePath; + IMCacheProcessStarter::FullExePathForClientLocation( EIMCacheServerExe, + fullExePath ); + + TRACE( T_LIT("CIMCacheClient::Connect() end") ); + return IMCacheProcessStarter::ConnectToServer( fullExePath, + KNullDesC, + *this, + KIMCacheServerName, + TVersion( KIMCacheVersionMajor, + KIMCacheVersionMinor, + KIMCacheVersionBuild ), + KIMCacheMsgSlotCount ); + + } + +// ----------------------------------------------------------------------------- +// CIMCacheClient::RegisterObserverL() +// ----------------------------------------------------------------------------- +// +void CIMCacheClient::RegisterUpdateObserverL( MIMCacheEventHandler& aObserver ) + { + TRACE( T_LIT("CIMCacheClient::RegisterUpdateObserverL() begin") ); + + CIMCacheEventHandler* tempObserver = CIMCacheEventHandler::NewL( *this , aObserver ); + + if( iUpdateObserver ) + { + delete iUpdateObserver; + iUpdateObserver = NULL; + } + + iUpdateObserver = tempObserver; + TRACE( T_LIT("CIMCacheClient::RegisterUpdateObserverL() end") ); + } + +// ----------------------------------------------------------------------------- +// CIMCacheClient::UnRegisterUpdateObserver() +// ----------------------------------------------------------------------------- +// +void CIMCacheClient::UnRegisterUpdateObserver( MIMCacheEventHandler& /*aObserver*/) + { + TRACE( T_LIT("CIMCacheClient::UnRegisterUpdateObserver() begin") ); + + iUpdateObserver->UnRegisterObserver(); + + TRACE( T_LIT("CIMCacheClient::UnRegisterUpdateObserver() end") ); + } + +// ----------------------------------------------------------------------------- +// CIMCacheClient::RegisterAccessObserverL() +// ----------------------------------------------------------------------------- +// +void CIMCacheClient::RegisterAccessObserverL( MIMCacheEventHandler& aObserver ) + { + TRACE( T_LIT("CIMCacheClient::RegisterUpdateObserverL() begin") ); + + CIMCacheAccessEventHandler* tempObserver = CIMCacheAccessEventHandler::NewL( *this , aObserver ); + + if( iAccessObserver ) + { + delete iAccessObserver; + iAccessObserver = NULL; + } + + iAccessObserver = tempObserver; + TRACE( T_LIT("CIMCacheClient::RegisterUpdateObserverL() end") ); + } + +// ----------------------------------------------------------------------------- +// CIMCacheClient::UnRegisterAccessObserver() +// ----------------------------------------------------------------------------- +// +void CIMCacheClient::UnRegisterAccessObserver( MIMCacheEventHandler& /*aObserver*/) + { + TRACE( T_LIT("CIMCacheClient::UnRegisterUpdateObserver() begin") ); + + iAccessObserver->UnRegisterObserver(); + + TRACE( T_LIT("CIMCacheClient::UnRegisterUpdateObserver() end") ); + } +// ----------------------------------------------------------------------------- +// CIMCacheClient::RegisterObserverToServerL() +// ----------------------------------------------------------------------------- +// +void CIMCacheClient::RegisterObserverToServerL( TRequestStatus& aStatus , EIMCacheOperations aRight) + { + TRACE( T_LIT("CIMCacheClient::RegisterObserverToServerL() begin") ); + TIpcArgs args; + SendReceive( aRight, args, aStatus ); + TRACE( T_LIT("CIMCacheClient::RegisterObserverToServerL() end") ); + } + +// ----------------------------------------------------------------------------- +// CIMCacheClient::UnRegisterObserverToServerL() +// ----------------------------------------------------------------------------- +// +void CIMCacheClient::UnRegisterObserverToServerL( TRequestStatus& aStatus, EIMCacheOperations aRight) + { + TRACE( T_LIT("CIMCacheClient::UnRegisterObserverToServerL() begin") ); + TIpcArgs args; + TInt err = SendReceive( aRight, args ); + User::LeaveIfError( err ); + TRACE( T_LIT("CIMCacheClient::UnRegisterObserverToServerL() end") ); + } +// ----------------------------------------------------------------------------- +// CIMCacheClient::CancelRequestL() +// ----------------------------------------------------------------------------- +// +void CIMCacheClient::CancelRequestL( TRequestStatus& aStatus, EIMCacheOperations aRight) + { + TRACE( T_LIT("CIMCacheClient::CancelRequestL() begin") ); + TIpcArgs args; + TInt err = SendReceive( aRight, args ); + User::LeaveIfError( err ); + TRACE( T_LIT("CIMCacheClient::CancelRequestL() end") ); + } +// ----------------------------------------------------------------------------- +// CIMCacheClient::StartTransactionL() +// ----------------------------------------------------------------------------- +// +void CIMCacheClient::StartTransactionL( EIMCacheOperations aOperationType, + TInt aServiceId , + const TDesC& aText + ) + { + TRACE( T_LIT("CIMCacheClient::StartTransactionL() begin") ); + TIpcArgs args = CreateArgumentsL( aServiceId, aText ); + TInt err = SendReceive( aOperationType, args ); + User::LeaveIfError( err ); + TRACE( T_LIT("CIMCacheClient::StartTransactionL() end") ); + } + + +// ----------------------------------------------------------------------------- +// CIMCacheClient::StartTransactionL() +// ----------------------------------------------------------------------------- +// +void CIMCacheClient::StartTransactionL(EIMCacheOperations aOperationType, + const TDesC& aText + ) + { + TRACE( T_LIT("CIMCacheClient::StartTransactionL() begin") ); + TIpcArgs args; + args.Set( 0, &aText ); + TInt err = SendReceive( aOperationType, args ); + User::LeaveIfError( err ); + TRACE( T_LIT("CIMCacheClient::StartTransactionL() end") ); + } +// ----------------------------------------------------------------------------- +// CIMCacheClient::StartTransactionL() +// ----------------------------------------------------------------------------- +// +void CIMCacheClient::StartTransactionL( EIMCacheOperations aOperationType, + TInt aServiceId, + const TDesC& aText1 , + const TDesC& aText2 + ) + { + TRACE( T_LIT("CIMCacheClient::StartTransactionL() begin") ); + TIpcArgs args = CreateArgumentsL(aServiceId, aText1, aText2 ); + TInt err = SendReceive( aOperationType, args ); + User::LeaveIfError( err ); + TRACE( T_LIT("CIMCacheClient::StartTransactionL() end") ); + } + +// ----------------------------------------------------------------------------- +// CIMCacheClient::StopTransactionL() +// ----------------------------------------------------------------------------- +// +TInt CIMCacheClient::StartTransactionL(EIMCacheOperations aOperationType ) + { + TRACE( T_LIT("CIMCacheClient::StopTransactionL() begin") ); + TRACE( T_LIT(" aOperationType = %d "),aOperationType ); + TInt err = SendReceive( aOperationType ); + TRACE( T_LIT("CIMCacheClient::StopTransactionL() end") ); + return err; + } + +// ----------------------------------------------------------------------------- +// CIMCacheClient::CreateArgumentsL() +// ----------------------------------------------------------------------------- +// +TIpcArgs CIMCacheClient::CreateArgumentsL( TInt aServiceId , + const TDesC& aText ) + { + TRACE( T_LIT("CIMCacheClient::CreateArgumentsL() begin") ); + // set the arguments for the message + TIpcArgs args; + args.Set( 0, aServiceId ); + args.Set( 1, &aText ); + TRACE( T_LIT("CIMCacheClient::CreateArgumentsL() end") ); + return args; + } + + // ----------------------------------------------------------------------------- +// CIMCacheClient::CreateArgumentsL() +// ----------------------------------------------------------------------------- +// +TIpcArgs CIMCacheClient::CreateArgumentsL(TInt aServiceId, + const TDesC& aText1 , + const TDesC& aText2 ) + { + TRACE( T_LIT("CIMCacheClient::CreateArgumentsL() begin") ); + // set the arguments for the message + TIpcArgs args(aServiceId); + args.Set( 1, &aText1 ); + args.Set( 2, &aText2 ); + TRACE( T_LIT("CIMCacheClient::CreateArgumentsL() end") ); + return args; + } + + +// ----------------------------------------------------------------------------- +// CIMCacheClient::GetInformationL() +// ----------------------------------------------------------------------------- +// +TInt CIMCacheClient::GetInformationL(EIMCacheOperations aOperationType, TInt aServiceId,const TDesC& aBuddyId ) + { + TRACE( T_LIT("CIMCacheClient::GetInformationL start") ); + TInt returnValue = 0; + TIpcArgs args(aServiceId); + args.Set( 1, &aBuddyId ); + TPckg pack( returnValue ); + args.Set(2, &pack ); + TInt err = SendReceive( aOperationType, args ); + User::LeaveIfError( err ); + TRACE( T_LIT("CIMCacheClient::GetInformationL() end") ); + return returnValue; + } + + // ----------------------------------------------------------------------------- +// CIMCacheClient::GetCountL() +// ----------------------------------------------------------------------------- +// +TInt CIMCacheClient::GetInformationL(EIMCacheOperations aOperationType, TInt aServiceId ) + { + TRACE( T_LIT("CIMCacheClient::GetInformationL") ); + TInt returnValue = 0; + TIpcArgs args(aServiceId); + + TPckg pack( returnValue ); + args.Set(1, &pack ); + TInt err = SendReceive( aOperationType, args ); + User::LeaveIfError( err ); + TRACE( T_LIT("CIMCacheClient::GetInformationL() end") ); + return returnValue; + } +// ----------------------------------------------------------------------------- +// CIMCacheClient::GetContactBufferL() +// ----------------------------------------------------------------------------- +// +TPtr8 CIMCacheClient::GetBufferedDataL(EIMCacheOperations aOperationType ) + { + TRACE( T_LIT("CIMCacheClient::GetContactBufferL() begin") ); + + if(!iChatBuffer)//if not allocated allocate. + { + iChatBuffer = HBufC8::NewL(KMaxSize); + } + TPtr8 chatBufferPtr = iChatBuffer->Des(); + TIpcArgs msgArgs; + msgArgs.Set( 0, &chatBufferPtr ); + + TInt err = SendReceive( aOperationType, msgArgs ); + User::LeaveIfError( err ); + + TRACE( T_LIT("CIMCacheClient::GetContactBufferL() end") ); + + return iChatBuffer->Des(); + } + +// ----------------------------------------------------------------------------- +// CIMCacheClient::GetChatListL() +// ----------------------------------------------------------------------------- +TPtr8 CIMCacheClient::GetChatListL( const TInt& aServiceId /*= -1*/ ) + { + + if(!iChatBuffer)//if not allocated allocate. + { + iChatBuffer = HBufC8::NewL(KMaxSize); + } + TPtr8 ptr = iChatBuffer->Des(); + + TIpcArgs msgArgs( aServiceId );//at 0. + msgArgs.Set( 1, &ptr ); + + TInt err = SendReceive( EIMCacheGetChatList, msgArgs ); + User::LeaveIfError( err ); + + return iChatBuffer->Des(); + } + +// end of file + diff -r 000000000000 -r e6b17d312c8b imservices/instantmessagingcache/imcacheclient/src/cimcacheeventhandler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/instantmessagingcache/imcacheclient/src/cimcacheeventhandler.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,344 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: cache message change observer +* +*/ + + +// INCLUDE FILES + +#include "cimcacheeventhandler.h" +#include "mimcacheclient.h" +#include "mimcacheeventhandler.h" +// logs +#include "imcachedebugtrace.h" + +// ----------------------------------------------------------------------------- +// CIMCacheEventHandler::NewL +// ----------------------------------------------------------------------------- +// +CIMCacheEventHandler* CIMCacheEventHandler::NewL( + MIMCacheClient& aRegistrar, + MIMCacheEventHandler& aHandler) + { + TRACE( T_LIT("CIMCacheEventHandler::NewL() begin") ); + CIMCacheEventHandler* self = new ( ELeave ) CIMCacheEventHandler( aRegistrar ,aHandler ) ; + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); //self + TRACE( T_LIT("CIMCacheEventHandler::NewL() end") ); + return self; + } + +// ----------------------------------------------------------------------------- +// CIMCacheEventHandler::ConstructL +// ----------------------------------------------------------------------------- +// +void CIMCacheEventHandler::ConstructL() + { + TRACE( T_LIT("CIMCacheEventHandler::ConstructL() begin") ); + iContinueObserving = ETrue ; + CActiveScheduler::Add( this ); + iRegistrar.RegisterObserverToServerL( iStatus ,EIMCacheObserveMessageUpdateRegister ); + SetActive(); + TRACE( T_LIT("CIMCacheEventHandler::ConstructL() end") ); + } + +// ----------------------------------------------------------------------------- +// CIMCacheEventHandler::~CIMCacheEventHandler +// ----------------------------------------------------------------------------- +// +CIMCacheEventHandler::~CIMCacheEventHandler() + { + TRACE( T_LIT("CIMCacheEventHandler::~CIMCacheEventHandler() begin") ); + Cancel(); + TRACE( T_LIT("CIMCacheEventHandler::~CIMCacheEventHandler() end") ); + } + +// ----------------------------------------------------------------------------- +// CIMCacheEventHandler::CIMCacheEventHandler( +// ----------------------------------------------------------------------------- +// +CIMCacheEventHandler::CIMCacheEventHandler( + MIMCacheClient& aRegistrar , + MIMCacheEventHandler& aHandler ) : + CActive( CActive::EPriorityIdle ), + iRegistrar( aRegistrar ), + iUpdateHandler( aHandler ) + { + TRACE( T_LIT("CIMCacheEventHandler::CIMCacheEventHandler()") ); + } +// ----------------------------------------------------------------------------- +// CIMCacheEventHandler::RunL +// ----------------------------------------------------------------------------- +// +void CIMCacheEventHandler::RunL() + { + TRACE( T_LIT("CIMCacheEventHandler::RunL() begin") ); + TRACE( T_LIT("CIMCacheEventHandler::RunL() iStatus code = "),iStatus.Int() ); + + switch( iStatus.Int() ) + { + case EIMOperationUnreadMessage : + case EIMOperationDataAvailable : + case EIMOperationMessageAdded : + { + // message data available get the data + GetBufferChatDataL(); + break; + } + case EIMOperationCompleted : + { + iUpdateHandler.HandleIMCacheEventL( EIMCacheRequestCompleted, NULL ); + } + case EIMOperationChatStarted : + { + iUpdateHandler.HandleIMCacheEventL( EIMCacheRequestCompleted, NULL ); + break; + } + case EIMOperationUnreadChange: + { + iUpdateHandler.HandleIMCacheEventL( EIMCacheRequestCompleted, NULL ); + break; + } + case EIMOperationChatAdded : + { + // chat information + GetBufferedChatItemL(EIMCacheNewChat); + break; + } + case EIMOperationChatDeleted : + { + // message data available get the data + GetBufferedChatItemL(EIMCacheChatClosed ); + break; + } + case EIMOperationAllChatDeleted: + { + iUpdateHandler.HandleIMCacheEventL( EIMCacheAllChatClosed, NULL ); + break; + } + case EIMOperationUnRegistered: + { + TRACE( T_LIT("CIMCacheEventHandler::RunL() EIMOperationUnRegistered") ); + iContinueObserving = EFalse; + break; + } + default : + { + TRACE( T_LIT("CIMCacheEventHandler::RunL() default") ); + break; + } + } + + TRACE( T_LIT("CIMCacheEventHandler::RunL() iContinueObserving iContinueObserving = %d") ,iContinueObserving); + // check need to continue observing to server + if( iContinueObserving ) + { + iRegistrar.RegisterObserverToServerL( iStatus ,EIMCacheObserveMessageUpdateRegister ); + SetActive(); + } + TRACE( T_LIT("CIMCacheEventHandler::RunL() end") ); + } +// ----------------------------------------------------------------------------- +// CIMCacheEventHandler::DoCancel +// ----------------------------------------------------------------------------- +// +void CIMCacheEventHandler::DoCancel() + { + TRACE( T_LIT("CIMCacheEventHandler::DoCancel() ") ); + if( IsActive() ) + { + TRAP_IGNORE(iRegistrar.CancelRequestL( iStatus ,EIMCacheCancelRequest )); + } + } +// --------------------------------------------------------- +// CIMCacheEventHandler::RunError() +// --------------------------------------------------------- +// +TInt CIMCacheEventHandler::RunError( TInt /* aError */) + { + TRACE( T_LIT("CVIMPSTEngineCVListener::RunError() start")); + return KErrNone; + } +// ----------------------------------------------------------------------------- +// CIMCacheEventHandler::UnRegisterObserver +// ----------------------------------------------------------------------------- +// +void CIMCacheEventHandler::UnRegisterObserver() + { + TRACE( T_LIT("CIMCacheEventHandler::UnRegisterObserver() begin") ); + if( IsActive() ) + { + TRACE( T_LIT("CIMCacheEventHandler::UnRegisterObserver() active") ); + TRAP_IGNORE(iRegistrar.UnRegisterObserverToServerL( iStatus ,EIMCacheObserveMessageUpdateUnRegister )); + } + TRACE( T_LIT("CIMCacheEventHandler::UnRegisterObserver() end") ); + } +// ----------------------------------------------------------------------------- +// CIMCacheEventHandler::GetBufferChatDataL +// ----------------------------------------------------------------------------- +// +void CIMCacheEventHandler::GetBufferChatDataL( ) + { + TRACE( T_LIT("CIMCacheEventHandler::GetBufferChatDataL() begin") ); + TBool more = ETrue; + while(more) + { + TPtr8 bufferPtr = iRegistrar.GetBufferedDataL( EIMCacheGetBufferedPackets ); + InternalizeChatDataL( bufferPtr , more ); + } + TRACE( T_LIT("CIMCacheEventHandler::GetBufferChatDataL() end") ); + } +// ----------------------------------------------------------------------------- +// CIMCacheEventHandler::InternalizeChatDataL +// ----------------------------------------------------------------------------- +void CIMCacheEventHandler::InternalizeChatDataL( TPtr8 aChatDataBuffer , TBool& aMore ) + { + TRACE( T_LIT("CIMCacheEventHandler::InternalizeChatDataL() Start") ); + if( 0 == aChatDataBuffer.Length()) + { + TRACE( T_LIT("CIMCacheEventHandler::InternalizeChatDataL() aChatDataBuffer is zeor, hence returning ") ); + return; + } + RDesReadStream readAllStream ; + RDesReadStream readStream ; + + readAllStream.Open( aChatDataBuffer ); + CleanupClosePushL(readAllStream); + + TInt messageCount = readAllStream.ReadInt16L(); + + for( TInt i=0; i< messageCount; i++) + { + SIMCacheMessageData chatData = + { + TIMCacheMessageType(0), + }; + + TInt size = readAllStream.ReadInt16L() ; + HBufC8* mBuffer = HBufC8::NewLC( size ); + TPtr8 mBufferPtr = mBuffer->Des(); + + readAllStream.ReadL( mBufferPtr , size ); + + readStream.Open( *mBuffer ); + CleanupClosePushL(readStream) ; + + chatData.iMessageType = static_cast( readStream.ReadInt16L() ); + chatData.iMessagerType = static_cast( readStream.ReadInt16L() ); + chatData.iContentType = static_cast( readStream.ReadInt16L() ); + chatData.iTime = static_cast( readStream.ReadReal64L() ); + + TInt buddyLength = readStream.ReadInt16L(); + HBufC* buddy = HBufC::NewLC( buddyLength ); + TPtr buddyPtr = buddy->Des(); + readStream.ReadL( buddyPtr , buddyLength ); + chatData.iBuddyId = buddy; + + TInt textSize = readStream.ReadInt16L(); + HBufC* text = HBufC::NewLC( textSize ); + TPtr textPtr = text->Des(); + readStream.ReadL( textPtr , textSize); + chatData.iText = text; + + iUpdateHandler.HandleIMCacheEventL(EIMCacheNewMessage , &chatData); + + CleanupStack::PopAndDestroy(4);//close read stream, delete mBuffer, text, buddy + } + + aMore = static_cast( readAllStream.ReadInt16L() ); + + CleanupStack::PopAndDestroy();//readAllStream. + + TRACE( T_LIT("CIMCacheEventHandler::InternalizeChatDataL() End") ); + } + +// ----------------------------------------------------------------------------- +// CIMCacheEventHandler::GetBufferedChatItemL +// ----------------------------------------------------------------------------- +// +void CIMCacheEventHandler::GetBufferedChatItemL( TIMCacheEventType aEventType ) + { + TRACE( T_LIT("CIMCacheAccessEventHandler::GetBufferedChatItemL() begin") ); + + TPtr8 bufferPtr = iRegistrar.GetBufferedDataL( EIMCacheGetBufferedPackets ); + + InternalizeChatItemL( aEventType, bufferPtr ); + + TRACE( T_LIT("CIMCacheAccessEventHandler::GetBufferedChatItemL() end") ); + } + + +// ----------------------------------------------------------------------------- +// CIMCacheEventHandler::InternalizeChatItemL +// ----------------------------------------------------------------------------- +// +void CIMCacheEventHandler::InternalizeChatItemL( TIMCacheEventType aEventType, + TPtr8 aContactBuffer ) + { + TRACE( T_LIT("CIMCacheClient::InternalizeChatItemL() begin") ); + if( 0 == aContactBuffer.Length()) + { + TRACE( T_LIT("CIMCacheEventHandler::InternalizeChatDataL() aChatDataBuffer is zeor, hence returning ") ); + return; + } + RDesReadStream readAllStream ; + RDesReadStream readStream ; + + readAllStream.Open( aContactBuffer ); + CleanupClosePushL(readAllStream); + + TInt messageCount = readAllStream.ReadInt16L(); + + for( TInt i=0; i< messageCount; i++) + { + SIMCacheChatItem chatItem = + { + 0, + }; + + TInt size = readAllStream.ReadInt16L() ; + HBufC8* mBuffer = HBufC8::NewLC( size ); + TPtr8 mBufferPtr = mBuffer->Des(); + + readAllStream.ReadL( mBufferPtr , size ); + + readStream.Open( *mBuffer ); + CleanupClosePushL(readStream) ; + + chatItem.iServiceId = static_cast( readStream.ReadInt16L() ); + + TInt textSize = readStream.ReadInt16L(); + HBufC* buddyId = HBufC::NewLC( textSize ); + TPtr buddyIdPtr = buddyId->Des(); + readStream.ReadL( buddyIdPtr , textSize); + + chatItem.iBuddyId = buddyId; + + iUpdateHandler.HandleIMCacheEventL( aEventType , &chatItem ); + + CleanupStack::PopAndDestroy(3);//buddyId , close read stream, delete mBuffer. + + } + + CleanupStack::PopAndDestroy();//readAllStream. + + TRACE( T_LIT("CIMCacheClient::InternalizeChatItemL() End") ); + } + + + +// end of file + diff -r 000000000000 -r e6b17d312c8b imservices/instantmessagingcache/imcacheclient/src/cimcachefactory.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/instantmessagingcache/imcacheclient/src/cimcachefactory.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,205 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: factory class to create access and updateer class implementation +* +*/ + + + +// INCLUDE FILES +#include "cimcachefactory.h" + +#include "cimcacheupdater.h" +#include "mimcacheupdater.h" +#include "cimcacheaccessor.h" +#include "mimcacheaccessor.h" +#include "cimcacheclient.h" +// logs +#include "imcachedebugtrace.h" + +// ============================ MEMBER FUNCTIONS =============================== + // ----------------------------------------------------------------------------- +// CIMCacheFactory::Instance +//see whether there is an instance in the TLS +//if not create the instance and set the same in TLS +// ----------------------------------------------------------------------------- +// + EXPORT_C CIMCacheFactory* CIMCacheFactory::InstanceL() + { + TRACE( T_LIT("CIMCacheFactory::InstanceL begin") ); + CIMCacheFactory *factory = static_cast( Dll::Tls() ); + + if ( ! factory ) + { + // no existing instance, create a new one + factory = CIMCacheFactory::NewL(); + CleanupStack::PushL( factory ); + User::LeaveIfError( Dll::SetTls( static_cast( factory ) ) ); + CleanupStack::Pop( factory ); + } + TRACE( T_LIT("CIMCacheFactory::InstanceL end") ); + factory->IncrementReference(); + return factory; + } + // ----------------------------------------------------------------------------- +// CIMCacheFactory::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CIMCacheFactory* CIMCacheFactory::NewL() + { + TRACE( T_LIT("CIMCacheFactory::NewL begin") ); + CIMCacheFactory* self = new ( ELeave ) CIMCacheFactory() ; + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); //self + TRACE( T_LIT("CIMCacheFactory::NewL end") ); + return self; + } + +// ----------------------------------------------------------------------------- +// CIMCacheFactory::Release() +// ----------------------------------------------------------------------------- +// +EXPORT_C void CIMCacheFactory::Release() + { + TRACE( T_LIT("CIMCacheFactory::Release start") ); + //if any instance in TLS get the same and delete it + CIMCacheFactory *factory = static_cast( Dll::Tls() ); + if ( factory && !(factory->DecrementReference())) + if ( factory ) + { + delete factory; + Dll::SetTls( NULL ); + } + TRACE( T_LIT("CIMCacheFactory::Release end") ); + } +// ----------------------------------------------------------------------------- +// CIMCacheFactory::IncrementReference() +// ----------------------------------------------------------------------------- +// +void CIMCacheFactory::IncrementReference() + { + TRACE( T_LIT("CIMCacheFactory::IncrementReference ") ); + iReferenceCount++; + } + +// ----------------------------------------------------------------------------- +// CPresenceCacheServer::DecrementReference() +// ----------------------------------------------------------------------------- +// +TInt CIMCacheFactory::DecrementReference() + { + TRACE( T_LIT("CIMCacheFactory::DecrementReference ") ); + iReferenceCount--; + return iReferenceCount; + } + +// ----------------------------------------------------------------------------- +// CIMCacheFactory::CIMCacheFactory() +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CIMCacheFactory::CIMCacheFactory() + { + } + +// ----------------------------------------------------------------------------- +// CIMCacheFactory::~CIMCacheFactory() +// Symbian OS desstructor +// ----------------------------------------------------------------------------- +// +CIMCacheFactory::~CIMCacheFactory() + { + TRACE( T_LIT("CIMCacheFactory::~CIMCacheFactory start") ); + iUpdaterArray.ResetAndDestroy(); + iAccessorArray.ResetAndDestroy(); + delete iServerKeepAlive; + TRACE( T_LIT("CIMCacheFactory::~CIMCacheFactory end") ); + } +// ----------------------------------------------------------------------------- +// CIMCacheFactory::ConstructL() +// Symbian OS default constructor can leave. +// ----------------------------------------------------------------------------- +// +void CIMCacheFactory::ConstructL( ) + { + TRACE( T_LIT("CIMCacheFactory::ConstructL start") ); + iServerKeepAlive = new(ELeave) CIMCacheClient(); // CSI: 74 # this needs to be like this + TRACE( T_LIT("CIMCacheFactory::ConstructL end") ); + } + +// ----------------------------------------------------------------------------- +// CIMCacheFactory::CreateUpdaterL() +// ----------------------------------------------------------------------------- +// +EXPORT_C MIMCacheUpdater* CIMCacheFactory::CreateUpdaterL(TInt aServiceId, + const TDesC& aUserId , + TBool aRegistrationNeeded ) + { + TRACE( T_LIT("CIMCacheFactory::CreateAccessL begin") ); + + CIMCacheUpdater* updater = NULL; + + TInt count = iUpdaterArray.Count(); + for( TInt i = 0; i < count; ++i ) + { + if( iUpdaterArray[i]->ServiceId() == aServiceId ) + { + updater = iUpdaterArray[i]; + break; + } + } + if( !updater ) + { + updater = CIMCacheUpdater::NewL( aServiceId, aUserId, aRegistrationNeeded ); + iUpdaterArray.Append(updater); + } + + TRACE( T_LIT("CIMCacheFactory::CreateAccessL end") ); + return updater; + } + +// ----------------------------------------------------------------------------- +// CIMCacheFactory::CreateAccessorL() +// ----------------------------------------------------------------------------- +// +EXPORT_C MIMCacheAccessor* CIMCacheFactory::CreateAccessorL(TInt aServiceId, + const TDesC& aUserId ) + { + TRACE( T_LIT("CIMCacheFactory::CreateAccessL begin") ); + + CIMCacheAccessor* accessor = NULL; + + TInt count = iAccessorArray.Count(); + for( TInt i = 0; i < count; ++i ) + { + if( iAccessorArray[i]->ServiceId() == aServiceId ) + { + accessor = iAccessorArray[i]; + break; + } + } + if( !accessor ) + { + accessor = CIMCacheAccessor::NewL( aServiceId, aUserId ); + iAccessorArray.Append(accessor); + } + + TRACE( T_LIT("CIMCacheFactory::CreateAccessL end") ); + return accessor; + } +// End of File + diff -r 000000000000 -r e6b17d312c8b imservices/instantmessagingcache/imcacheclient/src/cimcacheupdater.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/instantmessagingcache/imcacheclient/src/cimcacheupdater.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,318 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: write right class implemetation +* +*/ + +// INCLUDE FILES +#include "cimcacheupdater.h" + +#include +// logs +#include "imcachedebugtrace.h" + +#include +#include + +//Received message maximum length is 400 character if received message is +//longer than 400 character truncate it to 400 character +//This must always be in sync with imcvuiapp KReceiveMsgMaxLength +const TInt KReceiveMsgMaxLength = 400; +_LIT(KPercentage, "%"); +// ----------------------------------------------------------------------------- +// CIMCacheUpdater::NewL() +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CIMCacheUpdater* CIMCacheUpdater::NewL(TInt aServiceId, + const TDesC& aSenderId ,TBool aRegistrationNeeded ) + { + TRACE( T_LIT("CIMCacheUpdater::NewL begin") ); + CIMCacheUpdater* self = new ( ELeave ) CIMCacheUpdater( aServiceId ) ; + CleanupStack::PushL( self ); + self->ConstructL( aSenderId, aRegistrationNeeded ); + CleanupStack::Pop( self ); //self + TRACE( T_LIT("CIMCacheUpdater::NewL end") ); + return self; + } +// ----------------------------------------------------------------------------- +// CIMCacheUpdater::ConstructL() +// Symbian OS default constructor can leave. +// ----------------------------------------------------------------------------- +// +void CIMCacheUpdater::ConstructL( const TDesC& aSenderId ,TBool aRegistrationNeeded ) + { + TRACE( T_LIT("CIMCacheUpdater::ConstructL begin") ); + iUserId = aSenderId.AllocL(); + User::LeaveIfError( iClient.Connect() ); + EIMCacheOperations opration = EIMCacheInitUpdate; + if( aRegistrationNeeded ) + { + opration = EIMCacheInitConvesation; + } + iClient.StartTransactionL(opration, iServiceId, *iUserId ); + TRACE( T_LIT("CIMCacheUpdater::ConstructL end") ); + } +// ----------------------------------------------------------------------------- +// CIMCacheUpdater::~CIMCacheUpdater() +// Destructor +// ----------------------------------------------------------------------------- +// +CIMCacheUpdater::~CIMCacheUpdater() + { + TRACE( T_LIT("CIMCacheUpdater::~CIMCacheUpdater begin") ); + delete iUserId; + //do not close the client session here. since there is also accessor class which is closing the session + //moved this part of code which is common to both udpater and Accessor i.e, client ~CIMCacheClient() + //iClient.Close(); + TRACE( T_LIT("CIMCacheUpdater::~CIMCacheUpdater end") ); + } +// ----------------------------------------------------------------------------- +// CIMCacheUpdater::CIMCacheUpdater() +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CIMCacheUpdater::CIMCacheUpdater(TInt aServiceId ) + :iServiceId( aServiceId ) + { + TRACE( T_LIT("CIMCacheUpdater::CIMCacheUpdater ") ); + } + + +// ----------------------------------------------------------------------------- +// CIMCacheUpdater::StartNewConversationL() +// ----------------------------------------------------------------------------- +// +void CIMCacheUpdater::StartNewConversationL(const TDesC& aBuddyId ) + { + TRACE( T_LIT("CIMCacheUpdater::StartNewConversationL begin") ); + if( !aBuddyId.Length() ) + { + User::Leave( KErrArgument ) ; + } + iClient.StartTransactionL(EIMCacheStartNewConversation, iServiceId , aBuddyId ); + + TRACE( T_LIT("CIMCacheUpdater::StartNewConversationL end") ); + } + +// ----------------------------------------------------------------------------- +// CIMCacheUpdater::AppendReceiveMessageL() +// ----------------------------------------------------------------------------- +// +void CIMCacheUpdater::AppendReceiveMessageL( const TDesC& aBuddyId, + const TDesC& aText ) + { + TRACE( T_LIT("CIMCacheUpdater::AppendReceiveMessageL begin") ); + if( !aBuddyId.Length() ) + { + User::Leave( KErrArgument ) ; + } + TInt len = aText.Length(); + HBufC* bigmsg = NULL; + bigmsg = HBufC::NewLC(KReceiveMsgMaxLength + 1) ; // 1 for % + if( bigmsg ) + { + TRACE( T_LIT("Inside if( bigmsg )") ); + TPtr bigmsgPtr = bigmsg->Des(); + //If message is more than 400 character take only first 400 character + //rest of the message will be lost + bigmsgPtr.Append( aText.Left( KReceiveMsgMaxLength ) ); + if( len > KReceiveMsgMaxLength) + { + //append % as 401st character to identify on UI that it is a + //long message which is truncated + bigmsgPtr.Append(KPercentage); + } + + iClient.StartTransactionL(EIMCacheAppendReceiveMessage, iServiceId, aBuddyId , bigmsgPtr ); + + CleanupStack::PopAndDestroy(bigmsg); // bigmsg + } + TRACE( T_LIT("CIMCacheUpdater::AppendReceiveMessageL end") ); + } +// ----------------------------------------------------------------------------- +// CIMCacheUpdater::AppendSendMessageL() +// ----------------------------------------------------------------------------- +// +void CIMCacheUpdater::AppendSendMessageL(const TDesC& aText ) + { + TRACE( T_LIT("CIMCacheUpdater::AppendSendMessageL begin") ); + + iClient.StartTransactionL( EIMCacheAppendSendMessage , aText); + TRACE( T_LIT("CIMCacheUpdater::AppendSendMessageL end") ); + } + +// ----------------------------------------------------------------------------- +// CIMCacheUpdater::AppendMessageL() +// ----------------------------------------------------------------------------- +// +void CIMCacheUpdater::AppendMessageL(const TDesC& aBuddyId, const TDesC& aText ) + { + TRACE( T_LIT("CIMCacheUpdater::AppendMessageL begin") ); + if( !aBuddyId.Length() ) + { + User::Leave( KErrArgument ) ; + } + iClient.StartTransactionL(EIMCacheAppendMessage, iServiceId, aBuddyId, aText); + TRACE( T_LIT("CIMCacheUpdater::AppendMessageL end") ); + } + +// ----------------------------------------------------------------------------- +// CIMCacheUpdater::CloseConversation() +// ----------------------------------------------------------------------------- +// +void CIMCacheUpdater::CloseConversationL( const TDesC& aBuddyId ) + { + TRACE( T_LIT("CIMCacheUpdater::CloseConversationL begin") ); + + if( !aBuddyId.Length() ) + { + User::Leave( KErrArgument ) ; + } + iClient.StartTransactionL( EIMCacheCloseConversation, + iServiceId, + aBuddyId + ); + TRACE( T_LIT("CIMCacheUpdater::CloseConversationL end") ); + } + +// ----------------------------------------------------------------------------- +// CIMCacheUpdater::CloseConversation() +// ----------------------------------------------------------------------------- +// +void CIMCacheUpdater::CloseAllConversationL() + { + TRACE( T_LIT("CIMCacheUpdater::CloseAllConversationL begin") ); + iClient.StartTransactionL( EIMCacheCloseAllConversation ); + TRACE( T_LIT("CIMCacheUpdater::CloseAllConversationL end") ); + } +// ----------------------------------------------------------------------------- +// CIMCacheUpdater::DeactivateConversationL() +// ----------------------------------------------------------------------------- +// +TInt CIMCacheUpdater::DeactivateConversationL( ) + { + TRACE( T_LIT("CIMCacheUpdater::DeactivateConversationL begin") ); + + TInt error = iClient.StartTransactionL( EIMCacheDeactivateConversation ); + + TRACE( T_LIT("CIMCacheUpdater::DeactivateAllConversationsL end") ); + return error; + } +// ----------------------------------------------------------------------------- +// CIMCacheUpdater::ServiceId() +// ----------------------------------------------------------------------------- +// +TInt CIMCacheUpdater::ServiceId() const + { + return iServiceId; + } + +// ----------------------------------------------------------------------------- +// CIMCacheAccess::RegisterObserverL() +// ----------------------------------------------------------------------------- +// +void CIMCacheUpdater::RegisterObserverL( MIMCacheEventHandler& aObserver ) + { + TRACE( T_LIT("CIMCacheAccess::RegisterObserverL begin") ); + // update case ETrue says CV is active + // cch need not to register + iClient.RegisterUpdateObserverL( aObserver ); + TRACE( T_LIT("CIMCacheAccess::RegisterObserverL end") ); + } + +// ----------------------------------------------------------------------------- +// CIMCacheAccess::UnRegisterObserverL() +// ----------------------------------------------------------------------------- +// +void CIMCacheUpdater::UnRegisterObserver( MIMCacheEventHandler& aObserver ) + { + TRACE( T_LIT("CIMCacheAccess::UnRegisterObserverL begin") ); + iClient.UnRegisterUpdateObserver( aObserver ); + TRACE( T_LIT("CIMCacheAccess::UnRegisterObserverL end") ); + } + +// ----------------------------------------------------------------------------- +// CIMCacheAccess::GetChatListL() +// ----------------------------------------------------------------------------- +// +RArray CIMCacheUpdater::GetChatListL( const TInt aServiceId ) + { + TRACE( T_LIT("CIMCacheUpdater::GetChatListL") ); + RArray chatListArray;//array to hold chat item + TBool more = EFalse; + TPtr8 bufferPtr = iClient.GetChatListL( aServiceId ); + InternalizeChatListL( chatListArray, bufferPtr, more ); + + while( more) + { + bufferPtr = iClient.GetBufferedDataL( EIMCacheGetBufferedPackets ); + InternalizeChatListL( chatListArray, bufferPtr, more ); + } + return chatListArray; + } + +// ----------------------------------------------------------------------------- +// CIMCacheUpdater::InternalizeChatListL +// ----------------------------------------------------------------------------- +// +void CIMCacheUpdater::InternalizeChatListL(RArray& aChatArray, TPtr8 aChatListBuffer ,TBool& aMore ) + { + TRACE( T_LIT("CIMCacheUpdater::InternalizeChatListL() begin") ); + + RDesReadStream readAllStream ; + RDesReadStream readStream ; + + readAllStream.Open( aChatListBuffer ); + CleanupClosePushL(readAllStream); + + TInt messageCount = readAllStream.ReadInt16L(); + + for( TInt i=0; i< messageCount; i++) + { + SIMCacheChatItem chatItem = + { + 0, + }; + + TInt size = readAllStream.ReadInt16L() ; + HBufC8* mBuffer = HBufC8::NewLC( size ); + TPtr8 mBufferPtr = mBuffer->Des(); + + readAllStream.ReadL( mBufferPtr , size ); + + readStream.Open( *mBuffer ); + CleanupClosePushL(readStream) ; + + chatItem.iServiceId = static_cast( readStream.ReadInt16L() ); + + TInt textSize = readStream.ReadInt16L(); + HBufC* buddyId = HBufC::NewLC( textSize ); + TPtr buddyIdPtr = buddyId->Des(); + readStream.ReadL( buddyIdPtr , textSize); + + chatItem.iBuddyId = buddyId; + CleanupStack::Pop(buddyId); // ownership to structure variable + aChatArray.Insert(chatItem, 0); + CleanupStack::PopAndDestroy(2);//close read stream, delete mBuffer. + } + aMore = static_cast( readAllStream.ReadInt16L() ); + + CleanupStack::PopAndDestroy();//readAllStream. + + TRACE( T_LIT("CIMCacheUpdater::InternalizeChatListL() End") ); + } + +// END OF FILE diff -r 000000000000 -r e6b17d312c8b imservices/instantmessagingcache/imcacheclient/src/imcacheprocessstarter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/instantmessagingcache/imcacheclient/src/imcacheprocessstarter.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,266 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: start the server +* +*/ + + +#include "imcacheprocessstarter.h" +// logs +#include "imcachedebugtrace.h" +// system includes +#include +#include + + +// CONSTANTS +_LIT( KEka2ExeDir,"\\sys\\bin\\"); +_LIT( KEka2LaunchMutexExt, "[lMtx]" ); +const TInt KEka2SrvConnTries = 7; +const TInt KEka2SrvConnInitialRetryWait = 500; //MicroSeconds => 0.0005s + + +// ============================================================== +// ====================== HELPER CLASS ========================== +// ============================================================== + +/** + * RSessionBase accessor to give to the ProcessStarter + * access to RSessionBase::CreateSession(). + */ +class REka2SessionBaseAccessor : public RSessionBase + { + public: // Constructor + inline REka2SessionBaseAccessor() + { + } + + public: // New functions + + /** + * Public access to RSessionBase::CreateSession(). + */ + inline TInt CreateSession( const TDesC& aServer, + const TVersion& aVersion, + TInt aAsyncMessageSlots ) + { + return RSessionBase::CreateSession( aServer, + aVersion, + aAsyncMessageSlots ); + } + }; + + +// ============================================================== +// ====================== PROCESSSTARTER ======================== +// ============================================================== + +// -------------------------------------------------------------- +// IMCacheProcessStarter::FullExePathForClientLocation() +// -------------------------------------------------------------- +// +void IMCacheProcessStarter::FullExePathForClientLocation( + const TDesC& aExeName, + TFileName& aFullExePath ) + { + TRACE( T_LIT("IMCacheProcessStarter::FullExePathForClientLocation begin") ); + //Get drive (C:) where this client code is installed + { + TFileName tmp; + Dll::FileName( tmp ); + aFullExePath.Copy( TParsePtrC( tmp ).Drive() ); + } + + //Build the rest from the exe path + aFullExePath.Append( KEka2ExeDir ); + aFullExePath.Append( aExeName ); + TRACE( T_LIT("IMCacheProcessStarter::FullExePathForClientLocation end") ); + } + +// -------------------------------------------------------------- +// IMCacheProcessStarter::StartInstance() +// -------------------------------------------------------------- +// +TInt IMCacheProcessStarter::StartInstance( + const TDesC& aFullExePath, + const TDesC& aCommand ) + { + TRACE( T_LIT("IMCacheProcessStarter::StartInstance begin") ); + RMutex launchMutex; + TInt error = KErrNotFound; + + { + // Dynamic mutex name used to allow code share + TName launchMutexName( TParsePtrC( aFullExePath ).Name() ); + launchMutexName.Append( KEka2LaunchMutexExt ); + + // Open or Create mutex to serialize to access to server startup code. + // (race condition safe way) + while( error == KErrNotFound ) + { + error = launchMutex.CreateGlobal( launchMutexName ); + if( error != KErrAlreadyExists ) + { + break; + } + error = launchMutex.OpenGlobal( launchMutexName ); + } + + if( error != KErrNone ) + { + TRACE( T_LIT("IMCacheProcessStarter::StartInstance end") ); + return error; + } + } + + + launchMutex.Wait(); + + //Serialized access + error = IMCacheProcessStarter::DoStartInstance( aFullExePath, + aCommand ); + + launchMutex.Signal(); + launchMutex.Close(); + TRACE( T_LIT("IMCacheProcessStarter::StartInstance end") ); + return error; + } + +// -------------------------------------------------------------- +// IMCacheProcessStarter::ConnectToServer() +// -------------------------------------------------------------- +// +TInt IMCacheProcessStarter::ConnectToServer( + const TDesC& aFullExePath, + const TDesC& aCommand, + RSessionBase& aSessionToConnect, + const TDesC& aServerName, + const TVersion& aClientVersion, + TInt aAsyncMessageSlots ) + { + TRACE( T_LIT("IMCacheProcessStarter::ConnectToServer begin") ); + if( aSessionToConnect.Handle() != KNullHandle ) + { + return KErrInUse; + } + + TInt err = KErrNone; + TInt startupWait = KEka2SrvConnInitialRetryWait; + + //Server connect and launch loop + for( TInt trie = 0 ; trie < KEka2SrvConnTries ; trie++ ) + { + REka2SessionBaseAccessor acc; + err = acc.CreateSession( aServerName, + aClientVersion, + aAsyncMessageSlots ); + + if( err == KErrNone ) + { + //session ownership is now on client + aSessionToConnect = acc; + return KErrNone; + } + + else if( ( err == KErrNotFound ) || + ( err == KErrServerTerminated ) ) + { + //Server missing or died when connecting + //Start a new server + err = IMCacheProcessStarter::StartInstance( aFullExePath, + aCommand ); + + //If process exist already, then all is fine + //(some other process started it between the origical connect and launch trie) + if( err == KErrAlreadyExists ) + { + err = KErrNone; + } + + //If server process start failed, bail out. + if( err != KErrNone ) + { + return err; + } + + //If this is 2nd or subsequent try, + //give some time for server to startup + if( trie > 0 ) + { + // Code scanner warning : Use of User::After (id:92) + // it is required to be used here + User::After( startupWait ); // CSI: 92 # See above + startupWait = 2 * startupWait; + } + } + + else + { + //Server process start failed. Bail out. + return err; + } + } + TRACE( T_LIT("IMCacheProcessStarter::ConnectToServer end") ); + return err; + } + +// -------------------------------------------------------------- +// IMCacheProcessStarter::DoStartServerInstance() +// -------------------------------------------------------------- +// +TInt IMCacheProcessStarter::DoStartInstance( + const TDesC& aFullExePath, + const TDesC& aCommand ) + { + TRACE( T_LIT("IMCacheProcessStarter::DoStartInstance begin") ); + TInt error = KErrNone; + + //Create process + RProcess process; + error = process.Create( aFullExePath, aCommand ); + + if( error == KErrNone ) + { + + TRequestStatus rendezvousStatus; + process.Rendezvous( rendezvousStatus ); + + process.Resume(); + // Codescanner warning: user of User::WaitForRequest (Id:94) + // it is required to use at server startup + User::WaitForRequest( rendezvousStatus ); // CSI: 94 # See above + error = rendezvousStatus.Int(); + + if( process.ExitType() != EExitPending ) + { + //Something failed in server startup + //Force the error code to be always something + //else than KErrNone + if( error == KErrNone ) + { + error = KErrServerTerminated; + } + } + + } + + process.Close(); + TRACE( T_LIT("IMCacheProcessStarter::DoStartInstance end") ); + return error; + } + +// END OF FILE + + + diff -r 000000000000 -r e6b17d312c8b imservices/instantmessagingcache/imcacheserver/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/instantmessagingcache/imcacheserver/group/bld.inf Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,29 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: build definition file +* +*/ + + +#include +PRJ_PLATFORMS +DEFAULT + +PRJ_MMPFILES +imcacheserver.mmp + + + + +// end of file \ No newline at end of file diff -r 000000000000 -r e6b17d312c8b imservices/instantmessagingcache/imcacheserver/group/imcacheserver.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/instantmessagingcache/imcacheserver/group/imcacheserver.mmp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,58 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: mmp file +* +*/ + + +#include +#include +#include "../../inc/imcacheuids.h" + + +TARGET imcacheserver.exe +TARGETTYPE exe + +UID KStaticInterfaceDllUid2 KIMCacheServerUid3 +VENDORID VID_DEFAULT +CAPABILITY CAP_SERVER +TARGETPATH /system/libs + +VERSION 10.0 + +SOURCEPATH ../src + +SOURCE cimcacheserver.cpp +SOURCE cimcachesession.cpp +SOURCE ccacheserveractivehelper.cpp +SOURCE timcachemessagefactory.cpp +SOURCE cimcachemessageheader.cpp +SOURCE cimcachemessagebase.cpp +SOURCE cimcachebufferarray.cpp + +USERINCLUDE ../inc +USERINCLUDE ../../inc + +APP_LAYER_SYSTEMINCLUDE + +LIBRARY euser.lib +LIBRARY flogger.lib +LIBRARY charconv.lib +LIBRARY commonengine.lib +LIBRARY rsfwmountman.lib +LIBRARY estor.lib +LIBRARY ecom.lib + +// end of file + diff -r 000000000000 -r e6b17d312c8b imservices/instantmessagingcache/imcacheserver/inc/ccacheserveractivehelper.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/instantmessagingcache/imcacheserver/inc/ccacheserveractivehelper.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,227 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: instantmessagingcache server class declaration +* +*/ + +#ifndef __CIMCACHESERVERACTIVEHELPER_H__ +#define __CIMCACHESERVERACTIVEHELPER_H__ + +#include + +#include +#include + +// FORWARD DECLARATIONS +class CIMCacheServer; +class TIMCacheMessageFactory; +class MIMCacheMessageHeader; +class CIMCacheMessageBase; + + +/** +* This class is used by CIMCacheServer for dividing long running async. +* tasks into smaller units. The instantmessagingcache session itself was not made +* active, since that results in c++ ambiguousness problems in CCacheServerActiveHelper +* @since S60 v5.0 +*/ +class CCacheServerActiveHelper : public CBase + { + public: // public functions + + /** + * Default 1st phase factory method. + * Creates an instance of CCacheServerActiveHelper + * @return created instance of the CCacheServerActiveHelper + */ + static CCacheServerActiveHelper* NewL(CIMCacheServer& aServer); + + /** + * Destruct + */ + ~CCacheServerActiveHelper( ); + + + private: // private functions + + /** + * Constructor + * @param aServer, server reference + */ + CCacheServerActiveHelper(CIMCacheServer& aServer); + + /** + * ConstructL + */ + void ConstructL(); + + /** + * PackAndNotifyRecievedMessageL pack and notify about recieve message + * @param aMsgHeader, header reference + * @param aRecievedMsg, message reference + */ + void PackAndNotifyRecievedMessageL(MIMCacheMessageHeader* aMsgHeader, + CIMCacheMessageBase* aRecievedMsg); + + /** + * PackAndNotifyEventL pack and notify about message + * @param aNotification, type of change + * @param aMsgHeader, header reference + * @param aMessage, message reference + */ + void PackAndNotifyEventL( TIMCacheOperationsCode aNotification, + TInt aServiceId, + MIMCacheMessageHeader * aMsgHeader = NULL, + CIMCacheMessageBase* aMessage = NULL ); + + /** + * find and give the chat header pointer + * @param aServiceId, service id + * @param aBuddyId, buddy id + * @return chat header ,if not found NULL + */ + MIMCacheMessageHeader* ChatHeaderL(const TInt& aServiceId, const TDesC& aBuddyId ); + + /** + * Loads all the plugins + */ + void LoadPluginL( ); + + /** + * publishes the message info to the plugins + * @param aSenderId, buddy id + * @param aServiceId, service id + */ + void PublishMessageInfoL(const TDesC& aSenderId,TInt aServiceId ); + + +public: + /** + * reset all header chat started flag to EFalse + */ + void ResetHeaderInoformation(); + /** + * gets unread message count corresponding to a particular sender + */ + void GetUnreadMessageCountL(const RMessage2& aMessage ); + + /** + * gets all unread message count from all open conversations + */ + void GetAllUnreadMessageCountL(const RMessage2& aMessage ); + + /** + * start the new conversation + */ + void StartNewConversationL( const RMessage2 &aMessage ); + + /** + * append the revieve new messgae + */ + void AppendReceiveMessageL( const RMessage2 &aMessage ); + + /** + * append the new send messgae + */ + void AppendSendMessageL( const RMessage2 &aMessage ); + + /** + * append the information messgae + */ + void AppendMessageL( const RMessage2 &aMessage ); + + + /** + * close conversations overloaded method. + */ + void CloseConversationL( const RMessage2 &aMessage ); + + /** + * close All conversations availabe in service. + */ + void CloseAllConversationL( TInt aServiceId ); + + /** + * Deactivate ongoing conversation + */ + void DeactivateConversationL(); + + /** + * check if conversation already exist write ETrue if exist at 3rd index of message + */ + void CheckConversationExistL( const RMessage2 &aMessage ); + + + /** + * find the add contact header at given index + * @return contact header , NULL if not found + */ + MIMCacheMessageHeader* ChatHeaderAt( TInt aIndex ); + + /** + * total contact header counts + * @return the count + */ + TInt ChatHeadersCount() ; + + /** + * return array of chat headers corresponding to given service + * @param aServiceId, service id + * @param aServiceHeaderArray, filled with the headers corresponding to aServiceId,: out parameter. + * @return array of chat headers + */ + void GetServiceChatHeaderArrayL(TInt aServiceId , RPointerArray& aServiceHeaderArray ); +private: + /** + * Internal class used as a wrapper around a plugin + * and its uid. + */ + class CPluginInfo : public CBase + { + public: // Constructor & Destructor + CPluginInfo( CInstantMsgIndicator* aPlugin, TUid aUid ); + ~CPluginInfo(); + + public: // New functions + CInstantMsgIndicator& Plugin(); + private: // Data + CInstantMsgIndicator* iPlugin; + TUid iPluginUid; + }; +private : + /** + * pointer to CIMCacheServer& aServer doesnt own + */ + CIMCacheServer& iServer; + + // owned, main cache array + RPointerArray iHeaderArray; + + // not owned, active conversation header + MIMCacheMessageHeader* iActiveHeader; + + //owned, pointer to msg factory + TIMCacheMessageFactory* iMessageFactory; + + // takes ownership of the plugins + RPointerArray iPluginInfo; + + }; + +#endif // __CIMCACHESERVERACTIVEHELPER_H__ + + +// END OF FILE + + diff -r 000000000000 -r e6b17d312c8b imservices/instantmessagingcache/imcacheserver/inc/cimcachebufferarray.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/instantmessagingcache/imcacheserver/inc/cimcachebufferarray.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,92 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: a message class declaration +* +*/ + + +#ifndef CIMIMCACHEBUFFERARRAY_H +#define CIMIMCACHEBUFFERARRAY_H + +#include +#include +#include + +// FORWARD CLASS DECLERATIONS +// CLASS DECLARATION +// Definitions + +/** + * Message Base class + */ +class CIMCacheBufferArray : public CBase + { + + public: // Construction + + + /** + * Construction + * @param aData, text message + * @return Pointer to new created instance of CIMCacheBufferArray + */ + static CIMCacheBufferArray* NewL( const TDesC8& aPacketBuffer ,TIMCacheOperationsCode aOperationCode ); + + + /** + * Destruction + */ + ~CIMCacheBufferArray(); + + private : // Construction + + /** + * Constructor + */ + CIMCacheBufferArray( TIMCacheOperationsCode aOperationCode ); + + /** + * two phase construction + */ + void ConstructL( const TDesC8& aPacketBuffer ); + +public: + + + /** + * operatuin code stored + * @return operation code + */ + TIMCacheOperationsCode OperationCode(); + + /** + * Message + * @return message + */ + const TDesC8& PacketData(); + + + protected: // Member variables + + // owned, message buffer + HBufC8* iPacketBuffer; + + // owns : to identify type of message packed + TIMCacheOperationsCode iOperationCode; + + }; + +#endif // CIMIMCACHEMESSAGEBASE_H + +// End of File diff -r 000000000000 -r e6b17d312c8b imservices/instantmessagingcache/imcacheserver/inc/cimcachemessagebase.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/instantmessagingcache/imcacheserver/inc/cimcachemessagebase.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,144 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: a message class declaration +* +*/ + + +#ifndef CIMIMCACHEMESSAGEBASE_H +#define CIMIMCACHEMESSAGEBASE_H + +#include +#include +#include + +// FORWARD CLASS DECLERATIONS +// CLASS DECLARATION +// Definitions + +/** + * Message Base class + */ +class CIMCacheMessageBase : public CBase + { + + public: // Construction + + + /** + * Construction + * @param aData, text message + * @return Pointer to new created instance of CIMCacheMessageBase + */ + static CIMCacheMessageBase* NewL( + const TDesC& aData ); + + + /** + * Destruction + */ + ~CIMCacheMessageBase(); + + private : // Construction + + /** + * Constructor + */ + CIMCacheMessageBase(); + + /** + * Remember to call this one as last line of child ConstructL + * @param aSender, data + */ + void ConstructL( const TDesC& aData ); + + +public: + /** + * @see TimeStamp + * @return a time stamp + */ + const TTime& TimeStamp() const; + + /** + * @see MessageType + * @return a message type + */ + TIMCacheMessageType MessageType() const; + + /** + * @see MessagerType + * @return a messager type + */ + TIMCacheMessagerType MessagerType() const; + + + /** + * @see Text + * @return text message + */ + const TDesC& Text() const; + + + /** + * @see ContentType + * @return type of content + */ + TIMCacheContentType ContentType() const; + + + /** + * Set message type + * @param aNewType New message type. + */ + void SetMessageType( TIMCacheMessageType aNewType ); + + /** + * Set messager type + * @param aNewType New messager type. + */ + void SetMessagerType( TIMCacheMessagerType aNewType ); + + /** + * Set messager read + */ + void SetRead() ; + + /** + * IsUnread + * @return ETrue if messgae is unread. + */ + TBool IsUnread() const ; + + + protected: // Member variables + + /// Type of message + TIMCacheMessageType iMessageType; + // messager type + TIMCacheMessagerType iMessagerType; + + /// Timestamp. + TTime iTime; + /// Owns. Textual content. + HBufC* iText; + + // owned, message is unread + TBool iUnread; + + }; + +#endif // CIMIMCACHEMESSAGEBASE_H + +// End of File diff -r 000000000000 -r e6b17d312c8b imservices/instantmessagingcache/imcacheserver/inc/cimcachemessageheader.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/instantmessagingcache/imcacheserver/inc/cimcachemessageheader.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,142 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: a header of all convesation +* +*/ + + +#ifndef CIMCACHEMESSAGEHEADER_H +#define CIMCACHEMESSAGEHEADER_H + +#include +#include "mimcachemessageheader.h" + +// CLASS DECLARATION + +/** + * Message header for history data + * + * @lib imcacheserver.exe + * @since 5.0 + */ + +class CIMCacheMessageHeader : public CBase, + public MIMCacheMessageHeader + { + public: // Constructors and destructors + + /** + * NewL for CIMCacheMessageHeader + * Two-phase constructor + * @param aServiceId , a service id . + * @param aBuddyId a buddy. + * @return Instance of CIMCacheMessageHeader with header information. + */ + static CIMCacheMessageHeader* NewL(TInt aServiceId, const TDesC& aBuddyId ); + + /** + * Virtual destructor + */ + virtual ~CIMCacheMessageHeader(); + + private: // Constructors + + /** + * Default constructor + */ + CIMCacheMessageHeader(); + + /** + * ConstructL for CIMCacheMessageHeader + * Part of Two-phase construction + * @param aServiceId , a service id . + * @param aSender sender + * @param aBuddyId a recipient + */ + void ConstructL(TInt aServiceId, const TDesC& aBuddyId ); + + + public: //new MIMCacheMessageHeader + + /** + * service id + * @return a service id + */ + TInt ServiceId() const; + + /** + * user id of recipient + * @return recipient user id + */ + const TDesC& BuddyId() const; + + /** + * return total message count + */ + TInt MessageCount() const ; + + /** + * get message at given index + * @param aIndex index + */ + CIMCacheMessageBase* GetMessage(TInt aIndex ) ; + + /** + * append message + * @param aMessge message to append + */ + void AppendMessageL(CIMCacheMessageBase* aMessge) ; + + /** + * UnreadMessageCount + * @return unread message count + */ + TInt UnreadMessageCount() const ; + + /** + * check wheather chat started or not + * @return ETrue started + */ + TBool IsChatStarted(); + + /** + * set chat started + * @param aStarted, a boolean value to set + */ + void SetChatStarted(TBool aStarted ); + + /** + * mark all message read + */ + void MarkAllRead(); + + private: // Data + + //owned, recipient + HBufC* iBuddyId; + + //service id + TInt iServiceId ; + + //owned, array of all messages + RPointerArray< CIMCacheMessageBase > iMessageArray; + + //true if streaming is not completely done. + TBool iChatStarted; + + }; + +#endif // CIMCACHEMESSAGEHEADER_H + +// End of File diff -r 000000000000 -r e6b17d312c8b imservices/instantmessagingcache/imcacheserver/inc/cimcacheserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/instantmessagingcache/imcacheserver/inc/cimcacheserver.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,112 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: instantmessagingcache server class declaration +* +*/ + + +#ifndef __CIMCACHESERVER_H__ +#define __CIMCACHESERVER_H__ + +#include +#include + +// FORWARD DECLARATIONS +class CIMCacheSession; +class CCacheServerActiveHelper; +class MIMCacheMessageHeader ; +class CIMCacheMessageBase; +/** + * Service server. + */ +NONSHARABLE_CLASS( CIMCacheServer ): public CPolicyServer + { + + public: // Execution and destructors + static void ExecuteL(); + + virtual ~CIMCacheServer(); + + private: // C++ constructor + CIMCacheServer(); + + protected: // Methods from CPolicyServer + + CSession2* NewSessionL( const TVersion& aVersion, + const RMessage2& aMessage ) const; + + + public: //New methods + + /** + * SessionCreatedL + * @param aSession a session created + */ + void SessionCreatedL( CIMCacheSession* aSession ); + + /** + * SessionDied + * @param aSession a session died + */ + void SessionDied( CIMCacheSession* aSession ); + + + /** + * helper is owned by server class + * may any session requied to access + * to get the same instance + * @return pointer to the active helper + */ + CCacheServerActiveHelper* GetActiveHelper(); + + + /** + * pack and notify msg notification + * @param aChangeType , notification type + * @param aMsgHeader, chat header + * @param aMessage , a message + */ + void PackAndNotifyEventL( TIMCacheOperationsCode aChangeType, + TInt aServiceId, + MIMCacheMessageHeader* aMsgHeader = NULL, + CIMCacheMessageBase* aMessage = NULL ) ; + + + + private: // New methods + + + /** + * initialization will be done here + */ + void InitializeL(CIMCacheServer& aServer); + + + + private: //Data + // owned, session count + TInt iSessionCount; + // owned, array of all open sessions + RPointerArray iSessions; + // owned, active helper + CCacheServerActiveHelper* iActiveHelper; + }; + + +#endif // __CIMCACHESERVER_H__ + + +// END OF FILE + + diff -r 000000000000 -r e6b17d312c8b imservices/instantmessagingcache/imcacheserver/inc/cimcachesession.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/instantmessagingcache/imcacheserver/inc/cimcachesession.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,249 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: cache session class declaration +* +*/ + +#ifndef __CIMCACHESESSION_H__ +#define __CIMCACHESESSION_H__ + +#include +#include +#include + +// FARWORD DECLARATION +class CIMCacheServer; +class CCacheServerActiveHelper; +class MIMCacheMessageHeader ; +class CIMCacheMessageBase; +class CIMCacheBufferArray; + +/** + * Service side session. + */ + class CIMCacheSession : public CSession2 + { + + + public: + + /** + * NewL. + * Constructors + */ + static CIMCacheSession* NewL(); + /** + * ~CIMCacheSession + * destructors + */ + virtual ~CIMCacheSession(); + + + protected: // C++ constructors + /** + * C++ default constructor. + */ + CIMCacheSession(); + + /** + * Symbian OS constructor + */ + void ConstructL(); + + public: // Methods derived from CSession2 + /** + * From CSession2 + */ + void CreateL(); + /** + * From CSession2 + */ + void ServiceL( const RMessage2 &aMessage ); + /** + * From CSession2 + */ + void ServiceError( const RMessage2& aMessage, + TInt aError ); + + + + public: // New methods + + /** + * Server , + * @return server reference + */ + CIMCacheServer* Server() + { + return (CIMCacheServer*) CSession2::Server(); + } + + /** + * pack and notify msg notification + * @param aChangeType , notification type + * @param aMsgHeader, chat header + * @param aMessage , a message + * @param aServiceId ,service id + */ + void PackAndNotifyEventL( TIMCacheOperationsCode aChangeType , + MIMCacheMessageHeader* aMsgHeader = NULL , + CIMCacheMessageBase* aMessage = NULL ); + + /* + * return the service Id of session + */ + TInt ServiceId() const ; + + private: // New methods + + + /** + * Dispatch clients message + * @since + * @param aMessage client's message + */ + TBool DispatchMessageL( const RMessage2 &aMessage ); + + + /** + * Initializes the server + * @param aMessage client's message + */ + void InitSessionL( const RMessage2& aMessage ); + + + + /** + * reset all conversation, start flag to EFalse + */ + void ResetHeaderInoformation(); + + + /** + * Externalizes all chat data + * @param aArray, array of buffered headers.. + * @param aSize total size of buffered messages. + * @param aMore , still data is pending to be send + */ + void ExternalizeBufferedDataL(TIMCacheOperationsCode aOperationCode, + RPointerArray& aArray , + TInt aTotalSize , + TBool aMore = EFalse ); + + /** + * Externalizes chat headers + * @param aChangeType, event type + * @param aMsgHeader, chat header + * @param aMessage , chat message + * @param aServiceId , serviceid + */ + void ExternalizeChatItemL( TIMCacheOperationsCode aChangeType , + TInt aServiceId = KErrNotFound ); + + /** + * Externalizes all chat header messages. + * @param aChangeType, event type + * @param aMsgHeader, chat header + */ + void SendChatListDataL( TIMCacheOperationsCode aChangeType , + MIMCacheMessageHeader* aMsgHeader ); + + /** + * send unread change notification + * @param aMsgHeader, chat header + * @param aMessage , chat message + */ + void SendUnreadChangeNotificationL(MIMCacheMessageHeader* aMsgHeader, + CIMCacheMessageBase* aMessage ); + + /** + * Externalizes single chat item. + * @param aMsgHeader, chat header + */ + void ExternalizeSingleChatItemL( TIMCacheOperationsCode aChangeType, MIMCacheMessageHeader* aMsgHeader ); + + + /** + * Externalizes single chat messages. + * @param aMsgHeader, chat header + * @param aMessage , chat message + */ + void ExternalizeSingleChatDataL(TIMCacheOperationsCode aChangeType, + MIMCacheMessageHeader* aChatHeader, + CIMCacheMessageBase* aMessage ); + + /** + * Externalizes all chat messages in a message header + * @param aChangeType, event type + * @param aMsgHeader, chat header + */ + void ExternalizeChatDataL(TIMCacheOperationsCode aChangeType ,MIMCacheMessageHeader* aChatHeader ); + + /** + * write data to stream + * @param aChatHeader, chat header + * @param aSize total size of buffered messages. + * @return a HBufC8 stream buffer pointer + */ + HBufC8* GetPackedChatItemBufferL(MIMCacheMessageHeader* aChatHeader, TInt& aSize); + + /** + * write data to stream + * @param aMsg, message + * @param aMsgHeader, chat header + * @param aSize total size of buffered messages. + * @return a HBufC8 stream buffer pointer + */ + HBufC8* GetPackedChatDataBufferL(CIMCacheMessageBase* aMsg , + MIMCacheMessageHeader* aActiveHeader , + const TInt aSize); + /** + * do request complete + * @param aChangeType, type of request + */ + // void DoRequestComplete( TIMCacheOperationsCode aChangeType ); + private: // Data + //owned, message completed state + TBool iMessageCompleted; + + //does observer is active + TBool iObserverActive; + + //msg observer + RMessage2 iObserverMessage; + + // not owned, active helper + CCacheServerActiveHelper* iHelper; + + // owns, pending packets to be sent to ui client + RPointerArray iPacketsArray; + + // read only right initialized + TBool iAccessorInitialized; + // conversation r/w initialized + TBool iConvesationInitialized; + + // owns : add request fetch completed or not + TBool iOpenChatFetchCompleted; + + // service id for this session + TInt iServiceId; + + }; + +#endif // __CIMCACHESESSION_H__ + + +// END OF FILE + diff -r 000000000000 -r e6b17d312c8b imservices/instantmessagingcache/imcacheserver/inc/mimcachemessagefactory.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/instantmessagingcache/imcacheserver/inc/mimcachemessagefactory.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,83 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: factory helper class declaration +* +*/ + + +#ifndef __MIMCACHEMESSAGEFACTORY_H__ +#define __MIMCACHEMESSAGEFACTORY_H__ + +//INCLUDES + +#include + +// FORWARD DECLERATIONS + +class CIMCacheMessageBase; +class MIMCacheMessageHeader; + +// CLASS DECLARATION + +/** + * Interface for creator of MCAIMCacheMessages. + * imcacheserver.exe + * @since 5.0 + */ +class MIMCacheMessageFactory + { + protected: + + /** + * Destructor. + */ + virtual ~MIMCacheMessageFactory() {}; + + public: // Interface + + + /** + * Creates cahe message header + * @since 5.0 + * @param aServiceId service Id + * @param aBuddyId sender. + * @return Instance to MIMCacheMessageHeader + */ + virtual MIMCacheMessageHeader* CreateIMCacheMessageHeaderL(TInt aServiceId, const TDesC& aBuddyId ) = 0; + + /** + * Creates cashe message + * @param aSender sender of message. + * @param aRecipient recipient of message. + * @param aData content data. + * @return Instance to CIMCacheMessageBase + */ + virtual CIMCacheMessageBase* CreateCacheMessageL( + const TDesC& aData ) = 0; + + /** + * Find Index + * @param aArray array + * @param aRecipient recipient of message. + * @param aServiceId service Id + * @param aSender sender. + */ + virtual TInt FindHeaderIndexL( RPointerArray& aArray, + TInt aServiceId, + const TDesC& aBuddyId ) = 0 ; + }; + +#endif // __MIMCACHEMESSAGEFACTORY_H__ + +// End of File \ No newline at end of file diff -r 000000000000 -r e6b17d312c8b imservices/instantmessagingcache/imcacheserver/inc/mimcachemessageheader.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/instantmessagingcache/imcacheserver/inc/mimcachemessageheader.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,105 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: base call of header class +* +*/ + + +#ifndef MIMCACHEMESSAGEHEADER_H +#define MIMCACHEMESSAGEHEADER_H + +//INCLUDES + +#include +#include + +//FORWARD DECLARATIONS +class CIMCacheMessageBase; + +// CLASS DECLARATION + +/** + * Interface for header information of history file + * @lib imcacheserver.exe + * @since 5.0 + */ +class MIMCacheMessageHeader + { + public: + + /** + * Destructor. + */ + virtual ~MIMCacheMessageHeader() {}; + + public: // Interface + + /** + * service id + * @return a service id + */ + virtual TInt ServiceId() const = 0; + + /** + * user id of recipient + * @return recipient user id + */ + virtual const TDesC& BuddyId() const = 0; + + /** + * return total message count + */ + virtual TInt MessageCount() const = 0 ; + + /** + * get message at given index + * @param aIndex index + */ + virtual CIMCacheMessageBase* GetMessage(TInt aIndex ) = 0; + + /** + * append message + * @param aMessge message to append + */ + virtual void AppendMessageL(CIMCacheMessageBase* aMessge) = 0 ; + + /** + * UnreadMessageCount + * @return unread message count + */ + virtual TInt UnreadMessageCount() const = 0 ; + + /** + * check wheather chat started or not + * @return ETrue started + */ + virtual TBool IsChatStarted() = 0 ; + + /** + * set chat started + * @param aStarted, a boolean value to set + */ + virtual void SetChatStarted(TBool aStarted ) = 0 ; + + /** + * mark all message read + */ + virtual void MarkAllRead() = 0 ; + + + }; + +#endif // MIMCACHEMESSAGEHEADER_H + +// End of File diff -r 000000000000 -r e6b17d312c8b imservices/instantmessagingcache/imcacheserver/inc/timcachemessagefactory.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/instantmessagingcache/imcacheserver/inc/timcachemessagefactory.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,82 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: factory helper class declaration +* +*/ + + +#ifndef TIMCHACHEMESSAGEFACTORY_H +#define TIMCHACHEMESSAGEFACTORY_H + +//INCLUDES + +#include +#include "mimcachemessagefactory.h" + +// FORWARD DECLERATIONS + +class MIMCacheMessageHeader; +class CIMCacheMessageBase; +// CLASS DECLARATION + +/** + * Implementation for creator of MCAIMCacheMessages. + * + * T-class, because there is no dynamic member variables and because + * there is no other class which suites in this case. + * Class methods cannot be static, because pointer to MIMCacheMessageFactory + * is passed to client. + */ +class TIMCacheMessageFactory : public MIMCacheMessageFactory + { + public: // Interface + + + /** + * Creates cahe message header + * @since 5.0 + * @param aServiceId service Id + * @param aBuddyId sender. + * @return Instance to MIMCacheMessageHeader + */ + MIMCacheMessageHeader* CreateIMCacheMessageHeaderL(TInt aServiceId, + const TDesC& aBuddyId ); + + + /** + * Creates cashe message + * @param aSender sender of message. + * @param aRecipient recipient of message. + * @param aData content data. + * @return Instance to CIMCacheMessageBase + */ + CIMCacheMessageBase* CreateCacheMessageL(const TDesC& aData ); + + + /** + * Find Index + * @param aArray array + * @param aRecipient recipient of message. + * @param aServiceId service Id + */ + TInt FindHeaderIndexL( RPointerArray& aArray, + TInt aServiceId, + const TDesC& aBuddyId ); + + + }; + +#endif // TIMCHACHEMESSAGEFACTORY_H + +// End of File diff -r 000000000000 -r e6b17d312c8b imservices/instantmessagingcache/imcacheserver/src/ccacheserveractivehelper.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/instantmessagingcache/imcacheserver/src/ccacheserveractivehelper.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,730 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: active helper for server ,owns the main cache arrray +* +*/ + + // INCLUDE FILES +#include "ccacheserveractivehelper.h" + +#include "cimcachesession.h" +#include +#include "mimcachemessageheader.h" +#include "cimcacheserver.h" +#include "timcachemessagefactory.h" +#include "cimcachemessageheader.h" +#include "cimcachemessagebase.h" +#include + //logs +#include "imcachedebugtrace.h" +// --------------------------------------------------------------------------- +// CCacheServerActiveHelper::NewL() +// --------------------------------------------------------------------------- +// +CCacheServerActiveHelper* CCacheServerActiveHelper::NewL(CIMCacheServer& aServer) + { + TRACE( T_LIT( "CCacheServerActiveHelper::NewL begin") ); + CCacheServerActiveHelper* self = new(ELeave) CCacheServerActiveHelper(aServer); + CleanupStack::PushL( self ); + self->ConstructL( ); + CleanupStack::Pop( self ); + TRACE( T_LIT( "CCacheServerActiveHelper::NewL end") ); + return self; + } + +// --------------------------------------------------------------------------- +// CCacheServerActiveHelper::~CCacheServerActiveHelper() +// --------------------------------------------------------------------------- +// +CCacheServerActiveHelper::~CCacheServerActiveHelper( ) + { + TRACE( T_LIT( "CCacheServerActiveHelper::~CCacheServerActiveHelper begin") ); + + iHeaderArray.ResetAndDestroy(); + //all items are there in iHeaderArray so no need to call ResetAndDestroy + iPluginInfo.ResetAndDestroy(); + iPluginInfo.Close(); + TRACE( T_LIT( "CCacheServerActiveHelper::~CCacheServerActiveHelper end") ); + } + + +// --------------------------------------------------------------------------- +// CCacheServerActiveHelper::CCacheServerActiveHelper() +// --------------------------------------------------------------------------- +// +CCacheServerActiveHelper::CCacheServerActiveHelper(CIMCacheServer& aServer ) + :iServer(aServer ) + + { + TRACE( T_LIT( "CCacheServerActiveHelper::CCacheServerActiveHelper begin") ); + TRACE( T_LIT( "CCacheServerActiveHelper::CCacheServerActiveHelper end") ); + } + +// --------------------------------------------------------------------------- +// CCacheServerActiveHelper::ConstructL() +// --------------------------------------------------------------------------- +// +void CCacheServerActiveHelper::ConstructL() + { + TRACE( T_LIT( "CCacheServerActiveHelper::ConstructL begin") ); + iMessageFactory = new ( ELeave ) TIMCacheMessageFactory; + LoadPluginL( ); + TRACE( T_LIT( "CCacheServerActiveHelper::ConstructL end") ); + } + +// --------------------------------------------------------------------------- +// CCacheServerActiveHelper::ResetHeaderInoformation() +// --------------------------------------------------------------------------- +// +void CCacheServerActiveHelper::ResetHeaderInoformation() + + { + TRACE( T_LIT( "CCacheServerActiveHelper::ResetHeaderInoformation begin") ); + TInt count = iHeaderArray.Count() ; + for ( TInt i= 0; i< count; i++ ) + { + MIMCacheMessageHeader* header = iHeaderArray[ i ]; + header->SetChatStarted(EFalse); + } + TRACE( T_LIT( "CCacheServerActiveHelper::ResetHeaderInoformation end") ); + } +// --------------------------------------------------------- +// CCacheServerActiveHelper::GetUnreadMessageCountL +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CCacheServerActiveHelper::GetUnreadMessageCountL(const RMessage2& aMessage ) + { + TRACE( T_LIT( "CCacheServerActiveHelper::GetUnreadMessageCountL start") ); + // at zero place service id was appended + TInt sericeId = aMessage.Int0(); + + // at index 1 sender was appended + TInt bufferSize( aMessage.GetDesLength( 1 ) ); + HBufC* buddyId = HBufC::NewLC( bufferSize ); + TPtr buddyIdPtr = buddyId->Des(); + aMessage.ReadL( 1, buddyIdPtr ); + + TInt headerIndex = iMessageFactory->FindHeaderIndexL(iHeaderArray, sericeId, buddyIdPtr ); + TInt unreadCount = 0; + if( headerIndex != KErrNotFound ) //if match is found + { + MIMCacheMessageHeader* newHeader = iHeaderArray[ headerIndex ]; + + unreadCount = newHeader->UnreadMessageCount(); + + } + TPckgC pack( unreadCount ); + aMessage.WriteL( 2, pack ); + + CleanupStack::PopAndDestroy(buddyId); + TRACE( T_LIT( "CCacheServerActiveHelper::GetUnreadMessageCountL end") ); + } +// --------------------------------------------------------- +// CCacheServerActiveHelper::GetAllUnreadMessageCountL +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CCacheServerActiveHelper::GetAllUnreadMessageCountL(const RMessage2& aMessage ) + { + TRACE( T_LIT( "CCacheServerActiveHelper::GetAllUnreadMessageCountL start") ); + // at zero place service id was appended + TInt sericeId = aMessage.Int0(); + + TInt unreadCount = 0; + + TInt headerCount = iHeaderArray.Count(); + + for( TInt i=0; i< headerCount; i++ ) + { + // note in this case reciepient is own user id + MIMCacheMessageHeader* header = iHeaderArray[i]; + if( header->ServiceId() == sericeId ) + { + unreadCount = unreadCount + header->UnreadMessageCount(); + } + } + + TPckgC pack( unreadCount ); + aMessage.WriteL( 1, pack ); + + + TRACE( T_LIT( "CCacheServerActiveHelper::GetAllUnreadMessageCountL end") ); + } +// --------------------------------------------------------- +// CCacheServerActiveHelper::StartNewConversationL +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CCacheServerActiveHelper::StartNewConversationL( const RMessage2& aMessage ) + { + TRACE( T_LIT( "CCacheServerActiveHelper::StartNewConversationL start") ); + // at zero place service id was appended + TInt sericeId = aMessage.Int0(); + + // at index 1 sender was appended + TInt bufferSize( aMessage.GetDesLength( 1 ) ); + HBufC* buddyId = HBufC::NewLC( bufferSize ); + TPtr buddyIdPtr = buddyId->Des(); + aMessage.ReadL( 1, buddyIdPtr ); + + TInt messageCount = 0; + + MIMCacheMessageHeader* chatHeader = ChatHeaderL( sericeId, buddyIdPtr ); + + if( chatHeader == NULL ) //if match is not found + { + TRACE( T_LIT( "CCacheServerActiveHelper::StartNewConversationL Fresh conversation") ); + chatHeader = iMessageFactory->CreateIMCacheMessageHeaderL(sericeId, buddyIdPtr ); + // insert always on top + iHeaderArray.InsertL(chatHeader , 0); + + iActiveHeader = chatHeader; + + chatHeader->SetChatStarted(ETrue); + + PackAndNotifyEventL( EIMOperationChatStarted, sericeId, iActiveHeader , NULL ); + } + else if( !chatHeader->IsChatStarted() ) //if match is found + { + TRACE( T_LIT( "CCacheServerActiveHelper::StartNewConversationL existing conversation") ); + + chatHeader->SetChatStarted(ETrue); + + iActiveHeader = chatHeader ; + + iActiveHeader->MarkAllRead(); + + messageCount = iActiveHeader->MessageCount(); + + if( messageCount ) + { + PackAndNotifyEventL(EIMOperationFetchAll, sericeId, iActiveHeader, NULL ); + // still fetching is not completed, until EIMOperationCompleted + } + TRACE( T_LIT( "CCacheServerActiveHelper::StartNewConversationL start fetching") ); + } + else + { + iActiveHeader = chatHeader; + + iActiveHeader->MarkAllRead(); + + PackAndNotifyEventL(EIMOperationUnreadChange, sericeId, iActiveHeader , NULL ); + // once request is completed, mark as fetch completed + } + // if there are no unread messages then reset the status pane indicator. + TInt unreadCount = 0; + TInt headerCount = iHeaderArray.Count(); + for( TInt i=0; i< headerCount; i++ ) + { + // note in this case reciepient is own user id + MIMCacheMessageHeader* header = iHeaderArray[i]; + if( header->ServiceId() == sericeId ) + { + unreadCount = unreadCount + header->UnreadMessageCount(); + } + } + if(!unreadCount) + { + PublishMessageInfoL(*buddyId,sericeId); + } + + CleanupStack::PopAndDestroy(buddyId); + + TRACE( T_LIT( "CCacheServerActiveHelper::StartNewConversationL end") ); + } + + +// --------------------------------------------------------- +// CCacheServerActiveHelper::AppendReceiveMessageL +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CCacheServerActiveHelper::AppendReceiveMessageL( const RMessage2 &aMessage ) + { + TRACE( T_LIT( "CCacheServerActiveHelper::AppendReceiveMessageL start") ); + // at zero pace service id was apended + TInt sericeId = aMessage.Int0(); + + // at index 1 sender was appended + TInt bufferSize( aMessage.GetDesLength( 1 ) ); + HBufC* buddyId = HBufC::NewLC( bufferSize ); + TPtr buddyIdPtr = buddyId->Des(); + aMessage.ReadL( 1, buddyIdPtr ); + + // at index 2 text was appended + bufferSize = aMessage.GetDesLength( 2 ) ; + HBufC* text = HBufC::NewLC( bufferSize ); + TPtr textPtr = text->Des(); + aMessage.ReadL( 2, textPtr ); + + TRACE( T_LIT( "CCacheServerActiveHelper::AppendReceiveMessageL Msg %S"), &textPtr ); + + MIMCacheMessageHeader* chatHeader = ChatHeaderL( sericeId, buddyIdPtr ); + + CIMCacheMessageBase* newmessage = NULL; + + if( chatHeader == NULL ) //if match is not found + { + TRACE( T_LIT( "CCacheServerActiveHelper::AppendReceiveMessageL Fresh conversation") ); + chatHeader = iMessageFactory->CreateIMCacheMessageHeaderL(sericeId, buddyIdPtr); + // insert always on top + iHeaderArray.InsertL(chatHeader , 0); + + newmessage = iMessageFactory->CreateCacheMessageL( textPtr ); + newmessage->SetMessageType( EIMCMessagePTOP ); + newmessage->SetMessagerType( EIMCMessageReceived ); + + chatHeader->AppendMessageL(newmessage); + + PublishMessageInfoL(*buddyId,sericeId); + + // no notification so for this is for servicetab + // here need to notify for all session + // fresh conversation started + + PackAndNotifyEventL( EIMOperationChatAdded, sericeId, chatHeader ,newmessage ); + + } + else // chat found + { + TRACE( T_LIT( "CCacheServerActiveHelper::AppendReceiveMessageL existing conversation") ); + // this is called from network side + // here we dont know about ui client wheather this active conversation is active or not. + + newmessage = iMessageFactory->CreateCacheMessageL( textPtr ); + newmessage->SetMessageType( EIMCMessagePTOP ); + newmessage->SetMessagerType( EIMCMessageReceived ); + chatHeader->AppendMessageL(newmessage); + + // notify all registeed session about this changed + // this has happened on active conversation + + if( chatHeader == iActiveHeader ) + { + //cv tab is active notify it. + PackAndNotifyEventL( EIMOperationMessageAdded, sericeId, chatHeader, newmessage ); + } + else + { + PublishMessageInfoL(*buddyId,sericeId); + //cv tab is not active notify it. + PackAndNotifyEventL( EIMOperationUnreadMessage, sericeId, chatHeader , newmessage ); + } + } + CleanupStack::PopAndDestroy(2);//text,buddyId + // else TODO mark unread messagesinto buffer + TRACE( T_LIT( "CCacheServerActiveHelper::AppendReceiveMessageL end") ); + } +// --------------------------------------------------------- +// CCacheServerActiveHelper::AppendSendMessageL +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CCacheServerActiveHelper::AppendSendMessageL( const RMessage2 &aMessage ) + { + TRACE( T_LIT( "CCacheServerActiveHelper::AppendSendMessageL start") ); + + // at index 0 text was appended + TInt bufferSize = aMessage.GetDesLength( 0 ) ; + HBufC* text = HBufC::NewLC( bufferSize ); + TPtr textPtr = text->Des(); + aMessage.ReadL( 0, textPtr ); + + TRACE( T_LIT( "CCacheServerActiveHelper::AppendSendMessageL Msg %S"), &textPtr ); + + if( iActiveHeader ) + { + CIMCacheMessageBase* message = iMessageFactory->CreateCacheMessageL( textPtr ); + message->SetMessageType( EIMCMessagePTOP ); + message->SetMessagerType( EIMCMessageSent ); + message->SetRead(); + + iActiveHeader->AppendMessageL(message); + } + CleanupStack::PopAndDestroy(text); // text + + TRACE( T_LIT( "CCacheServerActiveHelper::AppendSendMessageL end") ); + } + +// --------------------------------------------------------- +// CCacheServerActiveHelper::AppendMessageL +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CCacheServerActiveHelper::AppendMessageL( const RMessage2 &aMessage ) + { + TRACE( T_LIT( "CCacheServerActiveHelper::AppendMessageL start") ); + // this is get called from active conversation only. + // this append the normal information message , + // please note, this is not sent/recieved message + // at 0 place text was appended + // this is get called from conversation only system emssage + // will get addded when buddy presence changes. + TInt sericeId = aMessage.Int0(); + + // at index 1 sender was appended + TInt bufferSize( aMessage.GetDesLength( 1 ) ); + HBufC* buddyId = HBufC::NewLC( bufferSize ); + TPtr buddyIdPtr = buddyId->Des(); + aMessage.ReadL( 1, buddyIdPtr ); + + // at index 2 text was appended + bufferSize = aMessage.GetDesLength( 2 ) ; + HBufC* text = HBufC::NewLC( bufferSize ); + TPtr textPtr = text->Des(); + aMessage.ReadL( 2, textPtr ); + + TRACE( T_LIT( "CCacheServerActiveHelper::AppendSendMessageL Msg %S"), &textPtr ); + + MIMCacheMessageHeader* chatHeader = ChatHeaderL( sericeId, buddyIdPtr ); + + if( chatHeader != NULL ) + { + CIMCacheMessageBase* message = iMessageFactory->CreateCacheMessageL( textPtr ); + message->SetMessageType( EIMCMessageSystem ); + message->SetMessagerType( EIMCMessageOther ); + message->SetRead(); + chatHeader->AppendMessageL(message); + } + CleanupStack::PopAndDestroy(2); //buddyId, text + + TRACE( T_LIT( "CCacheServerActiveHelper::AppendMessageL end") ); + } +// --------------------------------------------------------- +// CCacheServerActiveHelper::CloseConversationL +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CCacheServerActiveHelper::CloseConversationL( const RMessage2 &aMessage ) + { + TRACE( T_LIT( "CCacheServerActiveHelper::CloseConversationL start") ); + // at zero pace service id was apended + TInt sericeId = aMessage.Int0(); + + // at index 1 sender was appended + TInt bufferSize( aMessage.GetDesLength( 1 ) ); + HBufC* buddyId = HBufC::NewLC( bufferSize ); + TPtr buddyIdPtr = buddyId->Des(); + aMessage.ReadL( 1, buddyIdPtr ); + + TInt headerIndex = iMessageFactory->FindHeaderIndexL(iHeaderArray, sericeId, buddyIdPtr ) ; + + if( headerIndex != KErrNotFound ) //if match is found + { + MIMCacheMessageHeader* msgHeader = iHeaderArray[headerIndex]; + iHeaderArray.Remove(headerIndex); + if(msgHeader == iActiveHeader) + { + iActiveHeader = NULL; + } + + PackAndNotifyEventL( EIMOperationChatDeleted, sericeId, msgHeader, NULL ); + + delete msgHeader; + iHeaderArray.Compress(); + + } + CleanupStack::PopAndDestroy(buddyId); // buddyId + + TRACE( T_LIT( "CCacheServerActiveHelper::CloseConversationL end") ); + } +// --------------------------------------------------------- +// CCacheServerActiveHelper::CloseAllConversationL +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CCacheServerActiveHelper::CloseAllConversationL( TInt aServiceId ) + { + TRACE( T_LIT( "CCacheServerActiveHelper::CloseAllConversationL start") ); + TBool needToNotify = EFalse; + for( TInt index=0; indexServiceId() == aServiceId ) + { + iHeaderArray.Remove(index); + if(msgHeader == iActiveHeader) + { + iActiveHeader = NULL; + } + delete msgHeader; + msgHeader = NULL; + iHeaderArray.Compress(); + index = index-1;// start from same index again + needToNotify = ETrue; + } + } + if( needToNotify ) + { + PackAndNotifyEventL( EIMOperationAllChatDeleted, aServiceId, NULL, NULL ); + } + TRACE( T_LIT( "CCacheServerActiveHelper::CloseAllConversationL End") ); + } +// --------------------------------------------------------- +// CCacheServerActiveHelper::DeactivateConversationL +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CCacheServerActiveHelper::DeactivateConversationL() + { + TRACE( T_LIT( "CCacheServerActiveHelper::DeactivateConversationL start") ); + // this is get called from active conversation only. + if( iActiveHeader ) + { + iActiveHeader->MarkAllRead(); + } + iActiveHeader = NULL; + TRACE( T_LIT( "CCacheServerActiveHelper::DeactivateConversationL end") ); + } + +// --------------------------------------------------------- +// CCacheServerActiveHelper::CheckConversationExistL +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CCacheServerActiveHelper::CheckConversationExistL( const RMessage2& aMessage ) + { + TRACE( T_LIT( "CCacheServerActiveHelper::CheckConversationExistL start") ); + // at zero place service id was appended + TInt sericeId = aMessage.Int0(); + + // at index 1 sender was appended + TInt bufferSize( aMessage.GetDesLength( 1 ) ); + HBufC* buddyId = HBufC::NewLC( bufferSize ); + TPtr buddyIdPtr = buddyId->Des(); + aMessage.ReadL( 1, buddyIdPtr ); + + TInt headerIndex = iMessageFactory->FindHeaderIndexL(iHeaderArray, sericeId, buddyIdPtr ) ; + + TBool conversationExist = EFalse; + + if( headerIndex != KErrNotFound ) //if match is found + { + conversationExist = ETrue; + } + TPckgC pack( conversationExist ); + aMessage.WriteL(2, pack ); + + CleanupStack::PopAndDestroy(buddyId); // buddyId + + TRACE( T_LIT( "CCacheServerActiveHelper::CheckConversationExistL end") ); + } + +// --------------------------------------------------------- +// CCacheServerActiveHelper::PackAndNotifyEventL +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CCacheServerActiveHelper::PackAndNotifyEventL( TIMCacheOperationsCode aNotification, + TInt aServiceId, + MIMCacheMessageHeader* aChatHeader /*=NULL*/, + CIMCacheMessageBase* aMessage /*=NULL*/) + { + TRACE( T_LIT( "CCacheServerActiveHelper::PackAndNotifyEventL start") ); + + iServer.PackAndNotifyEventL( aNotification, aServiceId, aChatHeader, aMessage ); + + TRACE( T_LIT( "CCacheServerActiveHelper::PackAndNotifyEventL end") ); + } + + +// --------------------------------------------------------- +// CCacheServerActiveHelper::GetServiceChatHeaderArrayL +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CCacheServerActiveHelper::GetServiceChatHeaderArrayL(TInt aServiceId , RPointerArray& aServiceHeaderArray) + { + TRACE( T_LIT( "CCacheServerActiveHelper::GetServiceChatHeaderArrayL start") ); + + + if( -1 == aServiceId ) + { + aServiceHeaderArray = iHeaderArray; + } + else + { + for( TInt i= 0 ; i < iHeaderArray.Count() ; i++ ) + { + MIMCacheMessageHeader* header = iHeaderArray[i]; + if( header->ServiceId() == aServiceId ) + { + aServiceHeaderArray.AppendL(header); + } + } + } + TRACE( T_LIT( "CCacheServerActiveHelper::GetServiceChatHeaderArrayL end") ); + } + +// --------------------------------------------------------- +// CCacheServerActiveHelper::ChatHeaderL +// (other items were commented in a header). +// --------------------------------------------------------- +MIMCacheMessageHeader* CCacheServerActiveHelper::ChatHeaderL(const TInt& aServiceId, const TDesC& aBuddyId ) + { + MIMCacheMessageHeader* header = NULL; + TInt headerCount = iHeaderArray.Count(); + + for( TInt index = 0 ; index < headerCount ; index++ ) + { + header = iHeaderArray[index]; + if( header ) + { + if( ( aServiceId == header->ServiceId() ) && ( aBuddyId.CompareC( header->BuddyId() ) == 0 ) ) + { + break; + } + } + header = NULL; + } + return header; + } +// ----------------------------------------------------------------------------- +// CCacheServerActiveHelper::ChatHeaderAt +// name of history data +// ----------------------------------------------------------------------------- +// +MIMCacheMessageHeader* CCacheServerActiveHelper::ChatHeaderAt( TInt aIndex ) + { + if( aIndex >= ChatHeadersCount() ) + { + return NULL; + } + return iHeaderArray[aIndex]; + } + +// ----------------------------------------------------------------------------- +// CCacheServerActiveHelper::ChatHeadersCount +// name of history data +// ----------------------------------------------------------------------------- +// +TInt CCacheServerActiveHelper::ChatHeadersCount() + { + return iHeaderArray.Count(); + } + + +// ----------------------------------------------------------------------------- +// CCacheServerActiveHelper::PublishMessageInfoL() +// name of history data +// ----------------------------------------------------------------------------- +// +void CCacheServerActiveHelper::PublishMessageInfoL(const TDesC& aSenderId,TInt aServiceId ) + { + // set/reset the status pane indicator here + // based on the unread count. + // as we need to show the indicator only for the received messages + TInt unreadCount = 0; + TInt multipleSender = 0; + TInt headerCount = iHeaderArray.Count(); + TRACE(T_LIT( "CCacheServerActiveHelper::PublishMessageInfoL headerCount -- %d"), headerCount); + for( TInt i=0; i< headerCount; i++ ) + { + // note in this case reciepient is own user id + MIMCacheMessageHeader* header = iHeaderArray[i]; + TRACE(T_LIT( "CCacheServerActiveHelper::PublishMessageInfoL UnreadMessageCount -- %d"), header->UnreadMessageCount()); + if( header->ServiceId() == aServiceId && header->UnreadMessageCount() ) + { + unreadCount = unreadCount + header->UnreadMessageCount(); + multipleSender ++; + } + } + TRACE(T_LIT( "CCacheServerActiveHelper::PublishMessageInfoL multipleSender -- %d"), multipleSender); + // Get the number of plugins + const TInt count = iPluginInfo.Count(); + // Loop though all the command handlers, If DynInitMenuPaneL leaves for one plugin, a plugin + // error message will be displayed and the loop will continue with + // the next command handler. If none of the plugins leave, there will + // be only one TRAP used. + for ( TInt index = 0; index < count; ++index ) + { + //trap is required if one plugin leaves then it should continue with other plugins. + TRAP_IGNORE(iPluginInfo[index]->Plugin().MessageInfoL(unreadCount,aServiceId,aSenderId,multipleSender)); + } + } + // ----------------------------------------------------------------------------- + // CCacheServerActiveHelper::LoadPluginL + // ----------------------------------------------------------------------------- + // + void CCacheServerActiveHelper::LoadPluginL( ) + { + // plugininfo array, Owned + RImplInfoPtrArray pluginInfo; + iPluginInfo.ResetAndDestroy(); + REComSession::ListImplementationsL( KINSTANTMSGINTERFACEUID,pluginInfo ); + TInt pluginCount = pluginInfo.Count(); + for ( TInt pluginIndex(0); pluginIndex < pluginCount; ++pluginIndex ) + { + TUid pluginUid = pluginInfo[pluginIndex]->ImplementationUid(); + // Creates the plugin and transfers ownership of the services + // object to the plugin. + CInstantMsgIndicator* plugin = NULL; + TRAPD(error, plugin = CInstantMsgIndicator::CreateImplementationL( pluginUid )); + + if(KErrNone != error) + { + // handle the error here. + // error loading the plugin + } + else + { + // plugin loaded sucessfully + //if its here its sure that plugin is not null; + //add the plugin to the array + CPluginInfo* newPlugin = new ( ELeave ) CCacheServerActiveHelper::CPluginInfo( plugin, pluginUid); + CleanupStack::PushL( newPlugin ); + iPluginInfo.AppendL( newPlugin ); + CleanupStack::Pop( newPlugin ); + + } + + } + pluginInfo.ResetAndDestroy(); + pluginInfo.Close(); + } + // ---------------------------------------------------------------------------- + // CCacheServerActiveHelper::CPluginInfo::CPluginInfo( + // C++ constructor + // (other items were commented in a header). + // ---------------------------------------------------------------------------- + // + CCacheServerActiveHelper::CPluginInfo::CPluginInfo( + CInstantMsgIndicator* aPlugin, + TUid aPluginUid ) + : iPlugin( aPlugin ), + iPluginUid( aPluginUid ) + { + + } + // ---------------------------------------------------------------------------- + // CCacheServerActiveHelper::CPluginInfo::~CPluginInfo( + // C++ destructor + // (other items were commented in a header). + // ---------------------------------------------------------------------------- + // + CCacheServerActiveHelper::CPluginInfo::~CPluginInfo() + { + delete iPlugin; + } + // ----------------------------------------------------------------------------- + // CCacheServerActiveHelper::LoadPluginL + // ----------------------------------------------------------------------------- + // + CInstantMsgIndicator& CCacheServerActiveHelper::CPluginInfo::Plugin() + { + return *iPlugin; + } +/// end of file diff -r 000000000000 -r e6b17d312c8b imservices/instantmessagingcache/imcacheserver/src/cimcachebufferarray.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/instantmessagingcache/imcacheserver/src/cimcachebufferarray.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,91 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: a message class implementation +* +*/ + + +#include "cimcachebufferarray.h" + //logs +#include "imcachedebugtrace.h" + + +//----------------------------------------------------------------------------- +// CIMCacheBufferArray::NewL +// ( Other items commented in header ) +//----------------------------------------------------------------------------- +CIMCacheBufferArray* CIMCacheBufferArray::NewL(const TDesC8& aPacketBuffer , TIMCacheOperationsCode aOperationCode ) + { + TRACE( T_LIT( "CIMCacheBufferArray::NewL begin") ); + CIMCacheBufferArray* self = new ( ELeave ) CIMCacheBufferArray( aOperationCode ); + CleanupStack::PushL( self ); + self->ConstructL( aPacketBuffer ); + CleanupStack::Pop( self ); + TRACE( T_LIT( "CIMCacheBufferArray::NewL end") ); + return self; + } +//----------------------------------------------------------------------------- +// CIMCacheBufferArray::CIMCacheBufferArray +// ( Other items commented in header ) +//----------------------------------------------------------------------------- +CIMCacheBufferArray::CIMCacheBufferArray( TIMCacheOperationsCode aOperationCode ) + :iOperationCode ( aOperationCode ) + { + TRACE( T_LIT( "CIMCacheBufferArray::CIMCacheBufferArray") ); + } + + +//----------------------------------------------------------------------------- +// CIMCacheBufferArray::ConstructL +// ( Other items commented in header ) +//----------------------------------------------------------------------------- +void CIMCacheBufferArray::ConstructL( const TDesC8& aPacketBuffer ) + { + TRACE( T_LIT( "CIMCacheBufferArray::NewL start") ); + iPacketBuffer = aPacketBuffer.AllocL(); + TRACE( T_LIT( "CIMCacheBufferArray::NewL end") ); + } + +//----------------------------------------------------------------------------- +// CIMCacheBufferArray::OperationCode +// ( Other items commented in header ) +//----------------------------------------------------------------------------- +TIMCacheOperationsCode CIMCacheBufferArray::OperationCode() + { + TRACE( T_LIT( "CIMCacheBufferArray::OperationCode") ); + return iOperationCode; + } + + //----------------------------------------------------------------------------- +// CIMCacheBufferArray::PacketData +// ( Other items commented in header ) +//----------------------------------------------------------------------------- +const TDesC8& CIMCacheBufferArray::PacketData() + { + TRACE( T_LIT( "CIMCacheBufferArray::PacketData") ); + return *iPacketBuffer; + } +//----------------------------------------------------------------------------- +// CIMCacheBufferArray::~CIMCacheBufferArray +// ( Other items commented in header ) +//----------------------------------------------------------------------------- +CIMCacheBufferArray::~CIMCacheBufferArray() + { + TRACE( T_LIT( "CIMCacheBufferArray::~CIMCacheBufferArray start") ); + delete iPacketBuffer; + TRACE( T_LIT( "CIMCacheBufferArray::~CIMCacheBufferArray end") ); + } + + +// end of file diff -r 000000000000 -r e6b17d312c8b imservices/instantmessagingcache/imcacheserver/src/cimcachemessagebase.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/instantmessagingcache/imcacheserver/src/cimcachemessagebase.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,172 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: a message class implementation +* +*/ + + +#include "cimcachemessagebase.h" + //logs +#include "imcachedebugtrace.h" + + +//----------------------------------------------------------------------------- +// CIMCacheMessageBase::NewL +// ( Other items commented in header ) +//----------------------------------------------------------------------------- +CIMCacheMessageBase* CIMCacheMessageBase::NewL( + const TDesC& aData ) + { + TRACE( T_LIT( "CIMCacheMessageBase::NewL begin") ); + CIMCacheMessageBase* self = new ( ELeave ) CIMCacheMessageBase(); + CleanupStack::PushL( self ); + self->ConstructL(aData ); + CleanupStack::Pop( self ); + TRACE( T_LIT( "CIMCacheMessageBase::NewL end") ); + return self; + } +//----------------------------------------------------------------------------- +// CIMCacheMessageBase::CIMCacheMessageBase +// ( Other items commented in header ) +//----------------------------------------------------------------------------- +CIMCacheMessageBase::CIMCacheMessageBase() + { + TRACE( T_LIT( "CIMCacheMessageBase::CIMCacheMessageBase") ); + } + + +//----------------------------------------------------------------------------- +// CIMCacheMessageBase::ConstructL +// ( Other items commented in header ) +//----------------------------------------------------------------------------- +void CIMCacheMessageBase::ConstructL(const TDesC& aData ) + { + TRACE( T_LIT( "CIMCacheMessageBase::NewL start") ); + iText = aData.AllocL(); + iMessagerType = EIMCMessageOther; + iTime.HomeTime(); + iMessageType = EIMCMessagePTOP; + iUnread = ETrue; + TRACE( T_LIT( "CIMCacheMessageBase::NewL end") ); + } + +//----------------------------------------------------------------------------- +// CIMCacheMessageBase::~CIMCacheMessageBase +// ( Other items commented in header ) +//----------------------------------------------------------------------------- +CIMCacheMessageBase::~CIMCacheMessageBase() + { + TRACE( T_LIT( "CIMCacheMessageBase::~CIMCacheMessageBase start") ); + delete iText; + TRACE( T_LIT( "CIMCacheMessageBase::~CIMCacheMessageBase end") ); + } + +//----------------------------------------------------------------------------- +// CIMCacheMessageBase::TimeStamp +// ( Other items commented in header ) +//----------------------------------------------------------------------------- +const TTime& CIMCacheMessageBase::TimeStamp() const + { + return iTime; + } + +//----------------------------------------------------------------------------- +// CIMCacheMessageBase::MessageType +// ( Other items commented in header ) +//----------------------------------------------------------------------------- +TIMCacheMessageType CIMCacheMessageBase::MessageType() const + { + return iMessageType; + } + +//----------------------------------------------------------------------------- +// CIMCacheMessageBase::MessagerType +// ( Other items commented in header ) +//----------------------------------------------------------------------------- +TIMCacheMessagerType CIMCacheMessageBase::MessagerType() const + { + return iMessagerType; + } + + +//----------------------------------------------------------------------------- +// CIMCacheMessageBase::Text +// ( Other items commented in header ) +//----------------------------------------------------------------------------- +const TDesC& CIMCacheMessageBase::Text() const + { + TRACE( T_LIT( "CIMCacheMessageBase::Text start") ); + if( iText ) + { + return *iText; + } + TRACE( T_LIT( "CIMCacheMessageBase::Text end") ); + return KNullDesC; + } + +//----------------------------------------------------------------------------- +// CIMCacheMessageBase::SetRead +// ( Other items commented in header ) +//----------------------------------------------------------------------------- +void CIMCacheMessageBase::SetRead() + { + TRACE( T_LIT( "CIMCacheMessageBase::SetUnread start") ); + iUnread = EFalse; + TRACE( T_LIT( "CIMCacheMessageBase::SetUnread end") ); + + } + +//----------------------------------------------------------------------------- +// CIMCacheMessageBase::IsUnread +// ( Other items commented in header ) +//----------------------------------------------------------------------------- +TBool CIMCacheMessageBase::IsUnread() const + { + TRACE( T_LIT( "CIMCacheMessageBase::IsUnread ") ); + return iUnread; + + } +// ----------------------------------------------------------------------------- +// CIMCacheMessageBase::SetMessageType +// ----------------------------------------------------------------------------- +// +void CIMCacheMessageBase::SetMessageType( TIMCacheMessageType aNewType ) + { + TRACE( T_LIT( "CIMCacheMessageBase::SetMessageType start") ); + iMessageType = aNewType; + TRACE( T_LIT( "CIMCacheMessageBase::SetMessageType end") ); + } + +// ----------------------------------------------------------------------------- +// CIMCacheMessageBase::SetMessagerType +// ----------------------------------------------------------------------------- +// +void CIMCacheMessageBase::SetMessagerType( TIMCacheMessagerType aNewType ) + { + TRACE( T_LIT( "CIMCacheMessageBase::SetMessagerType start") ); + iMessagerType = aNewType; + TRACE( T_LIT( "CIMCacheMessageBase::SetMessagerType end") ); + } + + //----------------------------------------------------------------------------- +// CIMCacheMessageBase::ContentType +// ( Other items commented in header ) +//----------------------------------------------------------------------------- +TIMCacheContentType CIMCacheMessageBase::ContentType() const + { + return EIMCContentText; + } + + +// end of file diff -r 000000000000 -r e6b17d312c8b imservices/instantmessagingcache/imcacheserver/src/cimcachemessageheader.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/instantmessagingcache/imcacheserver/src/cimcachemessageheader.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,199 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: implementation of header of all convesation +* +*/ + + +// Include Files + +#include "cimcachemessageheader.h" + +#include "cimcachemessagebase.h" + //logs +#include "imcachedebugtrace.h" + + +// CONSTRUCTION +// ----------------------------------------------------------------------------- +// CIMCacheMessageHeader::NewL +// Static constructor +// ----------------------------------------------------------------------------- +// +CIMCacheMessageHeader* CIMCacheMessageHeader::NewL(TInt aServiceId, const TDesC& aBuddyId ) + { + TRACE( T_LIT( "CIMCacheMessageHeader::NewL begin") ); + CIMCacheMessageHeader* self = new (ELeave) CIMCacheMessageHeader; + CleanupStack::PushL(self); + self->ConstructL( aServiceId, aBuddyId ); + CleanupStack::Pop(); + TRACE( T_LIT( "CIMCacheMessageHeader::NewL end") ); + return self; + } + + +// ----------------------------------------------------------------------------- +// CIMCacheMessageHeader::~CIMCacheMessageHeader +// Destructor (virtual by CBase) +// ----------------------------------------------------------------------------- +// +CIMCacheMessageHeader::~CIMCacheMessageHeader() + { + TRACE( T_LIT( "CIMCacheMessageHeader::~CIMCacheMessageHeader begin") ); + delete iBuddyId; + iMessageArray.ResetAndDestroy() ; // all messages + TRACE( T_LIT( "CIMCacheMessageHeader::~CIMCacheMessageHeader end") ); + } + +// ----------------------------------------------------------------------------- +// CIMCacheMessageHeader::ConstructL +// Second phase construct +// ----------------------------------------------------------------------------- +// +void CIMCacheMessageHeader::ConstructL(TInt aServiceId, const TDesC& aBuddyId ) + { + TRACE( T_LIT( "CIMCacheMessageHeader::ConstructL begin") ); + iServiceId = aServiceId; + iBuddyId = aBuddyId.AllocL(); + TRACE( T_LIT( "CIMCacheMessageHeader::ConstructL end") ); + } + +// ----------------------------------------------------------------------------- +// CIMCacheMessageHeader::CIMCacheMessageHeader +// Constructor +// ----------------------------------------------------------------------------- +// +CIMCacheMessageHeader::CIMCacheMessageHeader(): + iChatStarted( EFalse) + { + TRACE( T_LIT( "CIMCacheMessageHeader::CIMCacheMessageHeader") ); + } + + +// ----------------------------------------------------------------------------- +// CIMCacheMessageHeader::Recipient +// name of history data +// ----------------------------------------------------------------------------- +// +const TDesC& CIMCacheMessageHeader::BuddyId() const + { + TRACE( T_LIT( "CIMCacheMessageHeader::Recipient begin") ); + if( iBuddyId ) + { + return *iBuddyId; + } + TRACE( T_LIT( "CIMCacheMessageHeader::Recipient end") ); + return KNullDesC; + + } + +// ----------------------------------------------------------------------------- +// CIMCacheMessageHeader::ServiceId +// name of history data +// ----------------------------------------------------------------------------- +// + TInt CIMCacheMessageHeader::ServiceId() const + { + return iServiceId; + } + +// ----------------------------------------------------------------------------- +// CIMCacheMessageHeader::MessageCount +// name of history data +// ----------------------------------------------------------------------------- +// + TInt CIMCacheMessageHeader::MessageCount() const + { + return iMessageArray.Count(); + } +// ----------------------------------------------------------------------------- +// CIMCacheMessageHeader::GetMessage +// name of history data +// ----------------------------------------------------------------------------- +// + CIMCacheMessageBase* CIMCacheMessageHeader::GetMessage(TInt aIndex ) + { + return iMessageArray[aIndex]; + } + +// ----------------------------------------------------------------------------- +// CIMCacheMessageHeader::AppendMessageL +// name of history data +// ----------------------------------------------------------------------------- +// +void CIMCacheMessageHeader::AppendMessageL(CIMCacheMessageBase* aMessge) + { + TRACE( T_LIT( "CIMCacheMessageHeader::AppendMessageL begin") ); + + iMessageArray.AppendL( aMessge ); + + TRACE( T_LIT( "CIMCacheMessageHeader::AppendMessageL end") ); + } + +// ----------------------------------------------------------------------------- +// CIMCacheMessageHeader::UnreadMessageCount +// name of history data +// ----------------------------------------------------------------------------- +// +TInt CIMCacheMessageHeader::UnreadMessageCount() const + { + TRACE( T_LIT( "CIMCacheMessageHeader::UnreadMessageCount begin") ); + TInt ret = 0; + TInt msgcount = iMessageArray.Count(); + for(TInt i=0; iIsUnread() ) + { + ret++; + } + } + TRACE( T_LIT( "CIMCacheMessageHeader::UnreadMessageCount end") ); + return ret; + } + +// ----------------------------------------------------------------------------- +// CIMCacheMessageHeader::IsChatStarted +// name of history data +//----------------------------------------------------------------------------- +TBool CIMCacheMessageHeader::IsChatStarted() + { + return iChatStarted; + } + +// ----------------------------------------------------------------------------- +// CIMCacheMessageHeader::SetChatStarted +// name of history data +//----------------------------------------------------------------------------- +void CIMCacheMessageHeader::SetChatStarted(TBool aStarted ) + { + iChatStarted = aStarted; + } + + // ----------------------------------------------------------------------------- +// CIMCacheMessageHeader::MarkAllRead +// name of history data +//----------------------------------------------------------------------------- +void CIMCacheMessageHeader::MarkAllRead() + { + TInt unreadCount = UnreadMessageCount(); + TInt count = MessageCount(); + + for( TInt i = count-1; i >= count- unreadCount; i-- ) + { + iMessageArray[i]->SetRead(); + } + } + +// End of File diff -r 000000000000 -r e6b17d312c8b imservices/instantmessagingcache/imcacheserver/src/cimcacheserver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/instantmessagingcache/imcacheserver/src/cimcacheserver.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,288 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: instantmessagingcache server class implementation +* +*/ + +#define __INCLUDE_CAPABILITY_NAMES__ +#define __INCLUDE_ALL_SUPPORTED_CAPABILITIES__ + +// INCLUDE FILES +#include "cimcacheserver.h" + +#include "ccacheserveractivehelper.h" +#include "cimcachesession.h" +#include "mimcachemessageheader.h" +#include "timcachemessagefactory.h" +#include "cimcachemessageheader.h" +#include "cimcachemessagebase.h" +// logs +#include "imcachedebugtrace.h" //logs + +// ============================================================== +// =============== PLATSEC POLICY CONFIGURATION ================= +// ============================================================== + +static const TInt KIMCachePlatSecRangeCount = 2; + +//Ranges for the Request values +static const TInt KIMCachePlatSecRanges[ KIMCachePlatSecRangeCount ] = + { + 0, + EIMCacheOperationLast + }; + + +// Element indexes for the defined ranges +static const TUint8 KIMCachePlatSecElementsIndex[ KIMCachePlatSecRangeCount ] = + { + 0, + CPolicyServer::ENotSupported + }; + + +// Policy elements +static const CPolicyServer::TPolicyElement KIMCachePlatSecElements[] = + { + { + _INIT_SECURITY_POLICY_C2( ECapabilityReadUserData, + ECapabilityWriteUserData ), + -5 //CPolicyServer::EFailClient + } + }; + + +// The platsec policy +static const CPolicyServer::TPolicy KIMCachePlatSecPolicy = + { + // Shortcut to the index into Elements,that is used to check a connection attempt + 0, + + // Number of ranges in the iRanges array + KIMCachePlatSecRangeCount, + + // A pointer to an array of ordered ranges of request numbers + KIMCachePlatSecRanges, + + // A pointer to an array of TUint8 values specifying + // the appropriate action to take for each range in iRanges + KIMCachePlatSecElementsIndex, + + // A pointer to an array of distinct policy elements + KIMCachePlatSecElements + }; + + +// ============================================================== +// ======================= SERVER ============================== +// ============================================================== + +// ----------------------------------------------------------------------------- +// CIMCacheServer::ExecuteL +// ----------------------------------------------------------------------------- +// +void CIMCacheServer::ExecuteL() + { + TRACE( T_LIT( "CIMCacheServer::ExecuteL() begin") ); + // start scheduler + CActiveScheduler* pA = new( ELeave )CActiveScheduler; + CleanupStack::PushL( pA ); + CActiveScheduler::Install( pA ); + + + // create server + CIMCacheServer* server = new( ELeave ) CIMCacheServer(); + CleanupStack::PushL( server ); + server->InitializeL(*server); + server->StartL( KIMCacheServerName ); + + + //Signal client that we are started + RProcess().Rendezvous( KErrNone ); + + // Execute the server + // Codescanner warning: using CActiveScheduler::Start (id:3) + // this has to be called for server starting. + CActiveScheduler::Start(); // CSI: 3 # See above + + //Cleanup + CleanupStack::PopAndDestroy( server );//server + CleanupStack::PopAndDestroy( pA ); + CActiveScheduler::Install( NULL ); + TRACE( T_LIT( "CIMCacheServer::ExecuteL() end") ); + } + +// ----------------------------------------------------------------------------- +// CIMCacheServer::~CIMCacheServer +// ----------------------------------------------------------------------------- +// +CIMCacheServer::~CIMCacheServer() + { + TRACE( T_LIT( "CIMCacheServer::~CIMCacheServer() begin") ); + + iSessions.Close(); + + delete iActiveHelper; + + #if _BullseyeCoverage + cov_write(); + #endif + TRACE( T_LIT( "CIMCacheServer::~CIMCacheServer() end") ); + } + +// ----------------------------------------------------------------------------- +// CIMCacheServer::CIMCacheServer +// ----------------------------------------------------------------------------- +// + +CIMCacheServer::CIMCacheServer() + : CPolicyServer( CActive::EPriorityStandard, + KIMCachePlatSecPolicy ) + { + } + +// ----------------------------------------------------------------------------- +// CIMCacheServer::NewSessionL +// ----------------------------------------------------------------------------- +// +CSession2* CIMCacheServer::NewSessionL( const TVersion &aVersion, + const RMessage2& /*aMessage*/ ) const + { + TRACE( T_LIT( "CIMCacheServer::NewSessionL() begin") ); + TVersion srvVersion( KIMCacheVersionMajor, + KIMCacheVersionMinor, + KIMCacheVersionBuild ); + + if( !User::QueryVersionSupported( aVersion, srvVersion ) ) + { + User::Leave( KErrNotSupported ); + } + CIMCacheSession* session = CIMCacheSession::NewL(); + + TRACE( T_LIT( "CIMCacheServer::NewSessionL() end session[%d] created"), session ); + return session; + } + +// ----------------------------------------------------------------------------- +// CIMCacheServer::SessionCreatedL +// ----------------------------------------------------------------------------- +// +void CIMCacheServer::SessionCreatedL( CIMCacheSession* aSession ) + { + TRACE( T_LIT( "CIMCacheServer::SessionCreatedL begin aSession[%d]"),aSession ); + iSessionCount++; + TInt err = iSessions.Find( aSession ); + if(err == KErrNotFound ) + { + iSessions.AppendL( aSession ); + } + TRACE( T_LIT( "CIMCacheServer::SessionCreatedL() end") ); + } +// ----------------------------------------------------------------------------- +// CIMCacheServer::SessionDied +// ----------------------------------------------------------------------------- +// +void CIMCacheServer::SessionDied( CIMCacheSession* aSession ) + { + TRACE( T_LIT( "CIMCacheServer::SessionDied() begin") ); + TInt count = iSessions.Count(); + for( TInt i = 0; i < count; i++ ) + { + if( iSessions[i] == aSession ) + { + iSessions.Remove( i ); + break; + } + } + iSessionCount--; + if( iSessionCount == 0 ) + { + // Codescanner warning: using CActiveScheduler::Stop ( Id: 4) + // it is required to stop the server + CActiveScheduler::Stop(); // CSI: 4 # See above + } + TRACE( T_LIT( "CIMCacheServer::SessionDied() end") ); + } +// ----------------------------------------------------------------------------- +// CIMCacheManager::GetActiveHelper +// Pass pointer to toc array to client. +// ----------------------------------------------------------------------------- +// +CCacheServerActiveHelper* CIMCacheServer::GetActiveHelper() + { + return iActiveHelper; + } + +// ----------------------------------------------------------------------------- +// CIMCacheServer::InitializeL +// ----------------------------------------------------------------------------- +// +void CIMCacheServer::InitializeL(CIMCacheServer& aServer) + { + TRACE( T_LIT( "CIMCacheServer::InitializeL begin") ); + + iActiveHelper = CCacheServerActiveHelper::NewL( aServer ); + + TRACE( T_LIT( "CIMCacheServer::InitializeL end") ); + } + +// ----------------------------------------------------------------------------- +// CIMCacheServer::PackAndNotifyEventL +// ----------------------------------------------------------------------------- +// send notication to all if registration is valid + +void CIMCacheServer::PackAndNotifyEventL(TIMCacheOperationsCode aChangeType, + TInt aServiceId, + MIMCacheMessageHeader* aChatHeader /*=NULL*/, + CIMCacheMessageBase* aMessage /*=NULL*/ ) + { + TInt count = iSessions.Count(); + for(TInt i = 0; iServiceId() ) + { + // send changes to only those session which are has same service Id + iSessions[i]->PackAndNotifyEventL(aChangeType , aChatHeader, aMessage); + } + } + } + + +// ============================================================== +// ====================== ENTRY POINT =========================== +// ============================================================== +GLDEF_C TInt E32Main() + { + TRACE( T_LIT("E32Main - enter") ); + + User::RenameThread( KIMCacheServerName ); + + CTrapCleanup* tc = CTrapCleanup::New(); + if( !tc ) + { + return KErrNoMemory; + } + + TRAPD( err, CIMCacheServer::ExecuteL() ); + delete tc; + + TRACE( T_LIT("E32Main - exit: %d"), err ); + return err; + } + + + +// END OF FILE + + diff -r 000000000000 -r e6b17d312c8b imservices/instantmessagingcache/imcacheserver/src/cimcachesession.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/instantmessagingcache/imcacheserver/src/cimcachesession.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,911 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: cache session class implementation +* +*/ + + +// INCLUDE FILES +// local includes +#include "cimcachesession.h" + +#include "cimcacheserver.h" +#include "ccacheserveractivehelper.h" +#include "cimcachemessagebase.h" +#include "mimcachemessageheader.h" +// logs +#include "imcachedebugtrace.h" +#include "cimcachebufferarray.h" + +// ============================================================== +// ======================== SESSION ============================= +// ============================================================== + +// --------------------------------------------------------- +// CIMCacheSession::NewL +// Two-phased constructor. +// --------------------------------------------------------- +// +CIMCacheSession* CIMCacheSession::NewL() + { + TRACE( T_LIT("CIMCacheSession::NewL begin") ); + CIMCacheSession* self = new( ELeave ) CIMCacheSession( ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + TRACE( T_LIT("CIMCacheSession::NewL end") ); + return self; + } + +// --------------------------------------------------------- +// CIMCacheSession::NewL +// Symbian OS default constructor can leave. +// --------------------------------------------------------- +// +void CIMCacheSession::ConstructL() + { + //This T-class is heap-allocated only because we do not want to + //include T-class header in header file of imcachesession. + } + +// --------------------------------------------------------- +// CIMCacheSession::NewL +// destructor +// --------------------------------------------------------- +// +CIMCacheSession::~CIMCacheSession() + { + TRACE( T_LIT("CIMCacheSession[%d]::~CIMCacheSession() start"), this ); + if(iObserverActive) + { + iObserverMessage.Complete( KErrCancel ); + iObserverActive = EFalse; + } + if( Server() ) + { + Server()->SessionDied( this ); + } + iPacketsArray.ResetAndDestroy(); + + ResetHeaderInoformation(); + + TRACE( T_LIT("CIMCacheSession::~CIMCacheSession() end ")); + } + + +// --------------------------------------------------------- +// CIMCacheSession::NewL +// C++ default constructor can NOT contain any code, that +// might leave. +// --------------------------------------------------------- +// +CIMCacheSession::CIMCacheSession(): +iOpenChatFetchCompleted( EFalse ) + { + TRACE( T_LIT("CIMCacheSession::CIMCacheSession")); + } + + +// --------------------------------------------------------- +// CIMCacheSession::CreateL +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CIMCacheSession::CreateL() + { + TRACE( T_LIT("CIMCacheSession[%d]::CreateL()"), this ); + Server()->SessionCreatedL( this ); + TRACE( T_LIT( "CIMCacheSession::CreateL end") ); + } + +// --------------------------------------------------------- +// CIMCacheSession::ServiceL +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CIMCacheSession::ServiceL( const RMessage2 &aMessage ) + { + TRACE( T_LIT("CIMCacheSession::ServiceL , begin")); + if( DispatchMessageL( aMessage ) ) + { + TRACE( T_LIT("CIMCacheSession::ServiceL inside DispatchMessageL")); + if( !iMessageCompleted ) + { + TRACE( T_LIT("CIMCacheSession::ServiceL inside !iMessageCompleted")); + aMessage.Complete( KErrNone ); + } + } + TRACE( T_LIT("CIMCacheSession::ServiceL , end")); + } + +// --------------------------------------------------------- +// CIMCacheSession::ServiceError +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CIMCacheSession::ServiceError( const RMessage2& aMessage, + TInt aError ) + { + TRACE( T_LIT("CIMCacheSession::ServiceError , begin")); + aMessage.Complete( aError ); + TRACE( T_LIT("CIMCacheSession::ServiceError , end")); + } + + +// --------------------------------------------------------- +// CIMCacheSession::DispatchMessageL +// (other items were commented in a header). +// --------------------------------------------------------- +// +TBool CIMCacheSession::DispatchMessageL( const RMessage2& aMessage ) + { + TRACE( T_LIT("CIMCacheSession[%d]::DispatchMessageL() %d"), this, aMessage.Function() ); + + iMessageCompleted = EFalse; + TBool msgNeedsToBeCompleted = ETrue; + + switch( aMessage.Function() ) + { + // initialization operations + case EIMCacheInitUpdate : + { + TRACE( T_LIT("CIMCacheSession::DispatchMessageL EIMCacheInitUpdate") ); + InitSessionL( aMessage ); + break; + } + // initialization operations + case EIMCacheInitAccess : + { + TRACE( T_LIT("CIMCacheSession::DispatchMessageL EIMCacheInitAccess") ); + InitSessionL( aMessage ); + iAccessorInitialized = ETrue; + break; + } + // initialization operations + case EIMCacheInitConvesation : + { + TRACE( T_LIT("CIMCacheSession::DispatchMessageL EIMCacheInitAccess") ); + InitSessionL( aMessage ); + iConvesationInitialized = ETrue; + break; + } + // update right operations + case EIMCacheStartNewConversation : + { + TRACE( T_LIT("CIMCacheSession::DispatchMessageL EIMCacheStartNewConversation excuted") ); + iHelper->StartNewConversationL(aMessage); + break; + } + case EIMCacheAppendSendMessage : + { + TRACE( T_LIT("CIMCacheSession::DispatchMessageL EIMCacheAppendSendMessage excuted") ); + iHelper->AppendSendMessageL(aMessage); + break; + } + case EIMCacheAppendMessage : + { + TRACE( T_LIT("CIMCacheSession::DispatchMessageL EIMCacheAppendMessage excuted") ); + iHelper->AppendMessageL(aMessage); + break; + } + case EIMCacheAppendReceiveMessage: + { + TRACE( T_LIT("CIMCacheSession::DispatchMessageL EIMCacheAppendReceiveMessage excuted") ); + iHelper->AppendReceiveMessageL(aMessage); + break; + } + case EIMCacheCloseConversation : + { + TRACE( T_LIT("CIMCacheSession::DispatchMessageL EIMCacheCloseConversation excuted") ); + iHelper->CloseConversationL(aMessage); + break; + } + case EIMCacheCloseAllConversation : + { + TRACE( T_LIT("CIMCacheSession::DispatchMessageL EIMCacheCloseAllConversation excuted") ); + iHelper->CloseAllConversationL(iServiceId); + break; + } + case EIMCacheDeactivateConversation: + { + TRACE( T_LIT("CIMCacheSession::DispatchMessageL EIMCacheDeactivateConversation excuted") ); + iHelper->DeactivateConversationL(); + + break; + } + + case EIMCacheObserveMessageUpdateRegister: + { + TRACE( T_LIT("CIMCacheSession::DispatchMessageL EIMCacheObserveMessageUpdateRegister excuted") ); + if( iObserverActive ) + { + TRACE( T_LIT("CIMCacheSession::DispatchMessageL observer already active") ); + // complete the old observer request with KErrCancel + iObserverMessage.Complete( KErrAlreadyExists ); + } + iObserverMessage = aMessage; + iObserverActive = ETrue; + msgNeedsToBeCompleted = EFalse; + // check fetching still needed or not if needed pack and send again + if( iPacketsArray.Count() ) + { + CIMCacheBufferArray* packet = iPacketsArray[ 0 ] ; + iObserverMessage.Complete( packet->OperationCode() ); + iObserverActive = EFalse; + } + + break; + } + case EIMCacheObserveMessageUpdateUnRegister : + { + TRACE( T_LIT("CIMCacheSession::DispatchMessageL EIMCacheObserveMessageUpdateUnRegister excuted") ); + if( !iObserverActive ) + { + TRACE( T_LIT("CIMCacheSession::DispatchMessageL observer not active ") ); + } + else + { + TRACE( T_LIT("CIMCacheSession::DispatchMessageL observer active ") ); + iObserverMessage.Complete( EIMOperationUnRegistered ); + iObserverActive = EFalse; + } + + break; + } + case EIMCacheObserveMessageAccessRegister: + { + TRACE( T_LIT("CIMCacheSession::DispatchMessageL EIMCacheObserveMessageAccessRegister excuted") ); + if( iObserverActive ) + { + TRACE( T_LIT("CIMCacheSession::DispatchMessageL observer already active") ); + // complete the old observer request with KErrCancel + iObserverMessage.Complete( KErrAlreadyExists ); + } + iObserverMessage = aMessage; + iObserverActive = ETrue; + msgNeedsToBeCompleted = EFalse; + if( iPacketsArray.Count() ) + { + CIMCacheBufferArray* packet = iPacketsArray[ 0 ] ; + iObserverMessage.Complete( packet->OperationCode() ); + iObserverActive = EFalse; + } + break; + } + case EIMCacheObserveMessageAccessUnRegister : + { + TRACE( T_LIT("CIMCacheSession::DispatchMessageL EIMCacheObserveMessageAccessUnRegister excuted") ); + if( !iObserverActive ) + { + TRACE( T_LIT("CIMCacheSession::DispatchMessageL observer not active ") ); + } + else + { + TRACE( T_LIT("CIMCacheSession::DispatchMessageL observer active ") ); + iObserverMessage.Complete( EIMOperationUnRegistered ); + iObserverActive = EFalse; + } + + break; + } + + case EIMCacheGetUnreadCount: + { + iHelper->GetUnreadMessageCountL(aMessage); + break; + } + case EIMCacheGetAllUnreadCount: + { + iHelper->GetAllUnreadMessageCountL(aMessage); + break; + } + // check for conversation + case EIMCacheIsConversationExist : + { + TRACE( T_LIT("CIMCacheSession::DispatchMessageL EIMCacheIsConversationExist excuted ") ); + iHelper->CheckConversationExistL(aMessage); + break; + } + // Get what change happen + case EIMCacheGetBufferedPackets: + { + TRACE( T_LIT("CIMCacheSession::DispatchMessageL EIMCacheGetBufferedPackets excuted") ); + if( iPacketsArray.Count() ) + { + CIMCacheBufferArray* packet = iPacketsArray[ 0 ] ; + aMessage.WriteL(0, packet->PacketData() ); + iPacketsArray.Remove(0); + delete packet; + packet = NULL; + iPacketsArray.Compress(); + } + break; + } + + case EIMCacheGetChatList: + { + TRACE( T_LIT("CIMCacheSession::DispatchMessageL EIMCacheGetChatList executed") ); + //0 serviceId + //1 buffer + TInt serviceId = aMessage.Int0(); + + ExternalizeChatItemL( EIMOperationFetchAll , serviceId ); + + //aMessage.WriteL( 1, *iChatDataBuffer); + TInt packetsCounts = iPacketsArray.Count(); + + if( packetsCounts ) + { + CIMCacheBufferArray* packet = iPacketsArray[ 0 ] ; + aMessage.WriteL( 1, packet->PacketData() ); + iPacketsArray.Remove(0); + delete packet; + packet = NULL; + iPacketsArray.Compress(); + } + break; + } + case EIMCacheCancelRequest: + { + TRACE( T_LIT("CIMCacheSession::EIMCacheCancelRequest start")); + if(iObserverActive) + { + TRACE( T_LIT("CIMCacheSession::EIMCacheCancelRequest Inside if")); + iObserverMessage.Complete( KErrCancel ); + TRACE( T_LIT("CIMCacheSession::EIMCacheCancelRequest After iObserverMessage.Complete")); + iObserverActive = EFalse; + } + TRACE( T_LIT("CIMCacheSession::EIMCacheCancelRequest End")); + + + break; + } + default: + { + TRACE( T_LIT("CIMCacheSession::DispatchMessageL default excuted") ); + User::Leave( KErrNotSupported ); + break; + } + } + TRACE( T_LIT("CIMCacheSession::DispatchMessageL end")); + return msgNeedsToBeCompleted; + + } + //======================================================================= +//==========================initialization ================================== +//======================================================================== + +// --------------------------------------------------------- +// CIMCacheSession::InitSessionL +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CIMCacheSession::InitSessionL(const RMessage2& aMessage ) + { + TRACE( T_LIT("CIMCacheSession::InitSessionL:start") ); + // at zero place service id was appended + iServiceId = aMessage.Int0(); + if( Server() ) + { + iHelper = Server()->GetActiveHelper(); + } + TRACE( T_LIT("CIMCacheSession::InitSessionL end") ); + } + + +// --------------------------------------------------------- +// CIMCacheSession::InitSessionL +// (other items were commented in a header). +// --------------------------------------------------------- +// +TInt CIMCacheSession::ServiceId() const + { + TRACE( T_LIT("CIMCacheSession::ServiceId:start") ); + TRACE( T_LIT("CIMCacheSession::ServiceId end") ); + return iServiceId; + } +// --------------------------------------------------------------------------- +// CIMCacheSession::ResetHeaderInoformation() +// --------------------------------------------------------------------------- +// +void CIMCacheSession::ResetHeaderInoformation() + + { + TRACE( T_LIT( "CIMCacheSession::ResetHeaderInoformation begin") ); + if( iConvesationInitialized ) + { + iHelper->ResetHeaderInoformation(); + } + TRACE( T_LIT( "CIMCacheSession::ResetHeaderInoformation end") ); + } + + +// --------------------------------------------------------- +// CIMCacheSession::PackAndNotifyEventL +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CIMCacheSession::PackAndNotifyEventL(TIMCacheOperationsCode aChangeType , + MIMCacheMessageHeader* aChatHeader /*=NULL*/, + CIMCacheMessageBase* aMessage /*=NULL*/ ) + + { + TRACE( T_LIT( "CIMCacheSession::PackAndNotifyEventL() begin") ); + + switch( aChangeType ) + { + case EIMOperationFetchAll : + { + SendChatListDataL(aChangeType, aChatHeader); + break; + } + case EIMOperationUnreadChange : + { + if( iObserverActive && iConvesationInitialized ) + { + iObserverMessage.Complete( aChangeType ); + iObserverActive = EFalse; + } + else if( iObserverActive && iAccessorInitialized ) + { + ExternalizeSingleChatItemL(aChangeType, aChatHeader ); + iObserverMessage.Complete( aChangeType ); + iObserverActive = EFalse; + } + break; + } + case EIMOperationUnreadMessage : + { + SendUnreadChangeNotificationL( aChatHeader, aMessage ); + break; + } + case EIMOperationChatStarted : + { + if( iObserverActive && iConvesationInitialized ) + { + iObserverMessage.Complete( aChangeType ); + iObserverActive = EFalse; + } + else if( iObserverActive && iAccessorInitialized ) + { + ExternalizeSingleChatItemL(aChangeType, aChatHeader ); + iObserverMessage.Complete( aChangeType ); + iObserverActive = EFalse; + } + break; + } + case EIMOperationChatAdded : + { + if( iConvesationInitialized ) + { + ExternalizeSingleChatItemL(aChangeType, aChatHeader); + if( iObserverActive ) + { + iObserverMessage.Complete( aChangeType ); + iObserverActive = EFalse; + } + } + else if( iAccessorInitialized ) + { + SendUnreadChangeNotificationL(aChatHeader, aMessage ); + } + break; + } + case EIMOperationMessageAdded : + { + if( iConvesationInitialized ) + { + ExternalizeSingleChatDataL(aChangeType, aChatHeader , aMessage ); + if( iObserverActive ) + { + iObserverMessage.Complete( aChangeType ); + iObserverActive = EFalse; + } + } + break; + } + case EIMOperationChatDeleted : + { + if( ( iConvesationInitialized || iAccessorInitialized ) && iObserverActive ) + { + ExternalizeSingleChatItemL(aChangeType, aChatHeader ); + } + if( iObserverActive ) + { + iObserverMessage.Complete( aChangeType ); + iObserverActive = EFalse; + } + break; + } + case EIMOperationAllChatDeleted: + { + if( ( iConvesationInitialized || iAccessorInitialized ) && iObserverActive ) + { + iObserverMessage.Complete( aChangeType ); + iObserverActive = EFalse; + } + break; + } + case EIMOperationCompleted : + { + if( iObserverActive && iConvesationInitialized ) + { + iObserverMessage.Complete( aChangeType ); + iObserverActive = EFalse; + } + break; + } + + } + + } +// --------------------------------------------------------- +// CIMCacheSession::SendUnreadChangeNotificationL +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CIMCacheSession::SendUnreadChangeNotificationL( MIMCacheMessageHeader* aMsgHeader, + CIMCacheMessageBase* aMessage ) + { + // write the message into continuous memory stream + if( iAccessorInitialized || + iConvesationInitialized && aMsgHeader->IsChatStarted() ) + { + ExternalizeSingleChatDataL(EIMOperationUnreadMessage, aMsgHeader, aMessage ); + if( iObserverActive ) + { + iObserverMessage.Complete( EIMOperationUnreadMessage ); + iObserverActive = EFalse; + } + } + + TRACE( T_LIT( "CIMCacheSession::SendUnreadChangeNotificationL() end") ); + } + +// --------------------------------------------------------- +// CIMCacheSession::SendChatListDataL +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CIMCacheSession::SendChatListDataL( TIMCacheOperationsCode aChangeType , + MIMCacheMessageHeader* aMsgHeader ) + + { + + TRACE( T_LIT( "CIMCacheSession::SendChatListChangeNotificationL() begin") ); + + // write the message into continuous memory stream + if( iConvesationInitialized ) + { + ExternalizeChatDataL(aChangeType, aMsgHeader ); + if( iObserverActive ) + { + iObserverMessage.Complete( EIMOperationDataAvailable ); + iObserverActive = EFalse; + } + } + else if( iObserverActive && iAccessorInitialized ) + { + iObserverMessage.Complete( EIMOperationUnreadChange ); + iObserverActive = EFalse; + } + + TRACE( T_LIT( "CIMCacheSession::SendChatListChangeNotificationL() end") ); + + } + +// --------------------------------------------------------- +// CIMCacheSession::ExternalizeSingleChatItemL +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CIMCacheSession::ExternalizeSingleChatItemL( TIMCacheOperationsCode aChangeType, MIMCacheMessageHeader* aMsgHeader ) + { + + TRACE( T_LIT( "CIMCacheSession::ExternalizeSingleChatItemL() Start") ); + + RPointerArray bufferedHeaderArray; + bufferedHeaderArray.Reset(); + + + TInt availableSize = KMaxSize - 2*sizeof(TInt);//messageCount + more. + TRACE( T_LIT( "CIMCacheSession::ExternalizeSingleChatItemL() availableSize ---- %d"),availableSize ); + + TBool more = EFalse; + + if( aMsgHeader != NULL ) + { + TRACE( T_LIT( "CIMCacheSession::ExternalizeSingleChatItemL() inside if aMsgHeader") ); + TInt dataSize = sizeof( TInt )+ //for service id. + sizeof( TInt )+ aMsgHeader->BuddyId().Size() ; // for buddyId length and buddyId. + + availableSize = availableSize - dataSize - sizeof( dataSize ); + TRACE( T_LIT( "CIMCacheSession::ExternalizeSingleChatItemL() inside if aMsgHeader availableSize --- %d"), availableSize ); + + if( availableSize > 0 ) + { + HBufC8* tempBuf = GetPackedChatItemBufferL( aMsgHeader , dataSize ); + bufferedHeaderArray.AppendL( tempBuf ); + } + } + + ExternalizeBufferedDataL(aChangeType, bufferedHeaderArray , KMaxSize , more ); + TRACE( T_LIT( "CIMCacheSession::ExternalizeSingleChatItemL() after ExternalizeBufferedDataL") ); + bufferedHeaderArray.ResetAndDestroy(); // delete all buffered contacts. + TRACE( T_LIT( "CIMCacheSession::ExternalizeSingleChatItemL() after bufferedHeaderArray.resetanddestroy") ); + TRACE( T_LIT( "CIMCacheSession::ExternalizeSingleChatItemL() Start") ); + } +// --------------------------------------------------------- +// CIMCacheSession::ExternalizeChatItemL +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CIMCacheSession::ExternalizeChatItemL( TIMCacheOperationsCode aChangeType, + TInt aServiceId /*= KErrNotFound*/ ) + { + + TRACE( T_LIT( "CIMCacheSession::ExternalizeL() begin") ); + + TInt availableSize = KMaxSize - 2*sizeof(TInt); + + RPointerArray bufferedHeaderArray; + + TBool more = EFalse; + TInt i = 0; + if( aChangeType == EIMOperationFetchAll ) + { + RPointerArray tempHeaderArray; + iHelper->GetServiceChatHeaderArrayL( aServiceId , tempHeaderArray ); + + TInt chatCount = tempHeaderArray.Count(); + + for( i=0; i < chatCount; i++ ) + { + MIMCacheMessageHeader* chatHeader = tempHeaderArray[ i ]; + + TInt dataSize = sizeof( TInt )+ //for service id. + sizeof( TInt )+ chatHeader->BuddyId().Size() ; // for buddyId length and buddyId. + + availableSize = availableSize - dataSize - sizeof( dataSize ); + + if( availableSize > 0 ) + { + HBufC8* tempBuf = GetPackedChatItemBufferL( chatHeader , dataSize ); + bufferedHeaderArray.AppendL( tempBuf ); + } + else + { + more = ETrue; + ExternalizeBufferedDataL(aChangeType, bufferedHeaderArray , KMaxSize , more ); + bufferedHeaderArray.ResetAndDestroy(); // delete all buffered contacts. + availableSize = KMaxSize - 2*sizeof(TInt); + //preserve information for next trial. + } + } + if( i == chatCount ) + { + more = EFalse; + ExternalizeBufferedDataL(aChangeType, bufferedHeaderArray , KMaxSize , more ); + } + } + + bufferedHeaderArray.ResetAndDestroy(); // delete all buffered contacts. + + TRACE( T_LIT( "CIMCacheSession::ExternalizeL() end") ); + } +// --------------------------------------------------------- +// CIMCacheSession::ExternalizeBufferedDataL +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CIMCacheSession::ExternalizeBufferedDataL(TIMCacheOperationsCode aOperationCode, + RPointerArray& aArray , + TInt aTotalSize , + TBool aMore /*= EFalse*/) + { + TRACE( T_LIT( "CIMCacheSession::ExternalizeBufferedDataL() begin") ); + TInt appendedMsgCount = aArray.Count(); + CBufFlat* flatBuf = CBufFlat::NewL(aTotalSize);//( aTotalSize + ( sizeof(TInt) * appendedMsgCount ) + sizeof(TInt) ); + CleanupStack::PushL( flatBuf ); + RBufWriteStream writeAllStream ; + CleanupClosePushL( writeAllStream ); + + writeAllStream.Open( *flatBuf ); + writeAllStream.WriteInt16L( appendedMsgCount ); + + for(TInt i = 0; i< appendedMsgCount ; i++ ) + { + HBufC8* buf = aArray[i]; + writeAllStream.WriteInt16L(buf->Length()); + writeAllStream.WriteL(*buf); + } + + writeAllStream.WriteInt16L( aMore );//write more information at end. + + writeAllStream.CommitL(); + + CIMCacheBufferArray* packet = CIMCacheBufferArray::NewL( flatBuf->Ptr(0) , aOperationCode ); + iPacketsArray.Append(packet); // ownership to array + + CleanupStack::PopAndDestroy(); // writeAllStream + CleanupStack::PopAndDestroy(); // flatBuf + + TRACE( T_LIT( "CIMCacheSession::ExternalizeBufferedDataL() end") ); + + } + +// --------------------------------------------------------- +// CIMCacheSession::ExternalizeSingleChatDataL +// (other items were commented in a header). +// --------------------------------------------------------- +void CIMCacheSession::ExternalizeSingleChatDataL(TIMCacheOperationsCode aChangeType, MIMCacheMessageHeader* aChatHeader, CIMCacheMessageBase* aMessage ) + { + + TInt availableSize = KMaxSize - 2*sizeof(TInt);//messageCount + more. + + TBool more = EFalse; + + if( aMessage && aChatHeader ) + { + if( aChangeType == EIMOperationMessageAdded ) + { + aMessage->SetRead() ; + } + RPointerArray bufferedChatArray; + + TInt dataSize = sizeof( aMessage->MessageType() )+ + sizeof( aMessage->MessagerType() )+ + sizeof( aMessage->ContentType() )+ + sizeof( aMessage->TimeStamp().Int64() )+ + sizeof( TInt )+ aChatHeader->BuddyId().Size() + // for buddy length and buddy name + sizeof( TInt )+ aMessage->Text().Size() ; // for message length and message + + availableSize = availableSize - dataSize - sizeof( dataSize ); + if( availableSize > 0 ) + { + HBufC8* messageBuffer = GetPackedChatDataBufferL( aMessage , aChatHeader , dataSize ); + bufferedChatArray.AppendL( messageBuffer ); + } + + ExternalizeBufferedDataL(aChangeType, bufferedChatArray , KMaxSize , more ); + bufferedChatArray.ResetAndDestroy(); + } + } + +// --------------------------------------------------------- +// CIMCacheSession::ExternalizeChatDataL +// (other items were commented in a header). +// --------------------------------------------------------- +void CIMCacheSession::ExternalizeChatDataL(TIMCacheOperationsCode aChangeType ,MIMCacheMessageHeader* aChatHeader ) + { + RPointerArray bufferedChatArray; + bufferedChatArray.Reset(); + + TInt availableSize = KMaxSize - 2*sizeof(TInt);//messageCount + more. + + TBool more = EFalse; + + if( aChangeType == EIMOperationFetchAll && aChatHeader ) + { + TInt messageCount = aChatHeader->MessageCount(); + + TInt index = 0; + for( index = 0 ; index < messageCount ; index++ ) + { + CIMCacheMessageBase* message = aChatHeader->GetMessage(index); + TInt dataSize = sizeof( message->MessageType() )+ + sizeof( message->MessagerType() )+ + sizeof( message->ContentType() )+ + sizeof( message->TimeStamp().Int64() )+ + sizeof( TInt )+ aChatHeader->BuddyId().Size() + // for buddy length and buddy name + sizeof( TInt )+ message->Text().Size() ; // for message length and message + + availableSize = availableSize - dataSize - sizeof( dataSize ); + if( availableSize > 0 ) + { + // mark message read + message->SetRead(); + HBufC8* messageBuffer = GetPackedChatDataBufferL( message , aChatHeader , dataSize ); + bufferedChatArray.AppendL( messageBuffer ); + } + else + { + //else set information for more and message nest to last sent message i.e index + more = ETrue; + ExternalizeBufferedDataL(aChangeType, bufferedChatArray , KMaxSize , more ); + bufferedChatArray.ResetAndDestroy(); + availableSize = KMaxSize - 2*sizeof(TInt); //messageCount + more. + index--; + } + } + if( index == messageCount ) + { + more = EFalse; + ExternalizeBufferedDataL(aChangeType, bufferedChatArray , KMaxSize , more ); + } + } + bufferedChatArray.ResetAndDestroy(); + } +// --------------------------------------------------------- +// CIMCacheSession::GetPackedChatDataBufferL +// (other items were commented in a header). +// --------------------------------------------------------- +HBufC8* CIMCacheSession::GetPackedChatDataBufferL(CIMCacheMessageBase* aMsg , MIMCacheMessageHeader* aActiveHeader , const TInt aSize) + { + TRACE( T_LIT( "CIMCacheSession::GetPackedChatDataBufferL() begin") ); + + + CBufFlat* flatBuf = CBufFlat::NewL( aSize ); + CleanupStack::PushL( flatBuf ); + + RBufWriteStream writeStream ; + CleanupClosePushL( writeStream ); + + writeStream.Open( *flatBuf ); + + writeStream.WriteInt16L( aMsg->MessageType() ); + writeStream.WriteInt16L( aMsg->MessagerType() ); + writeStream.WriteInt16L( aMsg->ContentType() ); + writeStream.WriteReal64L( aMsg->TimeStamp().Int64() ); + writeStream.WriteInt16L( aActiveHeader->BuddyId().Length() ); + writeStream.WriteL( aActiveHeader->BuddyId() ); + writeStream.WriteInt16L( aMsg->Text().Length() ); + writeStream.WriteL( aMsg->Text() ); + + writeStream.CommitL(); + + HBufC8* tempBuffer = flatBuf->Ptr(0).AllocL(); + + CleanupStack::PopAndDestroy(); // flatBuf + CleanupStack::PopAndDestroy(); // writeStream + + TRACE( T_LIT( "CIMCacheSession::GetPackedChatDataBufferL() end") ); + return tempBuffer; + } + +// --------------------------------------------------------- +// CIMCacheSession::GetPackedChatItemBufferL +// (other items were commented in a header). +// --------------------------------------------------------- +// +HBufC8* CIMCacheSession::GetPackedChatItemBufferL(MIMCacheMessageHeader* aChatHeader, TInt& aSize) + { + TRACE( T_LIT( "CIMCacheSession::GetPackedChatItemBufferL() end") ); + + TInt serviceId = aChatHeader->ServiceId(); + const TDesC& buddyId = aChatHeader->BuddyId(); + + CBufFlat* flatBuf = CBufFlat::NewL( aSize ); + CleanupStack::PushL( flatBuf ); + + RBufWriteStream writeStream ; + CleanupClosePushL( writeStream ); + writeStream.Open( *flatBuf ); + + writeStream.WriteInt16L( serviceId ); + writeStream.WriteInt16L( buddyId.Length() ); + writeStream.WriteL( buddyId ); + writeStream.CommitL(); + + HBufC8* chatHeaderBuffer = flatBuf->Ptr(0).AllocL(); + + CleanupStack::PopAndDestroy(2); // writeAllStream,flatBuf + + TRACE( T_LIT( "CIMCacheSession::GetPackedChatItemBufferL() end") ); + + return chatHeaderBuffer; + } + + +// end of file diff -r 000000000000 -r e6b17d312c8b imservices/instantmessagingcache/imcacheserver/src/timcachemessagefactory.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/instantmessagingcache/imcacheserver/src/timcachemessagefactory.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,84 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: factory helper class implementation +* +*/ + + +// INCLUDE FILES + +#include "timcachemessagefactory.h" +#include "cimcachemessageheader.h" +#include "cimcachemessagebase.h" + //logs +#include "imcachedebugtrace.h" + + +// ================= MEMBER FUNCTIONS ======================= + +// ----------------------------------------------------------------------------- +// TIMCacheMessageFactory::CreateIMCacheMessageHeaderL +// Create instantmessagingcache message header +// ----------------------------------------------------------------------------- +// +MIMCacheMessageHeader* TIMCacheMessageFactory::CreateIMCacheMessageHeaderL(TInt aServiceId, const TDesC& aBuddyId ) + { + TRACE( T_LIT( "TIMCacheMessageFactory::CreateIMCacheMessageHeaderL") ); + return CIMCacheMessageHeader::NewL( aServiceId, aBuddyId ); + } + + +// ----------------------------------------------------------------------------- +// TIMCacheMessageFactory::CreateCacheMessageL +// Create instantmessagingcache message header +// ----------------------------------------------------------------------------- +// +CIMCacheMessageBase* TIMCacheMessageFactory::CreateCacheMessageL( + const TDesC& aData ) + { + TRACE( T_LIT( "TIMCacheMessageFactory::CreateCacheMessageL") ); + return CIMCacheMessageBase::NewL(aData) ; + } + + // ----------------------------------------------------------------------------- +// TIMCacheMessageFactory::FindHeaderIndexL +// Create instantmessagingcache message header +// ----------------------------------------------------------------------------- +// +TInt TIMCacheMessageFactory::FindHeaderIndexL(RPointerArray& aArray, + TInt aServiceId, + const TDesC& aBuddyId ) + { + TRACE( T_LIT( "TIMCacheMessageFactory::FindHeaderIndexL begin") ); + TInt count = aArray.Count(); + TRACE( T_LIT( "TIMCacheMessageFactory::FindHeaderIndexL count = %d"),count ); + + for(TInt index = 0; index ServiceId() ) && ( aBuddyId.CompareC( header->BuddyId() ) == 0 ) ) + { + return index; + } + } + } + + TRACE( T_LIT( "TIMCacheMessageFactory::FindHeaderIndexL end") ); + return KErrNotFound; + } + +// end of file + diff -r 000000000000 -r e6b17d312c8b imservices/instantmessagingcache/inc/imcachedebugtrace.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/instantmessagingcache/inc/imcachedebugtrace.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,126 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: logs generation file +* +*/ + + + +#ifndef __IMCACHEDEBUGTRACE_H__ +#define __IMCACHEDEBUGTRACE_H__ + +// INCLUDES +#include "e32std.h" +#include +// DEFINES +// enable logs printing +// into c:\\logs\\instantmessagingcache\\instantmessagingcache.txt +//#define IMCHACHE_ENABLE_DEBUG_LOGS +#undef IMCHACHE_ENABLE_DEBUG_LOGS + +/** +* Usage of Log MACRO'S +* _LIT( KExample, "Example" ); +* TXT(s) _L(s) +* IM_CV_LOGS(TXT("Some text.") ); +* IM_CV_LOGS(TXT("Some text: %d"), 100 ); +* IM_CV_LOGS(TXT("Some text: %S"), &KExample ); +*/ + +_LIT( KTAdaptDebugOutputDir, "imcache" ); +_LIT( KTAdaptDebugOutputFileName, "imcache.txt" ); +const TInt KTAdaptMaxLogLineLength = 250 ; +#define T_LIT(s) _L(s) +#define TRACE TIMChacheLogger::WriteLog +#define PLUGIN_UNUSED_PARAM(p) (void) p + + +/** + * IM cache debug logger. + */ +class TIMChacheLogger + { + public: //Logging functions + /** + * WriteLog, write the message into c:\\logs\\instantmessagingcache\\instantmessagingcache.txt + * need to create imcv folder into c:\\logs + * @param aFmt, list of messges to print + */ + static void WriteLog( TRefByValue aFmt,... ); + + private: //Prohibited + /** + * construtor + */ + TIMChacheLogger(); + /** + * destructor + */ + ~TIMChacheLogger(); + }; + +#endif // __IMCACHEDEBUGTRACE_H__ + + + +/** + * Handler used by logger to truncate the string + * rather than panic in case of buffer overflow. +*/ + +NONSHARABLE_CLASS ( TAdaptOverflowTruncate ) : public TDes16Overflow + { + +public: + void Overflow ( TDes16& /*aDes*/ ) {} + }; + + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// TIMChacheLogger::WriteLog() +// ----------------------------------------------------------------------------- +// +inline void TIMChacheLogger::WriteLog ( TRefByValue aFmt, ... ) + { + #ifdef IMCHACHE_ENABLE_DEBUG_LOGS + ( void ) aFmt;//Suppress unused formal parameter warning + TBuf< KTAdaptMaxLogLineLength > buffer; + buffer.Append ( _L ( "[" ) ); // CSI: 78 # + buffer.Append ( RThread().Name() ); + buffer.Append ( _L ( "] " ) ); // CSI: 78 # + TAdaptOverflowTruncate overflow; + VA_LIST list; + VA_START ( list, aFmt ); + buffer.AppendFormatList ( aFmt, list, &overflow ); + RFileLogger logger; + + if ( logger.Connect() == KErrNone ) + { + logger.SetDateAndTime ( ETrue, ETrue ); + logger.CreateLog ( KTAdaptDebugOutputDir, KTAdaptDebugOutputFileName, + EFileLoggingModeAppend ); + logger.Write ( buffer ); + logger.CloseLog(); + logger.Close(); + } + #endif + + } + + +// End of File + + diff -r 000000000000 -r e6b17d312c8b imservices/instantmessagingcache/inc/imcacheuids.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/instantmessagingcache/inc/imcacheuids.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,37 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: collection of all uids +* +*/ + + +#ifndef __IMCACHEUIDS_H +#define __IMCACHEUIDS_H + +//Uid2:s +#define KStaticInterfaceDllUid2 0x1000008d // CSI: 8 # + + +// imcacheclient Uid3 +#define KIMCacheClientUid3 0x20012429 // CSI: 8 # +// imcacheserver uid3 +#define KIMCacheServerUid3 0x2001242A // CSI: 8 # + + +#endif // __IMCACHEUIDS_H + + +// END OF FILE + + diff -r 000000000000 -r e6b17d312c8b imservices/instantmessagingcache/rom/instantmessagingcache.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/instantmessagingcache/rom/instantmessagingcache.iby Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,28 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: IBY file for imcache +* +*/ + +#ifndef __INSTANTMESSAGINGCACHE_IBY__ +#define __INSTANTMESSAGINGCACHE_IBY__ + +//instant messaging cache +file=ABI_DIR/BUILD_DIR/imcacheserver.exe PROGRAMS_DIR/imcacheserver.exe +file=ABI_DIR/BUILD_DIR/imcacheclient.dll SHARED_LIB_DIR/imcacheclient.dll + +// stub SIS, provides support for SIS upgrading +data=DATAZ_/system/install/imcachestub.sis system/install/imcachestub.sis + +#endif //__INSTANTMESSAGINGCACHE_IBY__ diff -r 000000000000 -r e6b17d312c8b imservices/instantmessagingcache/sis/imcache.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/instantmessagingcache/sis/imcache.pkg Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,38 @@ + +; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +; All rights reserved. +; This component and the accompanying materials are made available +; under the terms of "Eclipse Public License v1.0" +; which accompanies this distribution, and is available +; at the URL "http://www.eclipse.org/legal/epl-v10.html". +; +; Initial Contributors: +; Nokia Corporation - initial contribution. +; +; Contributors: +; +; Description:pkg file for imcache +; +; imcache.pkg +; +;Language - standard language definitions +&EN + +; standard SIS file header +#{"IM Cache"},(0x20012429),1,1,0, TYPE=SA,RU + +;Supports Series 60 v 3.0 +(0x20022E6D), 0, 0, 0, {"Series60ProductID"} + +;Localized Vendor Name +%{"Nokia"} + +;Unique Vendor name +:"Nokia" + +; file to copy from imcache + +"\epoc32\release\armv5\urel\imcacheserver.exe" -"!:\sys\bin\imcacheserver.exe" +"\epoc32\release\armv5\urel\imcacheclient.dll" -"!:\sys\bin\imcacheclient.dll" + +; end of file \ No newline at end of file diff -r 000000000000 -r e6b17d312c8b imservices/instantmessagingcache/sis/imcachestub.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/instantmessagingcache/sis/imcachestub.pkg Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,32 @@ +; +; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +; All rights reserved. +; This component and the accompanying materials are made available +; under the terms of "Eclipse Public License v1.0" +; which accompanies this distribution, and is available +; at the URL "http://www.eclipse.org/legal/epl-v10.html". +; +; Initial Contributors: +; Nokia Corporation - initial contribution. +; +; Contributors: +; +; Description: +; +;Language +&EN + +;Header +#{"IM Cache"}, (0x20012429), 1, 0, 0, TYPE=SA + +;Localised VendorID +%{"Nokia"} + +;VendorID +:"Nokia" + +; instant messaging cache +"" -"z:\sys\bin\imcacheserver.exe" +"" -"z:\sys\bin\imcacheclient.dll" + +; end of file diff -r 000000000000 -r e6b17d312c8b imservices/instantmessagingcache/sis/imcachestub.sis Binary file imservices/instantmessagingcache/sis/imcachestub.sis has changed diff -r 000000000000 -r e6b17d312c8b imservices/instantmessagingcache/sis/metadata.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/instantmessagingcache/sis/metadata.xml Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,72 @@ + + + ABC:ABC + + + + + 1 + + InstantMessageCache + + Update for InstantMessageCache + + + + + + S60 + + + 5 + 2 + + + 2007 + 1 + + + + + 5 + 2 + + 2009 + 52 + + + + + + + + 0x20012429 + + + 1 + 0 + 0 + + + + 2 + 2 + 2 + + + + + diff -r 000000000000 -r e6b17d312c8b imservices/instantmessagingcache/tsrc/bwins/imcache_testu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/instantmessagingcache/tsrc/bwins/imcache_testu.def Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + ?LibEntryL@@YAPAVCScriptBase@@AAVCTestModuleIf@@@Z @ 1 NONAME ; class CScriptBase * LibEntryL(class CTestModuleIf &) + diff -r 000000000000 -r e6b17d312c8b imservices/instantmessagingcache/tsrc/conf/imcache_test.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/instantmessagingcache/tsrc/conf/imcache_test.cfg Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,155 @@ +/* +* ============================================================================== +* Name : imcache_test.cfg +* Part of : instantmessagingcache / imcache_test +* Description : instantmessagingcache related test cases +* Version: : % version:1 % +* +* Copyright (C) 2008 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 1. CreateSameUpdaterL +create imcache_test foobar +foobar CreateSameUpdaterL +delete foobar +[Endtest] + + +[Test] +title 2. CreateDifferentUpdaterL +create imcache_test foobar +foobar CreateDifferentUpdaterL +delete foobar +[Endtest] + + +[Test] +title 3. CreateSameAccessorL +create imcache_test foobar +foobar CreateSameAccessorL +delete foobar +[Endtest] + + +[Test] +title 4. CreateDifferentAccessorL +create imcache_test foobar +foobar CreateDifferentAccessorL +delete foobar +[Endtest] + +[Test] +title 5. StartNewConversationL +create imcache_test foobar +foobar StartNewConversationL +delete foobar +[Endtest] + + +[Test] +title 6. AppendSendMessageL +create imcache_test foobar +foobar AppendSendMessageL +delete foobar +[Endtest] + + +[Test] +title 7. AppendRecieveMessageL +create imcache_test foobar +foobar AppendRecieveMessageL +delete foobar +[Endtest] + + +[Test] +title 8. FetchExistingMessageL +create imcache_test foobar +foobar FetchExistingMessageL +delete foobar +[Endtest] + +[Test] +title 9. DeactivateConversationL +create imcache_test foobar +foobar DeactivateConversationL +delete foobar +[Endtest] + +[Test] +title 10. CloseConversationL +create imcache_test foobar +foobar CloseConversationL +delete foobar +[Endtest] + +[Test] +title 11. GetUnreadMsgCountL +create imcache_test foobar +foobar GetUnreadMsgCountL +delete foobar +[Endtest] + + +[Test] +title 12. GetNewMsgNotificationtL +create imcache_test foobar +foobar GetNewMsgNotificationtL +delete foobar +[Endtest] + +[Test] +title 13. ConversationUnExistTestL +create imcache_test foobar +foobar ConversationUnExistTestL +delete foobar +[Endtest] + + +[Test] +title 14. ConversationExistTestL +create imcache_test foobar +foobar ConversationExistTestL +delete foobar +[Endtest] + +[Test] +title 15. AppendMessageL +create imcache_test foobar +foobar AppendMessageL +delete foobar +[Endtest] + +[Test] +title 16. GetAllUnreadMsgCountL +create imcache_test foobar +foobar GetAllUnreadMsgCountL +delete foobar +[Endtest] + +[Test] +title 17. GetChatListTestL +create imcache_test foobar +foobar GetChatListTestL +delete foobar +[Endtest] + +[Test] +title 18. AccessorCloseConversationTestL +create imcache_test foobar +foobar AccessorCloseConversationTestL +delete foobar +[Endtest] + + diff -r 000000000000 -r e6b17d312c8b imservices/instantmessagingcache/tsrc/eabi/imcache_testu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/instantmessagingcache/tsrc/eabi/imcache_testu.def Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + _Z9LibEntryLR13CTestModuleIf @ 1 NONAME + diff -r 000000000000 -r e6b17d312c8b imservices/instantmessagingcache/tsrc/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/instantmessagingcache/tsrc/group/bld.inf Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,57 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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' + +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 +*/ +../init/TestFramework.ini /epoc32/winscw/c/TestFramework/TestFramework.ini +../conf/imcache_test.cfg /epoc32/winscw/c/TestFramework/imcache_test.cfg + +PRJ_TESTMMPFILES +// NOTE: If using ARS requirements .mmp file operation should be done under this. +// 'abld test build' +imcache_test.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: + + + +// End of File \ No newline at end of file diff -r 000000000000 -r e6b17d312c8b imservices/instantmessagingcache/tsrc/group/imcache_test.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/instantmessagingcache/tsrc/group/imcache_test.mmp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,54 @@ +/*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 "Eclipse Public License v1.0" +* which accompanies 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 +* +*/ + + + // To get the OSEXT_LAYER_SYSTEMINCLUDE-definition +#include +#include + +TARGET imcache_test.dll +TARGETTYPE dll +UID 0x1000008D 0x101FB3E3 + +CAPABILITY ALL -TCB + +//TARGETPATH ?target_path +DEFFILE imcache_test.def + +SOURCEPATH ../src +SOURCE imcache_test.cpp +SOURCE imcache_testBlocks.cpp + +USERINCLUDE ../inc +//USERINCLUDE ../../../../imcacheclient/inc +//USERINCLUDE ../../../../inc + +APP_LAYER_SYSTEMINCLUDE + +SYSTEMINCLUDE /epoc32/include/internal + +LIBRARY euser.lib +LIBRARY stiftestinterface.lib +LIBRARY stiftestengine.lib +// imcache +LIBRARY imcacheclient.lib + +LANG SC + + + +// End of File diff -r 000000000000 -r e6b17d312c8b imservices/instantmessagingcache/tsrc/group/imcache_test.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/instantmessagingcache/tsrc/group/imcache_test.pkg Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,42 @@ +; +; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +; All rights reserved. +; This component and the accompanying materials are made available +; under the terms of "Eclipse Public License v1.0" +; which accompanies this distribution, and is available +; at the URL "http://www.eclipse.org/legal/epl-v10.html". +; +; Initial Contributors: +; Nokia Corporation - initial contribution. +; +; Contributors: +; +; Description: +; +;Header +#{"Testcache"}, (0x101FB3E3), 1, 2, 3, TYPE=SP + +;Language - standard language definitions +&EN + +;Vendor ID +:"Nokia Corporation" + +;Localised vendor +%{"Vendor-EN"} + +;Supports Series 60 v 0.9 +[0x101F7961], 0, 0, 0, {"Series60ProductID"} + +;rom will not allow to update it if name is testframework, after install need to rename it to testframework.ini + +;INI FILE +"..\init\testframework.ini" -"c:\Testframework\ttestframework.ini" + +;CFG FILES +"..\conf\imcache_test.cfg" -"c:\Testframework\imcache_test.cfg" + +;imcache_test dll files + +"\EPOC32\RELEASE\ARMV5\UREL\imcache_test.dll" -"!:\sys\bin\imcache_test.dll" + diff -r 000000000000 -r e6b17d312c8b imservices/instantmessagingcache/tsrc/inc/imcache_test.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/instantmessagingcache/tsrc/inc/imcache_test.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,225 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 IMCACHE_TEST_H +#define IMCACHE_TEST_H + +// INCLUDES +#include +#include +#include +// imcache +#include "mimcacheeventhandler.h" +#include "mimcacheeventhandler.h" +#include + +// CONSTANTS +//const ?type ?constant_var = ?constant; + +// MACROS +//#define ?macro ?macro_def +// Logging path +_LIT( Kimcache_testLogPath, "\\logs\\testframework\\imcache_test\\" ); +// Log file +_LIT( Kimcache_testLogFile, "imcache_test.txt" ); +_LIT( Kimcache_testLogFileWithTitle, "imcache_test_[%S].txt" ); + +// FUNCTION PROTOTYPES +//?type ?function_name(?arg_list); + +// FORWARD DECLARATIONS +//class ?FORWARD_CLASSNAME; +class Cimcache_test; +class CIMCacheFactory; +class MIMCacheEventHandler; + +// DATA TYPES +//enum ?declaration +//typedef ?declaration +//extern ?data_type; + +// CLASS DECLARATION + +/** +* Cimcache_test test class for STIF Test Framework TestScripter. +* ?other_description_lines +* +* @lib ?library +* @since ?Series60_version +*/ +NONSHARABLE_CLASS(Cimcache_test) : public CScriptBase, + public MIMCacheEventHandler + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static Cimcache_test* NewL( CTestModuleIf& aTestModuleIf ); + + /** + * Destructor. + */ + virtual ~Cimcache_test(); + + 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. + */ + Cimcache_test( 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. + */ + + + //ADD NEW METHOD DEC HERE + //[TestMethods] - Do not remove + + virtual TInt CreateSameUpdaterL( CStifItemParser& aItem ); + + virtual TInt CreateDifferentUpdaterL( CStifItemParser& aItem ); + + virtual TInt CreateSameAccessorL( CStifItemParser& aItem ); + + virtual TInt CreateDifferentAccessorL( CStifItemParser& aItem ); + + virtual TInt StartNewConversationL( CStifItemParser& aItem ) ; + + virtual TInt AppendSendMessageL( CStifItemParser& aItem ) ; + + virtual TInt AppendRecieveMessageL( CStifItemParser& aItem ) ; + + virtual TInt FetchExistingMessageL( CStifItemParser& aItem ); + + virtual TInt DeactivateConversationL( CStifItemParser& aItem ); + + virtual TInt CloseConversationL( CStifItemParser& aItem ); + + virtual TInt GetUnreadMsgCountL(CStifItemParser& aItem) ; + + virtual TInt GetNewMsgNotificationtL(CStifItemParser& aItem) ; + + virtual TInt ConversationUnExistTestL(CStifItemParser& aItem) ; + + virtual TInt ConversationExistTestL(CStifItemParser& aItem) ; + + virtual TInt AppendMessageL( CStifItemParser& aItem); + + virtual TInt GetAllUnreadMsgCountL( CStifItemParser& aItem); + + + virtual TInt GetChatListTestL( CStifItemParser& aItem); + + virtual TInt AccessorCloseConversationTestL( CStifItemParser& aItem); + + + + public: // MIMCacheEventHandler + + /** + * Gets called when data update is available. + * Client can then decide wether to use the old one + * or the updated one. + * @param aNewMessage, new message details + */ + void HandleIMCacheEventL(TIMCacheEventType aEvent, TAny* aChatMessage = NULL ) ; + + + protected: // Data + // ?one_line_short_description_of_data + //?data_declaration; + + private: // Data + + CActiveSchedulerWait iWait; + + TInt iMessageFetch; + // ?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 // IMCACHE_TEST_H + +// End of File diff -r 000000000000 -r e6b17d312c8b imservices/instantmessagingcache/tsrc/init/TestFramework.ini --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/instantmessagingcache/tsrc/init/TestFramework.ini Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,44 @@ +# +# This is STIFTestFramework initialization file +# Comment lines start with '#'-character. +# See STIF TestFramework users guide.doc for instructions + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + +[Engine_Defaults] + +TestReportMode= FullReport # Possible values are: 'Empty', 'Summary', 'Environment', + 'TestCases' or 'FullReport' + +CreateTestReport= YES # Possible values: YES or NO + +TestReportFilePath= C:\LOGS\TestFramework\ +TestReportFileName= TestReport + +TestReportFormat= TXT # Possible values: TXT or HTML +TestReportOutput= FILE # Possible values: FILE or RDEBUG +TestReportFileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND + +DeviceResetDllName= StifResetForNokia.dll # e.g. 'StifHWResetStub.dll' for user specific reseting + +[End_Defaults] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Module configurations start + +[New_Module] +ModuleName= testscripter +TestCaseFile= C:\testframework\imcache_test.cfg +[End_Module] + + + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + +[Logger_Defaults] + +[End_Logger_Defaults] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + +# End of file diff -r 000000000000 -r e6b17d312c8b imservices/instantmessagingcache/tsrc/src/imcache_test.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/instantmessagingcache/tsrc/src/imcache_test.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,187 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 "imcache_test.h" +#include + +#include "cimcachefactory.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 =============================== + +// ----------------------------------------------------------------------------- +// Cimcache_test::Cimcache_test +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +Cimcache_test::Cimcache_test( + CTestModuleIf& aTestModuleIf ): + CScriptBase( aTestModuleIf ) + { + } + +// ----------------------------------------------------------------------------- +// Cimcache_test::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void Cimcache_test::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(Kimcache_testLogFileWithTitle, &title); + } + else + { + logFileName.Copy(Kimcache_testLogFile); + } + + iLog = CStifLogger::NewL( Kimcache_testLogPath, + logFileName, + CStifLogger::ETxt, + CStifLogger::EFile, + EFalse ); + + TestModuleIf().SetBehavior( CTestModuleIf::ETestLeaksHandles ); + + + + } + +// ----------------------------------------------------------------------------- +// Cimcache_test::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +Cimcache_test* Cimcache_test::NewL( + CTestModuleIf& aTestModuleIf ) + { + Cimcache_test* self = new (ELeave) Cimcache_test( aTestModuleIf ); + + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); + + return self; + + } + +// Destructor +Cimcache_test::~Cimcache_test() + { + + // Delete resources allocated from test methods + Delete(); + + // 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* ) Cimcache_test::NewL( aTestModuleIf ); + + } + + +// End of File diff -r 000000000000 -r e6b17d312c8b imservices/instantmessagingcache/tsrc/src/imcache_testBlocks.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/instantmessagingcache/tsrc/src/imcache_testBlocks.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,648 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 "imcache_test.h" + +#include "cimcachefactory.h" +#include "mimcacheupdater.h" +#include "mimcacheaccessor.h" +#include "mimcacheeventhandler.h" + + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// Cimcache_test::Delete +// Delete here all resources allocated and opened from test methods. +// Called from destructor. +// ----------------------------------------------------------------------------- +// +void Cimcache_test::Delete() + { + + } + +// ----------------------------------------------------------------------------- +// Cimcache_test::RunMethodL +// Run specified method. Contains also table of test mothods and their names. +// ----------------------------------------------------------------------------- +// +TInt Cimcache_test::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( "CreateSameUpdaterL", Cimcache_test::CreateSameUpdaterL ), + ENTRY( "CreateDifferentUpdaterL", Cimcache_test::CreateDifferentUpdaterL ), + ENTRY( "CreateSameAccessorL", Cimcache_test::CreateSameAccessorL ), + ENTRY( "CreateDifferentAccessorL", Cimcache_test::CreateDifferentAccessorL ), + ENTRY( "StartNewConversationL", Cimcache_test::StartNewConversationL ), + ENTRY( "AppendSendMessageL", Cimcache_test::AppendSendMessageL ), + ENTRY( "AppendRecieveMessageL", Cimcache_test::AppendRecieveMessageL ), + ENTRY( "FetchExistingMessageL", Cimcache_test::FetchExistingMessageL), + ENTRY( "DeactivateConversationL", Cimcache_test::DeactivateConversationL), + ENTRY( "CloseConversationL", Cimcache_test::CloseConversationL ), + ENTRY( "GetUnreadMsgCountL", Cimcache_test::GetUnreadMsgCountL ), + ENTRY( "GetNewMsgNotificationtL", Cimcache_test::GetNewMsgNotificationtL ), + + ENTRY( "ConversationUnExistTestL", Cimcache_test::ConversationUnExistTestL ), + ENTRY( "ConversationExistTestL", Cimcache_test::ConversationExistTestL ), + + ENTRY( "AppendMessageL", Cimcache_test::AppendMessageL ), + ENTRY( "GetAllUnreadMsgCountL", Cimcache_test::GetAllUnreadMsgCountL ), + + + ENTRY( "GetChatListTestL", Cimcache_test::GetChatListTestL ), + ENTRY( "AccessorCloseConversationTestL", Cimcache_test::AccessorCloseConversationTestL ) + + //ADD NEW ENTRY HERE + // [test cases entries] - Do not remove + + }; + + const TInt count = sizeof( KFunctions ) / + sizeof( TStifFunctionInfo ); + + return RunInternalL( KFunctions, count, aItem ); + + } + + +// ----------------------------------------------------------------------------- +// Cimcache_test::CreateSameUpdaterL +// Example test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Cimcache_test::CreateSameUpdaterL( CStifItemParser& /*aItem*/ ) + { + + CIMCacheFactory* instance = CIMCacheFactory::InstanceL(); + + MIMCacheUpdater* updater1 = instance->CreateUpdaterL(1, _L("testlm123@gmail.com"),ETrue ); + + MIMCacheUpdater* updater2 = instance->CreateUpdaterL(1, _L("testlm123@gmail.com") ,ETrue); + + TInt error = KErrGeneral; + + if(updater1 == updater2 ) + { + error = KErrNone; + } + + CIMCacheFactory::Release(); + + return error; + } + +// ----------------------------------------------------------------------------- +// Cimcache_test::CreateDifferentUpdaterL +// Example test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Cimcache_test::CreateDifferentUpdaterL( CStifItemParser& /*aItem*/ ) + { + + CIMCacheFactory* instance = CIMCacheFactory::InstanceL(); + + MIMCacheUpdater* updater1 = instance->CreateUpdaterL(1, _L("testlm123@gmail.com"),ETrue ); + + MIMCacheUpdater* updater2 = instance->CreateUpdaterL(2, _L("abc123@gmail.com") ,ETrue); + + TInt error = KErrGeneral; + + if(updater1 != updater2 ) + { + error = KErrNone; + } + + CIMCacheFactory::Release(); + + return error; + } + + // ----------------------------------------------------------------------------- +// Cimcache_test::CreateSameAccessorL +// Example test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Cimcache_test::CreateSameAccessorL( CStifItemParser& /*aItem*/ ) + { + + CIMCacheFactory* instance = CIMCacheFactory::InstanceL(); + + MIMCacheAccessor* accessor1 = instance->CreateAccessorL(1, _L("testlm123@gmail.com") ); + + MIMCacheAccessor* accessor2 = instance->CreateAccessorL(1, _L("testlm123@gmail.com") ); + + TInt error = KErrGeneral; + + if(accessor1 == accessor2 ) + { + error = KErrNone; + } + + CIMCacheFactory::Release(); + + return error; + } + +// ----------------------------------------------------------------------------- +// Cimcache_test::CreateDifferentAccessorL +// Example test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Cimcache_test::CreateDifferentAccessorL( CStifItemParser& /*aItem*/ ) + { + + CIMCacheFactory* instance = CIMCacheFactory::InstanceL(); + + MIMCacheAccessor* accessor1 = instance->CreateAccessorL(1, _L("testlm123@gmail.com") ); + + MIMCacheAccessor* accessor2 = instance->CreateAccessorL(2, _L("abc123@gmail.com") ); + + TInt error = KErrGeneral; + + if(accessor1 != accessor2 ) + { + error = KErrNone; + } + + CIMCacheFactory::Release(); + + return error; + } + // ----------------------------------------------------------------------------- +// Cimcache_test::StartNewConversationL +// Example test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Cimcache_test::StartNewConversationL( CStifItemParser& /*aItem*/ ) + { + CIMCacheFactory* instance = CIMCacheFactory::InstanceL(); + + MIMCacheUpdater* updater = instance->CreateUpdaterL(1, _L("testlm123@gmail.com"),ETrue ); + updater->RegisterObserverL(*this); + updater->StartNewConversationL( _L("testui123@gmail.com") ) ; + + if( !iWait.IsStarted() ) + { + iWait.Start(); + } + updater->UnRegisterObserver(*this); + CIMCacheFactory::Release(); + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// Cimcache_test::AppendSendMessageL +// Example test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Cimcache_test::AppendSendMessageL( CStifItemParser& /*aItem*/ ) + { + CIMCacheFactory* instance = CIMCacheFactory::InstanceL(); + + MIMCacheUpdater* updater = instance->CreateUpdaterL(1, _L("testlm123@gmail.com") ,ETrue); + updater->RegisterObserverL(*this); + updater->StartNewConversationL( _L("testui123@gmail.com") ) ; + + if( !iWait.IsStarted() ) + { + iWait.Start(); + } + updater->AppendSendMessageL( _L("hello this is test message appended") ) ; + updater->UnRegisterObserver(*this); + CIMCacheFactory::Release(); + return KErrNone; + } + + // ----------------------------------------------------------------------------- +// Cimcache_test::AppendRecieveMessageL +// Example test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Cimcache_test::AppendRecieveMessageL( CStifItemParser& /*aItem*/ ) + { + CIMCacheFactory* instance = CIMCacheFactory::InstanceL(); + + MIMCacheUpdater* updater = instance->CreateUpdaterL(1, _L("testlm123@gmail.com"),ETrue ); + updater->AppendReceiveMessageL( _L("testui123@gmail.com"),_L("hello this is test message appended") ) ; + + CIMCacheFactory::Release(); + return KErrNone; + } + + // ----------------------------------------------------------------------------- +// Cimcache_test::StartNewConversationL +// Example test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Cimcache_test::FetchExistingMessageL( CStifItemParser& /*aItem*/ ) + { + CIMCacheFactory* instance = CIMCacheFactory::InstanceL(); + TInt error = KErrNotFound; + MIMCacheUpdater* updater = instance->CreateUpdaterL(1, _L("testlm123@gmail.com") ,ETrue); + // tow message appended hence counter will be two. + updater->AppendReceiveMessageL( _L("testui123@gmail.com"),_L("hello this is test first message appended") ) ; + updater->AppendReceiveMessageL( _L("testui123@gmail.com"),_L("hello this is test second message appended") ) ; + + updater->RegisterObserverL(*this); + + if( !iWait.IsStarted() ) + { + iWait.Start(); + } + + updater->StartNewConversationL( _L("testui123@gmail.com") ) ; + + if( !iWait.IsStarted() ) + { + iWait.Start(); + } + updater->UnRegisterObserver(*this); + CIMCacheFactory::Release(); + if( iMessageFetch == 2) // two message should be fetched + { + error = KErrNone; + } + return error; + } + +// ----------------------------------------------------------------------------- +// Cimcache_test::DeactivateConversationL +// Example test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Cimcache_test::DeactivateConversationL( CStifItemParser& /*aItem*/ ) + { + CIMCacheFactory* instance = CIMCacheFactory::InstanceL(); + + MIMCacheUpdater* updater = instance->CreateUpdaterL(1, _L("testlm123@gmail.com"),ETrue ); + updater->RegisterObserverL(*this); + updater->StartNewConversationL( _L("testui123@gmail.com") ) ; + + if( !iWait.IsStarted() ) + { + iWait.Start(); + } + // close the active conversation + updater->DeactivateConversationL(); + + updater->UnRegisterObserver(*this); + CIMCacheFactory::Release(); + return KErrNone; + } +// ----------------------------------------------------------------------------- +// Cimcache_test::CloseConversationL +// Example test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Cimcache_test::CloseConversationL( CStifItemParser& /*aItem*/ ) + { + CIMCacheFactory* instance = CIMCacheFactory::InstanceL(); + + MIMCacheUpdater* updater = instance->CreateUpdaterL(1, _L("testlm123@gmail.com"),ETrue ); + updater->RegisterObserverL(*this); + + updater->StartNewConversationL( _L("testui123@gmail.com") ) ; + + if( !iWait.IsStarted() ) + { + iWait.Start(); + } + // close the active conversation + updater->CloseConversationL( _L("testui123@gmail.com") ); + + if( !iWait.IsStarted() ) + { + iWait.Start(); + } + + updater->UnRegisterObserver(*this); + CIMCacheFactory::Release(); + return KErrNone; + } + + +// ----------------------------------------------------------------------------- +// Cimcache_test::GetUnreadMsgCountL +// Example test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Cimcache_test::GetUnreadMsgCountL(CStifItemParser& /*aItem*/) + { + CIMCacheFactory* instance = CIMCacheFactory::InstanceL(); + + MIMCacheAccessor* accessor = instance->CreateAccessorL(1, _L("testlm123@gmail.com") ); + + MIMCacheUpdater* updater = instance->CreateUpdaterL(1, _L("testlm123@gmail.com"), ETrue ); + updater->AppendReceiveMessageL( _L("testui123@gmail.com"),_L("hello this is test message appended") ) ; + TInt count = accessor->GetUnreadMessageCountL( _L("testui123@gmail.com") ); + CIMCacheFactory::Release(); + if(count == 1) + { + return KErrNone; + } + return KErrArgument; + } + + +// ----------------------------------------------------------------------------- +// Cimcache_test::GetUnreadMsgCountChangeL +// Example test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Cimcache_test::GetAllUnreadMsgCountL(CStifItemParser& /*aItem*/) + { + CIMCacheFactory* instance = CIMCacheFactory::InstanceL(); + + MIMCacheAccessor* accessor = instance->CreateAccessorL(1, _L("testlm123@gmail.com") ); + + MIMCacheUpdater* updater = instance->CreateUpdaterL(1, _L("testlm123@gmail.com"), ETrue ); + updater->AppendReceiveMessageL( _L("testui123@gmail.com"),_L("hello this is test message appended") ) ; + updater->AppendReceiveMessageL( _L("meco1111@gmail.com"),_L("i am fine here") ) ; + + TInt count = accessor->GetAllUnreadMessageCountL( ); + CIMCacheFactory::Release(); + if(count == 2) + { + return KErrNone; + } + return KErrArgument; + } +// ----------------------------------------------------------------------------- +// Cimcache_test::ConversationUnExistTestL +// Example test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Cimcache_test::ConversationUnExistTestL(CStifItemParser& /*aItem*/) + { + CIMCacheFactory* instance = CIMCacheFactory::InstanceL(); + + MIMCacheAccessor* accessor = instance->CreateAccessorL(1, _L("testlm123@gmail.com") ); + // not yest conversation open so must be EFalse here + TBool ret = accessor->IsConversationExistL(_L("testui123@gmail.com") ); + + CIMCacheFactory::Release(); + + if(!ret) + { + return KErrNone; + } + return KErrArgument; + } + +// ----------------------------------------------------------------------------- +// Cimcache_test::ConversationExistTestL +// Example test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Cimcache_test::ConversationExistTestL(CStifItemParser& /*aItem*/) + { + CIMCacheFactory* instance = CIMCacheFactory::InstanceL(); + + MIMCacheUpdater* updater = instance->CreateUpdaterL(1, _L("testlm123@gmail.com"), ETrue ); + updater->RegisterObserverL(*this); + updater->StartNewConversationL( _L("testui123@gmail.com") ) ; + + if( !iWait.IsStarted() ) + { + iWait.Start(); + } + + MIMCacheAccessor* accessor = instance->CreateAccessorL(1, _L("testlm123@gmail.com") ); + // conversation already open so must be ETrue here + TBool ret = accessor->IsConversationExistL( _L("testui123@gmail.com") ); + + updater->UnRegisterObserver(*this); + + CIMCacheFactory::Release(); + + if(ret) + { + return KErrNone; + } + return KErrArgument; + } + +// ----------------------------------------------------------------------------- +// Cimcache_test::AppendMessageL +// Example test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Cimcache_test::AppendMessageL( CStifItemParser& /*aItem*/ ) + { + CIMCacheFactory* instance = CIMCacheFactory::InstanceL(); + + MIMCacheUpdater* updater = instance->CreateUpdaterL(1, _L("testlm123@gmail.com") ,ETrue); + updater->RegisterObserverL(*this); + updater->StartNewConversationL( _L("testui123@gmail.com") ) ; + + if( !iWait.IsStarted() ) + { + iWait.Start(); + } + updater->AppendMessageL(_L("testui123@gmail.com"), _L("this is system or information message message") ) ; + updater->UnRegisterObserver(*this); + CIMCacheFactory::Release(); + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// Cimcache_test::GetUnreadMsgCountL +// Example test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Cimcache_test::GetNewMsgNotificationtL(CStifItemParser& /*aItem*/) + { + CIMCacheFactory* instance = CIMCacheFactory::InstanceL(); + MIMCacheAccessor* accessor = instance->CreateAccessorL(1, _L("testlm123@gmail.com") ); + accessor->RegisterObserverL(*this); + MIMCacheUpdater* updater = instance->CreateUpdaterL(1, _L("testlm123@gmail.com"),ETrue); + updater->AppendReceiveMessageL( _L("testui123@gmail.com"),_L("hello this is new message notification") ) ; + + if( !iWait.IsStarted() ) + { + iWait.Start(); + } + accessor->UnRegisterObserver(*this); + + CIMCacheFactory::Release(); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// Cimcache_test::GetChatListTestL +// Example test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Cimcache_test::GetChatListTestL( CStifItemParser& /*aItem*/) + { + TInt error = KErrGeneral; + + CIMCacheFactory* instance = CIMCacheFactory::InstanceL(); + MIMCacheUpdater* updater = instance->CreateUpdaterL(1, _L("testlm123@gmail.com"), EFalse ); + + updater->AppendReceiveMessageL( _L("testui123@gmail.com"),_L("hello this is new message notification 1 ") ) ; + updater->AppendReceiveMessageL( _L("abc123@gmail.com"),_L("hello this is new message notification 2 ") ) ; + updater->AppendReceiveMessageL( _L("testgizmo123@gmail.com"),_L("hello this is new message notification 3 ") ) ; + + + RArray listArray = updater->GetChatListL( 1 ); + + if( listArray.Count() == 3 ) // total 3 chat created in server + { + error = KErrNone; + } + + CIMCacheFactory::Release(); + + return error; + } +// ----------------------------------------------------------------------------- +// Cimcache_test::AccessorCloseConversationTestL +// Example test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Cimcache_test::AccessorCloseConversationTestL( CStifItemParser& /*aItem*/) + { + TInt error = KErrGeneral; + + CIMCacheFactory* instance = CIMCacheFactory::InstanceL(); + + MIMCacheUpdater* updater = instance->CreateUpdaterL(1, _L("testlm123@gmail.com"),EFalse ); + updater->AppendReceiveMessageL( _L("testui123@gmail.com"),_L("hello this is new message notification 1 ") ) ; + + MIMCacheAccessor* accessor = instance->CreateAccessorL(1, _L("testlm123@gmail.com") ); + accessor->RegisterObserverL(*this); + + if( accessor->IsConversationExistL(_L("testui123@gmail.com") ) ) + { + // close the active conversation + accessor->CloseConversationL( _L("testui123@gmail.com") ); + + if( !iWait.IsStarted() ) + { + iWait.Start(); + } + error = KErrNone; + } + + accessor->UnRegisterObserver(*this); + + CIMCacheFactory::Release(); + + return error; + } + +// ----------------------------------------------------------------------------- +// Cimcache_test::HandleIMCacheNewMessageEventL +// Example test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// + +void Cimcache_test::HandleIMCacheEventL( TIMCacheEventType aEventType, TAny* /*aChatMessage*/ ) + { + switch( aEventType ) + { + case EIMCacheUnreadMessage : + { + if( iWait.IsStarted() ) + { + iWait.AsyncStop(); + } + break; + } + case EIMCacheUnreadChange : + { + if( iWait.IsStarted() ) + { + iWait.AsyncStop(); + } + break; + } + + case EIMCacheRequestCompleted : + { + if( iWait.IsStarted() ) + { + iWait.AsyncStop(); + } + break; + } + case EIMCacheNewMessage : + { + iMessageFetch++; + if( iWait.IsStarted() && iMessageFetch == 2 ) + { + iWait.AsyncStop(); + } + break; + } + case EIMCacheNewChat: + { + if( iWait.IsStarted() ) + { + iWait.AsyncStop(); + } + break; + } + case EIMCacheChatClosed: + { + if( iWait.IsStarted() ) + { + iWait.AsyncStop(); + } + break; + } + + } + } +// ========================== OTHER EXPORTED FUNCTIONS ========================= +// None + +// end of file diff -r 000000000000 -r e6b17d312c8b imservices/ossprotocoladaptation/dataconvlib/bwins/opencstringutilitieslibexu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/ossprotocoladaptation/dataconvlib/bwins/opencstringutilitieslibexu.def Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,19 @@ +EXPORTS + ?chartohbufc16@@YAHPBDAAVHBufC16@@@Z @ 1 NONAME ; int chartohbufc16(char const *, class HBufC16 &) + ?chartohbufc8@@YAXPBDAAVHBufC8@@@Z @ 2 NONAME ; void chartohbufc8(char const *, class HBufC8 &) + ?chartotbuf16@@YAHPBDAAVTDes16@@@Z @ 3 NONAME ; int chartotbuf16(char const *, class TDes16 &) + ?chartotbuf8@@YAXPBDAAVTDes8@@@Z @ 4 NONAME ; void chartotbuf8(char const *, class TDes8 &) + ?createMsgBuffer@@YAXPAD000H@Z @ 5 NONAME ; void createMsgBuffer(char *, char *, char *, char *, int) + ?tbuf16tochar@@YAHAAVTDes16@@PAD@Z @ 6 NONAME ; int tbuf16tochar(class TDes16 &, char *) + ?tbuf16towchar@@YAPAGAAVTDes16@@@Z @ 7 NONAME ; unsigned short * tbuf16towchar(class TDes16 &) + ?tbuf8tochar@@YAPADAAVTDes8@@@Z @ 8 NONAME ; char * tbuf8tochar(class TDes8 &) + ?tbuf8towchar@@YAHAAVTDes8@@PAG@Z @ 9 NONAME ; int tbuf8towchar(class TDes8 &, unsigned short *) + ?tbufC16tochar@@YAHAAVTDesC16@@PAD@Z @ 10 NONAME ; int tbufC16tochar(class TDesC16 &, char *) + ?tbufC16towchar@@YAXAAVTDesC16@@PAG@Z @ 11 NONAME ; void tbufC16towchar(class TDesC16 &, unsigned short *) + ?tbufC8tochar@@YAXAAVTDesC8@@PAD@Z @ 12 NONAME ; void tbufC8tochar(class TDesC8 &, char *) + ?tbufC8towchar@@YAHAAVTDesC8@@PAG@Z @ 13 NONAME ; int tbufC8towchar(class TDesC8 &, unsigned short *) + ?wchartohbufc16@@YAXPBGAAVHBufC16@@@Z @ 14 NONAME ; void wchartohbufc16(unsigned short const *, class HBufC16 &) + ?wchartohbufc8@@YAHPBGAAVHBufC8@@@Z @ 15 NONAME ; int wchartohbufc8(unsigned short const *, class HBufC8 &) + ?wchartotbuf16@@YAXPBGAAVTDes16@@@Z @ 16 NONAME ; void wchartotbuf16(unsigned short const *, class TDes16 &) + ?wchartotbuf8@@YAHPBGAAVTDes8@@@Z @ 17 NONAME ; int wchartotbuf8(unsigned short const *, class TDes8 &) + diff -r 000000000000 -r e6b17d312c8b imservices/ossprotocoladaptation/dataconvlib/bwins/opencstringutilslibu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/ossprotocoladaptation/dataconvlib/bwins/opencstringutilslibu.def Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,18 @@ +EXPORTS + ?chartohbufc16@@YAHPBDAAVHBufC16@@@Z @ 1 NONAME ; int chartohbufc16(char const *, class HBufC16 &) + ?chartohbufc8@@YAXPBDAAVHBufC8@@@Z @ 2 NONAME ; void chartohbufc8(char const *, class HBufC8 &) + ?chartotbuf16@@YAHPBDAAVTDes16@@@Z @ 3 NONAME ; int chartotbuf16(char const *, class TDes16 &) + ?chartotbuf8@@YAXPBDAAVTDes8@@@Z @ 4 NONAME ; void chartotbuf8(char const *, class TDes8 &) + ?tbuf16tochar@@YAHAAVTDes16@@PAD@Z @ 5 NONAME ; int tbuf16tochar(class TDes16 &, char *) + ?tbuf16towchar@@YAPAGAAVTDes16@@@Z @ 6 NONAME ; unsigned short * tbuf16towchar(class TDes16 &) + ?tbuf8tochar@@YAPADAAVTDes8@@@Z @ 7 NONAME ; char * tbuf8tochar(class TDes8 &) + ?tbuf8towchar@@YAHAAVTDes8@@PAG@Z @ 8 NONAME ; int tbuf8towchar(class TDes8 &, unsigned short *) + ?tbufC16tochar@@YAHAAVTDesC16@@PAD@Z @ 9 NONAME ; int tbufC16tochar(class TDesC16 &, char *) + ?tbufC16towchar@@YAXAAVTDesC16@@PAG@Z @ 10 NONAME ; void tbufC16towchar(class TDesC16 &, unsigned short *) + ?tbufC8tochar@@YAXAAVTDesC8@@PAD@Z @ 11 NONAME ; void tbufC8tochar(class TDesC8 &, char *) + ?tbufC8towchar@@YAHAAVTDesC8@@PAG@Z @ 12 NONAME ; int tbufC8towchar(class TDesC8 &, unsigned short *) + ?wchartohbufc16@@YAXPBGAAVHBufC16@@@Z @ 13 NONAME ; void wchartohbufc16(unsigned short const *, class HBufC16 &) + ?wchartohbufc8@@YAHPBGAAVHBufC8@@@Z @ 14 NONAME ; int wchartohbufc8(unsigned short const *, class HBufC8 &) + ?wchartotbuf16@@YAXPBGAAVTDes16@@@Z @ 15 NONAME ; void wchartotbuf16(unsigned short const *, class TDes16 &) + ?wchartotbuf8@@YAHPBGAAVTDes8@@@Z @ 16 NONAME ; int wchartotbuf8(unsigned short const *, class TDes8 &) + diff -r 000000000000 -r e6b17d312c8b imservices/ossprotocoladaptation/dataconvlib/eabi/OpenCStringUtilsLibu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/ossprotocoladaptation/dataconvlib/eabi/OpenCStringUtilsLibu.def Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,18 @@ +EXPORTS + _Z11chartotbuf8PKcR5TDes8 @ 1 NONAME + _Z11tbuf8tocharR5TDes8 @ 2 NONAME + _Z12chartohbufc8PKcR6HBufC8 @ 3 NONAME + _Z12chartotbuf16PKcR6TDes16 @ 4 NONAME + _Z12tbuf16tocharR6TDes16Pc @ 5 NONAME + _Z12tbuf8towcharR5TDes8Pw @ 6 NONAME + _Z12tbufC8tocharR6TDesC8Pc @ 7 NONAME + _Z12wchartotbuf8PKwR5TDes8 @ 8 NONAME + _Z13chartohbufc16PKcR7HBufC16 @ 9 NONAME + _Z13tbuf16towcharR6TDes16 @ 10 NONAME + _Z13tbufC16tocharR7TDesC16Pc @ 11 NONAME + _Z13tbufC8towcharR6TDesC8Pw @ 12 NONAME + _Z13wchartohbufc8PKwR6HBufC8 @ 13 NONAME + _Z13wchartotbuf16PKwR6TDes16 @ 14 NONAME + _Z14tbufC16towcharR7TDesC16Pw @ 15 NONAME + _Z14wchartohbufc16PKwR7HBufC16 @ 16 NONAME + diff -r 000000000000 -r e6b17d312c8b imservices/ossprotocoladaptation/dataconvlib/eabi/opencstringutilitieslibexu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/ossprotocoladaptation/dataconvlib/eabi/opencstringutilitieslibexu.def Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,19 @@ +EXPORTS + _Z11chartotbuf8PKcR5TDes8 @ 1 NONAME + _Z11tbuf8tocharR5TDes8 @ 2 NONAME + _Z12chartohbufc8PKcR6HBufC8 @ 3 NONAME + _Z12chartotbuf16PKcR6TDes16 @ 4 NONAME + _Z12tbuf16tocharR6TDes16Pc @ 5 NONAME + _Z12tbuf8towcharR5TDes8Pw @ 6 NONAME + _Z12tbufC8tocharR6TDesC8Pc @ 7 NONAME + _Z12wchartotbuf8PKwR5TDes8 @ 8 NONAME + _Z13chartohbufc16PKcR7HBufC16 @ 9 NONAME + _Z13tbuf16towcharR6TDes16 @ 10 NONAME + _Z13tbufC16tocharR7TDesC16Pc @ 11 NONAME + _Z13tbufC8towcharR6TDesC8Pw @ 12 NONAME + _Z13wchartohbufc8PKwR6HBufC8 @ 13 NONAME + _Z13wchartotbuf16PKwR6TDes16 @ 14 NONAME + _Z14tbufC16towcharR7TDesC16Pw @ 15 NONAME + _Z14wchartohbufc16PKwR7HBufC16 @ 16 NONAME + _Z15createMsgBufferPcS_S_S_i @ 17 NONAME + diff -r 000000000000 -r e6b17d312c8b imservices/ossprotocoladaptation/dataconvlib/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/ossprotocoladaptation/dataconvlib/group/bld.inf Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,27 @@ +/* +* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Generic string utility Apis to convert SYMBIAN descriptors +* to standard C character/Wide-character strings and Viceversa +* +*/ + + +PRJ_PLATFORMS +WINSCW +ARMV5 + + + +PRJ_MMPFILES +stringutils.mmp \ No newline at end of file diff -r 000000000000 -r e6b17d312c8b imservices/ossprotocoladaptation/dataconvlib/group/stringutils.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/ossprotocoladaptation/dataconvlib/group/stringutils.mmp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,46 @@ +/* +* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Generic string utility Apis to convert SYMBIAN descriptors +* to standard C character/Wide-character strings and Viceversa +* +*/ + + +#include +TARGET opencstringutilslib.dll +TARGETTYPE dll +UID 0x1000008D 0x2001241C + +CAPABILITY ALL -TCB +VENDORID VID_DEFAULT + +VERSION 10.0 + +SOURCEPATH ../src +//Sourcefile +SOURCE stringutils.cpp + +USERINCLUDE ../inc + + + +MW_LAYER_SYSTEMINCLUDE +OS_LAYER_LIBC_SYSTEMINCLUDE + +LIBRARY euser.lib +LIBRARY libc.lib + +LANG SC + + diff -r 000000000000 -r e6b17d312c8b imservices/ossprotocoladaptation/dataconvlib/inc/stringutils.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/ossprotocoladaptation/dataconvlib/inc/stringutils.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,249 @@ +/* +* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Header file for stringutils +* +*/ + +#ifndef __STRINGUTILS_H__ +#define __STRINGUTILS_H__ + +/** @file stringutils.h + * stringutils is a DLL that exports some set of genaralized APIs using which + * user can convert the SYMBIAN descriptors to standard C character/wide-character + * strings and vice-versa + */ + +//Symbian Headers +#include +#include + +/** + * Aliases : Cconverting HBufC variants to char/wchar_t strings involves + * similiar procedure to that of converting TBufC variants to char/wchar_t strings. + * Hence HBufC to char/wchar_t conversion Apis are aliased to their corresponding TBufC + * counterparts + */ + + +/** + * Alias to the function tbufC16towchar + */ +#define hbufC16towchar tbufC16towchar +/** + * Alias to the function tbufC16tochar + */ +#define hbufC16tochar tbufC16tochar +/** + * Alias to the function tbufC8towchar + */ +#define hbufC8towchar tbufC8towchar +/** + * Alias to the function tbufC8tochar + */ +#define hbufC8tochar tbufC8tochar + + +//Function prototypes + +/** Functions to convert SYMBIAN descriptors to C character and + * Wide-Character strings + */ + +/** + * This Api converts the tbuf16 to a wide-character string + * @param aArg TDes object + * @return a pointer to a wide-character string + */ +IMPORT_C wchar_t* tbuf16towchar(TDes& aArg); + +/** + * This Api converts the tbuf8 to a character string + * @param aArg TDes8 object + * @return a pointer to a character string + */ +IMPORT_C char* tbuf8tochar(TDes8& aArg); + +/** + * This Api converts the tbuf16 to a character string. It is user + * responsibality to allocate a required size of char object. Api may + * resulting in crash, if the destination object size is smaller than + * that of the source. + * @param aSrc TDes16 object + * @param aDes character pointer, to which the resultant string will be copied. + * @return returns an integer value. + * @return Api returns -1 in case of any error. + */ +IMPORT_C int tbuf16tochar(TDes& aSrc, char* aDes); + +/** + * This Api converts the tbuf8 to a wide-character string. It is user + * responsibality to allocate a required size of wide-char object. Api may + * resulting in crash, if the destination object size is smaller than that + * of the source. + * @param aSrc TDes8 object + * @param aDes wide-character pointer, to which the resultant string will be copied. + * @return returns an integer value. + * @return Api returns -1 in case of any error. + */ +IMPORT_C int tbuf8towchar(TDes8& aSrc, wchar_t* aDes); + +/** + * This Api converts the tbuf16 to a wide-character string. It is user + * responsibality to allocate a required size of wide-char object. Api may + * resulting in crash, if the destination object size is smaller than + * that of the source. + * @param aSrc TDes16 object + * @param aDes wide-character pointer, to which the resultant string will be copied. + * @return none + */ +IMPORT_C void tbufC16towchar(TDesC& aSrc ,wchar_t* aDes); + + + /** + * This Api converts the tbufC8 to a character string. It is user + * responsibality to allocate a required size of wide-char object. Api may + * resulting in crash, if the destination object size is smaller than + * that of the source. + * @param aSrc TDesC8 object + * @param aDes character pointer, to which the resultant string will be copied. + * @return none + */ + +IMPORT_C void tbufC8tochar(TDesC8& aSrc, char* aDes); + +/** + * This Api converts the TBufC16 to a character string. It is user + * responsibality to allocate a required size of wide-char object. Api may + * resulting in crash, if the destination object size is smaller than + * that of the source. + * @param aSrc TDesC object + * @param aDes character pointer, to which the resultant string will be copied. + * @return returns an integer value. + * @return Api returns -1 in case of any error. + */ +IMPORT_C int tbufC16tochar(TDesC& aSrc, char* aDes); + + +/** + * This Api converts the TBufC8 to a wide-character string. It is user + * responsibality to allocate a required size of wide-char object. Api may + * resulting in crash, if the destination object size is smaller than + * that of the source. + * @param aSrc TDesC8 object + * @param aDes wide-character pointer, to which the resultant string will be copied. + * @return returns an integer value. + * @return Api returns -1 in case of any error. + */ +IMPORT_C int tbufC8towchar(TDesC8& aSrc, wchar_t* aDes); + + +/** + * Functions to convert C character and + * Wide-Character strings to SYMBIAN descriptors + */ + +/** + * This Api converts the wide-char to a TBuf16. It is user responsibality + * to allocate a required size of TBuf16 object. Api may resulting in crash, + * if the destination object size is smaller than that of the source. + * @param aSrc wide-character pointer. + * @param aDes TBuf16 object, to which the resultant string will be copied. + * @return none + */ +IMPORT_C void wchartotbuf16(const wchar_t *aSrc, TDes16& aDes); + + + /** + * This Api converts the char to a TBuf16. It is user responsibality + * to allocate a required size of TBuf16 object. Api may resulting in crash, + * if the destination object size is smaller than that of the source. + * @param aSrc character pointer. + * @param aDes TBuf16 object, to which the resultant string will be copied. + * @return returns an integer value. + * @return Api returns -1 in case of any error. + */ +IMPORT_C int chartotbuf16(const char* aSrc, TDes16& aDes); + +/** + * This Api converts the wide-char string to a TBuf8. It is user + * responsibality to allocate a required size of TBuf8 object. Api may + * resulting in crash, if the destination object size is smaller than + * that of the source. + * @param aSrc wide-character pointer. + * @param aDes TBuf8 object, to which the resultant string will be copied. + * @return returns an integer value. + * @return Api returns -1 in case of any error. + */ +IMPORT_C int wchartotbuf8(const wchar_t* aSrc, TDes8& aDes); + + + /* + * This Api converts the character string to a TBuf8. It is user + * responsibality to allocate a required size of TBuf8 object. Api may + * resulting in crash, if the destination object size is smaller than + * that of the source. + * @param aSrc character pointer. + * @param aDes TBuf8 object, to which the resultant string will be copied. + * @return none + */ +IMPORT_C void chartotbuf8(const char* aSrc, TDes8& aDes); + + + /** + * This Api converts the wide-char to a HBufC16. It is user responsibality + * to allocate a required size of HBufC16 object. Api may resulting in crash, + * if the destination object size is smaller than that of the source. + * @param aSrc wide-character pointer. + * @param aDes HBufC16 object, to which the resultant string will be copied. + * @return none + */ +IMPORT_C void wchartohbufc16(const wchar_t* aSrc, HBufC16& aDes); + + + /** + * This Api converts the char to a HBufC16. It is user responsibality + * to allocate a required size of HBufC16 object. Api may resulting in crash, + * if the destination object size is smaller than that of the source. + * @param aSrc character pointer. + * @param aDes HBufC16 object, to which the resultant string will be copied. + * @return returns an integer value. + * @return Api returns -1 in case of any error. + */ +IMPORT_C int chartohbufc16(const char* aSrc, HBufC16& aDes); + +/** + * This Api converts the wide-char to a HBufC8. It is user responsibality + * to allocate a required size of HBufC8 object. Api may resulting in crash, + * if the destination object size is smaller than that of the source. + * @param aSrc wide-character pointer. + * @param aDes HBufC8 object, to which the resultant string will be copied. + * @return returns an integer value. + * @return Api returns -1 in case of any error. + */ +IMPORT_C int wchartohbufc8(const wchar_t* aSrc, HBufC8& aDes); + + + /* + * This Api converts the char to a HBufC8. It is user responsibality + * to allocate a required size of HBufC8 object. Api may resulting in crash, + * if the destination object size is smaller than that of the source. + * @param aSrc character pointer. + * @param aDes HBufC8 object, to which the resultant string will be copied. + * @return none + */ +IMPORT_C void chartohbufc8(const char* aSrc, HBufC8& aDes); + + + +#endif //__STRINGUTILS_H__ \ No newline at end of file diff -r 000000000000 -r e6b17d312c8b imservices/ossprotocoladaptation/dataconvlib/sis/stringutils_lib.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/ossprotocoladaptation/dataconvlib/sis/stringutils_lib.pkg Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,39 @@ +; +; Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies). +; All rights reserved. +; This component and the accompanying materials are made available +; under the terms of "Eclipse Public License v1.0" +; which accompanies this distribution, and is available +; at the URL "http://www.eclipse.org/legal/epl-v10.html". +; +; Initial Contributors: +; Nokia Corporation - initial contribution. +; +; Contributors: +; +; Description: Installation file for OpenCStringUtilitiesLibEx Library +; +&EN + +;packet-header (name, uid, major, minor, build, type) +#{"StringUtils Library"},(0xA0001321),1,0,6371, TYPE=SA + +;Localised Vendor name +%{"Nokia"} + +;Unique Vendor name +:"Nokia" + +;Supports Series 60 v3.0 +;This line indicates that this installation is for the Series 60 platform v3.0 +;This line must appear _exactly_ as shown below in the sis file +;If this line is missing or incorrect, the sis file will not be able +;to be installed on Series 60 v2.0 platforms +[0x101F7961], 0, 0, 0, {"Series60ProductID"} + +;copy any data files if you have + +;Files to install +"\epoc32\release\armv5\urel\OpenCStringUtilitiesLibEx.dll" - "!:\sys\bin\OpenCStringUtilitiesLibEx.dll" + + diff -r 000000000000 -r e6b17d312c8b imservices/ossprotocoladaptation/dataconvlib/src/stringutils.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/ossprotocoladaptation/dataconvlib/src/stringutils.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,177 @@ +/* +* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Source file for stringutils +* +*/ + + +// GCCE header +//#ifdef __GCCE__ +//#include +//#endif //__GCCE__ + +//System headers +#include +#include + +//User-definied headers +#include "stringutils.h" + + +EXPORT_C wchar_t* tbuf16towchar(TDes& aArg) +{ + return (wchar_t*)aArg.PtrZ(); +} + +EXPORT_C char* tbuf8tochar(TDes8& aArg) +{ + return (char*)aArg.PtrZ(); +} + +EXPORT_C int tbuf16tochar(TDes& aSrc, char* aDes) +{ + const TUint16 *wideString = aSrc.PtrZ(); + + TInt ret = wcstombs(aDes, (const wchar_t*)wideString, KMaxFileName ); + + return ret; +} + +EXPORT_C int tbuf8towchar(TDes8& aSrc ,wchar_t* aDes) +{ + const char *charString = (const char*)aSrc.PtrZ(); + + TInt ret = mbstowcs(aDes, charString, KMaxFileName ); + + return ret; +} + + +EXPORT_C void tbufC16towchar(TDesC& aSrc ,wchar_t *aDes) +{ + wchar_t *temp = (wchar_t*)aSrc.Ptr(); + const TInt size = aSrc.Size(); + *(temp + size/2 ) = L'\0'; + wcscpy(aDes, temp); +} + +EXPORT_C void tbufC8tochar(TDesC8& aSrc, char* aDes) +{ + char *temp = (char*)aSrc.Ptr(); + const TInt size = aSrc.Length(); + *(temp + size) = '\0'; + strcpy(aDes, temp); +} + +EXPORT_C int tbufC16tochar(TDesC& aSrc, char* aDes) +{ + TUint16* wideString = (TUint16*)aSrc.Ptr(); + const TInt size = aSrc.Length(); + *(wideString + size) = L'\0'; + + + TInt ret = wcstombs(aDes, (const wchar_t*)wideString, size*2 ); + return ret; +} + + +EXPORT_C int tbufC8towchar(TDesC8& aSrc, wchar_t* aDes) +{ + TUint8* charString = (TUint8*)aSrc.Ptr(); + const TInt size = aSrc.Length(); + *(charString + size) = '\0'; + + TInt ret = mbstowcs(aDes, (const char*)charString, KMaxFileName ); + return ret; +} + +EXPORT_C void wchartotbuf16(const wchar_t *aSrc, TDes16 &aDes) +{ + aDes = (const TUint16*)aSrc; +} + +EXPORT_C int chartotbuf16(const char *aSrc, TDes16 &aDes) +{ + int len = strlen(aSrc); + wchar_t *buf = new wchar_t[len]; + + TInt ret = mbstowcs(buf, (const char*)aSrc, len + 1 ); + + if( ret != -1) + aDes = (const TUint16*)buf; + + delete buf; + return ret; +} + +EXPORT_C int wchartotbuf8(const wchar_t *aSrc, TDes8 &aDes) +{ + int len = wcslen(aSrc); + char *buf = new char[len]; + + TInt ret = wcstombs(buf, (const wchar_t*)aSrc, len + 1); + + if( ret != -1) + aDes = (const TUint8*)buf; + + delete buf; + return ret; +} + +EXPORT_C void chartotbuf8 (const char *aSrc, TDes8 &aDes) +{ + aDes = (const TUint8*)aSrc; +} + +EXPORT_C void wchartohbufc16 (const wchar_t* aSrc ,HBufC16& aDes ) +{ + aDes = (const TUint16*)aSrc; +} + +EXPORT_C int chartohbufc16(const char* aSrc, HBufC16& aDes) +{ + int len = strlen(aSrc); + wchar_t *buf = new wchar_t[len]; + + TInt ret = mbstowcs(buf, (const char*)aSrc, len + 1); + + if( ret != -1) + aDes = (const TUint16*)buf; + + delete buf; + return ret; +} + +EXPORT_C void chartohbufc8(const char* aSrc, HBufC8& aDes) +{ + aDes = (const TUint8*)aSrc; +} + +EXPORT_C int wchartohbufc8(const wchar_t* aSrc, HBufC8& aDes) +{ + int len = wcslen(aSrc); + char *buf = new char[len]; + + TInt ret = wcstombs(buf, aSrc, len + 1 ); + + if( ret != -1) + aDes = (const TUint8*)buf; + + delete buf; + return ret; +} + + + +// End of file diff -r 000000000000 -r e6b17d312c8b imservices/ossprotocoladaptation/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/ossprotocoladaptation/group/bld.inf Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,40 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Build information file for project ossprotocoladaptation +* +*/ + + +#include + +PRJ_PLATFORMS +WINSCW +ARMV5 + +PRJ_EXPORTS +../rom/ossprotocoladaptation.iby CORE_MW_LAYER_IBY_EXPORT_PATH(ossprotocoladaptation.iby) +../../data/200195A9.txt /epoc32/data/Z/private/10202be9/200195A9.txt //temporary +../../data/200195A9.txt /epoc32/release/winscw/udeb/Z/private/10202be9/200195A9.txt //temporary + + +PRJ_MMPFILES + +../dataconvlib/group/stringutils.mmp +ossprotocoladaptation.mmp + + + +PRJ_TESTMMPFILES + +PRJ_TESTEXPORTS diff -r 000000000000 -r e6b17d312c8b imservices/ossprotocoladaptation/group/ossprotocoladaptation.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/ossprotocoladaptation/group/ossprotocoladaptation.mmp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,142 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project definition file for OSSProtocolAdaptation +* +*/ + +// To get the MW_LAYER_SYSTEMINCLUDE-definition +#include +#include "../inc/ossprotocoladaptationuids.h" + +TARGET ossprotocoladaptation.dll +TARGETTYPE Plugin +UID KEComRecognitionDllUid2 KEComRecognitionDllUid3 +VENDORID VID_DEFAULT +CAPABILITY CAP_ECOM_PLUGIN + +VERSION 10.0 + +EPOCALLOWDLLDATA + +EPOCHEAPSIZE 0x100000 0x200000 +START RESOURCE ../rss/ossprotocoladaptation.rss +TARGET ossprotocoladaptation.rsc +END + + +SOURCEPATH ../src +SOURCE cossprotocolsearchfeatures.cpp +SOURCE cossprotocolplugin.cpp +SOURCE cossprotocolconnection.cpp +SOURCE cossprotocolpresencefeatures.cpp +SOURCE cossprotocolconnectionmanager.cpp +SOURCE cossprotocolloginrequest.cpp +SOURCE cossprotocollogoutrequest.cpp +SOURCE cossprotocolimfeatures.cpp +SOURCE waittimer.cpp +SOURCE cosssenddataoperation.cpp +SOURCE cossprotocolservererrorhandler.cpp +SOURCE cosscontactmanager.cpp + +//utils +SOURCE ossprotocoladaptutils.cpp +// for logs +SOURCE ossprotocolpluginlogger.cpp +// presentity groups source +SOURCEPATH ../src/presentitygroups +SOURCE cossprotocolpresentitygroups.cpp +SOURCE csubscribepresentitygroupcontentrequest.cpp +SOURCE caddpresentitygroupmemberrequest.cpp +SOURCE cremovepresentitygroupmemberrequest.cpp +SOURCE caddcontactnotificationhandler.cpp +SOURCE ccontactsynchandler.cpp +// --------------------------------------------------------------------------- +SOURCEPATH ../src/presencepublishing +// --------------------------------------------------------------------------- +SOURCE cossprotocolpresencepublishing.cpp +SOURCE cpresencenotificationhandler.cpp +SOURCE cpublishownpresencerequest.cpp + +// --------------------------------------------------------------------------- +SOURCEPATH ../src/presenceauthorization +// --------------------------------------------------------------------------- +SOURCE cossprotocolpresenceauthorization.cpp +SOURCE csubscribepresencegrantrequestlistrequest.cpp +SOURCE cpresenceauthuserrequest.cpp +SOURCE cwithdrawpresencegrantfrompresentityrequest.cpp +// Im operations source +SOURCEPATH ../src/im +SOURCE cossprotocolimconversation.cpp +SOURCE cosssendmessagerequest.cpp +SOURCE creceivemessagehandler.cpp + +SOURCEPATH ../src/processlauncher +SOURCE processlaunher.cpp + +// --------------------------------------------------------------------------- +SOURCEPATH ../src/search +// --------------------------------------------------------------------------- +SOURCE cossprotocolsearch.cpp +SOURCE csearchrequest.cpp +SOURCE csearchkeystore.cpp +SOURCE csearchgetsearchkeys.cpp + +// user includes +USERINCLUDE ../inc/search +USERINCLUDE . +USERINCLUDE ../inc +USERINCLUDE ../inc/presentitygroups +USERINCLUDE ../inc/im +USERINCLUDE ../inc/processlauncher +USERINCLUDE ../inc/presencepublishing +USERINCLUDE ../inc/presenceauthorization +USERINCLUDE ../dataconvlib/inc + +USERINCLUDE ../../xmppsettingsfetcher/inc + +// Default system include paths for middleware layer modules. +APP_LAYER_SYSTEMINCLUDE +OS_LAYER_LIBC_SYSTEMINCLUDE +OS_LAYER_GLIB_SYSTEMINCLUDE +OS_LAYER_SSL_SYSTEMINCLUDE +OS_LAYER_STDCPP_SYSTEMINCLUDE +OS_LAYER_DBUS_SYSTEMINCLUDE +SYSTEMINCLUDE /epoc32/include/ecom + + + + + +LIBRARY euser.lib +LIBRARY ecom.lib +LIBRARY flogger.lib +LIBRARY bafl.lib +LIBRARY jabbersettings.lib +LIBRARY xmppsettingsfetcher.lib + +LIBRARY libc.lib +LIBRARY estor.lib +LIBRARY efsrv.lib +LIBRARY apparc.lib +LIBRARY opencmessagequeuelibrary.lib +LIBRARY opencstringutilslib.lib +LIBRARY inetprotutil.lib + +LIBRARY serviceprovidersettings.lib +LIBRARY centralrepository.lib +LIBRARY estlib.lib +LIBRARY presencecacheclient2.lib +LIBRARY presencecacheutils.lib + +// End of file diff -r 000000000000 -r e6b17d312c8b imservices/ossprotocoladaptation/inc/cosscontactmanager.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/ossprotocoladaptation/inc/cosscontactmanager.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,135 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: contact manager +* +*/ + +#ifndef __COSSCONTACTMANAGER_H__ +#define __COSSCONTACTMANAGER_H__ + +#include + + +class MOSSProtocolConnectionManager; +/** + * COSSContactManager + * + */ +NONSHARABLE_CLASS ( COSSContactManager ) : public CBase + { + + public: + + static COSSContactManager* NewL(MOSSProtocolConnectionManager& aConnMan); + ~COSSContactManager(); + + + private: + + COSSContactManager(MOSSProtocolConnectionManager& aConnMan); + void ConstructL(); + + public: + /** + * get iFetchContactsFirstTime + */ + TBool IsFetchContactsFirstTime(); + /** + * iFetchInvitationsFirstTime + */ + TBool IsFetchInvitationsForFirstTime(); + /** + * Set iFetchContactsFirstTime + * @param value to be set + */ + void SetFetchContactsFirstTime(TBool aValue); + /** + * Set iFetchInvitationsFirstTime + * @param value to be set + */ + void SetFetchInvitationsForFirstTime(TBool aValue); + /** + * Get reference to iContacts + * @param iContacts + */ + RPointerArray& GetContactsListL(); + + /** + * Get reference to iInvitationList + * @param return iInvitationList + */ + RPointerArray& GetInvitationListL(); + /** + * give list of invitations to ximp fw and client side ui + * + */ + void ReturnInvitationListL(); + /** + * give list of current member and remote pending contacts to ximp fw and client side ui + * + */ + void ReturnContactsListL(); + /** + * remove a contact from the local copy of iContacts + * @param aContactName to be removed + */ + void RemoveContactFromLocalL(const TDesC& aContactName); + /** + * add a contact to the local copy of iContacts + * @param aContactName to be added + */ + void AddContactToLocalL(const TDesC& aContactName); + /** + * remove a invitation from the local copy of iInvitationList + * @param aContactName to be removed from the invitation list + */ + void RemoveInvitationFromLocalL(const TDesC& aContactName); + + private: + + /** + * Oss Protocol Plugin Contact Manager + * Not own. *** Write "Not own" if some other class owns this object. + */ + MOSSProtocolConnectionManager& iConnMan; + + /** + * stores if fetching contacts for the first time value + * Own + */ + TBool iFetchContactsFirstTime ; + /** + * stores if fetching invitations for the first time value + * Own + */ + TBool iFetchInvitationsFirstTime ; + /** + * current contacts. to maintain local copy of current contacts + * own + */ + RPointerArray iContacts; + + /** + * local copy of pending contacts or invitations + * own + */ + RPointerArray iInvitationList; + + }; + +#endif // __COSSCONTACTMANAGER_H__ + +// End of File + + diff -r 000000000000 -r e6b17d312c8b imservices/ossprotocoladaptation/inc/cossprotocolconnection.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/ossprotocoladaptation/inc/cossprotocolconnection.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,197 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: oss plugin implementation for XIMP Framework +* +*/ + + +#ifndef __COSSPROTOCOLCONNECTION_H__ +#define __COSSPROTOCOLCONNECTION_H__ + +//#include "OSSProtocloLiterals.h" + +#include +#include +#include +#include +#include + + +// FORWARD DECLARATIONS + +class MXIMPServiceInfo; + +class MXIMPContextClientInfo; + +class MXIMPProtocolConnection; + +class COSSProtocolConnectionManager; + +class COSSProtocolLogoutRequest; + +class COSSProtocolLoginRequest; + +class COSSProtocolPresenceFeatures; + +class COSSProtocolImFeatures; +class COSSProtocolSearchFeature; +/** + * COSSProtocolConnection + * + * OSS Protocol Connection Object. Protocol Connection Object has connection Manager. + * + * + * + */ + +class COSSProtocolConnection : + public CBase, + public MXIMPProtocolConnection + { + + public: + + static COSSProtocolConnection* NewL ( const MXIMPServiceInfo& aServiceInfo, + const MXIMPContextClientInfo& aClientCtxInfo ); + + + ~COSSProtocolConnection(); + + + + void ReleaseConnectionL(); + + + private: + + COSSProtocolConnection(); + + + void ConstructL ( const MXIMPServiceInfo& aServiceInfo, + const MXIMPContextClientInfo& aClientCtxInfo ); + + + public: // from MXIMPBase + + /** + * @see MXIMPProtocolConnection + */ + TAny* GetInterface ( TInt32 aInterfaceId, + TIfGetOps aOptions ); + /** + * @see MXIMPProtocolConnection + */ + const TAny* GetInterface ( TInt32 aInterfaceId, + TIfGetOps aOptions ) const; + /** + * @see MXIMPProtocolConnection + */ + TInt32 GetInterfaceId() const; + + + public: // from MXIMPProtocolConnection + + /** + * @see MXIMPProtocolConnection + */ + void PrimeHost ( MXIMPProtocolConnectionHost& aHost ); + + /** + * @see MXIMPProtocolConnection + */ void OpenSessionL ( const MXIMPContextClientInfo& aClientCtxInfo, + TXIMPRequestId aOpId ); + + /** + * @see MXIMPProtocolConnection + */ + void OpenSessionL ( const TInt& aSettingsId, + TXIMPRequestId aReqId ); + + /** + * @see MXIMPProtocolConnection + */ + void OpenSessionL ( + const MXIMPContextClientInfo& aContextClient, + const TInt& aSettingsId, + TXIMPRequestId aReqId ); + + /** + * @see MXIMPProtocolConnection + */ + void CloseSession ( const MXIMPContextClientInfo& aClientCtxInfo, + TXIMPRequestId aOpId ); + + /** + * @see MXIMPProtocolConnection + */ + void LogoutRequestL(TXIMPRequestId aOpId); + + /** + * @see MXIMPProtocolConnection + */ + void ReOpenSessionsL ( TXIMPRequestId aReqId ); + + /** + * @see MXIMPProtocolConnection + */ + void GetSupportedFeaturesL ( CDesC8Array& aFeatures ) const; + + /** + * @see MXIMPProtocolConnection + */ + MProtocolPresenceFeatures& ProtocolPresenceFeatures(); + + /** + * @see MXIMPProtocolConnection + */ + TAny* GetProtocolInterface(TInt aInterfaceId); + + + private: // data members + /** + * Connection manager + * OWN: + */ + COSSProtocolConnectionManager* iConnMan; + /** + * Presence features + * OWN: + */ + COSSProtocolPresenceFeatures* iPresFeatures; + /** + * Im features + * OWN: + */ + COSSProtocolImFeatures* iImFeatures; + /** + * Search features + * OWN: + */ + COSSProtocolSearchFeature* iSearchFeatures; + /** + * Request id + * OWN: + */ + TXIMPRequestId iRequestId; + /** + * Stores connection count + * OWN: + */ + TInt iConntectionCreated; + + + }; + + +#endif // __COSSPROTOCOLCONNECTION_H__ diff -r 000000000000 -r e6b17d312c8b imservices/ossprotocoladaptation/inc/cossprotocolconnectionmanager.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/ossprotocoladaptation/inc/cossprotocolconnectionmanager.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,344 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: connection manager +* +*/ + +#ifndef __COSSPROTOCOLCONNECTIONMANAGER_H__ +#define __COSSPROTOCOLCONNECTIONMANAGER_H__ + +// INCLUDES +#include +#include +#include +#include "mossprotocolconnectionmanager.h" +#include "waittimer.h" +#include "cpresencenotificationhandler.h" +#include "creceivemessagehandler.h" +#include "cossprotocolservererrorhandler.h" +#include "caddcontactenotificationhandler.h" +#include "cosscontactmanager.h" +#include "msg_enums.h" +#include +#include "csearchkeystore.h" + +// FORWARD DECLARATIONS + +class MXIMPServiceInfo; + +class MXIMPProtocolConnectionHost; + +class MOSSProtocolConnectionManager; + +class CXmppParameters; + +class CWaitTimer; +class MProtocolImDataHost ; +class MProtocolSearchDataHost; +class CContactSyncHandler; + +_LIT(KColon,":"); + +/** + * COSSProtocolConnectionManager + * + * Every XIMPFW-OSS Connection has Connection Manager Object. + * + * + */ +NONSHARABLE_CLASS ( COSSProtocolConnectionManager ) : public CBase, + public MOSSProtocolConnectionManager + // implement session status observer callback + { + +public: + + static COSSProtocolConnectionManager* NewL(); + virtual ~COSSProtocolConnectionManager(); + + +private: + + COSSProtocolConnectionManager(); + void ConstructL(); + + +public: // From MOSSProtocolConnectionManager + + /** + * @see MOSSProtocolConnectionManager + */ + CXmppParameters& XmppParams(); + + /** + * @see MOSSProtocolConnectionManager + */ + CWaitTimer& DataHandler(); + + /** + * @see MOSSProtocolConnectionManager + */ + MXIMPProtocolConnectionHost& HandleToHost(); + + /** + * @see MOSSProtocolConnectionManager + */ + void ManufactureDataHandlerL() ; + + /** + * @see MOSSProtocolConnectionManager + */ + RArray< HBufC >* PresenceAuthGrantReqList(); + +public: // new methods + + /** + * set protocol connection host + * @param aHost protocol connection host + */ + void SetHost ( MXIMPProtocolConnectionHost& aHost ); + + /** + * set connection parameters + * @param aUserName user account + * @param aPassword password + * @param aServiceId ,service id + */ + void SetConnectionParamsL ( const TDesC& aUserName, + const TDesC& aPassword, + const TInt32 aServiceId ); + + /** + * set connection parameters + * @param aServiceId, service id + * @param aReadNedded, EFalse if need not to red from xmpp settings + * @return error if any + */ + TInt SetConnectionParamsL ( const TUint32 aServiceId, TBool aReadNeeded = ETrue ); + + + /** + * set protocol im data host + * @param aHost protocol im data host + */ + void SetImHost(MProtocolImDataHost& aHost); + + /** + * Get protocol im data host + * @param aHost protocol im data host + */ + MProtocolImDataHost& GetImHost() ; + + /** + * Get add notification handler + * @param iAddnotificationhandler + */ + CAddContactNotificationHandler& GetAddNotificationHandler(); + /** + * set protocol search data host + * @param aHost protocol search data host + */ + void SetSearchHost(MProtocolSearchDataHost& aHost); + + /** + * Get protocol search data host + * @param aHost protocol search data host + */ + MProtocolSearchDataHost& GetSearchHost() ; + + /** + * Release Connection + * send killing request to isoserver + */ + void ReleaseConnectionL(); + + + /** + * return ETrue if server disconnect has happen + */ + TBool IsServerDisconnect(); + + /*! /brief Gets a handle to search key store + * /return A handle to search key store + */ + CSearchKeyStore& GetSearchKeyStore(); + +public: + + /** + * Get id + * @return id + */ + TInt32 IapId(); + + /** + * Get username + * @return username + */ + TDesC& UserName(); + + /** + * Get password + * @return password + */ + TDesC& Password(); + + /** + * Get groupid + * @return groupid + */ + TDesC& GroupId(); + /** + * Get service name + * @return servicename + */ + const TDesC& ServiceName(); + /** + * Set group id + * @param group id + */ + void SetGroupIDL(TDesC& aGroupId); + + /** + * gets the contactmanager + * @return iContactManager + */ + COSSContactManager& GetContactManager(); + + +private: // data + + /** + * Stores settings + * Own + */ + CXmppParameters* iXmppParams; + + /** + * REF: protocol connection host + */ + MXIMPProtocolConnectionHost* iHostHandle; + + /** + * Server address: + * Own + */ + HBufC* iServerAddress; + + /** + * UserName: + * Own + */ + HBufC* iUserName; + + /** + * UserName: + * Own + */ + HBufC* iPassword; + + /** + * Group id: + * Own + */ + HBufC* iGroupId; + + /** + * wait scheduler: + * Own + */ + CActiveSchedulerWait* iWaitScheduler; + + /** + * wait timer: + * Own + */ + CWaitTimer* iTimer; + + /** + * Presence notifier: + * Own + */ + CPresenceNotificationHandler* iNotifier; + + /** + * Recieve message handler: + * Own + */ + CReceiveMessageHandler* iRecvHandler; + + /** + * Server intiated error hanlder: + * Own + */ + COssprotocolServerErrorHandler* iServerErrorHandler; + + /** + * Add notifications handler + * Own + */ + CAddContactNotificationHandler* iAddNotificationHanlder; + + /** + * Contact synchronisation handler: + * Own + */ + CContactSyncHandler* iContactSyncHandler; + + /** + * stores data handler readyness value + * Own + */ + TBool iIsDataHandlerReady; + + /** + * Search key store + * Own + */ + CSearchKeyStore* iSearchKeyStore; + + /** + * Protocol im data host + * Doesn't own + */ + MProtocolImDataHost *iHost ; + + /** + * Protocl search data host + * Doesn't own + */ + MProtocolSearchDataHost *iSearchHost ; + + /** + * local contact manager + * own + */ + COSSContactManager* iContactManager; + /** + * service name for presence cache updation + * Own + */ + HBufC* iServiceName; +public: + /** + * Presence authorisation grant list + * Doesn't own + */ + RArray< HBufC > iPresenceAuthGrantReqList; + + + }; + + +#endif // __COSSPROTOCOLCONNECTIONMANAGER_H__ diff -r 000000000000 -r e6b17d312c8b imservices/ossprotocoladaptation/inc/cossprotocolimfeatures.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/ossprotocoladaptation/inc/cossprotocolimfeatures.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,119 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: oss presence features implementation for XIMP Framework +* +*/ + + +#ifndef __COSSPROTOCOLIMFEATURES_H__ +#define __COSSPROTOCOLIMFEATURES_H__ + +// INCLUDES +#include +#include +//#include +#include +#include +//#include +//#include +#include "cossprotocolconnectionmanager.h" + +class COSSProtocolImConversation; +/** + * COSSProtocolImFeatures + * + * OSS Protocol Connection Object. Protocol Connection Object has connection Manager. + * + */ + +class COSSProtocolImFeatures : + public CProtocolImFeatures + { + + public: + + static COSSProtocolImFeatures* NewL ( COSSProtocolConnectionManager& aConnMan ); + + + ~COSSProtocolImFeatures(); + + private: + + COSSProtocolImFeatures(COSSProtocolConnectionManager& aConnMan ); + + + void ConstructL ( COSSProtocolConnectionManager& aConnMan ); + + public: // from MXIMPBase + + TAny* GetInterface ( TInt32 aInterfaceId, + TIfGetOps aOptions ); + + const TAny* GetInterface ( TInt32 aInterfaceId, + TIfGetOps aOptions ) const; + + + TInt32 GetInterfaceId() const; + + public :// From MProtocolImFeatures + + /** + * @see MProtocolImFeatures + */ + MProtocolImGroup& ImGroup(); + /** + * @see MProtocolImFeatures + */ + MProtocolImConversation& ImConversation(); + /** + * @see MProtocolImFeatures + */ + /** + * @see MProtocolImFeatures + */ + MProtocolImInvitation& ImInvitation(); + /** + * @see MProtocolImFeatures + */ + MProtocolImSearch& ImSearch(); + /** + * @see MProtocolImFeatures + */ + void SetHost(MProtocolImDataHost& aHost ); + + TInt SupportedSubInterfaces() const; + + private : //data members + /** + * im conversation + * Own: + */ + COSSProtocolImConversation* iImConversation; + + /** + * Protocol im data hodt + * Not own: + */ + MProtocolImDataHost *iHost ; + + /** + * Connection manager + * Not own: + */ + COSSProtocolConnectionManager &iConnMan ; + }; + +#endif //__COSSPROTOCOLIMFEATURES_H__ + +// end of file \ No newline at end of file diff -r 000000000000 -r e6b17d312c8b imservices/ossprotocoladaptation/inc/cossprotocolloginrequest.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/ossprotocoladaptation/inc/cossprotocolloginrequest.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,121 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Login Request to the Network Server. +* +*/ + + + +#ifndef _COSSPROTOCOLLOGINREQUEST_H_ +#define _COSSPROTOCOLLOGINREQUEST_H_ + +// INCLUDES +#include +#include +#include +#include "ossprotocolpluginlogger.h" +#include "ossprotocloliterals.h" +// FORWARD DECLARATIONS + +class MOSSProtocolConnectionManager; + +class COSSProtocolConnectionManager; + + +const TInt KImpsMaxResourceIdLen = 64; // maximum Resource ID, this is not sure! + +/** + * COSSProtocolLoginRequest + * + * Issue Login Request to the Network Server + * + */ +NONSHARABLE_CLASS ( COSSProtocolLoginRequest ) : public CActive + + + { + +public: + + static COSSProtocolLoginRequest* NewLC ( MOSSProtocolConnectionManager& aConnMan, + TXIMPRequestId aRequestId ); + static COSSProtocolLoginRequest* NewL ( MOSSProtocolConnectionManager& aConnMan, + TXIMPRequestId aRequestId ); + virtual ~COSSProtocolLoginRequest(); + + +private: + + COSSProtocolLoginRequest ( MOSSProtocolConnectionManager& aConnMan, + TXIMPRequestId aRequestId ); + void ConstructL(); + + +private: // from CActive + + void DoCancel(); + /* + * RunL() function also deletes the request object once the activity is done + * + */ + void RunL(); + TInt RunError ( TInt aError ); + +private: // new methods + + /** + * Resource Id Generator + * Leaves with KErrNotFound if no value + * @return ResourceId + */ + TPtrC GenResourceId( const TDesC& aResourceId ); +public: + + /** + * Issue login request to the isolation server + */ + void IssueLoginRequestL(); + + +private: // data + + /** + * OWN:Request Id from ximpfw + */ + TXIMPRequestId iRequestId; + /** + * Send data request to pure data handler generates the id + */ + TInt iSendId; + /** + * OSS Protocol Plugin Connection Manager + * Not own. + */ + MOSSProtocolConnectionManager& iConnMan; + + /** + * Resource ID Implementation + * Not own. + */ + TBuf iResourceId; + + /** + * Own user id + */ + HBufC* iUserName; + }; + + +#endif // _COSSPROTOCOLLOGINREQUEST_H_ + diff -r 000000000000 -r e6b17d312c8b imservices/ossprotocoladaptation/inc/cossprotocollogoutrequest.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/ossprotocoladaptation/inc/cossprotocollogoutrequest.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,102 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Logout Request to the Network Server. +* +*/ + + + +#ifndef __COSSPROTOCOLLOGOUTREQUEST_H_ +#define __COSSPROTOCOLLOGOUTREQUEST_H_ + +// INCLUDES +#include +#include +#include +#include "ossprotocolpluginlogger.h" +#include "ossprotocloliterals.h" +// FORWARD DECLARATIONS + +class MOSSProtocolConnectionManager; + +class COSSProtocolConnectionManager; + + +/** + * COSSProtocolLogoutRequest + * + * Issue Logout Request to the Network Server + * + */ +NONSHARABLE_CLASS ( COSSProtocolLogoutRequest ) : public CActive + + + { + +public: + + static COSSProtocolLogoutRequest* NewLC ( MOSSProtocolConnectionManager& aConnMan, + TXIMPRequestId aRequestId ); + static COSSProtocolLogoutRequest* NewL ( MOSSProtocolConnectionManager& aConnMan, + TXIMPRequestId aRequestId ); + virtual ~COSSProtocolLogoutRequest(); + + +private: + + COSSProtocolLogoutRequest ( MOSSProtocolConnectionManager& aConnMan, + TXIMPRequestId aRequestId ); + void ConstructL(); + + +private: // from CActive + + void DoCancel(); + /* + * RunL() function also deletes the request object once the activity is done + * + */ + void RunL(); + TInt RunError ( TInt aError ); + +public: + /** + * Issue logout request to the isolation server + */ + void IssueLogoutRequestL(); + + +private: // data + + /** + * Request Id + * OWN + */ + TXIMPRequestId iRequestId; + /** + * OSS Protocol Plugin Connection Manager + * Not own. + */ + MOSSProtocolConnectionManager& iConnMan; + + /** + * Send data request to pure data handler generates the id + */ + TInt iSendId; + + }; + + +#endif // __COSSPROTOCOLLOGOUTREQUEST_H_ + diff -r 000000000000 -r e6b17d312c8b imservices/ossprotocoladaptation/inc/cossprotocolplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/ossprotocoladaptation/inc/cossprotocolplugin.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,118 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: adaptation for open source +* +*/ + + +#ifndef __COSSPROTOCOLPLUGIN_H__ +#define __COSSPROTOCOLPLUGIN_H__ + +// INCLUDES +#include +#include + +// FORWARD DECLARATIONS + +class MXIMPServiceInfo; + +class MXIMPContextClientInfo; + +class COSSProtocolConnection; + +class CProcessLauncher; + + + + +/** + * OSS protocol Plugin + * + * OSS plugin is ECOM plugin and shall be loaded by PrFw. + * OSS has one or many connections. + */ + +class COSSProtocolPlugin : public CXIMPProtocolPluginBase + { + + public: + + static COSSProtocolPlugin* NewL(); + static COSSProtocolPlugin* NewLC(); + + ~COSSProtocolPlugin(); + + private: + + COSSProtocolPlugin(); + void ConstructL(); + + public: // From MXIMPProtocolPlugin + + /** + * @see MXIMPProtocolPlugin + */ + void PrimeHost ( MXIMPProtocolPluginHost& aHost ); + /** + * @see MXIMPProtocolPlugin + */ + MXIMPProtocolConnection& AcquireConnectionL ( + const MXIMPServiceInfo& aServiceInfo, + const MXIMPContextClientInfo& aClientCtxInfo ); + /** + * @see MXIMPProtocolPlugin + */ + void ReleaseConnection ( + MXIMPProtocolConnection& aConnection ); + + public: // from MXIMPBase + /** + * @see MXIMPBase + */ + TAny* GetInterface ( + TInt32 aInterfaceId, + TIfGetOps aOptions ); + /** + * @see MXIMPBase + */ + const TAny* GetInterface ( + TInt32 aInterfaceId, + TIfGetOps aOptions ) const; + /** + * @see MXIMPBase + */ + TInt32 GetInterfaceId() const; + + private: // Data + /** + * Prime host + * Not own. + */ + MXIMPProtocolPluginHost* iHost; + /** + * protocol connections + * Own. + */ + RPointerArray< COSSProtocolConnection > iConnections; + + /** + * process launcher.launches isolation server + * Own. + */ + CProcessLauncher *iIsoServerLauncher; + + + }; + +#endif // __COSSPROTOCOLPLUGIN_H__ diff -r 000000000000 -r e6b17d312c8b imservices/ossprotocoladaptation/inc/cossprotocolpresencefeatures.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/ossprotocoladaptation/inc/cossprotocolpresencefeatures.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,121 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: oss presence features implementation for XIMP Framework +* +*/ + + +#ifndef __COSSPROTOCOLPRESENCERFEATURES_H__ +#define __COSSPROTOCOLPRESENCERFEATURES_H__ + +// INCLUDES +#include +#include +#include +#include +#include +#include +#include "cossprotocolconnectionmanager.h" +class COSSProtocolPresentityGroups; +class COSSProtocolpresentitygroups; +class COssProtocolPresencePublishing; +class COssProtocolPresenceAuthorization; +/** + * COSSProtocolPresenceFeatures + * + * COSSProtocolPresenceFeatures provide + * access following feature specific sub-interfaces: + * - MProtocolPresenceWatching + * - MProtocolPresencePublishing + * - MProtocolPresentityGroups + * - MProtocolPresenceAuthorization + * + */ +class COSSProtocolPresenceFeatures : + public CBase, + public MProtocolPresenceFeatures + { + + public: + + static COSSProtocolPresenceFeatures* NewL( COSSProtocolConnectionManager& aConnMan ); + + + ~COSSProtocolPresenceFeatures(); + + private: + + COSSProtocolPresenceFeatures(); + + + void ConstructL( COSSProtocolConnectionManager& aConnMan ); + + public: // from MXIMPBase + /** + * @see MXIMPBase + */ + TAny* GetInterface( TInt32 aInterfaceId, + TIfGetOps aOptions ); + /** + * @see MXIMPBase + */ + const TAny* GetInterface( TInt32 aInterfaceId, + TIfGetOps aOptions ) const; + + /** + * @see MXIMPBase + */ + TInt32 GetInterfaceId() const; + + public : // From MProtocolPresenceFeatures + + /** + * @see MProtocolPresenceFeatures + */ + MProtocolPresenceWatching& PresenceWatching(); + /** + * @see MProtocolPresenceFeatures + */ + MProtocolPresencePublishing& PresencePublishing(); + /** + * @see MProtocolPresenceFeatures + */ + MProtocolPresentityGroups& PresentityGroups(); + /** + * @see MProtocolPresenceFeatures + */ + MProtocolPresenceAuthorization& PresenceAuthorization(); + + private : //data members + /** + * presentity group + * Own + */ + COSSProtocolpresentitygroups* iPresentityGroups; + /** + * presence publishing + * Own + */ + COssProtocolPresencePublishing* iPresencePublishing; + /** + * presence authorisation + * Own + */ + COssProtocolPresenceAuthorization* iAuthrozation; + + }; + +#endif //__COSSPROTOCOLPRESENCERFEATURES_H__ + +// end of file \ No newline at end of file diff -r 000000000000 -r e6b17d312c8b imservices/ossprotocoladaptation/inc/cossprotocolsearchfeatures.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/ossprotocoladaptation/inc/cossprotocolsearchfeatures.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,95 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: oss search features implementation for XIMP Framework +* +*/ + + +#ifndef __COSSPROTOCOLSEARCHFEATURE_H__ +#define __COSSPROTOCOLSEARCHFEATURE_H__ + +// INCLUDES +#include +#include +#include +#include "cossprotocolconnectionmanager.h" + + +class COSSProtocolSearch; + +/** + * COSSProtocolSearchFeature + * Provides access to subinterface MProtocolSearch + * and sets the search data host + * + */ + +class COSSProtocolSearchFeature : public CBase, + public MProtocolSearchFeature + + { + + public: + + static COSSProtocolSearchFeature* NewL ( COSSProtocolConnectionManager& aConnMan ); + + + ~COSSProtocolSearchFeature(); + + private: + + COSSProtocolSearchFeature(COSSProtocolConnectionManager& aConnMan ); + + + void ConstructL ( COSSProtocolConnectionManager& aConnMan ); + + public: // from MXIMPBase + + TAny* GetInterface ( TInt32 aInterfaceId, + TIfGetOps aOptions ); + + const TAny* GetInterface ( TInt32 aInterfaceId, + TIfGetOps aOptions ) const; + + + TInt32 GetInterfaceId() const; + + public : // From MProtocolSearchFeature.for comments,see MProtocolSearchFeature + + /** + * @see MProtocolSearchFeature + */ + MProtocolSearch& Search(); + /** + * @see MProtocolSearchFeature + */ + void SetHost(MProtocolSearchDataHost& aSearchHost ); + + private : //data members + /** + * search + * owned + */ + COSSProtocolSearch* iSearch; + + /** + * connection manager + * not owned + */ + COSSProtocolConnectionManager &iConnMan ; + }; + +#endif //__COSSPROTOCOLSEARCHFEATURE_H__ + +// end of file \ No newline at end of file diff -r 000000000000 -r e6b17d312c8b imservices/ossprotocoladaptation/inc/cossprotocolservererrorhandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/ossprotocoladaptation/inc/cossprotocolservererrorhandler.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,96 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: implementation of server error notification handler +* +*/ + + +#ifndef __COssprotocolServerErrorHandler_H__ +#define __COssprotocolServerErrorHandler_H__ + + +// INCLUDES +#include +#include + +#include +#include + +// FORWARD DECLARATIONS + +class MOSSProtocolConnectionManager; + +/** + * COssprotocolServerErrorHandler + * + * Handles network server intiated errors + * + */ + +class COssprotocolServerErrorHandler: public CActive + + + { + + public: + + static COssprotocolServerErrorHandler* NewL ( + MOSSProtocolConnectionManager& aConnMan + ); + + static COssprotocolServerErrorHandler* NewLC ( + MOSSProtocolConnectionManager& aConnMan + ); + + virtual ~COssprotocolServerErrorHandler(); + + private: + + COssprotocolServerErrorHandler ( MOSSProtocolConnectionManager& aConnMan ); + void ConstructL(); + + private: // from CActive + + void DoCancel(); + void RunL(); + TInt RunError ( TInt aError ); + + public: + /** + * start listening for server intiated error signals + */ + void StartListeningL(); + /** + * Handles the recieved error signal + */ + void ProcessIncomingDataL(); + + private: // data + + /** + * Send data request to pure data handler generates the id + */ + TInt iSendId; + + /** + * Oss Protocol Plugin Connection Manager + * Not own. *** Write "Not own" if some other class owns this object. + */ + MOSSProtocolConnectionManager& iConnMan; + + }; + + +#endif // __COssprotocolServerErrorHandler_H__ + diff -r 000000000000 -r e6b17d312c8b imservices/ossprotocoladaptation/inc/cosssenddataoperation.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/ossprotocoladaptation/inc/cosssenddataoperation.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,128 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Send data operation holder +* +*/ + +#ifndef __COSSSENDDATAOPERATION_H__ +#define __COSSSENDDATAOPERATION_H__ + +// INCLUDES +#include +#include "ossprotocolpluginlogger.h" +#include + + +/** + * COssSendDataOperation: + * Send data operation holder + * + */ +NONSHARABLE_CLASS ( COssSendDataOperation ) : + public CBase + { + +public: + + static COssSendDataOperation* NewLC(); + + /** + * Default constructor + */ + COssSendDataOperation(); + + /** + * Destructor + */ + ~COssSendDataOperation(); + + +public: // new function of the class + + + /** + * Set ids, operation and log id + */ + void SetIds ( TInt aOperationId, TInt aLogId ); + + /** + * Set request status + */ + void SetRequestStatus ( TRequestStatus& aStatus ); + + + /** + * request status of this operation + * @return Trequest status of this operation + */ + TRequestStatus* Status(); + + /** + * Get Ids + * + * @return operation Id + */ + TInt OperationId() const; + + /** + * Complete operation + * + * @param aCode complete code + */ + void CompletedOperation ( TInt aCode ); + + /** + * Set response buffer + * Owner ship is transfered + * @param aBuff response buffer + */ + void SetResponse ( char* aBuff ); + + /** + * Response buffer, + * owner ship is transfered + * @return transfer buffer + */ + char* Response(); + +private: // Public data + + /** + * Status of the operation + */ + TRequestStatus* iStatus; + + /** + * Operation Id + * OWN + */ + TInt iOpId; + + /** + * Response buffer + * OWN + */ + char* iData; + /** + * Id used for logs writting + * OWN + */ + TInt iLogId; + }; + + + +#endif // __COSSSENDDATAOPERATION_H__ + +// End of File diff -r 000000000000 -r e6b17d312c8b imservices/ossprotocoladaptation/inc/cuserafter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/ossprotocoladaptation/inc/cuserafter.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,150 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Active object based wait. +* +*/ + +#ifndef CUSERAFTER_H__ +#define CUSERAFTER_H__ + +// INCLUDES +#include + + +// CLASS DESCRIPTION + +/** + * Active object based wait. + * + * Similar like User::After() but doesn't block + * whole thread, but current RunL() with + * CActiveSchedulerWait. + */ + +class CUserAfter : public CTimer + { + + public: //Construction + static inline CUserAfter* NewL(); + static inline CUserAfter* NewLC(); + ~CUserAfter(); + + + public: //Wait support + + /** + * Static "one shot" wait method. + */ + static inline void AfterL ( TInt aWaitTimeMicroSeconds ); + + /** + * Member wait method. + */ + inline void After ( TInt aWaitTimeMicroSeconds ); + + + private: + CUserAfter(); + + void RunL(); + void RunError(); + void DoCancel(); + + + private: //data + + /** + * ActiveSchedulerWait + * Own + */ + CActiveSchedulerWait iWait; + + }; + + + + +// ----------------------------------------------------------------------------- +// CUserAfter public functions +// ----------------------------------------------------------------------------- +// +inline CUserAfter* CUserAfter::NewL() + { + CUserAfter* self = CUserAfter::NewLC(); + CleanupStack::Pop ( self ); + return self; + } + +inline CUserAfter* CUserAfter::NewLC() + { + CUserAfter* self = new ( ELeave ) CUserAfter(); + CleanupStack::PushL ( self ); + self->ConstructL(); + return self; + } + + +inline CUserAfter::~CUserAfter() + { + CTimer::Cancel(); + } + +inline void CUserAfter::After ( TInt aWaitTimeMicroSeconds ) + { + CTimer::After ( aWaitTimeMicroSeconds ); + iWait.Start(); + } + + +inline void CUserAfter::AfterL ( TInt aWaitTimeMicroSeconds ) + { + CUserAfter* after = CUserAfter::NewL(); + after->After ( aWaitTimeMicroSeconds ); + delete after; + } + + + +// ----------------------------------------------------------------------------- +// CUserAfter private functions +// ----------------------------------------------------------------------------- +// +inline CUserAfter::CUserAfter() + : CTimer ( CActive::EPriorityStandard ) + { + CActiveScheduler::Add ( this ); + } + + +inline void CUserAfter::RunL() + { + iWait.AsyncStop(); + Cancel(); + } + +inline void CUserAfter::RunError() + { + } + +inline void CUserAfter::DoCancel() + { + iWait.AsyncStop(); + CTimer::DoCancel(); + } + + +#endif // CUSERAFTER_H__ + +// End of File + diff -r 000000000000 -r e6b17d312c8b imservices/ossprotocoladaptation/inc/im/cossprotocolimconversation.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/ossprotocoladaptation/inc/im/cossprotocolimconversation.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,135 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Oss protocol im conversation +* +*/ + +#ifndef COSSPROTOCOLIMCONVERSATION_H__ +#define COSSPROTOCOLIMCONVERSATION_H__ + + +#include +#include + + +class MOSSProtocolConnectionManager; + + +/** + * COSSProtocolImConversation + * implements MProtocolImConversation methods + * these methods will called by ximp framework + */ +class COSSProtocolImConversation : public CBase, + public MProtocolImConversation + { + +public: + + static COSSProtocolImConversation* NewL( MOSSProtocolConnectionManager& aConnManager ); + ~COSSProtocolImConversation(); + + +private: + + COSSProtocolImConversation( MOSSProtocolConnectionManager& aConnManager ); + void ConstructL(); + +public: //from MXIMPBase + + /** + * @see MXIMPBase + */ + TAny* GetInterface( TInt32 aInterfaceId, + TIfGetOps aOptions ); + /** + * @see MXIMPBase + */ + const TAny* GetInterface( TInt32 aInterfaceId, + TIfGetOps aOptions ) const; + + /** + * @see MXIMPBase + */ + TInt32 GetInterfaceId() const; + +public: // From MProtocolImConversation + /** + * @see MProtocolImConversation + */ + void DoSendMessageL( + const MImConversationInfo& aImMessage, + TXIMPRequestId aReqId ); + /** + * @see MProtocolImConversation + */ + void DoForwardMessageL( + const MImConversationInfo& aImMessage, + TXIMPRequestId aReqId); + /** + * @see MProtocolImConversation + */ + void DoSendMessageToGroupL( + const MImConversationInfo& aImMessage, + const TDesC* aGroupId,TXIMPRequestId aReqId ); + /** + * @see MProtocolImConversation + */ + TXIMPRequestId DoBlockUsersL( + const MDesCArray* aUserIds, + TXIMPRequestId aReqId); + /** + * @see MProtocolImConversation + */ + TXIMPRequestId DoUnBlockUsersL( + const MDesCArray* aUserIds, + TXIMPRequestId aReqId ); + /** + * @see MProtocolImConversation + */ + void DoGetBlockedListRequestL( + const MXIMPIdentity& aImMessageId, + TXIMPRequestId aReqId ); + /** + * @see MProtocolImConversation + */ + void DoGetMessageListL( + const MXIMPIdentity& aImMessageId, + const TDesC* aGroupId, + const TInt aMessageCount, + TBool aDeliveryReportWanted, + TXIMPRequestId aReqId); + /** + * @see MProtocolImConversation + */ + void DoRejectMessageL( + const MXIMPIdentity& aImMessageId, + const TDesC& aMessageID, + TXIMPRequestId aReqId ); +private: + /** + * Creates data handler + */ + void CreateDataHandlerL(); + +private: // data members + /** + * Oss Protocol Plugin Connection Manager + * Not own. *** Write "Not own" if some other class owns this object. + */ + MOSSProtocolConnectionManager& iConnMan; + + }; + +#endif // COSSPROTOCOLIMCONVERSATION_H__ diff -r 000000000000 -r e6b17d312c8b imservices/ossprotocoladaptation/inc/im/cosssendmessagerequest.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/ossprotocoladaptation/inc/im/cosssendmessagerequest.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,107 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Oss Protocol send massage request +* +*/ + + +#ifndef __COSSSENDMESSAGEREQUEST_H__ +#define __COSSSENDMESSAGEREQUEST_H__ + + +// INCLUDES +#include +#include +#include "ossprotocolpluginlogger.h" +#include "ossprotocloliterals.h" + +// FORWARD DECLARATIONS + +class MOSSProtocolConnectionManager; + +class MImConversationInfo; +/** + * COSSSendMessageRequest + * + * Issue Send Message Request to Network Server + * + */ + +class COSSSendMessageRequest: public CActive + + + { + + public: + + static COSSSendMessageRequest* NewL ( + MOSSProtocolConnectionManager& aConnMan, + TXIMPRequestId aRequestId ); + + static COSSSendMessageRequest* NewLC ( + MOSSProtocolConnectionManager& aConnMan, + TXIMPRequestId aRequestId ); + + virtual ~COSSSendMessageRequest(); + + private: + + COSSSendMessageRequest ( + MOSSProtocolConnectionManager& aConnMan, + TXIMPRequestId aRequestId ); + void ConstructL(); + + private: // from CActive + + void DoCancel(); + /* + * RunL() function also deletes the request object once the activity is done + * + */ + void RunL(); + TInt RunError ( TInt aError ); + + public: + /** + * Send message to the recipients + * @param aImMessage stucture stores message,recipients + */ + void SendMessageL ( const MImConversationInfo& aImMessage ); + + private: // data + + /** + * Request Id from ximpfw + */ + TXIMPRequestId iRequestId; + /** + * Send data request to pure data handler generates the id + */ + TInt iSendId; + /** + * list id + * Own + */ + HBufC16* iListId; + /** + * Oss Protocol Plugin Connection Manager + * Not own. *** Write "Not own" if some other class owns this object. + */ + MOSSProtocolConnectionManager& iConnMan; + + }; + + +#endif // __COSSSENDMESSAGEREQUEST_H__ + diff -r 000000000000 -r e6b17d312c8b imservices/ossprotocoladaptation/inc/im/creceivemessagehandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/ossprotocoladaptation/inc/im/creceivemessagehandler.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,95 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of reicive message handler +* +*/ + + +#ifndef __CRECEIVEMESSAGEHANDLER_H__ +#define __CRECEIVEMESSAGEHANDLER_H__ + + +// INCLUDES +#include +#include + + + +// FORWARD DECLARATIONS + +class MOSSProtocolConnectionManager; + +/** + * CReceiveMessageHandler + * + * Handles the messages recieved. + * updates imfeature plugin data model and + * triggers event + * + */ + +class CReceiveMessageHandler: public CActive + + + { + + public: + + static CReceiveMessageHandler* NewL ( + MOSSProtocolConnectionManager& aConnMan + ); + + + virtual ~CReceiveMessageHandler(); + + private: + + CReceiveMessageHandler ( MOSSProtocolConnectionManager& aConnMan ); + void ConstructL(); + + private: // from CActive + + void DoCancel(); + void RunL(); + TInt RunError ( TInt aError ); + + public: + + /** + * start listening recieved massages + */ + void StartListeningL(); + /** + * parse the data and update the data cache of ximp.send event back to ximp + */ + void ProcessIncomingDataL(); + + private: // data + + /** + * Send data request to pure data handler generates the id + */ + TInt iSendId; + + /** + * Oss Protocol Plugin Connection Manager + * Not own. *** Write "Not own" if some other class owns this object. + */ + MOSSProtocolConnectionManager& iConnMan; + + }; + + +#endif // __CRECEIVEMESSAGEHANDLER_H__ + diff -r 000000000000 -r e6b17d312c8b imservices/ossprotocoladaptation/inc/mossprotocolconnectionmanager.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/ossprotocoladaptation/inc/mossprotocolconnectionmanager.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,128 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: oss protocol plugin connection manager interface +* +*/ + +#ifndef __MOSSCONNNECTIONMANAGERCONTROL_H__ +#define __MOSSCONNNECTIONMANAGERCONTROL_H__ + + +// FORWARD DECLARATIONS + +class MXIMPProtocolConnectionHost; +class CXmppParameters; +class CWaitTimer; +class MProtocolImDataHost; +class MProtocolSearchDataHost; +class CSearchKeyStore; +class CAddContactNotificationHandler; +class COSSContactManager; +/** + * MOSSProtocolConnectionManager + * + * Telepathy Plugin Connection Manager's Interface + * + */ +class MOSSProtocolConnectionManager + { + +public: + + /** + * ?description + * + * access to xmpp settings + * @return handle to xmppparameter + */ + virtual CXmppParameters& XmppParams() = 0; + /** + * access to protocol data handler + * @return protocol data handler + */ + virtual CWaitTimer& DataHandler() = 0; + /** + * access to protocol connection host + * @return protocol connection host + */ + virtual MXIMPProtocolConnectionHost& HandleToHost() = 0; + /** + * creates datahanlder + * @return access point + * + */ + virtual void ManufactureDataHandlerL() = 0; + /** + * check the data handler creation + * @return ETrue,if datahandler created,else EFalse + */ + + virtual TDesC& UserName() = 0; + /** + * + * @return Passwor + */ + virtual TDesC& Password() = 0; + /** + * @return GroupId + */ + virtual TDesC& GroupId() =0 ; + /** + * @return ServiceName + */ + virtual const TDesC& ServiceName() = 0; + /** + * sets the groupid + * @param aGroupId : group id to be set + */ + virtual void SetGroupIDL(TDesC& aGroupId) = 0; + /** + * gets the contactmanager + * @return iContactManager + */ + virtual COSSContactManager& GetContactManager() = 0; + /** + * @return authorised list + */ + virtual RArray* PresenceAuthGrantReqList() = 0; + /** + * @return im data host + */ + virtual MProtocolImDataHost& GetImHost() = 0; + /** + * @return add notification handler + */ + virtual CAddContactNotificationHandler& GetAddNotificationHandler() = 0; + /** + * @return search data host + */ + virtual MProtocolSearchDataHost& GetSearchHost() = 0; + /** + * @return search key store + */ + virtual CSearchKeyStore& GetSearchKeyStore() = 0; + +protected: + + /** + * Protected destructor. + * Instancies can't be destroyed via this interface. + */ + virtual ~MOSSProtocolConnectionManager() {} + + }; + +#endif // __MOSSCONNNECTIONMANAGERCONTROL_H__ + + diff -r 000000000000 -r e6b17d312c8b imservices/ossprotocoladaptation/inc/mossprotocolstatusobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/ossprotocoladaptation/inc/mossprotocolstatusobserver.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,61 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Access handler of one network session +* +*/ + +#ifndef __MOSSPROTOCOLSTATUSOBSERVER_H +#define __MOSSPROTOCOLSTATUSOBSERVER_H + + +// INCLUDES +#include + +/** + * Access handler of one network session + * + * It is used to open/close network session + * and register its observers + * + */ +class MPEngSessionStatusObserver + { + + public: // + + /** + * Handle Session status change + * + * @param new session slot state + * @param new session slot event + */ + virtual void StatusChangedL(/* TPEngNWSessionSlotState aNewState, + TPEngNWSessionSlotEvent aNewEvent*/ ) = 0; + + + protected: //Destructor + + /** + * Protected destructor to prohibits deletion trough interface. + */ + virtual ~MPEngSessionStatusObserver() {}; + }; + + +#endif // __MOSSPROTOCOLSTATUSOBSERVER_H + +// End of File + + + diff -r 000000000000 -r e6b17d312c8b imservices/ossprotocoladaptation/inc/ossadappanics.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/ossprotocoladaptation/inc/ossadappanics.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,80 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: oss adapter plugin panics +* +*/ + +#ifndef __OSSADAPPANICS_H__ +#define __OSSADAPPANICS_H__ + +// INCLUDES +#include + +// CONSTANTS +/** +* Oss Adaptation Library panic category. +*/ +_LIT ( KOssAdapPanic, "OssAdaptation" ); + +/** +* OSS Adaptation Library Auth interface +*/ + +_LIT ( KOssProtocolPresenceAuthorization, "CImpsProtocolPresenceAuthorization" ); + +/** +* OSS Adaptation Library Publishing panic category +*/ + +_LIT ( KOssProtocolPresencePublishing, "CImpsProtocolPresencePublishing" ); + +/** +* Oss adapter Library watching panic category. +*/ + +_LIT ( KOssProtocolPresenceWatching, "CImpsProtocolPresenceWatching" ); + +/** +* Oss adapter Library groups panic category. +*/ + +_LIT ( KOssProtocolPresentityGroups, "CImpsProtocolPresentityGroups" ); + +/** +* OSS adapter plugin library panic reasons. +* +* Following panic reasons are used in +* oss adapter plugin library panics. +* +* @since 3.0 +*/ +enum TOssAdapterPluginPanics + { + ESesionConsistencyLost = 1, + EOpIdConsistencyLost = 2, + ENoActiveOperations = 3, + EUnknownUnumeration = 4, + EReferenceCountUnderflow = 5, + EIlegalSingletonDeletion = 6, + EUnknowPureData = 7, + EListenerAlreadyActive = 8, + ELogInDataNotValid = 9 + + }; + + +#endif //__OSSADAPPANICS_H__ + +// End of File + diff -r 000000000000 -r e6b17d312c8b imservices/ossprotocoladaptation/inc/ossprotocloliterals.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/ossprotocoladaptation/inc/ossprotocloliterals.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,53 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: OSS adapter plugin +* +*/ + +#ifndef __OSSPROTOCOLLITERALS_H__ +#define __OSSPROTOCOLLITERALS_H__ + +#include + +#define CONNMGR_BUS "org.freedesktop.Telepathy.ConnectionManager.gabble" +#define CONNMGR_PATH "/org/freedesktop/Telepathy/ConnectionManager/gabble" +#define PROTOCOL "jabber" +#define TP_IFACE_CONN_MGR_INTERFACE \ + "org.freedesktop.Telepathy.ConnectionManager" +#define TestId "mytest" +#define ServerStr "server" +#define ResourceStr "resource" +#define AccountStr "account" +#define PasswdStr "password" +#define PortStr "port" +#define OldsslStr "old-ssl" +#define PORT 443 + +_LIT(KOSSProtocolConnection, "COSSProtocolConnection"); +_LIT8(KConnectionFeature, "telepathy/connection "); +_LIT( KZeroId, "0" ); +_LIT(KSlash,"/"); +_LIT(KEnd,"\0"); + +enum TRegRespState + { + ERequestDelivered = 0, + EResponseRecieved + }; + + +#endif //__OSSPROTOCOLLITERALS_H__ + +// End of File + diff -r 000000000000 -r e6b17d312c8b imservices/ossprotocoladaptation/inc/ossprotocoladaptationuids.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/ossprotocoladaptation/inc/ossprotocoladaptationuids.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: OSSProtocolAdaptationUids +* NOTE!! Don't change / edit any UID values!!! +* +*/ + +#ifndef __OSSPROTOCOLADAPTATIONUIDS_H_ +#define __OSSPROTOCOLADAPTATIONUIDS_H_ +// MACROS + +//Uid2:s +#define KEComRecognitionDllUid2 0x10009D8D // CSI: 8 # + +//Uid3:s +#define KEComRecognitionDllUid3 0x101FB3E7 // 0x10282EE9 + + + +#endif // __OSSPROTOCOLADAPTATIONUIDS_H_ + diff -r 000000000000 -r e6b17d312c8b imservices/ossprotocoladaptation/inc/ossprotocoladaptutils.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/ossprotocoladaptation/inc/ossprotocoladaptutils.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,60 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Utils for IOSSProtocolAdaptation +* +*/ + + +#ifndef __OSSPROTOCLADAPUTILS_H__ +#define __OSSPROTOCLADAPUTILS_H__ + +// INCLUDES +#include +#include + +struct charFormatData + { + char* data; + TInt dataSize;//this also includes '/0'. + }; +/** + * Utils for OSSProtocolAdaptation modules. + */ +class OssProtocolAdapUtils + { + public: // new methods + + /** + * utility method to convert from char to unsigned int + * @param1 pmSrc: source + * @return pointer to unsigned int + */ + static HBufC16* ConvertCharToTUint16LC( const char *pcSrc); + /** + * utility method to convert from unsigned int to char + * @param1 pmSrc: source + * @return structure charFormatData, contains data and size + */ + static charFormatData ConvertTUint16ToCharLC( const TDesC &aData ); + /** + * utility method to convert from tdesc8 to char + * @param1 aSrc: source + * @param aDes: destination + */ + static void ConvertTDesC8toChar(const TDesC8& aSrc, char* aDes); + }; + +#endif // __OSSPROTOCLADAPUTILS_H__ + +// End of File diff -r 000000000000 -r e6b17d312c8b imservices/ossprotocoladaptation/inc/ossprotocolpluginerrors.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/ossprotocoladaptation/inc/ossprotocolpluginerrors.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,56 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: OSs adapter plugin errors +* +*/ + +#ifndef __OSSPROTOCOLPLUGINERRORS_H__ +#define __OSSPROTOCOLPLUGINERRORS_H__ + +// INCLUDES +#include +/** +* Mapping xmpp protocl errors with ximpfw +* +*/ +/** + * Xmpp protocol error codes. + * + * Xmpp status codes received from network transactions + * are translated into Xmpp error code range + * with following mapping: + * = KOssAdapBaseErrorXmppServerResponseBase - + * NOTE!! Mapping algorithm above and error symbols defined + * below are in sync with algorithm used by the Xmpp protocol. + */ +enum + { + KOssAdapBaseErrorXmppServerResponseBase = -10000, + KOssAdapBaseErrorXmppServerLoginResponseBase = -11000, + KOssAdapBaseErrorXmppServerContactResponseBase = -12000, + KOssAdapBaseErrorXmppServerContactListResponseBase = -13000, + KOssAdapBaseErrorXmppServerPresenceResponseBase = -14000, + KOssAdapBaseErrorXmppServerSendMessageResponseBase = -15000, + KOssAdapBaseErrorXmppServerReceiveMessageResponseBase = -16000, + KOssAdapBaseErrorXmppServerLogoutResponseBase = -17000, + KOssAdapBaseErrorMessageQueueResponseBase = -18000, + + KOssAdapErrMsgQueueCreate = KOssAdapBaseErrorMessageQueueResponseBase - 100, + KOssAdapErrMsgQueueSend = KOssAdapBaseErrorMessageQueueResponseBase - 101, + + + KOssadapErrInvalidSettingsId = KOssAdapBaseErrorXmppServerLoginResponseBase - 800, + }; + +#endif //__OSSPROTOCOLPLUGINERRORS_H__ diff -r 000000000000 -r e6b17d312c8b imservices/ossprotocoladaptation/inc/ossprotocolpluginlogger.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/ossprotocoladaptation/inc/ossprotocolpluginlogger.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,61 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Logger implementation +* +*/ + + +#ifndef __TLOGGER_H__ +#define __TLOGGER_H__ + +// INCLUDES +#include + +//#ifdef _DEBUG +#define ENABLE_DEBUG_LOGS +//#endif + +/** +* Usage of Log MACRO'S +* _LIT( KExample, "Example" ); +* TXT(s) _L(s) +* LOGGER(TXT("Some text.") ); +* LOGGER(TXT("Some text: %d"), 100 ); +* LOGGER(TXT("Some text: %S"), &KExample ); +*/ + +_LIT( KTAdaptDebugOutputDir, "os" ); +_LIT( KTAdaptDebugOutputFileName, "ossadapt.txt" ); +const TInt KTAdaptMaxLogLineLength = 250 ; +//#ifdef _DEBUG + +#define TXT(s) _L(s) +#define LOGGER TLogger::WriteLog +#define PLUGIN_UNUSED_PARAM(p) (void) p +//#endif + +/** + * OSS Protocol Adaptation logger. + */ +class TLogger + { + public: //Logging functions + static void WriteLog( TRefByValue aFmt,... ); + private: //Prohibited construtor / destructor + TLogger(); + ~TLogger(); + }; +#endif //__TLOGGER_H__ + +// End of File diff -r 000000000000 -r e6b17d312c8b imservices/ossprotocoladaptation/inc/ossprotocolpluginpanics.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/ossprotocoladaptation/inc/ossprotocolpluginpanics.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,89 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: OSs adapter plugin panics +* +*/ + +#ifndef __OSSPROTOCOLPLUGINPANICS_H__ +#define __OSSPROTOCOLPLUGINPANICS_H__ + +// INCLUDES +#include + + +// CONSTANTS +/** +* OSS Adaptation Library panic category. +*/ +_LIT( KOSSProtocolPluginPanic, "OSSProtocolPlugin" ); + +/** +* OSS Adaptation Library Auth interface +*/ + +_LIT(KOSSProtocolPresenceAuthorization, "COSSProtocolPresenceAuthorization"); + +/** +* OSS Adaptation Library Publishing interface +*/ + +_LIT(KOSSProtocolPresencePublishing, "COSSProtocolPresencePublishing"); + +/** +* OSS Adaptation Library watching interface. +*/ + +_LIT(KOSSProtocolPresenceWatching, "COSSProtocolPresenceWatching"); + +/** +* OSS Adaptation Library panic presentity groups interface. +*/ + +_LIT(KOSSProtocolPresentityGroups, "COSSProtocolPresentityGroups"); + +/** +* OSS Adaptation Library panic conversation interface. +*/ + +_LIT(KOSSProtocolConversation, "COSSProtocolImConversation"); + + +/** +* Telepathy adapter plugin library panic reasons. +* +* Following panic reasons are used in +* OSS adapter plugin library panics. +* +* @since 3.0 +*/ +enum TOSSAdapterPluginPanics + { + ESesionConsistencyLost = 1, + EOpIdConsistencyLost = 2, + ENoActiveOperations = 3, + EUnknownUnumeration = 4, + EReferenceCountUnderflow = 5, + EIlegalSingletonDeletion = 6, + EAccessHandlerObserversUnregistered = 7, + EUnknowPureData = 8, + EListenerAlreadyActive = 9, + ELogInDataNotValid = 10 + + }; + + +#endif //__OSSPROTOCOLPLUGINPANICS_H__ + +// End of File + diff -r 000000000000 -r e6b17d312c8b imservices/ossprotocoladaptation/inc/presenceauthorization/cossprotocolpresenceauthorization.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/ossprotocoladaptation/inc/presenceauthorization/cossprotocolpresenceauthorization.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,229 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Oss Protocol implementation for Presence Framework +* +*/ + + +#ifndef __COSSPROTOCLPRESENCEAUTHORISATION_H_ +#define __COSSPROTOCLPRESENCEAUTHORISATION_H_ + + +// INCLUDES +#include +#include +#include +#include + + + +// FORWARD DECLARATIONS + +class MXIMPServiceInfo; +class MOSSProtocolConnectionManager; + + +/** + * COssProtocolPresenceAuthorization + * + * Oss Protocol Authorization Request Handling + * + */ + +class COssProtocolPresenceAuthorization: + public CBase, + public MProtocolPresenceAuthorization + { +public: + + static COssProtocolPresenceAuthorization* NewL(MOSSProtocolConnectionManager& aConnManager); + + + ~COssProtocolPresenceAuthorization(); + + +private: + + COssProtocolPresenceAuthorization(MOSSProtocolConnectionManager& aConnManager); + + + void ConstructL(); + +public: // from MXIMPBase + + /** + * @see MXIMPBase + */ + TAny* GetInterface( TInt32 aInterfaceId, + TIfGetOps aOptions ); + /** + * @see MXIMPBase + */ + const TAny* GetInterface( TInt32 aInterfaceId, + TIfGetOps aOptions ) const; + /** + * @see MXIMPBase + */ + TInt32 GetInterfaceId() const; + +public: //from MProtocolPresenceAuthorization + + /** + * @see MProtocolPresenceAuthorization + */ + void DoSubscribePresenceGrantRequestListL( + TXIMPRequestId aReqId ); + /** + * @see MProtocolPresenceAuthorization + */ + void DoUnsubscribePresenceGrantRequestListL( + TXIMPRequestId aReqId ); + +public: // Granting presence information access to single presentities + + /** + * @see MProtocolPresenceAuthorization + */ + void DoGrantPresenceForPresentityL( + const MXIMPIdentity& aPresentityId, + const MPresenceInfoFilter& aPif, + TXIMPRequestId aReqId ); + /** + * @see MProtocolPresenceAuthorization + */ + void DoUpdatePresenceGrantPifForPresentityL( + const MXIMPIdentity& aPresentityId, + const MPresenceInfoFilter& aPif, + TXIMPRequestId aReqId ); + /** + * @see MProtocolPresenceAuthorization + */ + void DoWithdrawPresenceGrantFromPresentityL( + const MXIMPIdentity& aPresentityId, + TXIMPRequestId aReqId ); + +public: // Granting presence information access to presentity group members + + /** + * @see MProtocolPresenceAuthorization + */ + void DoGrantPresenceForPresentityGroupMembersL( + const MXIMPIdentity& aGroupId, + const MPresenceInfoFilter& aPif, + TXIMPRequestId aReqId ); + /** + * @see MProtocolPresenceAuthorization + */ + void DoUpdatePresenceGrantPifForPresentityGroupMembersL( + const MXIMPIdentity& aGroupId, + const MPresenceInfoFilter& aPif, + TXIMPRequestId aReqId ); + /** + * @see MProtocolPresenceAuthorization + */ + void DoWithdrawPresenceGrantFromPresentityGroupMembersL( + const MXIMPIdentity& aGroupId, + TXIMPRequestId aReqId ); + +public: // Granting presence information access to everyone + + /** + * @see MProtocolPresenceAuthorization + */ + void DoGrantPresenceForEveryoneL( + const MPresenceInfoFilter& aPif, + TXIMPRequestId aReqId ); + + /** + * @see MProtocolPresenceAuthorization + */ + void DoUpdatePresenceGrantPifForEveryoneL( + const MPresenceInfoFilter& aPif, + TXIMPRequestId aReqId ); + + /** + * @see MProtocolPresenceAuthorization + */ + void DoWithdrawPresenceGrantFromEveryoneL( + TXIMPRequestId aReqId ); +public: // Subscribe presence block list + + /** + * @see MProtocolPresenceAuthorization + */ + void DoSubscribePresenceBlockListL( + TXIMPRequestId aReqId ); + + + /** + * @see MProtocolPresenceAuthorization + */ + void DoUnsubscribePresenceBlockListL( + TXIMPRequestId aReqId ); + +public: // Blocking presence information access from single presentities + + /** + * @see MProtocolPresenceAuthorization + */ + void DoBlockPresenceForPresentityL( + const MXIMPIdentity& aPresentityId, + TXIMPRequestId aReqId ); + + /** + * @see MProtocolPresenceAuthorization + */ + void DoCancelPresenceBlockFromPresentityL( + const MXIMPIdentity& aPresentityId, + TXIMPRequestId aReqId ); + + +public: + + /** + * Creates data handler + */ + void CreateDataHandlerL(); + +private: + + /** + * Request Id from ximpfw + */ + TXIMPRequestId iRequestId; + + + /** + * Oss Protocol Plugin Connection Manager + * Not own. *** Write "Not own" if some other class owns this object. + */ + MOSSProtocolConnectionManager& iConnMan; + + + + }; + +#endif // __COSSPROTOCLPRESENCEAUTHORISATION_H_ + + + + + + + + + + + + diff -r 000000000000 -r e6b17d312c8b imservices/ossprotocoladaptation/inc/presenceauthorization/cpresenceauthuserrequest.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/ossprotocoladaptation/inc/presenceauthorization/cpresenceauthuserrequest.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,102 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Response to authorization request +* +*/ + + +#ifndef __CPRESENCEAUTHUSERREQUEST_H__ +#define __CPRESENCEAUTHUSERREQUEST_H__ + + +// INCLUDES +#include +#include + + +// FORWARD DECLARATIONS +class MOSSProtocolConnectionManager; +class MXIMPIdentity; +class MPresenceInfoFilter; + +/** + * CPresenceAuthUserRequest + * + * Issue Accept Response of add notification Request to Network Server + * + */ + + class CPresenceAuthUserRequest: public CActive + + + { + +public: + + static CPresenceAuthUserRequest* NewL( MOSSProtocolConnectionManager& aConnMan, + TXIMPRequestId aRequestId ); + + static CPresenceAuthUserRequest* NewLC( MOSSProtocolConnectionManager& aConnMan, + TXIMPRequestId aRequestId ); + + virtual ~CPresenceAuthUserRequest(); + +private: + + CPresenceAuthUserRequest( MOSSProtocolConnectionManager& aConnMan, + TXIMPRequestId aRequestId ); + void ConstructL(); + +private: // from CActive + + void DoCancel(); + void RunL(); + TInt RunError( TInt aError ); + +public: + +/** + * Issue Accept Response of add notification Request to Network Server + * + * @param aIdentity: conatct id + * aPif : presence info filter + */ + void PresenceAuthUserRequestL( + const MXIMPIdentity & aIdentity, + const MPresenceInfoFilter & aPif); + + +private: // data + + /** + * Request Id from ximpfw + */ + TXIMPRequestId iRequestId; + + /** + * Send data request to pure data handler generates the id + */ + TInt iSendId; + + /** + * Oss Protocol Plugin Connection Manager + * Not own. *** Write "Not own" if some other class owns this object. + */ + MOSSProtocolConnectionManager& iConnMan; + + }; + + +#endif // __CPRESENCEAUTHUSERREQUEST_H__ + diff -r 000000000000 -r e6b17d312c8b imservices/ossprotocoladaptation/inc/presenceauthorization/csubscribepresencegrantrequestlistrequest.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/ossprotocoladaptation/inc/presenceauthorization/csubscribepresencegrantrequestlistrequest.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,91 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: subscribing to get add notifications +* +*/ + + +#ifndef __CSUBSCRIBEPRESENCEGRANTREQUESTLISTREQUEST_H__ +#define __CSUBSCRIBEPRESENCEGRANTREQUESTLISTREQUEST_H__ + + +// INCLUDES +#include +#include + + +// FORWARD DECLARATIONS +class MOSSProtocolConnectionManager; +class MXIMPIdentity; + +/** + * CSubscribePresenceGrantRequestListRequest + * + * subscribing from ximpfw to grant presence + */ + + class CSubscribePresenceGrantRequestListRequest: public CActive + + + { + +public: + + static CSubscribePresenceGrantRequestListRequest* NewL( + MOSSProtocolConnectionManager& aConnMan, + TXIMPRequestId aRequestId ); + + static CSubscribePresenceGrantRequestListRequest* NewLC( + MOSSProtocolConnectionManager& aConnMan, + TXIMPRequestId aRequestId ); + + virtual ~CSubscribePresenceGrantRequestListRequest(); + +private: + + CSubscribePresenceGrantRequestListRequest( + MOSSProtocolConnectionManager& aConnMan, + TXIMPRequestId aRequestId ); + void ConstructL(); + +private: // from CActive + + void DoCancel(); + void RunL(); + TInt RunError( TInt aError ); + +public: + + void SubscribePresenceGrantRequestListL(); + + +private: // data + + /** + * Request Id from ximpFw + */ + + TXIMPRequestId iRequestId; + + /** + * Oss Protocol Plugin Connection Manager + * Not own. *** Write "Not own" if some other class owns this object. + */ + MOSSProtocolConnectionManager& iConnMan; + + }; + + +#endif // __CSUBSCRIBEPRESENCEGRANTREQUESTLISTREQUEST_H__ + diff -r 000000000000 -r e6b17d312c8b imservices/ossprotocoladaptation/inc/presenceauthorization/cwithdrawpresencegrantfrompresentityrequest.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/ossprotocoladaptation/inc/presenceauthorization/cwithdrawpresencegrantfrompresentityrequest.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,100 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Response to authorization request +* +*/ + + +#ifndef __CWITHDRAWPRESENCEGRANTFROMPRESENTITYREQUEST_H__ +#define __CWITHDRAWPRESENCEGRANTFROMPRESENTITYREQUEST_H__ + + +// INCLUDES +#include +#include + + +// FORWARD DECLARATIONS +class MOSSProtocolConnectionManager; +class MXIMPIdentity; +class MPresenceInfoFilter; + +/** + * CWithdrawPresenceGrantFromPresentityRequest + * + * Issue Rejecting Response of add notification Request to Network Server + * + */ + + class CWithdrawPresenceGrantFromPresentityRequest: public CActive + + + { + +public: + + static CWithdrawPresenceGrantFromPresentityRequest* NewL( MOSSProtocolConnectionManager& aConnMan, + TXIMPRequestId aRequestId ); + + static CWithdrawPresenceGrantFromPresentityRequest* NewLC( MOSSProtocolConnectionManager& aConnMan, + TXIMPRequestId aRequestId ); + + virtual ~CWithdrawPresenceGrantFromPresentityRequest(); + +private: + + CWithdrawPresenceGrantFromPresentityRequest( MOSSProtocolConnectionManager& aConnMan, + TXIMPRequestId aRequestId ); + void ConstructL(); + +private: // from CActive + + void DoCancel(); + void RunL(); + TInt RunError( TInt aError ); + +public: + + /** + * Send Rejecting Response of add notification Request to Network Server + * @param aPresentityId: conatct id + */ + void WithdrawPresenceGrantFromPresentityL( + const MXIMPIdentity& aPresentityId); + + +private: // data + + /** + * Request Id from PrFw + */ + + TXIMPRequestId iRequestId; + + /** + * Send data request to wait timer generates the id + */ + TInt iSendId; + + /** + * Oss Protocol Plugin Connection Manager + * Not own. *** Write "Not own" if some other class owns this object. + */ + MOSSProtocolConnectionManager& iConnMan; + + }; + + +#endif // __CWITHDRAWPRESENCEGRANTFROMPRESENTITYREQUEST_H__ + diff -r 000000000000 -r e6b17d312c8b imservices/ossprotocoladaptation/inc/presencepublishing/cossprotocolpresencepublishing.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/ossprotocoladaptation/inc/presencepublishing/cossprotocolpresencepublishing.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,129 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: IMPS Protocol implementation for Presence Framework +* +*/ + + +#ifndef __COSSSPROTOCOLPRESENCEPUBLISHING_H__ +#define __COSSSPROTOCOLPRESENCEPUBLISHING_H__ + +// INCLUDES +#include +#include +#include +#include +#include + +// FORWARD DECLARATIONS +class MXIMPServiceInfo; +class MOSSProtocolConnectionManager; +class CPresenceNotificationHandler; +class MProtocolPresencePublishing; + +/** + * COssProtocolPresencePublishing + * + * Oss Protocol presence publishing Request Handling + * + */ +class COssProtocolPresencePublishing: + public CBase, + public MProtocolPresencePublishing + { + +public: + + static COssProtocolPresencePublishing* NewL(MOSSProtocolConnectionManager& aConnManager); + + + ~COssProtocolPresencePublishing(); + + +private: + + COssProtocolPresencePublishing(MOSSProtocolConnectionManager& aConnManager); + + + void ConstructL(); + +public: //from MXIMPBase + /** + * @see MXIMPBase + */ + TAny* GetInterface( TInt32 aInterfaceId, + TIfGetOps aOptions ); + /** + * @see MXIMPBase + */ + const TAny* GetInterface( TInt32 aInterfaceId, + TIfGetOps aOptions ) const; + + /** + * @see MXIMPBase + */ + TInt32 GetInterfaceId() const; + +public: // From MProtocolPresencePublishing + + /** + * @see MProtocolPresencePublishing + */ + void DoPublishOwnPresenceL( const MPresenceInfo& aPresence, + TXIMPRequestId aReqId ); + /** + * @see MProtocolPresencePublishing + */ + void DoSubscribeOwnPresenceL( const MPresenceInfoFilter& aPif, + TXIMPRequestId aReqId ); + /** + * @see MProtocolPresencePublishing + */ + void DoUpdateOwnPresenceSubscriptionPifL( const MPresenceInfoFilter& aPif, + TXIMPRequestId aReqId ); + /** + * @see MProtocolPresencePublishing + */ + void DoUnsubscribeOwnPresenceL( TXIMPRequestId aReqId ); + + /** + * @see MProtocolPresencePublishing + */ + void DoSubscribePresenceWatcherListL( TXIMPRequestId aReqId ); + + /** + * @see MProtocolPresencePublishing + */ + void DoUnsubscribePresenceWatcherListL( TXIMPRequestId aReqId ); + + +private: + + /** + * Request Id from PrFw + */ + TXIMPRequestId iRequestId; + + /** + * Oss Protocol Plugin Connection Manager + * Not own. + *** Write "Not own" if some other class owns this object. + */ + MOSSProtocolConnectionManager& iConnMan; + + CPresenceNotificationHandler* iNotificationHandler; + + }; + +#endif // __COSSSPROTOCOLPRESENCEPUBLISHING_H__ diff -r 000000000000 -r e6b17d312c8b imservices/ossprotocoladaptation/inc/presencepublishing/cpresencenotificationhandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/ossprotocoladaptation/inc/presencepublishing/cpresencenotificationhandler.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,101 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: implementation of presence notification handler +* +*/ + + +#ifndef __CPRESENCENOTIFICATIONHANDLER_H__ +#define __CPRESENCENOTIFICATIONHANDLER_H__ + + +// INCLUDES +#include +#include + +#include +#include + +// FORWARD DECLARATIONS + +class MOSSProtocolConnectionManager; + +/** + * CPresenceNotificationHandler + * + * Handles presnce notifications recieved from the server + * and updates presence cache + */ + +class CPresenceNotificationHandler: public CActive + + + { + + public: + + static CPresenceNotificationHandler* NewL ( + MOSSProtocolConnectionManager& aConnMan + ); + + static CPresenceNotificationHandler* NewLC ( + MOSSProtocolConnectionManager& aConnMan + ); + + virtual ~CPresenceNotificationHandler(); + + private: + + CPresenceNotificationHandler ( MOSSProtocolConnectionManager& aConnMan ); + void ConstructL(); + + private: // from CActive + + void DoCancel(); + void RunL(); + TInt RunError ( TInt aError ); + + public: + /** + * Start listening presence from the server + */ + void StartListeningL(); + /** + * Process the recieved presence from the server + */ + void ProcessIncomingDataL(); + + private: // data + + /** + * Send data request to pure data handler generates the id + */ + TInt iSendId; + /** + * Presence cache writer + * Own + */ + MPresenceCacheWriter2* iPresenceCacheWriter; + + /** + * Oss Protocol Plugin Connection Manager + * Not own. *** Write "Not own" if some other class owns this object. + */ + MOSSProtocolConnectionManager& iConnMan; + + }; + + +#endif // __CPRESENCENOTIFICATIONHANDLER_H__ + diff -r 000000000000 -r e6b17d312c8b imservices/ossprotocoladaptation/inc/presencepublishing/cpublishownpresencerequest.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/ossprotocoladaptation/inc/presencepublishing/cpublishownpresencerequest.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,107 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: IMPS Protocol implementation for Presence Framework +* +*/ + + +#ifndef __CPUBLISHOWNPRESENCEREQUEST_H__ +#define __CPUBLISHOWNPRESENCEREQUEST_H__ + + +// INCLUDES +#include +#include + + +// FORWARD DECLARATIONS +class MOSSProtocolConnectionManager; +class MPresenceInfo; +class MPresenceBuddyInfo2; + +/** + * CPublishOwnPresencerequest + * + * Publishes own presence + * + */ + + class CPublishOwnPresencerequest: public CActive + + + { + +public: + + static CPublishOwnPresencerequest* NewL( + MOSSProtocolConnectionManager& aConnMan, + TXIMPRequestId aRequestId ); + + static CPublishOwnPresencerequest* NewLC( + MOSSProtocolConnectionManager& aConnMan, + TXIMPRequestId aRequestId ); + + virtual ~CPublishOwnPresencerequest(); + +private: + + CPublishOwnPresencerequest( + MOSSProtocolConnectionManager& aConnMan, + TXIMPRequestId aRequestId ); + void ConstructL(); + +private: // from CActive + + void DoCancel(); + void RunL(); + TInt RunError( TInt aError ); + +public: + /** + * CPublishOwnPresencerequest + * + * Publishes update own presence to network server + * + */ + void PublishOwnPresenceL(const MPresenceInfo& aPresence); + + +private: // data + + /** + * Request Id from ximpfw + */ + + TXIMPRequestId iRequestId; + + /** + * Send data request to pure data handler generates the id + */ + TInt iSendId; + + + /** + * Imps Protocol Plugin Connection Manager + * Not own. *** Write "Not own" if some other class owns this object. + */ + MOSSProtocolConnectionManager& iConnMan; + + //owns : own presence info + MPresenceBuddyInfo2* iOwnPresenceInfo; + + }; + + +#endif // __CPUBLISHOWNPRESENCEREQUEST_H__ + diff -r 000000000000 -r e6b17d312c8b imservices/ossprotocoladaptation/inc/presentitygroups/caddcontactenotificationhandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/ossprotocoladaptation/inc/presentitygroups/caddcontactenotificationhandler.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,96 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: implementation of add notification handler +* +*/ + + +#ifndef __CADDCONTACTNOTIFICATIONHANDLER_H__ +#define __CADDCONTACTNOTIFICATIONHANDLER_H__ + + +// INCLUDES +#include +#include + +#include +#include + +// FORWARD DECLARATIONS + +class MOSSProtocolConnectionManager; + +/** + * CAddContactNotificationHandler + * + * Handles add notifications recieved from the network server + * + */ + +class CAddContactNotificationHandler: public CActive + + + { + + public: + + static CAddContactNotificationHandler* NewL ( + MOSSProtocolConnectionManager& aConnMan + ); + + static CAddContactNotificationHandler* NewLC ( + MOSSProtocolConnectionManager& aConnMan + ); + + virtual ~CAddContactNotificationHandler(); + + private: + + CAddContactNotificationHandler ( MOSSProtocolConnectionManager& aConnMan ); + void ConstructL(); + + private: // from CActive + + void DoCancel(); + void RunL(); + TInt RunError ( TInt aError ); + + public: + /** + * Start listening for the add notifications + */ + void StartListeningL(); + /** + * Process the recieved add notifications + */ + void ProcessIncomingDataL(); + + private: // data + + /** + * Send data request to pure data handler generates the id + */ + TInt iSendId; + + /** + * Oss Protocol Plugin Connection Manager + * Not own. *** Write "Not own" if some other class owns this object. + */ + MOSSProtocolConnectionManager& iConnMan; + + }; + + +#endif // __CADDCONTACTNOTIFICATIONHANDLER_H__ + diff -r 000000000000 -r e6b17d312c8b imservices/ossprotocoladaptation/inc/presentitygroups/caddpresentitygroupmemberrequest.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/ossprotocoladaptation/inc/presentitygroups/caddpresentitygroupmemberrequest.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,110 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Add presentity group member request +* +*/ + + +#ifndef __CADDPRESENTITYGROUPMEMBERREQUEST_H__ +#define __CADDPRESENTITYGROUPMEMBERREQUEST_H__ + + +// INCLUDES +#include +#include + + +// FORWARD DECLARATIONS +class MOSSProtocolConnectionManager; +class MXIMPIdentity; + +/** + * CAddPresentityGroupMemberRequest + * + * Issue Add Presentity Group Member Request to Network Server + * + */ + + class CAddPresentityGroupMemberRequest: public CActive + + + { + +public: + + + static CAddPresentityGroupMemberRequest* NewLC( + MOSSProtocolConnectionManager& aConnMan, + TXIMPRequestId aRequestId ); + + virtual ~CAddPresentityGroupMemberRequest(); + +private: + + CAddPresentityGroupMemberRequest( + MOSSProtocolConnectionManager& aConnMan, + TXIMPRequestId aRequestId ); + void ConstructL(); + +private: // from CActive + + void DoCancel(); + /* + * RunL() function also deletes the request object once the activity is done + * + */ + void RunL(); + TInt RunError( TInt aError ); + +public: + /** + * Add contact to the list + * @param aGroupId group identity + * @param aMemberId conatct identity + * @param aMemberDisplayName contact displayname + */ + void AddPresentityGroupMemberL( const MXIMPIdentity& aGroupId, + const MXIMPIdentity& aMemberId, + const TDesC16& aMemberDisplayName ); + + +private: // data + + /** + * Request Id from ximpfw + */ + + TXIMPRequestId iRequestId; + + /** + * Send data request to pure data handler generates the id + */ + TInt iSendId; + + /** + * Oss Protocol Plugin Connection Manager + * Not own. *** Write "Not own" if some other class owns this object. + */ + MOSSProtocolConnectionManager& iConnMan; + + /* + * Stores contactid + * Own + */ + HBufC* iContactId; + }; + + +#endif // __CADDPRESENTITYGROUPMEMBERREQUEST_H__ + diff -r 000000000000 -r e6b17d312c8b imservices/ossprotocoladaptation/inc/presentitygroups/ccontactsynchandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/ossprotocoladaptation/inc/presentitygroups/ccontactsynchandler.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,86 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: handles synchronisation of contacts +* +*/ + + +#ifndef __CCONTACTSYNCHANDLER_H__ +#define __CCONTACTSYNCHANDLER_H__ + + +// INCLUDES +#include +#include + +#include +#include + +// FORWARD DECLARATIONS + +class MOSSProtocolConnectionManager; + +/** + * CContactSyncHandler + * + * handles synchronisation of contacts from Network Server + * + */ + +class CContactSyncHandler: public CActive + + + { + + public: + + static CContactSyncHandler* NewL ( MOSSProtocolConnectionManager& aConnMan ); + + virtual ~CContactSyncHandler(); + + private: + + CContactSyncHandler ( MOSSProtocolConnectionManager& aConnMan ); + + private: // from CActive + + void DoCancel(); + void RunL(); + TInt RunError ( TInt aError ); + + public: + + /** + * keep on listening for events + */ + void StartListening(); + + /** + * Processes the data from server and sends to ximpfw + */ + void ProcessAndSendL(); + + private: // data + + /** + * Oss Protocol Plugin Connection Manager + * Not own. + */ + MOSSProtocolConnectionManager& iConnMan; + + }; + + +#endif // __CCONTACTSYNCHANDLER_H__ + diff -r 000000000000 -r e6b17d312c8b imservices/ossprotocoladaptation/inc/presentitygroups/cossprotocolpresentitygroups.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/ossprotocoladaptation/inc/presentitygroups/cossprotocolpresentitygroups.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,157 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Oss Protocol presentity groups +* +*/ + +#ifndef COSSPROTOCOLPRESENTITYGROUPS_H__ +#define COSSPROTOCOLPRESENTITYGROUPS_H__ + + +#include +#include + + +class MOSSProtocolConnectionManager; + + +/** + * COSSProtocolpresentitygroups + * + * implementation of MProtocolPresentityGroups methods. + * these methods will called by ximp framework + * + */ +class COSSProtocolpresentitygroups : public CBase, + public MProtocolPresentityGroups + { + +public: + + static COSSProtocolpresentitygroups* NewL( MOSSProtocolConnectionManager& aConnManager ); + ~COSSProtocolpresentitygroups(); + + +private: + + COSSProtocolpresentitygroups( MOSSProtocolConnectionManager& aConnManager ); + void ConstructL(); + +public: // from MXIMPBase + + /** + * @see MXIMPBase + */ + TAny* GetInterface( TInt32 aInterfaceId, + TIfGetOps aOptions ); + /** + * @see MXIMPBase + */ + const TAny* GetInterface( TInt32 aInterfaceId, + TIfGetOps aOptions ) const; + /** + * @see MXIMPBase + */ + TInt32 GetInterfaceId() const; + +public: //From MProtocolPresentityGroups + /** + * @see MProtocolPresentityGroups + */ + void DoSubscribePresentityGroupListL( + TXIMPRequestId aReqId ); + /** + * @see MProtocolPresentityGroups + */ + void DoUnsubscribePresentityGroupListL( + TXIMPRequestId aReqId ); + +public: // Manage presentity groups + /** + * @see MProtocolPresentityGroups + */ + void DoCreatePresentityGroupL( + const MXIMPIdentity& aGroupId, + const TDesC16& aDisplayName, + TXIMPRequestId aReqId ); + /** + * @see MProtocolPresentityGroups + */ + void DoDeletePresentityGroupL( + const MXIMPIdentity& aGroupId, + TXIMPRequestId aReqId ); + /** + * @see MProtocolPresentityGroups + */ + void DoUpdatePresentityGroupDisplayNameL( + const MXIMPIdentity& aGroupId, + const TDesC16& aDisplayName, + TXIMPRequestId aReqId ); + +public: // Subscribe presentity group content + /** + * @see MProtocolPresentityGroups + */ + void DoSubscribePresentityGroupContentL( + const MXIMPIdentity& aGroupId, + TXIMPRequestId aReqId ); + /** + * @see MProtocolPresentityGroups + */ + void DoUnsubscribePresentityGroupContentL( + const MXIMPIdentity& aGroupId, + TXIMPRequestId aReqId ); + +public: // Manage presentity group members + /** + * @see MProtocolPresentityGroups + */ + void DoAddPresentityGroupMemberL( + const MXIMPIdentity& aGroupId, + const MXIMPIdentity& aMemberId, + const TDesC16& aMemberDisplayName, + TXIMPRequestId aReqId ); + /** + * @see MProtocolPresentityGroups + */ + void DoRemovePresentityGroupMemberL( + const MXIMPIdentity& aGroupId, + const MXIMPIdentity& aMemberId, + TXIMPRequestId aReqId ); + /** + * @see MProtocolPresentityGroups + */ + void DoUpdatePresentityGroupMemberDisplayNameL( + const MXIMPIdentity& aGroupId, + const MXIMPIdentity& aMemberId, + const TDesC16& aMemberDisplayName, + TXIMPRequestId aReqId ); + +private: + /** + * Creates data handler + */ + void CreateDataHandlerL(); + +private: // data members + + /** + * Oss Protocol Plugin Connection Manager + * Not own. *** Write "Not own" if some other class owns this object. + */ + MOSSProtocolConnectionManager& iConnMan; + + }; + +#endif // COSSPROTOCOLPRESENTITYGROUPS_H__ diff -r 000000000000 -r e6b17d312c8b imservices/ossprotocoladaptation/inc/presentitygroups/cremovepresentitygroupmemberrequest.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/ossprotocoladaptation/inc/presentitygroups/cremovepresentitygroupmemberrequest.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,106 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Remove presentity group member request +* +*/ + + +#ifndef __CREMOVEPRESENTITYGROUPMEMBERREQUEST_H__ +#define __CREMOVEPRESENTITYGROUPMEMBERREQUEST_H__ + + +// INCLUDES +#include +#include + + +// FORWARD DECLARATIONS +class MOSSProtocolConnectionManager; +class MXIMPIdentity; + + +/** + * CRemovePresentityGroupMemberRequest + * + * Issue Remove Presentity Group Member Request to Network Server + * + */ + + class CRemovePresentityGroupMemberRequest: public CActive + + + { + +public: + + + + static CRemovePresentityGroupMemberRequest* NewLC( + MOSSProtocolConnectionManager& aConnMan, + TXIMPRequestId aRequestId ); + + virtual ~CRemovePresentityGroupMemberRequest(); + +private: + + CRemovePresentityGroupMemberRequest( + MOSSProtocolConnectionManager& aConnMan, + TXIMPRequestId aRequestId ); + void ConstructL(); + +private: // from CActive + + void DoCancel(); + /* + * RunL() function also deletes the request object once the activity is done + * + */ + void RunL(); + TInt RunError( TInt aError ); + +public: + /** + * Remove presentity group member from the list + * @param aGroupId group identity + * @param aGroupId group member identity + */ + void RemovePresentityGroupMemberL(const MXIMPIdentity& aGroupId, + const MXIMPIdentity& aMemberId); + +private: // data + + /** + * Request Id from ximpfw + */ + TXIMPRequestId iRequestId; + + /** + * Send data request to pure data handler generates the id + */ + TInt iSendId; + + /** + * Oss Protocol Plugin Connection Manager + * Not own. *** Write "Not own" if some other class owns this object. + */ + MOSSProtocolConnectionManager& iConnMan; + + // owns : userid id to delete + HBufC* iUserId; + + }; + + +#endif // __CREMOVEPRESENTITYGROUPMEMBERREQUEST_H__ + diff -r 000000000000 -r e6b17d312c8b imservices/ossprotocoladaptation/inc/presentitygroups/csubscribepresentitygroupcontentrequest.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/ossprotocoladaptation/inc/presentitygroups/csubscribepresentitygroupcontentrequest.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,137 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Subscribe Presentity Group Content Request +* +*/ + + +#ifndef __CSUBSCRIBEPRESENTITYGROUPCONTENTREQUEST_H__ +#define __CSUBSCRIBEPRESENTITYGROUPCONTENTREQUEST_H__ + + +// INCLUDES +#include +#include +#include +#include "ossprotocloliterals.h" +// FORWARD DECLARATIONS + +class MOSSProtocolConnectionManager; + +class MXIMPIdentity; + +/** + * CSubscribePresentityGroupContentRequest + * + * Fetches the contacts and update to ximp fw + * + */ + +class CSubscribePresentityGroupContentRequest: public CActive + + + { + + public: + + static CSubscribePresentityGroupContentRequest* NewL ( + MOSSProtocolConnectionManager& aConnMan, + TXIMPRequestId aRequestId ); + + static CSubscribePresentityGroupContentRequest* NewLC ( + MOSSProtocolConnectionManager& aConnMan, + TXIMPRequestId aRequestId ); + + virtual ~CSubscribePresentityGroupContentRequest(); + + private: + + CSubscribePresentityGroupContentRequest ( + MOSSProtocolConnectionManager& aConnMan, + TXIMPRequestId aRequestId ); + void ConstructL(); + /** + * IssueRequest + */ + void IssueRequest(); + /** + * populate data + */ + void PopulateDataL(); + + private: // from CActive + + void DoCancel(); + /* + * RunL() function also deletes the request object once the activity is done + * + */ + void RunL(); + TInt RunError ( TInt aError ); + + public: + /** + * subscribe to get group members of the list + * @param aGroupId group identity + */ + void SubscribePresentityGroupContentL ( + const MXIMPIdentity& aGroupId ); + + public: + + + /** + * parse the data and update the data cache of ximp.send event back to ximp + */ + + void ProcessIncomingDataL(); + + private: // data + + /** + * Request Id from ximpfw + */ + + TXIMPRequestId iRequestId; + + /** + * Send data request to pure data handler generates the id + */ + TInt iSendId; + + /** + * Array of conatcts + * Own + */ + //RPointerArray iContacts; + /** + * Oss Protocol Plugin Connection Manager + * Not own. *** Write "Not own" if some other class owns this object. + */ + MOSSProtocolConnectionManager& iConnMan; + + /* + * Stores groupname + * Own + */ + HBufC* iGroupName; + /* + * Listcount + */ + TInt iListcount; + }; + + +#endif // __CSUBSCRIBEPRESENTITYGROUPCONTENTREQUEST_H__ + diff -r 000000000000 -r e6b17d312c8b imservices/ossprotocoladaptation/inc/processlauncher/processlaunher.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/ossprotocoladaptation/inc/processlauncher/processlaunher.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,100 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Offers launching of given process +* +*/ + + + +#ifndef __CPROCESSLAUNCHER_H__ +#define __CPROCESSLAUNCHER_H__ + + +#include + + +/** +* CProcessLauncher +* The implementation for launching of processes +* +*/ + +class CProcessLauncher : public CActive + { + + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static CProcessLauncher* NewL ( const TDesC16& aprocessname ); + + /** + * Destructor. + */ + ~CProcessLauncher(); + + + public: + + /** + * Does the launching of given process + */ + void LaunchProcessL(); + + + private: + + /** + * C++ default constructor. + * @param aReconnHandler Handler for global reconnect continuation query + */ + CProcessLauncher(); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL ( const TDesC16& aprocessname ); + + + protected: + /** + * @see CActive. + */ + void DoCancel(); + + /** + * @see CActive. + */ + void RunL(); + + /** + * @see CActive. + */ + TInt RunError ( TInt aError ); + + private: //data + /** + * process launcher + */ + RProcess iLauncher; + /** + * name of the process to be launched + */ + HBufC16* iProcessName; + }; + +#endif // __CPROCESSLAUNCHER_H__ + +// End of File diff -r 000000000000 -r e6b17d312c8b imservices/ossprotocoladaptation/inc/search/cossprotocolsearch.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/ossprotocoladaptation/inc/search/cossprotocolsearch.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,90 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Oss protocol search +* +*/ + +#ifndef COSSPROTOCOLSEARCH_H__ +#define COSSPROTOCOLSEARCH_H__ + + +#include +#include + + +class MOSSProtocolConnectionManager; + + +/** + * COSSProtocolSearch + * implementation of MProtocolSearch methods. + * these methods will called by search feature plugin + */ +class COSSProtocolSearch : public CBase, + public MProtocolSearch + { + + public: + + static COSSProtocolSearch* NewL( MOSSProtocolConnectionManager& aConnManager ); + + ~COSSProtocolSearch(); + + + private: + + COSSProtocolSearch( MOSSProtocolConnectionManager& aConnManager ); + void ConstructL(); + + public: //from MXIMPBase + + /** + * @see MXIMPBase + */ + TAny* GetInterface( TInt32 aInterfaceId, + TIfGetOps aOptions ); + /** + * @see MXIMPBase + */ + const TAny* GetInterface( TInt32 aInterfaceId, + TIfGetOps aOptions ) const; + /** + * @see MXIMPBase + */ + TInt32 GetInterfaceId() const; + + public: // From MProtocolSearch + + /** + * @see MProtocolSearch + */ + void DoSearchL( const MXIMPIdentity& aSearchId, + const RPointerArray< MSearchElement >& aObjs, + TInt aSearchLimit, + TXIMPRequestId aReqId ); + /** + * @see MProtocolSearch + */ + void DoGetSearchKeysL( TXIMPRequestId aReqId ); + + private: // data members + /** + * Oss Protocol Plugin Connection Manager + * Not own. + */ + MOSSProtocolConnectionManager& iConnMan; + + }; + +#endif // COSSPROTOCOLSEARCH_H__ diff -r 000000000000 -r e6b17d312c8b imservices/ossprotocoladaptation/inc/search/csearchgetsearchkeys.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/ossprotocoladaptation/inc/search/csearchgetsearchkeys.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,115 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: This class handles dynamic search label-key pair storing. +* +*/ + + +/*! \def To avoid multiple inclusions +*/ +#ifndef C_SEARCHGETSEARCHKEYS_H +#define C_SEARCHGETSEARCHKEYS_H + +#include +#include +#include +#include "mossprotocolconnectionmanager.h" + +/*! \file +* \brief Interfaces for the get search key request +*/ + + +/*! \class CSearchGetSearchKeys csearchgetsearchkeys.h +* \brief This class derived from CActive impliments a request +* for the get search keys +*/ +class CSearchGetSearchKeys : public CActive + { + + public: + + /*! \fn + * \brief static function to create a new object of this class + */ + static CSearchGetSearchKeys* NewL( + MOSSProtocolConnectionManager& aConnMan, + TXIMPRequestId aRequestId ); + + + /*! \fn + * \brief Default Constructor for this class + */ + CSearchGetSearchKeys( + MOSSProtocolConnectionManager& aConnMan, + TXIMPRequestId aRequestId ); + + /*! \fn + * \brief destructor + */ + ~CSearchGetSearchKeys(); + + + /*! \brief Function to issue a request, in this case + * it is geting search keys + */ + void GetSearchKeysL(); + + + protected: + + /*! \fn + * \brief Called when a cancel is done on the active object + */ + void DoCancel(); + + /*! \fn + * \brief Called when the request submitted by this object + * is completed + */ + void RunL(); + + /*! \fn + * \brief Called when the RunL leaves + */ + TInt RunError( TInt aError ); + + + + private: + + /*! \fn + * \brief 2nd phase constructor for this class + */ + void ConstructL(); + + /*! \var Data Id generated for the request + */ + TInt iSendId; + + + /*! \var TXIMPRequestId Request Id + * + */ + TXIMPRequestId iRequestId; + + /*! \var iConnMan handle to connection manager + * This variable is not owned by this class + */ + MOSSProtocolConnectionManager& iConnMan; + + }; + + +#endif //C_SEARCHGETSEARCHKEYS_H diff -r 000000000000 -r e6b17d312c8b imservices/ossprotocoladaptation/inc/search/csearchkeystore.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/ossprotocoladaptation/inc/search/csearchkeystore.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,148 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: This class handles dynamic search label-key pair storing. +* +*/ + + +/*! /def To avoid multiple inclusions +*/ +#ifndef C_SEARCHKEYSTORE_H +#define C_SEARCHKEYSTORE_H + +//For CBase +#include +//For RHashMap +#include +//For TDesC +#include +//For CRepository +#include +//For TSearchKey +#include + +/*! /file +* Interfaces for CSearchKeyStore class +*/ + + +/*! /var KLabelKeyStoreHash Uid to access central repository +*/ +const TUid KLabelKeyStoreHash = { 0x200195A9 }; +/*! /def Total no. of keys that the UI supports( for localization ) +*/ +#define NO_OF_KEYS_SUPPORTED 13 + + +/*! /class CSearchKeyStore csearchkeystore.h +* +* /brief This class stores the localizable search labels, and maps +* the labels got from get search keys to enums( Localizable ) and +* strings( non localizable ). +* +* /brief Background : The search key labels from server are not standardized. +* So gizmo can give for 'First Name' a label 'First' and gtalk can give it as +* 'Name'. We will have possible values for 'First Name' in cen rep. And +* whenever a get search keys done and labels got, we wil try to map those +* to enums('Name', 'First' for EFirstName). If for 'first name' the label +* for some xyz server is 'Given' then it is non localizable. And wil be +* sent to UI as a string +*/ +class CSearchKeyStore : public CBase + { + + public : + /*! /fn + * /brief Static function that creates a new object + * of type CSearchKeyStore + */ + static CSearchKeyStore* NewL(); + + /*! /fn + * /brief constructor for the CSearchKeyStore class + */ + CSearchKeyStore(); + + /*! /fn + * /brief destructor for the CSearchKeyStore class + */ + virtual ~CSearchKeyStore(); + + /*! /fn + * /brief Maps the labels from server got by making a get + * search keys request to server. Those are mapped to localizable + * enums and non localizable strings + * + * /param aLabels Labels to be classified + */ + void MapLabelsToEnumL( RPointerArray& aLabels ); + + /*! /fn + * /brief Gets the label (for server) for the given enum(search field) + * + * /param aEnum search field + * /return HBufC* string corresponding to the enum. The ownership of + * returned pointer is transfered to callee. + */ + HBufC* GetLabelFromEnumL( TSearchKey aEnum ); + + /*! /brief This function returns an array of pointers to the + * supported keys( Supported labels are the labels that have + * support in the UI for logical strings) + * + * /return an array of pointers to enums + */ + RPointerArray GetSupportedEnums(); + + + /*! /brief This function returns a handle to the array of not + * supported label strings. Not supported here means that + * there are no logical strings in UI for these labels + * + * /return const handle to not supported strings + */ + + const RPointerArray GetNotSupportedLabels(); + + private: + + /*! /fn + * /brief ConstructL reads labels from the cen rep + * and maps them to enums + */ + void ConstructL(); + + /*! /var iLabelKeyHashRep Handle to cen rep + */ + CRepository* iLabelKeyHashRep;//owned + + /*! /var iEnumLabels maps the labels to enums + */ + RHashMap iEnumLabels;//owned + + /*! /var iNotSupportedLabels Has the labels that can not + * be localized. + */ + RPointerArray iNotSupportedLabels;//owned + + /*! /var iSupportedLabels Hash Map of the search labels and + * to search field enums + */ + RHashMap iSupportedLabels;//owned + + }; + + + +#endif //C_SEARCHKEYSTORE_H diff -r 000000000000 -r e6b17d312c8b imservices/ossprotocoladaptation/inc/search/csearchrequest.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/ossprotocoladaptation/inc/search/csearchrequest.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,109 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Search implementation +* +*/ + + +#ifndef __CSEARCHREQUEST_H__ +#define __CSEARCHREQUEST_H__ + + +// INCLUDES +#include +#include + +#include + +// FORWARD DECLARATIONS +class MOSSProtocolConnectionManager; +class MSearchElement; +class MXIMPIdentity; + +/** + * CSearchrequest + * + * Issue Search Request to Network Server + * + */ + +class CSearchrequest: public CActive + + + { + + public: + + static CSearchrequest* NewLC( MOSSProtocolConnectionManager& aConnMan, + TXIMPRequestId aRequestId ); + + virtual ~CSearchrequest(); + + private: + + CSearchrequest( MOSSProtocolConnectionManager& aConnMan, + TXIMPRequestId aRequestId ); + void ConstructL(); + + private: // from CActive + + void DoCancel(); + void RunL(); + TInt RunError( TInt aError ); + + private : + /** + * parse the data + * @param aResponse: response contains searched data + * @param alen: length + * @param aSearchInfo: search info + * @param aKeytype: search key type + */ + void ParseAndSetL(char* aResponse, TInt alen, MSearchInfo& aSearchInfo, TInfoType aKeytype); + + public: + /** + * Issue search request to network server + * @param aSearchId: search id + * @param aObjs: array of search elements + * @param aSearchLimit: search limit + */ + void SearchL(const MXIMPIdentity& aSearchId,const RPointerArray< MSearchElement >& aObjs,TInt aSearchLimit); + + private: // data + + /** + * Request Id + */ + TXIMPRequestId iRequestId; + + /** + * Send data request to pure data handler generates the id + */ + TInt iSendId; + /** + * Search Id + */ + HBufC16* iSearchId; + /** + * Oss Protocol Plugin Connection Manager + * Not own. *** Write "Not own" if some other class owns this object. + */ + MOSSProtocolConnectionManager& iConnMan; + + }; + + +#endif // __CSEARCHREQUEST_H__ + diff -r 000000000000 -r e6b17d312c8b imservices/ossprotocoladaptation/inc/waittimer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/ossprotocoladaptation/inc/waittimer.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,337 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Header for Waittimer.h. +* +*/ + +#ifndef WAITTIMER_H +#define WAITTIMER_H + +#include // For CActive, link against: euser.lib +#include // For RTimer, link against: euser.lib +#include +// FORWARD DECLARATIONS + +class COssSendDataOperation; +class COSSProtocolConnectionManager; +class MOSSProtocolConnectionManager; +class MXIMPProtocolConnectionHost; + +enum TDataFetchSteps + { + EDataFetchingStep1 = -1, // three + EDataFetchingStep2 , // -1 +// EDataFetchingStep3, // 0 + EDataFetchComplete // 1 done + }; + +/** + * CWaitTimer implementation. + * Responsible for sending filled message queue and + * reading response message queue when it is updated + * keep track of updation of message queue + */ +class CWaitTimer : public CActive + { + + public: + // Cancel and destroy + ~CWaitTimer(); + + // Two-phased constructor. + static CWaitTimer* NewL (MOSSProtocolConnectionManager& aConnMan); + + + public: // New functions + /** + * Function for making the initial request + */ + TInt SendDataL ( TRequestStatus& aStatus, char* msg, TInt nBytes ); + /** + * Get response data based on the transaction id + */ + char* ResponseL ( TInt aTransId ); + /** + * start listening on the queue to keep track of the queue updation + */ + void StartListeningL(); + /** + * Increase operation id + */ + void IncreaseOpId(); + /** + * Get operation id + */ + TInt GetOpId(); + /** + * Listen Incoming data + */ + + void ListenIncomingData ( TRequestStatus& aStatus ); + + /** + * Listen Incoming data count + */ + + TInt IncomingDataCount(); + /** + * Returns searched data count + */ + TInt SearchDataCount(); + + /** + * Returns ContactsChange Response Count + */ + TInt ContactsChangeResponseCount(); + + /** + *Listen Incoming message + */ + TInt ListenIncomingMsg ( TRequestStatus& aStatus ); + /** + * Cancel incoming data listening + */ + void CancelListening(); + + /** + * Listen Incoming message listening + */ + void CancelListeningMsg(); + /** + * returns fetchingcontinue flag + */ + TBool IsFetchingContinue(); + + /** + * Listen Incoming Presence notifications + */ + TInt ListenIncomingPresence ( TRequestStatus& aStatus ); + /** + * Cancel Incoming presence listening + */ + void CancelListeningPres(); + /** + * Listen Incoming Added contact notifications + */ + TInt ListenAddNotification ( TRequestStatus& aStatus ); + /** + * Cancel listening Incoming Added contact notifications + */ + void CancelListeningAddNotication(); + /** + * Listen Incoming network server Error notifications + */ + TInt ListenIncomingServerError ( TRequestStatus& aStatus ); + /** + * Cancel Incoming server error listening + */ + void CancelListeningServerErrors(); + + /** + * issue the releasing reuest and exit + */ + void IssueReleaseRequestL(); + + /** + * return ETrue if server disconnect has happen + */ + TBool IsServerDisconnect(); + /** + * Listen any contacts change events + */ + void ListenContactsChange( TRequestStatus& aStatus ); + + /** + * Cancel any contacts change events listening + */ + void CancelContactsChangeListening(); + /** + * ETrue.if fetching contacts is completed + */ + TBool IsFetchContactsCompleted(); + + private: + /** + * C++ constructor + */ + CWaitTimer ( MOSSProtocolConnectionManager& aConnMan ); + + /** + * Second-phase constructor + */ + void ConstructL(); + + private: // From CActive + + /** + * Handles recieved message queue data. + */ + void RunL(); + + /** + * How to cancel me + */ + void DoCancel(); + /** + * Override to handle leaves from RunL(). Default implementation causes + * the active scheduler to panic. + */ + TInt RunError ( TInt aError ); + + private: // new private functions + + /** + * Find operationl + * + * @return index in array + */ + TInt FindOperation ( TInt aOpId, TInt ( COssSendDataOperation:: *aIdFunc ) () const ) const; + TInt FindOperationL ( TInt aOpId, TInt ( COssSendDataOperation:: *aIdFunc ) () const ) const; + /** + * set presence as pending into the presence cache + * for the remote pending contacts + * @param armsg: message to parse to get remote contacts + */ + void PendingPresenceContactsL(char* aRmessage); + private: + /** + * State of the active object + */ + TInt iState; + /** + * Request status + */ + TRequestStatus* iStatus1; + /** + * Send data operations + * Own + * Elements OWNed + */ + RPointerArray iOperations; + /** + * Logs Id iteration + */ + TInt iOpidIterator; + /** + * Id iteration + */ + TInt iOpId; + + /** + * Max number of active requests + */ + TInt iMaxActive; + + /** + * Incoming data queue + * OWN + */ + RPointerArray iIncomingData; + /** + * Incoming message queue + * OWN + */ + RPointerArray iIncomingMsg; + /** + * Incoming presence information queue + * OWN + */ + RPointerArray iIncomingPres; + /** + * Incoming server error queue + * OWN + */ + RPointerArray iIncomingServerError; + /** + * Incoming add notifications queue + * OWN + */ + RPointerArray iAddNotification; + /** + * Incoming search elements queue + * OWN + */ + RPointerArray iSearchElements; + /** + * Incoming conatct change queue + * OWN + */ + RPointerArray iContactChangeList; + /** + * data Request Status + * OWN + */ + TRequestStatus* iIncReqStatus; + /** + * Message Request Status + * OWN + */ + TRequestStatus* iIncMsgReqStatus; + /** + * Presence Request Status + * OWN + */ + TRequestStatus* iIncPresReqStatus; + /** + * Error Request Status + * OWN + */ + TRequestStatus* iIncErrorReqStatus; + /** + * Add Request Status + * OWN + */ + TRequestStatus* iIncAddReqStatus; + /** + * Contacts Change Request Status + * OWN + */ + TRequestStatus* iContactsChangeStatus; + + /** + * Id which is used to do logs more human readable + * OWN + */ + TInt iConnectionLogsId; + + + /** + * flag for checking fetching is done + */ + TBool iFetchingContinue; + + /** + * connection manager + */ + MOSSProtocolConnectionManager& iConnMan; + /** + * Flag to denote whether Msg Queue was created + * this will help us in reusing the created msgqueue + */ + TBool iResponseMsgQCreated ; + /** + * ETrue if server disconnect has happen + */ + TBool iServerDisconnected; + /** + * timer to trigger message queue uptation checking + */ + RTimer iTimer; + /** + * stores fetching steps + */ + TInt iFetchingStep; + }; + +#endif // WAITTIMER_H diff -r 000000000000 -r e6b17d312c8b imservices/ossprotocoladaptation/rom/ossprotocoladaptation.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/ossprotocoladaptation/rom/ossprotocoladaptation.iby Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,28 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description:IBY for ossadaptation +* +*/ + + +#ifndef __OSSPROTOCOLADAPTATION_IBY__ +#define __OSSPROTOCOLADAPTATION_IBY__ + +file=ABI_DIR\BUILD_DIR\OpenCStringUtilsLib.dll SHARED_LIB_DIR\OpenCStringUtilsLib.dll + +ECOM_PLUGIN( OSSProtocolAdaptation.dll, ossprotocoladaptation.rsc ) + +#endif + + diff -r 000000000000 -r e6b17d312c8b imservices/ossprotocoladaptation/rom/ossprotocoladaptation.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/ossprotocoladaptation/rom/ossprotocoladaptation.pkg Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,36 @@ +; +; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +; All rights reserved. +; This component and the accompanying materials are made available +; under the terms of "Eclipse Public License v1.0" +; which accompanies this distribution, and is available +; at the URL "http://www.eclipse.org/legal/epl-v10.html". +; +; Initial Contributors: +; Nokia Corporation - initial contribution. +; +; Contributors: +; +; Description: Pkg file for ossadaptation +; +;Header +#{"XIMP-TELEPATHY Adaptation Plugin"}, (0x10292DE8), 1, 0, 0 + +;Language +&EN + +;Localised VendorID +%{"Nokia"} + +;VendorID +:"Nokia" + +(0x101F7961), 0, 0, 0, {"Series60ProductID"} + +;Test data + +;EUnit test dlls +"\EPOC32\RELEASE\ARMV5\UDEB\TelepathyAdaptation.dll" - "!:\sys\bin\TelepathyAdaptation.dll" + +;resources +"\EPOC32\DATA\Z\Resource\Plugins\TelepathyAdaptation.RSC"-"!:\resource\plugins\TelepathyAdaptation.rsc" diff -r 000000000000 -r e6b17d312c8b imservices/ossprotocoladaptation/rss/ossprotocoladaptation.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/ossprotocoladaptation/rss/ossprotocoladaptation.rss Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,51 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ECOM registery info for Presence Framework Test Protocol +* +*/ + + +#include + +#include + +// --------------------------------------------------------------------------- +// ECOM registery info for XIMP Framework ECOM hook +// --------------------------------------------------------------------------- +// +RESOURCE REGISTRY_INFO theInfo + { + resource_format_version = RESOURCE_FORMAT_VERSION_2; + dll_uid = 0x101FB3E7; // dll's own uid + + interfaces = + { + INTERFACE_INFO + { // implemented interface + interface_uid = XIMP_ECOM_IF_UID_PROTOCOL_PLUGIN_BASE_INTERFACE; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = 0x101FB3E7; // implementation's identifier uid + version_no = 1; + display_name = "XMPP"; // Protocol display name + default_data = "XMPP"; // Protocol Id string + + } + }; + } + }; + } + diff -r 000000000000 -r e6b17d312c8b imservices/ossprotocoladaptation/src/cosscontactmanager.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/ossprotocoladaptation/src/cosscontactmanager.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,301 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: contact manager +* +*/ + +#include "cosscontactmanager.h" +#include "mossprotocolconnectionmanager.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "cossprotocolconnectionmanager.h" +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// COSSContactManager::COSSContactManager() +// --------------------------------------------------------------------------- +// +COSSContactManager::COSSContactManager(MOSSProtocolConnectionManager& aConnMan): + iConnMan ( aConnMan ) + { + + } + + +// --------------------------------------------------------------------------- +// COSSContactManager::ConstructL() +// --------------------------------------------------------------------------- +// +void COSSContactManager::ConstructL() + { + iFetchContactsFirstTime = EFalse; + iFetchInvitationsFirstTime = EFalse; + } + + +// --------------------------------------------------------------------------- +// COSSContactManager::NewL() +// --------------------------------------------------------------------------- +// +COSSContactManager* COSSContactManager::NewL(MOSSProtocolConnectionManager& aConnMan) + { + + COSSContactManager* self = new ( ELeave )COSSContactManager(aConnMan); + + CleanupStack::PushL ( self ); + + self->ConstructL(); + CleanupStack::Pop ( self ); + + return self; + } + + +// --------------------------------------------------------------------------- +// COSSContactManager::~COSSProtocolConnectionManager() +// --------------------------------------------------------------------------- +// +COSSContactManager::~COSSContactManager() + { + iContacts.ResetAndDestroy(); + iInvitationList.ResetAndDestroy(); + } + +// --------------------------------------------------------------------------- +// COSSContactManager::IsFetchForFirstTime() +// --------------------------------------------------------------------------- +// +TBool COSSContactManager::IsFetchContactsFirstTime() + { + return iFetchContactsFirstTime; + } + +// --------------------------------------------------------------------------- +// COSSContactManager::IsFetchInvitationsForFirstTime() +// --------------------------------------------------------------------------- +// +TBool COSSContactManager::IsFetchInvitationsForFirstTime() + { + return iFetchInvitationsFirstTime; + } + +// --------------------------------------------------------------------------- +// COSSContactManager::SetFetchForFirstTime() +// --------------------------------------------------------------------------- +// +void COSSContactManager::SetFetchContactsFirstTime(TBool aValue) + { + iFetchContactsFirstTime = aValue; + } + +// --------------------------------------------------------------------------- +// COSSContactManager::SetFetchInvitationsForFirstTime() +// --------------------------------------------------------------------------- +// +void COSSContactManager::SetFetchInvitationsForFirstTime(TBool aValue) + { + iFetchInvitationsFirstTime = aValue; + } + +// --------------------------------------------------------------------------- +// COSSContactManager::GetContactsListL() +// --------------------------------------------------------------------------- +// +RPointerArray& COSSContactManager::GetContactsListL() + { + return iContacts; + } +// --------------------------------------------------------------------------- +// COSSContactManager::GetInvitationListL() +// --------------------------------------------------------------------------- +// +RPointerArray& COSSContactManager::GetInvitationListL() + { + return iInvitationList; + } + +// --------------------------------------------------------------------------- +// COSSContactManager::ReturnContactsListL() +// --------------------------------------------------------------------------- +// +void COSSContactManager::ReturnInvitationListL() + { + MXIMPObjectFactory& prfwObjFact = iConnMan.HandleToHost().ObjectFactory(); + + MPresenceObjectFactory& prObjFact = iConnMan.HandleToHost().ProtocolPresenceDataHost().PresenceObjectFactory(); + + MXIMPIdentity* AuthReqIdentity = NULL ; + MPresenceGrantRequestInfo* presenceGrant = NULL; + + MXIMPObjectCollection* listOfInvitations = prfwObjFact.NewObjectCollectionLC(); + + for ( TInt i = 0; iSetIdentityL(*(iInvitationList[ i ] )); + iInvitationList[i]->Des().Fold(); + presenceGrant->SetRequestorIdL(AuthReqIdentity); + listOfInvitations->AddObjectL( presenceGrant ); + CleanupStack::Pop ( 2 );//presenceGrant, AuthReqIdentity + } + + iConnMan.HandleToHost().ProtocolPresenceDataHost().AuthorizationDataHost().HandlePresenceGrantRequestListL( listOfInvitations ); + CleanupStack::Pop ( 1 );//listOfInvitations + } + +// --------------------------------------------------------------------------- +// COSSContactManager::ReturnContactsListL() +// --------------------------------------------------------------------------- +// +void COSSContactManager::ReturnContactsListL() + { + MXIMPObjectFactory& prfwObjFact = iConnMan.HandleToHost().ObjectFactory(); + + MPresenceObjectFactory& prObjFact = iConnMan.HandleToHost().ProtocolPresenceDataHost().PresenceObjectFactory(); + + MXIMPIdentity* contactIdentity = NULL; + MPresentityGroupMemberInfo* groupMemberInfo = NULL; + + MXIMPObjectCollection* listOfContacts = prfwObjFact.NewObjectCollectionLC(); + for(TInt i = 0;iSetIdentityL ( *(iContacts[ i ] )); + groupMemberInfo->SetGroupMemberIdL ( contactIdentity ); + groupMemberInfo->SetGroupMemberDisplayNameL ( *(iContacts[ i ] ) ); + listOfContacts->AddObjectL ( groupMemberInfo ); + CleanupStack::Pop ( 2 );//groupMemberInfo, contactIdentity + } + MXIMPIdentity* groupIdentity = prfwObjFact.NewIdentityLC(); + groupIdentity->SetIdentityL ( iConnMan.GroupId() ); + iConnMan.HandleToHost().ProtocolPresenceDataHost().GroupsDataHost().HandlePresentityGroupContentL ( groupIdentity, listOfContacts ); + CleanupStack::Pop ( 2 );//groupIdentity,listOfContacts + } + +// --------------------------------------------------------------------------- +// COSSContactManager::RemoveContactFromLocalL() +// --------------------------------------------------------------------------- +// +void COSSContactManager::RemoveContactFromLocalL(const TDesC& aContactName) + { + HBufC* contactName = aContactName.AllocLC(); + MXIMPObjectFactory& ximpObjFact = iConnMan.HandleToHost().ObjectFactory(); + MXIMPIdentity* contactIdentity = ximpObjFact.NewIdentityLC(); + MXIMPIdentity* groupIdentity = ximpObjFact.NewIdentityLC(); + groupIdentity->SetIdentityL ( iConnMan.GroupId()); + contactIdentity->SetIdentityL(*contactName); + //removing from the local copy of the contacts + for(TInt i = 0; iCompare(*(iContacts[i]))) + { + iContacts.Remove( i ); + //give info after removing. to ximp fw and client + iConnMan.HandleToHost().ProtocolPresenceDataHost().GroupsDataHost().HandlePresentityGroupMemberRemovedL ( groupIdentity, contactIdentity ); + break; + } + } + CleanupStack::Pop( 2 ); // contactIdentity , groupIdentity + CleanupStack::PopAndDestroy( 1 ); //contactName + } + +// --------------------------------------------------------------------------- +// COSSContactManager::AddContactToLocalL() +// --------------------------------------------------------------------------- +// +void COSSContactManager::AddContactToLocalL(const TDesC& aContactName) + { + HBufC* contactName = aContactName.AllocLC(); + MXIMPObjectFactory& ximpObjFact = iConnMan.HandleToHost().ObjectFactory(); + MXIMPIdentity* contactIdentity = ximpObjFact.NewIdentityLC(); + MXIMPIdentity* groupIdentity = ximpObjFact.NewIdentityLC(); + groupIdentity->SetIdentityL ( iConnMan.GroupId()); + contactIdentity->SetIdentityL(*contactName); + iContacts.AppendL(contactName); + groupIdentity->SetIdentityL ( iConnMan.GroupId()); + contactIdentity->SetIdentityL(*contactName); + MPresentityGroupMemberInfo* groupMemberInfo = iConnMan.HandleToHost().ProtocolPresenceDataHost().PresenceObjectFactory().NewPresentityGroupMemberInfoLC(); + groupMemberInfo->SetGroupMemberIdL ( contactIdentity ); + groupMemberInfo->SetGroupMemberDisplayNameL ( *contactName ); + iConnMan.HandleToHost().ProtocolPresenceDataHost().GroupsDataHost().HandlePresentityGroupMemberAddedL ( groupIdentity, groupMemberInfo ); + + //set presence as pending for the added contact + MPresenceBuddyInfo2* buddyPresInfo = MPresenceBuddyInfo2::NewLC(); + + MPresenceCacheWriter2* presenceCacheWriter = MPresenceCacheWriter2::CreateWriterL(); + CleanupDeletePushL(presenceCacheWriter); + HBufC* name = HBufC::NewLC( aContactName.Length() + iConnMan.ServiceName().Length() + KColon().Length() ); + TPtr namePtr( name->Des() ); + namePtr.Zero(); + namePtr.Append(iConnMan.ServiceName() ); // prepend service name + namePtr.Append(KColon); + namePtr.Append(aContactName ); + buddyPresInfo->SetIdentityL(namePtr); + buddyPresInfo->SetAnyFieldL(KExtensionKey,KPendingRequestExtensionValue()); + CleanupStack::PopAndDestroy(1);//name + + // Writing into Presence Cache + TInt cacheerror = presenceCacheWriter->WritePresenceL(buddyPresInfo); + User::LeaveIfError ( cacheerror); + CleanupStack::PopAndDestroy(2);//presenceCacheWriter,buddyPresInfo + CleanupStack::Pop( 4 ); // contactName, contactIdentity , groupIdentity , groupMemberInfo + } + +// --------------------------------------------------------------------------- +// COSSContactManager::RemoveInvitationFromLocalL() +// --------------------------------------------------------------------------- +// +void COSSContactManager::RemoveInvitationFromLocalL(const TDesC& aContactName) + { + MXIMPObjectFactory& ObjFact = iConnMan.HandleToHost().ObjectFactory(); + MPresenceObjectFactory& prfwObjFact = iConnMan.HandleToHost().ProtocolPresenceDataHost().PresenceObjectFactory(); + MXIMPIdentity* authReqIdentity = ObjFact.NewIdentityLC();//1 + if( authReqIdentity ) + { + authReqIdentity->SetIdentityL(aContactName); + for(TInt i = 0; i +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "cossprotocolconnectionmanager.h" +#include "cossprotocolpresencefeatures.h" +#include "cossprotocolimfeatures.h" +#include "ossprotocolpluginlogger.h" +#include "cossprotocolloginrequest.h" +#include "mossprotocolconnectionmanager.h" + +#include +#include "cossprotocolsearchfeatures.h" +#include "cossprotocollogoutrequest.h" +#include + +// ======== COSSProtocolConnection - MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// COSSProtocolConnection::COSSProtocolConnection() +// --------------------------------------------------------------------------- +// +COSSProtocolConnection::COSSProtocolConnection() + { + LOGGER ( TXT ( "COSSProtocolConnection::COSSProtocolConnection() Start-End" ) ); + } + +// --------------------------------------------------------------------------- +// COSSProtocolConnection::ConstructL() +// --------------------------------------------------------------------------- +// +void COSSProtocolConnection::ConstructL ( + const MXIMPServiceInfo& aServiceInfo , + const MXIMPContextClientInfo& aClientCtxInfo ) + { + LOGGER ( TXT ( "COSSProtocolConnection::ConstructL() Start" ) ); + + PLUGIN_UNUSED_PARAM ( aClientCtxInfo ); + iConnMan = COSSProtocolConnectionManager::NewL(); + + iConnMan->SetConnectionParamsL ( aServiceInfo.UserId(), + aServiceInfo.Password(), + aServiceInfo.IapId() ); + iPresFeatures = COSSProtocolPresenceFeatures::NewL ( *iConnMan ); + iImFeatures = COSSProtocolImFeatures::NewL ( *iConnMan ); + iSearchFeatures= COSSProtocolSearchFeature::NewL ( *iConnMan ); + LOGGER ( TXT ( "COSSProtocolConnection::ConstructL() End" ) ); + } + + +// --------------------------------------------------------------------------- +// COSSProtocolConnection::NewL() +// --------------------------------------------------------------------------- +// +COSSProtocolConnection* COSSProtocolConnection::NewL ( + const MXIMPServiceInfo& aServiceInfo, + const MXIMPContextClientInfo& aClientCtxInfo ) + { + LOGGER ( TXT ( "COSSProtocolConnection::NewL() Start" ) ); + + COSSProtocolConnection* self = new ( ELeave ) COSSProtocolConnection; + CleanupStack::PushL ( self ); + self->ConstructL ( aServiceInfo, aClientCtxInfo ); + CleanupStack::Pop ( self ); + + LOGGER ( TXT ( "COSSProtocolConnection::NewL() End" ) ); + return self; + } + + +// --------------------------------------------------------------------------- +// COSSProtocolConnection::~COSSProtocolConnection() +// --------------------------------------------------------------------------- +// +COSSProtocolConnection::~COSSProtocolConnection() + { + LOGGER ( TXT ( "COSSProtocolConnection::~COSSProtocolConnection() Start" ) ); + + delete iSearchFeatures; + delete iConnMan; + delete iPresFeatures; + delete iImFeatures; + LOGGER ( TXT ( "COSSProtocolConnection::~COSSProtocolConnection() End" ) ); + } + + +// --------------------------------------------------------------------------- +// COSSProtocolConnection::GetInterface() +// --------------------------------------------------------------------------- +// +TAny* COSSProtocolConnection::GetInterface ( TInt32 aInterfaceId, + TIfGetOps aOptions ) + { + LOGGER ( TXT ( "COSSProtocolConnection::GetInterface() Start" ) ); + + if ( aInterfaceId == MXIMPProtocolConnection::KInterfaceId ) + { + MXIMPProtocolConnection* self = this; + return self; + } + + if ( aOptions == MXIMPBase::EPanicIfUnknown ) + + { + User::Panic ( KOSSProtocolConnection, KErrExtensionNotSupported ); + } + + LOGGER ( TXT ( "COSSProtocolConnection::GetInterface() End" ) ); + + return NULL; + } + + +// --------------------------------------------------------------------------- +// COSSProtocolConnection::GetInterface() const +// --------------------------------------------------------------------------- +// +const TAny* COSSProtocolConnection::GetInterface ( TInt32 aInterfaceId, + TIfGetOps aOptions ) const + { + LOGGER ( TXT ( "COSSProtocolConnection::GetInterface() const Start" ) ); + + if ( aInterfaceId == MXIMPProtocolConnection::KInterfaceId ) + { + const MXIMPProtocolConnection* self = this; + return self; + } + + if ( aOptions == MXIMPBase::EPanicIfUnknown ) + { + User::Panic ( KOSSProtocolConnection, KErrExtensionNotSupported ); + } + + LOGGER ( TXT ( "COSSProtocolConnection::GetInterface() const End" ) ); + + return NULL; + } + + +// --------------------------------------------------------------------------- +// COSSProtocolConnection::GetInterfaceId() const +// --------------------------------------------------------------------------- +// +TInt32 COSSProtocolConnection::GetInterfaceId() const + { + LOGGER ( TXT ( "COSSProtocolConnection::GetInterfaceId() Start-End" ) ); + return MXIMPProtocolConnection::KInterfaceId; + } + + +// --------------------------------------------------------------------------- +// COSSProtocolConnection::PrimeHost() +// --------------------------------------------------------------------------- +// +void COSSProtocolConnection::PrimeHost ( MXIMPProtocolConnectionHost& aHost ) + { + LOGGER ( TXT ( "COSSProtocolConnection::PrimeHost() Start" ) ); + + iConnMan->SetHost ( aHost ); + + LOGGER ( TXT ( "COSSProtocolConnection::PrimeHost() Start" ) ); + } + + +// --------------------------------------------------------------------------- +// COSSProtocolConnection::OpenSessionL() +// --------------------------------------------------------------------------- +// +void COSSProtocolConnection::OpenSessionL ( + const MXIMPContextClientInfo& /*aClientCtxInfo*/, + TXIMPRequestId aOpId ) + { + if( iConntectionCreated ) + { + iConntectionCreated++; + iConnMan->HandleToHost().HandleRequestCompleted(aOpId,KErrNone); + } + else + { + LOGGER(TXT("COSSProtocolConnection::OpenSessionL \n")); + COSSProtocolLoginRequest* req = + COSSProtocolLoginRequest::NewLC( *iConnMan, aOpId ); + + req->IssueLoginRequestL(); + CleanupStack::Pop( req ); + iConntectionCreated++; + } + + LOGGER ( TXT ( "COSSProtocolConnection::OpenSessionL() End" ) ); + } + +// --------------------------------------------------------------------------- +// COSSProtocolConnection::OpenSessionL() +// --------------------------------------------------------------------------- +// +void COSSProtocolConnection::OpenSessionL ( const TInt& aServiceId, + TXIMPRequestId aReqId ) + { + LOGGER ( TXT ( "COSSProtocolConnection::OpenSessionLsettingsid \n" ) ); + if( iConntectionCreated ) + { + iConntectionCreated++; + iConnMan->HandleToHost().HandleRequestCompleted(aReqId,KErrNone); + } + else + { + TInt error = iConnMan->SetConnectionParamsL ( aServiceId ); + LOGGER ( TXT ( "COSSProtocolConnection::OpenSessionL settings id is %d" ), aServiceId ); + + if( error == KErrNotFound ) + { + iConnMan->HandleToHost().HandleRequestCompleted(aReqId,KXIMPErrServiceGeneralError); + } + else + { + COSSProtocolLoginRequest* req = + COSSProtocolLoginRequest::NewLC ( *iConnMan, aReqId ); + req->IssueLoginRequestL(); + CleanupStack::Pop ( req ); + iConntectionCreated++; + } + } + + LOGGER ( TXT ( "COSSProtocolConnection::OpenSessionLsettingsid() End" ) ); + } + +// --------------------------------------------------------------------------- +// COSSProtocolConnection::OpenSessionL() +// --------------------------------------------------------------------------- +// + +void COSSProtocolConnection::OpenSessionL ( + const MXIMPContextClientInfo& /*aContextClient*/, + const TInt& /*aSettingsId*/, + TXIMPRequestId /*aReqId*/ ) + { + + } + +// --------------------------------------------------------------------------- +// COSSProtocolConnection::CloseSession() +// --------------------------------------------------------------------------- +// +void COSSProtocolConnection::CloseSession ( + const MXIMPContextClientInfo& /*aClientCtxInfo*/, + TXIMPRequestId aOpId ) + { + LOGGER ( TXT ( "COSSProtocolConnection::CloseSession() Start" ) ); + iConntectionCreated--; + + // if server already disconnected no need to issue logout request + TBool serverdisconnect = iConnMan->IsServerDisconnect(); + + if(!iConntectionCreated && !serverdisconnect ) + { + iRequestId = aOpId; + TRAPD(error,LogoutRequestL(aOpId)); + if( KErrNone != error ) + { + iConnMan->HandleToHost().HandleRequestCompleted(aOpId,error); + + } + } + else + { + iConnMan->HandleToHost().HandleRequestCompleted(aOpId,KErrNone); + } + LOGGER ( TXT ( "COSSProtocolConnection::CloseSession() End" ) ); + } + + +// --------------------------------------------------------------------------- +// COSSProtocolConnection::ReOpenSessionsL() +// --------------------------------------------------------------------------- +// +void COSSProtocolConnection::ReOpenSessionsL ( TXIMPRequestId /*aOpId*/ ) + { + LOGGER ( TXT ( "COSSProtocolConnection::ReOpenSessionsL() Start" ) ); + + LOGGER ( TXT ( "COSSProtocolConnection::ReOpenSessionsL() End" ) ); + } + + +// --------------------------------------------------------------------------- +// COSSProtocolConnection::GetSupportedFeaturesL() +// --------------------------------------------------------------------------- +// +void COSSProtocolConnection::GetSupportedFeaturesL ( CDesC8Array& aFeatures ) const + { + LOGGER ( TXT ( "COSSProtocolConnection::GetSupportedFeaturesL() Start End" ) ); + // first empty the whole array + aFeatures.Reset(); + // then add our features there + // currently we are not doing any negotiation from the server for the supported features. + // based on our implimentation we are hardcoding these values. + // actual implimentatiion requires client server negotiation to tackle supported features. + + using namespace NXIMPFeature::Presence; + aFeatures.AppendL( KPublish ); + aFeatures.AppendL( KFetch ); + aFeatures.AppendL( KSubscribe ); + aFeatures.AppendL( KUnsubscribe ); + aFeatures.AppendL( KAddContact ); + aFeatures.AppendL( KDeleteContact ); + aFeatures.AppendL( KAvatar ); + + using namespace NXIMPFeature::InstantMessage; + aFeatures.AppendL( KInstantMessage ); + + using namespace NXIMPFeature::Search; + aFeatures.AppendL( KSearch ); + + LOGGER ( TXT ( "COSSProtocolConnection::GetSupportedFeaturesL" ) ); + } + +// --------------------------------------------------------------------------- +// COSSProtocolConnection::ProtocolPresenceFeatures() +// --------------------------------------------------------------------------- +// +MProtocolPresenceFeatures& COSSProtocolConnection::ProtocolPresenceFeatures() + { + LOGGER ( TXT ( "COSSProtocolConnection::ProtocolPresenceFeatures() Start " ) ); + return *iPresFeatures; + } +// --------------------------------------------------------------------------- +// COSSProtocolConnection::ProtocolImFeatures() +// --------------------------------------------------------------------------- +// +/* +CProtocolImFeatures* COSSProtocolConnection::ProtocolImFeatures() + { + LOGGER ( TXT ( "COSSProtocolConnection::ProtocolImFeatures() Start " ) ); + return iImFeatures; + }*/ + +// --------------------------------------------------------------------------- +// COSSProtocolConnection::ReleaseConnectionL() +// --------------------------------------------------------------------------- +// + +void COSSProtocolConnection::ReleaseConnectionL() + { + LOGGER ( TXT ( "COSSProtocolConnection::ReleaseConnectionL() Start " ) ); + if( iConnMan ) + { + iConnMan->ReleaseConnectionL(); + } + + LOGGER ( TXT ( "COSSProtocolConnection::ReleaseConnectionL() End" ) ); + } +// --------------------------------------------------------------------------- +// COSSProtocolConnection::LogoutRequestL() +// --------------------------------------------------------------------------- +// +void COSSProtocolConnection::LogoutRequestL(TXIMPRequestId aOpId) + { + COSSProtocolLogoutRequest* req = COSSProtocolLogoutRequest::NewLC ( *iConnMan, aOpId ); + + req->IssueLogoutRequestL(); + + CleanupStack::Pop ( req ); + + + } +// --------------------------------------------------------------------------- +// COSSProtocolConnection::GetProtocolInterface +// --------------------------------------------------------------------------- +// + +TAny* COSSProtocolConnection::GetProtocolInterface(TInt aInterfaceId) + { + LOGGER ( TXT ( "COSSProtocolConnection::ProtocolImFeatures() Start " ) ); + + //return iImFeatures->GetInterface(aInterfaceId, MXIMPBase::EPanicIfUnknown ); + + if(aInterfaceId == CProtocolImFeatures::KInterfaceId) + { + return iImFeatures->GetInterface(aInterfaceId, MXIMPBase::EPanicIfUnknown ); + } + + else if(aInterfaceId == MProtocolSearchFeature::KInterfaceId) + { + return iSearchFeatures->GetInterface(aInterfaceId, MXIMPBase::EPanicIfUnknown ) ; + } + + return NULL; + } + diff -r 000000000000 -r e6b17d312c8b imservices/ossprotocoladaptation/src/cossprotocolconnectionmanager.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/ossprotocoladaptation/src/cossprotocolconnectionmanager.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,371 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: connection manager +* +*/ + +#include "cossprotocolconnectionmanager.h" +#include "cossprotocolservererrorhandler.h" +#include "ccontactsynchandler.h" +#include +#include +#include +#include +#include +#include "xmppservicesettingsapi.h" +#include "xmppparams.h" //from xmppsettingsapi + +#include "xmppsettingsfetcher.h" +#include "xmppparameters.h" +#include "waittimer.h" + +#include +#include +#include + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// COSSProtocolConnectionManager::COSSProtocolConnectionManager() +// --------------------------------------------------------------------------- +// +COSSProtocolConnectionManager::COSSProtocolConnectionManager() + { + } + + +// --------------------------------------------------------------------------- +// COSSProtocolConnectionManager::ConstructL() +// --------------------------------------------------------------------------- +// +void COSSProtocolConnectionManager::ConstructL() + { + iXmppParams = CXmppParameters::NewL(); + iTimer = CWaitTimer::NewL (*this); + iTimer->StartListeningL(); //start listening message queue updation + iNotifier = CPresenceNotificationHandler::NewL ( *this ); + iNotifier->StartListeningL(); //start listening presence notifications + iSearchKeyStore = CSearchKeyStore::NewL(); + iContactManager = COSSContactManager::NewL( *this ); + + } + + +// --------------------------------------------------------------------------- +// COSSProtocolConnectionManager::NewL() +// --------------------------------------------------------------------------- +// +COSSProtocolConnectionManager* COSSProtocolConnectionManager::NewL() + { + + COSSProtocolConnectionManager* self = new ( ELeave ) + COSSProtocolConnectionManager(); + + CleanupStack::PushL ( self ); + + self->ConstructL(); + CleanupStack::Pop ( self ); + + return self; + } + + +// --------------------------------------------------------------------------- +// COSSProtocolConnectionManager::~COSSProtocolConnectionManager() +// --------------------------------------------------------------------------- +// +COSSProtocolConnectionManager::~COSSProtocolConnectionManager() + { + delete iXmppParams; + delete iNotifier; + delete iRecvHandler; + delete iServerErrorHandler; + delete iAddNotificationHanlder; + delete iContactSyncHandler; + delete iUserName; + delete iPassword; + delete iTimer; + delete iGroupId; + delete iContactManager; + delete iSearchKeyStore; + if(iServiceName) + { + delete iServiceName; + } + } + + +// --------------------------------------------------------------------------- +// COSSProtocolConnectionManager::Username +// --------------------------------------------------------------------------- +// +TDesC& COSSProtocolConnectionManager::UserName() + { + return *iUserName; + } + + +// --------------------------------------------------------------------------- +// COSSProtocolConnectionManager::Password +// --------------------------------------------------------------------------- +// +TDesC& COSSProtocolConnectionManager::Password() + { + return *iPassword; + } + +// --------------------------------------------------------------------------- +// COSSProtocolConnectionManager::GroupID +// --------------------------------------------------------------------------- +// +TDesC& COSSProtocolConnectionManager::GroupId() + { + return *iGroupId; + } + +// --------------------------------------------------------------------------- +// COSSProtocolConnectionManager::GroupID +// --------------------------------------------------------------------------- +// +void COSSProtocolConnectionManager::SetGroupIDL(TDesC& aGroupId) + { + HBufC* tmpId = aGroupId.AllocL(); + delete iGroupId; + iGroupId=NULL; + iGroupId = tmpId ; + } + +// --------------------------------------------------------------------------- +// COSSProtocolConnectionManager::XmppParams +// --------------------------------------------------------------------------- +// +CXmppParameters& COSSProtocolConnectionManager::XmppParams() + { + return *iXmppParams; + } + + +// --------------------------------------------------------------------------- +// COSSProtocolConnectionManager::DataHandler() +// --------------------------------------------------------------------------- +// +CWaitTimer& COSSProtocolConnectionManager::DataHandler() + { + return *iTimer; + } + +// --------------------------------------------------------------------------- +// COSSProtocolConnectionManager::HandleToHost() +// --------------------------------------------------------------------------- +// +MXIMPProtocolConnectionHost& COSSProtocolConnectionManager::HandleToHost() + { + return *iHostHandle; + } + + +// --------------------------------------------------------------------------- +// COSSProtocolConnectionManager::SetHost() +// --------------------------------------------------------------------------- +// +void COSSProtocolConnectionManager::SetHost ( MXIMPProtocolConnectionHost& aHost ) + { + iHostHandle = &aHost; + } + +// --------------------------------------------------------------------------- +// COSSProtocolConnectionManager::SetConnectionParamsL() +// --------------------------------------------------------------------------- +// +void COSSProtocolConnectionManager::SetConnectionParamsL ( const TDesC& aUserName, + const TDesC& aPassword, + const TInt32 aServiceId ) + { + + // first store the login parameters + + HBufC* tmpBuf = aUserName.AllocL(); + delete iUserName; + iUserName = tmpBuf; + + tmpBuf = aPassword.AllocL(); + delete iPassword; + iPassword = tmpBuf; + + SetConnectionParamsL( aServiceId, EFalse ); + } + + +// --------------------------------------------------------------------------- +// COSSProtocolConnectionManager::ManufactureDataHandlerL() +// --------------------------------------------------------------------------- +// +void COSSProtocolConnectionManager::ManufactureDataHandlerL() + { + if(!iIsDataHandlerReady) + { + iRecvHandler = CReceiveMessageHandler::NewL ( *this ); + iRecvHandler->StartListeningL();//start listening incoming messages + iServerErrorHandler = COssprotocolServerErrorHandler::NewL ( *this ); + iServerErrorHandler->StartListeningL();//start listening incoming messages + iAddNotificationHanlder = CAddContactNotificationHandler::NewL ( *this ); + iContactSyncHandler = CContactSyncHandler::NewL(*this); + iContactSyncHandler->StartListening(); // listening for contacts changes + iIsDataHandlerReady = ETrue; + } + } + +// --------------------------------------------------------------------------- +// COSSProtocolConnectionManager::SetConnectionParamsL +// --------------------------------------------------------------------------- +// +TInt COSSProtocolConnectionManager::SetConnectionParamsL ( const TUint32 aServiceId , TBool aReadNeeded /* = ETrue*/ ) + { + // Get the service setting id and service name + TInt error = KErrNone; + + CSPSettings* settings = CSPSettings::NewLC(); + + if(aReadNeeded) + { + TInt settingsId = 0; + CSPProperty* property = CSPProperty::NewLC(); + settings->FindPropertyL( aServiceId, + ESubPropertyIMSettingsId, + *property ); + if ( property ) + { + property->GetValue( settingsId ); + } + // read settings + + error = CXmppSettingsFetcher::ReadSettingsL ( settingsId, *iXmppParams ); //settings id is used to read settings + + CleanupStack::PopAndDestroy(); // property + + } + // read service name + CSPEntry* entry = CSPEntry::NewLC(); + settings->FindEntryL( aServiceId, *entry ) ; + + // set the service name to presence cache updater + if(iServiceName) + { + delete iServiceName; + iServiceName = NULL; + } + iServiceName = entry->GetServiceName().AllocL(); + CleanupStack::PopAndDestroy(2); // entry, settings + + return error; + } +// --------------------------------------------------------------------------- +// COSSProtocolConnectionManager::PresenceAuthGrantReqList() +// --------------------------------------------------------------------------- +// +RArray< HBufC >* COSSProtocolConnectionManager::PresenceAuthGrantReqList() + { + return &iPresenceAuthGrantReqList; + } + +// --------------------------------------------------------------------------- +// COSSProtocolConnectionManager::ReleaseConnectionL() +// --------------------------------------------------------------------------- +// +void COSSProtocolConnectionManager::ReleaseConnectionL() + { + if( iTimer ) + { + iTimer->IssueReleaseRequestL(); + } + } + +// --------------------------------------------------------------------------- +// COSSProtocolConnectionManager::IsServerDisconnect() +// --------------------------------------------------------------------------- +// +TBool COSSProtocolConnectionManager::IsServerDisconnect() + { + return iTimer->IsServerDisconnect(); + } +// --------------------------------------------------------------------------- +// COSSProtocolConnectionManager::SetImHost +// --------------------------------------------------------------------------- +// + +void COSSProtocolConnectionManager::SetImHost(MProtocolImDataHost& aHost) + { + iHost = &aHost ; + } +// --------------------------------------------------------------------------- +// COSSProtocolConnectionManager::GetImHost() +// --------------------------------------------------------------------------- +// +MProtocolImDataHost& COSSProtocolConnectionManager::GetImHost() + { + return *iHost; + } + +// --------------------------------------------------------------------------- +// COSSProtocolConnectionManager::GetAddNotificationHandler() +// --------------------------------------------------------------------------- +// +CAddContactNotificationHandler& COSSProtocolConnectionManager::GetAddNotificationHandler() + { + return *iAddNotificationHanlder; + } +// --------------------------------------------------------------------------- +// COSSProtocolConnectionManager::SetSearchHost +// --------------------------------------------------------------------------- +// +void COSSProtocolConnectionManager::SetSearchHost(MProtocolSearchDataHost& aSearchHost) + { + iSearchHost = &aSearchHost ; + } +// --------------------------------------------------------------------------- +// COSSProtocolConnectionManager::GetSearchHost() +// --------------------------------------------------------------------------- +// +MProtocolSearchDataHost& COSSProtocolConnectionManager::GetSearchHost() + { + return *iSearchHost; + } +// --------------------------------------------------------------------------- +// COSSProtocolConnectionManager::GetSearchKeyStore() +// --------------------------------------------------------------------------- +// +CSearchKeyStore& COSSProtocolConnectionManager::GetSearchKeyStore() + { + return *iSearchKeyStore; + } + +// --------------------------------------------------------------------------- +// COSSProtocolConnectionManager::GetContactManager() +// --------------------------------------------------------------------------- +// +COSSContactManager& COSSProtocolConnectionManager::GetContactManager() + { + return *iContactManager; + } +// --------------------------------------------------------------------------- +// COSSProtocolConnectionManager::ServiceName() +// --------------------------------------------------------------------------- +// +const TDesC& COSSProtocolConnectionManager::ServiceName() + { + return *iServiceName; + } +// End of File + + diff -r 000000000000 -r e6b17d312c8b imservices/ossprotocoladaptation/src/cossprotocolimfeatures.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/ossprotocoladaptation/src/cossprotocolimfeatures.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,185 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: oss protocol plugin im features +* +*/ + +#include "cossprotocolimfeatures.h" +#include +#include +#include "cossprotocolimconversation.h" +#include "ossprotocolpluginlogger.h" + +_LIT ( KOSSProtocolImFeatures, "COSSProtocolImFeatures" ); + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// COSSProtocolConnection::COSSProtocolImFeatures() +// --------------------------------------------------------------------------- +// +COSSProtocolImFeatures::COSSProtocolImFeatures(COSSProtocolConnectionManager& aConnMan) : iConnMan (aConnMan) + { + } + +// --------------------------------------------------------------------------- +// COSSProtocolImFeatures::ConstructL() +// --------------------------------------------------------------------------- +// +void COSSProtocolImFeatures::ConstructL ( + COSSProtocolConnectionManager& aConnMan ) + { + iImConversation = COSSProtocolImConversation::NewL ( aConnMan ); + } + +// --------------------------------------------------------------------------- +// COSSProtocolImFeatures::NewL() +// --------------------------------------------------------------------------- +// +COSSProtocolImFeatures* COSSProtocolImFeatures::NewL ( + COSSProtocolConnectionManager& aConnMan ) + { + + COSSProtocolImFeatures* self = new ( ELeave ) COSSProtocolImFeatures(aConnMan); + CleanupStack::PushL ( self ); + self->ConstructL ( aConnMan ); + CleanupStack::Pop ( self ); + + return self; + } + +// --------------------------------------------------------------------------- +// COSSProtocolImFeatures::~COSSProtocolImFeatures() +// --------------------------------------------------------------------------- +// +COSSProtocolImFeatures::~COSSProtocolImFeatures() + { + delete iImConversation; + } + + +// --------------------------------------------------------------------------- +// COSSProtocolImFeatures::GetInterface() +// --------------------------------------------------------------------------- +// +TAny* COSSProtocolImFeatures::GetInterface ( TInt32 aInterfaceId, + TIfGetOps aOptions ) + { + if ( aInterfaceId == CProtocolImFeatures::KInterfaceId ) + { + CProtocolImFeatures* self = this; + return self; + } + + if ( aOptions == MXIMPBase::EPanicIfUnknown ) + + { + User::Panic ( KOSSProtocolImFeatures, KErrExtensionNotSupported ); + } + + return NULL; + } + + +// --------------------------------------------------------------------------- +// COSSProtocolImFeatures::GetInterface() +// --------------------------------------------------------------------------- +// +const TAny* COSSProtocolImFeatures::GetInterface ( TInt32 aInterfaceId, + TIfGetOps aOptions ) const + { + + if ( aInterfaceId == CProtocolImFeatures::KInterfaceId ) + { + const CProtocolImFeatures* self = this; + return self; + } + + if ( aOptions == MXIMPBase::EPanicIfUnknown ) + { + User::Panic ( KOSSProtocolImFeatures, KErrExtensionNotSupported ); + } + + return NULL; + } + + +// --------------------------------------------------------------------------- +// COSSProtocolImFeatures::GetInterfaceId() const +// --------------------------------------------------------------------------- +// +TInt32 COSSProtocolImFeatures::GetInterfaceId() const + { + return CProtocolImFeatures::KInterfaceId; + } + + +// --------------------------------------------------------------------------- +// COSSProtocolImFeatures::ImConversation() +// --------------------------------------------------------------------------- +// +MProtocolImConversation& COSSProtocolImFeatures::ImConversation() + { + return *iImConversation; + } + +// --------------------------------------------------------------------------- +// COSSProtocolImFeatures::ImGroup() +// --------------------------------------------------------------------------- +// +MProtocolImGroup& COSSProtocolImFeatures::ImGroup() + { + MProtocolImGroup* dummyGroup = NULL; + return *dummyGroup; + //Not supported + } + +// --------------------------------------------------------------------------- +// COSSProtocolImFeatures::ImInvitation() +// --------------------------------------------------------------------------- +// +MProtocolImInvitation& COSSProtocolImFeatures::ImInvitation() + { + //Not supported + MProtocolImInvitation* dummyInvitation = NULL; + return *dummyInvitation; + + } +// --------------------------------------------------------------------------- +// COSSProtocolImFeatures::SupportedSubInterfaces() +// --------------------------------------------------------------------------- +// +TInt COSSProtocolImFeatures::SupportedSubInterfaces() const + { + return KErrNone; + + } +// --------------------------------------------------------------------------- +// COSSProtocolImFeatures::ImSearch() +// --------------------------------------------------------------------------- +// +MProtocolImSearch& COSSProtocolImFeatures::ImSearch() + { + //ignore compiler worning ,Not supported + MProtocolImSearch* dummySearch = NULL; + return *dummySearch; + + } +void COSSProtocolImFeatures::SetHost(MProtocolImDataHost& aHost ) + { + iHost = &aHost ; + iConnMan.SetImHost(aHost) ; + } + +// End of file diff -r 000000000000 -r e6b17d312c8b imservices/ossprotocoladaptation/src/cossprotocolloginrequest.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/ossprotocoladaptation/src/cossprotocolloginrequest.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,420 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Login Request to the Network Server. +* +*/ + + +#include "cossprotocolloginrequest.h" +#include +#include "mossprotocolconnectionmanager.h" +#include "ossprotocolpluginlogger.h" +#include "cossprotocolconnection.h" +#include "cossprotocolconnectionmanager.h" +#include +#include "stringutils.h" +#include +#include "msgliterals.h" +#include "msg_enums.h" +#include "xmppparameters.h" +#include "waittimer.h" +#include + +#include + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// COSSProtocolLoginRequest::COSSProtocolLoginRequest() +// --------------------------------------------------------------------------- +// +COSSProtocolLoginRequest::COSSProtocolLoginRequest ( + MOSSProtocolConnectionManager& aConnMan, + TXIMPRequestId aRequestId ) : + CActive ( CActive::EPriorityStandard ), + iRequestId ( aRequestId ), + iConnMan ( aConnMan ) + { + LOGGER ( TXT ( "COSSProtocolLoginRequest::COSSProtocolLoginRequest Start" ) ); + CActiveScheduler::Add ( this ); + LOGGER ( TXT ( "COSSProtocolLoginRequest::COSSProtocolLoginRequest End" ) ); + } + +// COSSProtocolLoginRequest::ConstructL() +// --------------------------------------------------------------------------- +// +void COSSProtocolLoginRequest::ConstructL() + { + LOGGER ( TXT ( "COSSProtocolLoginRequest::COSSProtocolLoginRequest Start-End" ) ); + LOGGER ( TXT ( "COSSProtocolLoginRequest::COSSProtocolLoginRequest End" ) ); + } + + +// --------------------------------------------------------------------------- +// COSSProtocolLoginRequest::NewL() +// --------------------------------------------------------------------------- +// +COSSProtocolLoginRequest* COSSProtocolLoginRequest::NewL ( + MOSSProtocolConnectionManager& aConnMan, + TXIMPRequestId aRequestId ) + { + LOGGER ( TXT ( "COSSProtocolLoginRequest::NewL Start" ) ); + + COSSProtocolLoginRequest* self = + new ( ELeave ) COSSProtocolLoginRequest ( aConnMan, aRequestId ); + CleanupStack::PushL ( self ); + self->ConstructL(); + CleanupStack::Pop ( self ); + + LOGGER ( TXT ( "COSSProtocolLoginRequest::NewL End" ) ); + return self; + } + + +// --------------------------------------------------------------------------- +// COSSProtocolLoginRequest::NewLC() +// --------------------------------------------------------------------------- +// +COSSProtocolLoginRequest* COSSProtocolLoginRequest::NewLC ( + MOSSProtocolConnectionManager& aConnMan, + TXIMPRequestId aRequestId ) + { + LOGGER ( TXT ( "COSSProtocolLoginRequest::NewLC Start" ) ); + + COSSProtocolLoginRequest* self = + COSSProtocolLoginRequest::NewL ( aConnMan, aRequestId ); + CleanupStack::PushL ( self ); + + LOGGER ( TXT ( "COSSProtocolLoginRequest::NewLC End" ) ); + return self; + } + +// --------------------------------------------------------------------------- +// COSSProtocolLoginRequest::~COSSProtocolLoginRequest() +// --------------------------------------------------------------------------- +// +COSSProtocolLoginRequest::~COSSProtocolLoginRequest() + { + LOGGER ( TXT ( "::~COSSProtocolLoginRequest Start-End" ) ); + Cancel(); + if( iUserName ) + { + delete iUserName; + } + + LOGGER ( TXT ( "::~COSSProtocolLoginRequest End\n" ) ); + } + + +// --------------------------------------------------------------------------- +// COSSProtocolLoginRequest::DoCancel() +// --------------------------------------------------------------------------- +// +void COSSProtocolLoginRequest::DoCancel() + { + } + + +// --------------------------------------------------------------------------- +// COSSProtocolLoginRequest::RunL() +// --------------------------------------------------------------------------- +// +void COSSProtocolLoginRequest::RunL() + { + LOGGER ( TXT ( "COSSProtocolLoginRequest::RunL Start" ) ); + message_hdr_resp* msg_struct = NULL; + User::LeaveIfError ( iStatus.Int() ); + char* pResponse = NULL; + pResponse = iConnMan.DataHandler().ResponseL ( iSendId ); + + msg_struct = ( message_hdr_resp* )pResponse ; + if( !( msg_struct->response ) ) + { + switch( msg_struct->error_type ) + { + case ELOGIN_NETWORK_ERROR: + LOGGER ( TXT ( "COSSProtocolLoginRequest::RunL ELOGIN_NETWORK_ERROR" ) ); + case ELOGIN_NONE_SPECIFIED: + //XImpfw is not giving any error code for canceling accespoint so we are using KErrDisconnected + //once error code is provided by ximpfw we can remove + LOGGER ( TXT ( "COSSProtocolLoginRequest::RunL ELOGIN_NONE_SPECIFIED" ) ); + iConnMan.HandleToHost().HandleRequestCompleted ( iRequestId, KErrDisconnected ); + break; + case ELOGIN_AUTHENTICATION: //The username or password was invalid. + LOGGER ( TXT ( "COSSProtocolLoginRequest::RunL ELOGIN_AUTHENTICATION" ) ); + iConnMan.HandleToHost().HandleRequestCompleted ( iRequestId, KXIMPErrServiceAuthenticationFailed ); + break; + default: //for all other error codes like ssl related are mapped to general error ELOGIN_AUTHORIZATION + LOGGER ( TXT ( "COSSProtocolLoginRequest::RunL defualt" ) ); + iConnMan.HandleToHost().HandleRequestCompleted ( iRequestId, KXIMPErrServiceGeneralError ); + break; + } + } + else + { + iConnMan.HandleToHost().HandleRequestCompleted ( iRequestId, KErrNone ); + MPresenceBuddyInfo2* buddyPresInfo = MPresenceBuddyInfo2::NewLC(); + MPresenceCacheWriter2* presenceCacheWriter = MPresenceCacheWriter2::CreateWriterL(); + HBufC* userName = HBufC::NewLC( iUserName->Length() + iConnMan.ServiceName().Length() + KColon().Length() ); + TPtr namePtr( userName->Des() ); + namePtr.Zero(); + namePtr.Append(iConnMan.ServiceName()); // prepend service name + namePtr.Append(KColon); + namePtr.Append(iUserName->Des() ); + buddyPresInfo->SetIdentityL(namePtr); + LOGGER ( TXT ( "COSSProtocolLoginRequest::owndata:%S " ), userName ); + CleanupStack::PopAndDestroy();//userName + _LIT(KAvailable,"available");//since not getting the own status from downlayer.here + _LIT(KStatusTest,"Online");//is hardcoded once logged in is successfully + HBufC16 *message = KAvailable().AllocLC(); + buddyPresInfo->SetAvailabilityL( MPresenceBuddyInfo2::EAvailable,*message); + HBufC16 *statusmessage = KStatusTest().AllocLC(); + buddyPresInfo->SetStatusMessageL(*statusmessage); + + TInt cacheerror = presenceCacheWriter->WritePresenceL(buddyPresInfo); + User::LeaveIfError ( cacheerror); + CleanupStack::PopAndDestroy ( 3 ); //buddyPresInfo, message ,statusmessage + delete presenceCacheWriter ; + } + + + free( pResponse ); + delete this; + + LOGGER ( TXT ( "COSSProtocolLoginRequest::RunL End" ) ); + + } + + +// --------------------------------------------------------------------------- +// COSSProtocolLoginRequest::RunError() +// --------------------------------------------------------------------------- +// +TInt COSSProtocolLoginRequest::RunError ( TInt aError ) + { + LOGGER ( TXT ( "COSSProtocolLoginRequest::RunError Start" ) ); + + iConnMan.HandleToHost().HandleRequestCompleted ( iRequestId, aError ); + + delete this; + LOGGER ( TXT ( "COSSProtocolLoginRequest::RunError End" ) ); + return KErrNone; + } + + +// --------------------------------------------------------------------------- +// COSSProtocolLoginRequest::IssueLoginRequestL() +// --------------------------------------------------------------------------- +// +void COSSProtocolLoginRequest::IssueLoginRequestL() + { + LOGGER ( TXT ( "COSSProtocolLoginRequest::IssueLoginRequestL Start" ) ); + + char *smsg = NULL; + char *tmpmsg = NULL; + message_hdr_req msgHdr = {0,}; + int userLen = 0; + int totalLen = 0; + int err = 0; + + smsg = ( char* ) User::AllocLC(MAX_MSG_SIZE); + + tmpmsg = ( char* ) User::AllocLC(MAX_MSG_SIZE); + + HBufC* buffer = HBufC::NewLC ( MAX_MSG_SIZE ); + TPtr bufferPtr ( buffer->Des() ); + bufferPtr.Zero(); + memset ( smsg, '\0', MAX_MSG_SIZE ); + memset ( tmpmsg, '\0', MAX_MSG_SIZE ); + + msgHdr.message_type = ELogin_Request; + iConnMan.DataHandler().IncreaseOpId(); + TInt Opid = iConnMan.DataHandler().GetOpId(); + msgHdr.request_id = Opid; + memcpy ( smsg, &msgHdr, sizeof ( message_hdr_req ) ); + totalLen += sizeof ( message_hdr_req ); + bufferPtr.Zero(); + + if ( iConnMan.UserName().Length() == 0 && iConnMan.Password().Length() == 0 ) //if username and pwd are not passed from client.read default settings + { + bufferPtr.Append ( iConnMan.XmppParams().UserName() ); + iUserName = bufferPtr.AllocL(); + LOGGER ( TXT ( "COSSProtocolLoginRequest::UserName:%S " ), & ( iConnMan.XmppParams().UserName() ) ); + memset ( tmpmsg, '\0', MAX_MSG_SIZE ); + err = tbufC16tochar ( bufferPtr, tmpmsg ); + if( -1 == err) + { + iConnMan.HandleToHost().HandleRequestCompleted ( iRequestId, err ); + } + userLen = strlen ( tmpmsg ) + 1; //for '\0' + memcpy ( smsg + totalLen, tmpmsg, userLen ); + totalLen += userLen; + + bufferPtr.Zero(); + bufferPtr.Append ( iConnMan.XmppParams().Passwd() ); + memset ( tmpmsg, '\0', MAX_MSG_SIZE ); + err = tbufC16tochar ( bufferPtr, tmpmsg ); + userLen = strlen ( tmpmsg ) + 1; //for '\0' + memcpy ( smsg + totalLen, tmpmsg, userLen ); + totalLen += userLen; + } + else + { + iUserName = iConnMan.UserName().AllocL(); + bufferPtr.Append ( iConnMan.UserName() ); + LOGGER ( TXT ( "COSSProtocolLoginRequest::UserName:%S " ), & ( iConnMan.UserName() ) ); + memset ( tmpmsg, '\0', MAX_MSG_SIZE ); + err = tbufC16tochar ( bufferPtr, tmpmsg ); + userLen = strlen ( tmpmsg ) + 1; //for '\0' + memcpy ( smsg + totalLen, tmpmsg, userLen ); + totalLen += userLen; + + bufferPtr.Zero(); + bufferPtr.Append ( iConnMan.Password() ); + memset ( tmpmsg, '\0', MAX_MSG_SIZE ); + err = tbufC16tochar ( bufferPtr, tmpmsg ); + userLen = strlen ( tmpmsg ) + 1; //for '\0' + memcpy ( smsg + totalLen, tmpmsg, userLen ); + totalLen += userLen; + + } + + bufferPtr.Zero(); + + bufferPtr.Append ( iConnMan.XmppParams().ServerAddress() ); + LOGGER ( TXT ( "COSSProtocolLoginRequest::RunL:ServerAddress:%S " ), & ( iConnMan.XmppParams().ServerAddress() ) ); + memset ( tmpmsg, '\0', MAX_MSG_SIZE ); + err = tbufC16tochar ( bufferPtr, tmpmsg ); + userLen = strlen ( tmpmsg ) + 1; //for '\0' + memcpy ( smsg + totalLen, tmpmsg, userLen ); + totalLen += userLen; + + //resource + bufferPtr.Zero(); + bufferPtr.Append ( GenResourceId(iConnMan.XmppParams().Resource()) ); + memset ( tmpmsg, '\0', MAX_MSG_SIZE ); + err = tbufC16tochar ( bufferPtr, tmpmsg ); + userLen = strlen ( tmpmsg ) + 1; //for '\0' + memcpy ( smsg + totalLen, tmpmsg, userLen ); + totalLen += userLen; + + //ssl + bufferPtr.Zero(); + bufferPtr.AppendNum ( iConnMan.XmppParams().Ssl() ); + memset ( tmpmsg, '\0', MAX_MSG_SIZE ); + err = tbufC16tochar ( bufferPtr, tmpmsg ); + userLen = strlen ( tmpmsg ) + 1; //for '\0' + memcpy ( smsg + totalLen, tmpmsg, userLen ); + totalLen += userLen; + + //ServerPort + bufferPtr.Zero(); + bufferPtr.AppendNum ( iConnMan.XmppParams().ServerPort() ); + memset ( tmpmsg, '\0', MAX_MSG_SIZE ); + err = tbufC16tochar ( bufferPtr, tmpmsg ); + userLen = strlen ( tmpmsg ) + 1; //for '\0' + memcpy ( smsg + totalLen, tmpmsg, userLen ); + totalLen += userLen; + + //IapId + bufferPtr.Zero(); + bufferPtr.AppendNum ( iConnMan.XmppParams().IapId() ); + memset ( tmpmsg, '\0', MAX_MSG_SIZE ); + err = tbufC16tochar ( bufferPtr, tmpmsg ); + userLen = strlen ( tmpmsg ) + 1; //for '\0' + memcpy ( smsg + totalLen, tmpmsg, userLen ); + totalLen += userLen; + + //connmgr_bus + bufferPtr.Zero(); + bufferPtr.Append ( iConnMan.XmppParams().ConnMgrBus() ); + memset ( tmpmsg, '\0', MAX_MSG_SIZE ); + err = tbufC16tochar ( bufferPtr, tmpmsg ); + userLen = strlen ( tmpmsg ) + 1; //for '\0' + memcpy ( smsg + totalLen, tmpmsg, userLen ); + totalLen += userLen; + + //connmgr_path + bufferPtr.Zero(); + bufferPtr.Append ( iConnMan.XmppParams().ConnMgrPath() ); + memset ( tmpmsg, '\0', MAX_MSG_SIZE ); + err = tbufC16tochar ( bufferPtr, tmpmsg ); + userLen = strlen ( tmpmsg ) + 1; //for '\0' + memcpy ( smsg + totalLen, tmpmsg, userLen ); + totalLen += userLen; + + //protocol + bufferPtr.Zero(); + bufferPtr.Append ( iConnMan.XmppParams().Protocol() ); + memset ( tmpmsg, '\0', MAX_MSG_SIZE ); + err = tbufC16tochar ( bufferPtr, tmpmsg ); + userLen = strlen ( tmpmsg ) + 1; //for '\0' + memcpy ( smsg + totalLen, tmpmsg, userLen ); + totalLen += userLen; + +#ifdef __WINSCW__ + //ProxyServer + bufferPtr.Zero(); + bufferPtr.Append ( iConnMan.XmppParams().ProxyServer() ); + memset ( tmpmsg, '\0', MAX_MSG_SIZE ); + err = tbufC16tochar ( bufferPtr, tmpmsg ); + userLen = strlen ( tmpmsg ) + 1; //for '\0' + memcpy ( smsg + totalLen, tmpmsg, userLen ); + totalLen += userLen; + + //ProxyPort + bufferPtr.Zero(); + bufferPtr.AppendNum ( iConnMan.XmppParams().ProxyPort() ); + memset ( tmpmsg, '\0', MAX_MSG_SIZE ); + err = tbufC16tochar ( bufferPtr, tmpmsg ); + userLen = strlen ( tmpmsg ) + 1; //for '\0' + memcpy ( smsg + totalLen, tmpmsg, userLen ); + totalLen += userLen; +#endif + + + iSendId = iConnMan.DataHandler().SendDataL ( iStatus, smsg, totalLen ); + + // signal the scheduler + SetActive(); + CleanupStack::PopAndDestroy (buffer); + CleanupStack::PopAndDestroy (tmpmsg); + CleanupStack::PopAndDestroy (smsg); + LOGGER ( TXT ( "COSSProtocolConnection::OpenSessionL() End" ) ); + } +// --------------------------------------------------------------------------- +// COSSProtocolLoginRequest::GenResourceId() +// --------------------------------------------------------------------------- +// +TPtrC COSSProtocolLoginRequest::GenResourceId( const TDesC& aResourceId ) + { + TBuf tempRId = aResourceId; + //initialise client id + iResourceId.SetLength(0); + + //generate Resourse here + iResourceId.Append(tempRId); + + TTime time; + time.HomeTime(); + TInt64 seed = time.Int64(); + + TInt i = Math::Rand( seed ); + + iResourceId.AppendFormat( _L("%d"), i); + + return iResourceId; + } + +// End of file diff -r 000000000000 -r e6b17d312c8b imservices/ossprotocoladaptation/src/cossprotocollogoutrequest.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/ossprotocoladaptation/src/cossprotocollogoutrequest.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,200 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Login Request to the Network Server. +* +*/ + + +#include "cossprotocollogoutrequest.h" +#include +#include "mossprotocolconnectionmanager.h" +#include "ossprotocolpluginlogger.h" +#include "cossprotocolconnection.h" +#include "cossprotocolconnectionmanager.h" +#include +#include "stringutils.h" +#include +#include "msgliterals.h" +#include "xmppparameters.h" +#include "msg_enums.h" +#include + + + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// COSSProtocolLogoutRequest::COSSProtocolLogoutRequest() +// --------------------------------------------------------------------------- +// +COSSProtocolLogoutRequest::COSSProtocolLogoutRequest ( + MOSSProtocolConnectionManager& aConnMan, + TXIMPRequestId aRequestId ) : + CActive ( CActive::EPriorityStandard ), + iRequestId ( aRequestId ), + iConnMan ( aConnMan ) + { + LOGGER ( TXT ( "COSSProtocolLogoutRequest::COSSProtocolLogoutRequest Start" ) ); + CActiveScheduler::Add ( this ); + LOGGER ( TXT ( "COSSProtocolLogoutRequest::COSSProtocolLogoutRequest End" ) ); + } + + +// --------------------------------------------------------------------------- +// COSSProtocolLogoutRequest::ConstructL() +// --------------------------------------------------------------------------- +// +void COSSProtocolLogoutRequest::ConstructL() + { + LOGGER ( TXT ( "COSSProtocolLogoutRequest::COSSProtocolLogoutRequest Start-End" ) ); + } + + +// --------------------------------------------------------------------------- +// COSSProtocolLogoutRequest::NewL() +// --------------------------------------------------------------------------- +// +COSSProtocolLogoutRequest* COSSProtocolLogoutRequest::NewL ( + MOSSProtocolConnectionManager& aConnMan, + TXIMPRequestId aRequestId ) + { + LOGGER ( TXT ( "COSSProtocolLogoutRequest::NewL Start" ) ); + + COSSProtocolLogoutRequest* self = + new ( ELeave ) COSSProtocolLogoutRequest ( aConnMan, aRequestId ); + CleanupStack::PushL ( self ); + self->ConstructL(); + CleanupStack::Pop ( self ); + + LOGGER ( TXT ( "COSSProtocolLogoutRequest::NewL End" ) ); + return self; + } + + +// --------------------------------------------------------------------------- +// COSSProtocolLogoutRequest::NewLC() +// --------------------------------------------------------------------------- +// +COSSProtocolLogoutRequest* COSSProtocolLogoutRequest::NewLC ( + MOSSProtocolConnectionManager& aConnMan, + TXIMPRequestId aRequestId ) + { + LOGGER ( TXT ( "COSSProtocolLogoutRequest::NewLC Start" ) ); + + COSSProtocolLogoutRequest* self = + COSSProtocolLogoutRequest::NewL ( aConnMan, aRequestId ); + CleanupStack::PushL ( self ); + + LOGGER ( TXT ( "COSSProtocolLogoutRequest::NewLC End" ) ); + return self; + } + +// --------------------------------------------------------------------------- +// COSSProtocolLogoutRequest::~COSSProtocolLogoutRequest() +// --------------------------------------------------------------------------- +// +COSSProtocolLogoutRequest::~COSSProtocolLogoutRequest() + { + LOGGER ( TXT ( "::~COSSProtocolLogoutRequest Start" ) ); + Cancel(); + } + + +// --------------------------------------------------------------------------- +// COSSProtocolLogoutRequest::DoCancel() +// --------------------------------------------------------------------------- +// +void COSSProtocolLogoutRequest::DoCancel() + { + } + + +// --------------------------------------------------------------------------- +// COSSProtocolLogoutRequest::RunL() +// --------------------------------------------------------------------------- +// +void COSSProtocolLogoutRequest::RunL() + { + LOGGER ( TXT ( "COSSProtocolLogoutRequest::RunL Start" ) ); + message_hdr_resp* msg_struct = NULL; + + User::LeaveIfError ( iStatus.Int() ); + char* pResponse = NULL; + pResponse = iConnMan.DataHandler().ResponseL ( iSendId ); + msg_struct = ( message_hdr_resp* )pResponse ; + + if( !( msg_struct->response ) ) + { + switch( msg_struct->error_type ) + { + + default: //for all other error codes like ssl related are mapped to general error + iConnMan.HandleToHost().HandleRequestCompleted ( iRequestId, KXIMPErrServiceGeneralError ); + break; + } + } + else + { + iConnMan.HandleToHost().HandleRequestCompleted ( iRequestId, KErrNone ); + } + + free( pResponse ); + + + delete this; + + LOGGER ( TXT ( "COSSProtocolLogoutRequest::RunL End" ) ); + } + + +// --------------------------------------------------------------------------- +// COSSProtocolLogoutRequest::RunError() +// --------------------------------------------------------------------------- +// +TInt COSSProtocolLogoutRequest::RunError ( TInt aError ) + { + LOGGER ( TXT ( "COSSProtocolLogoutRequest::RunError Start" ) ); + + iConnMan.HandleToHost().HandleRequestCompleted ( iRequestId, aError ); + + LOGGER ( TXT ( "COSSProtocolLogoutRequest::RunError - id: %d" ), aError ); + + delete this; + LOGGER ( TXT ( "COSSProtocolLogoutRequest::RunError End" ) ); + return KErrNone; + } + + +// --------------------------------------------------------------------------- +// COSSProtocolLogoutRequest::IssueLogoutRequestL() +// --------------------------------------------------------------------------- +// +void COSSProtocolLogoutRequest::IssueLogoutRequestL() + { + LOGGER ( TXT ( "COSSProtocolLogoutRequest::IssueLogoutRequestL Start" ) ); + + message_hdr_req msgHdr = {0,}; + + msgHdr.message_type = ELogout_Request; + + iSendId = iConnMan.DataHandler().SendDataL ( iStatus, ( char* ) &msgHdr, sizeof ( message_hdr_req ) ); + + // signal the scheduler + SetActive(); + + LOGGER ( TXT ( "COSSProtocolConnection::IssueLogoutRequestL() End" ) ); + } + + +// End of file diff -r 000000000000 -r e6b17d312c8b imservices/ossprotocoladaptation/src/cossprotocolplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/ossprotocoladaptation/src/cossprotocolplugin.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,289 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: adaptation for open source +* +*/ + +#include "cossprotocolplugin.h" + +#include "cossprotocolconnection.h" +#include "ossprotocolpluginlogger.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "processlaunher.h" +#include "cuserafter.h" + +_LIT ( KOSSProtocolPlugin, "COSSProtocolPlugin" ); +_LIT ( KIsoserver, "isoserver.exe" ); + + +// ======== MEMBER FUNCTIONS ======== + + +// --------------------------------------------------------------------------- +// Key value pair table to identify correct constructor +// function for the requested interface. +// --------------------------------------------------------------------------- +// +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY ( 0x101FB3E7, COSSProtocolPlugin::NewL ) + }; + + +// --------------------------------------------------------------------------- +// Exported function to return the implementation proxy table +// --------------------------------------------------------------------------- +// +EXPORT_C const TImplementationProxy* ImplementationGroupProxy ( TInt& aTableCount ) + { + + aTableCount = sizeof ( ImplementationTable ) / sizeof ( TImplementationProxy ); + + return ImplementationTable; + } + + +// --------------------------------------------------------------------------- +// COSSProtocolPlugin::COSSProtocolPlugin() +// --------------------------------------------------------------------------- +// +COSSProtocolPlugin::COSSProtocolPlugin() + { + + LOGGER ( TXT ( "COSSProtocolPlugin::COSSProtocolPlugin() Start-End" ) ); + } + + +// --------------------------------------------------------------------------- +// COSSProtocolPlugin::ConstructL() +// --------------------------------------------------------------------------- +// +void COSSProtocolPlugin::ConstructL() + { + LOGGER ( TXT ( "COSSProtocolPlugin::ConstructL() Start" ) ); + iIsoServerLauncher = CProcessLauncher::NewL ( KIsoserver ); + LOGGER ( TXT ( "COSSProtocolPlugin::ConstructL() End" ) ); + } + + +// --------------------------------------------------------------------------- +// COSSProtocolPlugin::NewLC() +// --------------------------------------------------------------------------- +// +COSSProtocolPlugin* COSSProtocolPlugin::NewLC() + { + LOGGER ( TXT ( "COSSProtocolPlugin::NewLC() Start" ) ); + + COSSProtocolPlugin* self = COSSProtocolPlugin::NewL(); + CleanupStack::PushL ( self ); + + LOGGER ( TXT ( "COSSProtocolPlugin::NewLC() End" ) ); + return self; + } + + +// --------------------------------------------------------------------------- +// COSSProtocolPlugin::NewL() +// --------------------------------------------------------------------------- +// +COSSProtocolPlugin* COSSProtocolPlugin::NewL() + { + LOGGER ( TXT ( "=============================START=========================================" ) ); + LOGGER ( TXT ( "COSSProtocolPlugin::NewL() Start" ) ); + + COSSProtocolPlugin* self = new ( ELeave ) COSSProtocolPlugin(); + CleanupStack::PushL ( self ); + self->ConstructL(); + CleanupStack::Pop ( self ); + + LOGGER ( TXT ( "COSSProtocolPlugin::NewL() End :Address of %d" ), &self ); + return self; + } + + +// --------------------------------------------------------------------------- +// COSSProtocolPlugin::~COSSProtocolPlugin() +// --------------------------------------------------------------------------- +// +COSSProtocolPlugin::~COSSProtocolPlugin() + { + LOGGER ( TXT ( "COSSProtocolPlugin::~COSSProtocolPlugin() Start" ) ); + delete iIsoServerLauncher; + + iConnections.ResetAndDestroy(); + + LOGGER ( TXT ( "COSSProtocolPlugin::~COSSProtocolPlugin() End" ) ); + LOGGER ( TXT ( "=============================END=========================================" ) ); + } + + +// --------------------------------------------------------------------------- +// COSSProtocolPlugin::PrimeHost() +// --------------------------------------------------------------------------- +// +void COSSProtocolPlugin::PrimeHost ( MXIMPProtocolPluginHost& aHost ) + { + LOGGER ( TXT ( "COSSProtocolPlugin::PrimeHost() Start" ) ); + + iHost = &aHost; + + LOGGER ( TXT ( "COSSProtocolPlugin::PrimeHost() End" ) ); + } + + +// --------------------------------------------------------------------------- +// COSSProtocolPlugin::AcquireConnectionL() +// --------------------------------------------------------------------------- +// +MXIMPProtocolConnection& COSSProtocolPlugin::AcquireConnectionL ( + const MXIMPServiceInfo& aServiceInfo, + const MXIMPContextClientInfo& aClientCtxInfo ) + { + LOGGER ( TXT ( "COSSProtocolPlugin::AcquireConnectionL() Start" ) ); + + TInt count = iConnections.Count(); + //COSSProtocolConnection* connection = NULL; + // count how many connections are there in plugin + // create new connection if array is empty + // create existing connection based on check if it + if ( count == 0 ) + { + COSSProtocolConnection* connection = COSSProtocolConnection::NewL ( aServiceInfo, aClientCtxInfo ); + CleanupStack::PushL ( connection ); + iConnections.AppendL ( connection ); + CleanupStack::Pop ( connection ); + iIsoServerLauncher->LaunchProcessL(); + LOGGER ( TXT ( "COSSProtocolPlugin::isoserver launched" ) ); + LOGGER ( TXT ( "COSSProtocolPlugin::AcquireConnectionL() End" ) ); + return *connection; + + } + else if ( count == 1 ) + { + LOGGER(TXT("COSSProtocolPlugin::AcquireConnectionL() End") ); + return *iConnections[0]; + } + else + { + // even if there are many connection objects, we just return + // the reference to the first connection object which is + // initiated by CCH + return *iConnections[0]; + } + } + + +// --------------------------------------------------------------------------- +// COSSProtocolPlugin::ReleaseConnection() +// --------------------------------------------------------------------------- +// +void COSSProtocolPlugin::ReleaseConnection ( MXIMPProtocolConnection& aConnection ) + { + LOGGER ( TXT ( "COSSProtocolPlugin::ReleaseConnection() Start" ) ); + + TInt connectionsCount = iConnections.Count(); + + for ( TInt i ( connectionsCount - 1 ); i >= 0; i-- ) + { + MXIMPProtocolConnection* tmp = iConnections[i]; + + if ( tmp == &aConnection ) + { + TRAP_IGNORE( iConnections[i]->ReleaseConnectionL() ); + delete iConnections[i]; + iConnections.Remove ( i ); + } + } + + LOGGER ( TXT ( "COSSProtocolPlugin::ReleaseConnection() End" ) ); + } + + +// --------------------------------------------------------------------------- +// COSSProtocolPlugin::GetInterface() +// --------------------------------------------------------------------------- +// +TAny* COSSProtocolPlugin::GetInterface ( TInt32 aInterfaceId, + TIfGetOps aOptions ) + { + LOGGER ( TXT ( "COSSProtocolPlugin::GetInterface() Start" ) ); + + if ( aInterfaceId == MXIMPProtocolPlugin::KInterfaceId ) + { + MXIMPProtocolPlugin* self = this; + return self; + } + + if ( aOptions == MXIMPBase::EPanicIfUnknown ) + + { + User::Panic ( KOSSProtocolPlugin, KErrExtensionNotSupported ); + } + + LOGGER ( TXT ( "COSSProtocolPlugin::GetInterface() End" ) ); + + return NULL; + } + + +// --------------------------------------------------------------------------- +// COSSProtocolPlugin::GetInterface() +// --------------------------------------------------------------------------- +// +const TAny* COSSProtocolPlugin::GetInterface ( TInt32 aInterfaceId, + TIfGetOps aOptions ) const + { + LOGGER ( TXT ( "COSSProtocolPlugin::GetInterface() const Start" ) ); + + if ( aInterfaceId == MXIMPProtocolPlugin::KInterfaceId ) + { + const MXIMPProtocolPlugin* self = this; + return self; + } + + if ( aOptions == MXIMPBase::EPanicIfUnknown ) + + { + User::Panic ( KOSSProtocolPlugin, KErrExtensionNotSupported ); + } + + LOGGER ( TXT ( "COSSProtocolPlugin::GetInterface() const End" ) ); + + return NULL; + } + + +// --------------------------------------------------------------------------- +// COSSProtocolPlugin::GetInterfaceId() const +// --------------------------------------------------------------------------- +// +TInt32 COSSProtocolPlugin::GetInterfaceId() const + { + LOGGER ( TXT ( "COSSProtocolPlugin::GetInterface() without parameters Start-End" ) ); + return MXIMPProtocolPlugin::KInterfaceId; + } + + +// End of file + diff -r 000000000000 -r e6b17d312c8b imservices/ossprotocoladaptation/src/cossprotocolpresencefeatures.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/ossprotocoladaptation/src/cossprotocolpresencefeatures.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,179 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: oss presence features implementation for XIMP Framework +* +*/ + +#include "cossprotocolpresencefeatures.h" +#include +#include +#include +#include +#include "cossprotocolpresentitygroups.h" +#include "ossprotocolpluginlogger.h" +#include "cossprotocolpresencepublishing.h" +#include "cossprotocolpresenceauthorization.h" + +_LIT ( KOSSProtocolPresenceFeatures, "COSSProtocolPresenceFeatures" ); + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// COSSProtocolConnection::COSSProtocolPresenceFeatures() +// --------------------------------------------------------------------------- +// +COSSProtocolPresenceFeatures::COSSProtocolPresenceFeatures() + { + } + +// --------------------------------------------------------------------------- +// COSSProtocolPresenceFeatures::ConstructL() +// --------------------------------------------------------------------------- +// +void COSSProtocolPresenceFeatures::ConstructL ( + COSSProtocolConnectionManager& aConnMan ) + { + iPresentityGroups = COSSProtocolpresentitygroups::NewL ( aConnMan ); + iPresencePublishing = COssProtocolPresencePublishing::NewL ( aConnMan ); + iAuthrozation = COssProtocolPresenceAuthorization::NewL ( aConnMan ); + } + +// --------------------------------------------------------------------------- +// COSSProtocolPresenceFeatures::NewL() +// --------------------------------------------------------------------------- +// +COSSProtocolPresenceFeatures* COSSProtocolPresenceFeatures::NewL ( + COSSProtocolConnectionManager& aConnMan ) + { + + COSSProtocolPresenceFeatures* self = new ( ELeave ) COSSProtocolPresenceFeatures; + CleanupStack::PushL ( self ); + self->ConstructL ( aConnMan ); + CleanupStack::Pop ( self ); + + return self; + } + +// --------------------------------------------------------------------------- +// COSSProtocolPresenceFeatures::~COSSProtocolPresenceFeatures() +// --------------------------------------------------------------------------- +// +COSSProtocolPresenceFeatures::~COSSProtocolPresenceFeatures() + { + delete iPresentityGroups; + delete iPresencePublishing; + delete iAuthrozation; + } + + +// --------------------------------------------------------------------------- +// COSSProtocolPresenceFeatures::GetInterface() +// --------------------------------------------------------------------------- +// +TAny* COSSProtocolPresenceFeatures::GetInterface ( TInt32 aInterfaceId, + TIfGetOps aOptions ) + { + if ( aInterfaceId == MProtocolPresenceFeatures::KInterfaceId ) + { + MProtocolPresenceFeatures* self = this; + return self; + } + + if ( aOptions == MXIMPBase::EPanicIfUnknown ) + + { + User::Panic ( KOSSProtocolPresenceFeatures, KErrExtensionNotSupported ); + } + + return NULL; + } + + +// --------------------------------------------------------------------------- +// COSSProtocolPresenceFeatures::GetInterface() +// --------------------------------------------------------------------------- +// +const TAny* COSSProtocolPresenceFeatures::GetInterface ( TInt32 aInterfaceId, + TIfGetOps aOptions ) const + { + + if ( aInterfaceId == MProtocolPresenceFeatures::KInterfaceId ) + { + const MProtocolPresenceFeatures* self = this; + return self; + } + + if ( aOptions == MXIMPBase::EPanicIfUnknown ) + { + User::Panic ( KOSSProtocolPresenceFeatures, KErrExtensionNotSupported ); + } + + return NULL; + } + + +// --------------------------------------------------------------------------- +// COSSProtocolPresenceFeatures::GetInterfaceId() +// --------------------------------------------------------------------------- +// +TInt32 COSSProtocolPresenceFeatures::GetInterfaceId() const + { + return MProtocolPresenceFeatures::KInterfaceId; + } + +// --------------------------------------------------------------------------- +// COSSProtocolPresenceFeatures::PresenceWatching() +// --------------------------------------------------------------------------- +// +MProtocolPresenceWatching& COSSProtocolPresenceFeatures::PresenceWatching() + { + MProtocolPresenceWatching* dummyWatch = NULL; + return *dummyWatch; + } + +// --------------------------------------------------------------------------- +// COSSProtocolPresenceFeatures::PresencePublishing() +// --------------------------------------------------------------------------- +// +MProtocolPresencePublishing& COSSProtocolPresenceFeatures::PresencePublishing() + { + return *iPresencePublishing; + } + +// --------------------------------------------------------------------------- +// COSSProtocolPresenceFeatures::PresentityGroups() +// --------------------------------------------------------------------------- +// +MProtocolPresentityGroups& COSSProtocolPresenceFeatures::PresentityGroups() + { + return *iPresentityGroups; + } + +// --------------------------------------------------------------------------- +// COSSProtocolPresenceFeatures::PresenceAuthorization() +// --------------------------------------------------------------------------- +// +MProtocolPresenceAuthorization& COSSProtocolPresenceFeatures::PresenceAuthorization() + { + return *iAuthrozation; + } + +// End of file + + + + + + + diff -r 000000000000 -r e6b17d312c8b imservices/ossprotocoladaptation/src/cossprotocolsearchfeatures.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/ossprotocoladaptation/src/cossprotocolsearchfeatures.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,151 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: oss protocol plugin search features +* +*/ + +#include "cossprotocolsearchfeatures.h" +#include +#include "cossprotocolsearch.h" +#include "ossprotocolpluginlogger.h" + +_LIT ( KOSSProtocolSearchFeatures, "COSSProtocolSearchFeature" ); + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// COSSProtocolConnection::COSSProtocolSearchFeature() +// --------------------------------------------------------------------------- +// +COSSProtocolSearchFeature::COSSProtocolSearchFeature(COSSProtocolConnectionManager& aConnMan) : iConnMan (aConnMan) + { + } + +// --------------------------------------------------------------------------- +// COSSProtocolSearchFeature::ConstructL() +// --------------------------------------------------------------------------- +// +void COSSProtocolSearchFeature::ConstructL ( + COSSProtocolConnectionManager& aConnMan ) + { + iSearch = COSSProtocolSearch::NewL ( aConnMan ); + } + +// --------------------------------------------------------------------------- +// COSSProtocolSearchFeature::NewL() +// --------------------------------------------------------------------------- +// +COSSProtocolSearchFeature* COSSProtocolSearchFeature::NewL ( + COSSProtocolConnectionManager& aConnMan ) + { + + COSSProtocolSearchFeature* self = new ( ELeave ) COSSProtocolSearchFeature(aConnMan); + CleanupStack::PushL ( self ); + self->ConstructL ( aConnMan ); + CleanupStack::Pop ( self ); + + return self; + } + +// --------------------------------------------------------------------------- +// COSSProtocolSearchFeature::~COSSProtocolSearchFeature() +// --------------------------------------------------------------------------- +// +COSSProtocolSearchFeature::~COSSProtocolSearchFeature() + { + delete iSearch; + } + + +// --------------------------------------------------------------------------- +// COSSProtocolSearchFeature::GetInterface() +// --------------------------------------------------------------------------- +// +TAny* COSSProtocolSearchFeature::GetInterface ( TInt32 aInterfaceId, + TIfGetOps aOptions ) + { + MProtocolSearchFeature* self = NULL; + if ( aInterfaceId == MProtocolSearchFeature::KInterfaceId ) + { + self = this; + } + else + { + if ( aOptions == MXIMPBase::EPanicIfUnknown ) + + { + User::Panic ( KOSSProtocolSearchFeatures, KErrExtensionNotSupported ); + } + } + + return self; + } + +// --------------------------------------------------------------------------- +// COSSProtocolSearchFeature::SetHost +// --------------------------------------------------------------------------- +// + +void COSSProtocolSearchFeature::SetHost(MProtocolSearchDataHost& aSearchHost ) + { + iConnMan.SetSearchHost(aSearchHost) ; // set this in connection manager. + } + +// --------------------------------------------------------------------------- +// COSSProtocolSearchFeature::GetInterface() +// --------------------------------------------------------------------------- +// +const TAny* COSSProtocolSearchFeature::GetInterface ( TInt32 aInterfaceId, + TIfGetOps aOptions ) const + { + + const MProtocolSearchFeature* self = NULL; + if ( aInterfaceId == MProtocolSearchFeature::KInterfaceId ) + { + self = this; + } + else + { + if ( aOptions == MXIMPBase::EPanicIfUnknown ) + + { + User::Panic ( KOSSProtocolSearchFeatures, KErrExtensionNotSupported ); + } + } + + return self; + } + + +// --------------------------------------------------------------------------- +// COSSProtocolSearchFeature::GetInterfaceId() const +// --------------------------------------------------------------------------- +// +TInt32 COSSProtocolSearchFeature::GetInterfaceId() const + { + return MProtocolSearchFeature::KInterfaceId; + } + + +// --------------------------------------------------------------------------- +// COSSProtocolSearchFeature::search() +// --------------------------------------------------------------------------- +// +MProtocolSearch& COSSProtocolSearchFeature::Search() + { + return *iSearch; + } + + +// End of file diff -r 000000000000 -r e6b17d312c8b imservices/ossprotocoladaptation/src/cossprotocolservererrorhandler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/ossprotocoladaptation/src/cossprotocolservererrorhandler.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,212 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: server error handler +* +*/ + + +#include +#include "cossprotocolservererrorhandler.h" +#include "mossprotocolconnectionmanager.h" +#include "ossprotocolpluginlogger.h" +#include "waittimer.h" +#include "cossprotocolconnectionmanager.h" + +#include +#include +#include +#include +#include +#include +#include +#include "msgliterals.h" +#include + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// COssprotocolServerErrorHandler::COssprotocolServerErrorHandler +// --------------------------------------------------------------------------- +// +COssprotocolServerErrorHandler::COssprotocolServerErrorHandler ( + MOSSProtocolConnectionManager& aConnMan ) : + CActive ( EPriorityNormal ), + iConnMan ( aConnMan ) + { + LOGGER ( TXT ( "COssprotocolServerErrorHandler::COssprotocolServerErrorHandler Start" ) ); + CActiveScheduler::Add ( this ); + + LOGGER ( TXT ( "COssprotocolServerErrorHandler::COssprotocolServerErrorHandler End" ) ); + } + + +// --------------------------------------------------------------------------- +// COssprotocolServerErrorHandler::ConstructL +// --------------------------------------------------------------------------- +// +void COssprotocolServerErrorHandler::ConstructL() + { + LOGGER ( TXT ( "COssprotocolServerErrorHandler::ConstructL Start-End" ) ); + + } + + +// --------------------------------------------------------------------------- +// COssprotocolServerErrorHandler::NewL +// --------------------------------------------------------------------------- +// +COssprotocolServerErrorHandler* COssprotocolServerErrorHandler::NewL ( + MOSSProtocolConnectionManager& aConnMan ) + { + LOGGER ( TXT ( "COssprotocolServerErrorHandler::NewL Start" ) ); + + COssprotocolServerErrorHandler* self = new ( ELeave ) + COssprotocolServerErrorHandler ( aConnMan ); + CleanupStack::PushL ( self ); + self->ConstructL(); + CleanupStack::Pop ( self ); + + LOGGER ( TXT ( "COssprotocolServerErrorHandler::NewL End" ) ); + return self; + } + + +// --------------------------------------------------------------------------- +// COssprotocolServerErrorHandler::NewLC +// --------------------------------------------------------------------------- +// +COssprotocolServerErrorHandler* COssprotocolServerErrorHandler::NewLC ( + MOSSProtocolConnectionManager& aConnMan ) + { + LOGGER ( TXT ( "COssprotocolServerErrorHandler::NewLC Start" ) ); + + COssprotocolServerErrorHandler* self = + COssprotocolServerErrorHandler::NewL ( aConnMan ); + CleanupStack::PushL ( self ); + + LOGGER ( TXT ( "COssprotocolServerErrorHandler::NewLC End" ) ); + return self; + } + +// --------------------------------------------------------------------------- +// COssprotocolServerErrorHandler::~COssprotocolServerErrorHandler +// --------------------------------------------------------------------------- +// +COssprotocolServerErrorHandler::~COssprotocolServerErrorHandler() + { + LOGGER ( TXT ( "::~COssprotocolServerErrorHandler Start" ) ); + + Cancel(); + + LOGGER ( TXT ( "::~COssprotocolServerErrorHandler End" ) ); + } + + +// --------------------------------------------------------------------------- +// COssprotocolServerErrorHandler::DoCancel() +// --------------------------------------------------------------------------- +// +void COssprotocolServerErrorHandler::DoCancel() + { + LOGGER ( TXT ( "COssprotocolServerErrorHandler::DoCancel Start" ) ); + + iConnMan.DataHandler().CancelListeningServerErrors(); + + LOGGER ( TXT ( "COssprotocolServerErrorHandler::DoCancel End" ) ); + } + +// --------------------------------------------------------------------------- +// COssprotocolServerErrorHandler::RunL() +// --------------------------------------------------------------------------- +// +void COssprotocolServerErrorHandler::RunL() + { + LOGGER ( TXT ( "COssprotocolServerErrorHandler::RunL Start" ) ); + + // something is coming from the xmpp server + User::LeaveIfError ( iStatus.Int() ); + + ProcessIncomingDataL(); +// StartListeningL(); + + LOGGER ( TXT ( "COssprotocolServerErrorHandler::RunL End" ) ); + } + +// --------------------------------------------------------------------------- +// COssprotocolServerErrorHandler::ProcessIncomingDataL() +// --------------------------------------------------------------------------- +// +void COssprotocolServerErrorHandler::ProcessIncomingDataL() + { + LOGGER ( TXT ( "COssprotocolServerErrorHandler::ProcessIncomingDataL Start" ) ); + TInt senderidlen = 0; + TInt messagelen = 0; + char* sender = NULL; + char* recvdmessage = NULL; + guint messagetype = NULL; + guint time; + char* pResponse = NULL, *pOrigResponse = NULL; + User::LeaveIfError ( iStatus.Int() ); + pOrigResponse = pResponse = iConnMan.DataHandler().ResponseL ( 3 ); + CleanupStack::PushL(pOrigResponse) ; + //parse message type + + memcpy ( &messagetype, pResponse, sizeof ( guint ) ); + memcpy ( &time, pResponse + sizeof ( guint ), sizeof ( guint ) ); + + senderidlen = strlen(pResponse + sizeof ( guint ) * 2 ); + sender = ( char* ) User::AllocLC ( senderidlen + 1 ); + memset ( sender, '\0', senderidlen ); + memcpy ( sender, pResponse + sizeof ( guint ) * 2, senderidlen + 1); + + messagelen = strlen(pResponse + sizeof ( guint ) * 2 + senderidlen + 1 ); + recvdmessage = ( char* ) User::AllocLC ( messagelen + 1 ); + memset ( recvdmessage, '\0', messagelen ); + memcpy ( recvdmessage, pResponse + sizeof ( guint ) * 2 + 1 + senderidlen, messagelen + 1 ); + CleanupStack::PopAndDestroy ( recvdmessage ); + CleanupStack::PopAndDestroy ( sender ); + CleanupStack::PopAndDestroy(pOrigResponse) ;//pOrigResponse + LOGGER ( TXT ( "COssprotocolServerErrorHandler::ProcessIncomingDataL End" ) ); + } + + +// --------------------------------------------------------------------------- +// COssprotocolServerErrorHandler::RunError +// --------------------------------------------------------------------------- +// +TInt COssprotocolServerErrorHandler::RunError ( TInt aError ) + { + LOGGER ( TXT ( "COssprotocolServerErrorHandler::RunError Start %d" ), aError ); + + LOGGER ( TXT ( "COssprotocolServerErrorHandler::RunError End" ) ); + return KErrNone; + } + +// --------------------------------------------------------------------------- +// COssprotocolServerErrorHandler::StartListeningL +// --------------------------------------------------------------------------- +// +void COssprotocolServerErrorHandler::StartListeningL() + { + LOGGER ( TXT ( "COssprotocolServerErrorHandler::StartListeningL Start" ) ); + + if ( ! ( this->IsActive() ) ) + { + iConnMan.DataHandler().ListenIncomingServerError ( iStatus ); + SetActive(); + } + LOGGER ( TXT ( "COssprotocolServerErrorHandler::StartListeningL End" ) ); + } + +// End of file diff -r 000000000000 -r e6b17d312c8b imservices/ossprotocoladaptation/src/cosssenddataoperation.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/ossprotocoladaptation/src/cosssenddataoperation.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,157 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: cosssenddataoperation.cpp +* +*/ + +// INCLUDES +#include + +#include "cosssenddataoperation.h" +#include "ossprotocolpluginlogger.h" + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// COssSendDataOperation::COssSendDataOperation() +// --------------------------------------------------------------------------- +// +COssSendDataOperation::COssSendDataOperation () + : iOpId ( KErrNone ) + { + iData = NULL; + LOGGER ( TXT ( "COssSendDataOperation::COssSendDataOperation Start End" ) ); + } +// --------------------------------------------------------------------------- +// COssSendDataOperation::~COssSendDataOperation() +// --------------------------------------------------------------------------- +// +COssSendDataOperation::~COssSendDataOperation () + { + LOGGER ( TXT ( "COssSendDataOperation::~COssSendDataOperation Start" ) ); + delete iData; + + if ( iStatus ) + { + User::RequestComplete ( iStatus, KErrCancel ); + } + + LOGGER ( TXT ( "COssSendDataOperation::~COssSendDataOperation End" ) ); + } + +// --------------------------------------------------------------------------- +// COssSendDataOperation::SetIds() +// --------------------------------------------------------------------------- +// +void COssSendDataOperation::SetIds ( TInt aOperationId, TInt aLogId ) + { + LOGGER ( TXT ( "COssSendDataOperation::SetIds Start" ) ); + iOpId = aOperationId; + iLogId = aLogId; + LOGGER ( TXT ( "COssSendDataOperation::SetIds End" ) ); + } + + +// --------------------------------------------------------------------------- +// COssSendDataOperation::SetRequestStatus() +// --------------------------------------------------------------------------- +// +void COssSendDataOperation::SetRequestStatus ( TRequestStatus& aStatus ) + { + LOGGER ( TXT ( "COssSendDataOperation::SetRequestStatus Start" ) ); + iStatus = &aStatus; + LOGGER ( TXT ( "COssSendDataOperation::SetRequestStatus End" ) ); + } + +// --------------------------------------------------------------------------- +// COssSendDataOperation::Status() +// --------------------------------------------------------------------------- +// +TRequestStatus* COssSendDataOperation::Status() + { + LOGGER ( TXT ( "COssSendDataOperation::Status Start-End" ) ); + return iStatus; + } + +// --------------------------------------------------------------------------- +// COssSendDataOperation::OperationId() +// --------------------------------------------------------------------------- +// +TInt COssSendDataOperation::OperationId() const + { + LOGGER ( TXT ( "COssSendDataOperation::OperationId Start-End" ) ); + return iOpId; + } +// --------------------------------------------------------------------------- +// COssSendDataOperation::NewLC() +// --------------------------------------------------------------------------- +// + COssSendDataOperation* COssSendDataOperation::NewLC() + { + LOGGER ( TXT ( "COssSendDataOperation::NewLC Start-End" ) ); + COssSendDataOperation* self = new ( ELeave ) + COssSendDataOperation(); + + CleanupStack::PushL ( self ); + LOGGER ( TXT ( "COssSendDataOperation::NewLC End" ) ); + return self; + } + +// --------------------------------------------------------------------------- +// COssSendDataOperation::CompletedOperation() +// --------------------------------------------------------------------------- +// + void COssSendDataOperation::CompletedOperation ( TInt aCode ) + { + LOGGER ( TXT ( "COssSendDataOperation::CompletedOperation Start :id:%d,code:%d" ), + iOpId, + aCode ); + + if ( !iStatus ) + { + LOGGER ( TXT ( "COssSendDataOperation::CompletedOperation:!!Double Completion!!!" ) ); + return; + } + + User::RequestComplete ( iStatus, aCode ); + + iStatus = NULL; + } + +// --------------------------------------------------------------------------- +// COssSendDataOperation::SetResponse() +// --------------------------------------------------------------------------- + void COssSendDataOperation::SetResponse ( char* aBuff ) + { + LOGGER ( TXT ( "CPEngPureDataHandler::SetResponse - id: %d" ), iOpId ); + delete iData; + iData = aBuff; + LOGGER ( TXT ( "COssSendDataOperation::SetResponse End" ) ); + } + +// --------------------------------------------------------------------------- +// COssSendDataOperation::Response() +// --------------------------------------------------------------------------- +// + char* COssSendDataOperation::Response() + { + LOGGER ( TXT ( "CPEngPureDataHandler::Response Start" ) ); + char* b = iData; + iData = NULL; + LOGGER ( TXT ( "CPEngPureDataHandler::Response End" ) ); + return b; + } + + +// End of File diff -r 000000000000 -r e6b17d312c8b imservices/ossprotocoladaptation/src/im/cossprotocolimconversation.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/ossprotocoladaptation/src/im/cossprotocolimconversation.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,269 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Oss Protocol im conversation implementation +* +*/ + +#include +#include +#include +#include "cossprotocolimconversation.h" +#include "cossprotocolconnectionmanager.h" +#include "cosssendmessagerequest.h" +#include "mossprotocolconnectionmanager.h" +#include "ossprotocolpluginlogger.h" +#include "ossprotocolpluginpanics.h" +#include "ossprotocolpluginlogger.h" +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// COSSProtocolImConversation::GetInterface() +// --------------------------------------------------------------------------- +// +TAny* COSSProtocolImConversation::GetInterface ( TInt32 aInterfaceId, + TIfGetOps aOptions ) + { + LOGGER ( TXT ( "COSSProtocolImConversation::GetInterface() Start" ) ); + + if ( aInterfaceId == MProtocolImConversation::KInterfaceId ) + { + MProtocolImConversation* self = this; + return self; + } + + if ( aOptions == MXIMPBase::EPanicIfUnknown ) + + { + User::Panic ( KOSSProtocolConversation, KErrExtensionNotSupported ); + } + + LOGGER ( TXT ( "COSSProtocolImConversation::GetInterface() End" ) ); + + return NULL; + } + + +// --------------------------------------------------------------------------- +// COSSProtocolImConversation::GetInterface() +// --------------------------------------------------------------------------- +// +const TAny* COSSProtocolImConversation::GetInterface ( TInt32 aInterfaceId, + TIfGetOps aOptions ) const + { + LOGGER ( TXT ( "COSSProtocolImConversation::GetInterface() Start" ) ); + + if ( aInterfaceId == MProtocolImConversation::KInterfaceId ) + { + const MProtocolImConversation* self = this; + return self; + } + + if ( aOptions == MXIMPBase::EPanicIfUnknown ) + + { + User::Panic ( KOSSProtocolConversation, KErrExtensionNotSupported ); + } + + LOGGER ( TXT ( "COSSProtocolImConversation::GetInterface() End" ) ); + + return NULL; + } + + +// --------------------------------------------------------------------------- +// COSSProtocolImConversation::GetInterfaceId() +// --------------------------------------------------------------------------- +// +TInt32 COSSProtocolImConversation::GetInterfaceId() const + { + LOGGER ( TXT ( "COSSProtocolImConversation::GetInterfaceId() Start-End" ) ); + return MProtocolImConversation::KInterfaceId; + } + + +// --------------------------------------------------------------------------- +// COSSProtocolImConversation::COSSProtocolImConversation() +// --------------------------------------------------------------------------- +// +COSSProtocolImConversation::COSSProtocolImConversation ( + MOSSProtocolConnectionManager& aConnMan ) + : iConnMan ( aConnMan ) + { + LOGGER ( TXT ( "Groups::COSSProtocolImConversation() Start-End" ) ); + } + + +// --------------------------------------------------------------------------- +// COSSProtocolImConversation::ConstructL() +// --------------------------------------------------------------------------- +// +void COSSProtocolImConversation::ConstructL() + { + LOGGER ( TXT ( "COSSProtocolImConversation::ConstructL() Start" ) ); + LOGGER ( TXT ( "COSSProtocolImConversation::ConstructL() End" ) ); + } + + +// --------------------------------------------------------------------------- +// COSSProtocolImConversation::NewL() +// --------------------------------------------------------------------------- +// +COSSProtocolImConversation* COSSProtocolImConversation::NewL ( + MOSSProtocolConnectionManager& aConnMan ) + { + LOGGER ( TXT ( "COSSProtocolImConversation::NewL() Start" ) ); + + COSSProtocolImConversation* self = + new ( ELeave ) COSSProtocolImConversation ( aConnMan ); + CleanupStack::PushL ( self ); + self->ConstructL( ); + CleanupStack::Pop ( self ); + + LOGGER ( TXT ( "COSSProtocolImConversation::NewL() End" ) ); + return self; + } + + +// --------------------------------------------------------------------------- +// COSSProtocolImConversation::~COSSProtocolImConversation() +// --------------------------------------------------------------------------- +// +COSSProtocolImConversation::~COSSProtocolImConversation() + { + LOGGER ( TXT ( "Groups::~COSSProtocolImConversation() Start" ) ); + + LOGGER ( TXT ( "Groups::~COSSProtocolImConversation() End" ) ); + } + + + +// --------------------------------------------------------------------------- +// COSSProtocolImConversation::DoSendMessageL() +// --------------------------------------------------------------------------- +// +void COSSProtocolImConversation::DoSendMessageL ( + const MImConversationInfo& aImMessage, + TXIMPRequestId aReqId ) + { + LOGGER ( TXT ( "Groups::DoSendMessageL() Start" ) ); + + + COSSSendMessageRequest* req = + COSSSendMessageRequest::NewLC ( iConnMan, aReqId ); + + req->SendMessageL ( aImMessage ); + + CleanupStack::Pop ( req ); + + LOGGER ( TXT ( "Groups::DoSendMessageL() End" ) ); + } + +// --------------------------------------------------------------------------- +// COSSProtocolImConversation::DoForwardMessageL() +// --------------------------------------------------------------------------- +// +void COSSProtocolImConversation::DoForwardMessageL ( + const MImConversationInfo& /*aImMessage*/, + TXIMPRequestId /*aReqId*/ ) + { + + } + +// --------------------------------------------------------------------------- +// COSSProtocolImConversation::DoSendMessageToGroupL() +// --------------------------------------------------------------------------- +// +void COSSProtocolImConversation::DoSendMessageToGroupL ( + const MImConversationInfo& /*aImMessage*/, + const TDesC* /*aGroupId*/, TXIMPRequestId /*aReqId*/ ) + { + + } + +// --------------------------------------------------------------------------- +// COSSProtocolImConversation::DoBlockUsersL() +// --------------------------------------------------------------------------- +// +TXIMPRequestId COSSProtocolImConversation::DoBlockUsersL ( + const MDesCArray* /*aUserIds*/, + TXIMPRequestId aReqId ) + { + //Not Supported + return aReqId; + } + +// --------------------------------------------------------------------------- +// COSSProtocolImConversation::DoUnBlockUsersL() +// --------------------------------------------------------------------------- +// +TXIMPRequestId COSSProtocolImConversation::DoUnBlockUsersL ( + const MDesCArray* /*aUserIds*/, + TXIMPRequestId aReqId ) + { + //Not Supported + return aReqId; + } + +// --------------------------------------------------------------------------- +// COSSProtocolImConversation::DoGetBlockedListRequestL() +// --------------------------------------------------------------------------- +// +void COSSProtocolImConversation::DoGetBlockedListRequestL ( + const MXIMPIdentity& /*aImMessageId*/, + TXIMPRequestId /*aReqId*/ ) + { + + } + +// --------------------------------------------------------------------------- +// COSSProtocolImConversation::DoGetMessageListL() +// --------------------------------------------------------------------------- +// +void COSSProtocolImConversation::DoGetMessageListL ( + const MXIMPIdentity& /*aImMessageId*/, + const TDesC* /*aGroupId*/, + const TInt /*aMessageCount*/, + TBool /*aDeliveryReportWanted*/, + TXIMPRequestId /*aReqId*/ ) + { + + } + +// --------------------------------------------------------------------------- +// COSSProtocolImConversation::DoRejectMessageL() +// --------------------------------------------------------------------------- +// +void COSSProtocolImConversation::DoRejectMessageL ( + const MXIMPIdentity& /*aImMessageId*/, + const TDesC& /*aMessageID*/, + TXIMPRequestId /*aReqId*/ ) + { + + } + +// --------------------------------------------------------------------------- +// COSSProtocolImConversation::CreateDataHandlerL() +// --------------------------------------------------------------------------- +// +void COSSProtocolImConversation::CreateDataHandlerL() + { + LOGGER ( TXT ( "COSSProtocolImConversation::CreateDataHandler() Start" ) ); + + iConnMan.ManufactureDataHandlerL(); + + LOGGER ( TXT ( "COSSProtocolImConversation::CreateDataHandler() End" ) ); + } + +// End of file + diff -r 000000000000 -r e6b17d312c8b imservices/ossprotocoladaptation/src/im/cosssendmessagerequest.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/ossprotocoladaptation/src/im/cosssendmessagerequest.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,278 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Send message Request to the Network Server +* +*/ + +#include "cosssendmessagerequest.h" +#include +#include "cossprotocolconnectionmanager.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "ossprotocolpluginlogger.h" +#include "ossprotocloliterals.h" +#include +#include "stringutils.h" +#include +#include "msgliterals.h" +#include "msg_enums.h" +#include + +#include +#include +#include "ossprotocoladaptutils.h" + +/** +* operations state enums variables +*/ + +enum ImStates + { + RecipientOffline = 1, + SenderBlocked = 3, + NotSupported = 5, + + // add if required + }; +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// COSSSendMessageRequest::COSSSendMessageRequest() +// --------------------------------------------------------------------------- +// +COSSSendMessageRequest::COSSSendMessageRequest ( + MOSSProtocolConnectionManager& aConnMan, + TXIMPRequestId aRequestId ) : + + CActive ( EPriorityNormal ), + iRequestId ( aRequestId ), + iConnMan ( aConnMan ) + { + LOGGER ( TXT ( "COSSSendMessageRequest::COSSSendMessageRequest Start" ) ); + CActiveScheduler::Add ( this ); + + LOGGER ( TXT ( "COSSSendMessageRequest::COSSSendMessageRequest End" ) ); + } + + +// --------------------------------------------------------------------------- +// COSSSendMessageRequest::ConstructL() +// --------------------------------------------------------------------------- +// +void COSSSendMessageRequest::ConstructL() + { + LOGGER ( TXT ( "COSSSendMessageRequest::ConstructL Start-End" ) ); + + + } + + +// --------------------------------------------------------------------------- +// COSSSendMessageRequest::NewL() +// --------------------------------------------------------------------------- +// +COSSSendMessageRequest* COSSSendMessageRequest::NewL ( + MOSSProtocolConnectionManager& aConnMan, + TXIMPRequestId aRequestId ) + { + LOGGER ( TXT ( "COSSSendMessageRequest::NewL Start" ) ); + + COSSSendMessageRequest* self = new ( ELeave ) + COSSSendMessageRequest ( aConnMan, aRequestId ); + CleanupStack::PushL ( self ); + self->ConstructL(); + CleanupStack::Pop ( self ); + + LOGGER ( TXT ( "COSSSendMessageRequest::NewL End" ) ); + return self; + } + + +// --------------------------------------------------------------------------- +// COSSSendMessageRequest::NewLC() +// --------------------------------------------------------------------------- +// +COSSSendMessageRequest* COSSSendMessageRequest::NewLC ( + MOSSProtocolConnectionManager& aConnMan, + TXIMPRequestId aRequestId ) + { + LOGGER ( TXT ( "COSSSendMessageRequest::NewLC Start" ) ); + + COSSSendMessageRequest* self = + COSSSendMessageRequest::NewL ( aConnMan, aRequestId ); + CleanupStack::PushL ( self ); + + LOGGER ( TXT ( "COSSSendMessageRequest::NewLC End" ) ); + return self; + } + +// --------------------------------------------------------------------------- +// COSSSendMessageRequest::~COSSSendMessageRequest() +// --------------------------------------------------------------------------- +// +COSSSendMessageRequest::~COSSSendMessageRequest() + { + LOGGER ( TXT ( "COSSSendMessageRequest::~COSSSendMessageRequest Start" ) ); + LOGGER ( TXT ( "COSSSendMessageRequest::~COSSSendMessageRequest End" ) ); + } + + +// --------------------------------------------------------------------------- +// COSSSendMessageRequest::DoCancel() +// --------------------------------------------------------------------------- +// +void COSSSendMessageRequest::DoCancel() + { + } + + +// --------------------------------------------------------------------------- +// COSSSendMessageRequest::RunL() +// --------------------------------------------------------------------------- +// +void COSSSendMessageRequest::RunL() + { + LOGGER ( TXT ( "COSSSendMessageRequest::RunL start" ) ); + message_hdr_resp* msg_struct = NULL; + User::LeaveIfError ( iStatus.Int() ); + char* pResponse = NULL; + pResponse = iConnMan.DataHandler().ResponseL ( iSendId ); + + msg_struct = ( message_hdr_resp* )pResponse ; + if( !( msg_struct->response ) ) + { + switch( msg_struct->error_type ) + { + + case RecipientOffline: //The username or password was invalid. + iConnMan.HandleToHost().HandleRequestCompleted ( iRequestId, KImApiErrRecipientNotLogged ); + break; + case SenderBlocked: //The username or password was invalid. + iConnMan.HandleToHost().HandleRequestCompleted ( iRequestId, KImApiErrSenderBlocked ); + break; + case NotSupported: //The username or password was invalid. + iConnMan.HandleToHost().HandleRequestCompleted ( iRequestId, KImErrServiceRequestTypeNotSupported ); + break; + default: //for all other error codes like ssl related are mapped to general error + iConnMan.HandleToHost().HandleRequestCompleted ( iRequestId, KImErrServiceGeneralError ); + break; + } + } + else + { + iConnMan.HandleToHost().HandleRequestCompleted ( iRequestId, KErrNone ); + } + + free( pResponse ); + + delete this; + + LOGGER ( TXT ( "COSSSendMessageRequest::RunL End" ) ); + } + + +// --------------------------------------------------------------------------- +// COSSSendMessageRequest::RunError() +// --------------------------------------------------------------------------- +// +TInt COSSSendMessageRequest::RunError ( TInt aError ) + { + LOGGER ( TXT ( "COSSSendMessageRequest::RunError Start" ) ); + + iConnMan.HandleToHost().HandleRequestCompleted ( iRequestId, aError ); + + delete this; + LOGGER ( TXT ( "COSSSendMessageRequest::RunError End" ) ); + return KErrNone; + } + +// --------------------------------------------------------------------------- +// COSSSendMessageRequest::SendMessageL() +// --------------------------------------------------------------------------- +// +void COSSSendMessageRequest::SendMessageL ( const MImConversationInfo& aImMessage ) + { + LOGGER ( TXT ( "COSSSendMessageRequest::SendMessageL Start" ) ); + + TPtrC16 message = aImMessage.TextMessage(); + const MDesCArray& recipients = aImMessage.RecipientL(); + + int userLen = 0; + int totalLen = 0; + + message_hdr_req msgHdr = {0,}; + msgHdr.message_type = ESend_Request; + totalLen += sizeof ( message_hdr_req ); + + RArray recipientArray; + for ( TInt i = 0; i < recipients.MdcaCount(); i++ ) + { + TPtrC16 recipientsPtr = recipients.MdcaPoint( i ); + charFormatData recipient = OssProtocolAdapUtils::ConvertTUint16ToCharLC( recipientsPtr ); + recipientArray.AppendL( recipient );//will get it back when writting to final buffer. + userLen = recipient.dataSize; + totalLen += userLen; + } + totalLen++; + + charFormatData charData = OssProtocolAdapUtils::ConvertTUint16ToCharLC( message ); + char* msg = charData.data; + userLen = charData.dataSize; + totalLen += userLen; + + User::LeaveIfError ( totalLen > MAX_MSG_SIZE ); + + char* outMessage = ( char* ) User::AllocLC( totalLen ); + memset( outMessage , '\0' , totalLen ); + + userLen = 0; + totalLen = 0; + totalLen += sizeof ( message_hdr_req ); + + + memcpy( outMessage , &msgHdr , totalLen ); //copy header. + + //now copy recipients one by one. + TInt recipientCount = recipientArray.Count(); + for( TInt count = 0 ; count < recipientCount ; count++) + { + charFormatData receiver = recipientArray[count]; + userLen = receiver.dataSize; + memcpy( outMessage + totalLen , receiver.data , userLen ); + totalLen += userLen; + } + + totalLen++; + userLen = charData.dataSize; + memcpy ( outMessage + totalLen , msg , userLen ); + + totalLen += userLen; + iSendId = iConnMan.DataHandler().SendDataL ( iStatus, outMessage, totalLen ); + + // signal the scheduler + SetActive(); + CleanupStack::PopAndDestroy( recipientCount + 2 );//outMessage,msg, + recipientArray.Close(); + + LOGGER ( TXT ( "COSSSendMessageRequest::SendMessageL End" ) ); + } + +// End of file diff -r 000000000000 -r e6b17d312c8b imservices/ossprotocoladaptation/src/im/creceivemessagehandler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/ossprotocoladaptation/src/im/creceivemessagehandler.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,250 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: implementation of receive message handler +* +*/ + + +#include +#include "creceivemessagehandler.h" +#include "mossprotocolconnectionmanager.h" +#include "ossprotocolpluginlogger.h" +#include "waittimer.h" +#include "cossprotocolconnectionmanager.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "ossprotocoladaptutils.h" + + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// CReceiveMessageHandler::CReceiveMessageHandler +// --------------------------------------------------------------------------- +// +CReceiveMessageHandler::CReceiveMessageHandler ( + MOSSProtocolConnectionManager& aConnMan ) : + + CActive ( EPriorityNormal ), + iConnMan ( aConnMan ) + { + LOGGER ( TXT ( "::CReceiveMessageHandler Start" ) ); + CActiveScheduler::Add ( this ); + + LOGGER ( TXT ( "::CReceiveMessageHandler End" ) ); + } + + +// --------------------------------------------------------------------------- +// CReceiveMessageHandler::ConstructL +// --------------------------------------------------------------------------- +// +void CReceiveMessageHandler::ConstructL() + { + LOGGER ( TXT ( "CReceiveMessageHandler::ConstructL Start-End" ) ); + + + } + + +// --------------------------------------------------------------------------- +// CReceiveMessageHandler::NewL +// --------------------------------------------------------------------------- +// +CReceiveMessageHandler* CReceiveMessageHandler::NewL ( + MOSSProtocolConnectionManager& aConnMan ) + { + LOGGER ( TXT ( "CReceiveMessageHandler::NewL Start" ) ); + + CReceiveMessageHandler* self = new ( ELeave ) + CReceiveMessageHandler ( aConnMan ); + CleanupStack::PushL ( self ); + self->ConstructL(); + CleanupStack::Pop ( self ); + + LOGGER ( TXT ( "CReceiveMessageHandler::NewL End" ) ); + return self; + } + + + +// --------------------------------------------------------------------------- +// CReceiveMessageHandler::~CReceiveMessageHandler +// --------------------------------------------------------------------------- +// +CReceiveMessageHandler::~CReceiveMessageHandler() + { + LOGGER ( TXT ( "::~CReceiveMessageHandler Start" ) ); + + Cancel(); + + LOGGER ( TXT ( "::~CReceiveMessageHandler End" ) ); + } + + +// --------------------------------------------------------------------------- +// CReceiveMessageHandler::DoCancel() +// --------------------------------------------------------------------------- +// +void CReceiveMessageHandler::DoCancel() + { + LOGGER ( TXT ( "CReceiveMessageHandler::DoCancel Start" ) ); + + iConnMan.DataHandler().CancelListeningMsg(); + + LOGGER ( TXT ( "CReceiveMessageHandler::DoCancel End" ) ); + } + +// --------------------------------------------------------------------------- +// CReceiveMessageHandler::RunL() +// --------------------------------------------------------------------------- +// +void CReceiveMessageHandler::RunL() + { + LOGGER ( TXT ( "CReceiveMessageHandler::RunL Start" ) ); + + // something is coming from the xmpp server + User::LeaveIfError ( iStatus.Int() ); + + TRAPD( error, ProcessIncomingDataL() ); + if ( error != KErrNone ) + { + Cancel(); + } + + // start listening again for next incoming message + StartListeningL(); + + LOGGER ( TXT ( "CReceiveMessageHandler::RunL End" ) ); + } + +// --------------------------------------------------------------------------- +// CReceiveMessageHandler::ProcessIncomingDataL() +// --------------------------------------------------------------------------- +// +void CReceiveMessageHandler::ProcessIncomingDataL() + { + LOGGER ( TXT ( "CReceiveMessageHandler::ProcessIncomingDataL Start" ) ); + + char* pResponse = iConnMan.DataHandler().ResponseL ( 1 ); + CleanupStack::PushL( pResponse ); + + //-----Response format-------- + //|------|------/0|-------/0| + //|header|sender/0|message/0| + + //parse sender. + char* sender = pResponse + sizeof( message_hdr_resp ); + HBufC16 *sendername = OssProtocolAdapUtils::ConvertCharToTUint16LC(sender); + + //parse message. + char* recvdmessage = pResponse + sizeof( message_hdr_resp ) + strlen(sender) + 1; + HBufC16 *message = OssProtocolAdapUtils::ConvertCharToTUint16LC(recvdmessage); + + MXIMPObjectFactory& objFact = iConnMan.HandleToHost().ObjectFactory(); + MImObjectFactory& imObjFact = iConnMan.GetImHost().ImObjectFactory(); + MXIMPIdentity* identity = objFact.NewIdentityLC(); + MImConversationInfo* convinfo = imObjFact.NewImConversationInfoLC(); + + identity->SetIdentityL ( *sendername ); + convinfo->SetMessageIdL ( identity ); + convinfo->SetTextMessageL ( *message ); //SetTextMessageL(const TDesC16& aMessage ) + iConnMan.GetImHost().ConversationDataHost().HandleNewTextMessageL ( convinfo ); + + CleanupStack::Pop( 2 ); //convinfo,identity + CleanupStack::PopAndDestroy( 3 ); //message,sendername,pResponse. + + LOGGER ( TXT ( "CReceiveMessageHandler::ProcessIncomingDataL End" ) ); + } + + +// --------------------------------------------------------------------------- +// CReceiveMessageHandler::RunError +// --------------------------------------------------------------------------- +// +TInt CReceiveMessageHandler::RunError ( TInt aError ) + { + LOGGER ( TXT ( "CReceiveMessageHandler::RunError Start %d" ), aError ); + + // restart listening incoming data + iConnMan.DataHandler().ListenIncomingMsg ( iStatus ); + SetActive(); + + LOGGER ( TXT ( "CReceiveMessageHandler::RunError End" ) ); + return KErrNone; + } + +// --------------------------------------------------------------------------- +// CReceiveMessageHandler::StartListeningL +// --------------------------------------------------------------------------- +// +void CReceiveMessageHandler::StartListeningL() + { + LOGGER ( TXT ( "CReceiveMessageHandler::StartListeningL Start" ) ); + + // Ready to receive notification from the server + TInt count = 0; + + // signal the scheduler + + if ( ! ( this->IsActive() ) ) + { + count = iConnMan.DataHandler().ListenIncomingMsg ( iStatus ); + SetActive(); + } + + for ( TInt x ( 0 ) ; x < count ; ++x ) + { + ProcessIncomingDataL(); + } + + LOGGER ( TXT ( "CReceiveMessageHandler::StartListeningL End" ) ); + } + + + +// End of file diff -r 000000000000 -r e6b17d312c8b imservices/ossprotocoladaptation/src/ossprotocoladaptutils.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/ossprotocoladaptation/src/ossprotocoladaptutils.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,85 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Utils for OSSProtocolAdaptation modules. +* +*/ + + +// INCLUDES +#include "ossprotocoladaptutils.h" +#include +#include +#include +#include "escapeutils.h" +#include "stringutils.h" + + +// --------------------------------------------------------------------------- +// OssProtocolAdapUtils::OssProtocolAdapUtils::ConvertCharToTUint16L +// --------------------------------------------------------------------------- +// +HBufC16* OssProtocolAdapUtils::ConvertCharToTUint16LC( const char *pcSrc ) + { + TUint8* scr = (TUint8*)pcSrc; + TPtrC8 ptr; + ptr.Set(scr); + HBufC16* buf = EscapeUtils::ConvertToUnicodeFromUtf8L(ptr); + CleanupStack::PushL(buf); + return buf; + } + + +// --------------------------------------------------------------------------- +// OssProtocolAdapUtils::OssProtocolAdapUtils::ConvertTUint16ToCharL +// --------------------------------------------------------------------------- +// +charFormatData OssProtocolAdapUtils::ConvertTUint16ToCharLC( const TDesC &aData ) + { + HBufC8 * data = EscapeUtils::ConvertFromUnicodeToUtf8L( aData ); + CleanupStack::PushL(data); + + TPtr8 ptr = data->Des(); + TInt length = ptr.Length(); + + //allocate new contiguous buffer as returned buffer may be fragmented. + HBufC8* newBuf = HBufC8::NewLC( length + 1 );//+1 space for '\0' + TPtr8 newBufPtr = newBuf->Des(); + newBufPtr.Copy(ptr); + + char* chPtrTemp = ( char* )newBufPtr.PtrZ(); + char* chPtr = (char*) User::AllocL( length + 1 ); + strcpy( chPtr , chPtrTemp ); + + CleanupStack::PopAndDestroy( 2 );//newBuf,data. + + charFormatData charData ; + charData.data = chPtr; + charData.dataSize = length + 1; //+1 space for '\0' + + CleanupStack::PushL(chPtr); + return charData; + } +// --------------------------------------------------------------------------- +// OssProtocolAdapUtils::ConvertTDesC8toChar +// --------------------------------------------------------------------------- +// +void OssProtocolAdapUtils::ConvertTDesC8toChar(const TDesC8& aSrc, char* aDes) +{ + char *temp = (char*)aSrc.Ptr(); + const TInt size = aSrc.Length(); + *(temp + size) = '\0'; + memcpy( aDes, temp, size ); +} + +// End of file diff -r 000000000000 -r e6b17d312c8b imservices/ossprotocoladaptation/src/ossprotocolpluginlogger.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/ossprotocoladaptation/src/ossprotocolpluginlogger.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,80 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Logger implementation +* +*/ + +// INCLUDE FILES + +#include +#include +#include + +#include "ossprotocolpluginlogger.h" + + +/** + * Handler used by logger to truncate the string + * rather than panic in case of buffer overflow. +*/ + +NONSHARABLE_CLASS ( TAdaptOverflowTruncate ) : public TDes16Overflow + { + +public: + void Overflow ( TDes16& /*aDes*/ ) {} + }; + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// TLogger::WriteLog() +// ----------------------------------------------------------------------------- +// +void TLogger::WriteLog ( TRefByValue aFmt, ... ) + { +#ifdef ENABLE_DEBUG_LOGS + ( void ) aFmt;//Suppress unused formal parameter warning + TBuf< KTAdaptMaxLogLineLength > buffer; + buffer.Append ( _L ( "[" ) ); // CSI: 78 # + buffer.Append ( RThread().Name() ); + buffer.Append ( _L ( "] " ) ); // CSI: 78 # + TAdaptOverflowTruncate overflow; + VA_LIST list; + VA_START ( list, aFmt ); + buffer.AppendFormatList ( aFmt, list, &overflow ); + RFileLogger logger; + + if ( logger.Connect() == KErrNone ) + { + logger.SetDateAndTime ( ETrue, ETrue ); + logger.CreateLog ( KTAdaptDebugOutputDir, KTAdaptDebugOutputFileName, + EFileLoggingModeAppend ); + logger.Write ( buffer ); + logger.CloseLog(); + logger.Close(); + } + +#endif + + } + + + + + + +// End of File + + diff -r 000000000000 -r e6b17d312c8b imservices/ossprotocoladaptation/src/presenceauthorization/cossprotocolpresenceauthorization.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/ossprotocoladaptation/src/presenceauthorization/cossprotocolpresenceauthorization.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,393 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Oss Protocol implementation for Presence Framework +* +*/ + + +#include + +#include +#include +#include + +#include "cossprotocolpresenceauthorization.h" +#include "ossprotocolpluginlogger.h" +#include "cossprotocolconnectionmanager.h" + +#include "csubscribepresencegrantrequestlistrequest.h" +#include "ossprotocolpluginpanics.h" +#include "cpresenceauthuserrequest.h" +#include "cwithdrawpresencegrantfrompresentityrequest.h" + + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// CImpsConnection::GetInterface() +// --------------------------------------------------------------------------- +// +TAny* COssProtocolPresenceAuthorization::GetInterface( TInt32 aInterfaceId, + TIfGetOps aOptions ) + { + LOGGER ( TXT("COssProtocolPresenceAuthorization::GetInterface() Start") ); + if( aInterfaceId == MProtocolPresenceAuthorization::KInterfaceId ) + { + MProtocolPresenceAuthorization* self = this; + return self; + } + + if( aOptions == MXIMPBase::EPanicIfUnknown ) + { + User::Panic( KOSSProtocolPresenceAuthorization, KErrExtensionNotSupported ); + } + LOGGER ( TXT("COssProtocolPresenceAuthorization::GetInterface() End") ); + return NULL; + } + + +// --------------------------------------------------------------------------- +// CImpsConnection::GetInterface() +// --------------------------------------------------------------------------- +// +const TAny* COssProtocolPresenceAuthorization::GetInterface( TInt32 aInterfaceId, + TIfGetOps aOptions ) const + { + LOGGER ( TXT("COssProtocolPresenceAuthorization::GetInterface() Start") ); + if( aInterfaceId == MProtocolPresenceAuthorization::KInterfaceId ) + { + const MProtocolPresenceAuthorization* self = this; + return self; + } + + if( aOptions == MXIMPBase::EPanicIfUnknown ) + { + User::Panic( KOSSProtocolPresenceAuthorization, KErrExtensionNotSupported ); + } + LOGGER ( TXT("COssProtocolPresenceAuthorization::GetInterface() End") ); + return NULL; + } + + +// --------------------------------------------------------------------------- +// CImpsConnection::NewInstanceLC() +// --------------------------------------------------------------------------- +// +TInt32 COssProtocolPresenceAuthorization::GetInterfaceId() const + { + LOGGER ( TXT("COssProtocolPresenceAuthorization::GetInterfaceId() Start-End") ); + return MProtocolPresenceAuthorization::KInterfaceId; + } + + + +// --------------------------------------------------------------------------- +// COssProtocolPresenceAuthorization::COssProtocolPresenceAuthorization() +// --------------------------------------------------------------------------- +// +COssProtocolPresenceAuthorization::COssProtocolPresenceAuthorization( + MOSSProtocolConnectionManager& aConnMan) + :iConnMan(aConnMan) + { + LOGGER ( TXT("::COssProtocolPresenceAuthorization() Start-End") ); + } + + +// --------------------------------------------------------------------------- +// COssProtocolPresenceAuthorization::ConstructL() +// --------------------------------------------------------------------------- +// +void COssProtocolPresenceAuthorization::ConstructL() + { + LOGGER ( TXT("COssProtocolPresenceAuthorization::ConstructL() Start") ); + LOGGER ( TXT("COssProtocolPresenceAuthorization::ConstructL() End") ); + } + + +// --------------------------------------------------------------------------- +// COssProtocolPresenceAuthorization::NewL() +// --------------------------------------------------------------------------- +// +COssProtocolPresenceAuthorization* COssProtocolPresenceAuthorization::NewL( + MOSSProtocolConnectionManager& aConnMan ) + { + LOGGER ( TXT("COssProtocolPresenceAuthorization::NewL() Start") ); + + COssProtocolPresenceAuthorization* self = + new( ELeave ) COssProtocolPresenceAuthorization( aConnMan); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + + LOGGER ( TXT("COssProtocolPresenceAuthorization::NewL() End") ); + return self; + } + + +// --------------------------------------------------------------------------- +// COssProtocolPresenceAuthorization::~COssProtocolPresenceAuthorization() +// --------------------------------------------------------------------------- +// +COssProtocolPresenceAuthorization::~COssProtocolPresenceAuthorization() + { + LOGGER ( TXT("Authorization::~COssProtocolPresenceAuthorization() Start") ); + + + LOGGER ( TXT("Authorization::~COssProtocolPresenceAuthorization() End") ); + } + + +// --------------------------------------------------------------------------- +// COssProtocolPresenceAuthorization::DoUnsubscribePresenceWatcherListL() +// --------------------------------------------------------------------------- +// +void COssProtocolPresenceAuthorization::DoSubscribePresenceGrantRequestListL( + TXIMPRequestId aReqId ) + { + LOGGER ( TXT("Authorization::DoSubscribePresenceGrantRequestListL() Start") ); + if( ! iConnMan.GetContactManager().IsFetchInvitationsForFirstTime() ) + { + iConnMan.GetContactManager().SetFetchInvitationsForFirstTime(ETrue); + CreateDataHandlerL(); + + iConnMan.GetAddNotificationHandler().StartListeningL(); + iConnMan.HandleToHost().HandleRequestCompleted( aReqId, KErrNone ); + } + else + { + iConnMan.GetContactManager().ReturnInvitationListL(); + iConnMan.HandleToHost().HandleRequestCompleted ( aReqId, KErrNone ); + } + + LOGGER ( TXT("Authorization::DoSubscribePresenceGrantRequestListL() End") ); + } + +// --------------------------------------------------------------------------- +// COssProtocolPresenceAuthorization::DoUnsubscribePresenceWatcherListL() +// --------------------------------------------------------------------------- +// +void COssProtocolPresenceAuthorization::DoUnsubscribePresenceGrantRequestListL( + TXIMPRequestId aReqId ) + { + LOGGER ( TXT("Authorization::DoUnsubscribePresenceGrantRequestListL() Start") ); + + // complete the request successfully + iConnMan.HandleToHost().HandleRequestCompleted( aReqId, KErrNone ); + + LOGGER ( TXT("Authorization::DoUnsubscribePresenceGrantRequestListL() End") ); + } + +// --------------------------------------------------------------------------- +// COssProtocolPresenceAuthorization::DoGrantPresenceForPresentityL() +// --------------------------------------------------------------------------- +// +void COssProtocolPresenceAuthorization::DoGrantPresenceForPresentityL( + const MXIMPIdentity& aIdentity, + const MPresenceInfoFilter& aPif, + TXIMPRequestId aReqId ) + { + LOGGER ( TXT("Authorization::DoGrantPresenceForPresentityL() Start") ); + CreateDataHandlerL(); + + CPresenceAuthUserRequest* req = + CPresenceAuthUserRequest::NewLC( iConnMan, aReqId ); + + + req->PresenceAuthUserRequestL(aIdentity,aPif); + + CleanupStack::Pop( req ); + LOGGER ( TXT("Authorization::DoGrantPresenceForPresentityL() End") ); + } + +// --------------------------------------------------------------------------- +// COssProtocolPresenceAuthorization::DoUpdateGrantPresenceForPresentityL() +// --------------------------------------------------------------------------- +// +void COssProtocolPresenceAuthorization::DoUpdatePresenceGrantPifForPresentityL( + const MXIMPIdentity&/*aIdentity*/, + const MPresenceInfoFilter &/*aPif*/, + TXIMPRequestId /*aReqId*/ ) + { + LOGGER ( TXT("Authorization::DoUpdatePresenceGrantPifForPresentityL() Start") ); + LOGGER ( TXT("Authorization::DoUpdatePresenceGrantPifForPresentityL() End") ); + } + +// --------------------------------------------------------------------------- +// COssProtocolPresenceAuthorization::DoUpdateGrantPresenceForPresentityGroupMembersL() +// --------------------------------------------------------------------------- +// +void COssProtocolPresenceAuthorization::DoWithdrawPresenceGrantFromPresentityL( + const MXIMPIdentity &aIdentity, + TXIMPRequestId aReqId ) + { + LOGGER ( TXT("Authorization::DoWithdrawPresenceGrantFromPresentityL() Start") ); + CreateDataHandlerL(); + + CWithdrawPresenceGrantFromPresentityRequest* req = + CWithdrawPresenceGrantFromPresentityRequest::NewLC( iConnMan, aReqId ); + + + req->WithdrawPresenceGrantFromPresentityL( aIdentity ); + + CleanupStack::Pop( req ); + + + LOGGER ( TXT("Authorization::DoWithdrawPresenceGrantFromPresentityL() End") ); + } + +// --------------------------------------------------------------------------- +// COssProtocolPresenceAuthorization::DoGrantPresenceForPresentityGroupMembersL() +// --------------------------------------------------------------------------- +// +void COssProtocolPresenceAuthorization::DoGrantPresenceForPresentityGroupMembersL( + const MXIMPIdentity&/*aIdentity*/, + const MPresenceInfoFilter& /*aPif*/, + TXIMPRequestId /*aReqId*/ ) + { + LOGGER ( TXT("Authorization::DoGrantPresenceForPresentityGroupMembersL() Start") ); + + LOGGER ( TXT("Authorization::DoGrantPresenceForPresentityGroupMembersL() End") ); + } + +// --------------------------------------------------------------------------- +// COssProtocolPresenceAuthorization::DoUpdateGrantPresenceForPresentityGroupMembersL() +// --------------------------------------------------------------------------- +// +void COssProtocolPresenceAuthorization::DoUpdatePresenceGrantPifForPresentityGroupMembersL( + const MXIMPIdentity&/*aIdentity*/, + const MPresenceInfoFilter&/*aPif*/, + TXIMPRequestId /*aReqId*/ ) + { + LOGGER ( TXT("DoUpdatePresenceGrantPifForPresentityGroupMembersL() Start") ); + + LOGGER ( TXT("DoUpdatePresenceGrantPifForPresentityGroupMembersL() End") ); + } + + +// --------------------------------------------------------------------------- +// COssProtocolPresenceAuthorization::DoUpdateGrantPresenceForPresentityGroupMembersL() +// --------------------------------------------------------------------------- +// +void COssProtocolPresenceAuthorization::DoWithdrawPresenceGrantFromPresentityGroupMembersL( + const MXIMPIdentity&/*aIdentity*/, + TXIMPRequestId /*aReqId*/ ) + { + LOGGER ( TXT("DoWithdrawPresenceGrantFromPresentityGroupMembersL() Start") ); + + LOGGER ( TXT("DoWithdrawPresenceGrantFromPresentityGroupMembersL() End") ); + } + +// --------------------------------------------------------------------------- +// COssProtocolPresenceAuthorization::DoGrantPresenceForEveryoneL() +// --------------------------------------------------------------------------- +// +void COssProtocolPresenceAuthorization::DoGrantPresenceForEveryoneL( + const MPresenceInfoFilter& /*aPif*/, + TXIMPRequestId /*aReqId*/ ) + { + LOGGER ( TXT("Authorization::DoGrantPresenceForEveryoneL() Start") ); + + LOGGER ( TXT("Authorization::DoGrantPresenceForEveryoneL() End") ); + } + +// --------------------------------------------------------------------------- +// COssProtocolPresenceAuthorization::DoUpdatePresenceGrantPifForEveryoneL() +// --------------------------------------------------------------------------- +// +void COssProtocolPresenceAuthorization::DoUpdatePresenceGrantPifForEveryoneL( + const MPresenceInfoFilter& /*aPif*/, + TXIMPRequestId /*aReqId*/ ) + { + LOGGER ( TXT("Authorization::DoUpdatePresenceGrantPifForEveryoneL() Start") ); + + LOGGER ( TXT("Authorization::DoUpdatePresenceGrantPifForEveryoneL() End") ); + } + +// --------------------------------------------------------------------------- +// COssProtocolPresenceAuthorization::DoWithdrawPresenceGrantFromEveryoneL() +// --------------------------------------------------------------------------- +// +void COssProtocolPresenceAuthorization::DoWithdrawPresenceGrantFromEveryoneL( + TXIMPRequestId /*aReqId*/ ) + { + LOGGER ( TXT("Authorization::DoWithdrawPresenceGrantFromEveryoneL() Start") ); + + LOGGER ( TXT("Authorization::DoWithdrawPresenceGrantFromEveryoneL() End") ); + } + +// --------------------------------------------------------------------------- +// COssProtocolPresenceAuthorization::DoSubscribePresenceBlockListL() +// --------------------------------------------------------------------------- +// +void COssProtocolPresenceAuthorization::DoSubscribePresenceBlockListL( + TXIMPRequestId /*aReqId*/ ) + { + LOGGER ( TXT("Authorization::DoSubscribePresenceBlockListL() Start") ); + + LOGGER ( TXT("Authorization::DoSubscribePresenceBlockListL() End") ); + } + + +// --------------------------------------------------------------------------- +// COssProtocolPresenceAuthorization::DoUnsubscribePresenceBlockListL() +// --------------------------------------------------------------------------- +// +void COssProtocolPresenceAuthorization::DoUnsubscribePresenceBlockListL( + TXIMPRequestId /*aReqId*/ ) + { + LOGGER ( TXT("Authorization::DoUnsubscribePresenceBlockListL() Start") ); + LOGGER ( TXT("Authorization::DoUnsubscribePresenceBlockListL() End") ); + } + + +// --------------------------------------------------------------------------- +// COssProtocolPresenceAuthorization::DoBlockPresenceForPresentityL() +// --------------------------------------------------------------------------- +// +void COssProtocolPresenceAuthorization::DoBlockPresenceForPresentityL( + const MXIMPIdentity& /*aPresentityId*/, + TXIMPRequestId /*aReqId*/ ) + { + LOGGER ( TXT("Authorization::DoBlockPresenceForPresentityL() Start") ); + + LOGGER ( TXT("Authorization::DoBlockPresenceForPresentityL() End") ); + } + +// --------------------------------------------------------------------------- +// COssProtocolPresenceAuthorization::DoCancelPresenceBlockFromPresentityL() +// --------------------------------------------------------------------------- +// +void COssProtocolPresenceAuthorization::DoCancelPresenceBlockFromPresentityL( + const MXIMPIdentity& /*aPresentityId*/, + TXIMPRequestId /*aReqId*/ ) + { + LOGGER ( TXT("Authorization::DoCancelPresenceBlockFromPresentityL() Start") ); + + LOGGER ( TXT("Authorization::DoCancelPresenceBlockFromPresentityL() End") ); + } + +// --------------------------------------------------------------------------- +// COssProtocolPresenceAuthorization::CreateDataHandlerL() +// --------------------------------------------------------------------------- +// +void COssProtocolPresenceAuthorization::CreateDataHandlerL() + { + LOGGER ( TXT("Authorization::CreateDataHandler() Start")); + iConnMan.ManufactureDataHandlerL(); + LOGGER ( TXT("Authorization::CreateDataHandler() End")); + } + + +// End of file + diff -r 000000000000 -r e6b17d312c8b imservices/ossprotocoladaptation/src/presenceauthorization/cpresenceauthuserrequest.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/ossprotocoladaptation/src/presenceauthorization/cpresenceauthuserrequest.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,220 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Request for accepting add invite to the Network Server. +* +*/ + + +#include +#include "cpresenceauthuserrequest.h" +#include "mossprotocolconnectionmanager.h" +#include "ossprotocolpluginlogger.h" +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include "stringutils.h" +#include +#include +#include +#include +#include "msgliterals.h" +#include "msg_enums.h" +#include "waittimer.h" +#include +#include "ossprotocoladaptutils.h" + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// CPresenceAuthUserRequest::CPresenceAuthUserRequest +// --------------------------------------------------------------------------- +// +CPresenceAuthUserRequest::CPresenceAuthUserRequest( + MOSSProtocolConnectionManager& aConnMan, + TXIMPRequestId aRequestId ) : + CActive( EPriorityNormal ), + iRequestId( aRequestId ), + iConnMan( aConnMan ) + { + LOGGER ( TXT("::CPresenceAuthUserRequest Start") ); + CActiveScheduler::Add( this ); + LOGGER ( TXT("::CPresenceAuthUserRequest End") ); + } + + +// --------------------------------------------------------------------------- +// CPresenceAuthUserRequest::ConstructL +// --------------------------------------------------------------------------- +// +void CPresenceAuthUserRequest::ConstructL() + { + LOGGER ( TXT("CPresenceAuthUserRequest::ConstructL Start-End") ); + + } + + +// --------------------------------------------------------------------------- +// CPresenceAuthUserRequest::NewL +// --------------------------------------------------------------------------- +// +CPresenceAuthUserRequest* CPresenceAuthUserRequest::NewL( + MOSSProtocolConnectionManager& aConnMan, + TXIMPRequestId aRequestId ) + { + LOGGER ( TXT("CPresenceAuthUserRequest::NewL Start") ); + + CPresenceAuthUserRequest* self = + new( ELeave ) CPresenceAuthUserRequest( aConnMan, aRequestId ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + + LOGGER ( TXT("CPresenceAuthUserRequest::NewL End") ); + return self; + } + + +// --------------------------------------------------------------------------- +// CPresenceAuthUserRequest::NewLC +// --------------------------------------------------------------------------- +// +CPresenceAuthUserRequest* CPresenceAuthUserRequest::NewLC( + MOSSProtocolConnectionManager& aConnMan, + TXIMPRequestId aRequestId ) + { + LOGGER ( TXT("CPresenceAuthUserRequest::NewLC Start") ); + + CPresenceAuthUserRequest* self = + CPresenceAuthUserRequest::NewL( aConnMan, aRequestId ); + CleanupStack::PushL( self ); + + LOGGER ( TXT("CPresenceAuthUserRequest::NewLC End") ); + return self; + } + +// --------------------------------------------------------------------------- +// CPresenceAuthUserRequest::~CPresenceAuthUserRequest +// --------------------------------------------------------------------------- +// +CPresenceAuthUserRequest::~CPresenceAuthUserRequest() + { + LOGGER ( TXT("CPresenceAuthUserRequest::~CPresenceAuthUserRequest Start") ); + + CActive::Cancel(); + LOGGER ( TXT("CPresenceAuthUserRequest::~CPresenceAuthUserRequest End") ); + } + + +// --------------------------------------------------------------------------- +// CPresenceAuthUserRequest::DoCancel() +// --------------------------------------------------------------------------- +// +void CPresenceAuthUserRequest::DoCancel() + { + LOGGER ( TXT("CPresenceAuthUserRequest::DoCancel Start") ); + } + + +// --------------------------------------------------------------------------- +// CPresenceAuthUserRequest::RunL() +// --------------------------------------------------------------------------- +// +void CPresenceAuthUserRequest::RunL() + { + LOGGER ( TXT("CPresenceAuthUserRequest::RunL Start") ); + + message_hdr_resp* msg_struct = NULL; + User::LeaveIfError( iStatus.Int() ); + char* pResponse = NULL; + pResponse = iConnMan.DataHandler().ResponseL( iSendId ); + + msg_struct = ( message_hdr_resp* )pResponse ; + + if( !( msg_struct->response ) ) + { + //for all other error codes like ssl related are mapped to general error + iConnMan.HandleToHost().HandleRequestCompleted ( iRequestId, KXIMPErrServiceGeneralError ); + } + else + { + iConnMan.HandleToHost().HandleRequestCompleted ( iRequestId, KErrNone ); + } + free(pResponse); + delete this; + LOGGER ( TXT("CPresenceAuthUserRequest::RunL End") ); + } + + +// --------------------------------------------------------------------------- +// CPresenceAuthUserRequest::RunError +// --------------------------------------------------------------------------- +// +TInt CPresenceAuthUserRequest::RunError( TInt aError ) + { + LOGGER ( TXT("CPresenceAuthUserRequest::RunError Start") ); + + iConnMan.HandleToHost().HandleRequestCompleted( iRequestId, aError ); + + delete this; + LOGGER ( TXT("CPresenceAuthUserRequest::RunError End") ); + return KErrNone; + } + +// --------------------------------------------------------------------------- +// CPresenceAuthUserRequest::PresenceAuthUserRequest +// --------------------------------------------------------------------------- +// +void CPresenceAuthUserRequest::PresenceAuthUserRequestL( + const MXIMPIdentity & aIdentity, + const MPresenceInfoFilter &/*aPif*/ ) + { + LOGGER ( TXT("CPresenceAuthUserRequest::PresenceAuthUserRequest Start") ); + + char *smsg = NULL; + int totalLen = 0; + + message_hdr_req msgHdr = {0,}; + msgHdr.message_type = EAccept_Contact_Request ; + TInt headerSize = sizeof( message_hdr_req ) ; + + charFormatData tmpmsgData = OssProtocolAdapUtils::ConvertTUint16ToCharLC( aIdentity.Identity() ); + char* tmpmsg = tmpmsgData.data; + TInt tmpmsgLength = tmpmsgData.dataSize; + totalLen = headerSize + tmpmsgLength; + + smsg = ( char* ) User::AllocLC(totalLen); + memcpy( smsg, &msgHdr, headerSize ); + memcpy ( smsg + headerSize, tmpmsg, tmpmsgLength ); + + iSendId = iConnMan.DataHandler().SendDataL ( iStatus, smsg, totalLen ); + + // signal the scheduler + SetActive(); + + CleanupStack::PopAndDestroy ( 2 ); //smsg, tmpmsg. + LOGGER ( TXT("CPresenceAuthUserRequest::PresenceAuthUserRequest End") ); + } + + +// End of file diff -r 000000000000 -r e6b17d312c8b imservices/ossprotocoladaptation/src/presenceauthorization/csubscribepresencegrantrequestlistrequest.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/ossprotocoladaptation/src/presenceauthorization/csubscribepresencegrantrequestlistrequest.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,180 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: subscribe to grant presence request list +* +*/ + + +#include +#include "csubscribepresencegrantrequestlistrequest.h" +#include "mossprotocolconnectionmanager.h" +#include "ossprotocolpluginlogger.h" +#include + +#include "cossprotocolconnectionmanager.h" + +#include +#include +#include +#include +#include +#include +#include + + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// CSubscribePresenceGrantRequestListRequest::CSubscribePresenceGrantRequestListRequest +// --------------------------------------------------------------------------- +// +CSubscribePresenceGrantRequestListRequest::CSubscribePresenceGrantRequestListRequest( + MOSSProtocolConnectionManager& aConnMan, + TXIMPRequestId aRequestId ) : + CActive( EPriorityNormal ), + iRequestId( aRequestId ), + iConnMan( aConnMan ) + { + LOGGER ( TXT("::CSubscribePresenceGrantRequestListRequest Start") ); + CActiveScheduler::Add( this ); + LOGGER ( TXT("::CSubscribePresenceGrantRequestListRequest End") ); + } + + +// --------------------------------------------------------------------------- +// CSubscribePresenceGrantRequestListRequest::ConstructL +// --------------------------------------------------------------------------- +// +void CSubscribePresenceGrantRequestListRequest::ConstructL() + { + LOGGER ( TXT("::ConstructL Start") ); + LOGGER ( TXT("::ConstructL End") ); + } + + +// --------------------------------------------------------------------------- +// CSubscribePresenceGrantRequestListRequest::NewL +// --------------------------------------------------------------------------- +// +CSubscribePresenceGrantRequestListRequest* CSubscribePresenceGrantRequestListRequest::NewL( + MOSSProtocolConnectionManager& aConnMan, + TXIMPRequestId aRequestId ) + { + LOGGER ( TXT("CSubscribePresenceGrantRequestListRequest::NewL Start") ); + + CSubscribePresenceGrantRequestListRequest* self = new( ELeave ) + CSubscribePresenceGrantRequestListRequest( aConnMan, aRequestId ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + + LOGGER ( TXT("CSubscribePresenceGrantRequestListRequest::NewL End") ); + return self; + } + + +// --------------------------------------------------------------------------- +// CSubscribePresenceGrantRequestListRequest::NewLC +// --------------------------------------------------------------------------- +// +CSubscribePresenceGrantRequestListRequest* CSubscribePresenceGrantRequestListRequest::NewLC( + MOSSProtocolConnectionManager& aConnMan, + TXIMPRequestId aRequestId ) + { + LOGGER ( TXT("CSubscribePresenceGrantRequestListRequest::NewLC Start") ); + + CSubscribePresenceGrantRequestListRequest* self = + CSubscribePresenceGrantRequestListRequest::NewL( aConnMan, aRequestId ); + CleanupStack::PushL( self ); + + LOGGER ( TXT("CSubscribePresenceGrantRequestListRequest::NewLC End") ); + return self; + } + +// --------------------------------------------------------------------------- +// CSubscribePresenceGrantRequestListRequest::~CSubscribePresenceGrantRequestListRequest +// --------------------------------------------------------------------------- +// +CSubscribePresenceGrantRequestListRequest::~CSubscribePresenceGrantRequestListRequest() + { + LOGGER ( TXT("::~CSubscribePresenceGrantRequestListRequest Start") ); + + CActive::Cancel(); + + LOGGER ( TXT("::~CSubscribePresenceGrantRequestListRequest End") ); + } + + +// --------------------------------------------------------------------------- +// CSubscribePresenceGrantRequestListRequest::DoCancel() +// --------------------------------------------------------------------------- +// +void CSubscribePresenceGrantRequestListRequest::DoCancel() + { + LOGGER ( TXT("CSubscribePresenceGrantRequestListRequest::DoCancel Start") ); + iConnMan.DataHandler().CancelListeningAddNotication(); + LOGGER ( TXT("CSubscribePresenceGrantRequestListRequest::DoCancel End") ); + } + + +// --------------------------------------------------------------------------- +// CSubscribePresenceGrantRequestListRequest::RunL() +// --------------------------------------------------------------------------- +// +void CSubscribePresenceGrantRequestListRequest::RunL() + { + LOGGER ( TXT("CSubscribePresenceGrantRequestListRequest::RunL Start") ); + + User::LeaveIfError( iStatus.Int() ); + + iConnMan.HandleToHost().HandleRequestCompleted( iRequestId, KErrNone); + + delete this; + LOGGER ( TXT("CSubscribePresenceGrantRequestListRequest::RunL End") ); + } + + +// --------------------------------------------------------------------------- +// CSubscribePresenceGrantRequestListRequest::RunError +// --------------------------------------------------------------------------- +// +TInt CSubscribePresenceGrantRequestListRequest::RunError( TInt aError ) + { + LOGGER ( TXT("CSubscribePresenceGrantRequestListRequest::RunError Start") ); + + iConnMan.HandleToHost().HandleRequestCompleted( iRequestId, aError ); + + delete this; + LOGGER ( TXT("CSubscribePresenceGrantRequestListRequest::RunError End") ); + return KErrNone; + } + +// --------------------------------------------------------------------------- +// CSubscribePresenceGrantRequestListRequest::SubscribePresenceGrantRequestListL +// --------------------------------------------------------------------------- +// +void CSubscribePresenceGrantRequestListRequest::SubscribePresenceGrantRequestListL() + { + LOGGER ( TXT("::SubscribePresenceGrantRequestListL Start") ); + // signal the scheduler + SetActive(); + + //by default adaptation 1.2 is ready for receiving presence authorisation requests from the server.no need to subscribe for it + TRequestStatus *status = &iStatus; + User::RequestComplete( status, KErrNone); + + LOGGER ( TXT("::SubscribePresenceGrantRequestListL End") ); + } + +// End of file diff -r 000000000000 -r e6b17d312c8b imservices/ossprotocoladaptation/src/presenceauthorization/cwithdrawpresencegrantfrompresentityrequest.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/ossprotocoladaptation/src/presenceauthorization/cwithdrawpresencegrantfrompresentityrequest.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,234 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Request for Rejecting add invite to the Network Server. +* +*/ + + +#include +#include "cwithdrawpresencegrantfrompresentityrequest.h" +#include "mossprotocolconnectionmanager.h" +#include "ossprotocolpluginlogger.h" +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include "stringutils.h" +#include +#include +#include +#include +#include "msgliterals.h" +#include "msg_enums.h" +#include "waittimer.h" +#include +#include "ossprotocoladaptutils.h" + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// CWithdrawPresenceGrantFromPresentityRequest::CWithdrawPresenceGrantFromPresentityRequest +// --------------------------------------------------------------------------- +// +CWithdrawPresenceGrantFromPresentityRequest::CWithdrawPresenceGrantFromPresentityRequest( + MOSSProtocolConnectionManager& aConnMan, + TXIMPRequestId aRequestId ) : + CActive( EPriorityNormal ), + iRequestId( aRequestId ), + iConnMan( aConnMan ) + { + LOGGER ( TXT("::CWithdrawPresenceGrantFromPresentityRequest Start") ); + CActiveScheduler::Add( this ); + LOGGER ( TXT("::CWithdrawPresenceGrantFromPresentityRequest End") ); + } + + +// --------------------------------------------------------------------------- +// CWithdrawPresenceGrantFromPresentityRequest::ConstructL +// --------------------------------------------------------------------------- +// +void CWithdrawPresenceGrantFromPresentityRequest::ConstructL() + { + LOGGER ( TXT("CWithdrawPresenceGrantFromPresentityRequest::ConstructL Start-End") ); + + } + + +// --------------------------------------------------------------------------- +// CWithdrawPresenceGrantFromPresentityRequest::NewL +// --------------------------------------------------------------------------- +// +CWithdrawPresenceGrantFromPresentityRequest* CWithdrawPresenceGrantFromPresentityRequest::NewL( + MOSSProtocolConnectionManager& aConnMan, + TXIMPRequestId aRequestId ) + { + LOGGER ( TXT("CWithdrawPresenceGrantFromPresentityRequest::NewL Start") ); + + CWithdrawPresenceGrantFromPresentityRequest* self = + new( ELeave ) CWithdrawPresenceGrantFromPresentityRequest( aConnMan, aRequestId ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + + LOGGER ( TXT("CWithdrawPresenceGrantFromPresentityRequest::NewL End") ); + return self; + } + + +// --------------------------------------------------------------------------- +// CWithdrawPresenceGrantFromPresentityRequest::NewLC +// --------------------------------------------------------------------------- +// +CWithdrawPresenceGrantFromPresentityRequest* CWithdrawPresenceGrantFromPresentityRequest::NewLC( + MOSSProtocolConnectionManager& aConnMan, + TXIMPRequestId aRequestId ) + { + LOGGER ( TXT("CWithdrawPresenceGrantFromPresentityRequest::NewLC Start") ); + + CWithdrawPresenceGrantFromPresentityRequest* self = + CWithdrawPresenceGrantFromPresentityRequest::NewL( aConnMan, aRequestId ); + CleanupStack::PushL( self ); + + LOGGER ( TXT("CWithdrawPresenceGrantFromPresentityRequest::NewLC End") ); + return self; + } + +// --------------------------------------------------------------------------- +// CWithdrawPresenceGrantFromPresentityRequest::~CWithdrawPresenceGrantFromPresentityRequest +// --------------------------------------------------------------------------- +// +CWithdrawPresenceGrantFromPresentityRequest::~CWithdrawPresenceGrantFromPresentityRequest() + { + LOGGER ( TXT("CWithdrawPresenceGrantFromPresentityRequest::~CWithdrawPresenceGrantFromPresentityRequest Start") ); + CActive::Cancel(); + LOGGER ( TXT("CWithdrawPresenceGrantFromPresentityRequest::~CWithdrawPresenceGrantFromPresentityRequest End") ); + } + + +// --------------------------------------------------------------------------- +// CWithdrawPresenceGrantFromPresentityRequest::DoCancel() +// --------------------------------------------------------------------------- +// +void CWithdrawPresenceGrantFromPresentityRequest::DoCancel() + { + LOGGER ( TXT("CWithdrawPresenceGrantFromPresentityRequest::DoCancel Start") ); + + // iConnMan.DataHandler().CancelSending( iSendId ); + + LOGGER ( TXT("CWithdrawPresenceGrantFromPresentityRequest::DoCancel End") ); + } + + +// --------------------------------------------------------------------------- +// CWithdrawPresenceGrantFromPresentityRequest::RunL() +// --------------------------------------------------------------------------- +// +void CWithdrawPresenceGrantFromPresentityRequest::RunL() + { + LOGGER ( TXT("CWithdrawPresenceGrantFromPresentityRequest::RunL Start") ); + + message_hdr_resp* msg_struct = NULL; + char* pResponse = NULL; + TInt error_code(KErrNone); + User::LeaveIfError( iStatus.Int() ); + + pResponse = iConnMan.DataHandler().ResponseL( iSendId ); + + msg_struct = ( message_hdr_resp* )pResponse ; + error_code = msg_struct->error_type; + if( !( msg_struct->response ) ) + { + iConnMan.HandleToHost().HandleRequestCompleted ( iRequestId, error_code ); + } + else + { + iConnMan.HandleToHost().HandleRequestCompleted ( iRequestId, KErrNone ); + } + + free( pResponse ); + delete this; + LOGGER ( TXT("CWithdrawPresenceGrantFromPresentityRequest::RunL End") ); + } + + +// --------------------------------------------------------------------------- +// CWithdrawPresenceGrantFromPresentityRequest::RunError +// --------------------------------------------------------------------------- +// +TInt CWithdrawPresenceGrantFromPresentityRequest::RunError( TInt aError ) + { + LOGGER ( TXT("CWithdrawPresenceGrantFromPresentityRequest::RunError Start") ); + + iConnMan.HandleToHost().HandleRequestCompleted( iRequestId, aError ); + + delete this; + LOGGER ( TXT("CWithdrawPresenceGrantFromPresentityRequest::RunError End") ); + return KErrNone; + } + +// --------------------------------------------------------------------------- +// CWithdrawPresenceGrantFromPresentityRequest::WithdrawPresenceGrantFromPresentityL +// --------------------------------------------------------------------------- +// +void CWithdrawPresenceGrantFromPresentityRequest::WithdrawPresenceGrantFromPresentityL( + const MXIMPIdentity& aIdentity) + { + LOGGER ( TXT("CWithdrawPresenceGrantFromPresentityRequest::WithdrawPresenceGrantFromPresentity Start") ); + char *smsg = NULL; + char *tmpmsg = NULL; + int userLen = 0; + int totalLen = 0; + + message_hdr_req msgHdr = {0,}; + msgHdr.message_type = EReject_Contact_Request ; + + TInt headerLength = sizeof( message_hdr_req ); + totalLen += headerLength; + // adding add contact + charFormatData tmpmsgData = OssProtocolAdapUtils::ConvertTUint16ToCharLC( aIdentity.Identity() ); + tmpmsg = tmpmsgData.data; + userLen = tmpmsgData.dataSize; + totalLen += userLen; + + if ( totalLen > MAX_MSG_SIZE ) + { + User::Leave(KErrArgument); + } + + smsg = ( char* ) User::AllocLC(totalLen); + memcpy( smsg, &msgHdr, headerLength ); + memcpy ( smsg + headerLength, tmpmsg, userLen ); + + iSendId = iConnMan.DataHandler().SendDataL ( iStatus, smsg, totalLen ); + + // signal the scheduler + SetActive(); + + CleanupStack::PopAndDestroy ( 2 );//smsg, tmpmsg. + + LOGGER ( TXT("CWithdrawPresenceGrantFromPresentityRequest::WithdrawPresenceGrantFromPresentity End") ); + } + + + +// End of file diff -r 000000000000 -r e6b17d312c8b imservices/ossprotocoladaptation/src/presencepublishing/cossprotocolpresencepublishing.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/ossprotocoladaptation/src/presencepublishing/cossprotocolpresencepublishing.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,266 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: IMPS Protocol Publishing implementation for Presence Framework +* +*/ + + +#include + +#include +#include +#include + +#include "cossprotocolpresencepublishing.h" +#include "ossprotocolpluginlogger.h" +#include "cossprotocolconnectionmanager.h" +//#include "csubscribeownpresencerequest.h" +#include "cpresencenotificationhandler.h" +//#include "cunsubscribeownpresencerequest.h" +#include "cpublishownpresencerequest.h" +//#include "csubscribepresencewatcherlistrequest.h" +//#include "cupdateownpresencesubscriptionpifrequest.h" + +#include "ossprotocolpluginpanics.h" + + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// COssProtocolPresencePublishing::GetInterface() +// --------------------------------------------------------------------------- +// +TAny* COssProtocolPresencePublishing::GetInterface( + TInt32 aInterfaceId, + TIfGetOps aOptions ) + { + LOGGER ( TXT("CImpsProtocolPresentityGroups::GetInterface() Start") ); + + + if( aInterfaceId == MProtocolPresencePublishing::KInterfaceId ) + { + MProtocolPresencePublishing* self = this; + return self; + } + + if( aOptions == MXIMPBase::EPanicIfUnknown ) + { + User::Panic( KOSSProtocolPresencePublishing, KErrExtensionNotSupported ); + } + + LOGGER ( TXT("COssProtocolPresencePublishing::GetInterface() End") ); + return NULL; + } + + +// --------------------------------------------------------------------------- +// COssProtocolPresencePublishing::GetInterface() +// --------------------------------------------------------------------------- +// +const TAny* COssProtocolPresencePublishing::GetInterface( + TInt32 aInterfaceId, + TIfGetOps aOptions ) const + { + LOGGER ( TXT("CImpsProtocolPresentityGroups::GetInterface() Start") ); + + if( aInterfaceId == MProtocolPresencePublishing::KInterfaceId ) + { + const MProtocolPresencePublishing* self = this; + return self; + } + + if( aOptions == MXIMPBase::EPanicIfUnknown ) + { + User::Panic( KOSSProtocolPresencePublishing, KErrExtensionNotSupported ); + } + + LOGGER ( TXT("COssProtocolPresencePublishing::GetInterface() End") ); + return NULL; + } + + +// --------------------------------------------------------------------------- +// COssProtocolPresencePublishing::NewInstanceLC() +// --------------------------------------------------------------------------- +// +TInt32 COssProtocolPresencePublishing::GetInterfaceId() const + { + LOGGER ( TXT("COssProtocolPresencePublishing::GetInterfaceId() Start-End") ); + return MProtocolPresencePublishing::KInterfaceId; + } + +// --------------------------------------------------------------------------- +// COssProtocolPresencePublishing::COssProtocolPresencePublishing() +// --------------------------------------------------------------------------- +// +COssProtocolPresencePublishing::COssProtocolPresencePublishing( + MOSSProtocolConnectionManager& aConnMan) +:iConnMan(aConnMan) + { + LOGGER ( TXT("Publishing::COssProtocolPresencePublishing() Start") ); + LOGGER ( TXT("Publishing::COssProtocolPresencePublishing() End") ); + } + + +// --------------------------------------------------------------------------- +// COssProtocolPresencePublishing::ConstructL() +// --------------------------------------------------------------------------- +// +void COssProtocolPresencePublishing::ConstructL() + { + LOGGER ( TXT("COssProtocolPresencePublishing::ConstructL() Start") ); + + //iNotificationHandler = CPresenceNotificationHandler::NewL( iConnMan ); + + + LOGGER ( TXT("COssProtocolPresencePublishing::ConstructL() End") ); + } + + +// --------------------------------------------------------------------------- +// COssProtocolPresencePublishing::NewL() +// --------------------------------------------------------------------------- +// +COssProtocolPresencePublishing* COssProtocolPresencePublishing::NewL( + MOSSProtocolConnectionManager& aConnMan ) + + { + LOGGER ( TXT("COssProtocolPresencePublishing::NewL() Start") ); + + COssProtocolPresencePublishing* self = + new( ELeave ) COssProtocolPresencePublishing(aConnMan); + CleanupStack::PushL( self ); + self->ConstructL( ); + CleanupStack::Pop( self ); + + LOGGER ( TXT("COssProtocolPresencePublishing::NewL() End") ); + return self; + } + + +// --------------------------------------------------------------------------- +// COssProtocolPresencePublishing::~COssProtocolPresencePublishing() +// --------------------------------------------------------------------------- +// +COssProtocolPresencePublishing::~COssProtocolPresencePublishing() + { + LOGGER ( TXT("Publishing::~COssProtocolPresencePublishing() Start") ); + + //delete iNotificationHandler; + + LOGGER ( TXT("Publishing::~COssProtocolPresencePublishing() End") ); + } + + +// --------------------------------------------------------------------------- +// COssProtocolPresencePublishing::DoSubscribeOwnPresenceL() +// --------------------------------------------------------------------------- +// +void COssProtocolPresencePublishing::DoSubscribeOwnPresenceL( + const MPresenceInfoFilter& /*aPif*/, + TXIMPRequestId /*aReqId*/ ) + { + LOGGER ( TXT("Publishing::DoSubscribeOwnPresenceL() Start") ); + + LOGGER ( TXT("Publishing::DoSubscribeOwnPresenceL() End") ); + } + + + +// --------------------------------------------------------------------------- +// COssProtocolPresencePublishing::DoUnsubscribeOwnPresenceL() +// --------------------------------------------------------------------------- +// +void COssProtocolPresencePublishing::DoUnsubscribeOwnPresenceL( + TXIMPRequestId /*aReqId*/ ) + { + LOGGER ( TXT("Publishing::DoUnsubscribeOwnPresenceL() Start") ); + + LOGGER ( TXT("Publishing::DoUnsubscribeOwnPresenceL() End") ); + } + + + +// --------------------------------------------------------------------------- +// COssProtocolPresencePublishing::DoUpdateOwnPresenceSubscriptionL() +// --------------------------------------------------------------------------- +// +void COssProtocolPresencePublishing::DoUpdateOwnPresenceSubscriptionPifL( + const MPresenceInfoFilter& /*aPif*/, + TXIMPRequestId /*aReqId*/ ) + { + LOGGER ( TXT("Publishing::DoUpdateOwnPresenceSubscriptionPifL() Start") ); + + + LOGGER ( TXT("Publishing::DoUpdateOwnPresenceSubscriptionPifL() End") ); + } + + + +// --------------------------------------------------------------------------- +// COssProtocolPresencePublishing::DoPublishOwnPresenceL() +// --------------------------------------------------------------------------- +// +void COssProtocolPresencePublishing::DoPublishOwnPresenceL( + const MPresenceInfo& aPresence, + TXIMPRequestId aReqId ) + { + LOGGER ( TXT("Publishing::DoPublishOwnPresenceL() Start") ); + + + + CPublishOwnPresencerequest* req = + CPublishOwnPresencerequest::NewLC( iConnMan, aReqId ); + + + req->PublishOwnPresenceL(aPresence); + + CleanupStack::Pop( req ); + + LOGGER ( TXT("Publishing::DoPublishOwnPresenceL() End") ); + } + +// --------------------------------------------------------------------------- +// COssProtocolPresencePublishing::DoSubscribePresenceWatcherListL() +// --------------------------------------------------------------------------- +// +void COssProtocolPresencePublishing::DoSubscribePresenceWatcherListL( + TXIMPRequestId /*aReqId*/ ) + { + LOGGER ( TXT("Publishing::DoSubscribePresenceWatcherListL() Start") ); + + + + LOGGER ( TXT("Publishing::DoSubscribePresenceWatcherListL() End") ); + } + + +// --------------------------------------------------------------------------- +// COssProtocolPresencePublishing::DoUnsubscribePresenceWatcherListL() +// --------------------------------------------------------------------------- +// +void COssProtocolPresencePublishing::DoUnsubscribePresenceWatcherListL( + TXIMPRequestId /*aReqId*/ ) + { + LOGGER ( TXT("Publishing::DoUnsubscribePresenceWatcherListL() Start") ); + + + LOGGER ( TXT("Publishing::DoUnsubscribePresenceWatcherListL() End") ); + } + + + + +// End of file + diff -r 000000000000 -r e6b17d312c8b imservices/ossprotocoladaptation/src/presencepublishing/cpresencenotificationhandler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/ossprotocoladaptation/src/presencepublishing/cpresencenotificationhandler.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,293 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation for handling presence notification + * +*/ + + +#include +#include "cpresencenotificationhandler.h" +#include "mossprotocolconnectionmanager.h" +#include "ossprotocolpluginlogger.h" +#include "waittimer.h" +#include "cossprotocolconnectionmanager.h" + +#include +#include +#include +#include +#include +#include "msgliterals.h" + +#include "ossprotocoladaptationuids.h" +#include "ossprotocoladaptutils.h" + +#include + + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// CPresenceNotificationHandler::CPresenceNotificationHandler +// --------------------------------------------------------------------------- +// +CPresenceNotificationHandler::CPresenceNotificationHandler ( + MOSSProtocolConnectionManager& aConnMan ) : + CActive ( EPriorityNormal ), + iConnMan ( aConnMan ) + { + LOGGER ( TXT ( "CPresenceNotificationHandler::CPresenceNotificationHandler Start" ) ); + CActiveScheduler::Add ( this ); + LOGGER ( TXT ( "CPresenceNotificationHandler::CPresenceNotificationHandler End" ) ); + } + + +// --------------------------------------------------------------------------- +// CPresenceNotificationHandler::ConstructL +// --------------------------------------------------------------------------- +// +void CPresenceNotificationHandler::ConstructL() + { + LOGGER ( TXT ( "CPresenceNotificationHandler::ConstructL Start-End" ) ); + iPresenceCacheWriter = MPresenceCacheWriter2::CreateWriterL(); + + } + + +// --------------------------------------------------------------------------- +// CPresenceNotificationHandler::NewL +// --------------------------------------------------------------------------- +// +CPresenceNotificationHandler* CPresenceNotificationHandler::NewL ( + MOSSProtocolConnectionManager& aConnMan ) + { + LOGGER ( TXT ( "CPresenceNotificationHandler::NewL Start" ) ); + + CPresenceNotificationHandler* self = new ( ELeave ) CPresenceNotificationHandler ( aConnMan ); + CleanupStack::PushL ( self ); + self->ConstructL(); + CleanupStack::Pop ( self ); + + LOGGER ( TXT ( "CPresenceNotificationHandler::NewL End" ) ); + return self; + } + + +// --------------------------------------------------------------------------- +// CPresenceNotificationHandler::NewLC +// --------------------------------------------------------------------------- +// +CPresenceNotificationHandler* CPresenceNotificationHandler::NewLC ( + MOSSProtocolConnectionManager& aConnMan ) + { + LOGGER ( TXT ( "CPresenceNotificationHandler::NewLC Start" ) ); + + CPresenceNotificationHandler* self = CPresenceNotificationHandler::NewL ( aConnMan ); + CleanupStack::PushL ( self ); + + LOGGER ( TXT ( "CPresenceNotificationHandler::NewLC End" ) ); + return self; + } + +// --------------------------------------------------------------------------- +// CPresenceNotificationHandler::~CPresenceNotificationHandler +// --------------------------------------------------------------------------- +// +CPresenceNotificationHandler::~CPresenceNotificationHandler() + { + LOGGER ( TXT ( "::~CPresenceNotificationHandler Start" ) ); + + Cancel(); + // + if ( iPresenceCacheWriter ) + { + iPresenceCacheWriter->DeleteService( iConnMan.ServiceName() ); + delete iPresenceCacheWriter ; + } + LOGGER ( TXT ( "::~CPresenceNotificationHandler End" ) ); + } + +// --------------------------------------------------------------------------- +// CPresenceNotificationHandler::DoCancel() +// --------------------------------------------------------------------------- +// +void CPresenceNotificationHandler::DoCancel() + { + LOGGER ( TXT ( "CPresenceNotificationHandler::DoCancel Start" ) ); + + iConnMan.DataHandler().CancelListeningPres(); + + LOGGER ( TXT ( "CPresenceNotificationHandler::DoCancel End" ) ); + } + +// --------------------------------------------------------------------------- +// CPresenceNotificationHandler::RunL() +// --------------------------------------------------------------------------- +// +void CPresenceNotificationHandler::RunL() + { + LOGGER ( TXT ( "CPresenceNotificationHandler::RunL Start" ) ); + + // something is coming from the xmpp server + User::LeaveIfError ( iStatus.Int() ); + ProcessIncomingDataL(); + StartListeningL(); + + LOGGER ( TXT ( "CPresenceNotificationHandler::RunL End" ) ); + } + +// --------------------------------------------------------------------------- +// CPresenceNotificationHandler::ProcessIncomingDataL() +// --------------------------------------------------------------------------- +/* This Function is used to convert the received + * presence notification from Isolation Server Message queue + * into the ximpfw data types. and storing the presence information + * in to the presence cache ( available in ximpfw ) + * client has to read the presence information from the + * presence cache. when the change in status notification is received + * while updating presence cache, client will receive the notification if subscribed. + */ +void CPresenceNotificationHandler::ProcessIncomingDataL() + { + LOGGER ( TXT ( "CPresenceNotificationHandler::ProcessIncomingDataL Start" ) ); + + char* pResponse = NULL, *pOrigResponse = NULL; + pOrigResponse = pResponse = iConnMan.DataHandler().ResponseL ( 2 );// 2 is to differentiate presence notification from server initiated request + CleanupStack::PushL(pOrigResponse) ; + MPresenceBuddyInfo2* buddyPresInfo = MPresenceBuddyInfo2::NewLC(); + + // pResponse contians "ContactId/0AvailabilityStatus/0StatusMessage". + pResponse += sizeof ( message_hdr_resp ); // Skipping Message Header + + ///////// Geting Contact-id from message queue + char* contactid = pResponse; // contactid + HBufC16 *contactName = OssProtocolAdapUtils::ConvertCharToTUint16LC( contactid ); + HBufC* name = HBufC::NewLC( contactName->Length() + iConnMan.ServiceName().Length() + KColon().Length() ); + TPtr namePtr( name->Des() ); + namePtr.Zero(); + namePtr.Append(iConnMan.ServiceName() ); // prepend service name + namePtr.Append(KColon); + namePtr.Append(contactName->Des() ); + buddyPresInfo->SetIdentityL(namePtr); + LOGGER ( TXT ( "CPresenceNotificationHandler::ProcessIncomingDataL :ContactName:%S " ), contactName ); + CleanupStack::PopAndDestroy();//name + CleanupStack::PopAndDestroy();//contactName + + ///////// End Getting Contact-id + + int toklength = strlen(pResponse) + 1 ; // finding length of contactid + '/0' + pResponse += toklength; // skipping the contactid + + ///////// Getting availibility text + char* availability = pResponse; // availability text + HBufC16 *message = OssProtocolAdapUtils::ConvertCharToTUint16LC( availability ); + switch (*(pResponse)) + { + case 'd': //compares the first char of "dnd" + { + buddyPresInfo->SetAvailabilityL( MPresenceBuddyInfo2::EBusy,KDndState); + break; + } + case 'b': + { + buddyPresInfo->SetAvailabilityL( MPresenceBuddyInfo2::EBusy,*message); + break; + } + case 'o': //compares the first char of "offline" + { + buddyPresInfo->SetAvailabilityL( MPresenceBuddyInfo2::ENotAvailable,*message); + break; + } + case 'a': ////compares the first char of "away" and "available" + { + if ('v' == *(pResponse + 1)) + { + buddyPresInfo->SetAvailabilityL( MPresenceBuddyInfo2::EAvailable,*message); + } + else + { + // EAway - is not available in presence cache + buddyPresInfo->SetAvailabilityL( MPresenceBuddyInfo2::EBusy,*message); + } + break; + } + case 'x': + { + buddyPresInfo->SetAvailabilityL( MPresenceBuddyInfo2::EBusy,KAwayState ); + break; + } + case 'h': + { + buddyPresInfo->SetAvailabilityL( MPresenceBuddyInfo2::EUnknownAvailability,KInvisibleState ); + break; + } + default: + buddyPresInfo->SetAvailabilityL( MPresenceBuddyInfo2::EUnknownAvailability,*message); + break; + } + CleanupStack::PopAndDestroy( message ); + ///////// End getting availability message + + toklength = strlen(pResponse) + 1; // finding length of availability text + '/0' + pResponse += toklength; // skipping availability text + + ///////// Getting status message if exists + if(toklength >1) + { + char* statustext = pResponse; + HBufC16 *statusmessage = OssProtocolAdapUtils::ConvertCharToTUint16LC( statustext ); + buddyPresInfo->SetStatusMessageL(*statusmessage); + CleanupStack::PopAndDestroy( statusmessage ); + } + ///////// End Getting status message + + // Writing into Presence Cache + TInt cacheerror = iPresenceCacheWriter->WritePresenceL(buddyPresInfo); + User::LeaveIfError ( cacheerror); + // End + CleanupStack::PopAndDestroy ( 1 ); //buddyPresInfo + CleanupStack::PopAndDestroy(pOrigResponse) ;//pOrigResponse + LOGGER ( TXT ( "CPresenceNotificationHandler::ProcessIncomingDataL End" ) ); + } + + +// --------------------------------------------------------------------------- +// CPresenceNotificationHandler::RunError +// --------------------------------------------------------------------------- +// +TInt CPresenceNotificationHandler::RunError ( TInt aError ) + { + LOGGER ( TXT ( "CPresenceNotificationHandler::RunError Start %d" ), aError ); + + LOGGER ( TXT ( "CPresenceNotificationHandler::RunError End" ) ); + return KErrNone; + } + +// --------------------------------------------------------------------------- +// CPresenceNotificationHandler::StartListeningL +// --------------------------------------------------------------------------- +// +void CPresenceNotificationHandler::StartListeningL() + { + LOGGER ( TXT ( "CPresenceNotificationHandler::StartListeningL Start" ) ); + + if ( ! ( this->IsActive() ) ) + { + iConnMan.DataHandler().ListenIncomingPresence ( iStatus ); + SetActive(); + } + LOGGER ( TXT ( "CPresenceNotificationHandler::StartListeningL End" ) ); + } + +// End of file diff -r 000000000000 -r e6b17d312c8b imservices/ossprotocoladaptation/src/presencepublishing/cpublishownpresencerequest.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/ossprotocoladaptation/src/presencepublishing/cpublishownpresencerequest.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,488 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: IMplementaion for publising own presence +* +*/ + + +#include +#include "cpublishownpresencerequest.h" +#include "mossprotocolconnectionmanager.h" +#include "ossprotocolpluginlogger.h" +#include "waittimer.h" + +#include "cossprotocolconnectionmanager.h" + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include "stringutils.h" +#include +#include "msgliterals.h" +#include "msg_enums.h" +#include "xmppparameters.h" +#include "waittimer.h" +#include +#include "ossprotocoladaptutils.h" +#include + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// CPublishOwnPresencerequest::CPublishOwnPresencerequest +// --------------------------------------------------------------------------- +// +CPublishOwnPresencerequest::CPublishOwnPresencerequest( + MOSSProtocolConnectionManager& aConnMan, + TXIMPRequestId aRequestId ) : + CActive( EPriorityNormal ), + iRequestId( aRequestId ), + iConnMan( aConnMan ) + { + LOGGER ( TXT("::CPublishOwnPresencerequest Start") ); + CActiveScheduler::Add( this ); + + LOGGER ( TXT("::CPublishOwnPresencerequest End") ); + } + + +// --------------------------------------------------------------------------- +// CPublishOwnPresencerequest::ConstructL +// --------------------------------------------------------------------------- +// +void CPublishOwnPresencerequest::ConstructL() + { + LOGGER ( TXT("CPublishOwnPresencerequest::ConstructL Start-End") ); + + + } + + +// --------------------------------------------------------------------------- +// CPublishOwnPresencerequest::NewL +// --------------------------------------------------------------------------- +// +CPublishOwnPresencerequest* CPublishOwnPresencerequest::NewL( + MOSSProtocolConnectionManager& aConnMan, + TXIMPRequestId aRequestId ) + { + LOGGER ( TXT("CPublishOwnPresencerequest::NewL Start") ); + + CPublishOwnPresencerequest* self = new( ELeave ) + CPublishOwnPresencerequest( aConnMan, aRequestId ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + + LOGGER ( TXT("CPublishOwnPresencerequest::NewL End") ); + return self; + } + + +// --------------------------------------------------------------------------- +// CPublishOwnPresencerequest::NewLC +// --------------------------------------------------------------------------- +// +CPublishOwnPresencerequest* CPublishOwnPresencerequest::NewLC( + MOSSProtocolConnectionManager& aConnMan, + TXIMPRequestId aRequestId ) + { + LOGGER ( TXT("CPublishOwnPresencerequest::NewLC Start") ); + + CPublishOwnPresencerequest* self = + CPublishOwnPresencerequest::NewL(aConnMan, aRequestId); + CleanupStack::PushL( self ); + + LOGGER ( TXT("CPublishOwnPresencerequest::NewLC End") ); + return self; + } + +// --------------------------------------------------------------------------- +// CPublishOwnPresencerequest::~CPublishOwnPresencerequest +// --------------------------------------------------------------------------- +// +CPublishOwnPresencerequest::~CPublishOwnPresencerequest() + { + LOGGER ( TXT("::~CPublishOwnPresencerequest Start") ); + + CActive::Cancel(); + + delete iOwnPresenceInfo; + iOwnPresenceInfo = NULL; + LOGGER ( TXT("::~CPublishOwnPresencerequest End") ); + } + + +// --------------------------------------------------------------------------- +// CPublishOwnPresencerequest::DoCancel() +// --------------------------------------------------------------------------- +// +void CPublishOwnPresencerequest::DoCancel() + { + LOGGER ( TXT("CPublishOwnPresencerequest::DoCancel Start") ); + + // iConnMan.DataHandler().CancelSending( iSendId ); + + LOGGER ( TXT("CPublishOwnPresencerequest::DoCancel End") ); + } + + +// --------------------------------------------------------------------------- +// CPublishOwnPresencerequest::RunL() +// --------------------------------------------------------------------------- +// +void CPublishOwnPresencerequest::RunL() + { + LOGGER ( TXT("CPublishOwnPresencerequest::RunL Start") ); + message_hdr_resp* msg_struct = NULL; + User::LeaveIfError ( iStatus.Int() ); + char* pResponse = NULL; + pResponse = iConnMan.DataHandler().ResponseL ( iSendId ); + + msg_struct = ( message_hdr_resp* )pResponse ; + if( !( msg_struct->response ) ) + { + switch( msg_struct->error_type ) + { + + default: //for all other error codes like ssl related are mapped to general error + iConnMan.HandleToHost().HandleRequestCompleted ( iRequestId, KXIMPErrServiceGeneralError ); + break; + } + } + else + { + if( iOwnPresenceInfo ) + { + // set or clear avatar + MPresenceCacheWriter2* presenceCacheWriter = MPresenceCacheWriter2::CreateWriterL(); + TInt cacheerror = presenceCacheWriter->WritePresenceL( iOwnPresenceInfo ); + User::LeaveIfError ( cacheerror); + delete iOwnPresenceInfo ; + iOwnPresenceInfo = NULL; + delete presenceCacheWriter; + } + iConnMan.HandleToHost().HandleRequestCompleted ( iRequestId, KErrNone ); + } + + free( pResponse ); + + delete this; + + LOGGER ( TXT("CPublishOwnPresencerequest::RunL End") ); + } + + +// --------------------------------------------------------------------------- +// CPublishOwnPresencerequest::RunError +// --------------------------------------------------------------------------- +// +TInt CPublishOwnPresencerequest::RunError( TInt aError ) + { + LOGGER ( TXT("CPublishOwnPresencerequest::RunError Start") ); + + iConnMan.HandleToHost().HandleRequestCompleted( iRequestId, aError ); + + delete this; + LOGGER ( TXT("CPublishOwnPresencerequest::RunError End") ); + return KErrNone; + } + +// --------------------------------------------------------------------------- +// CPublishOwnPresencerequest::PublishOwnPresenceL +// --------------------------------------------------------------------------- +// +void CPublishOwnPresencerequest::PublishOwnPresenceL(const MPresenceInfo& aPresence) + { + LOGGER ( TXT("CPublishOwnPresencerequest::PublishOwnPresenceL Start") ); + char *smsg = NULL; + char *tmpmsg = NULL; + message_hdr_req msgHdr = {0,}; + + int err = 0; + int userLen = 0; + int totalLen = 0; + const MPersonPresenceInfo* personPresence = aPresence.PersonPresence(); + const MPresenceInfoFieldCollection& presenceFields = personPresence->Fields(); + const MPresenceInfoField& presenceField = presenceFields.FieldAt( 0 ); + //updating own avtar + if( !(presenceField.FieldType().Compare( NPresenceInfo::NFieldType::KAvatar )) ) + { + int messagelength = 0; + const MPresenceInfoFieldValueBinary* avtarfield = + TXIMPGetInterface< const MPresenceInfoFieldValueBinary >::From( + presenceField.FieldValue(), + MXIMPBase::EPanicIfUnknown ); + if( !(avtarfield->MimeType().Length() )) //clear avatar + { + // now manufacture the message for the clear avtar + msgHdr.message_type = EClearOwnAvatar; + messagelength = sizeof( message_hdr_req ); + smsg = ( char* ) User::AllocLC ( messagelength ); + memset ( smsg, '\0', messagelength ); + memcpy( smsg, &msgHdr, messagelength );//copies message header + iSendId = iConnMan.DataHandler().SendDataL ( iStatus, smsg, messagelength ); + SetActive();// signal the scheduler + CleanupStack::PopAndDestroy ( 1 ); //smsg + } + else //set or update avatar + { + // now manufacture the message for the avtar + msgHdr.message_type = EUpdateOwnAvtar; + messagelength = sizeof( message_hdr_req ) + avtarfield->MimeType().Length() + avtarfield->BinaryValue().Length()+2; // 2 for '\0' 's + smsg = ( char* ) User::AllocLC ( messagelength ); + tmpmsg = ( char* ) User::AllocLC ( messagelength ); + memset ( smsg, '\0', messagelength ); + memset ( tmpmsg, '\0', messagelength ); + if( messagelength > (MAX_MSG_SIZE - totalLen) ) + msgHdr.continue_flag = 1; + memcpy( smsg, &msgHdr, sizeof( message_hdr_req ) );//copies message header + totalLen += sizeof( message_hdr_req ); + OssProtocolAdapUtils::ConvertTDesC8toChar( avtarfield->MimeType(),tmpmsg); + userLen = avtarfield->MimeType().Length(); + memcpy( smsg + totalLen, tmpmsg, userLen );//copies mimetype + totalLen += userLen + 1; // for '\0' + memset ( tmpmsg, '\0', messagelength ); + OssProtocolAdapUtils::ConvertTDesC8toChar( avtarfield->BinaryValue(),tmpmsg); + userLen = avtarfield->BinaryValue().Length(); + memcpy( smsg + totalLen, tmpmsg, userLen );//copies avtar + totalLen += userLen + 1; + iSendId = iConnMan.DataHandler().SendDataL ( iStatus, smsg, totalLen ); + SetActive();// signal the scheduler + CleanupStack::PopAndDestroy ( 2 ); //tmpmsg,smsg + } + iOwnPresenceInfo = MPresenceBuddyInfo2::NewL(); + if( iOwnPresenceInfo ) + { + TPtrC ownUserPtr = iConnMan.UserName(); + HBufC* xspId = NULL; + if( ownUserPtr.Length() ) + { + xspId = HBufC::NewLC( ownUserPtr.Length() + iConnMan.ServiceName().Length() + KColon().Length() ); + TPtr xspIdPtr( xspId->Des() ); + xspIdPtr.Zero(); + xspIdPtr.Append(iConnMan.ServiceName() ); // prepend service name + xspIdPtr.Append(KColon); + xspIdPtr.Append( ownUserPtr ); + iOwnPresenceInfo->SetIdentityL(xspIdPtr); + CleanupStack::PopAndDestroy(xspId); //xspId + } + else + { + TPtrC xmppOwnId = iConnMan.XmppParams().UserName(); + xspId = HBufC::NewLC( xmppOwnId.Length() + iConnMan.ServiceName().Length() + KColon().Length() ); + TPtr xspIdPtr( xspId->Des() ); + xspIdPtr.Zero(); + xspIdPtr.Append(iConnMan.ServiceName() ); // prepend service name + xspIdPtr.Append(KColon); + xspIdPtr.Append( xmppOwnId ); + iOwnPresenceInfo->SetIdentityL(xspIdPtr); + CleanupStack::PopAndDestroy(xspId); //xspId + } + iOwnPresenceInfo->SetAvatarL( avtarfield->BinaryValue() ); + + TInt fieldCount = presenceFields.FieldCount(); + for( TInt i = 1; i < fieldCount; i++ ) // zero index is for avatar + { + const MPresenceInfoField& presenceField = presenceFields.FieldAt( i ); + TBuf8<32> temp = presenceField.FieldType(); + if( !( presenceField.FieldType().Compare( NPresenceInfo::NFieldType::KAvailabilityEnum )) ) + { + const MPresenceInfoFieldValueEnum* availability = + TXIMPGetInterface< const MPresenceInfoFieldValueEnum >::From( + presenceField.FieldValue(), + MXIMPBase::EPanicIfUnknown ); + MPresenceBuddyInfo2::TAvailabilityValues availabe = MPresenceBuddyInfo2::EUnknownAvailability; + switch (availability->Value()) + { + case NPresenceInfo::EAvailable : + { + availabe = MPresenceBuddyInfo2::EAvailable; + iOwnPresenceInfo->SetAvailabilityL( availabe ,KNullDesC ); + break; + } + + case NPresenceInfo::EBusy : + { + availabe = MPresenceBuddyInfo2::EBusy; + iOwnPresenceInfo->SetAvailabilityL( availabe ,KNullDesC ); + break; + } + + case NPresenceInfo::EHidden : + { + availabe = MPresenceBuddyInfo2::EAvailable; + iOwnPresenceInfo->SetAvailabilityL( availabe ,KNullDesC ); + break; + } + + case NPresenceInfo::EDoNotDisturb: + { + availabe = MPresenceBuddyInfo2::EBusy; + iOwnPresenceInfo->SetAvailabilityL( availabe,KDndState); + break; + } + + case NPresenceInfo::EAway: + { + availabe = MPresenceBuddyInfo2::EBusy; + iOwnPresenceInfo->SetAvailabilityL( availabe,KAwayState); + break; + } + + case NPresenceInfo::ENotAvailable: + { + availabe = MPresenceBuddyInfo2::ENotAvailable; + iOwnPresenceInfo->SetAvailabilityL( availabe ,KNullDesC ); + break; + } + + default: + break; + } + } + else if( !(presenceField.FieldType().Compare( NPresenceInfo::NFieldType::KStatusMessage )) ) + { + const MPresenceInfoFieldValueText* statustext = + TXIMPGetInterface< const MPresenceInfoFieldValueText >::From( + presenceField.FieldValue(), + MXIMPBase::EPanicIfUnknown ); + // now manufacture the message for the status text + if( statustext && statustext->TextValue().Length() ) + { + iOwnPresenceInfo->SetStatusMessageL( statustext->TextValue() ); + } + + } + } + + } + } + else //for update presence + { + TInt fieldCount = presenceFields.FieldCount(); + char* availablty = ( char* ) User::AllocLC ( MAX_MSG_SIZE ); + smsg = ( char* ) User::AllocLC ( MAX_MSG_SIZE ); + tmpmsg = ( char* ) User::AllocLC ( MAX_MSG_SIZE ); + msgHdr.message_type = EUpdateOwnPresence; + memset ( smsg, '\0', MAX_MSG_SIZE ); + memset ( tmpmsg, '\0', MAX_MSG_SIZE ); + memset ( availablty, '\0', MAX_MSG_SIZE ); + memcpy( smsg, &msgHdr, sizeof( message_hdr_req ) ); + totalLen += sizeof( message_hdr_req ); + // updating availability + const MPersonPresenceInfo* personPresence = aPresence.PersonPresence(); + const MPresenceInfoFieldCollection& presenceFields = personPresence->Fields(); + //TInt fieldCount = presenceFields.FieldCount(); + for( TInt i = 0; i < fieldCount; i++ ) + { + const MPresenceInfoField& presenceField = presenceFields.FieldAt( i ); + TBuf8<32> temp = presenceField.FieldType(); + LOGGER ( TXT( "ExtractPersonPresenceAttributes:%S "),&presenceField.FieldType()); + + if( !( presenceField.FieldType().Compare( NPresenceInfo::NFieldType::KAvailabilityEnum )) ) + { + const MPresenceInfoFieldValueEnum* availability = + TXIMPGetInterface< const MPresenceInfoFieldValueEnum >::From( + presenceField.FieldValue(), + MXIMPBase::EPanicIfUnknown ); + if ( availability->Value() == NPresenceInfo::EAvailable ) + { + char* temp = "avaliable"; + strcpy(availablty,temp); + userLen = strlen( availablty ); + memcpy( smsg + totalLen, availablty, userLen ); + totalLen += userLen + 1; + } + else if ( availability->Value() == NPresenceInfo::EBusy ) + { + char* temp = "dnd"; + strcpy(availablty,temp); + userLen = strlen( availablty ); + memcpy( smsg + totalLen, availablty, userLen ); + totalLen += userLen + 1; + } + else if(availability->Value() == NPresenceInfo::EAway) + { + char* temp = "away"; + strcpy(availablty,temp); + userLen = strlen( availablty ); + memcpy( smsg + totalLen, availablty, userLen ); + totalLen += userLen + 1; + } + else if(availability->Value() == NPresenceInfo::EHidden) + { + char* temp = "hidden"; + strcpy(availablty,temp); + userLen = strlen( availablty ); + memcpy( smsg + totalLen, availablty, userLen ); + totalLen += userLen + 1; + } + else if(availability->Value() == NPresenceInfo::ENotAvailable) + { + char* temp = "offline"; + strcpy(availablty,temp); + userLen = strlen( availablty ); + memcpy( smsg + totalLen, availablty, userLen ); + totalLen += userLen + 1; + } + + } + //updating status text + + if( !(presenceField.FieldType().Compare( NPresenceInfo::NFieldType::KStatusMessage )) ) + { + const MPresenceInfoFieldValueText* statustext = + TXIMPGetInterface< const MPresenceInfoFieldValueText >::From( + presenceField.FieldValue(), + MXIMPBase::EPanicIfUnknown ); + // now manufacture the message for the status text + if( statustext && statustext->TextValue().Length() ) + { + TPtrC bufferPtr ( statustext->TextValue() ); + err = tbufC16tochar ( bufferPtr, tmpmsg ); + if( KErrNotFound == err) + { + iConnMan.HandleToHost().HandleRequestCompleted ( iRequestId, err ); + } + userLen = strlen ( tmpmsg ) + 1; //for '\0' + } + memcpy( smsg + totalLen, tmpmsg, userLen ); + totalLen += userLen + 1; + } + } + iSendId = iConnMan.DataHandler().SendDataL ( iStatus, smsg, totalLen ); + SetActive();// signal the scheduler + CleanupStack::PopAndDestroy ( 3 ); //tmpmsg,smsg,availability + } + LOGGER ( TXT("CPublishOwnPresencerequest::PublishOwnPresenceL End") ); + } + + +// End of file diff -r 000000000000 -r e6b17d312c8b imservices/ossprotocoladaptation/src/presentitygroups/caddcontactnotificationhandler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/ossprotocoladaptation/src/presentitygroups/caddcontactnotificationhandler.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,256 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Add notification handler +* +*/ + + +#include +#include "caddcontactenotificationhandler.h" + +#include "mossprotocolconnectionmanager.h" +#include "ossprotocolpluginlogger.h" +#include "waittimer.h" +#include "cossprotocolconnectionmanager.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "msgliterals.h" + +#include "ossprotocoladaptationuids.h" +#include "ossprotocoladaptutils.h" + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// CAddContactNotificationHandler::CAddContactNotificationHandler +// --------------------------------------------------------------------------- +// +CAddContactNotificationHandler::CAddContactNotificationHandler ( + MOSSProtocolConnectionManager& aConnMan ) : + CActive ( EPriorityNormal ), + iConnMan ( aConnMan ) + { + LOGGER ( TXT ( "CAddContactNotificationHandler::CAddContactNotificationHandler Start" ) ); + CActiveScheduler::Add ( this ); + + LOGGER ( TXT ( "CAddContactNotificationHandler::CAddContactNotificationHandler End" ) ); + } + + +// --------------------------------------------------------------------------- +// CAddContactNotificationHandler::ConstructL +// --------------------------------------------------------------------------- +// +void CAddContactNotificationHandler::ConstructL() + { + LOGGER ( TXT ( "CAddContactNotificationHandler::ConstructL Start-End" ) ); + + } + + +// --------------------------------------------------------------------------- +// CAddContactNotificationHandler::NewL +// --------------------------------------------------------------------------- +// +CAddContactNotificationHandler* CAddContactNotificationHandler::NewL ( + MOSSProtocolConnectionManager& aConnMan ) + { + LOGGER ( TXT ( "CAddContactNotificationHandler::NewL Start" ) ); + + CAddContactNotificationHandler* self = new ( ELeave ) CAddContactNotificationHandler ( aConnMan ); + CleanupStack::PushL ( self ); + self->ConstructL(); + CleanupStack::Pop ( self ); + + LOGGER ( TXT ( "CAddContactNotificationHandler::NewL End" ) ); + return self; + } + + +// --------------------------------------------------------------------------- +// CAddContactNotificationHandler::NewLC +// --------------------------------------------------------------------------- +// +CAddContactNotificationHandler* CAddContactNotificationHandler::NewLC ( + MOSSProtocolConnectionManager& aConnMan ) + { + LOGGER ( TXT ( "CAddContactNotificationHandler::NewLC Start" ) ); + + CAddContactNotificationHandler* self = CAddContactNotificationHandler::NewL ( aConnMan ); + CleanupStack::PushL ( self ); + + LOGGER ( TXT ( "CAddContactNotificationHandler::NewLC End" ) ); + return self; + } + +// --------------------------------------------------------------------------- +// CAddContactNotificationHandler::~CAddContactNotificationHandler +// --------------------------------------------------------------------------- +// +CAddContactNotificationHandler::~CAddContactNotificationHandler() + { + LOGGER ( TXT ( "::~CAddContactNotificationHandler Start" ) ); + + Cancel(); + + LOGGER ( TXT ( "::~CAddContactNotificationHandler End" ) ); + } + + +// --------------------------------------------------------------------------- +// CAddContactNotificationHandler::DoCancel() +// --------------------------------------------------------------------------- +// +void CAddContactNotificationHandler::DoCancel() + { + LOGGER ( TXT ( "CAddContactNotificationHandler::DoCancel Start" ) ); + + iConnMan.DataHandler().CancelListeningAddNotication(); + + LOGGER ( TXT ( "CAddContactNotificationHandler::DoCancel End" ) ); + } + +// --------------------------------------------------------------------------- +// CAddContactNotificationHandler::RunL() +// --------------------------------------------------------------------------- +// +void CAddContactNotificationHandler::RunL() + { + LOGGER ( TXT ( "CAddContactNotificationHandler::RunL Start" ) ); + + // something is coming from the xmpp server + User::LeaveIfError ( iStatus.Int() ); + + ProcessIncomingDataL(); + StartListeningL(); + + LOGGER ( TXT ( "CAddContactNotificationHandler::RunL End" ) ); + } + +// --------------------------------------------------------------------------- +// CAddContactNotificationHandler::ProcessIncomingDataL() +// --------------------------------------------------------------------------- +/* This Function is used to convert the received +* presence notification from Isolation Server Message queue +* into the ximpfw data types. and storing the presence information +* in to the presence cache ( available in ximpfw ) +* client has to read the presence information from the +* presence cache. when the change in status notification is received +* while updating presence cache, client will receive the notification if subscribed. +*/ +void CAddContactNotificationHandler::ProcessIncomingDataL() + { + LOGGER ( TXT ( "CAddContactNotificationHandler::ProcessIncomingDataL Start" ) ); + char* pResponse = NULL, *pOrigResponse = NULL; + TInt len = 0; + pOrigResponse = pResponse = iConnMan.DataHandler().ResponseL ( 4 ); + CleanupStack::PushL(pOrigResponse) ; + RPointerArray& invitations = iConnMan.GetContactManager().GetInvitationListL(); + if( pResponse ) + { + pResponse += sizeof ( message_hdr_resp ); + while(1) + { + len = strlen(pResponse) + 1; + if (1 == len) + { + break; + } + HBufC16* AuthreqId = OssProtocolAdapUtils::ConvertCharToTUint16LC( pResponse ); + pResponse += len; + TInt len1 = AuthreqId->Length(); + MXIMPObjectFactory& ObjFact = iConnMan.HandleToHost().ObjectFactory(); + MPresenceObjectFactory& prfwObjFact = iConnMan.HandleToHost().ProtocolPresenceDataHost().PresenceObjectFactory(); + + invitations.AppendL( AuthreqId ); + MPresenceGrantRequestInfo* presenceGrant; + presenceGrant = prfwObjFact.NewPresenceGrantRequestInfoLC();//1 + MXIMPIdentity* AuthReqIdentity; + AuthReqIdentity = ObjFact.NewIdentityLC();//2 + AuthReqIdentity->SetIdentityL(*AuthreqId); + AuthreqId->Des().Fold(); + presenceGrant->SetRequestorIdL(AuthReqIdentity); + iConnMan.HandleToHost().ProtocolPresenceDataHost().AuthorizationDataHost().HandlePresenceGrantRequestReceivedL (presenceGrant); + TInt count = iConnMan.PresenceAuthGrantReqList()->Count(); + iConnMan.PresenceAuthGrantReqList()->Append(*AuthreqId); + count = iConnMan.PresenceAuthGrantReqList()->Count(); + CleanupStack::Pop(2); //AuthReqIdentity,presenceGrant + CleanupStack::Pop ( 1 );//AuthreqId + } + } + CleanupStack::PopAndDestroy ( 1 );//pOrigResponse + LOGGER ( TXT ( "CAddContactNotificationHandler::ProcessIncomingDataL End" ) ); + } + + +// --------------------------------------------------------------------------- +// CAddContactNotificationHandler::RunError +// --------------------------------------------------------------------------- +// +TInt CAddContactNotificationHandler::RunError ( TInt aError ) + { + LOGGER ( TXT ( "CAddContactNotificationHandler::RunError Start %d" ), aError ); + + LOGGER ( TXT ( "CAddContactNotificationHandler::RunError End" ) ); + return KErrNone; + } + +// --------------------------------------------------------------------------- +// CAddContactNotificationHandler::StartListeningL +// --------------------------------------------------------------------------- +// +void CAddContactNotificationHandler::StartListeningL() + { + LOGGER ( TXT ( "CAddContactNotificationHandler::StartListeningL Start" ) ); + + if ( ! ( this->IsActive() ) ) + { + iConnMan.DataHandler().ListenAddNotification ( iStatus ); + SetActive(); + } + LOGGER ( TXT ( "CAddContactNotificationHandler::StartListeningL End" ) ); + } + +// End of file diff -r 000000000000 -r e6b17d312c8b imservices/ossprotocoladaptation/src/presentitygroups/caddpresentitygroupmemberrequest.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/ossprotocoladaptation/src/presentitygroups/caddpresentitygroupmemberrequest.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,259 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Add Presentity Group Member Request to the Network Server. +* +*/ + + +#include +#include "caddpresentitygroupmemberrequest.h" +#include "cossprotocolconnectionmanager.h" +#include "ossprotocolpluginlogger.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include "stringutils.h" +#include +#include +#include +#include +#include "msgliterals.h" +#include "msg_enums.h" +#include "ossprotocoladaptutils.h" +#include + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// CAddPresentityGroupMemberRequest::CAddPresentityGroupMemberRequest +// --------------------------------------------------------------------------- +// +CAddPresentityGroupMemberRequest::CAddPresentityGroupMemberRequest( + MOSSProtocolConnectionManager& aConnMan, + TXIMPRequestId aRequestId ) : + CActive( EPriorityNormal ), + iRequestId( aRequestId ), + iConnMan( aConnMan ) + { + LOGGER ( TXT("::CAddPresentityGroupMemberRequest Start") ); + CActiveScheduler::Add( this ); + + LOGGER ( TXT("::CAddPresentityGroupMemberRequest End") ); + } + + +// --------------------------------------------------------------------------- +// CAddPresentityGroupMemberRequest::ConstructL +// --------------------------------------------------------------------------- +// +void CAddPresentityGroupMemberRequest::ConstructL() + { + + LOGGER ( TXT("CAddPresentityGroupMemberRequest::ConstructL Start-End") ); + iContactId = NULL; + } + + + + + +// --------------------------------------------------------------------------- +// CAddPresentityGroupMemberRequest::NewLC +// --------------------------------------------------------------------------- +// +CAddPresentityGroupMemberRequest* CAddPresentityGroupMemberRequest::NewLC( + MOSSProtocolConnectionManager& aConnMan, + TXIMPRequestId aRequestId ) + { + LOGGER ( TXT("CAddPresentityGroupMemberRequest::NewLC Start") ); + + CAddPresentityGroupMemberRequest* self = new( ELeave ) + CAddPresentityGroupMemberRequest( aConnMan, aRequestId ); + CleanupStack::PushL( self ); + self->ConstructL(); + + LOGGER ( TXT("CAddPresentityGroupMemberRequest::NewLC End") ); + return self; + } + +// --------------------------------------------------------------------------- +// CAddPresentityGroupMemberRequest::~CAddPresentityGroupMemberRequest +// --------------------------------------------------------------------------- +// +CAddPresentityGroupMemberRequest::~CAddPresentityGroupMemberRequest() + { + LOGGER ( TXT("::~CAddPresentityGroupMemberRequest Start") ); + + CActive::Cancel(); + if(iContactId) + { + delete iContactId; + } + LOGGER ( TXT("::~CAddPresentityGroupMemberRequest End") ); + } + + +// --------------------------------------------------------------------------- +// CAddPresentityGroupMemberRequest::DoCancel() +// --------------------------------------------------------------------------- +// +void CAddPresentityGroupMemberRequest::DoCancel() + { + LOGGER ( TXT("CAddPresentityGroupMemberRequest::DoCancel Start") ); + + LOGGER ( TXT("CAddPresentityGroupMemberRequest::DoCancel End") ); + } + + +// --------------------------------------------------------------------------- +// CAddPresentityGroupMemberRequest::RunL() +// --------------------------------------------------------------------------- +// +void CAddPresentityGroupMemberRequest::RunL() + { + LOGGER ( TXT("CAddPresentityGroupMemberRequest::RunL Start") ); + message_hdr_resp* msg_struct = NULL; + char* pResponse = NULL; + User::LeaveIfError( iStatus.Int() ); + + pResponse = iConnMan.DataHandler().ResponseL ( iSendId ); + + msg_struct = ( message_hdr_resp* )pResponse ; + if( !( msg_struct->response ) ) + { + switch( msg_struct->error_type ) + { + + default: //for all other error codes like ssl related are mapped to general error + iConnMan.HandleToHost().HandleRequestCompleted ( iRequestId, KXIMPErrServiceGeneralError ); + break; + } + } + else + { + //set presence as pending for the added contact + MPresenceBuddyInfo2* buddyPresInfo = MPresenceBuddyInfo2::NewLC(); + + MPresenceCacheWriter2* presenceCacheWriter = MPresenceCacheWriter2::CreateWriterL(); + CleanupDeletePushL(presenceCacheWriter); + HBufC* name = HBufC::NewLC( iContactId->Length() + iConnMan.ServiceName().Length() + KColon().Length() ); + TPtr namePtr( name->Des() ); + namePtr.Zero(); + namePtr.Append(iConnMan.ServiceName() ); // prepend service name + namePtr.Append(KColon); + namePtr.Append(iContactId->Des() ); + buddyPresInfo->SetIdentityL(namePtr); + LOGGER ( TXT ( "CPresenceNotificationHandler::ProcessIncomingDataL :ContactName:%S " ), iContactId ); + + buddyPresInfo->SetAnyFieldL(KExtensionKey,KPendingRequestExtensionValue()); + CleanupStack::PopAndDestroy(1);//name + + // Writing into Presence Cache + TInt cacheerror = presenceCacheWriter->WritePresenceL(buddyPresInfo); + User::LeaveIfError ( cacheerror); + CleanupStack::PopAndDestroy(2);//presenceCacheWriter,buddyPresInfo + + iConnMan.HandleToHost().HandleRequestCompleted ( iRequestId, KErrNone ); + } + free( pResponse ); + delete this; + LOGGER ( TXT("CAddPresentityGroupMemberRequest::RunL End") ); + } + + +// --------------------------------------------------------------------------- +// CAddPresentityGroupMemberRequest::RunError +// --------------------------------------------------------------------------- +// +TInt CAddPresentityGroupMemberRequest::RunError( TInt aError ) + { + LOGGER ( TXT("CAddPresentityGroupMemberRequest::RunError Start") ); + + iConnMan.HandleToHost().HandleRequestCompleted( iRequestId, aError ); + delete this; + + LOGGER ( TXT("CAddPresentityGroupMemberRequest::RunError End") ); + return KErrNone; + } + +// --------------------------------------------------------------------------- +// CAddPresentityGroupMemberRequest::AddPresentityGroupMemberL +// --------------------------------------------------------------------------- +// +void CAddPresentityGroupMemberRequest::AddPresentityGroupMemberL( + const MXIMPIdentity& /*aGroupId*/, + const MXIMPIdentity& aMemberId, + const TDesC16& aMemberDisplayName) + { + LOGGER ( TXT("CAddPresentityGroupMemberRequest::AddPresentityGroupMemberL Start") ); + if(iContactId) + { + delete iContactId; + iContactId = NULL; + } + iContactId = aMemberId.Identity().AllocL(); + char *smsg = NULL; + int totalLen = 0; + message_hdr_req msgHdr = {0,}; + msgHdr.message_type = EAdd_Contact_Request; + + TInt headerLength = sizeof( message_hdr_req ); + totalLen += headerLength; + + // adding add contact + charFormatData memberIdentityData = OssProtocolAdapUtils::ConvertTUint16ToCharLC( aMemberId.Identity() ); + char* memberIdentity = memberIdentityData.data; + TInt memberIdLength = memberIdentityData.dataSize; + totalLen += memberIdLength; + + charFormatData displayNameData = OssProtocolAdapUtils::ConvertTUint16ToCharLC( aMemberDisplayName ); + char* displayName = displayNameData.data; + TInt displayNameLength = displayNameData.dataSize; + totalLen += displayNameLength; + + if ( totalLen > MAX_MSG_SIZE ) + { + User::Leave(KErrArgument); + } + + //after getting size now allocate memory. + smsg = ( char* ) User::AllocLC(totalLen); + memset ( smsg, '\0', totalLen ); + + memcpy( smsg, &msgHdr, sizeof( message_hdr_req ) ); //header + memcpy( smsg + headerLength , memberIdentity , memberIdLength ); //id + memcpy( smsg + headerLength + memberIdLength + 1 , displayName , displayNameLength ); //display name + + iSendId = iConnMan.DataHandler().SendDataL ( iStatus, smsg, totalLen ); + + // signal the scheduler + SetActive(); + + CleanupStack::PopAndDestroy ( 3 );//smsg, memberIdentity, displayName. + + LOGGER ( TXT("CAddPresentityGroupMemberRequest::AddPresentityGroupMemberL End") ); + } + + +// End of file diff -r 000000000000 -r e6b17d312c8b imservices/ossprotocoladaptation/src/presentitygroups/ccontactsynchandler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/ossprotocoladaptation/src/presentitygroups/ccontactsynchandler.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,212 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: handles synchronisation of contacts +* +*/ + + +#include + +#include +#include +#include +#include +#include +#include +#include + +#include + +#include + +#include +#include +#include +#include +#include +#include "msgliterals.h" + +#include "ccontactsynchandler.h" + +#include "mossprotocolconnectionmanager.h" +#include "ossprotocolpluginlogger.h" +#include "waittimer.h" +#include "cossprotocolconnectionmanager.h" +#include "ossprotocoladaptationuids.h" +#include "ossprotocoladaptutils.h" + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// CContactSyncHandler::CContactSyncHandler +// --------------------------------------------------------------------------- +// +CContactSyncHandler::CContactSyncHandler ( + MOSSProtocolConnectionManager& aConnMan ) : + CActive ( EPriorityNormal ), + iConnMan ( aConnMan ) + { + LOGGER ( TXT ( "CContactSyncHandler::CContactSyncHandler Start" ) ); + CActiveScheduler::Add ( this ); + + LOGGER ( TXT ( "CContactSyncHandler::CContactSyncHandler End" ) ); + } + + +// --------------------------------------------------------------------------- +// CContactSyncHandler::NewL +// --------------------------------------------------------------------------- +// +CContactSyncHandler* CContactSyncHandler::NewL ( + MOSSProtocolConnectionManager& aConnMan ) + { + LOGGER ( TXT ( "CContactSyncHandler::NewL Start" ) ); + + CContactSyncHandler* self = new ( ELeave ) CContactSyncHandler ( aConnMan ); + + LOGGER ( TXT ( "CContactSyncHandler::NewL End" ) ); + return self; + } + + +// --------------------------------------------------------------------------- +// CContactSyncHandler::~CContactSyncHandler +// --------------------------------------------------------------------------- +// +CContactSyncHandler::~CContactSyncHandler() + { + LOGGER ( TXT ( "::~CContactSyncHandler Start" ) ); + + Cancel(); + + LOGGER ( TXT ( "::~CContactSyncHandler End" ) ); + } + + +// --------------------------------------------------------------------------- +// CContactSyncHandler::DoCancel() +// --------------------------------------------------------------------------- +// +void CContactSyncHandler::DoCancel() + { + LOGGER ( TXT ( "CContactSyncHandler::DoCancel Start" ) ); + + iConnMan.DataHandler().CancelContactsChangeListening(); + + LOGGER ( TXT ( "CContactSyncHandler::DoCancel End" ) ); + } + +// --------------------------------------------------------------------------- +// CContactSyncHandler::RunL() +// --------------------------------------------------------------------------- +// +void CContactSyncHandler::RunL() + { + LOGGER ( TXT ( "CContactSyncHandler::RunL Start" ) ); + + // something is coming from the xmpp server + User::LeaveIfError ( iStatus.Int() ); + + ProcessAndSendL(); + StartListening(); + + LOGGER ( TXT ( "CContactSyncHandler::RunL End" ) ); + } + +// --------------------------------------------------------------------------- +// CContactSyncHandler::ProcessAndSendL() +// --------------------------------------------------------------------------- + +void CContactSyncHandler::ProcessAndSendL() + { + LOGGER ( TXT ( "CContactSyncHandler::ProcessIncomingDataL Start" ) ); + char* pResponse = NULL, *pOrigResponse = NULL; + message_hdr_resp* msg_struct = NULL; + + while( iConnMan.DataHandler().ContactsChangeResponseCount() ) // process all responses + { + pOrigResponse = pResponse = iConnMan.DataHandler().ResponseL (200 ); + CleanupStack::PushL(pOrigResponse) ; + + msg_struct = ( message_hdr_resp* )pResponse; + + char* contact= pResponse + sizeof ( message_hdr_resp ); + HBufC16* contactName = OssProtocolAdapUtils::ConvertCharToTUint16LC( contact ); + switch ( msg_struct->hdr_req.message_type ) + { + case ESubscribe_Remote_Pending: + { + break; + } + case ETrying_To_Add_Contact_Known: + { + iConnMan.GetContactManager().AddContactToLocalL(*contactName); + iConnMan.GetContactManager().RemoveInvitationFromLocalL(*contactName); + break; + } + case ESubscribe_RP_Accepted: + { + break; + } + case EPublish_RP_Accepted: + { + break; + } + case ESubscribe_Removed_Or_Rejected: + { + //removing from the local copy of the contacts + iConnMan.GetContactManager().RemoveContactFromLocalL(*contactName); + break; + } + case EPublish_Removed_Or_Rejected: + { + iConnMan.GetContactManager().RemoveInvitationFromLocalL(*contactName); + break; + } + } + CleanupStack::PopAndDestroy ( 2 );//pOrigResponse, contactName + } + LOGGER ( TXT ( "CContactSyncHandler::ProcessIncomingDataL End" ) ); + } + + +// --------------------------------------------------------------------------- +// CContactSyncHandler::RunError +// --------------------------------------------------------------------------- +// +TInt CContactSyncHandler::RunError ( TInt aError ) + { + LOGGER ( TXT ( "CContactSyncHandler::RunError Start %d" ), aError ); + + LOGGER ( TXT ( "CContactSyncHandler::RunError End" ) ); + return KErrNone; + } + +// --------------------------------------------------------------------------- +// CContactSyncHandler::StartListeningL +// --------------------------------------------------------------------------- +// +void CContactSyncHandler::StartListening() + { + LOGGER ( TXT ( "CContactSyncHandler::StartListeningL Start" ) ); + + if ( ! ( this->IsActive() ) ) + { + iConnMan.DataHandler().ListenContactsChange( iStatus ); + SetActive(); + } + LOGGER ( TXT ( "CContactSyncHandler::StartListeningL End" ) ); + } + +// End of file diff -r 000000000000 -r e6b17d312c8b imservices/ossprotocoladaptation/src/presentitygroups/cossprotocolpresentitygroups.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/ossprotocoladaptation/src/presentitygroups/cossprotocolpresentitygroups.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,334 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Oss protocol presentity groups implementation +* +*/ + +#include +#include +#include +#include "cossprotocolpresentitygroups.h" +#include "csubscribepresentitygroupcontentrequest.h" + +#include "cossprotocolconnectionmanager.h" +#include "mossprotocolconnectionmanager.h" +#include "ossprotocolpluginlogger.h" +#include "ossprotocolpluginpanics.h" +#include "ossprotocolpluginlogger.h" +#include "caddpresentitygroupmemberrequest.h" // add conatct request +#include "cremovepresentitygroupmemberrequest.h" // remove contact req. +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// COSSProtocolpresentitygroups::GetInterface() +// --------------------------------------------------------------------------- +// +TAny* COSSProtocolpresentitygroups::GetInterface ( TInt32 aInterfaceId, + TIfGetOps aOptions ) + { + LOGGER ( TXT ( "COSSProtocolpresentitygroups::GetInterface() Start" ) ); + + if ( aInterfaceId == MProtocolPresentityGroups::KInterfaceId ) + { + MProtocolPresentityGroups* self = this; + return self; + } + + if ( aOptions == MXIMPBase::EPanicIfUnknown ) + + { + User::Panic ( KOSSProtocolPresentityGroups, KErrExtensionNotSupported ); + } + + LOGGER ( TXT ( "COSSProtocolpresentitygroups::GetInterface() End" ) ); + + return NULL; + } + + +// --------------------------------------------------------------------------- +// COSSProtocolpresentitygroups::GetInterface() +// --------------------------------------------------------------------------- +// +const TAny* COSSProtocolpresentitygroups::GetInterface ( TInt32 aInterfaceId, + TIfGetOps aOptions ) const + { + LOGGER ( TXT ( "COSSProtocolpresentitygroups::GetInterface() Start" ) ); + + if ( aInterfaceId == MProtocolPresentityGroups::KInterfaceId ) + { + const MProtocolPresentityGroups* self = this; + return self; + } + + if ( aOptions == MXIMPBase::EPanicIfUnknown ) + + { + User::Panic ( KOSSProtocolPresentityGroups, KErrExtensionNotSupported ); + } + + LOGGER ( TXT ( "COSSProtocolpresentitygroups::GetInterface() End" ) ); + + return NULL; + } + + +// --------------------------------------------------------------------------- +// COSSProtocolpresentitygroups::GetInterfaceId() +// --------------------------------------------------------------------------- +// +TInt32 COSSProtocolpresentitygroups::GetInterfaceId() const + { + LOGGER ( TXT ( "COSSProtocolpresentitygroups::GetInterfaceId() Start-End" ) ); + return MProtocolPresentityGroups::KInterfaceId; + } + + +// --------------------------------------------------------------------------- +// COSSProtocolpresentitygroups::COSSProtocolpresentitygroups() +// --------------------------------------------------------------------------- +// +COSSProtocolpresentitygroups::COSSProtocolpresentitygroups ( + MOSSProtocolConnectionManager& aConnMan ) + : iConnMan ( aConnMan ) + { + LOGGER ( TXT ( "Groups::COSSProtocolpresentitygroups() Start-End" ) ); + } + + +// --------------------------------------------------------------------------- +// COSSProtocolpresentitygroups::ConstructL() +// --------------------------------------------------------------------------- +// +void COSSProtocolpresentitygroups::ConstructL() + { + LOGGER ( TXT ( "COSSProtocolpresentitygroups::ConstructL() Start" ) ); + LOGGER ( TXT ( "COSSProtocolpresentitygroups::ConstructL() End" ) ); + } + + +// --------------------------------------------------------------------------- +// COSSProtocolpresentitygroups::NewL() +// --------------------------------------------------------------------------- +// +COSSProtocolpresentitygroups* COSSProtocolpresentitygroups::NewL ( + MOSSProtocolConnectionManager& aConnMan ) + { + LOGGER ( TXT ( "COSSProtocolpresentitygroups::NewL() Start" ) ); + + COSSProtocolpresentitygroups* self = + new ( ELeave ) COSSProtocolpresentitygroups ( aConnMan ); + CleanupStack::PushL ( self ); + self->ConstructL( ); + CleanupStack::Pop ( self ); + + LOGGER ( TXT ( "COSSProtocolpresentitygroups::NewL() End" ) ); + return self; + } + + +// --------------------------------------------------------------------------- +// COSSProtocolpresentitygroups::~COSSProtocolpresentitygroups() +// --------------------------------------------------------------------------- +// +COSSProtocolpresentitygroups::~COSSProtocolpresentitygroups() + { + LOGGER ( TXT ( "Groups::~COSSProtocolpresentitygroups() Start" ) ); + + + LOGGER ( TXT ( "Groups::~COSSProtocolpresentitygroups() End" ) ); + } + + + +// --------------------------------------------------------------------------- +// COSSProtocolpresentitygroups::DoSubscribePresentityGroupListL() +// --------------------------------------------------------------------------- +// +void COSSProtocolpresentitygroups::DoSubscribePresentityGroupListL ( + TXIMPRequestId /*aReqId */) + { + // not supported + } + + +// --------------------------------------------------------------------------- +// COSSProtocolpresentitygroups::DoUnsubscribePresentityGroupListL() +// --------------------------------------------------------------------------- +// +void COSSProtocolpresentitygroups::DoUnsubscribePresentityGroupListL ( + TXIMPRequestId /*aReqId*/ ) + { + //not supported + } + + +// --------------------------------------------------------------------------- +// COSSProtocolpresentitygroups::DoCreatePresentityGroupL() +// --------------------------------------------------------------------------- +// +void COSSProtocolpresentitygroups::DoCreatePresentityGroupL ( + const MXIMPIdentity& /*aIdentity*/, + const TDesC16& /*aDisplayName*/, + TXIMPRequestId /*aReqId*/ ) + { + LOGGER ( TXT ( "Groups::DoCreatePresentityGroupL() Start" ) ); + //not supported + + LOGGER ( TXT ( "Groups::DoCreatePresentityGroupL() End" ) ); + } + +// --------------------------------------------------------------------------- +// COSSProtocolpresentitygroups::DoDeletePresentityGroupL() +// --------------------------------------------------------------------------- +// +void COSSProtocolpresentitygroups::DoDeletePresentityGroupL ( + const MXIMPIdentity& /*Identity*/, + TXIMPRequestId /*aReqId*/ ) + { + LOGGER ( TXT ( "Groups::DoDeletePresentityGroupL() Start" ) ); + //not supported + + LOGGER ( TXT ( "Groups::DoDeletePresentityGroupL() End" ) ); + } + +// --------------------------------------------------------------------------- +// COSSProtocolpresentitygroups::DoUpdatePresentityGroupDisplayNameL() +// --------------------------------------------------------------------------- +// +void COSSProtocolpresentitygroups::DoUpdatePresentityGroupDisplayNameL ( + const MXIMPIdentity& /*aIdentity*/, + const TDesC16& /*aDisplayName*/, + TXIMPRequestId /*aReqId*/ ) + { + LOGGER ( TXT ( "Groups::DoUpdatePresentityGroupDisplayNameL() Start" ) ); + + LOGGER ( TXT ( "Groups::DoUpdatePresentityGroupDisplayNameL() End" ) ); + } + +// --------------------------------------------------------------------------- +// COSSProtocolpresentitygroups::DoSubscribePresentityGroupContentL() +// --------------------------------------------------------------------------- +// +void COSSProtocolpresentitygroups::DoSubscribePresentityGroupContentL ( + const MXIMPIdentity& aGroupId, + TXIMPRequestId aReqId ) + { + + LOGGER ( TXT ( "Groups::DoSubscribePresentityGroupContentL() Start" ) ); + if( ! iConnMan.GetContactManager().IsFetchContactsFirstTime()) + { + iConnMan.GetContactManager().SetFetchContactsFirstTime(ETrue); + CreateDataHandlerL(); + CSubscribePresentityGroupContentRequest* req = + CSubscribePresentityGroupContentRequest::NewLC ( iConnMan, aReqId ); + req->SubscribePresentityGroupContentL ( aGroupId ); + CleanupStack::Pop ( req ); + } + //keep a locol copy of the contacts and return to ximp fw + else + { + iConnMan.GetContactManager().ReturnContactsListL(); + iConnMan.HandleToHost().HandleRequestCompleted ( aReqId, KErrNone ); + } + LOGGER ( TXT ( "Groups::DoSubscribePresentityGroupContentL() End" ) ); + } + +// --------------------------------------------------------------------------- +// COSSProtocolpresentitygroups::DoUnsubscribePresentityGroupContentL() +// --------------------------------------------------------------------------- +// +void COSSProtocolpresentitygroups::DoUnsubscribePresentityGroupContentL ( + const MXIMPIdentity& /*aGroupId*/, + TXIMPRequestId aReqId ) + { + LOGGER ( TXT ( "Groups::DoUnsubscribePresentityGroupContentL() Start" ) ); + + // just complete the request to PrFw Successfully + + iConnMan.HandleToHost().HandleRequestCompleted ( aReqId, KErrNone ); + + LOGGER ( TXT ( "Groups::DoUnsubscribePresentityGroupContentL() End" ) ); + } + +// --------------------------------------------------------------------------- +// COSSProtocolpresentitygroups::DoAddPresentityGroupMemberL() +// --------------------------------------------------------------------------- +// +void COSSProtocolpresentitygroups::DoAddPresentityGroupMemberL ( + const MXIMPIdentity& aGroupId, + const MXIMPIdentity& aMemberId, + const TDesC16& aMemberDisplayName, + TXIMPRequestId aReqId ) + { + LOGGER ( TXT ( "Groups::DoAddPresentityGroupMemberL() Start" ) ); + + CAddPresentityGroupMemberRequest* addreq = + CAddPresentityGroupMemberRequest::NewLC(iConnMan, aReqId ); + + addreq->AddPresentityGroupMemberL(aGroupId,aMemberId,aMemberDisplayName); + + CleanupStack::Pop ( addreq ); + + LOGGER ( TXT ( "Groups::DoAddPresentityGroupMemberL() End" ) ); + } + +// --------------------------------------------------------------------------- +// COSSProtocolpresentitygroups::DoRemovePresentityGroupMemberL() +// --------------------------------------------------------------------------- +// +void COSSProtocolpresentitygroups::DoRemovePresentityGroupMemberL ( + const MXIMPIdentity& aGroupId, + const MXIMPIdentity& aMemberId, + TXIMPRequestId aReqId ) + { + LOGGER ( TXT ( "Groups::DoRemovePresentityGroupMemberL() Start" ) ) ; + CRemovePresentityGroupMemberRequest* removereq = + CRemovePresentityGroupMemberRequest::NewLC(iConnMan, aReqId ); + + removereq->RemovePresentityGroupMemberL(aGroupId,aMemberId); + + CleanupStack::Pop ( removereq ); + LOGGER ( TXT ( "Groups::DoRemovePresentityGroupMemberL() End" ) ); + } + +// --------------------------------------------------------------------------- +// COSSProtocolpresentitygroups::DoUpdatePresentityGroupMemberDisplayNameL() +// --------------------------------------------------------------------------- +// +void COSSProtocolpresentitygroups::DoUpdatePresentityGroupMemberDisplayNameL ( + const MXIMPIdentity& /*aGroupId*/, + const MXIMPIdentity& /*aMemberId*/, + const TDesC16& /*aMemberDisplayName*/, + TXIMPRequestId /*aReqId*/ ) + { + LOGGER ( TXT ( "Groups::DoUpdatePresentityGroupMemberDisplayNameL() Start" ) ); + LOGGER ( TXT ( "Groups::DoUpdatePresentityGroupMemberDisplayNameL() End" ) ); + } + +// --------------------------------------------------------------------------- +// COSSProtocolpresentitygroups::CreateDataHandler() +// --------------------------------------------------------------------------- +// +void COSSProtocolpresentitygroups::CreateDataHandlerL() + { + LOGGER ( TXT ( "COSSProtocolpresentitygroups::CreateDataHandler() Start" ) ); + + iConnMan.ManufactureDataHandlerL(); + + LOGGER ( TXT ( "COSSProtocolpresentitygroups::CreateDataHandler() End" ) ); + } + +// End of file + diff -r 000000000000 -r e6b17d312c8b imservices/ossprotocoladaptation/src/presentitygroups/cremovepresentitygroupmemberrequest.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/ossprotocoladaptation/src/presentitygroups/cremovepresentitygroupmemberrequest.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,238 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Remove presentity group member request to the network server +* +*/ + + +#include +#include "cremovepresentitygroupmemberrequest.h" +#include "mossprotocolconnectionmanager.h" +#include "cossprotocolconnectionmanager.h" +#include "ossprotocolpluginlogger.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include "stringutils.h" +#include +#include +#include +#include +#include "msgliterals.h" +#include "msg_enums.h" +#include "ossprotocoladaptutils.h" + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// CRemovePresentityGroupMemberRequest::CRemovePresentityGroupMemberRequest +// --------------------------------------------------------------------------- +// +CRemovePresentityGroupMemberRequest::CRemovePresentityGroupMemberRequest( + MOSSProtocolConnectionManager& aConnMan, + TXIMPRequestId aRequestId ) : + CActive( EPriorityNormal ), + iRequestId( aRequestId ), + iConnMan( aConnMan ) + { + LOGGER ( TXT("::CRemovePresentityGroupMemberRequest Start") ); + CActiveScheduler::Add( this ); + + LOGGER ( TXT("::CRemovePresentityGroupMemberRequest End") ); + } + + +// --------------------------------------------------------------------------- +// CRemovePresentityGroupMemberRequest::ConstructL +// --------------------------------------------------------------------------- +// +void CRemovePresentityGroupMemberRequest::ConstructL() + { + LOGGER ( TXT("CRemovePresentityGroupMemberRequest::ConstructL Start") ); + iUserId = NULL; + LOGGER ( TXT("CRemovePresentityGroupMemberRequest::ConstructL End") ); + } + + + +// --------------------------------------------------------------------------- +// CRemovePresentityGroupMemberRequest::NewLC +// --------------------------------------------------------------------------- +// +CRemovePresentityGroupMemberRequest* CRemovePresentityGroupMemberRequest::NewLC( + MOSSProtocolConnectionManager& aConnMan, + TXIMPRequestId aRequestId ) + { + LOGGER ( TXT("CRemovePresentityGroupMemberRequest::NewLC Start") ); + + CRemovePresentityGroupMemberRequest* self = new( ELeave ) + CRemovePresentityGroupMemberRequest( aConnMan, aRequestId ); + CleanupStack::PushL( self ); + self->ConstructL(); + + + LOGGER ( TXT("CRemovePresentityGroupMemberRequest::NewLC End") ); + return self; + } + +// --------------------------------------------------------------------------- +// CRemovePresentityGroupMemberRequest::~CRemovePresentityGroupMemberRequest +// --------------------------------------------------------------------------- +// +CRemovePresentityGroupMemberRequest::~CRemovePresentityGroupMemberRequest() + { + LOGGER ( TXT("::~CRemovePresentityGroupMemberRequest Start") ); + + CActive::Cancel(); + delete iUserId; + LOGGER ( TXT("::~CRemovePresentityGroupMemberRequest End") ); + } + + +// --------------------------------------------------------------------------- +// CRemovePresentityGroupMemberRequest::DoCancel() +// --------------------------------------------------------------------------- +// +void CRemovePresentityGroupMemberRequest::DoCancel() + { + LOGGER ( TXT("CRemovePresentityGroupMemberRequest::DoCancel Start") ); + + LOGGER ( TXT("CRemovePresentityGroupMemberRequest::DoCancel End") ); + } + + +// --------------------------------------------------------------------------- +// CRemovePresentityGroupMemberRequest::RunL() +// --------------------------------------------------------------------------- +// +void CRemovePresentityGroupMemberRequest::RunL() + { + LOGGER ( TXT("CRemovePresentityGroupMemberRequest::RunL Start") ); + message_hdr_resp* msg_struct = NULL; + char* pResponse = NULL; + User::LeaveIfError( iStatus.Int() ); + + pResponse = iConnMan.DataHandler().ResponseL ( iSendId ); + + msg_struct = ( message_hdr_resp* )pResponse ; + if( !( msg_struct->response )) + { + switch( msg_struct->error_type ) + { + + default: //for all other error codes like ssl related are mapped to general error + iConnMan.HandleToHost().HandleRequestCompleted ( iRequestId, KXIMPErrServiceGeneralError ); + break; + } + } + else + { + if( iUserId ) + { + HBufC* sxpId = HBufC::NewLC( iConnMan.ServiceName().Length() + iUserId->Length() +1 ); + TPtr sxpIdPtr( sxpId->Des() ); + + sxpIdPtr.Zero(); + sxpIdPtr.Append( iConnMan.ServiceName() ); + sxpIdPtr.Append(KColon); + sxpIdPtr.Append( *iUserId ); + MPresenceCacheWriter2* presenceCacheWriter = MPresenceCacheWriter2::CreateWriterL(); + TInt cacheerror = presenceCacheWriter->DeletePresenceL( sxpIdPtr ); + User::LeaveIfError ( cacheerror); + CleanupStack::PopAndDestroy(); // sxpId + delete presenceCacheWriter; + presenceCacheWriter = NULL; + delete iUserId; + iUserId = NULL; + } + iConnMan.HandleToHost().HandleRequestCompleted ( iRequestId, KErrNone ); + } + + free( pResponse ); + delete this; + LOGGER ( TXT("CRemovePresentityGroupMemberRequest::RunL End") ); + } + + +// --------------------------------------------------------------------------- +// CRemovePresentityGroupMemberRequest::RunError +// --------------------------------------------------------------------------- +// +TInt CRemovePresentityGroupMemberRequest::RunError( TInt aError ) + { + LOGGER ( TXT("CRemovePresentityGroupMemberRequest::RunError Start") ); + + iConnMan.HandleToHost().HandleRequestCompleted( iRequestId, aError ); + + delete this; + LOGGER ( TXT("CRemovePresentityGroupMemberRequest::RunError End") ); + return KErrNone; + } + +// --------------------------------------------------------------------------- +// CRemovePresentityGroupMemberRequest::RemovePresentityGroupMemberL +// --------------------------------------------------------------------------- +// +void CRemovePresentityGroupMemberRequest::RemovePresentityGroupMemberL( + const MXIMPIdentity& /*aGroupId*/, + const MXIMPIdentity& aMemberId) + { + + LOGGER ( TXT("CRemovePresentityGroupMemberRequest::RemovePresentityGroupMemberL Start") ); + + int userLen=0; + int totalLen = 0; + iUserId = aMemberId.Identity().AllocL(); + + message_hdr_req msgHdr = {0,}; + msgHdr.message_type = EDelete_Contact_Request; + + TInt headerLength = sizeof( message_hdr_req ); + totalLen += headerLength; + + // adding add contact + charFormatData tmpmsgData = OssProtocolAdapUtils::ConvertTUint16ToCharLC ( aMemberId.Identity() ); + char *tmpmsg = tmpmsgData.data; + userLen = tmpmsgData.dataSize; + totalLen += userLen; + + User::LeaveIfError ( totalLen > MAX_MSG_SIZE ); + + //now allocate memory. + char* smsg = ( char* ) User::AllocLC( totalLen ); + memcpy( smsg, &msgHdr, headerLength ); + memcpy ( smsg + headerLength, tmpmsg, userLen ); + + iSendId = iConnMan.DataHandler().SendDataL ( iStatus, smsg, totalLen ); + + // signal the scheduler + SetActive(); + + CleanupStack::PopAndDestroy ( 2 );//smsg, tmpmsg. + + LOGGER ( TXT("::RemovePresentityGroupMemberL End") ); + } + + +// End of file diff -r 000000000000 -r e6b17d312c8b imservices/ossprotocoladaptation/src/presentitygroups/csubscribepresentitygroupcontentrequest.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/ossprotocoladaptation/src/presentitygroups/csubscribepresentitygroupcontentrequest.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,309 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Subscribe Presentity Group content request to the Network Server. +* +*/ + + +#include +#include "csubscribepresentitygroupcontentrequest.h" +#include "cossprotocolconnectionmanager.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "ossprotocolpluginlogger.h" + +#include +#include +#include +#include "stringutils.h" +#include +#include +#include +#include +#include "msgliterals.h" +#include "msg_enums.h" +#include "ossprotocoladaptutils.h" + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// CSubscribePresentityGroupContentRequest::CSubscribePresentityGroupContentRequest() +// --------------------------------------------------------------------------- +// +CSubscribePresentityGroupContentRequest::CSubscribePresentityGroupContentRequest ( + MOSSProtocolConnectionManager& aConnMan, + TXIMPRequestId aRequestId ) : + CActive ( EPriorityNormal ), + iRequestId ( aRequestId ), + iConnMan ( aConnMan ), + iListcount ( 0 ) + { + LOGGER ( TXT ( "::CSubscribePresentityGroupContentRequest Start" ) ); + CActiveScheduler::Add ( this ); + LOGGER ( TXT ( "::CSubscribePresentityGroupContentRequest End" ) ); + } + + +// --------------------------------------------------------------------------- +// CSubscribePresentityGroupContentRequest::ConstructL() +// --------------------------------------------------------------------------- +// +void CSubscribePresentityGroupContentRequest::ConstructL() + { + LOGGER ( TXT ( "CSubscribePresentityGroupContentRequest::ConstructL Start-End" ) ); + iGroupName = NULL; + + } + + +// --------------------------------------------------------------------------- +// CSubscribePresentityGroupContentRequest::NewL +// --------------------------------------------------------------------------- +// +CSubscribePresentityGroupContentRequest* CSubscribePresentityGroupContentRequest::NewL ( + MOSSProtocolConnectionManager& aConnMan, + TXIMPRequestId aRequestId ) + { + LOGGER ( TXT ( "CSubscribePresentityGroupContentRequest::NewL Start" ) ); + + CSubscribePresentityGroupContentRequest* self = new ( ELeave ) + CSubscribePresentityGroupContentRequest ( aConnMan, aRequestId ); + CleanupStack::PushL ( self ); + self->ConstructL(); + CleanupStack::Pop ( self ); + + LOGGER ( TXT ( "CSubscribePresentityGroupContentRequest::NewL End" ) ); + return self; + } + + +// --------------------------------------------------------------------------- +// CSubscribePresentityGroupContentRequest::NewLC() +// --------------------------------------------------------------------------- +// +CSubscribePresentityGroupContentRequest* CSubscribePresentityGroupContentRequest::NewLC ( + MOSSProtocolConnectionManager& aConnMan, + TXIMPRequestId aRequestId ) + { + LOGGER ( TXT ( "CSubscribePresentityGroupContentRequest::NewLC Start" ) ); + + CSubscribePresentityGroupContentRequest* self = + CSubscribePresentityGroupContentRequest::NewL ( aConnMan, aRequestId ); + CleanupStack::PushL ( self ); + + LOGGER ( TXT ( "CSubscribePresentityGroupContentRequest::NewLC End" ) ); + return self; + } + +// --------------------------------------------------------------------------- +// CSubscribePresentityGroupContentRequest::~CSubscribePresentityGroupContentRequest() +// --------------------------------------------------------------------------- +// +CSubscribePresentityGroupContentRequest::~CSubscribePresentityGroupContentRequest() + { + LOGGER ( TXT ( "::~CSubscribePresentityGroupContentRequest Start" ) ); + delete iGroupName; + iGroupName = NULL; + Cancel(); + //iContacts.ResetAndDestroy(); + LOGGER ( TXT ( "::~CSubscribePresentityGroupContentRequest End" ) ); + } + + +// --------------------------------------------------------------------------- +// CSubscribePresentityGroupContentRequest::DoCancel() +// --------------------------------------------------------------------------- +// +void CSubscribePresentityGroupContentRequest::DoCancel() + { + LOGGER ( TXT ( "CSubscribePresentityGroupContentRequest::DoCancel Start" ) ); + iConnMan.DataHandler().CancelListening(); + LOGGER ( TXT ( "CSubscribePresentityGroupContentRequest::DoCancel End" ) ); + } + +// --------------------------------------------------------------------------- +// CSubscribePresentityGroupContentRequest::RunL() +// --------------------------------------------------------------------------- +// +void CSubscribePresentityGroupContentRequest::RunL() + { + LOGGER ( TXT ( "CSubscribePresentityGroupContentRequest::RunL Start" ) ); + User::LeaveIfError( iStatus.Int() ); + TRAPD( error, ProcessIncomingDataL( ) ); + if ( error != KErrNone ) + { + Cancel(); + } + + LOGGER ( TXT ( "CSubscribePresentityGroupContentRequest::RunL End" ) ); + } + + +// --------------------------------------------------------------------------- +// CSubscribePresentityGroupContentRequest::RunError +// --------------------------------------------------------------------------- +// +TInt CSubscribePresentityGroupContentRequest::RunError ( TInt aError ) + { + LOGGER ( TXT ( "CSubscribePresentityGroupContentRequest::RunError Start" ) ); + + iConnMan.HandleToHost().HandleRequestCompleted ( iRequestId, aError ); + + delete this; + LOGGER ( TXT ( "CSubscribePresentityGroupContentRequest::RunError End" ) ); + return KErrNone; + } + +// --------------------------------------------------------------------------- +// CSubscribePresentityGroupContentRequest::SubscribePresentityGroupContentL +// --------------------------------------------------------------------------- +// +void CSubscribePresentityGroupContentRequest::SubscribePresentityGroupContentL ( + const MXIMPIdentity& aIdentity ) + { + LOGGER ( TXT ( "CSubscribePresentityGroupContentRequest::SubscribePresentityGroupContentL Start" ) ); + if(iGroupName) + { + delete iGroupName; + iGroupName = NULL; + } + iGroupName = aIdentity.Identity().AllocL(); + iConnMan.SetGroupIDL( *iGroupName ); // this groupname is used by contactsync class for synchronisation + + if(iConnMan.DataHandler().IsFetchContactsCompleted()) + { + ProcessIncomingDataL( ); + } + else + { + if ( ! ( this->IsActive() ) ) + { + iConnMan.DataHandler().ListenIncomingData ( iStatus ); + SetActive(); + } + } + + + LOGGER ( TXT ( "CSubscribePresentityGroupContentRequest::SubscribePresentityGroupContentL End" ) ); + } + + +// --------------------------------------------------------------------------- +// CSubscribePresentityGroupContentRequest::ProcessIncomingDataL() +// --------------------------------------------------------------------------- +// +void CSubscribePresentityGroupContentRequest::ProcessIncomingDataL() + { + LOGGER ( TXT ( "CSubscribePresentityGroupContentRequest::ProcessIncomingDataL Start" ) ); + + PopulateDataL(); + + MXIMPObjectFactory& prfwObjFact = iConnMan.HandleToHost().ObjectFactory(); + + MPresenceObjectFactory& prObjFact = + iConnMan.HandleToHost().ProtocolPresenceDataHost().PresenceObjectFactory(); + + MXIMPIdentity* contactIdentity = NULL; + MPresentityGroupMemberInfo* groupMemberInfo = NULL; + MXIMPObjectCollection* listOfContacts = prfwObjFact.NewObjectCollectionLC(); + + //get the ref to contacts which was already stored in PopulateDataL + RPointerArray& contacts = iConnMan.GetContactManager().GetContactsListL(); + + for(TInt i = 0;iSetIdentityL ( *(contacts[ i ] )); + groupMemberInfo->SetGroupMemberIdL ( contactIdentity ); + groupMemberInfo->SetGroupMemberDisplayNameL ( *(contacts[ i ] ) ); + listOfContacts->AddObjectL ( groupMemberInfo ); + CleanupStack::Pop ( 2 );//groupMemberInfo, contactIdentity + + } + + MXIMPIdentity* groupIdentity = prfwObjFact.NewIdentityLC(); + + groupIdentity->SetIdentityL ( *iGroupName ); + + iConnMan.HandleToHost().ProtocolPresenceDataHost().GroupsDataHost().HandlePresentityGroupContentL ( + groupIdentity, listOfContacts ); + iConnMan.HandleToHost().HandleRequestCompleted ( iRequestId, KErrNone ); + CleanupStack::Pop ( 2 );//groupIdentity,listOfContacts + + delete this; + + LOGGER ( TXT ( "CSubscribePresentityGroupContentRequest::ProcessIncomingDataL End" ) ); + + } + +// --------------------------------------------------------------------------- +// CSubscribePresentityGroupContentRequest::PopulateDataL +// --------------------------------------------------------------------------- +// +void CSubscribePresentityGroupContentRequest::PopulateDataL() + { + LOGGER ( TXT ( "CSubscribePresentityGroupContentRequest::PopulateDataL Start" ) ); + + int len = MAX_SIZE_DATA; + char* pResponse = NULL, *pOrigResponse = NULL; + + TInt datacount = iConnMan.DataHandler().IncomingDataCount(); + //to keep the local copy of contacts in adaptation till logout + RPointerArray& contacts = iConnMan.GetContactManager().GetContactsListL(); + + while( datacount ) + { + // get the incoming response from the server with transaction id equals zero + pOrigResponse = pResponse = iConnMan.DataHandler().ResponseL ( 0 ); + CleanupStack::PushL(pOrigResponse) ; + if( pResponse ) + { + pResponse += sizeof ( message_hdr_resp ); + + while(1) + { + len = strlen(pResponse) + 1; + if (1 == len) + { + break; + } + char* contact = pResponse; + pResponse += len; + + HBufC16 *contactName = OssProtocolAdapUtils::ConvertCharToTUint16LC( contact ); + contacts.AppendL(contactName); + LOGGER ( TXT ( "CSubscribePresentityGroupContentRequest::PopulateDataL:ContactName:%S " ), contactName ); + CleanupStack::Pop ( contactName ); + } + } + + CleanupStack::PopAndDestroy(pOrigResponse) ;//pOrigResponse + + datacount = iConnMan.DataHandler().IncomingDataCount(); + } + + LOGGER ( TXT ( "CSubscribePresentityGroupContentRequest::PopulateDataL End" ) ); + } + + + +// End of file diff -r 000000000000 -r e6b17d312c8b imservices/ossprotocoladaptation/src/processlauncher/processlaunher.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/ossprotocoladaptation/src/processlauncher/processlaunher.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,153 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: implementation of launching of process +* +*/ + + +// INCLUDE FILES +#include "processlaunher.h" + +#include +#include "ossprotocolpluginlogger.h" + + + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CProcessLauncher::CProcessLauncher +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CProcessLauncher::CProcessLauncher() : + CActive ( EPriorityStandard ) + { + CActiveScheduler::Add ( this ); + } + +// ----------------------------------------------------------------------------- +// CProcessLauncher::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CProcessLauncher::ConstructL ( const TDesC16& aprocessname ) + { + LOGGER ( TXT ( "CProcessLauncher::ConstructL()" ) ); + iProcessName = aprocessname.AllocL(); + } + +// ----------------------------------------------------------------------------- +// CProcessLauncher::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CProcessLauncher* CProcessLauncher::NewL ( const TDesC16& aprocessname ) + { + LOGGER ( TXT ( "CProcessLauncher::NewL()" ) ); + + CProcessLauncher* self = + new ( ELeave ) CProcessLauncher(); + + CleanupStack::PushL ( self ); + self->ConstructL ( aprocessname ); + CleanupStack::Pop(); + + return self; + } + +// Destructor +CProcessLauncher::~CProcessLauncher() + { + Cancel(); + delete iProcessName; + } + + +// --------------------------------------------------------- +// CProcessLauncher::DoCancel +// +// --------------------------------------------------------- +// +void CProcessLauncher::DoCancel() + { + iLauncher.LogonCancel ( iStatus ); + + } + +// --------------------------------------------------------- +// CProcessLauncher::RunL +// +// --------------------------------------------------------- +// +void CProcessLauncher::RunL() + { + TInt answer ( iStatus.Int() ); + + if ( answer != KErrNone ) + { + LOGGER ( TXT ( "CProcessLauncher::dd terminated with the reason %d" ), answer ); + + User::LeaveIfError ( answer ); + } + + Cancel(); + } + +// --------------------------------------------------------- +// CProcessLauncher::RunError +// +// --------------------------------------------------------- +// +TInt CProcessLauncher::RunError ( TInt aError ) + { + if ( IsActive() ) + { + Cancel(); + } + + return aError; + } +// --------------------------------------------------------- +// CProcessLauncher::LaunchProcessL +// --------------------------------------------------------- +// +void CProcessLauncher::LaunchProcessL() + { + LOGGER ( TXT ( "CProcessLauncher::LaunchProcessL() start" ) ); + TInt result = KErrNotFound; + + result = iLauncher.Create ( *iProcessName, KNullDesC ); + + if ( result != KErrNone ) + { + LOGGER ( TXT ( "CProcessLauncher::launching isoserver is failed with the reason %d" ), result ); + User::Leave ( result ); + } + + // When the launcher exits we'll get the exit code in iStatus + iStatus = KRequestPending; + + SetActive(); + + iLauncher.Logon ( iStatus ); + + iLauncher.Resume(); + + //iLauncher.Close(); + LOGGER ( TXT ( "CProcessLauncher::LaunchProcessL() End " ) ); + } + +// End of file diff -r 000000000000 -r e6b17d312c8b imservices/ossprotocoladaptation/src/search/cossprotocolsearch.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/ossprotocoladaptation/src/search/cossprotocolsearch.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,200 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Oss Protocol search implementation +* +*/ + +#include +#include +#include +#include + +#include "cossprotocolsearch.h" +#include "cossprotocolconnectionmanager.h" +#include "csearchrequest.h" +#include "mossprotocolconnectionmanager.h" +#include "ossprotocolpluginlogger.h" +#include "ossprotocolpluginpanics.h" + +#include "csearchgetsearchkeys.h" + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// COSSProtocolSearch::GetInterface() +// --------------------------------------------------------------------------- +// +TAny* COSSProtocolSearch::GetInterface ( TInt32 aInterfaceId, + TIfGetOps aOptions ) + { + LOGGER ( TXT ( "COSSProtocolSearch::GetInterface() Start" ) ); + + MProtocolSearch* self= NULL; + if ( aInterfaceId == MProtocolSearch::KInterfaceId ) + { + self = this ; + } + else + { + if (aOptions == MXIMPBase::EPanicIfUnknown ) + + { + User::Panic ( _L("serach"), KErrExtensionNotSupported ); + } + } + + + + LOGGER ( TXT ( "COSSProtocolSearch::GetInterface() End" ) ); + + return self; + } + + +// --------------------------------------------------------------------------- +// COSSProtocolSearch::GetInterface() +// --------------------------------------------------------------------------- +// +const TAny* COSSProtocolSearch::GetInterface ( TInt32 aInterfaceId, + TIfGetOps aOptions ) const + { + LOGGER ( TXT ( "COSSProtocolSearch::GetInterface() Start" ) ); + + const MProtocolSearch* self= NULL; + if ( aInterfaceId == MProtocolSearch::KInterfaceId ) + { + self = this ; + } + else + { + if (aOptions == MXIMPBase::EPanicIfUnknown ) + + { + User::Panic ( _L("serach"), KErrExtensionNotSupported ); + } + } + + LOGGER ( TXT ( "COSSProtocolSearch::GetInterface() End" ) ); + + return self; + } + + +// --------------------------------------------------------------------------- +// COSSProtocolSearch::GetInterfaceId() +// --------------------------------------------------------------------------- +// +TInt32 COSSProtocolSearch::GetInterfaceId() const + { + LOGGER ( TXT ( "COSSProtocolSearch::GetInterfaceId() Start-End" ) ); + return MProtocolSearch::KInterfaceId; + } + + +// --------------------------------------------------------------------------- +// COSSProtocolSearch::COSSProtocolSearch() +// --------------------------------------------------------------------------- +// +COSSProtocolSearch::COSSProtocolSearch ( + MOSSProtocolConnectionManager& aConnMan ) + : iConnMan ( aConnMan ) + { + LOGGER ( TXT ( "Groups::COSSProtocolSearch() Start-End" ) ); + } + + +// --------------------------------------------------------------------------- +// COSSProtocolSearch::ConstructL() +// --------------------------------------------------------------------------- +// +void COSSProtocolSearch::ConstructL() + { + LOGGER ( TXT ( "COSSProtocolSearch::ConstructL() Start" ) ); + LOGGER ( TXT ( "COSSProtocolSearch::ConstructL() End" ) ); + } + + +// --------------------------------------------------------------------------- +// COSSProtocolSearch::NewL() +// --------------------------------------------------------------------------- +// +COSSProtocolSearch* COSSProtocolSearch::NewL ( + MOSSProtocolConnectionManager& aConnMan ) + { + LOGGER ( TXT ( "COSSProtocolSearch::NewL() Start" ) ); + + COSSProtocolSearch* self = + new ( ELeave ) COSSProtocolSearch ( aConnMan ); + CleanupStack::PushL ( self ); + self->ConstructL( ); + CleanupStack::Pop ( self ); + + LOGGER ( TXT ( "COSSProtocolSearch::NewL() End" ) ); + return self; + } + + +// --------------------------------------------------------------------------- +// COSSProtocolSearch::~COSSProtocolSearch() +// --------------------------------------------------------------------------- +// +COSSProtocolSearch::~COSSProtocolSearch() + { + LOGGER ( TXT ( "COSSProtocolSearch::~COSSProtocolSearch() Start" ) ); + + LOGGER ( TXT ( "COSSProtocolSearch::~COSSProtocolSearch() End" ) ); + } + + + +// --------------------------------------------------------------------------- +// COSSProtocolSearch::DoSearchL() +// --------------------------------------------------------------------------- +// +void COSSProtocolSearch::DoSearchL( const MXIMPIdentity& aSearchId, + const RPointerArray< MSearchElement >& aObjs, + TInt aSearchLimit, + TXIMPRequestId aReqId ) + { + LOGGER ( TXT ( "COSSProtocolSearch::DoSearchL() Start" ) ); + + CSearchrequest* req = CSearchrequest::NewLC ( iConnMan, aReqId ); + req->SearchL(aSearchId,aObjs,aSearchLimit); + + CleanupStack::Pop ( req ); // req is deleted by itself once it completes the operation + + LOGGER ( TXT ( "COSSProtocolSearch::DoSearchL() End" ) ); + } + + +// --------------------------------------------------------------------------- +// COSSProtocolSearch::DoSearchL() +// --------------------------------------------------------------------------- +// +void COSSProtocolSearch::DoGetSearchKeysL( TXIMPRequestId aReqId ) + { + LOGGER ( TXT ( "COSSProtocolSearch::DoSearchL() Start" ) ); + //Shoudl be changed to NewLC + CSearchGetSearchKeys* req = CSearchGetSearchKeys::NewL ( + iConnMan, aReqId ); + // req->SearchL(aSearchId,aObjs,aSearchLimit); + + req->GetSearchKeysL(); + + //CleanupStack::Pop ( req ); // req is deleted by itself once it completes the operation + + LOGGER ( TXT ( "COSSProtocolSearch::DoSearchL() End" ) ); + } +// End of file + diff -r 000000000000 -r e6b17d312c8b imservices/ossprotocoladaptation/src/search/csearchgetsearchkeys.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/ossprotocoladaptation/src/search/csearchgetsearchkeys.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,228 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: This class handles dynamic search label-key pair storing. +* +*/ + +//For malloc +#include +//For protocol connection host +#include +//For Connection manager +#include "cossprotocolconnectionmanager.h" +#include "csearchgetsearchkeys.h" +#include "msg_enums.h" + +#include "ossprotocolpluginlogger.h" +//For Converting C style string to S60 style HBufC +#include "ossprotocoladaptutils.h" +//For open c string functions +#include + +#include + +#include +#include +#include +#include +#include + +/*! /brief Documented in header file +*/ +CSearchGetSearchKeys* CSearchGetSearchKeys::NewL( + MOSSProtocolConnectionManager& aConnMan, + TXIMPRequestId aRequestId ) + { + LOGGER ( TXT("::CSearchGetSearchKeys NewL Start") ); + + CSearchGetSearchKeys* self = new ( ELeave ) CSearchGetSearchKeys( + aConnMan, aRequestId ); + + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + + LOGGER ( TXT("::CSearchGetSearchKeys NewL End") ); + return self; + } + + +/*! /brief Documented in header file +*/ +CSearchGetSearchKeys::CSearchGetSearchKeys( + MOSSProtocolConnectionManager& aConnMan, + TXIMPRequestId aRequestId ) : CActive ( EPriorityNormal ), + iRequestId ( aRequestId ), + iConnMan ( aConnMan ) + { + + LOGGER ( TXT("::CSearchGetSearchKeys Start") ); + + CActiveScheduler::Add( this ); + + LOGGER ( TXT("::CSearchGetSearchKeys End") ); + + } + +/*! /brief Documented in header file +*/ +CSearchGetSearchKeys::~CSearchGetSearchKeys() + { + + } + +/*! /brief Documented in header file +*/ +void CSearchGetSearchKeys::DoCancel() + { + + } + +/*! /brief Documented in header file +*/ +void CSearchGetSearchKeys::RunL() + { + LOGGER( TXT( "CSearchGetSearchKeys::RunL start" ) ); + + User::LeaveIfError( iStatus.Int() ); + message_hdr_resp* msg_resp = NULL; + + char* response = NULL; + CSearchKeyStore& keyStore = iConnMan.GetSearchKeyStore(); + + response = iConnMan.DataHandler().ResponseL( iSendId ); + + msg_resp = ( message_hdr_resp* ) response; + + if ( !msg_resp->response ) + { + if ( msg_resp->error_type ) + { + //Complete the request with an error + iConnMan.HandleToHost().HandleRequestCompleted( iRequestId, + KErrNotSupported ); + } + } + else + { + + { + //This part reads all the possible labels from cen rep and tries to + //match the search labels got to those.. If match found search labels + //are assigned appropriate Enum values + TInt index = sizeof( message_hdr_resp ); + char* keyStr = NULL; + RPointerArray keyList; + TInt len = 0; + + while( !( *( response + index ) == '\0' + && *( response + index + 1 ) == '\0' ) ) + { + len = strlen( response + index ) + 1; + keyStr = ( char* ) User::AllocLC( len ); + strcpy ( keyStr, response + index ); + index += len; + + HBufC* key = OssProtocolAdapUtils::ConvertCharToTUint16LC( keyStr ); + keyList.Append( key ); + CleanupStack::Pop(); //key + CleanupStack::PopAndDestroy(); //keyStr + } + + keyStore.MapLabelsToEnumL( keyList ); + } + //Send all the labels to XIMP/UI + MXIMPObjectFactory& objFact = iConnMan.HandleToHost().ObjectFactory(); + MSearchObjectFactory& searchObjFact = iConnMan.GetSearchHost().SearchObjectFactory(); + MXIMPObjectCollection* labelArray = objFact.NewObjectCollectionLC(); + + RPointerArray lablEnum = keyStore.GetSupportedEnums(); + + for ( TInt i = 0; i < lablEnum.Count(); i++ ) + { + MSearchKeyInfo* srchKey = searchObjFact.NewSearchKeyInfoLC(); + srchKey->SetType( EKey ); + srchKey->SetKey((TSearchKey) *( lablEnum[i] ) ); + labelArray->AddObjectL( srchKey );//ownership transfered + CleanupStack::Pop(); //srchKey + } + + RPointerArray label = keyStore.GetNotSupportedLabels(); + + for ( TInt i = 0; i < label.Count(); i++ ) + { + MSearchKeyInfo* srchLabel = searchObjFact.NewSearchKeyInfoLC(); + srchLabel->SetType( ELabel ); + srchLabel->SetLabelL( *( label[i] ) ); + labelArray->AddObjectL( srchLabel );//ownership transfered + CleanupStack::Pop(); //srchLabel + } + + + iConnMan.GetSearchHost().SearchFeatureDataAccess().HandleSearchKeysL ( + labelArray );//ownership transfered + iConnMan.HandleToHost().HandleRequestCompleted ( iRequestId, KErrNone ); + + CleanupStack::Pop( ); //labelArray + } + + free( response ); + + LOGGER( TXT( "CSearchGetSearchKeys::RunL end" ) ); + delete this; + + } + +/*! /brief Documented in header file +*/ +TInt CSearchGetSearchKeys::RunError( TInt aError ) + { + LOGGER( TXT( "CSearchGetSearchKeys::RunError start" ) ); + + iConnMan.HandleToHost().HandleRequestCompleted( iRequestId, aError ); + + LOGGER( TXT( "CSearchGetSearchKeys::RunError end" ) ); + + return 0; + } + +/*! /brief Documented in header file +*/ +void CSearchGetSearchKeys::ConstructL() + { + + } + +/*! /brief Documented in header file +*/ +void CSearchGetSearchKeys::GetSearchKeysL() + { + LOGGER ( TXT("::CSearchGetSearchKeys GetSearchKeysL Start") ); + + TInt len = sizeof ( message_hdr_req ); + message_hdr_req* msgHdr = ( message_hdr_req* ) User::AllocLC( len ); + + msgHdr->message_type = ESearch_Get_Keys; + + iSendId = iConnMan.DataHandler().SendDataL( iStatus, ( char* )msgHdr, + len ); + + SetActive(); + + CleanupStack::PopAndDestroy ( 1 );//msgHdr + + LOGGER ( TXT("::CSearchGetSearchKeys GetSearchKeysL End") ); + } + +// End of file diff -r 000000000000 -r e6b17d312c8b imservices/ossprotocoladaptation/src/search/csearchkeystore.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/ossprotocoladaptation/src/search/csearchkeystore.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,227 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: This class handles dynamic search label-key pair storing. +* +*/ + + +#include "csearchkeystore.h" +#include "ossprotocolpluginlogger.h" + +/*! /file +* /brief Implimentation of interfaces defined in csearchkeystore.h +*/ + +/*! /brief documented in the header file +*/ +CSearchKeyStore* CSearchKeyStore::NewL() + { + LOGGER ( TXT("::CSearchKeyStore NewL Start") ); + + CSearchKeyStore* self = new ( ELeave ) CSearchKeyStore; + + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + + + LOGGER ( TXT("::CSearchKeyStore NewL End") ); + return self; + + } + +/*! /brief documented in the header file +*/ +CSearchKeyStore::CSearchKeyStore() + { + + } + +/*! /brief documented in the header file +*/ +CSearchKeyStore::~CSearchKeyStore() + { + LOGGER ( TXT("::CSearchKeyStore ~CSearchKeyStore Start") ); + + //Close the hash map + // any leaks here? + iEnumLabels.Close(); + + // any leaks here? + //Close the hash map + iSupportedLabels.Close(); + + + //reset and destroy + iNotSupportedLabels.ResetAndDestroy(); + + delete iLabelKeyHashRep; + + LOGGER ( TXT("::CSearchKeyStore ~CSearchKeyStore End") ); + } + +/*! /brief documented in the header file +*/ +void CSearchKeyStore::MapLabelsToEnumL( RPointerArray& aLabels ) + { + LOGGER ( TXT("::CSearchKeyStore MapLabelsToEnum Start") ); + + RArray enumBool; + //TO avoid excessive computation, we mark enumBool[i] if + //a label is already attched to that enum + for ( TInt i = 0; i < iEnumLabels.Count(); i++ ) + { + //unmark all of it + enumBool.Append( 0 ); + } + + for ( TInt i = 0; i < aLabels.Count(); i++ ) + { + //Boolean to say if the label we are matching is supported + TBool supported = EFalse; + + //Iterate thru the hash table of cenrep labels + THashMapIter iter( iEnumLabels ); + //Initialize to 0 + TInt j = 0; + //Loop till thr is a key + while( NULL != iter.NextKey() ) + { + //Check if a label has been assigned to the enum + if ( enumBool[j] ) + { + j++; + continue; + } + //If not + //Get the possible labels for this enum from cen rep + TPtr16 bufPtr = *(iter.CurrentValue()); + + TBuf<1024> buf; + //LC is not leaving/cleanup + //It converts the aLabels to lower case + buf.CopyLC( *( aLabels[i] ) ); + + //Match if the current label from isoserver is in the enum labels + TInt match = bufPtr.Find( buf ); + + if ( KErrNotFound != match ) + { + //If a match is found, mark the corresponding enum + enumBool[j] = 1; + TSearchKey enumvalue = ( TSearchKey )*( iter.CurrentKey() ); + //Add to supported labels hash key and label + iSupportedLabels.InsertL( enumvalue, + aLabels[i]->AllocL()->Des() ); + //Set the flag as supported, so that it is not added in + //not supported label + supported = ETrue; + //Break from the loop + //Get next label try to match to the cen rep labels(supported enums) + break; + } + //update the enum index tracker + j++; + } + //If the label has not matched to any of the supported enum labels + //add that to not supported list + if ( EFalse == supported ) + { + //Add to not supported labels + iNotSupportedLabels.Append( ( aLabels[i]->AllocL() ) ); + } + + + } + + LOGGER ( TXT("::CSearchKeyStore MapLabelsToEnum End") ); + } + +/*! /brief documented in the header file +*/ +HBufC* CSearchKeyStore::GetLabelFromEnumL( TSearchKey aEnum ) + { + LOGGER ( TXT("::CSearchKeyStore GetLabelFromEnum Start") ); + + TPtr* buf = NULL; + //Find if the labels corresponding to enum is there + //and return the alloced label. + //Ownership is transfered to the callee + buf = iSupportedLabels.Find( aEnum ); + if ( buf ) + { + return buf->AllocL(); + } + + LOGGER ( TXT("::CSearchKeyStore GetLabelFromEnum End") ); + + return NULL; + + } + +/*! /brief documented in the header file +*/ +void CSearchKeyStore::ConstructL() + { + LOGGER ( TXT("::CSearchKeyStore ConstructL Start") ); + + iLabelKeyHashRep = CRepository::NewL( KLabelKeyStoreHash ); + TBuf<1024> buf; + + //Read all the labels supported for localization from cen rep + //and have a map for the enum and search field + for ( TInt i = 0; i < NO_OF_KEYS_SUPPORTED; i++ ) + { + iLabelKeyHashRep->Get( ( TSearchKey )( i ), buf ); + iEnumLabels.InsertL( ( TSearchKey )( EUserFirstName + i ), buf.AllocL()->Des() ); + } + + LOGGER ( TXT("::CSearchKeyStore ConstructL End") ); + } +/*! /brief Get the supported enums +* /return An array of pointers to the supported enums +*/ +RPointerArray CSearchKeyStore::GetSupportedEnums() + { + LOGGER ( TXT("::CSearchKeyStore GetSupportedEnums Start") ); + + RPointerArray supportedEnums; + THashMapIter iter( iSupportedLabels ); + + while ( NULL != iter.NextKey() ) + { + + supportedEnums.Append( ( TSearchKey* )iter.CurrentKey() ); + + } + + LOGGER ( TXT("::CSearchKeyStore GetSupportedEnums End") ); + + return supportedEnums; + + } + +/*! /brief This function returns a handle to the array of not +* supported label strings. Not supported here means that +* there are no logical strings in UI for these labels +* /return const handle to not supported strings +*/ + +const RPointerArray CSearchKeyStore::GetNotSupportedLabels() + { + LOGGER ( TXT("::CSearchKeyStore GetNotSupportedLabels Start") ); + + return iNotSupportedLabels; + } +//End of file diff -r 000000000000 -r e6b17d312c8b imservices/ossprotocoladaptation/src/search/csearchrequest.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/ossprotocoladaptation/src/search/csearchrequest.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,417 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Search implementation +* +*/ + + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "stringutils.h" + +#include "msg_enums.h" +#include "waittimer.h" +#include "msgliterals.h" +#include "ossprotocoladaptutils.h" +#include "csearchrequest.h" +#include "mossprotocolconnectionmanager.h" +#include "ossprotocolpluginlogger.h" + +#include "cossprotocolconnectionmanager.h" + + +// search strings used +const char* FirstName ="first_name"; +const char* LastName ="last_name"; +const char* UserId ="user_id"; +const char* Jid ="jid"; + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// CSearchrequest::CSearchrequest +// --------------------------------------------------------------------------- +// +CSearchrequest::CSearchrequest( MOSSProtocolConnectionManager& aConnMan, + TXIMPRequestId aRequestId ) : + CActive( EPriorityNormal ), + iRequestId( aRequestId ), + iConnMan( aConnMan ) + { + LOGGER ( TXT("::CSearchrequest Start") ); + CActiveScheduler::Add( this ); + + LOGGER ( TXT("::CSearchrequest End") ); + } + + +// --------------------------------------------------------------------------- +// CSearchrequest::ConstructL +// --------------------------------------------------------------------------- +// +void CSearchrequest::ConstructL() + { + LOGGER ( TXT("CSearchrequest::ConstructL Start-End") ); + + iSearchId=NULL; + } + + +// --------------------------------------------------------------------------- +// CSearchrequest::NewLC +// --------------------------------------------------------------------------- +// +CSearchrequest* CSearchrequest::NewLC( + MOSSProtocolConnectionManager& aConnMan, + TXIMPRequestId aRequestId ) + { + LOGGER ( TXT("CSearchrequest::NewLC Start") ); + + CSearchrequest* self = new( ELeave ) + CSearchrequest( aConnMan, aRequestId ); + CleanupStack::PushL( self ); + self->ConstructL(); + + LOGGER ( TXT("CSearchrequest::NewLC End") ); + return self; + } + +// --------------------------------------------------------------------------- +// CSearchrequest::~CSearchrequest +// --------------------------------------------------------------------------- +// +CSearchrequest::~CSearchrequest() + { + LOGGER ( TXT("::~CSearchrequest Start") ); + delete iSearchId; + iSearchId=NULL; + + CActive::Cancel(); + + LOGGER ( TXT("::~CSearchrequest End") ); + } + + +// --------------------------------------------------------------------------- +// CSearchrequest::DoCancel() +// --------------------------------------------------------------------------- +// +void CSearchrequest::DoCancel() + { + LOGGER ( TXT("CSearchrequest::DoCancel Start") ); + LOGGER ( TXT("CSearchrequest::DoCancel End") ); + } + + +// --------------------------------------------------------------------------- +// CSearchrequest::RunL() +// --------------------------------------------------------------------------- +// +void CSearchrequest::RunL() + { + LOGGER ( TXT("CSearchrequest::RunL Start") ); + User::LeaveIfError ( iStatus.Int() ); + + int len = MAX_SIZE_DATA; + char* pResponse = NULL, *pOrigResponse = NULL;; + char* key = NULL; + + MXIMPObjectFactory& objFact = iConnMan.HandleToHost().ObjectFactory(); + MSearchObjectFactory& searchObjFact = iConnMan.GetSearchHost().SearchObjectFactory(); + MXIMPIdentity* identity = objFact.NewIdentityLC(); + MXIMPObjectCollection* fieldlist = objFact.NewObjectCollectionLC(); + + TInt datacount = iConnMan.DataHandler().SearchDataCount(); + + while( datacount ) + { + LOGGER ( TXT("CONTACT NO : %d"), datacount ); + pOrigResponse =pResponse = iConnMan.DataHandler().ResponseL ( 5 ); + CleanupStack::PushL(pOrigResponse) ; + MSearchInfo* searchInfo = searchObjFact.NewSearchInfoLC(); + pResponse += sizeof ( message_hdr_resp ); + len = strlen(pResponse) + 1; + while( !( *(pResponse) == '\0' && *(pResponse + 1) == '\0' )) + { + len = strlen(pResponse) + 1; + key = ( char* ) User::AllocLC(len); + strcpy(key,pResponse); + pResponse += len; + len = strlen(pResponse) + 1; + if( strcmp(key,FirstName) == 0) + { + LOGGER ( TXT("FIRSTNAME :") ); + ParseAndSetL(pResponse,len,*searchInfo, EFirstName); + } + else if( strcmp(key,LastName) == 0 ) + { + LOGGER ( TXT("LASTNAME :")); + ParseAndSetL(pResponse,len,*searchInfo, ELastName); + } + else if( strcmp(key,Jid) == 0 ) + { + LOGGER ( TXT("JID :") ); + ParseAndSetL(pResponse,len,*searchInfo, EEmailAddress); + } + pResponse += len; + CleanupStack::PopAndDestroy ();// key + } + fieldlist->AddObjectL ( searchInfo ); + CleanupStack::Pop();//searchInfo + CleanupStack::PopAndDestroy(pOrigResponse) ;//pOrigResponse + datacount = iConnMan.DataHandler().SearchDataCount(); + } + iConnMan.DataHandler().ResponseL ( 5 ); // this removes the operation from the array + identity->SetIdentityL(*iSearchId ); + iConnMan.GetSearchHost().SearchFeatureDataAccess().HandleSearchResultsL ( identity,fieldlist ); + iConnMan.HandleToHost().HandleRequestCompleted ( iRequestId, KErrNone ); + CleanupStack::Pop ( 2 );//identity,fieldlist + delete this; + + LOGGER ( TXT("CSearchrequest::RunL End") ); + } + +// --------------------------------------------------------------------------- +// CSearchrequest::RunError +// --------------------------------------------------------------------------- +// +TInt CSearchrequest::RunError( TInt aError ) + { + LOGGER ( TXT("CSearchrequest::RunError : %d Start"), aError ); + + iConnMan.HandleToHost().HandleRequestCompleted( iRequestId, aError ); + TRAP_IGNORE(iConnMan.DataHandler().ResponseL ( 5 )); // this removes the operation from the array + delete this; + LOGGER ( TXT("CSearchrequest::RunError End") ); + return KErrNone; + } + +// --------------------------------------------------------------------------- +// CSearchrequest::SearchL +// --------------------------------------------------------------------------- +// +void CSearchrequest::SearchL( const MXIMPIdentity& aSearchId, + const RPointerArray< MSearchElement >& aObjs, + TInt /*aSearchLimit*/) + { + LOGGER ( TXT("CSearchrequest::SearchL Start") ); + char *smsg = NULL; + char *tmpmsg = NULL; + message_hdr_req msgHdr = {0,}; + int userLen = 0; + int totalLen = 0; + smsg = ( char* ) User::AllocLC(MAX_MSG_SIZE); + memset ( smsg, '\0', MAX_MSG_SIZE ); + msgHdr.message_type = ESearch; + memcpy ( smsg, &msgHdr, sizeof ( message_hdr_req ) ); + + HBufC* keyStr = NULL;//HBufC::NewL( 1024 ); + + CSearchKeyStore& keyStore = iConnMan.GetSearchKeyStore(); + + totalLen += sizeof( message_hdr_req ); + + TInt elementCount=aObjs.Count(); + + for (TInt i=0; i< elementCount; ++i) + { + const MSearchElement* searchElement = aObjs[i]; + + switch( searchElement->GetSearchKey() ) + { + case EUserFirstName: + { + keyStr = keyStore.GetLabelFromEnumL( EUserFirstName ); + + break; + } + + case EUser: + { + keyStr = keyStore.GetLabelFromEnumL( EUser ); + + break; + } + + case EUserLastName: + { + keyStr = keyStore.GetLabelFromEnumL( EUserLastName ); + + break; + } + + case EUserMiddleName: + { + keyStr = keyStore.GetLabelFromEnumL( EUserMiddleName ); + + break; + } + + case EUserFullName: + { + keyStr = keyStore.GetLabelFromEnumL( EUserFullName ); + + break; + } + + case EUserCountry: + { + keyStr = keyStore.GetLabelFromEnumL( EUserCountry ); + + break; + } + + case EUserCity: + { + keyStr = keyStore.GetLabelFromEnumL( EUserCity ); + + break; + } + + case EBirthday: + { + keyStr = keyStore.GetLabelFromEnumL( EBirthday ); + + break; + } + + case EState: + { + keyStr = keyStore.GetLabelFromEnumL( EState ); + + break; + } + + case EUserEmailAddress: + { + keyStr = keyStore.GetLabelFromEnumL( EUserEmailAddress ); + + break; + } + + case EUserNickName: + { + keyStr = keyStore.GetLabelFromEnumL( EUserNickName ); + + break; + } + + case EOrganisation: + { + keyStr = keyStore.GetLabelFromEnumL( EOrganisation ); + + break; + } + + case EOrganisationUnit: + { + keyStr = keyStore.GetLabelFromEnumL( EOrganisationUnit ); + + break; + } + + case EReadLabel: + { + //If key is not supported(case of not localized string) + keyStr = searchElement->GetSearchLabel().Identity().AllocL(); + + break; + } + default: + { + //If any other case just continue with next one + continue; + } + } + + if ( NULL == keyStr ) + { + continue; + } + //Add key + CleanupStack::PushL( keyStr ); + + charFormatData tmpmsgData = OssProtocolAdapUtils::ConvertTUint16ToCharLC( *keyStr ); + tmpmsg = tmpmsgData.data; + userLen = tmpmsgData.dataSize; + + if ( totalLen + userLen > MAX_MSG_SIZE ) + { + User::Leave(KErrArgument); + } + + memcpy ( smsg + totalLen, tmpmsg, userLen ); + + totalLen += userLen; + + //Add value + + + + charFormatData tmpmsgDataValue = OssProtocolAdapUtils::ConvertTUint16ToCharLC( + searchElement->GetSearchId().Identity() ); + + tmpmsg = tmpmsgDataValue.data; + userLen = tmpmsgDataValue.dataSize; + + if ( totalLen + userLen > MAX_MSG_SIZE ) + { + User::Leave(KErrArgument); + } + + memcpy ( smsg + totalLen, tmpmsg, userLen ); + + totalLen += userLen; + + CleanupStack::PopAndDestroy ( 3 );//For keyStr, tmpmsgData, tmpmsgDataValue + + } // end : for loop + iSendId = iConnMan.DataHandler().SendDataL ( iStatus, smsg, totalLen++ ); + + delete iSearchId; + iSearchId=NULL; + iSearchId=aSearchId.Identity().AllocL(); + // signal the scheduler + SetActive(); + CleanupStack::PopAndDestroy ( 1 );//smsg + LOGGER ( TXT("CSearchrequest::SearchL End") ); + + } + +// --------------------------------------------------------------------------- +// CSearchrequest::SearchUtil +// --------------------------------------------------------------------------- +// +void CSearchrequest::ParseAndSetL(char* aResponse, TInt /*alen*/, MSearchInfo& aSearchInfo, TInfoType aKeytype) + { + char* keyvalue = aResponse; + HBufC16* key_value = OssProtocolAdapUtils::ConvertCharToTUint16LC( keyvalue ); + aSearchInfo.SetFieldInfoL(*key_value,aKeytype); + CleanupStack::PopAndDestroy( key_value ); + } + +// End of file + diff -r 000000000000 -r e6b17d312c8b imservices/ossprotocoladaptation/src/waittimer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/ossprotocoladaptation/src/waittimer.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,1150 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: oss protocol plugin im features +* +*/ + + +#include "waittimer.h" +#include "cosssenddataoperation.h" +#include "msgliterals.h" +#include "msg_enums.h" +#include +#include "ossprotocloliterals.h" +#include "stringutils.h" +#include "ossadappanics.h" +#include +#include +#include +#include "ossprotocolpluginlogger.h" +#include +#include "mossprotocolconnectionmanager.h" +#include "cossprotocolconnectionmanager.h" +#include +#include +#include +#include +#include "ossprotocoladaptutils.h" +// CONSTANTS +const TInt KOpIdInitvalue = 1000; + +#define KTimerInterval 50000 + +#define ONE_K_OPENC_FIX 1020 +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// CWaitTimer::COSSProtocolImFeatures() +// --------------------------------------------------------------------------- +// +CWaitTimer::CWaitTimer (MOSSProtocolConnectionManager& aConnMan) : + CActive ( EPriorityHigh ), // Standard priority + iOpidIterator ( KOpIdInitvalue ), iOpId ( 5 ),iConnMan ( aConnMan ), + iResponseMsgQCreated(EFalse),iServerDisconnected(EFalse), + iFetchingStep(EDataFetchingStep1) // -2 for fetching all three types of contacts + { + CActiveScheduler::Add ( this ); // Add to scheduler + } + + +// --------------------------------------------------------------------------- +// CWaitTimer::NewL() +// --------------------------------------------------------------------------- +// +CWaitTimer* CWaitTimer::NewL (MOSSProtocolConnectionManager& aConnMan) + { + CWaitTimer* self = new ( ELeave ) CWaitTimer (aConnMan); + CleanupStack::PushL ( self ); + self->ConstructL (); + CleanupStack::Pop (); // self; + return self; + } + +// --------------------------------------------------------------------------- +// CWaitTimer::ConstructL() +// --------------------------------------------------------------------------- +// +void CWaitTimer::ConstructL() + { + User::LeaveIfError( iTimer.CreateLocal() ); + } + +// --------------------------------------------------------------------------- +// CWaitTimer::~CWaitTimer() +// --------------------------------------------------------------------------- +// +CWaitTimer::~CWaitTimer() + { + LOGGER ( TXT ( "CWaitTimer::~CWaitTimer start" ) ); + TInt error = 0; + MsgQDelete ( REQUEST_QUEUE, &error ); + MsgQDelete ( RESPONSE_QUEUE, &error ); + iIncomingData.ResetAndDestroy(); + iIncomingMsg.ResetAndDestroy(); + iIncomingPres.ResetAndDestroy(); + iIncomingServerError.ResetAndDestroy(); + iAddNotification.ResetAndDestroy(); + if (iIncReqStatus) + { + User::RequestComplete( iIncReqStatus, KErrCancel ); + iIncReqStatus = NULL; + } + if (iIncMsgReqStatus) + { + User::RequestComplete( iIncMsgReqStatus, KErrCancel ); + iIncMsgReqStatus = NULL; + } + if (iIncPresReqStatus) + { + User::RequestComplete( iIncPresReqStatus, KErrCancel ); + iIncPresReqStatus = NULL; + } + if (iIncAddReqStatus) + { + User::RequestComplete( iIncAddReqStatus, KErrCancel ); + iIncAddReqStatus = NULL; + } + CancelContactsChangeListening(); + Cancel (); // Cancel any request, if outstanding + iTimer.Close (); // Destroy the RTimer object + iOperations.ResetAndDestroy(); + iSearchElements.ResetAndDestroy(); + iContactChangeList.ResetAndDestroy(); + LOGGER ( TXT ( "CWaitTimer::~CWaitTimer end" ) ); + + } + +// --------------------------------------------------------------------------- +// CWaitTimer::DoCancel() +// --------------------------------------------------------------------------- +// +void CWaitTimer::DoCancel() + { + iTimer.Cancel (); + } + +// ---------------------------------------------------------------------------- +// CWaitTimer::IncreaseOpId +// ---------------------------------------------------------------------------- +void CWaitTimer::IncreaseOpId( ) + { + + iOpId++; + + } + + +// ---------------------------------------------------------------------------- +// CWaitTimer::GetOpId +// ---------------------------------------------------------------------------- +TInt CWaitTimer::GetOpId( ) + { + + return iOpId; + } +// ---------------------------------------------------------------------------- +// CWaitTimer::IsFetchingContinue +// ---------------------------------------------------------------------------- +TInt CWaitTimer::IsFetchingContinue( ) + { + + return iFetchingContinue; + + } + +// ----------------------------------------------------------------------------- +// CWaitTimer::SendDataL() +// ----------------------------------------------------------------------------- +// +TInt CWaitTimer::SendDataL ( TRequestStatus& aStatus, char* msg, TInt nBytes ) + { + int result; + int err = 0; + int timeout = NO_WAIT; + LOGGER ( TXT ( "CWaitTimer::SendData start" ) ); + // allocate slot in array by adding NULL pointer and removing it + iOperations.AppendL ( NULL ); + iOperations.Remove ( iOperations.Count() - 1 ); + COssSendDataOperation* operation = + COssSendDataOperation::NewLC(); + operation->SetIds ( iOpId, iOpidIterator++ ); + iOperations.Append ( operation ); + CleanupStack::Pop ( operation ); // operation + // now it is safe to set request status + operation->SetRequestStatus ( aStatus ); + aStatus = KRequestPending; + /* Try to Create queueOne + */ + message_hdr_req* msgHdr = ( message_hdr_req* ) msg; + result = MsgQCreate ( REQUEST_QUEUE, MAX_MSG_Q_SIZE , MSG_Q_FIFO, &err ); + User::LeaveIfError ( result ); + /* Send Message to queueOne */ + if ( msgHdr->message_type == EUpdateOwnAvtar ) + { + TInt header_size = sizeof( message_hdr_req ); + char* one_pdu = ( char* ) User::AllocLC ( ONE_K_OPENC_FIX ); + //run a loop for rest of the data and keep track of the case of nBytes being + //multiple of 1020 - sizeof(msghdr) and it being not + //Amount of payload that can be sent + TInt single_read = ONE_K_OPENC_FIX - header_size; + //Data recieved from PublishOwnPresenceL has message header at begining + TInt actual_data = nBytes - header_size; + //No of packets needed to send the image data + TInt total_packets = (TInt)ceil( ( double ) ( actual_data ) / single_read ); + //This offset moves thru the msg pointer + TInt navigate_offset = header_size; + message_hdr_req msg_hdr; + memset( (void*)&msg_hdr, '\0', header_size ); + msg_hdr.message_type = EUpdateOwnAvtar; + for ( TInt i = 0; i < total_packets; i++ ) + { + //till the last packet size_tobe_sent will be ONE_K_OPENC_FIX + //last packet data is actual_data % single_read if less than single_read else ONE_K_OPENC_FIX + TInt size_tobe_sent = ( i < total_packets - 1 ) ? ONE_K_OPENC_FIX : + ( actual_data % single_read ? + actual_data % single_read + header_size : ONE_K_OPENC_FIX ); + + if ( i < total_packets - 1 ) + { + msg_hdr.continue_flag = 1; + } + else + { + msg_hdr.continue_flag = 0; + } + + //memcpy ( msg + header_size , msg + navigate_offset, size_tobe_sent - header_size ); + memcpy( one_pdu , &msg_hdr, header_size ); + memcpy( one_pdu + header_size, msg + navigate_offset, size_tobe_sent - header_size ); + result = MsgQSend ( REQUEST_QUEUE, one_pdu, size_tobe_sent, + MSG_PRI_NORMAL, timeout, &err ); + User::LeaveIfError ( result ); + navigate_offset += single_read; + } + CleanupStack::PopAndDestroy( one_pdu ); + one_pdu = NULL; + } + else + { + result = MsgQSend ( REQUEST_QUEUE, msg, nBytes, MSG_PRI_NORMAL, timeout, &err ); + + User::LeaveIfError ( result ); + } + LOGGER ( TXT ( "CWaitTimer::SendData end" ) ); + + return iOpId; + + } +// ----------------------------------------------------------------------------- +// CWaitTimer::ListenConatcsChange() //contacts +// ----------------------------------------------------------------------------- +// +void CWaitTimer::ListenContactsChange ( TRequestStatus& aStatus ) + { + LOGGER ( TXT ( "CWaitTimer::ListenContactsChange Start" ) ); + + if ( !iContactsChangeStatus ) + { + iContactsChangeStatus = &aStatus; + aStatus = KRequestPending; + } + LOGGER ( TXT ( "CWaitTimer::ListenContactsChange End" ) ); + } + +// ----------------------------------------------------------------------------- +// CWaitTimer::CancelListening() +// ----------------------------------------------------------------------------- +// +void CWaitTimer::CancelContactsChangeListening() + { + LOGGER ( TXT ( "CWaitTimer::CancelContactsChangeListening Start" ) ); + + if ( iContactsChangeStatus ) + { + User::RequestComplete ( iContactsChangeStatus, KErrCancel ); + iContactsChangeStatus = NULL; + } + + LOGGER ( TXT ( "CWaitTimer::CancelContactsChangeListening End" ) ); + } + + +// ----------------------------------------------------------------------------- +// CWaitTimer::ListenIncomingData() //contacts +// ----------------------------------------------------------------------------- +// +void CWaitTimer::ListenIncomingData ( TRequestStatus& aStatus ) + { + LOGGER ( TXT ( "CWaitTimer::ListenIncomingData Start" ) ); + + if ( !iIncReqStatus ) + { + iIncReqStatus = &aStatus; + aStatus = KRequestPending; + } + } + +// ----------------------------------------------------------------------------- +// CWaitTimer::IncomingDataCount() //contacts +// ----------------------------------------------------------------------------- +// +TInt CWaitTimer::IncomingDataCount() + { + LOGGER ( TXT ( "CWaitTimer::IncomingDataCount Start" ) ); + + return iIncomingData.Count(); + } +// ----------------------------------------------------------------------------- +// CWaitTimer::SearchDataCount() //Searched data +// ----------------------------------------------------------------------------- +// +TInt CWaitTimer::SearchDataCount() + { + return iSearchElements.Count(); + } +// ----------------------------------------------------------------------------- +// CWaitTimer::ContactsChangeResponseCount() //Searched data +// ----------------------------------------------------------------------------- +// +TInt CWaitTimer::ContactsChangeResponseCount() + { + return iContactChangeList.Count(); + } +// ----------------------------------------------------------------------------- +// CWaitTimer::CancelListening() +// ----------------------------------------------------------------------------- +// +void CWaitTimer::CancelListening() + { + LOGGER ( TXT ( "CWaitTimer::CancelListening Start" ) ); + + if ( iIncReqStatus ) + { + User::RequestComplete ( iIncReqStatus, KErrCancel ); + iIncReqStatus = NULL; + } + + LOGGER ( TXT ( "CWaitTimer::CancelListening End" ) ); + } + +// ----------------------------------------------------------------------------- +// CWaitTimer::ListenIncomingMsg() // messages +// ----------------------------------------------------------------------------- +// +TInt CWaitTimer::ListenIncomingMsg ( TRequestStatus& aStatus ) + { + LOGGER ( TXT ( "CWaitTimer::ListenIncomingMsg Start" ) ); + + if ( !iIncMsgReqStatus ) + { + iIncMsgReqStatus = &aStatus; + aStatus = KRequestPending; + } + + LOGGER ( TXT ( "CWaitTimer::ListenIncomingMsg End Count is %d" ), iIncomingMsg.Count() ); + + return iIncomingMsg.Count(); + } + +// ----------------------------------------------------------------------------- +// CWaitTimer::ListenIncomingPresenceL() // presence notifications +// ----------------------------------------------------------------------------- +// +TInt CWaitTimer::ListenIncomingPresence ( TRequestStatus& aStatus ) + { + LOGGER ( TXT ( "CWaitTimer::ListenIncomingPresence Start" ) ); + + if ( !iIncPresReqStatus ) + { + iIncPresReqStatus = &aStatus; + aStatus = KRequestPending; + } + + LOGGER ( TXT ( "CWaitTimer::ListenIncomingPresence End Count is %d" ), iIncomingPres.Count() ); + + return iIncomingPres.Count(); + } +// ----------------------------------------------------------------------------- +// CWaitTimer::ListenAddNotification() // Add contact notifications +// ----------------------------------------------------------------------------- +// +TInt CWaitTimer::ListenAddNotification ( TRequestStatus& aStatus ) + { + LOGGER ( TXT ( "CWaitTimer::ListenAddNotification Start" ) ); + + if ( !iIncAddReqStatus ) + { + iIncAddReqStatus = &aStatus; + aStatus = KRequestPending; + } + + LOGGER ( TXT ( "CWaitTimer::ListenAddNotification End Count is %d" ), iAddNotification.Count() ); + + return iAddNotification.Count(); + } +// ----------------------------------------------------------------------------- +// CWaitTimer::ListenIncomingServerError() // presence notifications +// ----------------------------------------------------------------------------- +// +TInt CWaitTimer::ListenIncomingServerError ( TRequestStatus& aStatus ) + { + LOGGER ( TXT ( "CWaitTimer::ListenIncomingServerError Start" ) ); + + if ( !iIncErrorReqStatus ) + { + iIncErrorReqStatus = &aStatus; + aStatus = KRequestPending; + } + + LOGGER ( TXT ( "CWaitTimer::ListenIncomingServerError End Count is %d" ), iIncomingServerError.Count() ); + + return iIncomingServerError.Count(); + } +// CWaitTimer::CancelListeningMsg() +// ----------------------------------------------------------------------------- +// +void CWaitTimer::CancelListeningMsg() + { + LOGGER ( TXT ( "CWaitTimer::CancelListening Start" ) ); + + if ( iIncMsgReqStatus ) + { + User::RequestComplete ( iIncMsgReqStatus, KErrCancel ); + iIncMsgReqStatus = NULL; + } + + LOGGER ( TXT ( "CWaitTimer::CancelListening End" ) ); + } +// ----------------------------------------------------------------------------- +// CWaitTimer::CancelListeningPres() +// ----------------------------------------------------------------------------- +// +void CWaitTimer::CancelListeningPres() + { + LOGGER ( TXT ( "CWaitTimer::CancelListeningPres Start" ) ); + + if ( iIncPresReqStatus ) + { + User::RequestComplete ( iIncPresReqStatus, KErrCancel ); + iIncPresReqStatus = NULL; + } + + LOGGER ( TXT ( "CWaitTimer::CancelListeningPres End" ) ); + } +// ----------------------------------------------------------------------------- +// CWaitTimer::CancelListeningAddNotication() +// ----------------------------------------------------------------------------- +// +void CWaitTimer::CancelListeningAddNotication() + { + LOGGER ( TXT ( "CWaitTimer::CancelListeningAddNotication Start" ) ); + + if ( iIncAddReqStatus ) + { + User::RequestComplete ( iIncAddReqStatus, KErrCancel ); + iIncAddReqStatus = NULL; + } + + LOGGER ( TXT ( "CWaitTimer::CancelListeningAddNotication End" ) ); + } +// ----------------------------------------------------------------------------- +// CWaitTimer::CancelListeningServerErrors() +// ----------------------------------------------------------------------------- +// +void CWaitTimer::CancelListeningServerErrors() + { + LOGGER ( TXT ( "CWaitTimer::CancelListeningServerErrors Start" ) ); + + if ( iIncErrorReqStatus ) + { + User::RequestComplete ( iIncErrorReqStatus, KErrCancel ); + iIncErrorReqStatus = NULL; + } + + LOGGER ( TXT ( "CWaitTimer::CancelListeningServerErrors End" ) ); + } + +// ----------------------------------------------------------------------------- +// CWaitTimer::StartListeningL() +// ----------------------------------------------------------------------------- +// + +void CWaitTimer::StartListeningL() + { + LOGGER ( TXT ( "CWaitTimer::StartListening Start" ) ); +// Cancel (); // Cancel any request, just to be sure +// iProperty.Subscribe(iStatus); + iTimer.After ( iStatus, KTimerInterval ); + SetActive (); // Tell scheduler a request is active + LOGGER ( TXT ( "CWaitTimer::StartListening End" ) ); + + } + +// ----------------------------------------------------------------------------- +// CWaitTimer::RunL() +// ----------------------------------------------------------------------------- +// + +void CWaitTimer::RunL() + { + + int timeout = IPC_NOWAIT; //TIME_OUT; + int err = 0; + int status = 0; + int size_msg = sizeof ( message_hdr_resp ); + TBool msgreadcontinue = EFalse; + message_hdr_resp* msg_struct = NULL; + char* rmsg = NULL; + + if( !iResponseMsgQCreated ) + { + status = MsgQCreate ( RESPONSE_QUEUE, MAX_MSG_Q_SIZE, MSG_Q_FIFO, &err ); + iResponseMsgQCreated = ETrue; + } + + if(-1 == status) + { + LOGGER ( TXT ( "CWaitTimer::leave " ) ); + User::Leave( status ); + } + do + { + rmsg = ( char* ) User::AllocLC ( MAX_MSG_SIZE ); + + // Receive Message from queueTwo + + status = MsgQReceive ( RESPONSE_QUEUE, rmsg, MAX_MSG_SIZE, timeout, &err ); + User::LeaveIfError ( err ); + //size should be atleast size of message_hdr_resp + if( -1 == status ) + { + CleanupStack::PopAndDestroy ( rmsg ); + } + + if ( status >= size_msg ) + { + LOGGER ( TXT ( "CWaitTimer::MsgQReceive responce recvd" ) ); + msg_struct = ( message_hdr_resp* )rmsg ; + LOGGER ( TXT ( "CWaitTimer::data recvd of type %d" ), msg_struct->hdr_req.message_type ); + + switch( msg_struct->hdr_req.message_type ) + { + TInt operationindex; + case EText_Message_Receive: + { + LOGGER ( TXT ( "CWaitTimer::EText_Message_Receive" ) ); + // complete prfw request + iIncomingMsg.AppendL ( rmsg ); + if ( iIncMsgReqStatus ) + { + User::RequestComplete ( iIncMsgReqStatus, KErrNone ); + iIncMsgReqStatus = NULL; + } + CleanupStack::Pop( rmsg ); + break; + } + case EPresenceNotification: + { + + LOGGER ( TXT ( "CWaitTimer::EPresence_Notification_Received" ) ); + // complete prfw request + // iIncomingPres.AppendL ( rmsg ); + iIncomingPres.Insert (rmsg,0); + if ( iIncPresReqStatus ) + { + User::RequestComplete ( iIncPresReqStatus, KErrNone ); + iIncPresReqStatus = NULL; + } + CleanupStack::Pop( rmsg ); + break; + } + case ETrying_To_Add_Contact_Publish: + { + LOGGER ( TXT ( "CWaitTimer::ETrying_To_Add_Contact" ) ); + // complete prfw request + iAddNotification.AppendL ( rmsg ); + if ( iIncAddReqStatus ) + { + User::RequestComplete ( iIncAddReqStatus, KErrNone ); + iIncAddReqStatus = NULL; + } + CleanupStack::Pop( rmsg ); + break; + } + case ESubscribe_Remote_Pending: + case ETrying_To_Add_Contact_Known: + { + LOGGER ( TXT ( "CWaitTimer::Sync of contacts state" ) ); + iContactChangeList.Append(rmsg); + if ( iContactsChangeStatus ) + { + User::RequestComplete ( iContactsChangeStatus, KErrNone ); + iContactsChangeStatus = NULL; + } + CleanupStack::Pop( rmsg ); + break; + } + + case ESubscribe_RP_Accepted: + { + CleanupStack::PopAndDestroy( rmsg ); + break; + } + case EPublish_RP_Accepted: + { + CleanupStack::PopAndDestroy( rmsg ); + break; + } + case EPublish_Removed_Or_Rejected: + { + LOGGER ( TXT ( "CWaitTimer::Sync of contacts state" ) ); + iContactChangeList.Append(rmsg); + if ( iContactsChangeStatus ) + { + User::RequestComplete ( iContactsChangeStatus, KErrNone ); + iContactsChangeStatus = NULL; + } + CleanupStack::Pop( rmsg ); + break; + } + case ESubscribe_Removed_Or_Rejected: + { + LOGGER ( TXT ( "CWaitTimer::Sync of contacts state" ) ); + iContactChangeList.Append(rmsg); + if ( iContactsChangeStatus ) + { + User::RequestComplete ( iContactsChangeStatus, KErrNone ); + iContactsChangeStatus = NULL; + } + CleanupStack::Pop( rmsg ); + break; + } + case ECurrent_Member_Contacts: + { + iFetchingContinue = EFalse; + // complete ximpfw request + iIncomingData.AppendL ( rmsg ); + if(msg_struct->continue_flag == 1) + { + iFetchingContinue = ETrue; + } + else + { + iFetchingStep++ ; // move to next step + } + + if ( iIncReqStatus && iFetchingStep == EDataFetchComplete )// complete request only if step is 1 + { + User::RequestComplete ( iIncReqStatus, KErrNone ); + iIncReqStatus = NULL; + } + CleanupStack::Pop( rmsg ); + break; + } + case ELocal_Pending_Contacts: + { + LOGGER ( TXT ( "CWaitTimer::ELocal_Pending_Contacts" ) ); + // complete prfw request + iAddNotification.AppendL ( rmsg ); + if ( iIncAddReqStatus ) + { + LOGGER ( TXT ( "CWaitTimer::ELocal_Pending_Contacts" ) ); + User::RequestComplete ( iIncAddReqStatus, KErrNone ); + iIncAddReqStatus = NULL; + } + CleanupStack::Pop( rmsg ); + break; + } + case ERemote_Pending_Contacts: + { + LOGGER ( TXT ( "CWaitTimer::ECurrent_Member_Contacts" ) ); + iFetchingContinue = EFalse; + // complete ximpfw request + iIncomingData.AppendL ( rmsg ); + PendingPresenceContactsL(rmsg); + if(msg_struct->continue_flag == 1) + { + iFetchingContinue = ETrue; + } + else + { + iFetchingStep++ ; // move next step + } + if ( iIncReqStatus && iFetchingStep == EDataFetchComplete) // complete request only if step is 1 + { + User::RequestComplete ( iIncReqStatus, KErrNone ); + iIncReqStatus = NULL; + } + CleanupStack::Pop( rmsg ); + break; + } + case ESend_Error: + { + LOGGER ( TXT ( "CWaitTimer::ESend_Error" ) ); + // complete ximpfw request + iIncomingServerError.AppendL ( rmsg ); + if ( iIncErrorReqStatus ) + { + User::RequestComplete ( iIncErrorReqStatus, KErrNone ); + iIncErrorReqStatus = NULL; + } + CleanupStack::Pop( rmsg ); + break; + } + + case EUserEndGprs: + LOGGER ( TXT ( "CWaitTimer::EUserCancelAccessPoint start" ) ); + + case EServer_DisConnect_Request: + { + iServerDisconnected = ETrue; + LOGGER ( TXT ( "CWaitTimer::EServer_DisConnect_Request start" ) ); + CancelListeningMsg(); + CancelListening(); + CancelListeningPres(); + CancelListeningAddNotication(); + CancelListeningServerErrors(); + CancelContactsChangeListening(); + + MXIMPObjectFactory& prfwObjFact = iConnMan.HandleToHost().ObjectFactory(); + MXIMPStatus* status = prfwObjFact.NewStatusLC();// status + status->SetResultCode( KErrDisconnected ); + iConnMan.HandleToHost().HandleConnectionTerminated( status ); + //IssueReleaseRequestL();//Release the connection + CleanupStack::PopAndDestroy(); // status + CleanupStack::Pop( rmsg ); + LOGGER ( TXT ( "CWaitTimer::EServer_DisConnect_Request end" ) ); + break; + } + case ESearch_State_Finished: + { + LOGGER ( TXT ( "CWaitTimer::ESearch_State_Finished" ) ); + operationindex = ( FindOperationL ( iOpId, COssSendDataOperation::OperationId ) ); + + if ( operationindex != KErrNotFound ) + { + LOGGER ( TXT ( "CWaitTimer::FindOperationL found" ) ); + iOperations[ operationindex ]->SetResponse ( rmsg ); //ownership of rmsg is transferred + iOperations[ operationindex ]->CompletedOperation ( KErrNone ); + } + CleanupStack::Pop( rmsg ); + break; + } + case ESearch: + { + LOGGER ( TXT ( "CWaitTimer::ESearch" ) ); + if ( msg_struct->response != 0 ) + { + LOGGER ( TXT ( "CWaitTimer::ESearch : Result" ) ); + char* pResponse = ( char* ) User::AllocLC ( status ); + memset ( pResponse, '\0', status ); + memcpy ( pResponse, rmsg, status ); + iSearchElements.AppendL ( pResponse ); + CleanupStack::Pop( pResponse ); + CleanupStack::PopAndDestroy( rmsg ); + } + else + { + LOGGER ( TXT ( "CWaitTimer::ESearch: ERROR !!" ) ); + operationindex = ( FindOperationL ( iOpId, COssSendDataOperation::OperationId ) ); + iOperations[ operationindex ]->SetResponse ( rmsg ); //ownership of rmsg is transferred + iOperations[ operationindex ]->CompletedOperation ( KErrNotSupported );// for all errors + CleanupStack::Pop( rmsg ); + // send not supported, since the error mapping is not done + } + break; + } + case ESearch_Get_Keys: + { + + LOGGER ( TXT ( "CWaitTimer::ESearch_Get_Keys" ) ); + operationindex = ( FindOperationL ( iOpId, COssSendDataOperation::OperationId ) ); + + if ( operationindex != KErrNotFound ) + { + LOGGER ( TXT ( "CWaitTimer::FindOperationL found" ) ); + iOperations[ operationindex ]->SetResponse ( rmsg ); //ownership of rmsg is transferred + iOperations[ operationindex ]->CompletedOperation ( KErrNone ); + } + CleanupStack::Pop( rmsg ); + LOGGER ( TXT ( "CWaitTimer::ESearch_Get_Keys end" ) ); + break; + } + case ESearch_State_During : + { + LOGGER ( TXT ( "CWaitTimer::ESearch_State_During" ) ); + iSearchElements.ResetAndDestroy(); + CleanupStack::PopAndDestroy( rmsg ); + LOGGER ( TXT ( "CWaitTimer::ESearch_State_During end" ) ); + break; + } + case EUpdateOwnAvtar : + { + LOGGER ( TXT ( "CWaitTimer::EUpdateOwnAvtar" ) ); + operationindex = ( FindOperationL ( iOpId, COssSendDataOperation::OperationId ) ); + + if ( operationindex != KErrNotFound ) + { + LOGGER ( TXT ( "CWaitTimer::FindOperationL found" ) ); + + iOperations[ operationindex ]->SetResponse ( rmsg ); //ownership of rmsg is transferred + iOperations[ operationindex ]->CompletedOperation ( KErrNone ); + } + CleanupStack::Pop( rmsg ); + break; + } + default: + { + LOGGER ( TXT ( "CWaitTimer::default start" ) ); + operationindex = ( FindOperationL ( iOpId, COssSendDataOperation::OperationId ) ); + + if ( operationindex != KErrNotFound ) + { + LOGGER ( TXT ( "CWaitTimer::FindOperationL found" ) ); + + iOperations[ operationindex ]->SetResponse ( rmsg ); //ownership of rmsg is transferred + iOperations[ operationindex ]->CompletedOperation ( KErrNone ); + } + CleanupStack::Pop( rmsg ); + LOGGER ( TXT ( "CWaitTimer::default end" ) ); + break; + } + } + + TInt pendingMsgCount = MsgQCheck(RESPONSE_QUEUE, &err ); + if( pendingMsgCount > 0) + { + msgreadcontinue = ETrue; + } + else + { + msgreadcontinue = EFalse; + } + LOGGER ( TXT ( "CWaitTimer::pendingMsgCount is %d" ), pendingMsgCount ); + } + }while( msgreadcontinue ); + /* + // there is no pending message in msgqueue, + // set active and subscribe for incomming queue message + iProperty.Subscribe(iStatus); + SetActive(); // Tell scheduler a request is active */ + + iTimer.After( iStatus, KTimerInterval ); + SetActive(); + } +// ----------------------------------------------------------------------------- +// CWaitTimer::PendingPresenceContactsL() +// ----------------------------------------------------------------------------- +// +void CWaitTimer::PendingPresenceContactsL(char* aRmessage) + { + char* prmsg = NULL; + prmsg = aRmessage; + HBufC16 *contactName = NULL; + HBufC* name = NULL; + int len = 0; + if( aRmessage ) + { + prmsg += sizeof ( message_hdr_resp ); + MPresenceBuddyInfo2* buddyPresInfo = MPresenceBuddyInfo2::NewLC(); + + MPresenceCacheWriter2* presenceCacheWriter = MPresenceCacheWriter2::CreateWriterL(); + CleanupDeletePushL(presenceCacheWriter); + while(1) + { + len = strlen(prmsg) + 1; + if (1 == len) + { + break; + } + char* contact = prmsg; + prmsg += len; + + contactName = OssProtocolAdapUtils::ConvertCharToTUint16LC( contact ); + LOGGER ( TXT ( "CWaitTimer::PendingPresenceContacts:ContactName:%S " ), contactName ); + + // contacts.AppendL(contactName); + name = HBufC::NewLC( contactName->Length() + iConnMan.ServiceName().Length() + KColon().Length() ); + TPtr namePtr( name->Des() ); + namePtr.Zero(); + namePtr.Append(iConnMan.ServiceName() ); // prepend service name + namePtr.Append(KColon); + namePtr.Append(contactName->Des() ); + buddyPresInfo->SetIdentityL(namePtr); + LOGGER ( TXT ( "CPresenceNotificationHandler::ProcessIncomingDataL :ContactName:%S " ), contactName ); + + buddyPresInfo->SetAnyFieldL(KExtensionKey,KPendingRequestExtensionValue()); + CleanupStack::PopAndDestroy(2);//name,contactName + name = NULL; + contactName = NULL; + // Writing into Presence Cache + TInt cacheerror = presenceCacheWriter->WritePresenceL(buddyPresInfo); + User::LeaveIfError ( cacheerror); + + } + CleanupStack::PopAndDestroy(2);//presenceCacheWriter,buddyPresInfo + + } + } +// ----------------------------------------------------------------------------- +// CWaitTimer::ResponseL() +// ----------------------------------------------------------------------------- +// + +char* CWaitTimer::ResponseL ( TInt aTransId ) + { + + if ( aTransId == 0 ) // for contact list + { + if ( iIncomingData.Count() == 0 ) + { + User::Leave ( KErrNotFound ); + } + + // take first one from the array + char* buff = iIncomingData[ 0 ]; + + iIncomingData.Remove ( 0 ); + iIncomingData.Compress(); + return buff; + } + + if ( aTransId == 1 ) //for receive message + { + if ( iIncomingMsg.Count() == 0 ) + { + User::Leave ( KErrNotFound ); + } + + // take first one from the array + char* buff = iIncomingMsg[ 0 ]; + + iIncomingMsg.Remove ( 0 ); + + return buff; + } + if ( aTransId == 2 ) //for presence notifications + { + TInt pCount = iIncomingPres.Count(); + + if ( pCount == 0 ) + { + User::Leave ( KErrNotFound ); + } + + // take first one from the array + char* buff = iIncomingPres[ pCount-1 ]; + + iIncomingPres.Remove ( pCount-1 ); + iIncomingPres.Compress(); + return buff; + } + if ( aTransId == 3 ) //for send error + { + if ( iIncomingServerError.Count() == 0 ) + { + User::Leave ( KErrNotFound ); + } + + // take first one from the array + char* buff = iIncomingServerError[ 0 ]; + + iIncomingServerError.Remove ( 0 ); + + return buff; + } + if ( aTransId == 4 ) //for Add notifications + { + if ( iAddNotification.Count() == 0 ) + { + User::Leave ( KErrNotFound ); + } + + // take first one from the array + char* buff = iAddNotification[ 0 ]; + + iAddNotification.Remove ( 0 ); + + return buff; + } + if( aTransId == 5 ) // search results + { + // take first one from the array + char* buff=NULL; + + if ( iSearchElements.Count() != 0 ) + { + buff = iSearchElements[ 0 ]; + iSearchElements.Remove ( 0 ); + iSearchElements.Compress(); + } + else + { + TInt x ( FindOperationL ( 6, COssSendDataOperation::OperationId ) ); + if( x != -1) + { // is operation completed? + TRequestStatus* status = iOperations[ x ]->Status(); + + if ( status && ( *status == KRequestPending ) ) + { + User::Leave ( KErrNotReady ); + } + delete iOperations[ x ]; + iOperations.Remove ( x ); + } + + } + + return buff; // return the buffer + } + if ( aTransId == 200 ) //for contact sync + { + if ( iContactChangeList.Count() == 0 ) + { + User::Leave ( KErrNotFound ); + } + + // take first one from the array + char* buff = iContactChangeList[ 0 ]; + + iContactChangeList.Remove ( 0 ); + iContactChangeList.Compress(); + return buff; + } + // try to find operation + TInt x ( FindOperationL ( aTransId, COssSendDataOperation::OperationId ) ); + + // is operation completed? + TRequestStatus* status = iOperations[ x ]->Status(); + + if ( status && ( *status == KRequestPending ) ) + { + User::Leave ( KErrNotReady ); + } + + char* buff = iOperations[ x ]->Response(); + + delete iOperations[ x ]; + iOperations.Remove ( x ); + return buff; + } + +// ----------------------------------------------------------------------------- +// CWaitTimer::RunError() +// ----------------------------------------------------------------------------- +// + +TInt CWaitTimer::RunError ( TInt aError ) + { + return aError; + } + +// ============================================================================= +// =============== New private Functions of the base class ===================== +// ============================================================================= + +// ----------------------------------------------------------------------------- +// CWaitTimer::FindOperation() +// Find operation in array +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt CWaitTimer::FindOperation ( + TInt aOpId, + TInt ( COssSendDataOperation:: *aIdFunc ) () const ) const + { + LOGGER ( TXT ( "CWaitTimer::FindOperation Start" ) ); + TInt count ( iOperations.Count() ); + + for ( TInt x ( 0 ) ; x < count ; ++x ) + { + if ( aOpId == ( ( *iOperations[ x ] ).*aIdFunc ) () ) + { + LOGGER ( TXT ( "CWaitTimer::FindOperation Returns %d" ), x ); + return x; + } + } + + LOGGER ( TXT ( "CWaitTimer::FindOperation End" ) ); + + return KErrNotFound; + } + +// ----------------------------------------------------------------------------- +// CWaitTimer::FindOperationL() +// Find operation in array, leave if not found +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt CWaitTimer::FindOperationL ( + TInt aOpId, + TInt ( COssSendDataOperation:: *aIdFunc ) () const ) const + { + LOGGER ( TXT ( "CWaitTimer::FindOperation Start" ) ); + TInt x ( FindOperation ( aOpId, aIdFunc ) ); + + LOGGER ( TXT ( "CWaitTimer::FindOperation End Returns %d" ), x ); + + return x; + } + +// ----------------------------------------------------------------------------- +// CWaitTimer::IssueReleaseRequestL() +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +void CWaitTimer::IssueReleaseRequestL() + { + LOGGER ( TXT ( "CWaitTimer::IssueReleaseRequestL Start" ) ); + int err = 0; + int timeout = NO_WAIT; + message_hdr_req *msgHdr = NULL; + msgHdr = ( message_hdr_req* ) User::AllocLC(sizeof ( message_hdr_req )); + memset ( msgHdr, '\0', sizeof ( message_hdr_req ) ); + msgHdr->message_type = EKill_Process; + + TInt nBytes = sizeof ( message_hdr_req ); + + MsgQCreate ( REQUEST_QUEUE, MAX_MSG_Q_SIZE , MSG_Q_FIFO, &err ); + + MsgQSend ( REQUEST_QUEUE, ( char* ) msgHdr , nBytes, MSG_PRI_NORMAL, timeout, &err ); + + CleanupStack::PopAndDestroy ( msgHdr ); + + LOGGER ( TXT ( "CWaitTimer::IssueReleaseRequestL end" ) ); + + } +// --------------------------------------------------------------------------- +// CWaitTimer::IsServerDisconnect() +// --------------------------------------------------------------------------- +// +TBool CWaitTimer::IsServerDisconnect() + { + return iServerDisconnected; + } +// --------------------------------------------------------------------------- +// CWaitTimer::IsFetchContactsCompleted() +// --------------------------------------------------------------------------- +// +TBool CWaitTimer::IsFetchContactsCompleted() + { + if(iFetchingStep == EDataFetchComplete) + { + return ETrue; + } + return EFalse; + } + + +// End of file diff -r 000000000000 -r e6b17d312c8b imservices/ossprotocoladaptation/tsrc/ossadapmt/bmarm/ossadapmtu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/ossprotocoladaptation/tsrc/ossadapmt/bmarm/ossadapmtu.def Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + LibEntryL__FR13CTestModuleIf @ 1 NONAME R3UNUSED ; LibEntryL(CTestModuleIf &) + diff -r 000000000000 -r e6b17d312c8b imservices/ossprotocoladaptation/tsrc/ossadapmt/bwins/ossadapmtu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/ossprotocoladaptation/tsrc/ossadapmt/bwins/ossadapmtu.def Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + ?LibEntryL@@YAPAVCScriptBase@@AAVCTestModuleIf@@@Z @ 1 NONAME ; class CScriptBase * __cdecl LibEntryL(class CTestModuleIf &) + diff -r 000000000000 -r e6b17d312c8b imservices/ossprotocoladaptation/tsrc/ossadapmt/conf/ossadapmt.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/ossprotocoladaptation/tsrc/ossadapmt/conf/ossadapmt.cfg Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,665 @@ +// Definitions +[Define] +SERVER chat.gizmoproject.com +//USERNAME testlmnokia@chat.gizmoproject.com +//PASSWORD loudmouth +RECIPIENT basu.bellary@gmail.com +MESSAGE Hello +RESOURCE mytest12345rt + +USERNAME ximptelepathy@gmail.com +PASSWORD tele1236 +SETTINGSID 3 +SERVICE_ID 3 +InvalidSettingsId -100 +UnexistJID testlmnokia1111@chat.gizmoproject.com +badpassword 12345 +badserver chat.gizmoprojeeeect.com +UsernameWithBadServer testlmnokia@chat.gizmoprojeeeeect.com +SpecialUSERNAME im:here%27s_a_wild_%26_%2Fcr%zy%2F_address@chat.gizmoproject.com +LONGUSERNAME im:here%27s_a_wild_%26_%2Fcr%zy%2F_address_here%27s_a_wild_%26_%2Fcr%zy%2F_address_here%27s_a_wild_%26_%2Fcr%zy%2F_address@chat.gizmoproject.com +LONGPASSWORD loudmouthloudmouthloudmouthloudmouthloudmouthloudmouthloudmouthloudmouthloudmouthloudmouthloudmouth +LONGMESSAGE HelloworldHelloworldHelloworldHelloworldHelloworldHelloworldHelloworldHelloworldHelloworlsfsdfdgdfgdfgdfgdfgdf +REPEATEDMESSAGE RepeatingHello +SMILEYMESSAGE :):-);-):-D:D:-(:( + +LONGGMAILUSERID abcd123456abcd123456abcd123456 +GMAILPWD nokia123 + +//PROXY_SERVER 172.16.42.135 +PROXY_SERVER 172.16.9.182 +PROXY_PORT 8080 + +WrongPassword wrongpassword +NoContactUserName emptycontactlist@gmail.com +NoContactPassword emptylist +300contactsUsername rakesh.harsh@gmail.com +300contactsPassword live_life +InvalidUserName invalidxmppid@gmail.com +CapitalUserName XIMPTELEPATHY@gmail.com +MixedUserName XIMPteLePathy@gmail.com +MaxCharUserName abcd123456abcd123456abcd123456@gmail.com +MaxCharIdPassword nokia123 +MaxCharExceedUserName abcd123456abcd123456abcd123456abcd123456abcd123456@gmail.com +MinCharUserName ab123d@gmail.com +MinCharIdPassword nokia123 +LessthanMincharUserName #*%4@gmail.com +BlankUserName " " +UserNamewithspace ximptelepathy @gmail.com +SpecialCharUserName #$%^&*(*&^$#@gmail.com +WrongDomainUserName ximptelepathy@hello.com +//contact management +Validcontact tele1236@gmail.com +NonExistingContact invalidxmppid@gmail.com +BlankContact " " +NonDomainUserName amsmartuknow + + +Message Hello +MsgSpecialChars #^(&$@!~`+_)/>.,<|%25? +450CharLenghthMsg abcdefghij1234567890abcdefghij1234567890\abcdefghij1234567890abcdefghij1234567890abcdefghij1234567890\abcdefghij1234567890abcdefghij1234567890abcdefghij1234567890abcdefghij1234567890\abcdefghij1234567890abcdefghij1234567890abcdefghij1234567890\ + +BlankMsg ' ' +Recipient junk1236@gmail.com +Recipient1 basu.bellary@gmail.com +Recipient2 ximptelepathy@gmail.com +Recipient3 me.papillon@gmail.com +InvalidRecipientId invalidxmppid@gmail.com +OfflineContact offline45@gmail.com + +statustext i am always available +InstantMessaging instant-messaging +DeviceName mobile_phone +Onlinestatus T +UserAvailibility1 0 //NPresenceInfo::ENotAvailable +UserAvailibility2 1 //NPresenceInfo::EBusy +UserAvailibility3 2 //0NPresenceInfo::EAvailable +UserAvailibilityText1 I am available +UserAvailibilityText2 I am busy +UserAvailibilityText3 I am away +Language PreferredLanguage +StatusContentfield StatusContent +DirectContentfield DirectContent +ContentTypefield, ContentType + +// ClientInfo attribute value tags +ClientInfo ClientInfo +ClientType ClientType +ClientLanguage Language +DevManufacturer DevManufacturer +ClientProducer ClientProducer +DeviceModel Model +ClientVersion ClientVersion +ClientTypeMobilePhone MOBILE_PHONE +ClientTypeComputer COMPUTER +ClientTypePDA PDA +ClientTypeCLI CLI +ClientTypeOther OTHER + +StatusMoodfield StatusMood +Aliasfield Alias +Age Age + +//Presence Attributes +Registration Registration +TimeZone TimeZone +GeoLocation GeoLocation +Address Address +FreeTextLocation FreeTextLocation +Plmn PLMN +PreferredContacts PreferredContacts +PreferredLanguage PreferredLanguage +StatusMood StatusMood +ContactInfo ContactInfo + +// StatusText attribute value tags +StatusTextfield StatusText + +// Online Status attribute value tags +OnlineStatusfield OnlineStatus + + +//avtar file +AVATARFILE C:\data\Images\test.jpg + +[Enddefine] +// ossadaptation related test cases + + +[Test] +title GetSearchKeyEnumL +create ossadapmt ossadap +ossadap GetSearchKeyEnumL USERNAME PASSWORD SETTINGSID +delete ossadap +[Endtest] + + +[Test] +title GetSearchKeyLabelL +create ossadapmt ossadap +ossadap GetSearchKeyLabelL USERNAME PASSWORD SETTINGSID +delete ossadap +[Endtest] + + +[Test] +title GetSearchKeyEnumNLabelL +create ossadapmt ossadap +ossadap GetSearchKeyEnumNLabelL USERNAME PASSWORD SETTINGSID +delete ossadap +[Endtest] + + +[Test] +title SecondSearchL +create ossadapmt ossadap +ossadap SecondSearchL USERNAME PASSWORD SERVICE_ID Message Recipient Validcontact +delete ossadap +[Endtest] + + + +[Test] +title SearchAndAddToIML +create ossadapmt ossadap +ossadap SearchAndAddToIML USERNAME PASSWORD SERVICE_ID Message Recipient Validcontact +delete ossadap +[Endtest] + +[Test] +title Login +create ossadapmt ossadap +ossadap Login USERNAME PASSWORD SERVICE_ID +delete ossadap +[Endtest] + +[Test] +title LoginInvalidUser +create ossadapmt ossadap +ossadap Login_InvalidData InvalidUserName PASSWORD SERVICE_ID +delete ossadap +[Endtest] + +[Test] +title LoginWrongPassword +create ossadapmt ossadap +ossadap Login_InvalidData USERNAME WrongPassword SERVICE_ID +delete ossadap +[Endtest] +[Test] +title Login_Logout_sequential +create ossadapmt ossadap +ossadap Login_Logout_sequential USERNAME PASSWORD SERVICE_ID +delete ossadap +[Endtest] + +[Test] +title LoginUserIdCapital +create ossadapmt ossadap +ossadap Login CapitalUserName PASSWORD SERVICE_ID +delete ossadap +[Endtest] + +[Test] +title LoginMixedLetterId +create ossadapmt ossadap +ossadap Login MixedUserName PASSWORD SERVICE_ID +delete ossadap +[Endtest] + +[Test] +title LoginMaxCharId +create ossadapmt ossadap +ossadap Login MaxCharUserName MaxCharIdPassword SERVICE_ID +delete ossadap +[Endtest] + +[Test] +title LoginMaxCharExceeded +create ossadapmt ossadap +ossadap Login_InvalidData MaxCharExceedUserName WrongPassword SERVICE_ID +delete ossadap +[Endtest] + +[Test] +title LoginMinCharId +create ossadapmt ossadap +ossadap Login MinCharUserName MinCharIdPassword SERVICE_ID +delete ossadap +[Endtest] + +[Test] +title LoginLessthanMinCharId +create ossadapmt ossadap +ossadap Login_InvalidData LessthanMincharUserName MinCharIdPassword SERVICE_ID +delete ossadap +[Endtest] + +[Test] +title LoginBlankUserId +create ossadapmt ossadap +ossadap Login_InvalidData BlankUserName MinCharIdPassword SERVICE_ID +delete ossadap +[Endtest] + +[Test] +title LoginUserIdwithSpace +create ossadapmt ossadap +ossadap Login_InvalidData UserNamewithspace PASSWORD SERVICE_ID +delete ossadap +[Endtest] + +[Test] +title LoginInvalidSettingsId +create ossadapmt ossadap +ossadap Login_InvalidData USERNAME PASSWORD InvalidSettingsId +delete ossadap +[Endtest] + +[Test] +title Unbind +create ossadapmt ossadap +ossadap Unbind USERNAME PASSWORD SERVICE_ID +delete ossadap +[Endtest] + +[Test] +title Get contacts +create ossadapmt ossadap +ossadap GetContacts USERNAME PASSWORD SERVICE_ID +delete ossadap +[Endtest] + +[Test] +title Fetch_300_Contacts +create ossadapmt ossadap +ossadap GetContacts 300contactsUsername 300contactsPassword SERVICE_ID +delete ossadap +[Endtest] + +[Test] +title FetchEmptyContactList +create ossadapmt ossadap +ossadap GetContacts NoContactUserName NoContactPassword SERVICE_ID +delete ossadap +[Endtest] + +[Test] +title Send message +create ossadapmt ossadap +ossadap Sendmessage USERNAME PASSWORD SERVICE_ID Message Recipient +delete ossadap +[Endtest] + +[Test] +title Send empty message +create ossadapmt ossadap +ossadap Sendemptymessage USERNAME PASSWORD SERVICE_ID Recipient +delete ossadap +[Endtest] + +[Test] +title Sendmessage_invaliduserid +create ossadapmt ossadap +ossadap Sendmessage USERNAME PASSWORD SERVICE_ID Message InvalidRecipientId +delete ossadap +[Endtest] + +[Test] +title Sendmessage_specialchars +create ossadapmt ossadap +ossadap Sendmessage USERNAME PASSWORD SERVICE_ID MsgSpecialChars Recipient +delete ossadap +[Endtest] + +[Test] +title Sendmessage_offlinecontact +create ossadapmt ossadap +ossadap Sendmessage USERNAME PASSWORD SERVICE_ID Message OfflineContact +delete ossadap +[Endtest] + +[Test] +title Sendmessage_longmessage +create ossadapmt ossadap +ossadap Sendmessage USERNAME PASSWORD SERVICE_ID LongMsg Recipient +delete ossadap +[Endtest] + +[Test] +title Send_450_char_message +create ossadapmt ossadap +ossadap Sendmessage USERNAME PASSWORD SERVICE_ID 450CharLenghthMsg Recipient +delete ossadap +[Endtest] + +[Test] +title Send_ten_messages +create ossadapmt ossadap +ossadap Send_ten_messages USERNAME PASSWORD SERVICE_ID Message Recipient +delete ossadap +[Endtest] + +[Test] +title Send_twenty_messages +create ossadapmt ossadap +ossadap Send_twenty_messages USERNAME PASSWORD SERVICE_ID Message Recipient +delete ossadap +[Endtest] + +[Test] +title Sendmessage_multiplecontacts +create ossadapmt ossadap +ossadap Sendmessage_multiplecontacts USERNAME PASSWORD SERVICE_ID Message Recipient Recipient1 Recipient2 Recipient3 +delete ossadap +[Endtest] + +[Test] +title Receivemessage +create ossadapmt ossadap +ossadap Receivemessage USERNAME PASSWORD SERVICE_ID Message +delete ossadap +[Endtest] + +[Test] +title Receiveemptymessage +create ossadapmt ossadap +ossadap Receiveemptymessage USERNAME PASSWORD SERVICE_ID +delete ossadap +[Endtest] + +[Test] +title Receivelongmessage +create ossadapmt ossadap +ossadap Receivemessage USERNAME PASSWORD SERVICE_ID Message +delete ossadap +[Endtest] + +[Test] +title Receive_450_char_message +create ossadapmt ossadap +ossadap Receivemessage USERNAME PASSWORD SERVICE_ID Message +delete ossadap +[Endtest] + +[Test] +title Receivemessage_specialchars +create ossadapmt ossadap +ossadap Receivemessage USERNAME PASSWORD SERVICE_ID Message +delete ossadap +[Endtest] + +[Test] +title Receive_ten_messages +create ossadapmt ossadap +ossadap Receive_ten_messages USERNAME PASSWORD SERVICE_ID Message +delete ossadap +[Endtest] + +[Test] +title Receive_twenty_message +create ossadapmt ossadap +ossadap Receive_twenty_message USERNAME PASSWORD SERVICE_ID Message +delete ossadap +[Endtest] + +[Test] +title Add_valid_conatct +create ossadapmt ossadap +ossadap Add_conatct USERNAME PASSWORD SERVICE_ID Validcontact +delete ossadap +[Endtest] + +[Test] +title AddNonExistingContact +create ossadapmt ossadap +ossadap Add_conatct USERNAME PASSWORD SERVICE_ID NonExistingContact +delete ossadap +[Endtest] + +[Test] +title AddMaxCharContact +create ossadapmt ossadap +ossadap Add_conatct USERNAME PASSWORD SERVICE_ID MaxCharUserName +delete ossadap +[Endtest] + +[Test] +title AddMoreThanMaxCharContact +create ossadapmt ossadap +ossadap Add_conatct USERNAME PASSWORD SERVICE_ID MaxCharExceedUserName +delete ossadap +[Endtest] + +[Test] +title AddMinCharContact +create ossadapmt ossadap +ossadap Add_conatct USERNAME PASSWORD SERVICE_ID MinCharUserName +delete ossadap +[Endtest] + +[Test] +title AddLessThanMinCharContact +create ossadapmt ossadap +ossadap Add_conatct USERNAME PASSWORD SERVICE_ID LessthanMincharUserName +delete ossadap +[Endtest] + +[Test] +title AddSpecialCharInvalidContact +create ossadapmt ossadap +ossadap Add_conatct USERNAME PASSWORD SERVICE_ID SpecialCharUserName +delete ossadap +[Endtest] + +[Test] +title AddBlankContact +create ossadapmt ossadap +ossadap Add_Blank_Conatct USERNAME PASSWORD SERVICE_ID +delete ossadap +[Endtest] + + +[Test] +title AddWithoutDomainContact +create ossadapmt ossadap +ossadap Add_conatct USERNAME PASSWORD SERVICE_ID NonDomainUserName +delete ossadap +[Endtest] + +[Test] +title AddAlreadyAddedConatct +create ossadapmt ossadap +ossadap Add_conatct USERNAME PASSWORD SERVICE_ID Validcontact +delete ossadap +[Endtest] + +[Test] +title AddWrongDomainContactL +create ossadapmt ossadap +ossadap Add_conatct USERNAME PASSWORD SERVICE_ID WrongDomainUserName +delete ossadap +[Endtest] + +[Test] +title Delete_valid_conatct +create ossadapmt ossadap +ossadap Delete_conatct USERNAME PASSWORD SERVICE_ID Validcontact +delete ossadap +[Endtest] + + +[Test] +title DeleteNonExistingContact +create ossadapmt ossadap +ossadap Delete_conatct USERNAME PASSWORD SERVICE_ID NonExistingContact +delete ossadap +[Endtest] + +[Test] +title DeleteMaxCharContact +create ossadapmt ossadap +ossadap Delete_conatct USERNAME PASSWORD SERVICE_ID MaxCharUserName +delete ossadap +[Endtest] + +[Test] +title DeleteMoreThanMaxCharContact +create ossadapmt ossadap +ossadap Delete_conatct USERNAME PASSWORD SERVICE_ID MaxCharExceedUserName +delete ossadap +[Endtest] + +[Test] +title DeleteMinCharContact +create ossadapmt ossadap +ossadap Delete_conatct USERNAME PASSWORD SERVICE_ID MinCharUserName +delete ossadap +[Endtest] + +[Test] +title DeleteLessThanMinxCharContact +create ossadapmt ossadap +ossadap Delete_conatct USERNAME PASSWORD SERVICE_ID LessthanMincharUserName +delete ossadap +[Endtest] + +[Test] +title DeleteSpecialCharInvalidContact +create ossadapmt ossadap +ossadap Delete_conatct USERNAME PASSWORD SERVICE_ID SpecialCharUserName +delete ossadap +[Endtest] + +[Test] +title DeleteBlankContact +create ossadapmt ossadap +ossadap Delete_Blank_Conatct USERNAME PASSWORD SERVICE_ID +delete ossadap +[Endtest] + +[Test] +title DeleteWithoutDomainContact +create ossadapmt ossadap +ossadap Delete_conatct USERNAME PASSWORD SERVICE_ID NonDomainUserName +delete ossadap +[Endtest] + +[Test] +title DeleteWrongDomainContact +create ossadapmt ossadap +ossadap Delete_conatct USERNAME PASSWORD SERVICE_ID WrongDomainUserName +delete ossadap +[Endtest] + +[Test] +title Publish_ownpresence_available +create ossadapmt ossadap +ossadap Publish_ownpresence USERNAME PASSWORD SERVICE_ID UserAvailibility1 UserAvailibilityText1 +delete ossadap +[Endtest] + +[Test] +title Publish_ownpresence_busy +create ossadapmt ossadap +ossadap Publish_ownpresence USERNAME PASSWORD SERVICE_ID UserAvailibility2 UserAvailibilityText2 +delete ossadap +[Endtest] + +[Test] +title Publish_ownpresence_not_available +create ossadapmt ossadap +ossadap Publish_ownpresence USERNAME PASSWORD SERVICE_ID UserAvailibility3 UserAvailibilityText3 +delete ossadap +[Endtest] + +[Test] +title Publish_ownpresence_emptytext +create ossadapmt ossadap +ossadap Publish_ownpresence_emptytext USERNAME PASSWORD SERVICE_ID UserAvailibility3 +delete ossadap +[Endtest] + +[Test] +title AcceptAddnotificationRequest +create ossadapmt ossadap +ossadap AcceptnotificationRequest USERNAME PASSWORD SERVICE_ID +delete ossadap +[Endtest] + +[Test] +title RejectAddnotificationRequest +create ossadapmt ossadap +ossadap RejectAddnotificationRequest USERNAME PASSWORD SERVICE_ID +delete ossadap +[Endtest] + +[Test] +title ImOperations_Coverage +create ossadapmt ossadap +ossadap ImOperations_Coverage USERNAME PASSWORD SERVICE_ID Message Recipient Validcontact +delete ossadap +[Endtest] + +[Test] +title SimpleSearchL +create ossadapmt ossadap +ossadap SimpleSearchL USERNAME PASSWORD SERVICE_ID Message Recipient Validcontact +delete ossadap +[Endtest] + +[Test] +title MultipleSearchL +create ossadapmt ossadap +ossadap MultipleSearchL USERNAME PASSWORD SERVICE_ID Message Recipient Validcontact +delete ossadap +[Endtest] + +[Test] +title NoResultSearchL +create ossadapmt ossadap +ossadap NoResultSearchL USERNAME PASSWORD SERVICE_ID Message Recipient Validcontact +delete ossadap +[Endtest] + +[Test] +title ManyResultsSearchL +create ossadapmt ossadap +ossadap ManyResultsSearchL USERNAME PASSWORD SERVICE_ID Message Recipient Validcontact +delete ossadap +[Endtest] + +[Test] +title BlankSearchL +create ossadapmt ossadap +ossadap BlankSearchL USERNAME PASSWORD SERVICE_ID Message Recipient Validcontact +delete ossadap +[Endtest] + +[Test] +title MaxCharSearchL +create ossadapmt ossadap +ossadap MaxCharSearchL USERNAME PASSWORD SERVICE_ID Message Recipient Validcontact +delete ossadap +[Endtest] + +[Test] +title SpecialCharSearchL +create ossadapmt ossadap +ossadap SpecialCharSearchL USERNAME PASSWORD SERVICE_ID Message Recipient Validcontact +delete ossadap +[Endtest] + +[Test] +title SearchEmailIDL +create ossadapmt ossadap +ossadap SearchEmailIDL USERNAME PASSWORD SERVICE_ID Message Recipient Validcontact +delete ossadap +[Endtest] + +[Test] +title Set_Avtar +create ossadapmt ossadap +ossadap SetAvtar USERNAME PASSWORD SERVICE_ID AVATARFILE +delete ossadap +[Endtest] diff -r 000000000000 -r e6b17d312c8b imservices/ossprotocoladaptation/tsrc/ossadapmt/eabi/ossadapmtu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/ossprotocoladaptation/tsrc/ossadapmt/eabi/ossadapmtu.def Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + _Z9LibEntryLR13CTestModuleIf @ 1 NONAME + diff -r 000000000000 -r e6b17d312c8b imservices/ossprotocoladaptation/tsrc/ossadapmt/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/ossprotocoladaptation/tsrc/ossadapmt/group/bld.inf Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,54 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: bld.inf +* +*/ + + + +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/ossadapmt.cfg /epoc32/winscw/c/TestFramework/ossadapmt.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 +// NOTE: If using ARS requirements .mmp file operation should be done under this. +// 'abld test build' +ossadapmt.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. + + + + +// End of File \ No newline at end of file diff -r 000000000000 -r e6b17d312c8b imservices/ossprotocoladaptation/tsrc/ossadapmt/group/ossadapmt.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/ossprotocoladaptation/tsrc/ossadapmt/group/ossadapmt.mmp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,87 @@ +/* +* Copyright (c) 2007 - 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ossadapmt.mmp +* +*/ + + +#if defined(__S60_) + // To get the OSEXT_LAYER_SYSTEMINCLUDE-definition + #include +#endif + +TARGET ossadapmt.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 ossadapmt.def + +SOURCEPATH ../src +SOURCE ossadapmt.cpp +SOURCE ossadapmtBlocks.cpp +SOURCE uscontextobserver.cpp +//RESOURCE resource_file +//RESOURCE resource_file2 + +USERINCLUDE ../inc + +SYSTEMINCLUDE /epoc32/include/ecom + +MW_LAYER_SYSTEMINCLUDE + + +LIBRARY euser.lib +LIBRARY stiftestinterface.lib +LIBRARY bafl.lib +LIBRARY aknnotify.lib +LIBRARY efsrv.lib +LIBRARY commdb.lib +LIBRARY stiftestengine.lib +LIBRARY flogger.lib +LIBRARY ecom.lib +LIBRARY ximpdatamodel.lib +LIBRARY charconv.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 000000000000 -r e6b17d312c8b imservices/ossprotocoladaptation/tsrc/ossadapmt/group/ossadaptmt.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/ossprotocoladaptation/tsrc/ossadapmt/group/ossadaptmt.pkg Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,41 @@ +; +; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +; All rights reserved. +; This component and the accompanying materials are made available +; under the terms of "Eclipse Public License v1.0" +; which accompanies this distribution, and is available +; at the URL "http://www.eclipse.org/legal/epl-v10.html". +; +; Initial Contributors: +; Nokia Corporation - initial contribution. +; +; Contributors: +; +; Description: ossadaptmt.pkg +; +;Header +#{"TestOssAdaptation"}, (0x101FB3E3), 1, 2, 3, TYPE=SP + +;Language - standard language definitions +&EN + +;Vendor ID +:"Nokia Corporation" + +;Localised vendor +%{"Vendor-EN"} + +;Supports Series 60 v 0.9 +[0x101F7961], 0, 0, 0, {"Series60ProductID"} + + +;INI FILE +"..\init\testframework.ini" -"c:\Testframework\testframework.ini" + +;CFG FILES +"..\conf\ossadapmt.cfg" -"c:\Testframework\ossadapmt.cfg" + +;ossadaptmt_test dll files + +"\EPOC32\RELEASE\ARMV5\UREL\ossadapmt.dll" -"!:\sys\bin\ossadapmt.dll" + diff -r 000000000000 -r e6b17d312c8b imservices/ossprotocoladaptation/tsrc/ossadapmt/inc/cuserafter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/ossprotocoladaptation/tsrc/ossadapmt/inc/cuserafter.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,159 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Active object based wait. +* +*/ + +#ifndef CUSERAFTER_H__ +#define CUSERAFTER_H__ + +// INCLUDES +#include + + +// CLASS DESCRIPTION + +/** + * Active object based wait. + * + * Similar like User::After() but doesn't block + * whole thread, but current RunL() with + * CActiveSchedulerWait. + */ + +class CUserAfter : public CTimer + { + + public: //Construction + static inline CUserAfter* NewL(); + static inline CUserAfter* NewLC(); + ~CUserAfter(); + + + public: //Wait support + + /** + * Static "one shot" wait method. + */ + static inline void AfterL ( TInt aWaitTimeMicroSeconds ); + /** + * Static "one shot" wait method. + */ + static inline void After8HrsL (); + + /** + * Member wait method. + */ + inline void After ( TInt aWaitTimeMicroSeconds ); + + + private: + CUserAfter(); + + void RunL(); + void RunError(); + void DoCancel(); + + + private: //data + CActiveSchedulerWait iWait; + + }; + + + + +// ----------------------------------------------------------------------------- +// CUserAfter public functions +// ----------------------------------------------------------------------------- +// +inline CUserAfter* CUserAfter::NewL() + { + CUserAfter* self = CUserAfter::NewLC(); + CleanupStack::Pop ( self ); + return self; + } + +inline CUserAfter* CUserAfter::NewLC() + { + CUserAfter* self = new ( ELeave ) CUserAfter(); + CleanupStack::PushL ( self ); + self->ConstructL(); + return self; + } + + +inline CUserAfter::~CUserAfter() + { + CTimer::Cancel(); + } + +inline void CUserAfter::After ( TInt aWaitTimeMicroSeconds ) + { + CTimer::After ( aWaitTimeMicroSeconds ); + iWait.Start(); + } + + +inline void CUserAfter::AfterL ( TInt aWaitTimeMicroSeconds ) + { + CUserAfter* after = CUserAfter::NewL(); + after->After ( aWaitTimeMicroSeconds ); + delete after; + } + +inline void CUserAfter::After8HrsL ( ) + { + CUserAfter* after = CUserAfter::NewL(); + //aWaitTimeMicroSeconds range is +-2147483647, which is +-35 minutes, 47 seconds. + for(TInt i =0 ; i<=16 ; i++) + { + after->After ( 2147483647 ); + } + delete after; + } + + +// ----------------------------------------------------------------------------- +// CUserAfter private functions +// ----------------------------------------------------------------------------- +// +inline CUserAfter::CUserAfter() + : CTimer ( CActive::EPriorityStandard ) + { + CActiveScheduler::Add ( this ); + } + + +inline void CUserAfter::RunL() + { + iWait.AsyncStop(); + Cancel(); + } + +inline void CUserAfter::RunError() + { + } + +inline void CUserAfter::DoCancel() + { + iWait.AsyncStop(); + CTimer::DoCancel(); + } + + +#endif // CUSERAFTER_H__ + +// End of File + diff -r 000000000000 -r e6b17d312c8b imservices/ossprotocoladaptation/tsrc/ossadapmt/inc/ossadapmt.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/ossprotocoladaptation/tsrc/ossadapmt/inc/ossadapmt.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,269 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ossadapmt.h +* +*/ + + + +#ifndef OSSADAPMT_H +#define OSSADAPMT_H + +// INCLUDES +#include +#include +#include +#include + +// CONSTANTS +//const ?type ?constant_var = ?constant; + +// MACROS +//#define ?macro ?macro_def +// Logging path +_LIT ( KossadapmtLogPath, "\\logs\\testframework\\ossadapmt\\" ); +// Log file +_LIT ( KossadapmtLogFile, "ossadapmt.txt" ); +_LIT ( KossadapmtLogFileWithTitle, "ossadapmt_[%S].txt" ); + +// FUNCTION PROTOTYPES +//?type ?function_name(?arg_list); + +// FORWARD DECLARATIONS +//class ?FORWARD_CLASSNAME; + +class Cossadapmt; + +enum TSearch + { + ESimpleSearch, + EMultipleSearch, + ESearchNoResults, + ESearchManyResults, + ESearchBlank, + ESearchMaxChars, + ESearchSpecialChars, + ESearchEmailid, + ESearchAndAddToIm, + ESecondSearch, + EGetSearchKeyEnum, + EGetSearchKeyLabel, + EGetSearchKeyEnumNLabel, + }; + +// DATA TYPES +//enum ?declaration +//typedef ?declaration +//extern ?data_type; + +// CLASS DECLARATION + +/** +* Cossadapmt test class for STIF Test Framework TestScripter. +* ?other_description_lines +* +* @lib ?library +* @since ?Series60_version +*/ +NONSHARABLE_CLASS ( Cossadapmt ) : public CScriptBase + { + +public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static Cossadapmt* NewL ( CTestModuleIf& aTestModuleIf ); + + /** + * Destructor. + */ + virtual ~Cossadapmt(); + +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. + */ + Cossadapmt ( 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. + */ + + /** + * Bind test method. + * @since ?Series60_version + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + virtual TInt LoginL ( CStifItemParser& aItem ); + virtual TInt Login_InvalidDataL ( CStifItemParser& aItem ); + virtual TInt Login8HrsLogoutL ( CStifItemParser& aItem ); + virtual TInt LoginLogout_LoginLogoutL ( CStifItemParser& aItem ); + /** + * UnBind test method. + */ + virtual TInt UnBindL ( CStifItemParser& aItem ); + /** + * Fetch contacts method + */ + virtual TInt GetContactsL ( CStifItemParser& aItem ); + + /** + * Send message test method. + */ + virtual TInt SendMessageL ( CStifItemParser& aItem ); + virtual TInt SendEmptyMessageL ( CStifItemParser& aItem ); + virtual TInt SendTenMessageL ( CStifItemParser& aItem ); + virtual TInt SendTwentyMessageL ( CStifItemParser& aItem ); + virtual TInt SendMessage_MultipleContactsL ( CStifItemParser& aItem ); + + /** + * Receive message test method + */ + virtual TInt ReceiveMessageL ( CStifItemParser& aItem ); + virtual TInt ReceiveEmptyMessageL ( CStifItemParser& aItem ); + virtual TInt ReceiveTenMessageL ( CStifItemParser& aItem ); + virtual TInt ReceiveTwentyMessageL ( CStifItemParser& aItem ); + + /** + *contact list manangement test methods + */ + virtual TInt AddConatctL ( CStifItemParser& aItem ); + virtual TInt AcceptnotificationRequestL ( CStifItemParser& aItem ); + virtual TInt AddBlankConatctL ( CStifItemParser& aItem ); + virtual TInt AddBlankConatct1L ( CStifItemParser& aItem ); + + virtual TInt DeleteConatctL ( CStifItemParser& aItem ); + virtual TInt DeleteBlankConatctL ( CStifItemParser& aItem ); + /** + * Presence publishing test method + */ + virtual TInt PublishOwnPresenceL ( CStifItemParser& aItem ); + virtual TInt PublishOwnPresenceEmptyTextL ( CStifItemParser& aItem ); + virtual TInt RejectAddnotificationRequestL ( CStifItemParser& aItem ); + virtual TInt ImOperationsCoverageL ( CStifItemParser& aItem ); + + virtual TInt SearchL ( CStifItemParser& aItem, TSearch aSearchType ); + virtual TInt SimpleSearchL( CStifItemParser& aItem ); + virtual TInt MultipleSearchL( CStifItemParser& aItem ); + virtual TInt NoResultSearchL( CStifItemParser& aItem ); + virtual TInt ManyResultsSearchL( CStifItemParser& aItem ); + virtual TInt BlankSearchL( CStifItemParser& aItem ); + virtual TInt MaxCharSearchL( CStifItemParser& aItem ); + virtual TInt SpecialCharSearchL( CStifItemParser& aItem ); + virtual TInt SearchEmailIDL( CStifItemParser& aItem ); + virtual TInt SearchAndAddToIML( CStifItemParser& aItem ); + virtual TInt SecondSearchL( CStifItemParser& aItem ); + virtual TInt GetSearchKeyEnumL( CStifItemParser& aItem ); + virtual TInt GetSearchKeyLabelL( CStifItemParser& aItem ); + virtual TInt GetSearchKeyEnumNLabelL( CStifItemParser& aItem ); + virtual TInt SetAvtarL( CStifItemParser& aItem ); +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; + + }; + +class TOssAdapMtLogger + { + + public: // New functions + /** + * Writes log to log file + */ + static void Log ( TRefByValue aFmt, ... ); + + }; + + + +#endif // OSSADAPMT_H + +// End of File diff -r 000000000000 -r e6b17d312c8b imservices/ossprotocoladaptation/tsrc/ossadapmt/inc/uscontextobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/ossprotocoladaptation/tsrc/ossadapmt/inc/uscontextobserver.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,87 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: uscontextobserver.h +* +*/ + + +#ifndef USCONTEXTOBSERVER_H__ +#define USCONTEXTOBSERVER_H__ + + +// INCLUDES +#include +#include + +_LIT( KAddContactFileName, "c:\\add_contact.txt" ); + +// CLASS DESCRIPTION + +/** + * Presence context observer for usage scenario tests. + */ + +class CUSContextObserver : public CBase, + public MXIMPContextObserver + { + + public: + static CUSContextObserver* CUSContextObserver::NewLC(); + ~CUSContextObserver(); + + private: + CUSContextObserver(); + + + public: + + /** + * Method to wait with CActiveSchedulerWait + * the given request completion. If request + * is completed with error, leaves with failure code. + * + * NOTE! Only one request can be waited at time. + * + * @param aReqToWait The request to wait. + */ + void WaitOpToCompleteL ( const TXIMPRequestId& aReqToWait ); + + + + private: //From MXIMPContextObserver + + void HandlePresenceContextEvent ( const MXIMPContext& aContext, + const MXIMPBase& aEvent ); + + + private: //Data + + //OWN: Active scheduler wait for waiting the completion + CActiveSchedulerWait iWait; + + //OWN: Request ID identifying request to wait + TXIMPRequestId iReqToWait; + + //OWN: Result code from waited request + TInt iReqResult; + TBuf<50> gid[10]; + TInt gidcount; + + }; + + + +#endif //USCONTEXTOBSERVER_H__ + + diff -r 000000000000 -r e6b17d312c8b imservices/ossprotocoladaptation/tsrc/ossadapmt/init/TestFramework.ini --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/ossprotocoladaptation/tsrc/ossadapmt/init/TestFramework.ini Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,196 @@ +# +# This is STIF initialization file +# Comment lines start with '#'-character. +# See STIF TestFramework users guide.doc for instructions + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Set following test engine settings: +# - Set Test Reporting mode. TestReportMode's possible values are: +# + 'Summary': Summary of the tested test cases. +# + 'Environment': Hardware and software info. +# + 'TestCases': Test case report. +# + 'FullReport': Set of all above ones. +# + Example 'TestReportMode= Summary TestCases' +# +# - CreateTestReport setting controls report creation mode +# + YES, Test report will created. +# + NO, No Test report. +# +# - File path indicates the base path of the test report. +# - File name indicates the name of the test report. +# +# - File format indicates the type of the test report. +# + TXT, Test report file will be txt type, for example 'TestReport.txt'. +# + HTML, Test report will be html type, for example 'TestReport.html'. +# +# - File output indicates output source of the test report. +# + FILE, Test report logging to file. +# + RDEBUG, Test report logging to using rdebug. +# +# - File Creation Mode indicates test report overwriting if file exist. +# + OVERWRITE, Overwrites if the Test report file exist. +# + APPEND, Continue logging after the old Test report information if +# report exist. +# - Sets a device reset module's dll name(Reboot). +# + If Nokia specific reset module is not available or it is not correct one +# StifHWResetStub module may use as a template for user specific reset +# module. +# - Sets STIF test measurement disable options. e.g. pluging1 and pluging2 disablation +# DisableMeasurement= stifmeasurementplugin01 stifmeasurementplugin02 +# + +[Engine_Defaults] + +TestReportMode= FullReport # Possible values are: 'Empty', 'Summary', 'Environment', + 'TestCases' or 'FullReport' + +CreateTestReport= YES # Possible values: YES or NO + +TestReportFilePath= C:\LOGS\TestFramework\ +TestReportFileName= TestReport + +TestReportFormat= TXT # Possible values: TXT or HTML +TestReportOutput= FILE # Possible values: FILE or RDEBUG +TestReportFileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND + +DeviceResetDllName= StifResetForNokia.dll # e.g. 'StifHWResetStub.dll' for user specific reseting + +DisableMeasurement= stifmeasurementdisablenone # Possible values are: + # 'stifmeasurementdisablenone', 'stifmeasurementdisableall' + # 'stifmeasurementplugin01', 'stifmeasurementplugin02', + # 'stifmeasurementplugin03', 'stifmeasurementplugin04', + # 'stifmeasurementplugin05' or 'stifbappeaprofiler' + +Timeout= 0 # Default timeout value for each test case. In milliseconds + +[End_Defaults] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + + + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Module configurations start +# Modules are added between module tags +# tags. Module name is specified after ModuleName= tag, like +# ModuleName= XXXXXXXXX +# Modules might have initialisation file, specified as +# IniFile= c:\testframework\YYYYYY +# Modules might have several configuration files, like +# TestCaseFile= c:\testframework\NormalCases.txt +# TestCaseFile= c:\testframework\SmokeCases.txt +# TestCaseFile= c:\testframework\ManualCases.txt + +# (TestCaseFile is synonym for old term ConfigFile) + +# Following case specifies demo module settings. Demo module +# does not read any settings from file, so tags +# IniFile and TestCaseFile are not used. +# In the simplest case it is enough to specify only the +# name of the test module when adding new test module + +[New_Module] +ModuleName= testscripter +TestCaseFile= C:\testframework\ossadapmt.cfg +[End_Module] + +# Load testmoduleXXX, optionally with initialization file and/or test case files +#[New_Module] +#ModuleName= testmodulexxx + +#TestModuleXXX used initialization file +#IniFile= c:\testframework\init.txt + +#TestModuleXXX used configuration file(s) +#TestCaseFile= c:\testframework\testcases1.cfg +#TestCaseFile= c:\testframework\testcases2.cfg +#TestCaseFile= c:\testframework\manualtestcases.cfg + +#[End_Module] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + + + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Set STIF logging overwrite parameters for Logger. +# Hardware and emulator environment logging path and styles can +# be configured from here to overwrite the Logger's implemented values. +# +# Settings description: +# - Indicates option for creation log directory/directories. If log directory/directories +# is/are not created by user they will make by software. +# + YES, Create log directory/directories if not allready exist. +# + NO, Log directory/directories not created. Only created one is used. +# +# - Overwrite emulator path setting. +# + Example: If 'EmulatorBasePath= C:\LOGS\TestFramework\' and in code is defined +# Logger's path 'D:\\LOGS\\Module\\' with those definition the path +# will be 'C:\LOGS\TestFramework\LOGS\Module\' +# +# - Overwrite emulator's logging format. +# + TXT, Log file(s) will be txt type(s), for example 'Module.txt'. +# + HTML, Log file(s) will be html type(s), for example 'Module.html'. +# +# - Overwrited emulator logging output source. +# + FILE, Logging to file(s). +# + RDEBUG, Logging to using rdebug(s). +# +# - Overwrite hardware path setting (Same description as above in emulator path). +# - Overwrite hardware's logging format(Same description as above in emulator format). +# - Overwrite hardware's logging output source(Same description as above in emulator output). +# +# - File Creation Mode indicates file overwriting if file exist. +# + OVERWRITE, Overwrites if file(s) exist. +# + APPEND, Continue logging after the old logging information if file(s) exist. +# +# - Will thread id include to the log filename. +# + YES, Thread id to log file(s) name, Example filename 'Module_b9.txt'. +# + NO, No thread id to log file(s), Example filename 'Module.txt'. +# +# - Will time stamps include the to log file. +# + YES, Time stamp added to each line in log file(s). Time stamp is +# for example'12.Nov.2003 115958 LOGGING INFO' +# + NO, No time stamp(s). +# +# - Will line breaks include to the log file. +# + YES, Each logging event includes line break and next log event is in own line. +# + NO, No line break(s). +# +# - Will event ranking include to the log file. +# + YES, Event ranking number added to each line in log file(s). Ranking number +# depends on environment's tics, for example(includes time stamp also) +# '012 12.Nov.2003 115958 LOGGING INFO' +# + NO, No event ranking. +# +# - Will write log file in unicode format. +# + YES, Log file will be written in unicode format +# + NO, Log will be written as normal, not unicode, file. +# + +[Logger_Defaults] + +#NOTE: If you want to set Logger using next setting(s) remove comment(s)'#' +#NOTE: TestEngine and TestServer logging settings cannot change here + +#CreateLogDirectories= YES # Possible values: YES or NO + +#EmulatorBasePath= C:\LOGS\TestFramework\ +#EmulatorFormat= HTML # Possible values: TXT or HTML +#EmulatorOutput= FILE # Possible values: FILE or RDEBUG + +#HardwareBasePath= D:\LOGS\TestFramework\ +#HardwareFormat= HTML # Possible values: TXT or HTML +#HardwareOutput= FILE # Possible values: FILE or RDEBUG + +#FileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND + +#ThreadIdToLogFile= YES # Possible values: YES or NO +#WithTimeStamp= YES # Possible values: YES or NO +#WithLineBreak= YES # Possible values: YES or NO +#WithEventRanking= YES # Possible values: YES or NO + +#FileUnicode= YES # Possible values: YES or NO +#AddTestCaseTitle= YES # Possible values: YES or NO +[End_Logger_Defaults] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + +# End of file diff -r 000000000000 -r e6b17d312c8b imservices/ossprotocoladaptation/tsrc/ossadapmt/src/ossadapmt.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/ossprotocoladaptation/tsrc/ossadapmt/src/ossadapmt.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,208 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ossadapmt.cpp +* +*/ + + + +// INCLUDE FILES +#include +#include "ossadapmt.h" +#include +#include + +// EXTERNAL DATA STRUCTURES +//extern ?external_data; + +// EXTERNAL FUNCTION PROTOTYPES +//extern ?external_function( ?arg_type,?arg_type ); + +// CONSTANTS +//const ?type ?constant_var = ?constant; + +// MACROS +//#define ?macro ?macro_def + +// LOCAL CONSTANTS AND MACROS +//const ?type ?constant_var = ?constant; +//#define ?macro_name ?macro_def + +// MODULE DATA STRUCTURES +//enum ?declaration +//typedef ?declaration + +// LOCAL FUNCTION PROTOTYPES +//?type ?function_name( ?arg_type, ?arg_type ); + +// FORWARD DECLARATIONS +//class ?FORWARD_CLASSNAME; + +// ============================= LOCAL FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// ?function_name ?description. +// ?description +// Returns: ?value_1: ?description +// ?value_n: ?description_line1 +// ?description_line2 +// ----------------------------------------------------------------------------- +// +/* +?type ?function_name( + ?arg_type arg, // ?description + ?arg_type arg) // ?description + { + + ?code // ?comment + + // ?comment + ?code + } +*/ + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// Cossadapmt::Cossadapmt +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +Cossadapmt::Cossadapmt ( + CTestModuleIf& aTestModuleIf ) : + CScriptBase ( aTestModuleIf ) + { + } + +// ----------------------------------------------------------------------------- +// Cossadapmt::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void Cossadapmt::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 ( KossadapmtLogFileWithTitle, &title ); + } + else + { + logFileName.Copy ( KossadapmtLogFile ); + } + + iLog = CStifLogger::NewL ( KossadapmtLogPath, + + logFileName, + CStifLogger::ETxt, + CStifLogger::EFile, + EFalse ); + TestModuleIf().SetBehavior ( CTestModuleIf::ETestLeaksHandles ); + + } + +// ----------------------------------------------------------------------------- +// Cossadapmt::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +Cossadapmt* Cossadapmt::NewL ( + CTestModuleIf& aTestModuleIf ) + { + Cossadapmt* self = new ( ELeave ) Cossadapmt ( aTestModuleIf ); + + CleanupStack::PushL ( self ); + self->ConstructL(); + CleanupStack::Pop(); + + return self; + + } + +// Destructor +Cossadapmt::~Cossadapmt() + { + + // Delete resources allocated from test methods + Delete(); + + // 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* ) Cossadapmt::NewL ( aTestModuleIf ); + + } + +// CONSTANTS +const TInt KTLogBufferLength = 256; + +_LIT ( KTLogDir, "osmt" ); +_LIT ( KTLogFile, "ossadapmt.txt" ); + +void TOssAdapMtLogger::Log ( TRefByValue aFmt, ... ) + { + VA_LIST list; + VA_START ( list, aFmt ); + + // Print to log file + TBuf buf; + buf.FormatList ( aFmt, list ); + + // Write to log file + RFileLogger::Write ( KTLogDir, KTLogFile, EFileLoggingModeAppend, buf ); + + } + +// End of File diff -r 000000000000 -r e6b17d312c8b imservices/ossprotocoladaptation/tsrc/ossadapmt/src/ossadapmtBlocks.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/ossprotocoladaptation/tsrc/ossadapmt/src/ossadapmtBlocks.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,3168 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ossadapmtBlocks.cpp +* +*/ + + + +// [INCLUDE FILES] - do not remove +#include +#include +#include +#include "ossadapmt.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "uscontextobserver.h" +#include +#include +#include +#include +#include +#include +#include "cuserafter.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +//#include "immessageinfoimp.h" +const TInt KProtocolUid = 0x101FB3E7; // 0x10282EE9; +_LIT8( KInstantMessaging, "instant-messaging"); + +// StatusText attribute value tags +_LIT8( KStatusTextfield, "StatusText"); + +// Online Status attribute value tags +_LIT8( KOnlineStatusfield, "OnlineStatus" ); +_LIT ( KMsgId, "MessageID1" ); +_LIT( KContact1, "meco5555@gmail.com"); + +// 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 =============================== + +// ----------------------------------------------------------------------------- +// Cossadapmt::Delete +// Delete here all resources allocated and opened from test methods. +// Called from destructor. +// ----------------------------------------------------------------------------- +// +void Cossadapmt::Delete() + { + + } + +// ----------------------------------------------------------------------------- +// Cossadapmt::RunMethodL +// Run specified method. Contains also table of test mothods and their names. +// ----------------------------------------------------------------------------- +// +TInt Cossadapmt::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 ( "SecondSearchL",Cossadapmt::SecondSearchL ), + ENTRY ( "Login", Cossadapmt::LoginL ), + ENTRY ( "Login_InvalidData", Cossadapmt::Login_InvalidDataL ), + ENTRY ( "AcceptnotificationRequest", Cossadapmt::AcceptnotificationRequestL ), + ENTRY ( "Login_Logout_sequential", Cossadapmt::LoginLogout_LoginLogoutL ), + ENTRY ( "Login_8Hrs_Logout", Cossadapmt::Login8HrsLogoutL ), + ENTRY ( "Unbind", Cossadapmt::UnBindL ), + ENTRY ( "GetContacts", Cossadapmt::GetContactsL ), + ENTRY ( "Add_conatct", Cossadapmt::AddConatctL ), + ENTRY ( "Add_Blank_Conatct", Cossadapmt::AddBlankConatctL ), + ENTRY ( "Add_Blank_Conatct1", Cossadapmt::AddBlankConatct1L ), + ENTRY ( "Delete_conatct", Cossadapmt::DeleteConatctL ), + ENTRY ( "Delete_Blank_Conatct", Cossadapmt::DeleteBlankConatctL ), + ENTRY ( "Sendmessage", Cossadapmt::SendMessageL ), + ENTRY ( "Sendemptymessage", Cossadapmt::SendEmptyMessageL ), + ENTRY ( "Send_ten_messages", Cossadapmt::SendTenMessageL ), + ENTRY ( "Send_twenty_messages", Cossadapmt::SendTwentyMessageL ), + ENTRY ( "Sendmessage_multiplecontacts", Cossadapmt::SendMessage_MultipleContactsL ), + ENTRY ( "Receivemessage", Cossadapmt::ReceiveMessageL ), + ENTRY ( "Receiveemptymessage", Cossadapmt::ReceiveEmptyMessageL ), + ENTRY ( "Receive_ten_messages", Cossadapmt::ReceiveTenMessageL ), + ENTRY ( "Receive_twenty_message", Cossadapmt::ReceiveTwentyMessageL ), + ENTRY ( "Publish_ownpresence", Cossadapmt::PublishOwnPresenceL ), + ENTRY ( "Publish_ownpresence_emptytext", Cossadapmt::PublishOwnPresenceEmptyTextL ), + ENTRY ( "RejectAddnotificationRequest", Cossadapmt::RejectAddnotificationRequestL ), + ENTRY ( "ImOperations_Coverage", Cossadapmt::ImOperationsCoverageL ), + + ENTRY ( "SimpleSearchL", Cossadapmt::SimpleSearchL ), + ENTRY ( "MultipleSearchL", Cossadapmt::MultipleSearchL ), + ENTRY ( "NoResultSearchL", Cossadapmt::NoResultSearchL ), + ENTRY ( "ManyResultsSearchL", Cossadapmt::ManyResultsSearchL ), + ENTRY ( "BlankSearchL", Cossadapmt::BlankSearchL ), + ENTRY ( "MaxCharSearchL", Cossadapmt::MaxCharSearchL ), + ENTRY ( "SpecialCharSearchL", Cossadapmt::SpecialCharSearchL ), + ENTRY ( "SearchEmailIDL",Cossadapmt::SearchEmailIDL ), + ENTRY ( "SearchAndAddToIML",Cossadapmt::SearchAndAddToIML ), + ENTRY ( "GetSearchKeyEnumL",Cossadapmt::GetSearchKeyEnumL ), + ENTRY ( "GetSearchKeyLabelL",Cossadapmt::GetSearchKeyLabelL ), + ENTRY ( "GetSearchKeyEnumNLabelL",Cossadapmt::GetSearchKeyEnumNLabelL ), + ENTRY ( "SetAvtar",Cossadapmt::SetAvtarL ), + //ADD NEW ENTRY HERE + // [test cases entries] - Do not remove + + }; + + const TInt count = sizeof ( KFunctions ) / + sizeof ( TStifFunctionInfo ); + + return RunInternalL ( KFunctions, count, aItem ); + + } + + + +// ----------------------------------------------------------------------------- +// Cossadapmt::SearchL +// Search test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Cossadapmt::SearchL ( CStifItemParser& aItem, TSearch aSearchType ) + { + + + + //Initialize XIMP client + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::LoginL() start" ) ); + + MXIMPClient* ximpClient = MXIMPClient::NewClientL(); + CleanupDeletePushL ( ximpClient ); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::MXIMPClient::NewClientL() start" ) ); + + //Create new sink to receive presence context events + CUSContextObserver* eventObserver = CUSContextObserver::NewLC(); + + //Create new presence context + MXIMPContext* presecenCtx = ximpClient->NewPresenceContextLC(); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::ximpClient->NewPresenceContextLC() called" ) ); + presecenCtx->RegisterObserverL ( *eventObserver ); + + + //read data from cfg file + TPtrC username; + TPtrC password; + TInt serviceId; + + + MSearchFeature* srFeature = NULL; + srFeature = MSearchFeature::NewL ( presecenCtx ); +// CleanupStack::PushL( srFeature ); + + MSearch& srch=srFeature->Search(); + MSearchObjectFactory& searchObjFact=srFeature->SearchObjectFactory(); + + + aItem.GetNextString ( username ); + aItem.GetNextString ( password ); + aItem.GetNextInt ( serviceId ); + + TUid protocolUid = TUid::Uid ( KProtocolUid ); + + //Bind context to desired presence service + TXIMPRequestId req = presecenCtx->BindToL ( protocolUid, + username, + password, + serviceId ); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::presecenCtx->BindToL() called" ) ); + //Wait with CActiveSchedulerWait the binding to complete + //If binding fails, it is handled with leave + eventObserver->WaitOpToCompleteL ( req ); + +//------------------------------------------Fetch Start------------------------------------------ + MPresenceFeatures* presenceFeatures = NULL; + presenceFeatures = MPresenceFeatures::NewL ( presecenCtx ); + CleanupDeletePushL ( presenceFeatures ); + MXIMPIdentity* newGroupId = presecenCtx->ObjectFactory().NewIdentityLC(); + MPresentityGroups& groups = presenceFeatures->PresentityGroups() ; + MXIMPIdentity* newmemberId = presecenCtx->ObjectFactory().NewIdentityLC(); + + TOssAdapMtLogger::Log ( _L ( "presentity groups object created" ) ); + _LIT ( KDummyListId, "list" ); + HBufC16* iListId; + iListId = KDummyListId().AllocL(); + iListId->Des().Fold(); + newGroupId->SetIdentityL ( *iListId ); + delete iListId; + iListId = NULL; + + + req = groups.SubscribePresentityGroupContentL ( *newGroupId ); + + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::groups.SubscribePresentityGroupListL() called" ) ); + + eventObserver->WaitOpToCompleteL ( req ); + + CUserAfter::AfterL ( 1000000 ); + +//------------------------------------------Fetch End------------------------------------------ + + + MXIMPIdentity* searchId = presecenCtx->ObjectFactory().NewIdentityLC(); + searchId->SetIdentityL(_L("SEARCH")); + + MXIMPIdentity* firstId = presecenCtx->ObjectFactory().NewIdentityLC(); + + + MSearchElement* srchElement1=searchObjFact.NewSearchElementLC(); + + + MXIMPIdentity* secondId = presecenCtx->ObjectFactory().NewIdentityLC(); + + + MSearchElement* srchElement2=searchObjFact.NewSearchElementLC(); + + + RPointerArray< MSearchElement > searchList; + CleanupClosePushL( searchList ); + + switch ( aSearchType ) + { + + case EGetSearchKeyEnum: + { + + req = srch.GetSearchKeysL(); + eventObserver->WaitOpToCompleteL ( req ); + + firstId->SetIdentityL(_L("james")); + srchElement1->SetRequestL( *firstId, EUserFirstName ); + + searchList.Append(srchElement1); + + req=srch.SearchL(*searchId,searchList,10 ); + break; + + } + + + case EGetSearchKeyLabel: + { + + req = srch.GetSearchKeysL(); + eventObserver->WaitOpToCompleteL ( req ); + + MXIMPIdentity* label = presecenCtx->ObjectFactory().NewIdentityLC(); + label->SetIdentityL( _L( "Family Name" ) ); + + secondId->SetIdentityL(_L("BOND")); + + srchElement2->SetRequestL( *secondId, *label ); + + searchList.Append( srchElement1 ); + searchList.Append( srchElement2 ); + + req=srch.SearchL(*searchId,searchList,10 ); + + CleanupStack::PopAndDestroy (); + + break; + + } + + + case EGetSearchKeyEnumNLabel: + { + + req = srch.GetSearchKeysL(); + eventObserver->WaitOpToCompleteL ( req ); + + + firstId->SetIdentityL(_L("james")); + srchElement1->SetRequestL( *firstId, EUserFirstName ); + + secondId->SetIdentityL(_L("BOND")); + + MXIMPIdentity* label = presecenCtx->ObjectFactory().NewIdentityLC(); + label->SetIdentityL( _L( "Family Name" ) ); + + srchElement2->SetRequestL( *secondId, *label ); + + searchList.Append( srchElement1 ); + searchList.Append( srchElement2 ); + + req=srch.SearchL(*searchId,searchList,10 ); + + CleanupStack::PopAndDestroy (); + + break; + } + + + case ESimpleSearch : + { + + req = srch.GetSearchKeysL(); + eventObserver->WaitOpToCompleteL ( req ); + + firstId->SetIdentityL(_L("james")); + srchElement1->SetRequestL( *firstId, EUserFirstName ); + + searchList.Append(srchElement1); + + req=srch.SearchL(*searchId,searchList,10 ); + + break; + } + + + case EMultipleSearch : + { + + req = srch.GetSearchKeysL(); + eventObserver->WaitOpToCompleteL ( req ); + + + firstId->SetIdentityL(_L("james")); + srchElement1->SetRequestL( *firstId, EUserFirstName ); + + secondId->SetIdentityL(_L("BOND")); + + MXIMPIdentity* label = presecenCtx->ObjectFactory().NewIdentityLC(); + label->SetIdentityL( _L( "Family Name" ) ); + + srchElement2->SetRequestL( *secondId, *label ); + + searchList.Append( srchElement1 ); + searchList.Append( srchElement2 ); + + req=srch.SearchL(*searchId,searchList,10 ); + + CleanupStack::PopAndDestroy (); + + break; + } + + + case ESearchNoResults : + { + firstId->SetIdentityL(_L("Santhosh")); + srchElement1->SetRequestL( *firstId, EUserFirstName ); + + secondId->SetIdentityL(_L("I C")); + srchElement2->SetRequestL( *secondId, EUserLastName ); + + searchList.Append( srchElement1 ); + searchList.Append( srchElement2 ); + + req=srch.SearchL(*searchId,searchList,10 ); + break; + } + + + case ESearchManyResults : + { + firstId->SetIdentityL(_L("a")); + srchElement1->SetRequestL( *firstId, EUserFirstName ); + + searchList.Append(srchElement1); + + req=srch.SearchL(*searchId,searchList,10 ); + + break; + } + + + case ESearchBlank : + { + firstId->SetIdentityL(_L("")); + srchElement1->SetRequestL( *firstId, EUserFirstName ); + + searchList.Append(srchElement1); + + req=srch.SearchL(*searchId,searchList,10 ); + break; + } + + + + case ESearchMaxChars : + { + firstId->SetIdentityL( _L( "fbg agh ggd sad ghda gh dhg hgasdg dh jggd gsdg g \ + kjdg g gsd gfhsdg fhasgd hasdh ghfgahfg hgsdg dg gdgsgkj" ) ); + srchElement1->SetRequestL( *firstId, EUserFirstName ); + + searchList.Append( srchElement1 ); + + req=srch.SearchL( *searchId,searchList,10 ); + break; + } + + + case ESearchSpecialChars : + { + firstId->SetIdentityL( _L( "*%#@$%^#%^&^^%)(" ) ); + srchElement1->SetRequestL( *firstId, EUserFirstName ); + + searchList.Append( srchElement1 ); + + req=srch.SearchL( *searchId,searchList,10 ); + + break; + } + case ESearchEmailid: + { + firstId->SetIdentityL( _L( "wordjames@chat.gizmoproject.com" ) ); + srchElement1->SetRequestL( *firstId, EUserFirstName ); + + searchList.Append( srchElement1 ); + + req=srch.SearchL( *searchId,searchList,10 ); + break; + } + + case ESearchAndAddToIm: + { + firstId->SetIdentityL( _L( "sharath" ) ); + srchElement1->SetRequestL( *firstId, EUserFirstName ); + + searchList.Append( srchElement1 ); + + req=srch.SearchL( *searchId,searchList,10 ); + //Wait for search to complete + eventObserver->WaitOpToCompleteL( req ); + CUserAfter::AfterL ( 5000000 ); + + //And then call the AddToContactList + RFs fs; + RFile file; + TBuf8<100> buf; + User::LeaveIfError( fs.Connect() ); + User::LeaveIfError( file.Open( fs, KAddContactFileName, EFileRead ) ); + file.Read( buf ); + file.Close(); + fs.Close(); + TBuf16<100> h_buf; + CnvUtfConverter::ConvertToUnicodeFromUtf8( h_buf, + buf ); +//-------------------Adding Contact Start----------------------------------------- + + newmemberId->SetIdentityL ( h_buf ); + + req = groups.AddPresentityGroupMemberL( + *newGroupId, + *newmemberId, + KNullDesC()) ; + + //eventObserver->WaitOpToCompleteL ( req ); + //CUserAfter::AfterL ( 5000000 ); + //Wait at the below eventObserver->WaitOpToCompleteL( req ); + + +//-------------------Adding Contact End----------------------------------------- + break; + } + case ESecondSearch: + { + + firstId->SetIdentityL(_L("sharath")); + srchElement1->SetRequestL( *firstId, EUserFirstName ); + + searchList.Append(srchElement1); + + req=srch.SearchL(*searchId,searchList,10 ); + + eventObserver->WaitOpToCompleteL( req ); + + CUserAfter::AfterL(100000); + searchList.Reset(); + + //Second Search + secondId->SetIdentityL(_L("Jeppu")); + srchElement1->SetRequestL( *secondId, EUserLastName ); + + searchList.Append(srchElement1); + + req=srch.SearchL(*searchId,searchList,10 ); + + break; + } + + } + + CleanupStack::PopAndDestroy (); //newmemberId + CleanupStack::PopAndDestroy ();//newGroupId + CleanupStack::PopAndDestroy ();//presenceFeatures + + CleanupStack::PopAndDestroy (); // + CleanupStack::PopAndDestroy (); + CleanupStack::PopAndDestroy (); + + CleanupStack::PopAndDestroy (); + CleanupStack::PopAndDestroy (); + + CleanupStack::PopAndDestroy (); + + eventObserver->WaitOpToCompleteL( req ); + //Unbind the context and wait completion + req = presecenCtx->UnbindL(); + eventObserver->WaitOpToCompleteL( req ); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::WaitOpToCompleteL() end" ) ); + +// CleanupStack::PopAndDestroy ();//Search feature plugin + CleanupStack::PopAndDestroy ( 3 ); //presecenCtx,eventObserver,ximpClient + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::SearchL() End" ) ); + return KErrNone; + + } +// ----------------------------------------------------------------------------- +// Cossadapmt::GetSearchKeyEnum +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Cossadapmt::GetSearchKeyEnumL( CStifItemParser& aItem ) + { + return SearchL ( aItem, EGetSearchKeyEnum ); + } + +// ----------------------------------------------------------------------------- +// Cossadapmt::GetSearchKeyLabel +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Cossadapmt::GetSearchKeyLabelL( CStifItemParser& aItem ) + { + return SearchL ( aItem, EGetSearchKeyLabel ); + } + +// ----------------------------------------------------------------------------- +// Cossadapmt::GetSearchKeyEnumNLabel +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Cossadapmt::GetSearchKeyEnumNLabelL( CStifItemParser& aItem ) + { + return SearchL ( aItem, EGetSearchKeyEnumNLabel ); + } + +// ----------------------------------------------------------------------------- +// Cossadapmt::SearchAndAddToIML +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// + +TInt Cossadapmt::SecondSearchL( CStifItemParser& aItem ) + { + return SearchL ( aItem, ESecondSearch ); + } + + +// ----------------------------------------------------------------------------- +// Cossadapmt::SearchAndAddToIML +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// + +TInt Cossadapmt::SearchAndAddToIML( CStifItemParser& aItem ) + { + return SearchL ( aItem, ESearchAndAddToIm ); + } + +// ----------------------------------------------------------------------------- +// Cossadapmt::SimpleSearchL +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// + +TInt Cossadapmt::SimpleSearchL( CStifItemParser& aItem ) + { + return SearchL ( aItem, ESimpleSearch ); + } +// ----------------------------------------------------------------------------- +// Cossadapmt::MultipleSearchL +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Cossadapmt::MultipleSearchL( CStifItemParser& aItem ) + { + return SearchL ( aItem, EMultipleSearch ); + } +// ----------------------------------------------------------------------------- +// Cossadapmt::NoResultSearchL +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Cossadapmt::NoResultSearchL( CStifItemParser& aItem ) + { + return SearchL ( aItem, ESearchNoResults ); + } +// ----------------------------------------------------------------------------- +// Cossadapmt::ManyResultsSearchL +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Cossadapmt::ManyResultsSearchL( CStifItemParser& aItem ) + { + return SearchL ( aItem, ESearchManyResults ); + } +// ----------------------------------------------------------------------------- +// Cossadapmt::BlankSearchL. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Cossadapmt::BlankSearchL( CStifItemParser& aItem ) + { + return SearchL ( aItem, ESearchBlank ); + } +// ----------------------------------------------------------------------------- +// Cossadapmt::MaxCharSearchL +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Cossadapmt::MaxCharSearchL( CStifItemParser& aItem ) + { + return SearchL ( aItem, ESearchMaxChars ); + } +// ----------------------------------------------------------------------------- +// Cossadapmt::SpecialCharSearchL +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Cossadapmt::SpecialCharSearchL( CStifItemParser& aItem ) + { + return SearchL ( aItem, ESearchSpecialChars ); + } +// ----------------------------------------------------------------------------- +// Cossadapmt::SearchEmailIDL +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Cossadapmt::SearchEmailIDL( CStifItemParser& aItem ) + { + return SearchL ( aItem, ESearchEmailid ); + } +// ----------------------------------------------------------------------------- +// Cossadapmt::LoginL +// Login test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Cossadapmt::LoginL ( CStifItemParser& aItem ) + { + + + + //Initialize XIMP client + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::LoginL() start" ) ); + + MXIMPClient* ximpClient = MXIMPClient::NewClientL(); + CleanupDeletePushL ( ximpClient ); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::MXIMPClient::NewClientL() start" ) ); + + //Create new sink to receive presence context events + CUSContextObserver* eventObserver = CUSContextObserver::NewLC(); + + //Create new presence context + MXIMPContext* presecenCtx = ximpClient->NewPresenceContextLC(); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::ximpClient->NewPresenceContextLC() called" ) ); + presecenCtx->RegisterObserverL ( *eventObserver ); + + //read data from cfg file + TPtrC username; + TPtrC password; + TInt serviceId; + + aItem.GetNextString ( username ); + aItem.GetNextString ( password ); + aItem.GetNextInt ( serviceId ); + + TUid protocolUid = TUid::Uid ( KProtocolUid ); + + //Bind context to desired presence service + TXIMPRequestId req = presecenCtx->BindToL ( protocolUid, + username, + password, + serviceId ); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::presecenCtx->BindToL() called" ) ); + //Wait with CActiveSchedulerWait the binding to complete + //If binding fails, it is handled with leave + eventObserver->WaitOpToCompleteL ( req ); + + + //Unbind the context and wait completion + req = presecenCtx->UnbindL(); + eventObserver->WaitOpToCompleteL( req ); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::WaitOpToCompleteL() end" ) ); + + CleanupStack::PopAndDestroy ( 3 ); //presecenCtx,eventObserver,ximpClient + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::LoginL() End" ) ); + return KErrNone; + + } +// ----------------------------------------------------------------------------- +// Cossadapmt::Login_InvalidDataL +// Login test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Cossadapmt::Login_InvalidDataL ( CStifItemParser& aItem ) + { + + + + //Initialize XIMP client + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::Login_InvalidDataL() start" ) ); + + MXIMPClient* ximpClient = MXIMPClient::NewClientL(); + CleanupDeletePushL ( ximpClient ); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::MXIMPClient::NewClientL() start" ) ); + + //Create new sink to receive presence context events + CUSContextObserver* eventObserver = CUSContextObserver::NewLC(); + + //Create new presence context + MXIMPContext* presecenCtx = ximpClient->NewPresenceContextLC(); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::ximpClient->NewPresenceContextLC() called" ) ); + presecenCtx->RegisterObserverL ( *eventObserver ); + + //read data from cfg file + TPtrC username; + TPtrC password; + TInt serviceId; + + aItem.GetNextString ( username ); + aItem.GetNextString ( password ); + aItem.GetNextInt ( serviceId ); + + TUid protocolUid = TUid::Uid ( KProtocolUid ); + + //Bind context to desired presence service + TXIMPRequestId req = presecenCtx->BindToL ( protocolUid, + username, + password, + serviceId ); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::presecenCtx->BindToL() called" ) ); + //Wait with CActiveSchedulerWait the binding to complete + //If binding fails, it is handled with leave + eventObserver->WaitOpToCompleteL ( req ); + + CleanupStack::PopAndDestroy ( 3 ); //presecenCtx,eventObserver,ximpClient + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::Login_InvalidDataL() End" ) ); + return KErrNone; + + } +// ----------------------------------------------------------------------------- +// Cossadapmt::Login8HrsLogoutL +// Login test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Cossadapmt::Login8HrsLogoutL ( CStifItemParser& aItem ) + { + + + + //Initialize XIMP client + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::Login8HrsLogoutL() start" ) ); + + MXIMPClient* ximpClient = MXIMPClient::NewClientL(); + CleanupDeletePushL ( ximpClient ); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::MXIMPClient::NewClientL() start" ) ); + + //Create new sink to receive presence context events + CUSContextObserver* eventObserver = CUSContextObserver::NewLC(); + + //Create new presence context + MXIMPContext* presecenCtx = ximpClient->NewPresenceContextLC(); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::ximpClient->NewPresenceContextLC() called" ) ); + presecenCtx->RegisterObserverL ( *eventObserver ); + + + //read data from cfg file + TPtrC username; + TPtrC password; + TInt serviceId; + + aItem.GetNextString ( username ); + aItem.GetNextString ( password ); + aItem.GetNextInt ( serviceId ); + + TUid protocolUid = TUid::Uid ( KProtocolUid ); + + //Bind context to desired presence service + TXIMPRequestId req = presecenCtx->BindToL ( protocolUid, + username, + password, + serviceId ); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::presecenCtx->BindToL() called" ) ); + //Wait with CActiveSchedulerWait the binding to complete + //If binding fails, it is handled with leave + eventObserver->WaitOpToCompleteL ( req ); + CUserAfter::After8HrsL (); + + //Unbind the context and wait completion + req = presecenCtx->UnbindL(); + eventObserver->WaitOpToCompleteL( req ); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::WaitOpToCompleteL() end" ) ); + + CleanupStack::PopAndDestroy ( 3 ); //presecenCtx,eventObserver,ximpClient + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::Login8HrsLogoutL() End" ) ); + return KErrNone; + + } + +// ----------------------------------------------------------------------------- +// Cossadapmt::LoginLogout_LoginLogoutL +// Login test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Cossadapmt::LoginLogout_LoginLogoutL ( CStifItemParser& aItem ) + { + + + + //Initialize XIMP client + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::LoginLogout_Log() start" ) ); + + MXIMPClient* ximpClient = MXIMPClient::NewClientL(); + CleanupDeletePushL ( ximpClient ); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::MXIMPClient::NewClientL() start" ) ); + + //Create new sink to receive presence context events + CUSContextObserver* eventObserver = CUSContextObserver::NewLC(); + + //Create new presence context + MXIMPContext* presecenCtx = ximpClient->NewPresenceContextLC(); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::ximpClient->NewPresenceContextLC() called" ) ); + presecenCtx->RegisterObserverL ( *eventObserver ); + //read data from cfg file + TPtrC username; + TPtrC password; + TInt serviceId; + + aItem.GetNextString ( username ); + aItem.GetNextString ( password ); + aItem.GetNextInt ( serviceId ); + + TUid protocolUid = TUid::Uid ( KProtocolUid ); + + //Bind context to desired presence service + TXIMPRequestId req = presecenCtx->BindToL ( protocolUid, + username, + password, + serviceId ); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::presecenCtx->BindToL() called - Sequence 1" ) ); + //Wait with CActiveSchedulerWait the binding to complete + //If binding fails, it is handled with leave + eventObserver->WaitOpToCompleteL ( req ); + + //Unbind the context and wait completion + req = presecenCtx->UnbindL(); + eventObserver->WaitOpToCompleteL( req ); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::WaitOpToCompleteL() end- Sequence 1 complete" ) ); + + +/// Login --- Logout - Sequence 2 + //Bind context to desired presence service + req = presecenCtx->BindToL ( protocolUid, + username, + password, + serviceId ); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::presecenCtx->BindToL() called - Sequence 2" ) ); + //Wait with CActiveSchedulerWait the binding to complete + //If binding fails, it is handled with leave + eventObserver->WaitOpToCompleteL ( req ); + + //Unbind the context and wait completion + req = presecenCtx->UnbindL(); + eventObserver->WaitOpToCompleteL( req ); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::WaitOpToCompleteL() end - Sequence 2 complete" ) ); + + + CleanupStack::PopAndDestroy ( 3 ); //presecenCtx,eventObserver,ximpClient + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::LoginLogout_Log() End" ) ); + return KErrNone; + + } + + +// ----------------------------------------------------------------------------- +// Cossadapmt::GetContactsL +// Fetch contacts test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Cossadapmt::GetContactsL ( CStifItemParser& aItem ) + { + + //Initialize XIMP client + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::GetContactsL() start" ) ); + + MXIMPClient* ximpClient = MXIMPClient::NewClientL(); + CleanupDeletePushL ( ximpClient ); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::MXIMPClient::NewClientL() start" ) ); + + //Create new sink to receive presence context events + CUSContextObserver* eventObserver = CUSContextObserver::NewLC(); + + //Create new presence context + MXIMPContext* presecenCtx = ximpClient->NewPresenceContextLC(); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::ximpClient->NewPresenceContextLC() called" ) ); + presecenCtx->RegisterObserverL ( *eventObserver ); + MPresenceFeatures* presenceFeatures = NULL; + presenceFeatures = MPresenceFeatures::NewL ( presecenCtx ); + CleanupDeletePushL ( presenceFeatures ); + TOssAdapMtLogger::Log ( _L ( "Loading presence plugin Done" ) ); + MXIMPObjectFactory& objFactory = presecenCtx->ObjectFactory(); + MXIMPIdentity* newGroupId = objFactory.NewIdentityLC(); + MPresentityGroups& groups = presenceFeatures->PresentityGroups() ; + + TOssAdapMtLogger::Log ( _L ( "presentity groups object created" ) ); + _LIT ( KDummyListId, "list" ); + HBufC16* iListId; + iListId = KDummyListId().AllocL(); + iListId->Des().Fold(); + newGroupId->SetIdentityL ( *iListId ); + delete iListId; + iListId = NULL; + + //read data from cfg file + TPtrC username; + TPtrC password; + TInt serviceId; + + aItem.GetNextString ( username ); + aItem.GetNextString ( password ); + aItem.GetNextInt ( serviceId ); + + TUid protocolUid = TUid::Uid ( KProtocolUid ); + + //Bind context to desired presence service + TXIMPRequestId req = presecenCtx->BindToL ( protocolUid, + username, + password, + serviceId ); + + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::presecenCtx->BindToL() called" ) ); + //Wait with CActiveSchedulerWait the binding to complete + //If binding fails, it is handled with leave + eventObserver->WaitOpToCompleteL ( req ); + + + req = groups.SubscribePresentityGroupContentL ( *newGroupId ); + + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::groups.SubscribePresentityGroupListL() called" ) ); + + eventObserver->WaitOpToCompleteL ( req ); + + CUserAfter::AfterL ( 1000000 ); + //Unbind the context and wait completion + req = presecenCtx->UnbindL(); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::presecenCtx->UnbindL() called" ) ); + + eventObserver->WaitOpToCompleteL ( req ); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::WaitOpToCompleteL() end" ) ); + + CleanupStack::PopAndDestroy ( 5 );//newGroupId,presenceFeatures,presecenCtx,eventObserver,ximpClient + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::GetContactsL() end" ) ); + + return KErrNone; + + } +// ----------------------------------------------------------------------------- +// Cossadapmt::AddConatctL +// AddConatctL contacts test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Cossadapmt::AddConatctL ( CStifItemParser& aItem ) + { + + //Initialize XIMP client + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::AddContactsL() start" ) ); + + MXIMPClient* ximpClient = MXIMPClient::NewClientL(); + CleanupDeletePushL ( ximpClient ); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::MXIMPClient::NewClientL() start" ) ); + + //Create new sink to receive presence context events + CUSContextObserver* eventObserver = CUSContextObserver::NewLC(); + + //Create new presence context + MXIMPContext* presecenCtx = ximpClient->NewPresenceContextLC(); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::ximpClient->NewPresenceContextLC() called" ) ); + presecenCtx->RegisterObserverL ( *eventObserver ); + MPresenceFeatures* presenceFeatures = NULL; + presenceFeatures = MPresenceFeatures::NewL ( presecenCtx ); + CleanupDeletePushL ( presenceFeatures ); + TOssAdapMtLogger::Log ( _L ( "Loading presence plugin Done" ) ); + MXIMPObjectFactory& objFactory = presecenCtx->ObjectFactory(); + MXIMPIdentity* newGroupId = objFactory.NewIdentityLC(); + MPresentityGroups& groups = presenceFeatures->PresentityGroups() ; + MXIMPIdentity* newmemberId = objFactory.NewIdentityLC(); + + TOssAdapMtLogger::Log ( _L ( "presentity groups object created" ) ); + _LIT ( KDummyListId, "list" ); + HBufC16* iListId; + iListId = KDummyListId().AllocL(); + iListId->Des().Fold(); + newGroupId->SetIdentityL ( *iListId ); + delete iListId; + iListId = NULL; + + //read data from cfg file + TPtrC username; + TPtrC password; + TInt serviceId; + TPtrC contact; + + aItem.GetNextString ( username ); + aItem.GetNextString ( password ); + aItem.GetNextInt ( serviceId ); + aItem.GetNextString ( contact ); + + TUid protocolUid = TUid::Uid ( KProtocolUid ); + + //Bind context to desired presence service + TXIMPRequestId req = presecenCtx->BindToL ( protocolUid, + username, + password, + serviceId ); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::presecenCtx->BindToL() called" ) ); + //Wait with CActiveSchedulerWait the binding to complete + //If binding fails, it is handled with leave + eventObserver->WaitOpToCompleteL ( req ); + + req = groups.SubscribePresentityGroupContentL ( *newGroupId ); + + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::groups.SubscribePresentityGroupListL() called" ) ); + + eventObserver->WaitOpToCompleteL ( req ); + + CUserAfter::AfterL ( 1000000 ); + + newmemberId->SetIdentityL ( contact ); + + req = groups.AddPresentityGroupMemberL( + *newGroupId, + *newmemberId, + KNullDesC()) ; + + eventObserver->WaitOpToCompleteL ( req ); + CUserAfter::AfterL ( 5000000 ); + CleanupStack::PopAndDestroy();//newmemberId + //Unbind the context and wait completion + req = presecenCtx->UnbindL(); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::presecenCtx->UnbindL() called" ) ); + + eventObserver->WaitOpToCompleteL ( req ); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::WaitOpToCompleteL() end" ) ); + + CleanupStack::PopAndDestroy ( 5 );//newGroupId,presenceFeatures,presecenCtx,eventObserver,ximpClient + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::AddContactsL() end" ) ); + + return KErrNone; + + } +// ----------------------------------------------------------------------------- +// Cossadapmt::AddBlankConatctL +// AddConatctL contacts test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Cossadapmt::AddBlankConatctL ( CStifItemParser& aItem ) + { + + //Initialize XIMP client + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::AddBlankConatctL() start" ) ); + + MXIMPClient* ximpClient = MXIMPClient::NewClientL(); + CleanupDeletePushL ( ximpClient ); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::MXIMPClient::NewClientL() start" ) ); + + //Create new sink to receive presence context events + CUSContextObserver* eventObserver = CUSContextObserver::NewLC(); + + //Create new presence context + MXIMPContext* presecenCtx = ximpClient->NewPresenceContextLC(); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::ximpClient->NewPresenceContextLC() called" ) ); + presecenCtx->RegisterObserverL ( *eventObserver ); + MPresenceFeatures* presenceFeatures = NULL; + presenceFeatures = MPresenceFeatures::NewL ( presecenCtx ); + CleanupDeletePushL ( presenceFeatures ); + TOssAdapMtLogger::Log ( _L ( "Loading presence plugin Done" ) ); + MXIMPObjectFactory& objFactory = presecenCtx->ObjectFactory(); + MXIMPIdentity* newGroupId = objFactory.NewIdentityLC(); + MPresentityGroups& groups = presenceFeatures->PresentityGroups() ; + MXIMPIdentity* newmemberId = objFactory.NewIdentityLC(); + + TOssAdapMtLogger::Log ( _L ( "presentity groups object created" ) ); + _LIT ( KDummyListId, "list" ); + HBufC16* iListId; + iListId = KDummyListId().AllocL(); + iListId->Des().Fold(); + newGroupId->SetIdentityL ( *iListId ); + delete iListId; + iListId = NULL; + + //read data from cfg file + TPtrC username; + TPtrC password; + TInt serviceId; + + aItem.GetNextString ( username ); + aItem.GetNextString ( password ); + aItem.GetNextInt ( serviceId ); + + TUid protocolUid = TUid::Uid ( KProtocolUid ); + + //Bind context to desired presence service + TXIMPRequestId req = presecenCtx->BindToL ( protocolUid, + username, + password, + serviceId ); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::presecenCtx->BindToL() called" ) ); + //Wait with CActiveSchedulerWait the binding to complete + //If binding fails, it is handled with leave + eventObserver->WaitOpToCompleteL ( req ); + + + req = groups.SubscribePresentityGroupContentL ( *newGroupId ); + + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::groups.SubscribePresentityGroupListL() called" ) ); + + eventObserver->WaitOpToCompleteL ( req ); + + CUserAfter::AfterL ( 1000000 ); + _LIT ( KBlankContact, "" ); + newmemberId->SetIdentityL ( KBlankContact ); + + + req = groups.AddPresentityGroupMemberL( + *newGroupId, + *newmemberId, + KNullDesC()) ; + + eventObserver->WaitOpToCompleteL ( req ); + //Unbind the context and wait completion + req = presecenCtx->UnbindL(); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::presecenCtx->UnbindL() called" ) ); + + eventObserver->WaitOpToCompleteL ( req ); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::WaitOpToCompleteL() end" ) ); + CleanupStack::PopAndDestroy(); + CleanupStack::PopAndDestroy ( 5 );//newGroupId,presenceFeatures,presecenCtx,eventObserver,ximpClient + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::AddBlankConatctL() end" ) ); + + return KErrNone; + + } +// ----------------------------------------------------------------------------- +// Cossadapmt::AddBlankConatct1L +// AddConatctL contacts test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Cossadapmt::AddBlankConatct1L ( CStifItemParser& aItem ) + { + + //Initialize XIMP client + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::AddBlankConatctL() start" ) ); + + MXIMPClient* ximpClient = MXIMPClient::NewClientL(); + CleanupDeletePushL ( ximpClient ); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::MXIMPClient::NewClientL() start" ) ); + + //Create new sink to receive presence context events + CUSContextObserver* eventObserver = CUSContextObserver::NewLC(); + + //Create new presence context + MXIMPContext* presecenCtx = ximpClient->NewPresenceContextLC(); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::ximpClient->NewPresenceContextLC() called" ) ); + presecenCtx->RegisterObserverL ( *eventObserver ); + MPresenceFeatures* presenceFeatures = NULL; + presenceFeatures = MPresenceFeatures::NewL ( presecenCtx ); + CleanupDeletePushL ( presenceFeatures ); + TOssAdapMtLogger::Log ( _L ( "Loading presence plugin Done" ) ); + MXIMPObjectFactory& objFactory = presecenCtx->ObjectFactory(); + MXIMPIdentity* newGroupId = objFactory.NewIdentityLC(); + MPresentityGroups& groups = presenceFeatures->PresentityGroups() ; + MXIMPIdentity* newmemberId = objFactory.NewIdentityLC(); + + TOssAdapMtLogger::Log ( _L ( "presentity groups object created" ) ); + _LIT ( KDummyListId, "list" ); + HBufC16* iListId; + iListId = KDummyListId().AllocL(); + iListId->Des().Fold(); + newGroupId->SetIdentityL ( *iListId ); + delete iListId; + iListId = NULL; + + //read data from cfg file + TPtrC username; + TPtrC password; + TInt serviceId; + + aItem.GetNextString ( username ); + aItem.GetNextString ( password ); + aItem.GetNextInt ( serviceId ); + + TUid protocolUid = TUid::Uid ( KProtocolUid ); + + //Bind context to desired presence service + TXIMPRequestId req = presecenCtx->BindToL ( protocolUid, + username, + password, + serviceId ); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::presecenCtx->BindToL() called" ) ); + //Wait with CActiveSchedulerWait the binding to complete + //If binding fails, it is handled with leave + eventObserver->WaitOpToCompleteL ( req ); + + + req = groups.SubscribePresentityGroupContentL ( *newGroupId ); + + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::groups.SubscribePresentityGroupListL() called" ) ); + + eventObserver->WaitOpToCompleteL ( req ); + + CUserAfter::AfterL ( 1000000 ); + _LIT ( KBlankContact, "" ); + newmemberId->SetIdentityL ( KBlankContact ); + + req = groups.AddPresentityGroupMemberL( + *newGroupId, + *newmemberId, + KNullDesC()) ; + + eventObserver->WaitOpToCompleteL ( req ); + CleanupStack::PopAndDestroy(); //newmemberId + //Unbind the context and wait completion + req = presecenCtx->UnbindL(); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::presecenCtx->UnbindL() called" ) ); + + eventObserver->WaitOpToCompleteL ( req ); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::WaitOpToCompleteL() end" ) ); + + CleanupStack::PopAndDestroy ( 5 );//newGroupId,presenceFeatures,presecenCtx,eventObserver,ximpClient + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::AddBlankConatctL() end" ) ); + + return KErrNone; + + } +// ----------------------------------------------------------------------------- +// Cossadapmt::DeleteConatctL +// DeleteConatctL contacts test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Cossadapmt::DeleteConatctL ( CStifItemParser& aItem ) + { + + //Initialize XIMP client + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::DeleteConatctL() start" ) ); + + MXIMPClient* ximpClient = MXIMPClient::NewClientL(); + CleanupDeletePushL ( ximpClient ); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::MXIMPClient::NewClientL() start" ) ); + + //Create new sink to receive presence context events + CUSContextObserver* eventObserver = CUSContextObserver::NewLC(); + + //Create new presence context + MXIMPContext* presecenCtx = ximpClient->NewPresenceContextLC(); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::ximpClient->NewPresenceContextLC() called" ) ); + presecenCtx->RegisterObserverL ( *eventObserver ); + MPresenceFeatures* presenceFeatures = NULL; + presenceFeatures = MPresenceFeatures::NewL ( presecenCtx ); + CleanupDeletePushL ( presenceFeatures ); + TOssAdapMtLogger::Log ( _L ( "Loading presence plugin Done" ) ); + MXIMPObjectFactory& objFactory = presecenCtx->ObjectFactory(); + MXIMPIdentity* newGroupId = objFactory.NewIdentityLC(); + MPresentityGroups& groups = presenceFeatures->PresentityGroups() ; + MXIMPIdentity* newmemberId = objFactory.NewIdentityLC(); + + TOssAdapMtLogger::Log ( _L ( "presentity groups object created" ) ); + _LIT ( KDummyListId, "list" ); + HBufC16* iListId; + iListId = KDummyListId().AllocL(); + iListId->Des().Fold(); + newGroupId->SetIdentityL ( *iListId ); + delete iListId; + iListId = NULL; + + //read data from cfg file + TPtrC username; + TPtrC password; + TInt serviceId; + TPtrC contact; + + aItem.GetNextString ( username ); + aItem.GetNextString ( password ); + aItem.GetNextInt ( serviceId ); + aItem.GetNextString ( contact ); + + TUid protocolUid = TUid::Uid ( KProtocolUid ); + + //Bind context to desired presence service + TXIMPRequestId req = presecenCtx->BindToL ( protocolUid, + username, + password, + serviceId ); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::presecenCtx->BindToL() called" ) ); + //Wait with CActiveSchedulerWait the binding to complete + //If binding fails, it is handled with leave + eventObserver->WaitOpToCompleteL ( req ); + + + req = groups.SubscribePresentityGroupContentL ( *newGroupId ); + + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::groups.SubscribePresentityGroupListL() called" ) ); + + eventObserver->WaitOpToCompleteL ( req ); + + CUserAfter::AfterL ( 1000000 ); + + newmemberId->SetIdentityL ( contact ); + + req = groups.RemovePresentityGroupMemberL( + *newGroupId, + *newmemberId) ; + + eventObserver->WaitOpToCompleteL ( req ); + CleanupStack::PopAndDestroy();//newmemberId + //Unbind the context and wait completion + req = presecenCtx->UnbindL(); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::presecenCtx->UnbindL() called" ) ); + + eventObserver->WaitOpToCompleteL ( req ); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::WaitOpToCompleteL() end" ) ); + + CleanupStack::PopAndDestroy ( 5 );//newGroupId,presenceFeatures,presecenCtx,eventObserver,ximpClient + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::DeleteConatctL() end" ) ); + + return KErrNone; + + } +// ----------------------------------------------------------------------------- +// Cossadapmt::DeleteBlankConatctL +// DeleteConatctL contacts test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Cossadapmt::DeleteBlankConatctL ( CStifItemParser& aItem ) + { + + //Initialize XIMP client + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::DeleteBlankConatctL() start" ) ); + + MXIMPClient* ximpClient = MXIMPClient::NewClientL(); + CleanupDeletePushL ( ximpClient ); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::MXIMPClient::NewClientL() start" ) ); + + //Create new sink to receive presence context events + CUSContextObserver* eventObserver = CUSContextObserver::NewLC(); + + //Create new presence context + MXIMPContext* presecenCtx = ximpClient->NewPresenceContextLC(); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::ximpClient->NewPresenceContextLC() called" ) ); + presecenCtx->RegisterObserverL ( *eventObserver ); + MPresenceFeatures* presenceFeatures = NULL; + presenceFeatures = MPresenceFeatures::NewL ( presecenCtx ); + CleanupDeletePushL ( presenceFeatures ); + TOssAdapMtLogger::Log ( _L ( "Loading presence plugin Done" ) ); + MXIMPObjectFactory& objFactory = presecenCtx->ObjectFactory(); + MXIMPIdentity* newGroupId = objFactory.NewIdentityLC(); + MPresentityGroups& groups = presenceFeatures->PresentityGroups() ; + MXIMPIdentity* newmemberId = objFactory.NewIdentityLC(); + + TOssAdapMtLogger::Log ( _L ( "presentity groups object created" ) ); + _LIT ( KDummyListId, "list" ); + HBufC16* iListId; + iListId = KDummyListId().AllocL(); + iListId->Des().Fold(); + newGroupId->SetIdentityL ( *iListId ); + delete iListId; + iListId = NULL; + + //read data from cfg file + TPtrC username; + TPtrC password; + TInt serviceId; + + aItem.GetNextString ( username ); + aItem.GetNextString ( password ); + aItem.GetNextInt ( serviceId ); + + TUid protocolUid = TUid::Uid ( KProtocolUid ); + + //Bind context to desired presence service + TXIMPRequestId req = presecenCtx->BindToL ( protocolUid, + username, + password, + serviceId ); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::presecenCtx->BindToL() called" ) ); + //Wait with CActiveSchedulerWait the binding to complete + //If binding fails, it is handled with leave + eventObserver->WaitOpToCompleteL ( req ); + + + req = groups.SubscribePresentityGroupContentL ( *newGroupId ); + + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::groups.SubscribePresentityGroupListL() called" ) ); + + eventObserver->WaitOpToCompleteL ( req ); + + CUserAfter::AfterL ( 1000000 ); + _LIT ( KBlankContact, "" ); + newmemberId->SetIdentityL (KBlankContact); + + req = groups.RemovePresentityGroupMemberL( + *newGroupId, + *newmemberId) ; + + eventObserver->WaitOpToCompleteL ( req ); + CleanupStack::PopAndDestroy(); //newmemberId + //Unbind the context and wait completion + req = presecenCtx->UnbindL(); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::presecenCtx->UnbindL() called" ) ); + + eventObserver->WaitOpToCompleteL ( req ); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::WaitOpToCompleteL() end" ) ); + + CleanupStack::PopAndDestroy ( 5 );//newGroupId,presenceFeatures,presecenCtx,eventObserver,ximpClient + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::DeleteBlankConatctL() end" ) ); + + return KErrNone; + + } +// ----------------------------------------------------------------------------- +// Cossadapmt::UnBindL +// UnBind test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Cossadapmt::UnBindL ( CStifItemParser& aItem ) + { + + //Initialize XIMP client + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::UnBindL() start" ) ); + + MXIMPClient* ximpClient = MXIMPClient::NewClientL(); + CleanupDeletePushL ( ximpClient ); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::MXIMPClient::NewClientL() start" ) ); + + //Create new sink to receive presence context events + CUSContextObserver* eventObserver = CUSContextObserver::NewLC(); + + //Create new presence context + MXIMPContext* presecenCtx = ximpClient->NewPresenceContextLC(); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::ximpClient->NewPresenceContextLC() called" ) ); + presecenCtx->RegisterObserverL ( *eventObserver ); + + //read data from cfg file + TPtrC username; + TPtrC password; + TInt serviceId; + + aItem.GetNextString ( username ); + aItem.GetNextString ( password ); + aItem.GetNextInt ( serviceId ); + + TUid protocolUid = TUid::Uid ( KProtocolUid ); + + //Bind context to desired presence service + TXIMPRequestId req = presecenCtx->BindToL ( protocolUid, + username, + password, + serviceId ); + + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::presecenCtx->BindToL() called" ) ); + //Wait with CActiveSchedulerWait the binding to complete + //If binding fails, it is handled with leave + eventObserver->WaitOpToCompleteL ( req ); + + + //Unbind the context and wait completion + req = presecenCtx->UnbindL(); + eventObserver->WaitOpToCompleteL( req ); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::WaitOpToCompleteL() end" ) ); + + + CleanupStack::Pop ( 3 ); //presecenCtx,eventObserver,ximpClient + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::UnBindL() End" ) ); + return KErrNone; + + + } + +// ----------------------------------------------------------------------------- +// Cossadapmt::SendMessageL +// SendMessage test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Cossadapmt::SendMessageL ( CStifItemParser& aItem ) + { + + //Initialize XIMP client + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::SendMessageL() start" ) ); + MXIMPClient* ximpClient = MXIMPClient::NewClientL(); + CleanupDeletePushL ( ximpClient ); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::MXIMPClient::NewClientL() start" ) ); + //Create new sink to receive presence context events + CUSContextObserver* eventObserver = CUSContextObserver::NewLC(); + //Create new presence context + MXIMPContext* presecenCtx = ximpClient->NewPresenceContextLC(); + //Bind context to desired presence service + presecenCtx->RegisterObserverL ( *eventObserver ); + MPresenceFeatures* presenceFeatures = NULL; + presenceFeatures = MPresenceFeatures::NewL ( presecenCtx ); + CleanupDeletePushL ( presenceFeatures ); + + //read data from cfg file + TPtrC username; + TPtrC password; + TInt serviceId; + TPtrC message; + TPtrC recipient; + + aItem.GetNextString ( username ); + aItem.GetNextString ( password ); + aItem.GetNextInt ( serviceId ); + aItem.GetNextString ( message ); + aItem.GetNextString ( recipient ); + + TUid protocolUid = TUid::Uid ( KProtocolUid ); + + //Bind context to desired presence service + TXIMPRequestId req = presecenCtx->BindToL ( protocolUid, + username, + password, + serviceId ); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::ximpClient->NewPresenceContextLC() called\n" ) ); + eventObserver->WaitOpToCompleteL ( req ); + MXIMPObjectFactory& objFactory = presecenCtx->ObjectFactory(); + MXIMPIdentity* newGroupId = objFactory.NewIdentityLC(); + MPresentityGroups& groups = presenceFeatures->PresentityGroups() ; + + TOssAdapMtLogger::Log ( _L ( "presentity groups object created" ) ); + _LIT ( KDummyListId, "" ); + HBufC16* iListId; + iListId = KDummyListId().AllocL(); + iListId->Des().Fold(); + newGroupId->SetIdentityL ( *iListId ); + delete iListId; + iListId = NULL; + req = groups.SubscribePresentityGroupContentL ( *newGroupId ); + + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::groups.SubscribePresentityGroupListL() called" ) ); + + eventObserver->WaitOpToCompleteL ( req ); + CleanupStack::PopAndDestroy(2); //newGroupId,presenceFeatures + + CUserAfter::AfterL ( 1000000 ); + //Bind context to desired presence service + MImFeatures* imFeatures = NULL; + imFeatures = MImFeatures::NewL ( presecenCtx ); + CleanupDeletePushL ( imFeatures ); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::imFeatures created\n" ) ); + MImConversation& imconversation = imFeatures->ImConversation(); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::imconversation created\n" ) ); + MImConversationInfo *aImMessage = NULL; + aImMessage = imFeatures->ImObjectFactory().NewImConversationInfoLC(); + MXIMPIdentity* identity = objFactory.NewIdentityLC(); + identity->SetIdentityL ( KMsgId ); + aImMessage->SetMessageIdL ( identity ); + aImMessage->SetTextMessageL ( message ); + CDesCArrayFlat* aRecipients = new ( ELeave ) CDesCArrayFlat ( 2 ); + CleanupStack::PushL ( aRecipients ); + aRecipients->AppendL ( recipient );//userid's + aImMessage->SetRecipientL ( aRecipients ); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::before sendmessage called\n" ) ); + + req = imconversation.SendMessageL ( *aImMessage ); + eventObserver->WaitOpToCompleteL ( req ); + CleanupStack::Pop ( 3 );//identity,aRecipients,aImMessage + //Unbind the context and wait completion + CUserAfter::AfterL ( 2000000 ); + req = presecenCtx->UnbindL(); + eventObserver->WaitOpToCompleteL( req ); + + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::message sent\n " ) ); + CleanupStack::PopAndDestroy(4); //imFeatures,presecenCtx,eventObserver,ximpClient, + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::SendMessageL() end" ) ); + + return KErrNone; + + } +// ----------------------------------------------------------------------------- +// Cossadapmt::SendEmptyMessageL +// SendMessage test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Cossadapmt::SendEmptyMessageL ( CStifItemParser& aItem ) + { + + //Initialize XIMP client + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::SendEmptyMessageL() start" ) ); + MXIMPClient* ximpClient = MXIMPClient::NewClientL(); + CleanupDeletePushL ( ximpClient ); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::MXIMPClient::NewClientL() start" ) ); + //Create new sink to receive presence context events + CUSContextObserver* eventObserver = CUSContextObserver::NewLC(); + //Create new presence context + MXIMPContext* presecenCtx = ximpClient->NewPresenceContextLC(); + //Bind context to desired presence service + presecenCtx->RegisterObserverL ( *eventObserver ); + MPresenceFeatures* presenceFeatures = NULL; + presenceFeatures = MPresenceFeatures::NewL ( presecenCtx ); + CleanupDeletePushL ( presenceFeatures ); + + //read data from cfg file + TPtrC username; + TPtrC password; + TInt serviceId; + TPtrC recipient; + + aItem.GetNextString ( username ); + aItem.GetNextString ( password ); + aItem.GetNextInt ( serviceId ); + aItem.GetNextString ( recipient ); + + TUid protocolUid = TUid::Uid ( KProtocolUid ); + + //Bind context to desired presence service + TXIMPRequestId req = presecenCtx->BindToL ( protocolUid, + username, + password, + serviceId ); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::ximpClient->NewPresenceContextLC() called\n" ) ); + eventObserver->WaitOpToCompleteL ( req ); + MXIMPObjectFactory& objFactory = presecenCtx->ObjectFactory(); + MXIMPIdentity* newGroupId = objFactory.NewIdentityLC(); + MPresentityGroups& groups = presenceFeatures->PresentityGroups() ; + + TOssAdapMtLogger::Log ( _L ( "presentity groups object created" ) ); + _LIT ( KDummyListId, "" ); + _LIT ( KEmptyMessage, "" ); + HBufC16* iListId; + iListId = KDummyListId().AllocL(); + iListId->Des().Fold(); + newGroupId->SetIdentityL ( *iListId ); + delete iListId; + iListId = NULL; + req = groups.SubscribePresentityGroupContentL ( *newGroupId ); + + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::groups.SubscribePresentityGroupListL() called" ) ); + + eventObserver->WaitOpToCompleteL ( req ); + CleanupStack::PopAndDestroy(2); //newGroupId,presenceFeatures + + CUserAfter::AfterL ( 1000000 ); + //Bind context to desired presence service + MImFeatures* imFeatures = NULL; + imFeatures = MImFeatures::NewL ( presecenCtx ); + CleanupDeletePushL ( imFeatures ); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::imFeatures created\n" ) ); + MImConversation& imconversation = imFeatures->ImConversation(); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::imconversation created\n" ) ); + MImConversationInfo *aImMessage = NULL; + aImMessage = imFeatures->ImObjectFactory().NewImConversationInfoLC(); + MXIMPIdentity* identity = objFactory.NewIdentityLC(); + identity->SetIdentityL ( KMsgId ); + aImMessage->SetMessageIdL ( identity ); + aImMessage->SetTextMessageL ( KEmptyMessage ); + CDesCArrayFlat* aRecipients = new ( ELeave ) CDesCArrayFlat ( 2 ); + CleanupStack::PushL ( aRecipients ); + aRecipients->AppendL ( recipient );//userid's + aImMessage->SetRecipientL ( aRecipients ); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::before sendmessage called\n" ) ); + + req = imconversation.SendMessageL ( *aImMessage ); + eventObserver->WaitOpToCompleteL ( req ); + CleanupStack::Pop ( 3 );//identity,aRecipients,aImMessage + //Unbind the context and wait completion + req = presecenCtx->UnbindL(); + eventObserver->WaitOpToCompleteL( req ); + + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::message sent\n " ) ); + CleanupStack::PopAndDestroy(4); //imFeatures,presecenCtx,eventObserver,ximpClient, + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::SendEmptyMessageL() end" ) ); + + return KErrNone; + + } + +// ----------------------------------------------------------------------------- +// Cossadapmt::SendTenMessageL +// SendMessage test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Cossadapmt::SendTenMessageL ( CStifItemParser& aItem ) + { + + //Initialize XIMP client + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::SendTenMessageL() start" ) ); + MXIMPClient* ximpClient = MXIMPClient::NewClientL(); + CleanupDeletePushL ( ximpClient ); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::MXIMPClient::NewClientL() start" ) ); + //Create new sink to receive presence context events + CUSContextObserver* eventObserver = CUSContextObserver::NewLC(); + //Create new presence context + MXIMPContext* presecenCtx = ximpClient->NewPresenceContextLC(); + //Bind context to desired presence service + presecenCtx->RegisterObserverL ( *eventObserver ); + MPresenceFeatures* presenceFeatures = NULL; + presenceFeatures = MPresenceFeatures::NewL ( presecenCtx ); + CleanupDeletePushL ( presenceFeatures ); + + //read data from cfg file + TPtrC username; + TPtrC password; + TInt serviceId; + TPtrC message; + TPtrC recipient; + + aItem.GetNextString ( username ); + aItem.GetNextString ( password ); + aItem.GetNextInt ( serviceId ); + aItem.GetNextString ( message ); + aItem.GetNextString ( recipient ); + + TUid protocolUid = TUid::Uid ( KProtocolUid ); + + //Bind context to desired presence service + TXIMPRequestId req = presecenCtx->BindToL ( protocolUid, + username, + password, + serviceId ); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::ximpClient->NewPresenceContextLC() called\n" ) ); + eventObserver->WaitOpToCompleteL ( req ); + MXIMPObjectFactory& objFactory = presecenCtx->ObjectFactory(); + MXIMPIdentity* newGroupId = objFactory.NewIdentityLC(); + MPresentityGroups& groups = presenceFeatures->PresentityGroups() ; + + TOssAdapMtLogger::Log ( _L ( "presentity groups object created" ) ); + _LIT ( KDummyListId, "" ); + HBufC16* iListId; + iListId = KDummyListId().AllocL(); + iListId->Des().Fold(); + newGroupId->SetIdentityL ( *iListId ); + delete iListId; + iListId = NULL; + req = groups.SubscribePresentityGroupContentL ( *newGroupId ); + + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::groups.SubscribePresentityGroupListL() called" ) ); + + eventObserver->WaitOpToCompleteL ( req ); + CleanupStack::PopAndDestroy(2); //newGroupId,presenceFeatures + + CUserAfter::AfterL ( 1000000 ); + //Bind context to desired presence service + MImFeatures* imFeatures = NULL; + imFeatures = MImFeatures::NewL ( presecenCtx ); + CleanupDeletePushL ( imFeatures ); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::imFeatures created\n" ) ); + MImConversation& imconversation = imFeatures->ImConversation(); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::imconversation created\n" ) ); + MImConversationInfo *aImMessage = NULL; + aImMessage = imFeatures->ImObjectFactory().NewImConversationInfoLC(); + MXIMPIdentity* identity = objFactory.NewIdentityLC(); + identity->SetIdentityL ( KMsgId ); + aImMessage->SetMessageIdL ( identity ); + aImMessage->SetTextMessageL ( message ); + CDesCArrayFlat* aRecipients = new ( ELeave ) CDesCArrayFlat ( 2 ); + CleanupStack::PushL ( aRecipients ); + aRecipients->AppendL ( recipient ); //userid's + aImMessage->SetRecipientL ( aRecipients ); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::before sendmessage called\n" ) ); + + for ( TInt i = 0;i < 10;i++ ) + { + req = imconversation.SendMessageL ( *aImMessage ); + eventObserver->WaitOpToCompleteL ( req ); + + } + CleanupStack::Pop ( 3 );//identity,aRecipients,aImMessage + + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::message sent\n " ) ); + //Unbind the context and wait completion + req = presecenCtx->UnbindL(); + eventObserver->WaitOpToCompleteL( req ); + CleanupStack::PopAndDestroy(4); //imFeatures,presecenCtx,eventObserver,ximpClient, + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::SendTenMessageL() end" ) ); + + return KErrNone; + + } + +// ----------------------------------------------------------------------------- +// Cossadapmt::SendTwentyMessageL +// SendMessage test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Cossadapmt::SendTwentyMessageL ( CStifItemParser& aItem ) + { + + //Initialize XIMP client + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::SendTwentyMessageL() start" ) ); + MXIMPClient* ximpClient = MXIMPClient::NewClientL(); + CleanupDeletePushL ( ximpClient ); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::MXIMPClient::NewClientL() start" ) ); + //Create new sink to receive presence context events + CUSContextObserver* eventObserver = CUSContextObserver::NewLC(); + //Create new presence context + MXIMPContext* presecenCtx = ximpClient->NewPresenceContextLC(); + //Bind context to desired presence service + presecenCtx->RegisterObserverL ( *eventObserver ); + MPresenceFeatures* presenceFeatures = NULL; + presenceFeatures = MPresenceFeatures::NewL ( presecenCtx ); + CleanupDeletePushL ( presenceFeatures ); + + //read data from cfg file + TPtrC username; + TPtrC password; + TInt serviceId; + TPtrC message; + TPtrC recipient; + + aItem.GetNextString ( username ); + aItem.GetNextString ( password ); + aItem.GetNextInt ( serviceId ); + aItem.GetNextString ( message ); + aItem.GetNextString ( recipient ); + + TUid protocolUid = TUid::Uid ( KProtocolUid ); + + //Bind context to desired presence service + TXIMPRequestId req = presecenCtx->BindToL ( protocolUid, + username, + password, + serviceId ); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::ximpClient->NewPresenceContextLC() called\n" ) ); + eventObserver->WaitOpToCompleteL ( req ); + MXIMPObjectFactory& objFactory = presecenCtx->ObjectFactory(); + MXIMPIdentity* newGroupId = objFactory.NewIdentityLC(); + MPresentityGroups& groups = presenceFeatures->PresentityGroups() ; + + TOssAdapMtLogger::Log ( _L ( "presentity groups object created" ) ); + _LIT ( KDummyListId, "" ); + HBufC16* iListId; + iListId = KDummyListId().AllocL(); + iListId->Des().Fold(); + newGroupId->SetIdentityL ( *iListId ); + delete iListId; + iListId = NULL; + req = groups.SubscribePresentityGroupContentL ( *newGroupId ); + + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::groups.SubscribePresentityGroupListL() called" ) ); + + eventObserver->WaitOpToCompleteL ( req ); + CleanupStack::PopAndDestroy(2); //newGroupId,presenceFeatures + + CUserAfter::AfterL ( 1000000 ); + //Bind context to desired presence service + MImFeatures* imFeatures = NULL; + imFeatures = MImFeatures::NewL ( presecenCtx ); + CleanupDeletePushL ( imFeatures ); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::imFeatures created\n" ) ); + MImConversation& imconversation = imFeatures->ImConversation(); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::imconversation created\n" ) ); + MImConversationInfo *aImMessage = NULL; + aImMessage = imFeatures->ImObjectFactory().NewImConversationInfoLC(); + MXIMPIdentity* identity = objFactory.NewIdentityLC(); + identity->SetIdentityL ( KMsgId ); + aImMessage->SetMessageIdL ( identity ); + aImMessage->SetTextMessageL ( message ); + CDesCArrayFlat* aRecipients = new ( ELeave ) CDesCArrayFlat ( 2 ); + CleanupStack::PushL ( aRecipients ); //userid's + aRecipients->AppendL ( recipient ); + aImMessage->SetRecipientL ( aRecipients ); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::before sendmessage called\n" ) ); + + for ( TInt i = 0;i < 20;i++ ) + { + req = imconversation.SendMessageL ( *aImMessage ); + eventObserver->WaitOpToCompleteL ( req ); + + } + CleanupStack::Pop ( 3 );//identity,aRecipients,aImMessage + + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::message sent\n " ) ); + //Unbind the context and wait completion + req = presecenCtx->UnbindL(); + eventObserver->WaitOpToCompleteL( req ); + CleanupStack::PopAndDestroy(4); //imFeatures,presecenCtx,eventObserver,ximpClient, + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::SendTwentyMessageL() end" ) ); + + return KErrNone; + + } + +// ----------------------------------------------------------------------------- +// Cossadapmt::SendMessage_MultipleContactsL +// SendMessage test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Cossadapmt::SendMessage_MultipleContactsL ( CStifItemParser& aItem ) + { + + //Initialize XIMP client + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::SendMessage_MultipleContactsL() start" ) ); + MXIMPClient* ximpClient = MXIMPClient::NewClientL(); + CleanupDeletePushL ( ximpClient ); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::MXIMPClient::NewClientL() start" ) ); + //Create new sink to receive presence context events + CUSContextObserver* eventObserver = CUSContextObserver::NewLC(); + //Create new presence context + MXIMPContext* presecenCtx = ximpClient->NewPresenceContextLC(); + //Bind context to desired presence service + presecenCtx->RegisterObserverL ( *eventObserver ); + MPresenceFeatures* presenceFeatures = NULL; + presenceFeatures = MPresenceFeatures::NewL ( presecenCtx ); + CleanupDeletePushL ( presenceFeatures ); + + //read data from cfg file + TPtrC username; + TPtrC password; + TInt serviceId; + TPtrC message; + TPtrC recipient; + TPtrC recipient1; + TPtrC recipient2; + TPtrC recipient3; + + aItem.GetNextString ( username ); + aItem.GetNextString ( password ); + aItem.GetNextInt ( serviceId ); + aItem.GetNextString ( message ); + aItem.GetNextString ( recipient ); + aItem.GetNextString ( recipient1 ); + aItem.GetNextString ( recipient2 ); + aItem.GetNextString ( recipient3 ); + + TUid protocolUid = TUid::Uid ( KProtocolUid ); + + //Bind context to desired presence service + TXIMPRequestId req = presecenCtx->BindToL ( protocolUid, + username, + password, + serviceId ); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::ximpClient->NewPresenceContextLC() called\n" ) ); + eventObserver->WaitOpToCompleteL ( req ); + MXIMPObjectFactory& objFactory = presecenCtx->ObjectFactory(); + MXIMPIdentity* newGroupId = objFactory.NewIdentityLC(); + MPresentityGroups& groups = presenceFeatures->PresentityGroups() ; + + TOssAdapMtLogger::Log ( _L ( "presentity groups object created" ) ); + _LIT ( KDummyListId, "" ); + HBufC16* iListId; + iListId = KDummyListId().AllocL(); + iListId->Des().Fold(); + newGroupId->SetIdentityL ( *iListId ); + delete iListId; + iListId = NULL; + req = groups.SubscribePresentityGroupContentL ( *newGroupId ); + + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::groups.SubscribePresentityGroupListL() called" ) ); + + eventObserver->WaitOpToCompleteL ( req ); + CleanupStack::PopAndDestroy(2); //newGroupId,presenceFeatures + + CUserAfter::AfterL ( 1000000 ); + //Bind context to desired presence service + MImFeatures* imFeatures = NULL; + imFeatures = MImFeatures::NewL ( presecenCtx ); + CleanupDeletePushL ( imFeatures ); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::imFeatures created\n" ) ); + MImConversation& imconversation = imFeatures->ImConversation(); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::imconversation created\n" ) ); + MImConversationInfo *aImMessage = NULL; + aImMessage = imFeatures->ImObjectFactory().NewImConversationInfoLC(); + MXIMPIdentity* identity = objFactory.NewIdentityLC(); + identity->SetIdentityL ( KMsgId ); + aImMessage->SetMessageIdL ( identity ); + aImMessage->SetTextMessageL ( message ); + CDesCArrayFlat* aRecipients = new ( ELeave ) CDesCArrayFlat ( 2 ); + CleanupStack::PushL ( aRecipients ); + aRecipients->AppendL ( recipient ); //userid's + aRecipients->AppendL ( recipient1 ); + aRecipients->AppendL ( recipient2 ); + aRecipients->AppendL ( recipient3 ); + + aImMessage->SetRecipientL ( aRecipients ); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::before sendmessage called\n" ) ); + + req = imconversation.SendMessageL ( *aImMessage ); + eventObserver->WaitOpToCompleteL ( req ); + CleanupStack::Pop ( 3 );//identity,aRecipients,aImMessage + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::message sent\n " ) ); + CUserAfter::AfterL ( 1000000 ); + + //Unbind the context and wait completion + req = presecenCtx->UnbindL(); + eventObserver->WaitOpToCompleteL( req ); + CleanupStack::PopAndDestroy(4); //imFeatures,presecenCtx,eventObserver,ximpClient, + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::SendMessage_MultipleContactsL() end" ) ); + + return KErrNone; + + } + +// ----------------------------------------------------------------------------- +// Cossadapmt::ReceiveMessageL +// SendMessage test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Cossadapmt::ReceiveMessageL ( CStifItemParser& aItem ) + { + + //Initialize XIMP client + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::ReceiveMessageL() start" ) ); + MXIMPClient* ximpClient = MXIMPClient::NewClientL(); + CleanupDeletePushL ( ximpClient ); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::MXIMPClient::NewClientL() start" ) ); + //Create new sink to receive presence context events + CUSContextObserver* eventObserver = CUSContextObserver::NewLC(); + //Create new presence context + MXIMPContext* presecenCtx = ximpClient->NewPresenceContextLC(); + //Bind context to desired presence service + presecenCtx->RegisterObserverL ( *eventObserver ); + MPresenceFeatures* presenceFeatures = NULL; + presenceFeatures = MPresenceFeatures::NewL ( presecenCtx ); + CleanupDeletePushL ( presenceFeatures ); + + //read data from cfg file + TPtrC username; + TPtrC password; + TInt serviceId; + TPtrC message; + + aItem.GetNextString ( username ); + aItem.GetNextString ( password ); + aItem.GetNextInt ( serviceId ); + aItem.GetNextString ( message ); + + TUid protocolUid = TUid::Uid ( KProtocolUid ); + + //Bind context to desired presence service + TXIMPRequestId req = presecenCtx->BindToL ( protocolUid, + username, + password, + serviceId ); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::ximpClient->NewPresenceContextLC() called\n" ) ); + eventObserver->WaitOpToCompleteL ( req ); + MXIMPObjectFactory& objFactory = presecenCtx->ObjectFactory(); + MXIMPIdentity* newGroupId = objFactory.NewIdentityLC(); + MPresentityGroups& groups = presenceFeatures->PresentityGroups() ; + + TOssAdapMtLogger::Log ( _L ( "presentity groups object created" ) ); + _LIT ( KDummyListId, "" ); + HBufC16* iListId; + iListId = KDummyListId().AllocL(); + iListId->Des().Fold(); + newGroupId->SetIdentityL ( *iListId ); + delete iListId; + iListId = NULL; + req = groups.SubscribePresentityGroupContentL ( *newGroupId ); + + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::groups.SubscribePresentityGroupListL() called" ) ); + + eventObserver->WaitOpToCompleteL ( req ); + CleanupStack::PopAndDestroy(2); //newGroupId,presenceFeatures + + CUserAfter::AfterL ( 1000000 ); + //Bind context to desired presence service + MImFeatures* imFeatures = NULL; + imFeatures = MImFeatures::NewL ( presecenCtx ); + CleanupDeletePushL ( imFeatures ); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::imFeatures created\n" ) ); + MImConversation& imconversation = imFeatures->ImConversation(); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::imconversation created\n" ) ); + MImConversationInfo *aImMessage = NULL; + aImMessage = imFeatures->ImObjectFactory().NewImConversationInfoLC(); + MXIMPIdentity* identity = objFactory.NewIdentityLC(); + identity->SetIdentityL ( KMsgId ); + aImMessage->SetMessageIdL ( identity ); + aImMessage->SetTextMessageL ( message ); + CDesCArrayFlat* aRecipients = new ( ELeave ) CDesCArrayFlat ( 1 ); + CleanupStack::PushL ( aRecipients ); + aRecipients->AppendL ( username ); //userid of own + aImMessage->SetRecipientL ( aRecipients ); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::before sendmessage called\n" ) ); + //send message is to own + req = imconversation.SendMessageL ( *aImMessage ); + eventObserver->WaitOpToCompleteL ( req ); + CleanupStack::Pop ( 3 );//identity,aRecipients,aImMessage + //send message to other guy + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::message sent\n " ) ); + //Unbind the context and wait completion + req = presecenCtx->UnbindL(); + eventObserver->WaitOpToCompleteL( req ); + CleanupStack::PopAndDestroy(4); //imFeatures,presecenCtx,eventObserver,ximpClient, + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::ReceiveMessageL() start" ) ); + + return KErrNone; + + } +// ----------------------------------------------------------------------------- +// Cossadapmt::ReceiveEmptyMessageL +// SendMessage test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Cossadapmt::ReceiveEmptyMessageL ( CStifItemParser& aItem ) + { + + //Initialize XIMP client + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::ReceiveEmptyMessageL() start" ) ); + MXIMPClient* ximpClient = MXIMPClient::NewClientL(); + CleanupDeletePushL ( ximpClient ); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::MXIMPClient::NewClientL() start" ) ); + //Create new sink to receive presence context events + CUSContextObserver* eventObserver = CUSContextObserver::NewLC(); + //Create new presence context + MXIMPContext* presecenCtx = ximpClient->NewPresenceContextLC(); + //Bind context to desired presence service + presecenCtx->RegisterObserverL ( *eventObserver ); + MPresenceFeatures* presenceFeatures = NULL; + presenceFeatures = MPresenceFeatures::NewL ( presecenCtx ); + CleanupDeletePushL ( presenceFeatures ); + + //read data from cfg file + TPtrC username; + TPtrC password; + TInt serviceId; + + aItem.GetNextString ( username ); + aItem.GetNextString ( password ); + aItem.GetNextInt ( serviceId ); + + TUid protocolUid = TUid::Uid ( KProtocolUid ); + + //Bind context to desired presence service + TXIMPRequestId req = presecenCtx->BindToL ( protocolUid, + username, + password, + serviceId ); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::ximpClient->NewPresenceContextLC() called\n" ) ); + eventObserver->WaitOpToCompleteL ( req ); + MXIMPObjectFactory& objFactory = presecenCtx->ObjectFactory(); + MXIMPIdentity* newGroupId = objFactory.NewIdentityLC(); + MPresentityGroups& groups = presenceFeatures->PresentityGroups() ; + + TOssAdapMtLogger::Log ( _L ( "presentity groups object created" ) ); + _LIT ( KDummyListId, "" ); + _LIT ( KEmptyMessage, "" ); + HBufC16* iListId; + iListId = KDummyListId().AllocL(); + iListId->Des().Fold(); + newGroupId->SetIdentityL ( *iListId ); + delete iListId; + iListId = NULL; + req = groups.SubscribePresentityGroupContentL ( *newGroupId ); + + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::groups.SubscribePresentityGroupListL() called" ) ); + + eventObserver->WaitOpToCompleteL ( req ); + CleanupStack::PopAndDestroy(2); //newGroupId,presenceFeatures + + CUserAfter::AfterL ( 1000000 ); + //Bind context to desired presence service + MImFeatures* imFeatures = NULL; + imFeatures = MImFeatures::NewL ( presecenCtx ); + CleanupDeletePushL ( imFeatures ); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::imFeatures created\n" ) ); + MImConversation& imconversation = imFeatures->ImConversation(); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::imconversation created\n" ) ); + MImConversationInfo *aImMessage = NULL; + aImMessage = imFeatures->ImObjectFactory().NewImConversationInfoLC(); + MXIMPIdentity* identity = objFactory.NewIdentityLC(); + identity->SetIdentityL ( KMsgId ); + aImMessage->SetMessageIdL ( identity ); + aImMessage->SetTextMessageL ( KEmptyMessage ); + CDesCArrayFlat* aRecipients = new ( ELeave ) CDesCArrayFlat ( 1 ); + CleanupStack::PushL ( aRecipients ); + aRecipients->AppendL ( username ); //userid of own + aImMessage->SetRecipientL ( aRecipients ); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::before sendmessage called\n" ) ); + //send message is to own + req = imconversation.SendMessageL ( *aImMessage ); + eventObserver->WaitOpToCompleteL ( req ); + CleanupStack::Pop ( 3 );//identity,aRecipients,aImMessage + //send message to other guy + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::message sent\n " ) ); + //Unbind the context and wait completion + req = presecenCtx->UnbindL(); + eventObserver->WaitOpToCompleteL( req ); + CleanupStack::PopAndDestroy(4); //imFeatures,presecenCtx,eventObserver,ximpClient, + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::ReceiveEmptyMessageL() start" ) ); + + return KErrNone; + + } + +// ----------------------------------------------------------------------------- +// Cossadapmt::ReceiveTenMessageL +// SendMessage test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Cossadapmt::ReceiveTenMessageL ( CStifItemParser& aItem ) + { + + //Initialize XIMP client + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::ReceiveTenMessageL() start" ) ); + MXIMPClient* ximpClient = MXIMPClient::NewClientL(); + CleanupDeletePushL ( ximpClient ); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::MXIMPClient::NewClientL() start" ) ); + //Create new sink to receive presence context events + CUSContextObserver* eventObserver = CUSContextObserver::NewLC(); + //Create new presence context + MXIMPContext* presecenCtx = ximpClient->NewPresenceContextLC(); + //Bind context to desired presence service + presecenCtx->RegisterObserverL ( *eventObserver ); + MPresenceFeatures* presenceFeatures = NULL; + presenceFeatures = MPresenceFeatures::NewL ( presecenCtx ); + CleanupDeletePushL ( presenceFeatures ); + + //read data from cfg file + TPtrC username; + TPtrC password; + TInt serviceId; + TPtrC message; + + aItem.GetNextString ( username ); + aItem.GetNextString ( password ); + aItem.GetNextInt ( serviceId ); + aItem.GetNextString ( message ); + + TUid protocolUid = TUid::Uid ( KProtocolUid ); + + //Bind context to desired presence service + TXIMPRequestId req = presecenCtx->BindToL ( protocolUid, + username, + password, + serviceId ); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::ximpClient->NewPresenceContextLC() called\n" ) ); + eventObserver->WaitOpToCompleteL ( req ); + MXIMPObjectFactory& objFactory = presecenCtx->ObjectFactory(); + MXIMPIdentity* newGroupId = objFactory.NewIdentityLC(); + MPresentityGroups& groups = presenceFeatures->PresentityGroups() ; + + TOssAdapMtLogger::Log ( _L ( "presentity groups object created" ) ); + _LIT ( KDummyListId, "" ); + HBufC16* iListId; + iListId = KDummyListId().AllocL(); + iListId->Des().Fold(); + newGroupId->SetIdentityL ( *iListId ); + delete iListId; + iListId = NULL; + req = groups.SubscribePresentityGroupContentL ( *newGroupId ); + + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::groups.SubscribePresentityGroupListL() called" ) ); + + eventObserver->WaitOpToCompleteL ( req ); + CleanupStack::PopAndDestroy(2); //newGroupId,presenceFeatures + + CUserAfter::AfterL ( 1000000 ); + //Bind context to desired presence service + MImFeatures* imFeatures = NULL; + imFeatures = MImFeatures::NewL ( presecenCtx ); + CleanupDeletePushL ( imFeatures ); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::imFeatures created\n" ) ); + MImConversation& imconversation = imFeatures->ImConversation(); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::imconversation created\n" ) ); + MImConversationInfo *aImMessage = NULL; + aImMessage = imFeatures->ImObjectFactory().NewImConversationInfoLC(); + MXIMPIdentity* identity = objFactory.NewIdentityLC(); + identity->SetIdentityL ( KMsgId ); + aImMessage->SetMessageIdL ( identity ); + aImMessage->SetTextMessageL ( message ); + CDesCArrayFlat* aRecipients = new ( ELeave ) CDesCArrayFlat ( 2 ); + CleanupStack::PushL ( aRecipients ); + aRecipients->AppendL ( username ); //userid of own + aImMessage->SetRecipientL ( aRecipients ); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::before sendmessage called\n" ) ); + + for ( TInt i = 0;i < 10;i++ ) + { + req = imconversation.SendMessageL ( *aImMessage ); + eventObserver->WaitOpToCompleteL ( req ); + + } + CleanupStack::Pop ( 3 );//identity,aRecipients,aImMessage + + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::message sent\n " ) ); + //Unbind the context and wait completion + req = presecenCtx->UnbindL(); + eventObserver->WaitOpToCompleteL( req ); + CleanupStack::PopAndDestroy(4); //imFeatures,presecenCtx,eventObserver,ximpClient, + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::ReceiveTenMessageL() end" ) ); + + return KErrNone; + + } + +// ----------------------------------------------------------------------------- +// Cossadapmt::ReceiveTwentyMessageL +// SendMessage test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Cossadapmt::ReceiveTwentyMessageL ( CStifItemParser& aItem ) + { + + //Initialize XIMP client + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::ReceiveTwentyMessageL() start" ) ); + MXIMPClient* ximpClient = MXIMPClient::NewClientL(); + CleanupDeletePushL ( ximpClient ); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::MXIMPClient::NewClientL() start" ) ); + //Create new sink to receive presence context events + CUSContextObserver* eventObserver = CUSContextObserver::NewLC(); + //Create new presence context + MXIMPContext* presecenCtx = ximpClient->NewPresenceContextLC(); + //Bind context to desired presence service + presecenCtx->RegisterObserverL ( *eventObserver ); + MPresenceFeatures* presenceFeatures = NULL; + presenceFeatures = MPresenceFeatures::NewL ( presecenCtx ); + CleanupDeletePushL ( presenceFeatures ); + + //read data from cfg file + TPtrC username; + TPtrC password; + TInt serviceId; + TPtrC message; + + aItem.GetNextString ( username ); + aItem.GetNextString ( password ); + aItem.GetNextInt ( serviceId ); + aItem.GetNextString ( message ); + + TUid protocolUid = TUid::Uid ( KProtocolUid ); + + //Bind context to desired presence service + TXIMPRequestId req = presecenCtx->BindToL ( protocolUid, + username, + password, + serviceId ); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::ximpClient->NewPresenceContextLC() called\n" ) ); + eventObserver->WaitOpToCompleteL ( req ); + MXIMPObjectFactory& objFactory = presecenCtx->ObjectFactory(); + MXIMPIdentity* newGroupId = objFactory.NewIdentityLC(); + MPresentityGroups& groups = presenceFeatures->PresentityGroups() ; + + TOssAdapMtLogger::Log ( _L ( "presentity groups object created" ) ); + _LIT ( KDummyListId, "" ); + HBufC16* iListId; + iListId = KDummyListId().AllocL(); + iListId->Des().Fold(); + newGroupId->SetIdentityL ( *iListId ); + delete iListId; + iListId = NULL; + req = groups.SubscribePresentityGroupContentL ( *newGroupId ); + + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::groups.SubscribePresentityGroupListL() called" ) ); + + eventObserver->WaitOpToCompleteL ( req ); + CleanupStack::PopAndDestroy(2); //newGroupId,presenceFeatures + + CUserAfter::AfterL ( 1000000 ); + //Bind context to desired presence service + MImFeatures* imFeatures = NULL; + imFeatures = MImFeatures::NewL ( presecenCtx ); + CleanupDeletePushL ( imFeatures ); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::imFeatures created\n" ) ); + MImConversation& imconversation = imFeatures->ImConversation(); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::imconversation created\n" ) ); + MImConversationInfo *aImMessage = NULL; + aImMessage = imFeatures->ImObjectFactory().NewImConversationInfoLC(); + MXIMPIdentity* identity = objFactory.NewIdentityLC(); + identity->SetIdentityL ( KMsgId ); + aImMessage->SetMessageIdL ( identity ); + aImMessage->SetTextMessageL ( message ); + CDesCArrayFlat* aRecipients = new ( ELeave ) CDesCArrayFlat ( 2 ); + CleanupStack::PushL ( aRecipients ); + aRecipients->AppendL ( username ); //userid's of own + aImMessage->SetRecipientL ( aRecipients ); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::before sendmessage called\n" ) ); + + for ( TInt i = 0;i < 20;i++ ) + { + req = imconversation.SendMessageL ( *aImMessage ); + eventObserver->WaitOpToCompleteL ( req ); + } + CleanupStack::Pop ( 3 );//identity,aRecipients,aImMessage + + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::message sent\n " ) ); + //Unbind the context and wait completion + req = presecenCtx->UnbindL(); + eventObserver->WaitOpToCompleteL( req ); + CleanupStack::PopAndDestroy(4); //imFeatures,presecenCtx,eventObserver,ximpClient, + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::ReceiveTwentyMessageL() end" ) ); + + return KErrNone; + + } + + +// ----------------------------------------------------------------------------- +// Cossadapmt::PublishOwnPresenceL +// Login test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Cossadapmt::PublishOwnPresenceL ( CStifItemParser& aItem ) + { + + + + //Initialize XIMP client + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::PublishOwnPresenceL() start" ) ); + + MXIMPClient* ximpClient = MXIMPClient::NewClientL(); + CleanupDeletePushL ( ximpClient ); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::MXIMPClient::NewClientL() start" ) ); + + //Create new sink to receive presence context events + CUSContextObserver* eventObserver = CUSContextObserver::NewLC(); + + //Create new presence context + MXIMPContext* presecenCtx = ximpClient->NewPresenceContextLC(); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::ximpClient->NewPresenceContextLC() called" ) ); + presecenCtx->RegisterObserverL ( *eventObserver ); + + MPresenceFeatures* presenceFeatures = NULL; + presenceFeatures = MPresenceFeatures::NewL(presecenCtx); + CleanupDeletePushL( presenceFeatures ); + + + //read data from cfg file + TPtrC username; + TPtrC password; + TInt serviceId; + TInt availability; + TPtrC statustext; + + aItem.GetNextString ( username ); + aItem.GetNextString ( password ); + aItem.GetNextInt ( serviceId ); + aItem.GetNextInt ( availability ); + aItem.GetNextString ( statustext ); + + TUid protocolUid = TUid::Uid ( KProtocolUid ); + + //Bind context to desired presence service + TXIMPRequestId req = presecenCtx->BindToL ( protocolUid, + username, + password, + serviceId ); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::presecenCtx->BindToL() called" ) ); + //Wait with CActiveSchedulerWait the binding to complete + //If binding fails, it is handled with leave + eventObserver->WaitOpToCompleteL ( req ); + // Take handles to object factory and publish interface + MXIMPObjectFactory& objFactory = presecenCtx->ObjectFactory(); + MPresencePublishing& publisher = presenceFeatures->PresencePublishing(); + //Fill presence doc with presence components and attributes + MPresenceInfo* myPresence = presenceFeatures->PresenceObjectFactory().NewPresenceInfoLC();//1 + MServicePresenceInfo* myServicePresence = presenceFeatures->PresenceObjectFactory().NewServicePresenceInfoLC();//2 + myServicePresence->SetServiceTypeL( NPresenceInfo::NServiceType::KInstantMessaging ); + //MPresenceInfoFieldCollection& attributeFields = myServicePresence->Fields(); + + MPersonPresenceInfo *PersonPresence = presenceFeatures->PresenceObjectFactory().NewPersonPresenceInfoLC(); + MPresenceInfoFieldCollection& attributeFields = PersonPresence->Fields(); + + MPresenceInfoField* infoField = presenceFeatures->PresenceObjectFactory().NewInfoFieldLC();//3 + + // "availability" attribute + MPresenceInfoFieldValueEnum* availabilityField = presenceFeatures->PresenceObjectFactory().NewEnumInfoFieldLC();//4 + availabilityField->SetValueL( availability ); + infoField->SetFieldTypeL( NPresenceInfo::NFieldType::KAvailability ); + infoField->SetFieldValue( availabilityField ); + CleanupStack::Pop(); // availabilityField + + attributeFields.AddOrReplaceFieldL(infoField ); + //TInt count = serviceFields.FieldCount(); + CleanupStack::Pop(); // infoField + + //status text + infoField = presenceFeatures->PresenceObjectFactory().NewInfoFieldLC();//7 + MPresenceInfoFieldValueText* statustextField = presenceFeatures->PresenceObjectFactory().NewTextInfoFieldLC();//8 + statustextField->SetTextValueL( statustext ); // some status text + infoField->SetFieldTypeL( KStatusTextfield ); + infoField->SetFieldValue( statustextField ); + CleanupStack::Pop(); // statustextField + attributeFields.AddOrReplaceFieldL( infoField ); + CleanupStack::Pop(); // infoField + + + //online status + + infoField = presenceFeatures->PresenceObjectFactory().NewInfoFieldLC();//7 + MPresenceInfoFieldValueText* onlineField = presenceFeatures->PresenceObjectFactory().NewTextInfoFieldLC();//8 + onlineField->SetTextValueL( _L("T" ) ); // some status text + infoField->SetFieldTypeL( KOnlineStatusfield ); + infoField->SetFieldValue( onlineField ); + CleanupStack::Pop(); // devmodelField + attributeFields.AddOrReplaceFieldL( infoField ); + CleanupStack::Pop(); // infoField + + + myPresence->AddServicePresenceL( myServicePresence ); + myPresence->SetPersonPresenceL(PersonPresence); + TInt count = attributeFields.FieldCount(); + CleanupStack::Pop(2); // myServicePresence,PersonPresence + + + //publish the presence + req = publisher.PublishOwnPresenceL( *myPresence ); + + // wait completion + eventObserver->WaitOpToCompleteL( req ); + CleanupStack::PopAndDestroy(1); // myPresence + + CUserAfter::AfterL ( 1000000 ); + req = presecenCtx->UnbindL(); + eventObserver->WaitOpToCompleteL( req ); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::WaitOpToCompleteL() end" ) ); + + CleanupStack::PopAndDestroy ( 4 ); //presenceFeatures,presecenCtx,eventObserver,ximpClient + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::PublishOwnPresenceL() End" ) ); + return KErrNone; + + } +// ----------------------------------------------------------------------------- +// Cossadapmt::PublishOwnPresenceEmptyTextL +// Login test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Cossadapmt::PublishOwnPresenceEmptyTextL ( CStifItemParser& aItem ) + { + + + + //Initialize XIMP client + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::PublishOwnPresenceEmptyTextL() start" ) ); + + MXIMPClient* ximpClient = MXIMPClient::NewClientL(); + CleanupDeletePushL ( ximpClient ); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::MXIMPClient::NewClientL() start" ) ); + + //Create new sink to receive presence context events + CUSContextObserver* eventObserver = CUSContextObserver::NewLC(); + + //Create new presence context + MXIMPContext* presecenCtx = ximpClient->NewPresenceContextLC(); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::ximpClient->NewPresenceContextLC() called" ) ); + presecenCtx->RegisterObserverL ( *eventObserver ); + + MPresenceFeatures* presenceFeatures = NULL; + presenceFeatures = MPresenceFeatures::NewL(presecenCtx); + CleanupDeletePushL( presenceFeatures ); + + + //read data from cfg file + TPtrC username; + TPtrC password; + TInt serviceId; + TInt availability; + + aItem.GetNextString ( username ); + aItem.GetNextString ( password ); + aItem.GetNextInt ( serviceId ); + aItem.GetNextInt ( availability ); + _LIT ( KBlankStatusText, "" ); + + TUid protocolUid = TUid::Uid ( KProtocolUid ); + + //Bind context to desired presence service + TXIMPRequestId req = presecenCtx->BindToL ( protocolUid, + username, + password, + serviceId ); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::presecenCtx->BindToL() called" ) ); + //Wait with CActiveSchedulerWait the binding to complete + //If binding fails, it is handled with leave + eventObserver->WaitOpToCompleteL ( req ); + // Take handles to object factory and publish interface + MXIMPObjectFactory& objFactory = presecenCtx->ObjectFactory(); + MPresencePublishing& publisher = presenceFeatures->PresencePublishing(); + //Fill presence doc with presence components and attributes + MPresenceInfo* myPresence = presenceFeatures->PresenceObjectFactory().NewPresenceInfoLC();//1 + MServicePresenceInfo* myServicePresence = presenceFeatures->PresenceObjectFactory().NewServicePresenceInfoLC();//2 + myServicePresence->SetServiceTypeL( NPresenceInfo::NServiceType::KInstantMessaging ); + //MPresenceInfoFieldCollection& attributeFields = myServicePresence->Fields(); + + MPersonPresenceInfo *PersonPresence = presenceFeatures->PresenceObjectFactory().NewPersonPresenceInfoLC(); + MPresenceInfoFieldCollection& attributeFields = PersonPresence->Fields(); + + MPresenceInfoField* infoField = presenceFeatures->PresenceObjectFactory().NewInfoFieldLC();//3 + + // "availability" attribute + MPresenceInfoFieldValueEnum* availabilityField = presenceFeatures->PresenceObjectFactory().NewEnumInfoFieldLC();//4 + availabilityField->SetValueL( availability ); + infoField->SetFieldTypeL( NPresenceInfo::NFieldType::KAvailability ); + infoField->SetFieldValue( availabilityField ); + CleanupStack::Pop(); // availabilityField + + attributeFields.AddOrReplaceFieldL(infoField ); + //TInt count = serviceFields.FieldCount(); + CleanupStack::Pop(); // infoField + + //status text + infoField = presenceFeatures->PresenceObjectFactory().NewInfoFieldLC();//7 + MPresenceInfoFieldValueText* statustextField = presenceFeatures->PresenceObjectFactory().NewTextInfoFieldLC();//8 + statustextField->SetTextValueL( KBlankStatusText ); // some status text + infoField->SetFieldTypeL( KStatusTextfield ); + infoField->SetFieldValue( statustextField ); + CleanupStack::Pop(); // statustextField + attributeFields.AddOrReplaceFieldL( infoField ); + CleanupStack::Pop(); // infoField + + + //online status + + infoField = presenceFeatures->PresenceObjectFactory().NewInfoFieldLC();//7 + MPresenceInfoFieldValueText* onlineField = presenceFeatures->PresenceObjectFactory().NewTextInfoFieldLC();//8 + onlineField->SetTextValueL( _L("T" ) ); // some status text + infoField->SetFieldTypeL( KOnlineStatusfield ); + infoField->SetFieldValue( onlineField ); + CleanupStack::Pop(); // devmodelField + attributeFields.AddOrReplaceFieldL( infoField ); + CleanupStack::Pop(); // infoField + + + myPresence->AddServicePresenceL( myServicePresence ); + myPresence->SetPersonPresenceL(PersonPresence); + TInt count = attributeFields.FieldCount(); + CleanupStack::Pop(2); // myServicePresence,PersonPresence + + + //publish the presence + req = publisher.PublishOwnPresenceL( *myPresence ); + + // wait completion + eventObserver->WaitOpToCompleteL( req ); + CleanupStack::PopAndDestroy(1); // myPresence + + CUserAfter::AfterL ( 1000000 ); + req = presecenCtx->UnbindL(); + eventObserver->WaitOpToCompleteL( req ); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::WaitOpToCompleteL() end" ) ); + + CleanupStack::PopAndDestroy ( 4 ); //presenceFeatures,presecenCtx,eventObserver,ximpClient + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::PublishOwnPresenceEmptyTextL() End" ) ); + return KErrNone; + + } +TInt Cossadapmt::AcceptnotificationRequestL ( CStifItemParser& aItem ) + { + + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::AcceptAddnotificationRequestL() start" ) ); + + MXIMPClient* ximpClient = MXIMPClient::NewClientL(); + CleanupDeletePushL ( ximpClient ); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::MXIMPClient::NewClientL() start" ) ); + + //Create new sink to receive presence context events + CUSContextObserver* eventObserver = CUSContextObserver::NewLC(); + + //Create new presence context + MXIMPContext* presecenCtx = ximpClient->NewPresenceContextLC(); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::ximpClient->NewPresenceContextLC() called" ) ); + presecenCtx->RegisterObserverL ( *eventObserver ); + MPresenceFeatures* presenceFeatures = NULL; + presenceFeatures = MPresenceFeatures::NewL ( presecenCtx ); + CleanupDeletePushL ( presenceFeatures ); + TOssAdapMtLogger::Log ( _L ( "Loading presence plugin Done" ) ); + MXIMPObjectFactory& objFactory = presecenCtx->ObjectFactory(); + MXIMPIdentity* newGroupId = objFactory.NewIdentityLC(); + MPresentityGroups& groups = presenceFeatures->PresentityGroups() ; + MPresenceAuthorization& authorization = presenceFeatures->PresenceAuthorization(); + MPresenceInfoFilter* infoFilt = presenceFeatures->PresenceObjectFactory().NewPresenceInfoFilterLC(); + + infoFilt->AcceptPersonFilterL( NPresenceInfo::NFieldType::KAcceptAll ); + + TOssAdapMtLogger::Log ( _L ( "presentity groups object created" ) ); + _LIT ( KDummyListId, "list" ); + HBufC16* iListId; + iListId = KDummyListId().AllocL(); + iListId->Des().Fold(); + newGroupId->SetIdentityL ( *iListId ); + delete iListId; + iListId = NULL; + + //read data from cfg file + TPtrC username; + TPtrC password; + TInt serviceId; + + aItem.GetNextString ( username ); + aItem.GetNextString ( password ); + aItem.GetNextInt ( serviceId ); + + TUid protocolUid = TUid::Uid ( KProtocolUid ); + + //Bind context to desired presence service + TXIMPRequestId req = presecenCtx->BindToL ( protocolUid, + username, + password, + serviceId ); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::presecenCtx->BindToL() called" ) ); + //Wait with CActiveSchedulerWait the binding to complete + //If binding fails, it is handled with leave + eventObserver->WaitOpToCompleteL ( req ); + req = authorization.SubscribePresenceGrantRequestListL(); + + // wait completion + + eventObserver->WaitOpToCompleteL( req ); + + CUserAfter::AfterL( 1000000 ); + + req = groups.SubscribePresentityGroupContentL ( *newGroupId ); + + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::groups.SubscribePresentityGroupListL() called" ) ); + + eventObserver->WaitOpToCompleteL ( req ); + + CUserAfter::AfterL ( 5000000 ); + + MXIMPIdentity* testContactId = objFactory.NewIdentityLC(); + testContactId->SetIdentityL( KContact1 ); + req = authorization.GrantPresenceForPresentityL(*testContactId ,*infoFilt ); + + // wait completion + eventObserver->WaitOpToCompleteL( req ); + + + CleanupStack::PopAndDestroy();//testContactId + //Unbind the context and wait completion + req = presecenCtx->UnbindL(); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::presecenCtx->UnbindL() called" ) ); + + eventObserver->WaitOpToCompleteL ( req ); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::WaitOpToCompleteL() end" ) ); + + CleanupStack::PopAndDestroy ( 6 );//newGroupId,presenceFeatures,presecenCtx,eventObserver,ximpClient,infoFilt + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::AcceptAddnotificationRequestL() end" ) ); + + return KErrNone; + } + + +// ----------------------------------------------------------------------------- +// Cossadapmt::RejectAddnotificationRequestL +// AddConatctL contacts test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Cossadapmt::RejectAddnotificationRequestL ( CStifItemParser& aItem ) + { + + //Initialize XIMP client + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::RejectAddnotificationRequestL() start" ) ); + + MXIMPClient* ximpClient = MXIMPClient::NewClientL(); + CleanupDeletePushL ( ximpClient ); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::MXIMPClient::NewClientL() start" ) ); + + //Create new sink to receive presence context events + CUSContextObserver* eventObserver = CUSContextObserver::NewLC(); + + //Create new presence context + MXIMPContext* presecenCtx = ximpClient->NewPresenceContextLC(); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::ximpClient->NewPresenceContextLC() called" ) ); + presecenCtx->RegisterObserverL ( *eventObserver ); + MPresenceFeatures* presenceFeatures = NULL; + presenceFeatures = MPresenceFeatures::NewL ( presecenCtx ); + CleanupDeletePushL ( presenceFeatures ); + TOssAdapMtLogger::Log ( _L ( "Loading presence plugin Done" ) ); + MXIMPObjectFactory& objFactory = presecenCtx->ObjectFactory(); + MXIMPIdentity* newGroupId = objFactory.NewIdentityLC(); + MPresentityGroups& groups = presenceFeatures->PresentityGroups() ; + MPresenceAuthorization& authorization = presenceFeatures->PresenceAuthorization(); + MPresenceInfoFilter* infoFilt = presenceFeatures->PresenceObjectFactory().NewPresenceInfoFilterLC(); + + infoFilt->AcceptPersonFilterL( NPresenceInfo::NFieldType::KAcceptAll ); + + TOssAdapMtLogger::Log ( _L ( "presentity groups object created" ) ); + _LIT ( KDummyListId, "list" ); + HBufC16* iListId; + iListId = KDummyListId().AllocL(); + iListId->Des().Fold(); + newGroupId->SetIdentityL ( *iListId ); + delete iListId; + iListId = NULL; + + //read data from cfg file + TPtrC username; + TPtrC password; + TInt serviceId; + + aItem.GetNextString ( username ); + aItem.GetNextString ( password ); + aItem.GetNextInt ( serviceId ); + + TUid protocolUid = TUid::Uid ( KProtocolUid ); + + //Bind context to desired presence service + TXIMPRequestId req = presecenCtx->BindToL ( protocolUid, + username, + password, + serviceId ); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::presecenCtx->BindToL() called" ) ); + //Wait with CActiveSchedulerWait the binding to complete + //If binding fails, it is handled with leave + eventObserver->WaitOpToCompleteL ( req ); + req = authorization.SubscribePresenceGrantRequestListL(); + + // wait completion + + eventObserver->WaitOpToCompleteL( req ); + + CUserAfter::AfterL( 1000000 ); + + req = groups.SubscribePresentityGroupContentL ( *newGroupId ); + + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::groups.SubscribePresentityGroupListL() called" ) ); + + eventObserver->WaitOpToCompleteL ( req ); + CUserAfter::AfterL ( 5000000 ); + + MXIMPIdentity* testContactId = objFactory.NewIdentityLC(); + testContactId->SetIdentityL( KContact1 ); + req = authorization.WithdrawPresenceGrantFromPresentityL(*testContactId); + + // wait completion + eventObserver->WaitOpToCompleteL( req ); + + CUserAfter::AfterL( 1000000 ); + + CleanupStack::PopAndDestroy();//testContactId + //Unbind the context and wait completion + req = presecenCtx->UnbindL(); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::presecenCtx->UnbindL() called" ) ); + + eventObserver->WaitOpToCompleteL ( req ); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::WaitOpToCompleteL() end" ) ); + + CleanupStack::PopAndDestroy ( 6 );//infoFilt,newGroupId,presenceFeatures,presecenCtx,eventObserver,ximpClient + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::RejectAddnotificationRequestL() end" ) ); + + return KErrNone; + + } +// ----------------------------------------------------------------------------- +// Cossadapmt::ImOperationsCoverageL +// ImOperationsCoverageL test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Cossadapmt::ImOperationsCoverageL ( CStifItemParser& aItem ) + { + + //Initialize XIMP client + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::ImOperationsCoverageL() start" ) ); + MXIMPClient* ximpClient = MXIMPClient::NewClientL(); + CleanupDeletePushL ( ximpClient ); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::MXIMPClient::NewClientL() start" ) ); + //Create new sink to receive presence context events + CUSContextObserver* eventObserver = CUSContextObserver::NewLC(); + //Create new presence context + MXIMPContext* presecenCtx = ximpClient->NewPresenceContextLC(); + //Bind context to desired presence service + presecenCtx->RegisterObserverL ( *eventObserver ); + MPresenceFeatures* presenceFeatures = NULL; + presenceFeatures = MPresenceFeatures::NewL ( presecenCtx ); + CleanupDeletePushL ( presenceFeatures ); + + //read data from cfg file + TPtrC username; + TPtrC password; + TInt serviceId; + TPtrC message; + TPtrC contact; + aItem.GetNextString ( username ); + aItem.GetNextString ( password ); + aItem.GetNextInt ( serviceId ); + aItem.GetNextString ( message ); + aItem.GetNextString ( contact ); + TUid protocolUid = TUid::Uid ( KProtocolUid ); + + //Bind context to desired presence service + TXIMPRequestId req = presecenCtx->BindToL ( protocolUid, + username, + password, + serviceId ); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::ximpClient->NewPresenceContextLC() called\n" ) ); + eventObserver->WaitOpToCompleteL ( req ); + MXIMPObjectFactory& objFactory = presecenCtx->ObjectFactory(); + MXIMPIdentity* newGroupId = objFactory.NewIdentityLC(); + MPresentityGroups& groups = presenceFeatures->PresentityGroups() ; + + TOssAdapMtLogger::Log ( _L ( "presentity groups object created" ) ); + _LIT ( KDummyListId, "" ); + HBufC16* iListId; + iListId = KDummyListId().AllocL(); + iListId->Des().Fold(); + newGroupId->SetIdentityL ( *iListId ); + delete iListId; + iListId = NULL; + req = groups.SubscribePresentityGroupContentL ( *newGroupId ); + + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::groups.SubscribePresentityGroupListL() called" ) ); + + eventObserver->WaitOpToCompleteL ( req ); + CleanupStack::PopAndDestroy(2); //newGroupId,presenceFeatures + + CUserAfter::AfterL ( 1000000 ); + //Bind context to desired presence service + MImFeatures* imFeatures = NULL; + imFeatures = MImFeatures::NewL ( presecenCtx ); + CleanupDeletePushL ( imFeatures ); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::imFeatures created\n" ) ); + MImConversation& imconversation = imFeatures->ImConversation(); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::imconversation created\n" ) ); + MImConversationInfo *aImMessage = NULL; + aImMessage = imFeatures->ImObjectFactory().NewImConversationInfoLC(); + MXIMPIdentity* identity = objFactory.NewIdentityLC(); + identity->SetIdentityL ( KMsgId ); + aImMessage->SetMessageIdL ( identity ); + aImMessage->SetTextMessageL ( message ); + CDesCArrayFlat* aRecipients = new ( ELeave ) CDesCArrayFlat ( 1 ); + CleanupStack::PushL ( aRecipients ); + aRecipients->AppendL ( username ); //userid of own + aImMessage->SetRecipientL ( aRecipients ); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::before sendmessage called\n" ) ); + //send message is to own + req = imconversation.SendMessageL ( *aImMessage ); + eventObserver->WaitOpToCompleteL ( req ); + CleanupStack::Pop ( 3 );//identity,aRecipients,aImMessage + //send message to other guy + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::message sent\n " ) ); + //Unbind the context and wait completion + req = presecenCtx->UnbindL(); + eventObserver->WaitOpToCompleteL( req ); + CleanupStack::PopAndDestroy(4); //imFeatures,presecenCtx,eventObserver,ximpClient, + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::ImOperationsCoverageL() start" ) ); + + return KErrNone; + + } +// ----------------------------------------------------------------------------- +// Cossadapmt::SetAvtarL +// Login test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Cossadapmt::SetAvtarL ( CStifItemParser& aItem ) + { + + + + //Initialize XIMP client + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::SetAvtarL() start" ) ); + + MXIMPClient* ximpClient = MXIMPClient::NewClientL(); + CleanupDeletePushL ( ximpClient ); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::MXIMPClient::NewClientL() start" ) ); + + //Create new sink to receive presence context events + CUSContextObserver* eventObserver = CUSContextObserver::NewLC(); + + //Create new presence context + MXIMPContext* presecenCtx = ximpClient->NewPresenceContextLC(); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::ximpClient->NewPresenceContextLC() called" ) ); + presecenCtx->RegisterObserverL ( *eventObserver ); + + MPresenceFeatures* presenceFeatures = NULL; + presenceFeatures = MPresenceFeatures::NewL(presecenCtx); + CleanupDeletePushL( presenceFeatures ); + + + //read data from cfg file + TPtrC username; + TPtrC password; + TInt serviceId; + TPtrC filename; + aItem.GetNextString ( username ); + aItem.GetNextString ( password ); + aItem.GetNextInt ( serviceId ); + aItem.GetNextString ( filename ); + TUid protocolUid = TUid::Uid ( KProtocolUid ); + + //Bind context to desired presence service + TXIMPRequestId req = presecenCtx->BindToL ( protocolUid, + username, + password, + serviceId ); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::presecenCtx->BindToL() called" ) ); + //Wait with CActiveSchedulerWait the binding to complete + //If binding fails, it is handled with leave + eventObserver->WaitOpToCompleteL ( req ); + // Take handles to object factory and publish interface + // Take handles to object factory and publish interface + presenceFeatures = MPresenceFeatures::NewL(presecenCtx); + MXIMPObjectFactory& objFactory = presecenCtx->ObjectFactory(); + + MXIMPIdentity* newGroupId = objFactory.NewIdentityLC(); + MXIMPIdentity* newmemberId = objFactory.NewIdentityLC(); + + CleanupDeletePushL( presenceFeatures ); + + MPresencePublishing& publisher = presenceFeatures->PresencePublishing(); + + //Fill presence doc with presence components and attributes + MPresenceInfo* myPresence = presenceFeatures->PresenceObjectFactory().NewPresenceInfoLC();//1 + MPersonPresenceInfo *PersonPresence = presenceFeatures->PresenceObjectFactory().NewPersonPresenceInfoLC(); + MPresenceInfoFieldCollection& attributeFields = PersonPresence->Fields(); + + MPresenceInfoField* infoField = presenceFeatures->PresenceObjectFactory().NewInfoFieldLC();//3 + + //based on the state conver it to ximpfw status. + + + // "availability" attribute + MPresenceInfoFieldValueBinary* avatarField = presenceFeatures->PresenceObjectFactory().NewBinaryInfoFieldLC();//4 + //avatarField->SetBinaryValueL(*(aImageLoader->GetContentData())); + _LIT8(KMimeType,"image/gif"); + TBufC8<20> mimetype(KMimeType); + + avatarField->SetMimeTypeL(mimetype.Des()); + RFile file; + RFs iFs; + User::LeaveIfError( iFs.Connect() ); + User::LeaveIfError( file.Open( iFs, _L("c:\\index.gif"), EFileRead ) ); + CleanupClosePushL( file ); + + // Get file size + TInt fileSize = 0; + User::LeaveIfError( file.Size( fileSize ) ); + + // Check file size, if bigger than max transaction content -> leave + /* if ( fileSize > + iImpsFactory.CreateImClientL()->MaxTransactionContentLengthL() ) + { + User::Leave( KErrOverflow ); + }*/ + + // Get file content + HBufC8* Content = HBufC8::NewL( fileSize ); + TPtr8 ptr( Content->Des() ); + User::LeaveIfError( file.Read( ptr, fileSize ) ); + + avatarField->SetBinaryValueL(*Content); + infoField->SetFieldTypeL( NPresenceInfo::NFieldType::KAvatar ); + infoField->SetFieldValue( avatarField ); + CleanupStack::Pop(); // availabilityField + + attributeFields.AddOrReplaceFieldL(infoField ); + + CleanupStack::Pop(); // infoField + + myPresence->SetPersonPresenceL(PersonPresence); + CleanupStack::Pop(1); // PersonPresence + + req = publisher.PublishOwnPresenceL( *myPresence ); + + // wait completion + eventObserver->WaitOpToCompleteL( req ); + CleanupStack::PopAndDestroy(1); // myPresence + + req = presecenCtx->UnbindL(); + eventObserver->WaitOpToCompleteL( req ); + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::WaitOpToCompleteL() end" ) ); + + CleanupStack::PopAndDestroy ( 4 ); //presenceFeatures,presecenCtx,eventObserver,ximpClient + TOssAdapMtLogger::Log ( _L ( "Cossadapmt::SetAvtarL() End" ) ); + return KErrNone; + + } +// [End of File] - Do not remove diff -r 000000000000 -r e6b17d312c8b imservices/ossprotocoladaptation/tsrc/ossadapmt/src/uscontextobserver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/ossprotocoladaptation/tsrc/ossadapmt/src/uscontextobserver.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,753 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: uscontextobserver.cpp +* +*/ + +#include "uscontextobserver.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "ossadapmt.h" +#include +#include +#include "ximpcontextstate.h" +#include +#include +#include +#include +#include +#include +#include +#include + +#include "imconversationevent.h" +#include + +#include "imconversationinfo.h" +#include +#include +#include + +#include +#include +#include +// ============================ MEMBER FUNCTIONS =============================== + +// CONSTRUCTION +CUSContextObserver* CUSContextObserver::NewLC() + { + CUSContextObserver* self = new ( ELeave ) CUSContextObserver(); + CleanupStack::PushL ( self ); + return self; + } + + +CUSContextObserver::~CUSContextObserver() + { + } + + +CUSContextObserver::CUSContextObserver() + { + } + + + +// =========================================================================== +// PUBLIC FUNCTIONS +// =========================================================================== +// +void CUSContextObserver::WaitOpToCompleteL ( const TXIMPRequestId& aOpToWait ) + { + iReqToWait = aOpToWait; + + iWait.Start(); + + } + +/*void CUSContextObserver::WaitCompleteL() + { + iWait.AsyncStop(); + }*/ + +// =========================================================================== +// FROM MXIMPContextObserver +// =========================================================================== +// +void CUSContextObserver::HandlePresenceContextEvent ( + const MXIMPContext& /*aContext*/, + const MXIMPBase& aEvent ) + { + + TOssAdapMtLogger::Log ( _L ( "HandlePresenceContextEvent called" ) ); + + TInt32 eventId = aEvent.GetInterfaceId(); + + switch ( aEvent.GetInterfaceId() ) + { + _LIT ( KDir, "EVENT_LOG" ); // here we hv to write a folder name in wch we want to create log file + _LIT ( KFile, "event.txt" ); //here we hv to write a file name in wch we want to log default path is " c:/Logs/" + + case MXIMPRequestCompleteEvent::KInterfaceId: + { + TOssAdapMtLogger::Log ( _L ( "CUSContextObserver::MXIMPRequestCompleteEvent() start" ) ); + + const MXIMPRequestCompleteEvent* complEvent = + TXIMPGetInterface< const MXIMPRequestCompleteEvent >::From ( aEvent, + MXIMPBase::EPanicIfUnknown ); + + RFileLogger::WriteFormat ( KDir, KFile, EFileLoggingModeAppend, _L ( "*************BEGIN******************" ) ); + _LIT ( KMsg, "Recvd RequestCompleteEvent " ); // here we hv to write message or text wch we want to write in log file + RFileLogger::WriteFormat ( KDir, KFile, EFileLoggingModeAppend, KMsg ); + + if ( iWait.IsStarted() && ( complEvent->RequestId() == iReqToWait ) ) + { + iReqResult = complEvent->CompletionResult().ResultCode(); + RFileLogger::WriteFormat ( KDir, KFile, EFileLoggingModeAppend, _L ( "Error code for the request is %d " ), iReqResult ); + iWait.AsyncStop(); + } + + TOssAdapMtLogger::Log ( _L ( "CUSContextObserver::MXIMPRequestCompleteEvent() end" ) ); + + break; + } + + case MXIMPContextStateEvent::KInterfaceId: + { + const MXIMPContextStateEvent* ctxtStateEvent = + TXIMPGetInterface< const MXIMPContextStateEvent >::From ( aEvent, + MXIMPBase::EPanicIfUnknown ); + RFileLogger::WriteFormat ( KDir, KFile, EFileLoggingModeAppend, _L ( "*************BEGIN******************" ) ); + _LIT ( KMsg, "Recvd PresenceContextStateEvent " ); // here we hv to write message or text wch we want to write in log file + RFileLogger::WriteFormat ( KDir, KFile, EFileLoggingModeAppend, KMsg ); + const MXIMPStatus* fwStatus = ctxtStateEvent->StateChangeReason(); + const MXIMPContextState& cState = ctxtStateEvent->ContextState(); + MXIMPContextState::TState state = cState.ContextState(); + break; + } + + case MPresentityGroupListEvent::KInterfaceId: + { + const MPresentityGroupListEvent* groupListEvent = + TXIMPGetInterface< const MPresentityGroupListEvent >::From ( aEvent, + MXIMPBase::EPanicIfUnknown ); + + TBuf<100> sdstate; + TBuf<100> ssstate; + _LIT ( Kna, " Susbcription state is unavailable" ); + _LIT ( Kava, " Susbcription state is available" ); + _LIT ( KDef, " Susbcription state is ERROR" ); + + const MXIMPDataSubscriptionState& dstate = groupListEvent->DataSubscriptionState(); + + switch ( dstate.SubscriptionState() ) + { + + case 0: + ssstate.Copy ( Kna ); + break; + + case 1: + ssstate.Copy ( Kava ); + break; + + default: + ssstate.Copy ( KDef ); + break; + } + + _LIT ( Kdna, " Data state is unavailable" ); + + _LIT ( Kdava, " Data state is available" ); + _LIT ( KdDef, " Data state is ERROR" ); + + + switch ( dstate.SubscriptionState() ) + { + + case 0: + sdstate.Copy ( Kdna ); + break; + + case 1: + sdstate.Copy ( Kdava ); + break; + + default: + sdstate.Copy ( KdDef ); + break; + } + + RFileLogger::WriteFormat ( KDir, KFile, EFileLoggingModeAppend, _L ( "*************BEGIN******************" ) ); + + RFileLogger::WriteFormat ( KDir, KFile, EFileLoggingModeAppend, _L ( "Recvd PresentityGroupListEvent New:%d, Updt:%d, Disappeared:%d, Current:%d, SubscrState:%d, DataState:%d" ), groupListEvent->NewGroupsCount(), groupListEvent->UpdatedGroupsCount(), groupListEvent->DisappearedGroupsCount(), groupListEvent->CurrentGroupsCount(), dstate.SubscriptionState(), dstate.DataState() );//KMsg); + RFileLogger::Write ( KDir, KFile, EFileLoggingModeAppend, sdstate ); + RFileLogger::Write ( KDir, KFile, EFileLoggingModeAppend, ssstate ); + break; + } + + + case MPresentityGroupContentEvent::KInterfaceId: + { + const MPresentityGroupContentEvent* groupContentEvent = + TXIMPGetInterface< const MPresentityGroupContentEvent >::From ( aEvent, + MXIMPBase::EPanicIfUnknown ); + TBuf<100> sdstate; + TBuf<100> ssstate; + _LIT ( Kna, " Susbcription state is unavailable" ); + _LIT ( Kava, " Susbcription state is available" ); + _LIT ( KDef, " Susbcription state is ERROR" ); + + const MXIMPDataSubscriptionState& dstate = groupContentEvent->DataSubscriptionState(); + + switch ( dstate.SubscriptionState() ) + { + + case 0: + ssstate.Copy ( Kna ); + break; + + case 1: + ssstate.Copy ( Kava ); + break; + + default: + ssstate.Copy ( KDef ); + break; + } + + _LIT ( Kdna, " Data state is unavailable" ); + + _LIT ( Kdava, " Data state is available" ); + _LIT ( KdDef, " Data state is ERROR" ); + + + switch ( dstate.SubscriptionState() ) + { + + case 0: + sdstate.Copy ( Kdna ); + break; + + case 1: + sdstate.Copy ( Kdava ); + break; + + default: + sdstate.Copy ( KdDef ); + break; + } + + + RFileLogger::WriteFormat ( KDir, KFile, EFileLoggingModeAppend, _L ( "*************BEGIN******************" ) ); + + RFileLogger::WriteFormat ( KDir, KFile, EFileLoggingModeAppend, _L ( "Recvd PresentityGroupContentEvent New:%d, Updt:%d, Disappeared:%d, Current:%d, SubscrState:%d, DataState:%d" ), groupContentEvent->NewMembersCount(), groupContentEvent->UpdatedMembersCount(), groupContentEvent->DisappearedMembersCount(), groupContentEvent->CurrentMembersCount(), dstate.SubscriptionState(), dstate.DataState() ); + RFileLogger::Write ( KDir, KFile, EFileLoggingModeAppend, sdstate ); + RFileLogger::Write ( KDir, KFile, EFileLoggingModeAppend, ssstate ); + RFileLogger::Write ( KDir, KFile, EFileLoggingModeAppend, groupContentEvent->GroupId().Identity() ); + // print the list contents + + for ( TInt i = 0; i < groupContentEvent->CurrentMembersCount(); i++ ) + { + const MPresentityGroupMemberInfo& gi = groupContentEvent->CurrentMember ( i ); + + RFileLogger::WriteFormat ( KDir, KFile, EFileLoggingModeAppend, _L ( "Id and displayname for cur group member %d X" ), i ); + RFileLogger::Write ( KDir, KFile, EFileLoggingModeAppend, gi.GroupMemberId().Identity() ); + RFileLogger::Write ( KDir, KFile, EFileLoggingModeAppend, gi.GroupMemberDisplayName() ); +// EUNIT_ASSERT_EQUALS_DESC( gi.GroupMemberId().Identity(), iContactid[i], "contact id's does'nt match"); +// EUNIT_ASSERT_EQUALS_DESC( gi.GroupMemberDisplayName(), iNickname[i], "contact nickname does'nt match"); + + } + + // print the list contents + for ( TInt i = 0; i < groupContentEvent->NewMembersCount(); i++ ) + { + const MPresentityGroupMemberInfo& gi = groupContentEvent->NewMember ( i ); + + + RFileLogger::WriteFormat ( KDir, KFile, EFileLoggingModeAppend, _L ( "Id and displayname for new group member %d X" ), i ); + RFileLogger::Write ( KDir, KFile, EFileLoggingModeAppend, gi.GroupMemberId().Identity() ); + RFileLogger::Write ( KDir, KFile, EFileLoggingModeAppend, gi.GroupMemberDisplayName() ); +// EUNIT_ASSERT_EQUALS_DESC( gi.GroupMemberId().Identity(), iContactid[i], "contact id's does'nt match"); +// EUNIT_ASSERT_EQUALS_DESC( gi.GroupMemberDisplayName(), iNickname[i], "contact nickname does'nt match"); + } + + + RFileLogger::WriteFormat ( KDir, KFile, EFileLoggingModeAppend, _L ( "*************END*******************" ) ); + + break; + } + + case MPresenceGrantRequestListEvent::KInterfaceId: + { + const MPresenceGrantRequestListEvent* grantreqEvent = + TXIMPGetInterface< const MPresenceGrantRequestListEvent >::From ( aEvent, + MXIMPBase::EPanicIfUnknown ); + TBuf<100> sdstate; + TBuf<100> ssstate; + _LIT ( Kna, " Susbcription state is unavailable" ); + _LIT ( Kava, " Susbcription state is available" ); + _LIT ( KDef, " Susbcription state is ERROR" ); + + const MXIMPDataSubscriptionState& dstate = grantreqEvent->DataSubscriptionState(); + + switch ( dstate.SubscriptionState() ) + { + + case 0: + ssstate.Copy ( Kna ); + break; + + case 1: + ssstate.Copy ( Kava ); + break; + + default: + ssstate.Copy ( KDef ); + break; + } + + _LIT ( Kdna, " Data state is unavailable" ); + + _LIT ( Kdava, " Data state is available" ); + _LIT ( KdDef, " Data state is ERROR" ); + + + switch ( dstate.SubscriptionState() ) + { + + case 0: + sdstate.Copy ( Kdna ); + break; + + case 1: + sdstate.Copy ( Kdava ); + break; + + default: + sdstate.Copy ( KdDef ); + break; + } + + RFileLogger::WriteFormat ( KDir, KFile, EFileLoggingModeAppend, _L ( "*************BEGIN******************" ) ); + + RFileLogger::WriteFormat ( KDir, KFile, EFileLoggingModeAppend, _L ( "Recvd Presentity Grant event" ) ); + RFileLogger::Write ( KDir, KFile, EFileLoggingModeAppend, sdstate ); + RFileLogger::Write ( KDir, KFile, EFileLoggingModeAppend, ssstate ); + + TInt index = grantreqEvent->NewRequestsCount(); + + for ( TInt i = 0; i < index; i++ ) + { + const MPresenceGrantRequestInfo& grantinfo = grantreqEvent->NewRequest ( i ); + + RFileLogger::Write ( KDir, KFile, EFileLoggingModeAppend, grantinfo.RequestorId().Identity() ); + const TDesC16 dispname = grantinfo.RequestorDisplayName(); + RFileLogger::Write ( KDir, KFile, EFileLoggingModeAppend, dispname ); + } + + index = grantreqEvent->CurrentRequestsCount(); + + for ( TInt i = 0; i < index; i++ ) + { + const MPresenceGrantRequestInfo& grantinfo = grantreqEvent->CurrentRequest ( i ); + + RFileLogger::Write ( KDir, KFile, EFileLoggingModeAppend, grantinfo.RequestorId().Identity() ); + const TDesC16 dispname = grantinfo.RequestorDisplayName(); + RFileLogger::Write ( KDir, KFile, EFileLoggingModeAppend, dispname ); + } + + break; + } + + case MPresenceBlockListEvent::KInterfaceId: + { + const MPresenceBlockListEvent* blockListEvent = + TXIMPGetInterface< const MPresenceBlockListEvent >::From ( aEvent, + MXIMPBase::EPanicIfUnknown ); + TBuf<100> sdstate; + TBuf<100> ssstate; + _LIT ( Kna, " Susbcription state is unavailable" ); + _LIT ( Kava, " Susbcription state is available" ); + _LIT ( KDef, " Susbcription state is ERROR" ); + + const MXIMPDataSubscriptionState& dstate = blockListEvent->DataSubscriptionState(); + + switch ( dstate.SubscriptionState() ) + { + + case 0: + ssstate.Copy ( Kna ); + break; + + case 1: + ssstate.Copy ( Kava ); + break; + + default: + ssstate.Copy ( KDef ); + break; + } + + _LIT ( Kdna, " Data state is unavailable" ); + + _LIT ( Kdava, " Data state is available" ); + _LIT ( KdDef, " Data state is ERROR" ); + + + switch ( dstate.SubscriptionState() ) + { + + case 0: + sdstate.Copy ( Kdna ); + break; + + case 1: + sdstate.Copy ( Kdava ); + break; + + default: + sdstate.Copy ( KdDef ); + break; + } + + RFileLogger::WriteFormat ( KDir, KFile, EFileLoggingModeAppend, _L ( "*************BEGIN******************" ) ); + + RFileLogger::WriteFormat ( KDir, KFile, EFileLoggingModeAppend, _L ( "Recvd Presentity Grant event" ) ); + RFileLogger::Write ( KDir, KFile, EFileLoggingModeAppend, sdstate ); + RFileLogger::Write ( KDir, KFile, EFileLoggingModeAppend, ssstate ); + + TInt index = blockListEvent->NewBlocksCount(); + + for ( TInt i = 0; i < index; i++ ) + { + const MPresenceBlockInfo& blockinfo = blockListEvent->NewBlock ( i ); + + RFileLogger::Write ( KDir, KFile, EFileLoggingModeAppend, blockinfo.BlockedEntityId().Identity() ); + const TDesC16& dispname = blockinfo.BlockedEntityDisplayName(); + RFileLogger::Write ( KDir, KFile, EFileLoggingModeAppend, dispname ); + } + + index = blockListEvent->CurrentBlocksCount(); + + for ( TInt i = 0; i < index; i++ ) + { + const MPresenceBlockInfo& blockinfo = blockListEvent->CurrentBlock ( i ); + + RFileLogger::Write ( KDir, KFile, EFileLoggingModeAppend, blockinfo.BlockedEntityId().Identity() ); + const TDesC16& dispname = blockinfo.BlockedEntityDisplayName(); + RFileLogger::Write ( KDir, KFile, EFileLoggingModeAppend, dispname ); + } + + break; + } + + case MPresentityPresenceEvent::KInterfaceId: + { + const MPresentityPresenceEvent* PresentityPresenceEvent = + TXIMPGetInterface< const MPresentityPresenceEvent >::From ( aEvent, + MXIMPBase::EPanicIfUnknown ); + TBuf<100> sdstate; + TBuf<100> ssstate; + _LIT ( Kna, " Susbcription state is unavailable" ); + _LIT ( Kava, " Susbcription state is available" ); + _LIT ( KDef, " Susbcription state is ERROR" ); + + const MXIMPDataSubscriptionState& dstate = PresentityPresenceEvent->DataSubscriptionState(); + + switch ( dstate.SubscriptionState() ) + { + + case 0: + ssstate.Copy ( Kna ); + break; + + case 1: + ssstate.Copy ( Kava ); + break; + + default: + ssstate.Copy ( KDef ); + break; + } + + _LIT ( Kdna, " Data state is unavailable" ); + + _LIT ( Kdava, " Data state is available" ); + _LIT ( KdDef, " Data state is ERROR" ); + + + switch ( dstate.SubscriptionState() ) + { + + case 0: + sdstate.Copy ( Kdna ); + break; + + case 1: + sdstate.Copy ( Kdava ); + break; + + default: + sdstate.Copy ( KdDef ); + break; + } + + RFileLogger::WriteFormat ( KDir, KFile, EFileLoggingModeAppend, _L ( "*************BEGIN******************" ) ); + + RFileLogger::WriteFormat ( KDir, KFile, EFileLoggingModeAppend, _L ( "Recvd Presentity PresenceEvent" ) ); + RFileLogger::Write ( KDir, KFile, EFileLoggingModeAppend, sdstate ); + RFileLogger::Write ( KDir, KFile, EFileLoggingModeAppend, ssstate ); + + RFileLogger::Write ( KDir, KFile, EFileLoggingModeAppend, PresentityPresenceEvent->PresentityId().Identity() ); + + const MPresenceInfo& pi = PresentityPresenceEvent->SubscribedPresence(); + const MPersonPresenceInfo* ppi = pi.PersonPresence(); + const MPresenceInfoFieldCollection& presinf = ppi->Fields(); + TInt index = presinf.FieldCount(); + // const MXIMPBase base; + + for ( TInt i = 0; i < index; i++ ) + { + const MPresenceInfoField& infofield = presinf.FieldAt ( i ); + RFileLogger::Write ( KDir, KFile, EFileLoggingModeAppend, infofield.FieldType() ); + const MPresenceInfoFieldValueText* PresentityPresencestatus = + TXIMPGetInterface< const MPresenceInfoFieldValueText >::From ( infofield.FieldValue(), + MXIMPBase::EPanicIfUnknown ); + RFileLogger::Write ( KDir, KFile, EFileLoggingModeAppend, PresentityPresencestatus->TextValue() ); + // EUNIT_ASSERT_EQUALS_DESC(PresentityPresencestatus->TextValue(), iPersonpresattributes[i], "statustext does'nt match"); + } + + index = pi.ServicePresenceCount(); + + for ( TInt i = 0; i < index; i++ ) + { + const MServicePresenceInfo& servicePresinfo = pi.ServicePresenceAt ( i ); + RFileLogger::Write ( KDir, KFile, EFileLoggingModeAppend, servicePresinfo.ServiceType() ); +// EUNIT_ASSERT_EQUALS_DESC(servicePresinfo.ServiceType(), servctype, "service does'nt match"); + const MPresenceInfoFieldCollection& fields = servicePresinfo.Fields(); + + for ( TInt j = 0; j < fields.FieldCount(); j++ ) + { + const MPresenceInfoField& infofield = fields.FieldAt ( j ); + RFileLogger::Write ( KDir, KFile, EFileLoggingModeAppend, infofield.FieldType() ); + const MPresenceInfoFieldValueText* Presenceavailability = + TXIMPGetInterface< const MPresenceInfoFieldValueText >::From ( infofield.FieldValue(), + MXIMPBase::EPanicIfUnknown ); + +// EUNIT_ASSERT_EQUALS_DESC(Presenceavailability->TextValue(), _L("OPEN") , "Comm capability does'nt match"); + RFileLogger::WriteFormat ( KDir, KFile, EFileLoggingModeAppend, Presenceavailability->TextValue() ); + } + } + + index = pi.DevicePresenceCount(); + + for ( TInt i = 0; i < index; i++ ) + { + const MDevicePresenceInfo& DevicePresinfo = pi.DevicePresenceAt ( i ); + const TPtrC8 devicename = DevicePresinfo.DeviceName(); + RFileLogger::Write ( KDir, KFile, EFileLoggingModeAppend, DevicePresinfo.DeviceName() ); + const MPresenceInfoFieldCollection& fields = DevicePresinfo.Fields(); + TInt fieldcount = fields.FieldCount(); + + for ( TInt j = 0; j < fieldcount; j++ ) + { + const MPresenceInfoField& infofield = fields.FieldAt ( j ); + const TDesC8* fieldtype = & ( infofield.FieldType() ); + RFileLogger::Write ( KDir, KFile, EFileLoggingModeAppend, *fieldtype ); + const MXIMPBase& base = infofield.FieldValue(); + const MPresenceInfoFieldValueText* Presentityvalue = + TXIMPGetInterface< const MPresenceInfoFieldValueText >::From ( infofield.FieldValue(), + MXIMPBase::EPanicIfUnknown ); + + RFileLogger::Write ( KDir, KFile, EFileLoggingModeAppend, Presentityvalue->TextValue() ); +// EUNIT_ASSERT_EQUALS_DESC(Presentityvalue->TextValue(), clienttype, "Clienttype does'nt match"); + } + + + } + + _LIT ( KMsg, " presentity presence event is getting " ); // here we hv to write message or text wch we want to write in log file + + RFileLogger::WriteFormat ( KDir, KFile, EFileLoggingModeAppend, KMsg ); + break; + } + + case MPresenceWatcherListEvent::KInterfaceId: + { + const MPresenceWatcherListEvent* watcherListEvent = + TXIMPGetInterface< const MPresenceWatcherListEvent >::From ( aEvent, + MXIMPBase::EPanicIfUnknown ); + TBuf<100> sdstate; + TBuf<100> ssstate; + + const MXIMPDataSubscriptionState& dstate = watcherListEvent->DataSubscriptionState(); + + RFileLogger::WriteFormat ( KDir, KFile, EFileLoggingModeAppend, _L ( "Recvd watcher event" ) ); + // print the list contents + + for ( TInt i = 0; i < watcherListEvent->CurrentWatchersCount(); i++ ) + { + const MPresenceWatcherInfo& gi = watcherListEvent->CurrentWatcher ( i ); + + gid[i].Copy ( gi.WatcherId().Identity() ); + RFileLogger::WriteFormat ( KDir, KFile, EFileLoggingModeAppend, _L ( "Id and displayname for cur watcher group %d X" ), i ); + RFileLogger::Write ( KDir, KFile, EFileLoggingModeAppend, gi.WatcherId().Identity() ); +// EUNIT_ASSERT_EQUALS_DESC(gi.WatcherId().Identity(), KContact1, "watcher does'nt match"); + RFileLogger::Write ( KDir, KFile, EFileLoggingModeAppend, gi.WatcherDisplayName() ); + // EUNIT_ASSERT_EQUALS_DESC(gi.WatcherDisplayName(), KNickname1, "Devicename does'nt match"); + } + + gidcount = watcherListEvent->CurrentWatchersCount(); + + // print the list contents + + for ( TInt i = 0; i < watcherListEvent->NewWatchersCount(); i++ ) + { + const MPresenceWatcherInfo& gi = watcherListEvent->NewWatcher ( i ); + gid[i].Copy ( gi.WatcherId().Identity() ); + RFileLogger::WriteFormat ( KDir, KFile, EFileLoggingModeAppend, _L ( "Id and displayname for new group %d X" ), i ); + RFileLogger::Write ( KDir, KFile, EFileLoggingModeAppend, gi.WatcherId().Identity() ); +// EUNIT_ASSERT_EQUALS_DESC(gi.WatcherId().Identity(), KContact1, "watcher does'nt match"); + RFileLogger::Write ( KDir, KFile, EFileLoggingModeAppend, gi.WatcherDisplayName() ); + // EUNIT_ASSERT_EQUALS_DESC(gi.WatcherDisplayName(), KNickname1, "Devicename does'nt match"); + } + + RFileLogger::WriteFormat ( KDir, KFile, EFileLoggingModeAppend, _L ( "*************END*******************" ) ); + + gidcount = watcherListEvent->NewWatchersCount(); + + break; + } + + case MImConversationEvent::KInterfaceId: + { + RFileLogger::WriteFormat ( KDir, KFile, EFileLoggingModeAppend, _L ( "Recvd conversation event" ) ); + + const MImConversationEvent* convEvent = + TXIMPGetInterface< const MImConversationEvent >::From + ( aEvent, MXIMPBase::EPanicIfUnknown ); + TInt count = convEvent->NewTextMessageCount(); + const MImConversationInfo& convInfo = convEvent->NewTextMessage ( 0 ); + const MXIMPIdentity& identity = convInfo.MessageId(); + const TDesC16& msg = convInfo.TextMessage(); + RFileLogger::WriteFormat ( KDir, KFile, EFileLoggingModeAppend, _L ( "message is" ) ); + RFileLogger::Write ( KDir, KFile, EFileLoggingModeAppend, convInfo.TextMessage() ); + RFileLogger::Write ( KDir, KFile, EFileLoggingModeAppend, convInfo.MessageId().Identity() ); + + /* const MDesCArray& array= convInfo.RecipientL(); + TPtrC sender=array.MdcaPoint(0);*/ + break; + } + case MSearchEvent::KInterfaceId: + { + RFileLogger::WriteFormat ( KDir, KFile, EFileLoggingModeAppend, _L ( "search event")); + const MSearchEvent* srchEvent = + TXIMPGetInterface< const MSearchEvent >::From + (aEvent, MXIMPBase::EPanicIfUnknown); + TInt count= srchEvent->SearchResultCount(); + RFileLogger::WriteFormat ( KDir, KFile, EFileLoggingModeAppend,_L("result count :%d "),count); + RFileLogger::Write ( KDir, KFile, EFileLoggingModeAppend, srchEvent->SearchId().Identity() ); + + TInt64 radn; + TInt random = Math::Rand( radn ); + + for(TInt i=0;iSearchResult(i); + RFileLogger::WriteFormat ( KDir, KFile, EFileLoggingModeAppend,_L("Result No:%d "),i); + RFileLogger::Write ( KDir, KFile, EFileLoggingModeAppend, info.GetFieldInfo(EFirstName) ); + RFileLogger::Write ( KDir, KFile, EFileLoggingModeAppend, info.GetFieldInfo(ELastName) ); + RFileLogger::Write ( KDir, KFile, EFileLoggingModeAppend, info.GetFieldInfo(EEmailAddress) ); + //take a random contact + if ( i == random % count ) + { + + RFs fs; + RFile file; + TBuf8<100> buf; + User::LeaveIfError( fs.Connect() ); + User::LeaveIfError( file.Replace( fs, + KAddContactFileName, EFileWrite ) ); + + CnvUtfConverter::ConvertFromUnicodeToUtf8( buf, + info.GetFieldInfo(EEmailAddress) ); + file.Write( buf ); + file.Close(); + fs.Close(); + + } + } + RFileLogger::WriteFormat ( KDir, KFile, EFileLoggingModeAppend, _L ( "search event processed")); + break; + } + + case MSearchKeysEvent::KInterfaceId: + { + const MSearchKeysEvent* srchEvent = + TXIMPGetInterface< const MSearchKeysEvent >::From + (aEvent, MXIMPBase::EPanicIfUnknown); + TInt count= srchEvent->InfoCount(); + + for(TInt a=0; a < count; a++) + { + const MSearchKeyInfo& keyInfo=srchEvent->SearchKeyInfo( a); + switch(keyInfo.Type()) + { + case EKey: + { + TInt key= keyInfo.Key(); + } + break; + + case ELabel: + { + TPtrC label = keyInfo.Label(); + break; + } + } + } + + break; + } + + default: + { + break; + } + } + } + + +// end of file + + + + + + diff -r 000000000000 -r e6b17d312c8b imservices/searchfeatureplugin/bwins/searchdatamodelhooku.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/searchfeatureplugin/bwins/searchdatamodelhooku.def Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + ?ImplementationGroupProxy@@YAPBUTImplementationProxy@@AAH@Z @ 1 NONAME ; struct TImplementationProxy const * ImplementationGroupProxy(int &) + diff -r 000000000000 -r e6b17d312c8b imservices/searchfeatureplugin/bwins/searchdatamodelu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/searchfeatureplugin/bwins/searchdatamodelu.def Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,32 @@ +EXPORTS + ??1CSearchSubscriptionItem@@UAE@XZ @ 1 NONAME ; CSearchSubscriptionItem::~CSearchSubscriptionItem(void) + ?CleanExpired@CSearchDataCache@@QAEXXZ @ 2 NONAME ; void CSearchDataCache::CleanExpired(void) + ?CleanResources@CSearchDataCache@@QAEXAAVMXIMPPscContext@@@Z @ 3 NONAME ; void CSearchDataCache::CleanResources(class MXIMPPscContext &) + ?InfoLinearOrder@CSearchInfoImp@@SAHABV1@0@Z @ 4 NONAME ; int CSearchInfoImp::InfoLinearOrder(class CSearchInfoImp const &, class CSearchInfoImp const &) + ?InternalizeL@CSearchElementImp@@QAEXAAVRReadStream@@@Z @ 5 NONAME ; void CSearchElementImp::InternalizeL(class RReadStream &) + ?InternalizeL@CSearchInfoImp@@QAEXAAVRReadStream@@@Z @ 6 NONAME ; void CSearchInfoImp::InternalizeL(class RReadStream &) + ?NewFromStreamLC@CSearchElementImp@@SAPAVCXIMPApiDataObjBase@@AAVRReadStream@@@Z @ 7 NONAME ; class CXIMPApiDataObjBase * CSearchElementImp::NewFromStreamLC(class RReadStream &) + ?NewFromStreamLC@CSearchInfoImp@@SAPAVCXIMPApiDataObjBase@@AAVRReadStream@@@Z @ 8 NONAME ; class CXIMPApiDataObjBase * CSearchInfoImp::NewFromStreamLC(class RReadStream &) + ?NewL@CSearchApiDataObjFactoryAccessor@@SAPAV1@XZ @ 9 NONAME ; class CSearchApiDataObjFactoryAccessor * CSearchApiDataObjFactoryAccessor::NewL(void) + ?NewL@CSearchDataCache@@SAPAV1@AAVMXIMPHost@@@Z @ 10 NONAME ; class CSearchDataCache * CSearchDataCache::NewL(class MXIMPHost &) + ?NewL@CSearchElementImp@@SAPAV1@XZ @ 11 NONAME ; class CSearchElementImp * CSearchElementImp::NewL(void) + ?NewL@CSearchInfoImp@@SAPAV1@XZ @ 12 NONAME ; class CSearchInfoImp * CSearchInfoImp::NewL(void) + ?NewL@CSearchObjectFactoryImp@@SAPAV1@XZ @ 13 NONAME ; class CSearchObjectFactoryImp * CSearchObjectFactoryImp::NewL(void) + ?NewLC@CSearchElementImp@@SAPAV1@XZ @ 14 NONAME ; class CSearchElementImp * CSearchElementImp::NewLC(void) + ?NewLC@CSearchEventImp@@SAPAV1@AAVCXIMPIdentityImp@@PAV?$RXIMPObjOwningPtrArray@VCSearchInfoImp@@@@@Z @ 15 NONAME ; class CSearchEventImp * CSearchEventImp::NewLC(class CXIMPIdentityImp &, class RXIMPObjOwningPtrArray *) + ?NewLC@CSearchInfoImp@@SAPAV1@XZ @ 16 NONAME ; class CSearchInfoImp * CSearchInfoImp::NewLC(void) + ?RemoveMe@?$@VCSearchSubscriptionItem@@@CSearchDataCache@@CAXAAPAV1@PAV1@@Z @ 17 NONAME ; void CSearchDataCache::RemoveMe(class CSearchSubscriptionItem * &, class CSearchSubscriptionItem *) + ?SearchSubscriptionItemLC@CSearchDataCache@@QAEAAVCSearchSubscriptionItem@@XZ @ 18 NONAME ; class CSearchSubscriptionItem & CSearchDataCache::SearchSubscriptionItemLC(void) + ?SetSearchIdL@CSearchSubscriptionItem@@QAEXAAVCXIMPIdentityImp@@@Z @ 19 NONAME ; void CSearchSubscriptionItem::SetSearchIdL(class CXIMPIdentityImp &) + ?SetSearchResults@CSearchSubscriptionItem@@QAEXPAV?$RXIMPObjOwningPtrArray@VCSearchInfoImp@@@@@Z @ 20 NONAME ; void CSearchSubscriptionItem::SetSearchResults(class RXIMPObjOwningPtrArray *) + ??1CSearchKeysSubscriptionItem@@UAE@XZ @ 21 NONAME ; CSearchKeysSubscriptionItem::~CSearchKeysSubscriptionItem(void) + ?RemoveMe@?$@VCSearchKeysSubscriptionItem@@@CSearchDataCache@@CAXAAPAV1@PAV1@@Z @ 22 NONAME ; void CSearchDataCache::RemoveMe(class CSearchKeysSubscriptionItem * &, class CSearchKeysSubscriptionItem *) + ?SearchKeysSubscriptionItemLC@CSearchDataCache@@QAEAAVCSearchKeysSubscriptionItem@@XZ @ 23 NONAME ; class CSearchKeysSubscriptionItem & CSearchDataCache::SearchKeysSubscriptionItemLC(void) + ?InternalizeL@CSearchKeyInfoImp@@QAEXAAVRReadStream@@@Z @ 24 NONAME ; void CSearchKeyInfoImp::InternalizeL(class RReadStream &) + ?LinearOrder@CSearchKeyInfoImp@@SAHABV1@0@Z @ 25 NONAME ; int CSearchKeyInfoImp::LinearOrder(class CSearchKeyInfoImp const &, class CSearchKeyInfoImp const &) + ?NewFromStreamLC@CSearchKeyInfoImp@@SAPAVCXIMPApiDataObjBase@@AAVRReadStream@@@Z @ 26 NONAME ; class CXIMPApiDataObjBase * CSearchKeyInfoImp::NewFromStreamLC(class RReadStream &) + ?NewL@CSearchKeyInfoImp@@SAPAV1@XZ @ 27 NONAME ; class CSearchKeyInfoImp * CSearchKeyInfoImp::NewL(void) + ?NewLC@CSearchKeyInfoImp@@SAPAV1@XZ @ 28 NONAME ; class CSearchKeyInfoImp * CSearchKeyInfoImp::NewLC(void) + ?NewLC@CSearchKeysEventImp@@SAPAV1@PAV?$RXIMPObjOwningPtrArray@VCSearchKeyInfoImp@@@@@Z @ 29 NONAME ; class CSearchKeysEventImp * CSearchKeysEventImp::NewLC(class RXIMPObjOwningPtrArray *) + ?SetKeyInfoArray@CSearchKeysSubscriptionItem@@QAEXPAV?$RXIMPObjOwningPtrArray@VCSearchKeyInfoImp@@@@@Z @ 30 NONAME ; void CSearchKeysSubscriptionItem::SetKeyInfoArray(class RXIMPObjOwningPtrArray *) + diff -r 000000000000 -r e6b17d312c8b imservices/searchfeatureplugin/bwins/searchecomhooku.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/searchfeatureplugin/bwins/searchecomhooku.def Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + ?ImplementationGroupProxy@@YAPBUTImplementationProxy@@AAH@Z @ 1 NONAME ; struct TImplementationProxy const * ImplementationGroupProxy(int &) + diff -r 000000000000 -r e6b17d312c8b imservices/searchfeatureplugin/bwins/searchmanageru.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/searchfeatureplugin/bwins/searchmanageru.def Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + ?NewL@CSearchFeatureImp@@SAPAV1@PAVMXIMPContext@@@Z @ 1 NONAME ; class CSearchFeatureImp * CSearchFeatureImp::NewL(class MXIMPContext *) + diff -r 000000000000 -r e6b17d312c8b imservices/searchfeatureplugin/bwins/searchoperationshooku.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/searchfeatureplugin/bwins/searchoperationshooku.def Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + ?ImplementationGroupProxy@@YAPBUTImplementationProxy@@AAH@Z @ 1 NONAME ; struct TImplementationProxy const * ImplementationGroupProxy(int &) + diff -r 000000000000 -r e6b17d312c8b imservices/searchfeatureplugin/bwins/searchoperationu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/searchfeatureplugin/bwins/searchoperationu.def Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,7 @@ +EXPORTS + ??0COperationHandleSearchResult@@QAE@XZ @ 1 NONAME ; COperationHandleSearchResult::COperationHandleSearchResult(void) + ??0COperationSearch@@QAE@XZ @ 2 NONAME ; COperationSearch::COperationSearch(void) + ?NewL@CSearchOperationFactory@@SAPAV1@XZ @ 3 NONAME ; class CSearchOperationFactory * CSearchOperationFactory::NewL(void) + ??0COperationGetSearchKeys@@QAE@XZ @ 4 NONAME ; COperationGetSearchKeys::COperationGetSearchKeys(void) + ??0COperationHandleSearchKeys@@QAE@XZ @ 5 NONAME ; COperationHandleSearchKeys::COperationHandleSearchKeys(void) + diff -r 000000000000 -r e6b17d312c8b imservices/searchfeatureplugin/bwins/searchprocessorhooku.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/searchfeatureplugin/bwins/searchprocessorhooku.def Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + ?ImplementationGroupProxy@@YAPBUTImplementationProxy@@AAH@Z @ 1 NONAME ; struct TImplementationProxy const * ImplementationGroupProxy(int &) + diff -r 000000000000 -r e6b17d312c8b imservices/searchfeatureplugin/bwins/searchprocessoru.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/searchfeatureplugin/bwins/searchprocessoru.def Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,6 @@ +EXPORTS + ?NewL@CProtocolDataHostImp@@SAPAV1@AAVMXIMPHost@@@Z @ 1 NONAME ; class CProtocolDataHostImp * CProtocolDataHostImp::NewL(class MXIMPHost &) + ?NewL@CProtocolSearchFeatureDataHostImp@@SAPAV1@AAVMXIMPHost@@@Z @ 2 NONAME ; class CProtocolSearchFeatureDataHostImp * CProtocolSearchFeatureDataHostImp::NewL(class MXIMPHost &) + ?NewLC@CProtocolDataHostImp@@SAPAV1@AAVMXIMPHost@@@Z @ 3 NONAME ; class CProtocolDataHostImp * CProtocolDataHostImp::NewLC(class MXIMPHost &) + ?SearchDataCache@CProtocolSearchDataHostImp@@QAEAAVCSearchDataCache@@XZ @ 4 NONAME ; class CSearchDataCache & CProtocolSearchDataHostImp::SearchDataCache(void) + diff -r 000000000000 -r e6b17d312c8b imservices/searchfeatureplugin/eabi/searchdatamodelhooku.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/searchfeatureplugin/eabi/searchdatamodelhooku.def Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + _Z24ImplementationGroupProxyRi @ 1 NONAME + diff -r 000000000000 -r e6b17d312c8b imservices/searchfeatureplugin/eabi/searchdatamodelu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/searchfeatureplugin/eabi/searchdatamodelu.def Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,48 @@ +EXPORTS + _ZN14CSearchInfoImp12InternalizeLER11RReadStream @ 1 NONAME + _ZN14CSearchInfoImp15InfoLinearOrderERKS_S1_ @ 2 NONAME + _ZN14CSearchInfoImp15NewFromStreamLCER11RReadStream @ 3 NONAME + _ZN14CSearchInfoImp4NewLEv @ 4 NONAME + _ZN14CSearchInfoImp5NewLCEv @ 5 NONAME + _ZN15CSearchEventImp5NewLCER16CXIMPIdentityImpP22RXIMPObjOwningPtrArrayI14CSearchInfoImpE @ 6 NONAME + _ZN16CSearchDataCache12CleanExpiredEv @ 7 NONAME + _ZN16CSearchDataCache14CleanResourcesER15MXIMPPscContext @ 8 NONAME + _ZN16CSearchDataCache24SearchSubscriptionItemLCEv @ 9 NONAME + _ZN16CSearchDataCache4NewLER9MXIMPHost @ 10 NONAME + _ZN16CSearchDataCache8RemoveMeI23CSearchSubscriptionItemEEvRPT_S3_ @ 11 NONAME + _ZN17CSearchElementImp12InternalizeLER11RReadStream @ 12 NONAME + _ZN17CSearchElementImp15NewFromStreamLCER11RReadStream @ 13 NONAME + _ZN17CSearchElementImp4NewLEv @ 14 NONAME + _ZN17CSearchElementImp5NewLCEv @ 15 NONAME + _ZN23CSearchObjectFactoryImp4NewLEv @ 16 NONAME + _ZN23CSearchSubscriptionItem12SetSearchIdLER16CXIMPIdentityImp @ 17 NONAME + _ZN23CSearchSubscriptionItem16SetSearchResultsEP22RXIMPObjOwningPtrArrayI14CSearchInfoImpE @ 18 NONAME + _ZN23CSearchSubscriptionItemD0Ev @ 19 NONAME + _ZN23CSearchSubscriptionItemD1Ev @ 20 NONAME + _ZN23CSearchSubscriptionItemD2Ev @ 21 NONAME + _ZN32CSearchApiDataObjFactoryAccessor4NewLEv @ 22 NONAME + _ZTI16CSearchDataCache @ 23 NONAME ; ## + _ZTI23CSearchObjectFactoryImp @ 24 NONAME ; ## + _ZTI23CSearchSubscriptionItem @ 25 NONAME ; ## + _ZTV16CSearchDataCache @ 26 NONAME ; ## + _ZTV23CSearchObjectFactoryImp @ 27 NONAME ; ## + _ZTV23CSearchSubscriptionItem @ 28 NONAME ; ## + _ZThn28_N23CSearchSubscriptionItemD0Ev @ 29 NONAME ; ## + _ZThn28_N23CSearchSubscriptionItemD1Ev @ 30 NONAME ; ## + _ZN16CSearchDataCache28SearchKeysSubscriptionItemLCEv @ 31 NONAME + _ZN16CSearchDataCache8RemoveMeI27CSearchKeysSubscriptionItemEEvRPT_S3_ @ 32 NONAME + _ZN17CSearchKeyInfoImp11LinearOrderERKS_S1_ @ 33 NONAME + _ZN17CSearchKeyInfoImp12InternalizeLER11RReadStream @ 34 NONAME + _ZN17CSearchKeyInfoImp15NewFromStreamLCER11RReadStream @ 35 NONAME + _ZN17CSearchKeyInfoImp4NewLEv @ 36 NONAME + _ZN17CSearchKeyInfoImp5NewLCEv @ 37 NONAME + _ZN19CSearchKeysEventImp5NewLCEP22RXIMPObjOwningPtrArrayI17CSearchKeyInfoImpE @ 38 NONAME + _ZN27CSearchKeysSubscriptionItem15SetKeyInfoArrayEP22RXIMPObjOwningPtrArrayI17CSearchKeyInfoImpE @ 39 NONAME + _ZN27CSearchKeysSubscriptionItemD0Ev @ 40 NONAME + _ZN27CSearchKeysSubscriptionItemD1Ev @ 41 NONAME + _ZN27CSearchKeysSubscriptionItemD2Ev @ 42 NONAME + _ZTI27CSearchKeysSubscriptionItem @ 43 NONAME ; ## + _ZTV27CSearchKeysSubscriptionItem @ 44 NONAME ; ## + _ZThn28_N27CSearchKeysSubscriptionItemD0Ev @ 45 NONAME ; ## + _ZThn28_N27CSearchKeysSubscriptionItemD1Ev @ 46 NONAME ; ## + diff -r 000000000000 -r e6b17d312c8b imservices/searchfeatureplugin/eabi/searchecomhooku.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/searchfeatureplugin/eabi/searchecomhooku.def Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + _Z24ImplementationGroupProxyRi @ 1 NONAME + diff -r 000000000000 -r e6b17d312c8b imservices/searchfeatureplugin/eabi/searchmanageru.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/searchfeatureplugin/eabi/searchmanageru.def Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + _ZN17CSearchFeatureImp4NewLEP12MXIMPContext @ 1 NONAME + diff -r 000000000000 -r e6b17d312c8b imservices/searchfeatureplugin/eabi/searchoperationshooku.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/searchfeatureplugin/eabi/searchoperationshooku.def Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + _Z24ImplementationGroupProxyRi @ 1 NONAME + diff -r 000000000000 -r e6b17d312c8b imservices/searchfeatureplugin/eabi/searchoperationu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/searchfeatureplugin/eabi/searchoperationu.def Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,19 @@ +EXPORTS + _ZN16COperationSearchC1Ev @ 1 NONAME + _ZN16COperationSearchC2Ev @ 2 NONAME + _ZN23CSearchOperationFactory4NewLEv @ 3 NONAME + _ZN28COperationHandleSearchResultC1Ev @ 4 NONAME + _ZN28COperationHandleSearchResultC2Ev @ 5 NONAME + _ZTI16COperationSearch @ 6 NONAME ; ## + _ZTI28COperationHandleSearchResult @ 7 NONAME ; ## + _ZTV16COperationSearch @ 8 NONAME ; ## + _ZTV28COperationHandleSearchResult @ 9 NONAME ; ## + _ZN23COperationGetSearchKeysC1Ev @ 10 NONAME + _ZN23COperationGetSearchKeysC2Ev @ 11 NONAME + _ZN26COperationHandleSearchKeysC1Ev @ 12 NONAME + _ZN26COperationHandleSearchKeysC2Ev @ 13 NONAME + _ZTI23COperationGetSearchKeys @ 14 NONAME ; ## + _ZTI26COperationHandleSearchKeys @ 15 NONAME ; ## + _ZTV23COperationGetSearchKeys @ 16 NONAME ; ## + _ZTV26COperationHandleSearchKeys @ 17 NONAME ; ## + diff -r 000000000000 -r e6b17d312c8b imservices/searchfeatureplugin/eabi/searchprocessorhooku.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/searchfeatureplugin/eabi/searchprocessorhooku.def Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + _Z24ImplementationGroupProxyRi @ 1 NONAME + diff -r 000000000000 -r e6b17d312c8b imservices/searchfeatureplugin/eabi/searchprocessoru.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/searchfeatureplugin/eabi/searchprocessoru.def Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,8 @@ +EXPORTS + _ZN20CProtocolDataHostImp4NewLER9MXIMPHost @ 1 NONAME + _ZN20CProtocolDataHostImp5NewLCER9MXIMPHost @ 2 NONAME + _ZN26CProtocolSearchDataHostImp15SearchDataCacheEv @ 3 NONAME + _ZN33CProtocolSearchFeatureDataHostImp4NewLER9MXIMPHost @ 4 NONAME + _ZTI33CProtocolSearchFeatureDataHostImp @ 5 NONAME ; ## + _ZTV33CProtocolSearchFeatureDataHostImp @ 6 NONAME ; ## + diff -r 000000000000 -r e6b17d312c8b imservices/searchfeatureplugin/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/searchfeatureplugin/group/bld.inf Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,40 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Build information file for project Search Feature Plugin +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS +../rom/searchfeatureplugin.iby CORE_MW_LAYER_IBY_EXPORT_PATH(searchfeatureplugin.iby) + +PRJ_MMPFILES +../srcsearchdatamodel/group/searchdatamodel.mmp +../srcsearchdatamodel/group/searchdatamodelhook.mmp +../srcsearchfrontend/group/searchmanager.mmp +../srcsearchfrontend/group/searchecomhook.mmp +../srcsearchprocessor/group/searchprocessor.mmp +../srcsearchprocessor/group/searchprocessorhook.mmp +../srcsearchoperations/group/searchoperation.mmp +../srcsearchoperations/group/searchoperationshook.mmp + +PRJ_TESTMMPFILES + +PRJ_TESTEXPORTS + diff -r 000000000000 -r e6b17d312c8b imservices/searchfeatureplugin/group/searchdlluids.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/searchfeatureplugin/group/searchdlluids.hrh Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,62 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework SEARCH Feature plugin DLL uids +* +*/ + + +#ifndef SEARCHDLLUIDS_HRH +#define SEARCHDLLUIDS_HRH + + +// ----------------------------------------------------------------------------- +// Common dll uids +// ----------------------------------------------------------------------------- +// +#define XIMP_SEARCH_DLL_UID_STATIC_INTERFACE 0x1000008d +#define XIMP_SEARCH_DLL_UID_ECOM_PLUGIN 0x10009D8D + + +// ----------------------------------------------------------------------------- +// ECOM implementation UID +// ----------------------------------------------------------------------------- +// +#define XIMP_ECOM_IMPLEMENTATION_UID_SEARCH_INTERFACE 0x2001846F +#define XIMP_ECOM_IMPL_UID_SEARCH_DATAMODEL_INTERFACE 0x20018470 +#define XIMP_ECOM_IMPL_UID_SEARCH_PROCESSOR_INTERFACE 0x20018471 +#define XIMP_ECOM_IMPL_UID_SEARCH_OPERATION_INTERFACE 0x20018472 + +//------------------------------------------------------------------------------------- +// HOOK uids +//------------------------------------------------------------------------------------ + +#define XIMP_DLL_UID_SEARCH_HOOK 0x20018473 +#define XIMP_DLL_UID_SEARCH_DATAMODEL_HOOK 0x20018474 +#define XIMP_DLL_UID_SEARCH_PROCESSOR_HOOK 0x20018475 +#define XIMP_DLL_UID_SEARCH_OPERATIONS_HOOK 0x20018476 + +//------------------------------------------------------------------------------------- +// Dll uids +//------------------------------------------------------------------------------------ + +#define XIMP_DLL_UID_SEARCH_MANAGER 0x20018477 +#define XIMP_DLL_UID_SEARCH_PROCESSOR 0x20018478 +#define XIMP_DLL_UID_SEARCH_OPERATION 0x20018479 +#define XIMP_DLL_UID_SEARCH_DATAMODEL 0x2001847A + + + +#endif // SEARCHDLLUIDS_HRH + + diff -r 000000000000 -r e6b17d312c8b imservices/searchfeatureplugin/rom/searchfeatureplugin.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/searchfeatureplugin/rom/searchfeatureplugin.iby Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,36 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description:IBY file for search feature plugin +* +*/ + +#ifndef __SEARCHFEATUREPLUGIN_IBY__ +#define __SEARCHFEATUREPLUGIN_IBY__ + +// searchfeature plugin : +//dlls +file=ABI_DIR\BUILD_DIR\searchmanager.dll SHARED_LIB_DIR\searchmanager.dll +file=ABI_DIR\BUILD_DIR\searchdatamodel.dll SHARED_LIB_DIR\searchdatamodel.dll +file=ABI_DIR\BUILD_DIR\searchoperation.dll SHARED_LIB_DIR\searchoperation.dll +file=ABI_DIR\BUILD_DIR\searchprocessor.dll SHARED_LIB_DIR\searchprocessor.dll + +//ECom hook +ECOM_PLUGIN( searchecomhook.dll, searchecomhook.rsc) +ECOM_PLUGIN( searchdatamodelhook.dll, searchdatamodelhook.rsc) +ECOM_PLUGIN( searchoperationshook.dll, searchoperationshook.rsc) +ECOM_PLUGIN( searchprocessorhook.dll, searchprocessorhook.rsc) + +#endif + + diff -r 000000000000 -r e6b17d312c8b imservices/searchfeatureplugin/srcsearchdatamodel/apidataobjfactory.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/searchfeatureplugin/srcsearchdatamodel/apidataobjfactory.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,51 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MApiDataObjFactory Declaration +* +*/ + + + +#ifndef M_APIOBJFACTORY_H +#define M_APIOBJFACTORY_H + +#include + +class CXIMPApiDataObjBase; + +class MApiDataObjFactory + { + public: + /** + * instantiation method from the stream. + * + * @param [in] aDataObjInterfaceId + * interface id of the object to be constructed. + * + * @param [in] aStream + * read stream from which the object is instantiated. + * + * + * @return CXIMPApiDataObjBase object. + * + * + */ + + virtual CXIMPApiDataObjBase* NewFromStreamLC( TInt32 aDataObjInterfaceId, + RReadStream& aStream ) = 0; + + }; + +#endif // M_APIOBJFACTORY_H + diff -r 000000000000 -r e6b17d312c8b imservices/searchfeatureplugin/srcsearchdatamodel/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/searchfeatureplugin/srcsearchdatamodel/group/bld.inf Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Build information file for project Search Feature Plugin +* +*/ + + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +PRJ_MMPFILES +searchdatamodel.mmp +searchdatamodelhook.mmp + + +PRJ_TESTMMPFILES + +PRJ_TESTEXPORTS + diff -r 000000000000 -r e6b17d312c8b imservices/searchfeatureplugin/srcsearchdatamodel/group/searchdatamodel.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/searchfeatureplugin/srcsearchdatamodel/group/searchdatamodel.mmp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,77 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project definition file for search Feature Plugin +* +*/ + +#include +#include +#include "../../group/searchdlluids.hrh" + +TARGET searchdatamodel.dll +TARGETTYPE dll +UID XIMP_SEARCH_DLL_UID_STATIC_INTERFACE XIMP_DLL_UID_SEARCH_DATAMODEL + +CAPABILITY CAP_GENERAL_DLL +VENDORID VID_DEFAULT + +VERSION 10.0 +// --------------------------------------------------------------------------- +SOURCEPATH ../search +// --------------------------------------------------------------------------- + +SOURCE searchsubscriptionitem.cpp +SOURCE searchelementimp.cpp +SOURCE searcheventimp.cpp +SOURCE searchinfoimp.cpp +SOURCE searchkeyinfoimp.cpp +SOURCE searchkeyseventimp.cpp +SOURCE searchkeysubscriptionitem.cpp +// --------------------------------------------------------------------------- +SOURCEPATH ../../srcsearchdatamodel +// --------------------------------------------------------------------------- +SOURCE searchdatacacheimp.cpp +SOURCE searchobjectfactoryimp.cpp + +SOURCE searchapidataobjfactory.cpp +SOURCE searcheventcodec.cpp +SOURCE searchapidataobjfactoryaccessor.cpp + + + +USERINCLUDE ../../srcsearchdatamodel +USERINCLUDE ../../srcsearchdatamodel/search +USERINCLUDE ../../group + + +MW_LAYER_SYSTEMINCLUDE + + +LIBRARY euser.lib +LIBRARY bafl.lib +LIBRARY estor.lib +LIBRARY ximputils.lib +LIBRARY ximpdatamodel.lib +LIBRARY ecom.lib +LIBRARY flogger.lib + + +#if defined( ARMCC ) +DEFFILE ../../eabi/ +#elif defined ( WINSCW ) +deffile ../../bwins/ +#endif + +// End of file + diff -r 000000000000 -r e6b17d312c8b imservices/searchfeatureplugin/srcsearchdatamodel/group/searchdatamodelhook.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/searchfeatureplugin/srcsearchdatamodel/group/searchdatamodelhook.mmp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,59 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project definition file for search Feature Plugin +* +*/ + + +#include +#include +#include "../../group/searchdlluids.hrh" + + +TARGET searchdatamodelhook.dll +CAPABILITY CAP_ECOM_PLUGIN +TARGETTYPE PLUGIN +UID XIMP_SEARCH_DLL_UID_ECOM_PLUGIN XIMP_DLL_UID_SEARCH_DATAMODEL_HOOK +VENDORID VID_DEFAULT + +VERSION 10.0 + +SOURCEPATH ../searchdatamodelhook +START RESOURCE searchdatamodelhook.rss +TARGET searchdatamodelhook.rsc +END + + +SOURCEPATH ../searchdatamodelhook +SOURCE searchdatamodelhook.cpp + + +USERINCLUDE ../../group +USERINCLUDE ../searchdatamodelhook +USERINCLUDE ../../srcsearchdatamodel + + +MW_LAYER_SYSTEMINCLUDE + + +LIBRARY euser.lib +LIBRARY searchdatamodel.lib +LIBRARY ecom.lib + + +#if defined( ARMCC ) +DEFFILE ../../eabi/ +#elif defined ( WINSCW ) +deffile ../../bwins/ +#endif \ No newline at end of file diff -r 000000000000 -r e6b17d312c8b imservices/searchfeatureplugin/srcsearchdatamodel/search/searchelementimp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/searchfeatureplugin/srcsearchdatamodel/search/searchelementimp.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,203 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Msearchelement implementation. +* +*/ + + +#include +#include "searchelementimp.h" +#include "ximpidentityimp.h" +#include "ximprbufhelpers.h" + + +// ============================ MEMBER FUNCTIONS ============================= + +// --------------------------------------------------------------------------- +// CSearchElementImp::NewLC() +// --------------------------------------------------------------------------- +// +EXPORT_C CSearchElementImp* CSearchElementImp::NewLC() + { + CSearchElementImp* self = new( ELeave ) CSearchElementImp; + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + + +// --------------------------------------------------------------------------- +// CSearchElementImp::NewL() +// --------------------------------------------------------------------------- +// +EXPORT_C CSearchElementImp* CSearchElementImp::NewL() + { + CSearchElementImp* self = NewLC(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// CSearchElementImp::NewFromStreamLC() +// --------------------------------------------------------------------------- +// +XIMPIMP_IMPLEMENT_DATAOBJ_NEWFROMSTREAM( CSearchElementImp ) + +// --------------------------------------------------------------------------- +// Implement supported interface access. +// --------------------------------------------------------------------------- +// +XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CSearchElementImp, MSearchElement ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() +XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CSearchElementImp, MSearchElement ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + +// --------------------------------------------------------------------------- +// CSearchElementImp::~CSearchElementImp() +// --------------------------------------------------------------------------- +// +CSearchElementImp::~CSearchElementImp() + { + delete iIdentity; + iIdentity=NULL; + delete iLabelIdentity; + iLabelIdentity=NULL; + } + +// --------------------------------------------------------------------------- +// CSearchElementImp::CSearchElementImp() +// --------------------------------------------------------------------------- +// +CSearchElementImp::CSearchElementImp() + { + } + + +// --------------------------------------------------------------------------- +// CSearchElementImp::ConstructL() +// --------------------------------------------------------------------------- +// +void CSearchElementImp::ConstructL() + { + iIdentity = CXIMPIdentityImp::NewLC(); + CleanupStack::Pop( iIdentity ); + iLabelIdentity = CXIMPIdentityImp::NewLC(); + CleanupStack::Pop( iLabelIdentity ); + } + +// --------------------------------------------------------------------------- +// CSearchElementImp::ExternalizeL() +// --------------------------------------------------------------------------- +// +void CSearchElementImp::ExternalizeL( RWriteStream& aStream ) const + { + iIdentity->ExternalizeL(aStream); + iLabelIdentity->ExternalizeL(aStream); + aStream.WriteInt32L(iSearchKey); + } + +// --------------------------------------------------------------------------- +// CSearchElementImp::InternalizeL() +// --------------------------------------------------------------------------- +// +EXPORT_C void CSearchElementImp::InternalizeL( RReadStream& aStream ) + { + iIdentity->InternalizeL(aStream); + iLabelIdentity->InternalizeL(aStream); + iSearchKey=aStream.ReadInt32L(); + } + + + + +// --------------------------------------------------------------------------- +// CSearchElementImp::EqualsContent() +// --------------------------------------------------------------------------- +// +TBool CSearchElementImp::EqualsContent( + const CXIMPApiDataObjBase& /*aOtherInstance*/ ) const + { + return ETrue; + } + // --------------------------------------------------------------------------- +// CSearchElementImp::SetRequestL +// --------------------------------------------------------------------------- +// +void CSearchElementImp::SetRequestL( MXIMPIdentity& aSearchStringId, + TSearchKey aKey ) + + { + if ( EReadLabel == aKey ) // if client trys to set EReadLabel then leave + { + User::Leave( KErrArgument ); + } + const CXIMPIdentityImp* identityImp = + TXIMPGetImpClassOrPanic< CXIMPIdentityImp>::From( aSearchStringId ); + + delete iIdentity; + iIdentity=NULL; + iIdentity =TXIMPObjectCloner< CXIMPIdentityImp>::CloneL(*identityImp ); + + iSearchKey=aKey; + + } + +// --------------------------------------------------------------------------- +// CSearchElementImp::SetRequestL +// --------------------------------------------------------------------------- +// +void CSearchElementImp::SetRequestL( MXIMPIdentity& aSearchStringId, + MXIMPIdentity& aLabelId ) + + { + const CXIMPIdentityImp* identityImp = + TXIMPGetImpClassOrPanic< CXIMPIdentityImp>::From( aSearchStringId ); + + delete iIdentity; + iIdentity=NULL; + iIdentity =TXIMPObjectCloner< CXIMPIdentityImp>::CloneL(*identityImp ); + + const CXIMPIdentityImp* labelIdentity = TXIMPGetImpClassOrPanic< CXIMPIdentityImp>::From( aLabelId ); + delete iLabelIdentity; + iLabelIdentity=NULL; + iLabelIdentity =TXIMPObjectCloner< CXIMPIdentityImp>::CloneL(*labelIdentity ); + iSearchKey = EReadLabel ; // make sure that if label is there then key is EReadLabel + + } +// --------------------------------------------------------------------------- +// CSearchElementImp::GetSearchId +// --------------------------------------------------------------------------- +// +MXIMPIdentity& CSearchElementImp::GetSearchId() const + { + return *iIdentity; + } +// --------------------------------------------------------------------------- +// CSearchElementImp::GetSearchLabel +// --------------------------------------------------------------------------- +// +MXIMPIdentity& CSearchElementImp::GetSearchLabel() const + { + return *iLabelIdentity; + } +// --------------------------------------------------------------------------- +// CSearchElementImp ::GetSearchKey +// --------------------------------------------------------------------------- +// +TSearchKey CSearchElementImp::GetSearchKey() const + { + return (TSearchKey)iSearchKey; + } + +// End of file diff -r 000000000000 -r e6b17d312c8b imservices/searchfeatureplugin/srcsearchdatamodel/search/searchelementimp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/searchfeatureplugin/srcsearchdatamodel/search/searchelementimp.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,129 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Msearchelement implementation. +* +*/ + +#ifndef CSEARCHELEMENTIMP_H +#define CSEARCHELEMENTIMP_H + + +#include +#include +#include +#include "ximpapidataobjbase.h" +#include "searchapiobjbase.h" + + +class CSearchElementImp; +class CXIMPIdentityImp; +/** + * MSearchElement implementation. + * + * @lib searchdatamodel.dll + */ +NONSHARABLE_CLASS( CSearchElementImp ): public CXIMPApiDataObjBase,public MSearchElement + { + public: + /** The class ID. */ + enum { KClassId = IMP_CLSID_CSEARCHELEMENTIMP }; + + public: + /** + * Construction :NewLC + */ + IMPORT_C static CSearchElementImp* NewLC(); + /** + * Construction :NewL + */ + IMPORT_C static CSearchElementImp* NewL(); + /** + * Destructor + */ + virtual ~CSearchElementImp(); + + private: + /** + * constructor + */ + CSearchElementImp(); + /** + * 2nd phase constructor + */ + void ConstructL(); + + public: // From CXIMPApiDataObjBase + + /** + * @see CXIMPApiDataObjBase + */ + XIMPIMP_DECLARE_DATAOBJ_BASE_METHODS + XIMPIMP_DECLARE_IF_BASE_METHODS + + + public: // New functions + + /** + * Internalizes object data from given stream. + * @param aStream Stream to read. + */ + IMPORT_C void InternalizeL( RReadStream& aStream ); + + /** + * + * @see MSearchElement + */ + void SetRequestL( MXIMPIdentity& aSearchId,TSearchKey aKey) ; + /** + * + * @see MSearchElement + */ + void SetRequestL( MXIMPIdentity& aSearchId, MXIMPIdentity& aLabelId) ; + /** + * + * @see MSearchElement + */ + MXIMPIdentity& GetSearchLabel() const; + + /** + * + * @see MSearchElement + */ + MXIMPIdentity& GetSearchId() const; + + /** + * + * @see MSearchElement + */ + TSearchKey GetSearchKey() const; + + private: + /** + * CXIMPIdentityImp for search id : owned + */ + CXIMPIdentityImp* iIdentity; + /** + * CXIMPIdentityImp for label : owned + */ + CXIMPIdentityImp* iLabelIdentity; + /** + * search key + */ + TInt iSearchKey; + + + }; + + +#endif // CSEARCHELEMENTIMP_H diff -r 000000000000 -r e6b17d312c8b imservices/searchfeatureplugin/srcsearchdatamodel/search/searcheventimp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/searchfeatureplugin/srcsearchdatamodel/search/searcheventimp.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,215 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MSearchEvent API object implementation. + * +*/ + +#include "searcheventimp.h" +#include "ximpapiobjbase.h" +#include "ximpapieventbase.h" +#include "searchinfoimp.h" +#include +#include "ximpobjecthelpers.h" +#include "ximpidentityimp.h" +// --------------------------------------------------------------------------- +// CSearchEventImp::NewLC() +// --------------------------------------------------------------------------- +// +EXPORT_C CSearchEventImp* CSearchEventImp::NewLC(CXIMPIdentityImp& aGroupId, + RSearchInfoImpArray* aSearchResults) + { + CSearchEventImp* self = new( ELeave ) CSearchEventImp(); + CleanupStack::PushL( self ); + self->ConstructL( aGroupId, aSearchResults ); + + return self; + } + +// --------------------------------------------------------------------------- +// CSearchEventImp::NewFromStreamLC() +// --------------------------------------------------------------------------- +// +CXIMPApiEventBase* CSearchEventImp::NewFromStreamLC( RReadStream& aStream ) + { + CSearchEventImp* self = new( ELeave ) CSearchEventImp; + CleanupStack::PushL( self ); + self->ConstructL( aStream ); + return self; + } +// --------------------------------------------------------------------------- +// CSearchEventImp::EqualsContent +// --------------------------------------------------------------------------- +// +TBool CSearchEventImp::EqualsContent( + const CXIMPApiEventBase& /*aOtherInstance*/ ) const + { + return ETrue; + } + +// --------------------------------------------------------------------------- +// From class CXIMPApiEventBase +// CSearchEventImp::ExternalizeL +// --------------------------------------------------------------------------- +// +void CSearchEventImp::ExternalizeL( RWriteStream& aStream ) const + { + iSearchId->ExternalizeL( aStream ); + WriteArrayToStreamL( *iSearchResults, aStream ); + } + + +// --------------------------------------------------------------------------- +// CSearchEventImp::~CSearchEventImp() +// --------------------------------------------------------------------------- +// +CSearchEventImp::~CSearchEventImp() + { + delete iSearchId; + delete iSearchResults; + iSearchResults=NULL; + } + + +// --------------------------------------------------------------------------- +// CSearchEventImp::CSearchEventImp() +// --------------------------------------------------------------------------- +// +CSearchEventImp::CSearchEventImp() + { + } + + +// --------------------------------------------------------------------------- +// CSearchEventImp::ConstructL() +// --------------------------------------------------------------------------- +// +void CSearchEventImp::ConstructL(CXIMPIdentityImp& aSearchId, + RSearchInfoImpArray* aSearchResults) + { + iSearchId=&aSearchId; // ownership is transfered here, need to delete + iSearchResults=aSearchResults; // ownership is transfered here, need to delete + } + + +// --------------------------------------------------------------------------- +// CSearchEventImp::ConstructL() +// --------------------------------------------------------------------------- +// +void CSearchEventImp::ConstructL( RReadStream& aStream ) + { + iConstructedFromStream = ETrue; + iSearchId = CXIMPIdentityImp::NewLC(); + CleanupStack::Pop( 1 ); // iSearchId + iSearchResults = new ( ELeave ) RSearchInfoImpArray; + InternalizeL( aStream ); + } + +// --------------------------------------------------------------------------- +// Implement supported interface access. +// --------------------------------------------------------------------------- +// +XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CSearchEventImp, + MSearchEvent ) + XIMPIMP_IF_BASE_GET_CLASS( CXIMPApiEventBase, this ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + +XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CSearchEventImp, + MSearchEvent ) + XIMPIMP_IF_BASE_GET_CONST_CLASS( CXIMPApiEventBase, this ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + + + +// --------------------------------------------------------------------------- +// Implement methods from base event interface and base event class +// --------------------------------------------------------------------------- +// +XIMPIMP_IMPLEMENT_EVENT_BASE_METHODS( CSearchEventImp, + MSearchEvent ) + + + +// --------------------------------------------------------------------------- +// CSearchEventImp::SearchCount() +// --------------------------------------------------------------------------- +// + TInt CSearchEventImp::SearchResultCount() const + { + return iSearchResults->Count(); + } +// --------------------------------------------------------------------------- +// CSearchEventImp::Search() +// --------------------------------------------------------------------------- +// + const MSearchInfo& CSearchEventImp::SearchResult( TInt aIndex ) const + { + return *(*iSearchResults)[ aIndex ]; + + } + +// --------------------------------------------------------------------------- +// CSearchEventImp::Search() +// --------------------------------------------------------------------------- +// + + const MXIMPIdentity& CSearchEventImp::SearchId() const + { + return *iSearchId; + } + // --------------------------------------------------------------------------- +// CSearchEventImp::WriteArrayToStreamL() +// --------------------------------------------------------------------------- +// +void CSearchEventImp::WriteArrayToStreamL( + RSearchInfoImpArray& aArray, RWriteStream& aStream ) const + { + TInt count = aArray.Count(); + aStream.WriteInt32L( count ); + { + for( TInt a = 0; a < count; ++a ) + { + aArray[ a ]->ExternalizeL( aStream ); + } + } + } + +// --------------------------------------------------------------------------- +// CSearchEventImp::FillArrayFromStreamL +// --------------------------------------------------------------------------- +// +void CSearchEventImp::FillArrayFromStreamL( + RSearchInfoImpArray& aArray, + RReadStream& aStream ) + { + TInt count = aStream.ReadInt32L(); + for( TInt a = 0; a < count; ++a ) + { + // the stream MUST be in order (since it was externalized by this class) + CSearchInfoImp* newInfo = CSearchInfoImp::NewLC(); + newInfo->InternalizeL( aStream ); + aArray.AppendL( newInfo ); // trap here if there is any error in the append + CleanupStack::Pop(); // newInfo + } + } + +// --------------------------------------------------------------------------- +// CSearchEventImp::InternalizeL( ) +// --------------------------------------------------------------------------- +// + +void CSearchEventImp::InternalizeL( RReadStream& aStream ) + { + iSearchId->InternalizeL( aStream ); + FillArrayFromStreamL( *iSearchResults, aStream ); + } diff -r 000000000000 -r e6b17d312c8b imservices/searchfeatureplugin/srcsearchdatamodel/search/searcheventimp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/searchfeatureplugin/srcsearchdatamodel/search/searcheventimp.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,156 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MSearchEvent API object implementation. + * +*/ + +#ifndef CSEARCHEVENTIMP_H +#define CSEARCHEVENTIMP_H + +#include +#include "ximpapieventbase.h" +#include +#include "searchapiobjbase.h" +#include "searchtypehelpers.h" + +class RReadStream; +class CXIMPIdentityImp; +class CSearchInfoImp; +class MXIMPIdentity; +/** + * MSearchEvent API object implementation. + * + * @lib searchdatamodel.dll + */ +NONSHARABLE_CLASS( CSearchEventImp ): public CXIMPApiEventBase,public MSearchEvent + { + public: + /** The class ID. */ + enum { KClassId = IMP_CLSID_CSEARCHEVENTIMP }; + + public: + /** + * Exported instantiation method for initializing + * new event object. + */ + IMPORT_C static CSearchEventImp* NewLC( CXIMPIdentityImp& aSearchId, + RSearchInfoImpArray* aSearchResults ); + + /** + * Instantiation method for event automation. + * Method signature must be exactly this to work + * with event delivery automation system. + * + * Event implementation must be registered to + * SearchEventCodec KApiEventConstructorTable. + */ + static CXIMPApiEventBase* NewFromStreamLC( RReadStream& aStream ); + + /** + * Destructor + */ + virtual ~CSearchEventImp(); + + private: + /** + * constructor + */ + CSearchEventImp(); + + /** + * 2nd phase constructor + */ + void ConstructL( CXIMPIdentityImp& aSearchId, + RSearchInfoImpArray* aSearchResults ); + + /** + * 2nd phase constructor + */ + void ConstructL( RReadStream& aStream ); + + + + /** + * Helper for internalize + */ + void InternalizeL( RReadStream& aStream ) ; + /** + * Helper for externalize + */ + void WriteArrayToStreamL(RSearchInfoImpArray& aArray, RWriteStream& aStream ) const; + + /** + * Helper for internalize + */ + void FillArrayFromStreamL( RSearchInfoImpArray& aArray, + RReadStream& aStream ); + + + public: // From API base interfaces + + /** + * Implementation of MXIMPBase interface methods + * @see MXIMPBase + */ + XIMPIMP_DECLARE_IF_BASE_METHODS + + /** + * Implementation of MSearchEventBase interface and + * CSearchApiEventBase methods + * + */ + XIMPIMP_DECLARE_EVENT_BASE_METHODS + + + public: // From MSearchEvent + /** + * + * @see MSearchEvent + */ + virtual TInt SearchResultCount() const ; + + + /** + * Gets the searched result by index. + * + * @param [in] aIndex + * The index of the search. + * + * @return The searched result from given index. + */ + virtual const MSearchInfo& SearchResult( TInt aIndex ) const ; + /** + * + * @see MSearchEvent + */ + virtual const MXIMPIdentity& SearchId() const; + + private: // data + + /** + * Search Info array + * Own. + */ + RSearchInfoImpArray* iSearchResults; + + /** + * CXIMPIdentityImp : owned + */ + CXIMPIdentityImp* iSearchId ; + + TBool iConstructedFromStream; + }; + + +#endif // CSEARCHEVENTIMP_H diff -r 000000000000 -r e6b17d312c8b imservices/searchfeatureplugin/srcsearchdatamodel/search/searchinfoimp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/searchfeatureplugin/srcsearchdatamodel/search/searchinfoimp.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,210 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MsearchInfo API object implementation. +* +*/ + +#include "searchinfoimp.h" +#include "ximpidentityimp.h" +#include "ximprbufhelpers.h" +#include "ximpobjecthelpers.h" + +// ============================ MEMBER FUNCTIONS ============================= + +// --------------------------------------------------------------------------- +// CSearchInfoImp::NewLC() +// --------------------------------------------------------------------------- +// +EXPORT_C CSearchInfoImp* CSearchInfoImp::NewLC() + { + CSearchInfoImp* self = new( ELeave ) CSearchInfoImp; + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + + +// --------------------------------------------------------------------------- +// CSearchInfoImp::NewL() +// --------------------------------------------------------------------------- +// +EXPORT_C CSearchInfoImp* CSearchInfoImp::NewL() + { + CSearchInfoImp* self = NewLC(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// CSearchInfoImp::NewFromStreamLC() +// --------------------------------------------------------------------------- +// +XIMPIMP_IMPLEMENT_DATAOBJ_NEWFROMSTREAM( CSearchInfoImp ) + +// --------------------------------------------------------------------------- +// Implement supported interface access. +// --------------------------------------------------------------------------- +// +XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CSearchInfoImp, MSearchInfo ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() +XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CSearchInfoImp, MSearchInfo ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + +// --------------------------------------------------------------------------- +// CSearchInfoImp::~CSearchInfoImp() +// --------------------------------------------------------------------------- +// +CSearchInfoImp::~CSearchInfoImp() + { + iFirstname.Close(); + iLastname.Close(); + iEmailId.Close(); + } + +// --------------------------------------------------------------------------- +// CSearchInfoImp::CSearchInfoImp() +// --------------------------------------------------------------------------- +// +CSearchInfoImp::CSearchInfoImp() + { + } + + +// --------------------------------------------------------------------------- +// CSearchInfoImp::ConstructL() +// --------------------------------------------------------------------------- +// +void CSearchInfoImp::ConstructL() + { + iFirstname.CreateL( 0 ); + iLastname.CreateL( 0 ); + iEmailId.CreateL( 0 ); + } + +// --------------------------------------------------------------------------- +// CSearchInfoImp::ExternalizeL() +// --------------------------------------------------------------------------- +// +void CSearchInfoImp::ExternalizeL( RWriteStream& aStream ) const + { + + XIMPRBuf16Helper::ExternalizeL( iFirstname, aStream ); + XIMPRBuf16Helper::ExternalizeL( iLastname, aStream ); + XIMPRBuf16Helper::ExternalizeL( iEmailId, aStream ); + } + +// --------------------------------------------------------------------------- +// CSearchInfoImp::InternalizeL() +// --------------------------------------------------------------------------- +// +EXPORT_C void CSearchInfoImp::InternalizeL( RReadStream& aStream ) + { + XIMPRBuf16Helper::InternalizeL( iFirstname, aStream ); + XIMPRBuf16Helper::InternalizeL( iLastname, aStream ); + XIMPRBuf16Helper::InternalizeL( iEmailId, aStream ); + + } + + + +// --------------------------------------------------------------------------- +// From MSearchInfo class. +// CSearchInfoImp::GetFieldInfo() +// --------------------------------------------------------------------------- +// +const TDesC16& CSearchInfoImp::GetFieldInfo(TInfoType aType) const + { + switch(aType) + { + case EFirstName: + { + return iFirstname; + } + case ELastName: + { + return iLastname; + } + case EEmailAddress: + { + return iEmailId; + } + default : + { + return KNullDesC(); + } + } + } + + + +// --------------------------------------------------------------------------- +// From MsearchInfo class. +// CSearchInfoImp::SetFieldInfoL() +// --------------------------------------------------------------------------- +// +void CSearchInfoImp::SetFieldInfoL(const TDesC16& aFieldInfo ,TInfoType aType) + + { + switch(aType) + { + case EFirstName: + { + HBufC16* buf = aFieldInfo.AllocL(); + iFirstname.Close(); + iFirstname.Assign( buf ); + break; + } + case ELastName: + { + HBufC16* buf= aFieldInfo.AllocL(); + iLastname.Close(); + iLastname.Assign( buf ); + break; + } + case EEmailAddress: + { + HBufC16* buf = aFieldInfo.AllocL(); + iEmailId.Close(); + iEmailId.Assign( buf ); + break; + } + + } + + } + + +// --------------------------------------------------------------------------- +// CSearchInfoImp::EqualsContent() +// --------------------------------------------------------------------------- +// +TBool CSearchInfoImp::EqualsContent( + const CXIMPApiDataObjBase& /*aOtherInstance*/ ) const + { + return ETrue; + } +// --------------------------------------------------------------------------- +// CSearchInfoImp:: InfoLinearOrder +// --------------------------------------------------------------------------- +// +EXPORT_C TInt CSearchInfoImp::InfoLinearOrder( + const CSearchInfoImp& /*aA*/, + const CSearchInfoImp& /*aB*/ ) + { + // Just returns 1 so that the results are appended as they come from server. + return 1; + } + + +// End of file diff -r 000000000000 -r e6b17d312c8b imservices/searchfeatureplugin/srcsearchdatamodel/search/searchinfoimp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/searchfeatureplugin/srcsearchdatamodel/search/searchinfoimp.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,120 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MsearchInfo API object implementation. +* +*/ + +#ifndef CSEARCHINFOIMP_H +#define CSEARCHINFOIMP_H + + +#include +#include +#include +#include "ximpapidataobjbase.h" +#include "searchapiobjbase.h" + + +class CSearchInfoImp; +class CXIMPIdentityImp; +/** + * MsearchInfo API object implementation. + * + * @lib searchdatamodel.dll + */ +NONSHARABLE_CLASS( CSearchInfoImp ): public CXIMPApiDataObjBase,public MSearchInfo + { + public: + /** The class ID. */ + enum { KClassId = IMP_CLSID_CSEARCHINFOIMP }; + + public: + /** + * Construction :NewLC + */ + IMPORT_C static CSearchInfoImp* NewLC(); + /** + * Construction :NewL + */ + IMPORT_C static CSearchInfoImp* NewL(); + + /** + * Destructor + */ + virtual ~CSearchInfoImp(); + + private: + /** + * constructor + */ + CSearchInfoImp(); + + /** + * 2nd phase constructor + */ + void ConstructL(); + + public: // From CXIMPApiDataObjBase + + /** + * @see CXIMPApiDataObjBase + */ + XIMPIMP_DECLARE_DATAOBJ_BASE_METHODS + XIMPIMP_DECLARE_IF_BASE_METHODS + + + public: // New functions + + /** + * Internalizes object data from given stream. + * @param aStream Stream to read. + */ + IMPORT_C void InternalizeL( RReadStream& aStream ); + + /** + * + * @see MSearchInfo + */ + const TDesC16& GetFieldInfo(TInfoType aType ) const; + + /** + * + * @see MSearchInfo + */ + void SetFieldInfoL(const TDesC16& aFieldInfo, TInfoType aType) ; + + /** + * returns the order of elements + * @ return '1' always here : + */ + IMPORT_C static TInt InfoLinearOrder(const CSearchInfoImp& aA, + const CSearchInfoImp& aB ) ; + + + private: // data + + + /** + * buffers : all owned + */ + RBuf16 iFirstname; // owned + + RBuf16 iLastname; // owned + + RBuf16 iEmailId; // owned + + }; + + +#endif // CSEARCHINFOIMP_H diff -r 000000000000 -r e6b17d312c8b imservices/searchfeatureplugin/srcsearchdatamodel/search/searchkeyinfoimp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/searchfeatureplugin/srcsearchdatamodel/search/searchkeyinfoimp.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,198 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Msearchkeyinfo API object implementation. +* +*/ + +#include "searchkeyinfoimp.h" +#include "ximprbufhelpers.h" +#include "ximpobjecthelpers.h" + +// ============================ MEMBER FUNCTIONS ============================= + +// --------------------------------------------------------------------------- +// CSupportedSearchKeyImp::NewLC() +// --------------------------------------------------------------------------- +// +EXPORT_C CSearchKeyInfoImp* CSearchKeyInfoImp::NewLC() + { + CSearchKeyInfoImp* self = new( ELeave ) CSearchKeyInfoImp; + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + + +// --------------------------------------------------------------------------- +// CSearchKeyInfoImp::NewL() +// --------------------------------------------------------------------------- +// +EXPORT_C CSearchKeyInfoImp* CSearchKeyInfoImp::NewL() + { + CSearchKeyInfoImp* self = NewLC(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// CSearchKeyInfoImp::NewFromStreamLC() +// --------------------------------------------------------------------------- +// +XIMPIMP_IMPLEMENT_DATAOBJ_NEWFROMSTREAM( CSearchKeyInfoImp ) + +// --------------------------------------------------------------------------- +// Implement supported interface access. +// --------------------------------------------------------------------------- +// +XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CSearchKeyInfoImp, MSearchKeyInfo ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() +XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CSearchKeyInfoImp, MSearchKeyInfo ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + +// --------------------------------------------------------------------------- +// CSearchKeyInfoImp::~CSearchKeyInfoImp() +// --------------------------------------------------------------------------- +// +CSearchKeyInfoImp::~CSearchKeyInfoImp() + { + iLabel.Close(); + } + +// --------------------------------------------------------------------------- +// CSearchKeyInfoImp::CSearchKeyInfoImp() +// --------------------------------------------------------------------------- +// +CSearchKeyInfoImp::CSearchKeyInfoImp() + { + } + + +// --------------------------------------------------------------------------- +// CSearchKeyInfoImp::ConstructL() +// --------------------------------------------------------------------------- +// +void CSearchKeyInfoImp::ConstructL() + { + iLabel.CreateL( 0 ); + } + +// --------------------------------------------------------------------------- +// CSearchKeyInfoImp::ExternalizeL() +// --------------------------------------------------------------------------- +// +void CSearchKeyInfoImp::ExternalizeL( RWriteStream& aStream ) const + { + aStream.WriteInt32L( iKeyType ); + aStream.WriteInt32L( iKey ); + XIMPRBuf16Helper::ExternalizeL( iLabel, aStream ); + } + +// --------------------------------------------------------------------------- +// CSearchKeyInfoImp::InternalizeL() +// --------------------------------------------------------------------------- +// +EXPORT_C void CSearchKeyInfoImp::InternalizeL( RReadStream& aStream ) + { + iKeyType = aStream.ReadInt32L(); + iKey = aStream.ReadInt32L(); + XIMPRBuf16Helper::InternalizeL( iLabel, aStream ); + } + + + +// --------------------------------------------------------------------------- +// +// CSearchKeyInfoImp::Key() +// --------------------------------------------------------------------------- +// +TSearchKey CSearchKeyInfoImp::Key() const + { + return (TSearchKey)iKey; + } + + + +// --------------------------------------------------------------------------- +// CSearchKeyInfoImp::SetKey +// --------------------------------------------------------------------------- +// +void CSearchKeyInfoImp::SetKey(TSearchKey aKey) + + { + iKey = aKey; + } +// --------------------------------------------------------------------------- +// +// CSearchKeyInfoImp::Key() +// --------------------------------------------------------------------------- +// +TKeyType CSearchKeyInfoImp::Type() const + { + return (TKeyType)iKeyType; + } + + + +// --------------------------------------------------------------------------- +// CSearchKeyInfoImp::SetKey +// --------------------------------------------------------------------------- +// +void CSearchKeyInfoImp::SetType(TKeyType aType) + + { + iKeyType = aType; + } + +// --------------------------------------------------------------------------- +// CSearchKeyInfoImp::Label() +// --------------------------------------------------------------------------- +// +const TDesC16& CSearchKeyInfoImp::Label() const + { + return iLabel; + } + +// ---------------------------------------------------------------------------. +// CSearchKeyInfoImp::SetLabelL() +// --------------------------------------------------------------------------- +// +void CSearchKeyInfoImp::SetLabelL(const TDesC16& aLabel) + + { + iLabel.Close(); + iLabel.Assign( aLabel.AllocL() ); + } +// --------------------------------------------------------------------------- +// CSearchKeyInfoImp::EqualsContent() +// --------------------------------------------------------------------------- +// +TBool CSearchKeyInfoImp::EqualsContent( + const CXIMPApiDataObjBase& /*aOtherInstance*/ ) const + { + return ETrue; + } +// --------------------------------------------------------------------------- +// CSearchKeyInfoImp::LinearOrder +// --------------------------------------------------------------------------- +// +EXPORT_C TInt CSearchKeyInfoImp::LinearOrder( + const CSearchKeyInfoImp& /*aA*/, + const CSearchKeyInfoImp& /*aB*/ ) + { + // Just returns 1 so that the Keys are appended as they come from server. + return 1; + } + + +// End of file diff -r 000000000000 -r e6b17d312c8b imservices/searchfeatureplugin/srcsearchdatamodel/search/searchkeyinfoimp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/searchfeatureplugin/srcsearchdatamodel/search/searchkeyinfoimp.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,125 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MSupportedSearchKey API object implementation. +* +*/ + +#ifndef CSEARCHKEYINFOIMP_H +#define CSEARCHKEYINFOIMP_H + + +#include +#include +#include +#include "ximpapidataobjbase.h" +#include "searchapiobjbase.h" + + +/** + * MSearchKeyInfo API object implementation. + * + * @lib searchdatamodel.dll + */ +NONSHARABLE_CLASS( CSearchKeyInfoImp ): public CXIMPApiDataObjBase, public MSearchKeyInfo + { + public: + /** The class ID. */ + enum { KClassId = IMP_CLSID_CSEARCHKEY_INFO_IMP }; + + public: + /** + * Construction :NewLC + */ + IMPORT_C static CSearchKeyInfoImp* NewLC(); + /** + * Construction :NewL + */ + IMPORT_C static CSearchKeyInfoImp* NewL(); + + /** + * Destructor + */ + virtual ~CSearchKeyInfoImp(); + + private: + /** + * constructor + */ + CSearchKeyInfoImp(); + + /** + * 2nd phase constructor + */ + void ConstructL(); + + public: // From CXIMPApiDataObjBase + + /** + * @see CXIMPApiDataObjBase + */ + XIMPIMP_DECLARE_DATAOBJ_BASE_METHODS + XIMPIMP_DECLARE_IF_BASE_METHODS + + + public: // from MSearchKeyInfo + + /** + * Internalizes object data from given stream. + * @param aStream Stream to read. + */ + IMPORT_C void InternalizeL( RReadStream& aStream ); + + /** + * + * @see MSearchKeyInfo + */ + TSearchKey Key() const ; + void SetKey( TSearchKey aKey) ; + + /** + * + * @see MSearchKeyInfo + */ + TKeyType Type()const ; + void SetType(TKeyType aType); + + /** + * + * @see MSearchKeyInfo + */ + const TDesC16& Label() const; + void SetLabelL(const TDesC16& aLabel); + + /** + * returns the order of elements + * @ return '1' always here : + */ + IMPORT_C static TInt LinearOrder( const CSearchKeyInfoImp& aA, + const CSearchKeyInfoImp& aB ) ; + + + private: // data + + // key + TInt iKey; + + //key type + TInt iKeyType; + + //Lablel : owned + RBuf16 iLabel; + }; + + +#endif // CSEARCHKEYINFOIMP_H diff -r 000000000000 -r e6b17d312c8b imservices/searchfeatureplugin/srcsearchdatamodel/search/searchkeyseventimp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/searchfeatureplugin/srcsearchdatamodel/search/searchkeyseventimp.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,197 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MSearchEvent API object implementation. + * +*/ + +#include "searchkeyseventimp.h" +#include "ximpapiobjbase.h" +#include "ximpapieventbase.h" + +#include +#include "ximpobjecthelpers.h" +#include "searchkeyinfoimp.h" + +// --------------------------------------------------------------------------- +// CSearchKeysEventImp::NewLC() +// --------------------------------------------------------------------------- +// +EXPORT_C CSearchKeysEventImp* CSearchKeysEventImp::NewLC( RSearchKeyInfoImpArray* aKeyInfoArray ) + { + CSearchKeysEventImp* self = new( ELeave ) CSearchKeysEventImp(); + CleanupStack::PushL( self ); + self->ConstructL( aKeyInfoArray ); + return self; + } + +// --------------------------------------------------------------------------- +// CSearchKeysEventImp::NewFromStreamLC() +// --------------------------------------------------------------------------- +// +CXIMPApiEventBase* CSearchKeysEventImp::NewFromStreamLC( RReadStream& aStream ) + { + CSearchKeysEventImp* self = new( ELeave ) CSearchKeysEventImp; + CleanupStack::PushL( self ); + self->ConstructL( aStream ); + return self; + } +// --------------------------------------------------------------------------- +// CSearchKeysEventImp::EqualsContent +// --------------------------------------------------------------------------- +// +TBool CSearchKeysEventImp::EqualsContent( + const CXIMPApiEventBase& /*aOtherInstance*/ ) const + { + return ETrue; + } + +// --------------------------------------------------------------------------- +// From class CXIMPApiEventBase +// CSearchKeysEventImp::ExternalizeL +// --------------------------------------------------------------------------- +// +void CSearchKeysEventImp::ExternalizeL( RWriteStream& aStream ) const + { + WriteArrayToStreamL( *iInfoArray, aStream ); + } + + +// --------------------------------------------------------------------------- +// CSearchKeysEventImp::~CSearchKeysEventImp() +// --------------------------------------------------------------------------- +// +CSearchKeysEventImp::~CSearchKeysEventImp() + { + delete iInfoArray; + iInfoArray = NULL; + } + + +// --------------------------------------------------------------------------- +// CSearchKeysEventImp::CSearchKeysEventImp() +// --------------------------------------------------------------------------- +// +CSearchKeysEventImp::CSearchKeysEventImp() + { + } + + +// --------------------------------------------------------------------------- +// CSearchKeysEventImp::ConstructL() +// --------------------------------------------------------------------------- +// +void CSearchKeysEventImp::ConstructL( RSearchKeyInfoImpArray* aKeyInfoArray ) + { + iInfoArray = aKeyInfoArray ; // ownership is transfered here, need to delete + } + + +// --------------------------------------------------------------------------- +// CSearchKeysEventImp::ConstructL() +// --------------------------------------------------------------------------- +// +void CSearchKeysEventImp::ConstructL( RReadStream& aStream ) + { + iInfoArray = new ( ELeave) RSearchKeyInfoImpArray; + InternalizeL( aStream ); + } + +// --------------------------------------------------------------------------- +// Implement supported interface access. +// --------------------------------------------------------------------------- +// +XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CSearchKeysEventImp, + MSearchKeysEvent ) + +XIMPIMP_IF_BASE_GET_CLASS( CXIMPApiEventBase, this ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + +XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CSearchKeysEventImp, + MSearchKeysEvent ) + XIMPIMP_IF_BASE_GET_CONST_CLASS( CXIMPApiEventBase, this ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + + + +// --------------------------------------------------------------------------- +// Implement methods from base event interface and base event class +// --------------------------------------------------------------------------- +// +XIMPIMP_IMPLEMENT_EVENT_BASE_METHODS( CSearchKeysEventImp, + MSearchKeysEvent ) + + + +// --------------------------------------------------------------------------- +// CSearchKeysEventImp::SupportedKeysCount() +// --------------------------------------------------------------------------- +// + TInt CSearchKeysEventImp::InfoCount() const + { + return iInfoArray->Count(); + } +// --------------------------------------------------------------------------- +// CSearchKeysEventImp::SupportedKey() +// --------------------------------------------------------------------------- +// + const MSearchKeyInfo& CSearchKeysEventImp::SearchKeyInfo( TInt aIndex ) const + { + return *(*iInfoArray)[ aIndex ]; + + } + + +// --------------------------------------------------------------------------- +// CSearchEventImp::FillArrayFromStreamL +// --------------------------------------------------------------------------- +// +void CSearchKeysEventImp::FillArrayFromStreamL( RSearchKeyInfoImpArray& aKeyInfoArray, + RReadStream& aStream ) + { + TInt count = aStream.ReadInt32L(); + for( TInt a = 0; a < count; ++a ) + { + // the stream MUST be in order (since it was externalized by this class) + CSearchKeyInfoImp* newInfo = CSearchKeyInfoImp::NewLC(); + newInfo->InternalizeL( aStream ); + aKeyInfoArray.AppendL( newInfo ); // trap here if there is any error in the append + CleanupStack::Pop(); // newInfo + } + } +// --------------------------------------------------------------------------- +// CSearchEventImp::WriteArrayToStreamL() +// --------------------------------------------------------------------------- +// +void CSearchKeysEventImp::WriteArrayToStreamL( RSearchKeyInfoImpArray& aKeyInfoArray, + RWriteStream& aStream ) const + { + TInt count = aKeyInfoArray.Count(); + aStream.WriteInt32L( count ); + + for( TInt a = 0; a < count; ++a ) + { + aKeyInfoArray[ a ]->ExternalizeL( aStream ); + } + } + + +// --------------------------------------------------------------------------- +// CSearchKeysEventImp::InternalizeL( ) +// --------------------------------------------------------------------------- +// + +void CSearchKeysEventImp::InternalizeL( RReadStream& aStream ) + { + FillArrayFromStreamL( *iInfoArray, aStream ); + } diff -r 000000000000 -r e6b17d312c8b imservices/searchfeatureplugin/srcsearchdatamodel/search/searchkeyseventimp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/searchfeatureplugin/srcsearchdatamodel/search/searchkeyseventimp.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,144 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MSearchKeysEvent object implementation. + * +*/ + +#ifndef CSEARCHKEYSEVENTIMP_H +#define CSEARCHKEYSEVENTIMP_H + +#include +#include "ximpapieventbase.h" +#include +#include "searchapiobjbase.h" +#include "searchtypehelpers.h" + +class RReadStream; + +class CSearchKeyInfoImp; + +/** + * MSearchKeysEvent API object implementation. + * + * @lib searchdatamodel.dll + */ +NONSHARABLE_CLASS( CSearchKeysEventImp ): public CXIMPApiEventBase, + public MSearchKeysEvent + { + public: + /** The class ID. */ + enum { KClassId = IMP_CLSID_CSEARCHKEYSEVENTIMP }; + + public: + /** + * Exported instantiation method for initializing + * new event object. + */ + IMPORT_C static CSearchKeysEventImp* NewLC( RSearchKeyInfoImpArray* aKeyInfoArray ); + + + /** + * Instantiation method for event automation. + * Method signature must be exactly this to work + * with event delivery automation system. + * + * Event implementation must be registered to + * SearchEventCodec KApiEventConstructorTable. + */ + static CXIMPApiEventBase* NewFromStreamLC( RReadStream& aStream ); + + /** + * Destructor + */ + virtual ~CSearchKeysEventImp(); + + public: // From MSearchKeysEvent + /** + * + * @see MSearchKeysEvent + */ + TInt InfoCount() const; + /** + * + * @see MSearchKeysEvent + */ + const MSearchKeyInfo& SearchKeyInfo( TInt aIndex ) const; + + + private: + /** + * constructor + */ + CSearchKeysEventImp(); + + /** + * 2nd phase constructor + */ + void ConstructL( RSearchKeyInfoImpArray* aKeyInfoArray ); + + /** + * 2nd phase constructor + */ + void ConstructL( RReadStream& aStream ); + + + /** + * internalize method + */ + void InternalizeL( RReadStream& aStream ) ; + + /** + * Helper for externalize + */ + void WriteArrayToStreamL( RSearchKeyInfoImpArray& aKeyInfoArray, + RWriteStream& aStream ) const; + + /** + * Helper for internalize + */ + void FillArrayFromStreamL( RSearchKeyInfoImpArray& aKeyInfoArray, + RReadStream& aStream ); + + + + + public: // From API base interfaces + + /** + * Implementation of MXIMPBase interface methods + * @see MXIMPBase + */ + XIMPIMP_DECLARE_IF_BASE_METHODS + + /** + * Implementation of MSearchEventBase interface and + * CSearchApiEventBase methods + * + */ + XIMPIMP_DECLARE_EVENT_BASE_METHODS + + + + private: // data + + /** + * RSupportedSearchKeyImpArray : owned + */ + RSearchKeyInfoImpArray* iInfoArray; + + + }; + + +#endif // CSEARCHKEYSEVENTIMP_H diff -r 000000000000 -r e6b17d312c8b imservices/searchfeatureplugin/srcsearchdatamodel/search/searchkeyssubscriptionitem.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/searchfeatureplugin/srcsearchdatamodel/search/searchkeyssubscriptionitem.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,101 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Search Keys subscription. +* +*/ + +#ifndef CSEARCHKEYSSUBSCRIPTIONITEM_H +#define CSEARCHKEYSSUBSCRIPTIONITEM_H + +#include +#include "ximpsubscriptionitembase.h" +#include "searchtypehelpers.h" + + +class MXIMPItemParentBase; +class MXIMPPscContext; +class CXIMPPscContext; + + +/** + * search subscription implementation + * + * @lib searchdatamodel.dll + */ +class CSearchKeysSubscriptionItem : public CXIMPSubscriptionItemBase + { + + public: // Construction and destruction + + /** + * Construction + * @param aParent. Parent has to be informed when this object is deleted by RemoveMe method. + */ + static CSearchKeysSubscriptionItem* NewLC( MXIMPItemParentBase& aParent ); + + /** + * Destruction + * - Remember to inform parent about delete. + */ + IMPORT_C virtual ~CSearchKeysSubscriptionItem(); + + private: // Construction and destruction + + /** + * Construction + * @param aParent. Parent has to be informed when this object is deleted by RemoveMe method. + */ + CSearchKeysSubscriptionItem( MXIMPItemParentBase& aParent ); + + /** + * Construction + */ + void ConstructL(); + + public : + /** + * Set the search key info array + * takes ownership and will be transfered to search keys event + */ + IMPORT_C void SetKeyInfoArray( RSearchKeyInfoImpArray* aKeyInfoArray); + + + public: // From MXIMPSubscriptionItem + + /** + * @see MXIMPSubscriptionItem + */ + void SynthesiseSubscriptionEventToL( MXIMPPscContext* aContext, TBool aForceEvent ); + private: // From CXIMPIMSubscriptionItemBase + + /** + * @see CXIMPIMSubscriptionItemBase + */ + void CleanExpired(); + + private : // data + + /** + * RSearchKeyInfoImpArray : Not owned + */ + RSearchKeyInfoImpArray* iKeyInfoArray; + + }; + + +/* ======================================================================== */ + + + +#endif // CSEARCHKEYSSUBSCRIPTIONITEM_H diff -r 000000000000 -r e6b17d312c8b imservices/searchfeatureplugin/srcsearchdatamodel/search/searchkeysubscriptionitem.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/searchfeatureplugin/srcsearchdatamodel/search/searchkeysubscriptionitem.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,115 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Search Keys subscription implementation. +* +*/ + + +#include +#include "ximpitemparentbase.h" +#include "ximppanics.h" +#include "ximppsccontext.h" +#include "ximpobjecthelpers.h" + +#include "ximpidentityimp.h" +#include "searchkeyssubscriptionitem.h" + +#include "searchitemparent.h" +#include "searchkeyseventimp.h" +// --------------------------------------------------------------------------- +// CSearchKeysSubscriptionItem::CSearchKeysSubscriptionItem() +// --------------------------------------------------------------------------- +// +CSearchKeysSubscriptionItem::CSearchKeysSubscriptionItem( MXIMPItemParentBase& aParent ) +: CXIMPSubscriptionItemBase( aParent ) + { + } + + +// --------------------------------------------------------------------------- +// CSearchKeysSubscriptionItem::ConstructL() +// --------------------------------------------------------------------------- +// +void CSearchKeysSubscriptionItem::ConstructL() + { + } + + +// --------------------------------------------------------------------------- +// CSearchKeysSubscriptionItem::NewL() +// --------------------------------------------------------------------------- +// +CSearchKeysSubscriptionItem* CSearchKeysSubscriptionItem::NewLC( MXIMPItemParentBase& aParent ) + { + CSearchKeysSubscriptionItem* self = new( ELeave ) CSearchKeysSubscriptionItem( aParent ); + CleanupClosePushL( *self ); + self->ConstructL(); + return self; + } + + +// --------------------------------------------------------------------------- +// CSearchKeysSubscriptionItem::~CSearchKeysSubscriptionItem() +// --------------------------------------------------------------------------- +// +EXPORT_C CSearchKeysSubscriptionItem::~CSearchKeysSubscriptionItem() + { + + MSearchItemParent* searchCache = static_cast + (iParent.GetInterface(SEARCH_ITEM_PARENT)); + searchCache->RemoveMe( this ); + + } + +// --------------------------------------------------------------------------- +// CSearchSubscriptionItem::SetKeyInfoArray() +// --------------------------------------------------------------------------- +// +EXPORT_C void CSearchKeysSubscriptionItem::SetKeyInfoArray(RSearchKeyInfoImpArray* aKeyInfoArray) + { + iKeyInfoArray = aKeyInfoArray; + } + +// --------------------------------------------------------------------------- +// From MXIMPSubscriptionItem class. +// CSearchKeysSubscriptionItem::SynthesiseSubscriptionEventToL() +// --------------------------------------------------------------------------- +// +void CSearchKeysSubscriptionItem::SynthesiseSubscriptionEventToL( + MXIMPPscContext* aContext, TBool /*aForceEvent*/ ) + { + + CSearchKeysEventImp* newEvent = CSearchKeysEventImp::NewLC( iKeyInfoArray ); + if( newEvent ) + { + MSearchItemParent* searchCache = static_cast(iParent.GetInterface(SEARCH_ITEM_PARENT)); + searchCache->AddEventL( *newEvent, aContext ); + CleanupStack::PopAndDestroy( newEvent ); //newEvent + } + + } + + + +// --------- ------------------------------------------------------------------ +// CGroupListSubscriptionItem::CleanExpired() +// --------------------------------------------------------------------------- +// +void CSearchKeysSubscriptionItem::CleanExpired() + { + + } + + +// End of file diff -r 000000000000 -r e6b17d312c8b imservices/searchfeatureplugin/srcsearchdatamodel/search/searchsubscriptionitem.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/searchfeatureplugin/srcsearchdatamodel/search/searchsubscriptionitem.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,122 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Search subscription implementation. +* +*/ + + +#include +#include "ximpitemparentbase.h" +#include "ximppanics.h" +#include "ximppsccontext.h" +#include "ximpobjecthelpers.h" +#include "searchtypehelpers.h" +#include "searcheventimp.h" +#include "ximpidentityimp.h" +#include "searchsubscriptionitem.h" + +#include "searchitemparent.h" + +// --------------------------------------------------------------------------- +// CSearchSubscriptionItem::CSearchSubscriptionItem() +// --------------------------------------------------------------------------- +// +CSearchSubscriptionItem::CSearchSubscriptionItem( MXIMPItemParentBase& aParent ) +: CXIMPSubscriptionItemBase( aParent ) + { + } + + +// --------------------------------------------------------------------------- +// CSearchSubscriptionItem::ConstructL() +// --------------------------------------------------------------------------- +// +void CSearchSubscriptionItem::ConstructL() + { + } + + +// --------------------------------------------------------------------------- +// CSearchSubscriptionItem::NewL() +// --------------------------------------------------------------------------- +// +CSearchSubscriptionItem* CSearchSubscriptionItem::NewLC( MXIMPItemParentBase& aParent ) + { + CSearchSubscriptionItem* self = new( ELeave ) CSearchSubscriptionItem( aParent ); + CleanupClosePushL( *self ); + self->ConstructL(); + return self; + } + + +// --------------------------------------------------------------------------- +// CSearchSubscriptionItem::~CSearchSubscriptionItem() +// --------------------------------------------------------------------------- +// +EXPORT_C CSearchSubscriptionItem::~CSearchSubscriptionItem() + { + + MSearchItemParent* searchCache = static_cast + (iParent.GetInterface(SEARCH_ITEM_PARENT)); + searchCache->RemoveMe( this ); + + } + +// --------------------------------------------------------------------------- +// From MXIMPSubscriptionItem class. +// CSearchSubscriptionItem::SynthesiseSubscriptionEventTo() +// --------------------------------------------------------------------------- +// +void CSearchSubscriptionItem::SynthesiseSubscriptionEventToL( + MXIMPPscContext* aContext, TBool /*aForceEvent*/ ) + { + + CSearchEventImp* newEvent = CSearchEventImp::NewLC(*iSearchId, iSearchResults); + if( newEvent ) + { + MSearchItemParent* searchCache = static_cast(iParent.GetInterface(SEARCH_ITEM_PARENT)); + searchCache->AddEventL( *newEvent, aContext ); + CleanupStack::PopAndDestroy( newEvent ); //newEvent*/ + } + + } + + +// --------------------------------------------------------------------------- +// CSearchSubscriptionItem::SetNewListL() +// --------------------------------------------------------------------------- +// +EXPORT_C void CSearchSubscriptionItem::SetSearchResults(RSearchInfoImpArray* aSearchResults) + { + iSearchResults =aSearchResults; + } +// --------------------------------------------------------------------------- +// CSearchSubscriptionItem::SetNewListL() +// --------------------------------------------------------------------------- +// +EXPORT_C void CSearchSubscriptionItem::SetSearchIdL(CXIMPIdentityImp& aSearchId) + { + iSearchId = &aSearchId; + } +// --------- ------------------------------------------------------------------ +// CGroupListSubscriptionItem::CleanExpired() +// --------------------------------------------------------------------------- +// +void CSearchSubscriptionItem::CleanExpired() + { + + } + + +// End of file diff -r 000000000000 -r e6b17d312c8b imservices/searchfeatureplugin/srcsearchdatamodel/search/searchsubscriptionitem.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/searchfeatureplugin/srcsearchdatamodel/search/searchsubscriptionitem.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,110 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Search subscription implementation. +* +*/ + +#ifndef CSEARCHSUBSCRIPTIONITEM_H +#define CSEARCHSUBSCRIPTIONITEM_H + +#include +#include "ximpsubscriptionitembase.h" +#include "searchtypehelpers.h" + + +class MXIMPItemParentBase; +class MXIMPPscContext; +class CXIMPPscContext; + +class CSearchInfoImp; +class MSearchInfo; +/** + * search subscription implementation + * + * @lib searchdatamodel.dll + */ +class CSearchSubscriptionItem : public CXIMPSubscriptionItemBase + { + + public: // Construction and destruction + + /** + * Construction + * @param aParent. Parent has to be informed when this object is deleted by RemoveMe method. + */ + static CSearchSubscriptionItem* NewLC( MXIMPItemParentBase& aParent ); + + /** + * Destruction + * - Remember to inform parent about delete. + */ + IMPORT_C virtual ~CSearchSubscriptionItem(); + + private: // Construction and destruction + + /** + * Construction + * @param aParent. Parent has to be informed when this object is deleted by RemoveMe method. + */ + CSearchSubscriptionItem( MXIMPItemParentBase& aParent ); + + /** + * Construction + */ + void ConstructL(); + + public: // New methods + + /** + * Set the search results takes ownership and given to search event + */ + IMPORT_C void SetSearchResults(RSearchInfoImpArray* aSearchResults); + /** + * Set the search id takes ownership and given to search event + */ + IMPORT_C void SetSearchIdL( CXIMPIdentityImp& aSearchId ); + + public: // From MXIMPSubscriptionItem + + /** + * @see MXIMPSubscriptionItem + */ + void SynthesiseSubscriptionEventToL( MXIMPPscContext* aContext, TBool aForceEvent ); + private: // From CXIMPIMSubscriptionItemBase + + /** + * @see CXIMPIMSubscriptionItemBase + */ + void CleanExpired(); + + private : + /** + * Search info array :Not owned + */ + + RSearchInfoImpArray* iSearchResults; + + /** + * identity :Not owned + */ + CXIMPIdentityImp* iSearchId ; + + }; + + +/* ======================================================================== */ + + + +#endif // CPSCSearchSUBSCRIPTIONITEM_H diff -r 000000000000 -r e6b17d312c8b imservices/searchfeatureplugin/srcsearchdatamodel/searchapidataobjfactory.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/searchfeatureplugin/srcsearchdatamodel/searchapidataobjfactory.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,153 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Base class for API implementations. +* +*/ + +#include "searchapidataobjfactory.h" +#include "ximpapidataobjbase.h" + +#include + + +// ============================ MEMBER FUNCTIONS ============================= + + +// --------------------------------------------------------------------------- +// CImEventCodec::NewL() +// --------------------------------------------------------------------------- +// +CSearchApiDataObjFactory* CSearchApiDataObjFactory::NewL() + { + CSearchApiDataObjFactory* self = new( ELeave ) CSearchApiDataObjFactory() ; + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + + +// --------------------------------------------------------------------------- +// CImEventCodec::ConstructL() +// --------------------------------------------------------------------------- +// +void CSearchApiDataObjFactory::ConstructL() + { + } + + +/** + * Method to instantiate new data object object + * of requested type and construct it from the stream. + * + * @param aDataObjInterfaceId + * @return Data object constructor function. + */ +CXIMPApiDataObjBase* CSearchApiDataObjFactory::NewFromStreamLC( + TInt32 aDataObjInterfaceId, + RReadStream& aStream ) + { + return NewDataObjectFromStreamLC( aDataObjInterfaceId, aStream ); + } + +// --------------------------------------------------------------------------- +// CSearchApiDataObjFactory::CSearchApiDataObjFactory() +// --------------------------------------------------------------------------- +// +CSearchApiDataObjFactory::CSearchApiDataObjFactory() + { + } + +// --------------------------------------------------------------------------- +// CSearchApiDataObjFactory::~CSearchApiDataObjFactory() +// --------------------------------------------------------------------------- +// +CSearchApiDataObjFactory::~CSearchApiDataObjFactory() + { + } + + +// --------------------------------------------------------------------------- +// ImApiDataObjFactory::InternalizeL +// --------------------------------------------------------------------------- +// +void CSearchApiDataObjFactory::InternalizeL( + RReadStream& aStream, + RSearchReqParamArray& aArray ) + { + TInt32 arrLen = aStream.ReadInt32L(); + + for ( TInt i = 0; i < arrLen; i++ ) + { + SSearchReqParam param; + param.iParamType = aStream.ReadInt32L(); + CXIMPApiDataObjBase* dataObject = NewDataObjectFromStreamLC( param.iParamType, aStream ); + param.iParam = dataObject; + aArray.AppendL( param ); + CleanupStack::Pop( dataObject ); + } + } + +// --------------------------------------------------------------------------- +// ImApiDataObjFactory::ExternalizeL +// --------------------------------------------------------------------------- +// +void CSearchApiDataObjFactory::ExternalizeL( + RWriteStream& aWs, + const RSearchReqParamArray& aArray ) + { + // write array length + aWs.WriteInt32L( aArray.Count() ); + + for ( TInt i = 0; i < aArray.Count(); i++ ) + { + // trust the type within the param struct + aWs.WriteInt32L( aArray[ i ].iParamType ); + + // write the actual object + CXIMPApiDataObjBase* theBase = aArray[ i ].iParam; + theBase->ExternalizeL( aWs ); + } + + aWs.CommitL(); + } + +// --------------------------------------------------------------------------- +// ImApiDataObjFactory::InternalizeLC +// --------------------------------------------------------------------------- +// +CXIMPApiDataObjBase* CSearchApiDataObjFactory::InternalizeLC( + RReadStream& aStream ) + { + TInt32 objType = aStream.ReadInt32L(); + CXIMPApiDataObjBase* dataObject = NewDataObjectFromStreamLC( objType, aStream ); + return dataObject; + } + +// --------------------------------------------------------------------------- +// ImApiDataObjFactory::ExternalizeL +// --------------------------------------------------------------------------- +// +void CSearchApiDataObjFactory::ExternalizeL( + RWriteStream& aWs, + const CXIMPApiDataObjBase& aDataObj ) + { + aWs.WriteInt32L( aDataObj.Base().GetInterfaceId() ); + aDataObj.ExternalizeL( aWs ); + aWs.CommitL(); + } + + +// End of file + diff -r 000000000000 -r e6b17d312c8b imservices/searchfeatureplugin/srcsearchdatamodel/searchapidataobjfactory.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/searchfeatureplugin/srcsearchdatamodel/searchapidataobjfactory.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,132 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MApiDataObjFactory implementation. +* +*/ + +#ifndef SEARCHAPIDATAOBJFACTORY_H +#define SEARCHAPIDATAOBJFACTORY_H + +#include +#include "ximpapidataobjbase.h" +#include "searchtypehelpers.h" +// internal interface for the factory +#include "apidataobjfactory.h" + +class RReadStream; +class RWriteStream; + + +/** + * Codec to pack and unpack data object arrays. + * + * @lib ximpdatamodel.dll + * @since S60 v3.2 + */ +NONSHARABLE_CLASS( CSearchApiDataObjFactory ) : public CBase, + public MApiDataObjFactory + { +public: + + static CSearchApiDataObjFactory* NewL(); + + // From base class see @ MApiDataObjFactory + CXIMPApiDataObjBase* NewFromStreamLC( TInt32 aDataObjInterfaceId, + RReadStream& aStream ); + /** + * Unpacks a request parameter array from a + * descriptor back to array format. + * @param aDataObjArrayData The packed array + * @param aArray The array which to fill + */ + static void InternalizeL( + RReadStream& aStream, + RSearchReqParamArray& aArray + ); + + /** + * Packs a given request parameter array into + * a stream. + * @param aWs The stream to pack into + * @param aArray The array to pack + */ + static void ExternalizeL( + RWriteStream& aWs, + const RSearchReqParamArray& aArray + ); + + /** + * Internalize a CXIMPApiDataObjBase-derived object + * from the given stream, ownership is returned to the caller. + * @param aStream The stream + * @return The object instance + */ + static CXIMPApiDataObjBase* InternalizeLC( + RReadStream& aStream ); + + /** + * Externalize a CXIMPApiDataObjBase-derived object + * to the given stream. + * @param aWs The write stream + * @param aDataObj The data object + */ + static void ExternalizeL( + RWriteStream& aWs, + const CXIMPApiDataObjBase& aDataObj ); + + + /* + * Packs a given array into a stream. + * @param aStream The stream + * @param aArray The array + */ + template< class INFOIMP> + static inline void InternalizeL( + RReadStream& aStream, + RPointerArray& aArray + ); + + /** + * Unpacks an array of info fields back to array format. + * @param aWs The stream + * @param aArray The array which to fill + */ + template< class INFOIMP > + static inline void ExternalizeL( + RWriteStream& aWs, + const RPointerArray& aArray + ); + + /** + * Destructor + */ + ~CSearchApiDataObjFactory(); + +private: + /** + * Constructor + */ + CSearchApiDataObjFactory(); + + /** + * ConstructL + */ + void ConstructL(); + + }; + +// template methods need inline implementation +#include "searchapidataobjfactory.inl" + +#endif // SEARCHAPIDATAOBJFACTORY diff -r 000000000000 -r e6b17d312c8b imservices/searchfeatureplugin/srcsearchdatamodel/searchapidataobjfactory.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/searchfeatureplugin/srcsearchdatamodel/searchapidataobjfactory.inl Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,188 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Inline methods for codec to pack and unpack data objects. +* +*/ + + +#include +#include + +#include "searchtypehelpers.h" +#include "searchobjectfactory.h" + + +#include "searchinfoimp.h" + +//DATA TYPES + + +// ============================ MEMBER FUNCTIONS ============================= + +/** + * Type definition for exact API data object constructor signature. + */ +typedef CXIMPApiDataObjBase* (*TApiDataObjConstructor)( RReadStream& ); + + + +/** + * Structure for mapping data object interface IDs to + * to corect API data object constructors. + */ +struct SApiDataObjConstructorMap + { + //Interface id + TInt32 iInterfaceId; + + //Function pointer to data object interface implementation + TApiDataObjConstructor iConstructorPtr; + } ; + + + +/** + * Helper macro to initialise KApiDataObjConstructorTable members. + * + * Macro forces that each data object implementation class to have static + * NewFromStreamLC() member function to instantiate the object. + * + * See TApiDataObjConstructor type definition for exact constructor + * signature. + */ +#define CONSTRUCTOR_ENTRY( TheImplementedIf, TheClass ) \ + { TheImplementedIf::KInterfaceId, TheClass::NewFromStreamLC } \ + +/** + * Constructor function mapping for data object interface implementations. + * + * When new data object types are implemented, add them here. + */ + +const SApiDataObjConstructorMap KApiDataObjConstructorTable[] = + { + CONSTRUCTOR_ENTRY( MSearchInfo, CSearchInfoImp ), + }; + + +/** + * Count of constructor mappings. + */ +const TInt KApiDataObjConstructorCount = sizeof( KApiDataObjConstructorTable ) + / sizeof( SApiDataObjConstructorMap ); + + + +// ============================ HELPER FUNCTIONS ============================= + + +namespace { + + /** + * Helper function to locate constructor function for + * data object interface ID. + * + * @param aDataObjInterfaceId The data object interface ID. + * @return Data object constructor function. + */ + TApiDataObjConstructor ConstructorForInterface( TInt32 aDataObjInterfaceId ) + { + //Locate correct constructor + for( TInt ix = 0; ix < KApiDataObjConstructorCount; ix++ ) + { + const SApiDataObjConstructorMap map = KApiDataObjConstructorTable[ ix ]; + if( map.iInterfaceId == aDataObjInterfaceId ) + { + return map.iConstructorPtr; + } + } + + + //If assertion below fails, check that data object implementation + //class implementing requested data object interface (aDataObjInterfaceId) + //is registered to KApiDataObjConstructorTable + __ASSERT_DEBUG( EFalse, + User::Panic( _L("ImObjectFactory"), KErrUnknown ) ); + + return NULL; + } + + /** + * Helper function to instantiate new data object object + * of requested type and construct it from the stream. + * + * @param aDataObjInterfaceId + * @return Data object constructor function. + */ + CXIMPApiDataObjBase* NewDataObjectFromStreamLC( TInt32 aDataObjInterfaceId, + RReadStream& aStream ) + { + TApiDataObjConstructor newFromStreamLC = NULL; + + //Locate correct constructor for interface ID + newFromStreamLC = ConstructorForInterface( aDataObjInterfaceId ); + + //Instantiate the object + CXIMPApiDataObjBase* dataObject = newFromStreamLC( aStream ); + + return dataObject; + } + +} // namespace + +// --------------------------------------------------------------------------- +// SearchApiDataObjFactory::InternalizeL +// --------------------------------------------------------------------------- +// +template< class INFOIMP > +inline void CSearchApiDataObjFactory::InternalizeL( + RReadStream& aStream, + RPointerArray& aArray ) + { + TInt32 arrLen = aStream.ReadInt32L(); + + for ( TInt i = 0; i < arrLen; i++ ) + { + TInt paramType = aStream.ReadInt32L(); + INFOIMP* infoObj = ( INFOIMP* ) NewDataObjectFromStreamLC( paramType, aStream ); + aArray.AppendL( infoObj ); + CleanupStack::Pop( infoObj ); + } + } + +// --------------------------------------------------------------------------- +// SearchApiDataObjFactory::ExternalizeL +// --------------------------------------------------------------------------- +// +template +inline void CSearchApiDataObjFactory::ExternalizeL( + RWriteStream& aWs, + const RPointerArray& aArray ) + { + aWs.WriteInt32L( aArray.Count() ); // array length + + for ( TInt i = 0; i < aArray.Count(); i++ ) + { + INFOIMP* infoField = aArray[ i ]; + + // write the type + aWs.WriteInt32L( infoField->Base().GetInterfaceId() ); + + // write the actual object + infoField->ExternalizeL( aWs ); + } + + aWs.CommitL(); + } + diff -r 000000000000 -r e6b17d312c8b imservices/searchfeatureplugin/srcsearchdatamodel/searchapidataobjfactoryaccessor.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/searchfeatureplugin/srcsearchdatamodel/searchapidataobjfactoryaccessor.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,98 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Base class for API implementations. +* +*/ + +#include "searchapidataobjfactoryaccessor.h" +#include "searcheventcodec.h" +#include "searchapidataobjfactory.h" + +//DATA TYPES + + +// ============================ MEMBER FUNCTIONS ============================= + +// --------------------------------------------------------------------------- +// CSearchApiDataObjFactoryAccessor::NewL() +// --------------------------------------------------------------------------- +// +EXPORT_C CSearchApiDataObjFactoryAccessor* CSearchApiDataObjFactoryAccessor::NewL() + { + CSearchApiDataObjFactoryAccessor* self = new( ELeave ) CSearchApiDataObjFactoryAccessor() ; + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + + +// --------------------------------------------------------------------------- +// CSearchApiDataObjFactoryAccessor::ConstructL() +// --------------------------------------------------------------------------- +// +void CSearchApiDataObjFactoryAccessor::ConstructL() + { + iEventCodec = CSearchEventCodec::NewL(); + iSearchApiDataObjFactory = CSearchApiDataObjFactory::NewL(); + } + + +// --------------------------------------------------------------------------- +// CSearchApiDataObjFactoryAccessor::CSearchApiDataObjFactoryAccessor() +// --------------------------------------------------------------------------- +// +CSearchApiDataObjFactoryAccessor::CSearchApiDataObjFactoryAccessor() + { + } + +// --------------------------------------------------------------------------- +// CSearchApiDataObjFactoryAccessor::~CSearchApiDataObjFactoryAccessor() +// --------------------------------------------------------------------------- +// +CSearchApiDataObjFactoryAccessor::~CSearchApiDataObjFactoryAccessor() + { + delete iEventCodec; + delete iSearchApiDataObjFactory; + } + + +// --------------------------------------------------------------------------- +// CSearchApiDataObjFactoryAccessor::EventCodec() +// --------------------------------------------------------------------------- +// +MEventCodec& CSearchApiDataObjFactoryAccessor::EventCodec() + { + return *iEventCodec; + } + +// --------------------------------------------------------------------------- +// CSearchApiDataObjFactoryAccessor::ApiDataObjFactory() +// --------------------------------------------------------------------------- +// +MApiDataObjFactory& CSearchApiDataObjFactoryAccessor::ApiDataObjFactory() + { + return *iSearchApiDataObjFactory; + } + + + +// End of file + + + + + + + diff -r 000000000000 -r e6b17d312c8b imservices/searchfeatureplugin/srcsearchdatamodel/searchapidataobjfactoryaccessor.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/searchfeatureplugin/srcsearchdatamodel/searchapidataobjfactoryaccessor.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,82 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class to access the different object factories in the datamodel +* +*/ + +#ifndef SEARCHAPIDATAOBJFACTORYACCESSOR_H +#define SEARCHAPIDATAOBJFACTORYACCESSOR_H + +#include + +class MEventCodec; +class CSearchEventCodec; +class MApiDataObjFactory; +class CSearchApiDataObjFactory; +class MApiDataObjFactoryAccessor; +/** + * Class to access the different object factories in the datamodel + * + * @lib searchdatamodel.dll + * + */ +NONSHARABLE_CLASS( CSearchApiDataObjFactoryAccessor ) : public MApiDataObjFactoryAccessor + { + public: + /** + ** NewL method + **/ + IMPORT_C static CSearchApiDataObjFactoryAccessor* NewL(); + + /** + * Returns the feature plugin specific event codec object + */ + MEventCodec& EventCodec() ; + + /** + * Returns the feature plugin specific api object data factory object + */ + MApiDataObjFactory& ApiDataObjFactory(); + /** + * destructor + */ + ~CSearchApiDataObjFactoryAccessor(); + + private: + /** + * constructor + */ + CSearchApiDataObjFactoryAccessor(); + /** + * construcL + */ + void ConstructL(); + + //data + private: + // Own + CSearchEventCodec* iEventCodec; + + // Own + CSearchApiDataObjFactory* iSearchApiDataObjFactory; + + }; + +#endif // SEARCHAPIDATAOBJFACTORYACCESSOR_H + + + + + + diff -r 000000000000 -r e6b17d312c8b imservices/searchfeatureplugin/srcsearchdatamodel/searchapiobjbase.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/searchfeatureplugin/srcsearchdatamodel/searchapiobjbase.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,54 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: class ids +* +*/ + +#ifndef SEARCHAPIOBJBASE_H +#define SEARCHAPIOBJBASE_H + + +/** + * search plugin class implementation UIDs. + * + * These do not have to be "real" Symbian UIDs, but such ID's, + * that they do not overlap with XIMP or IM Plugin API interface IDs. + */ + +// 90xx - ximp related +// 91xx - im related +// 92xx - instant messaging related +// 93xx - search related + + +const TInt KArrayGranularity( 2 ); + +#define IMP_CLSID_CSEARCHFEATUREIMP 9300 +#define IMP_CLSID_CSEARCHIMP 9301 + +#define IMP_CLSID_CSEARCHOBJECTFACTORYIMP 9302 +#define IMP_CLSID_CSEARCHINFOIMP 9303 +#define IMP_CLSID_CSEARCHEVENTIMP 9304 +#define IMP_CLSID_CPROTOCOLIMDATAHOSTIMP 9305 + +#define IMP_CLSID_CSEARCHOPERATIONFACTORYIMP 9306 +#define IMP_CLSID_CSEARCHDATACACHE 9307 +#define IMP_CLSID_CSEARCHELEMENTIMP 9308 +#define IMP_CLSID_CPROTOCOLSEARCHDATAHOSTIMP 9309 +#define IMP_CLSID_CPROTOCOLSEARCHFEATUREDATAHOST 9310 + + +#define IMP_CLSID_CSEARCHKEY_INFO_IMP 9311 +#define IMP_CLSID_CSEARCHKEYSEVENTIMP 9312 +#endif // SEARCHAPIOBJBASE_H diff -r 000000000000 -r e6b17d312c8b imservices/searchfeatureplugin/srcsearchdatamodel/searchdatacacheimp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/searchfeatureplugin/srcsearchdatamodel/searchdatacacheimp.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,187 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: search data cache implementation. + * +*/ + + +#include +#include +#include +#include + +#include "searchkeyssubscriptionitem.h" +#include "searchdatacacheimp.h" +#include "searchsubscriptionitem.h" +#include "searcheventimp.h" + +// --------------------------------------------------------------------------- +// CSearchDataCache ::CSearchDataCache () +// --------------------------------------------------------------------------- +// +CSearchDataCache ::CSearchDataCache ( MXIMPHost& aHost ) +:iHost( aHost ) + { + } +// --------------------------------------------------------------------------- +// CSearchDataCache ::ConstructL() +// --------------------------------------------------------------------------- +// +void CSearchDataCache ::ConstructL() + { + + } +// --------------------------------------------------------------------------- +// CSearchDataCache ::NewL() +// --------------------------------------------------------------------------- +// +EXPORT_C CSearchDataCache * CSearchDataCache ::NewL( MXIMPHost& aHost ) + { + CSearchDataCache * self = new( ELeave ) CSearchDataCache ( aHost ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } +// --------------------------------------------------------------------------- +// CSearchDataCache ::~CSearchDataCache () +// --------------------------------------------------------------------------- +// +CSearchDataCache ::~CSearchDataCache () + { + + } +// --------------------------------------------------------------------------- +// CSearchDataCache ::RemoveMe +// --------------------------------------------------------------------------- +// +template< class Type > +EXPORT_C void CSearchDataCache ::RemoveMe( Type*& aItem, Type* aChild ) + { + if( aChild == aItem ) + { + aItem = NULL; + } + } +// --------------------------------------------------------------------------- +// CSearchDataCache ::AddEventL +// --------------------------------------------------------------------------- +// +void CSearchDataCache ::AddEventL( CXIMPApiEventBase& aEvent, MXIMPPscContext* aContext ) + { + iHost.AddEventL( aEvent, aContext ); + } + +// --------------------------------------------------------------------------- +// CSearchDataCache ::RegisterExpiringItemL +// --------------------------------------------------------------------------- +// +void CSearchDataCache ::RegisterExpiringItemL( CXIMPSubscriptionItemBase* /*aExpireItem*/ ) + { + + } +// --------------------------------------------------------------------------- +// CSearchDataCache ::UnregisterExpiringItemL +// --------------------------------------------------------------------------- +// +void CSearchDataCache ::UnregisterExpiringItem( CXIMPSubscriptionItemBase* /*aExpireItem*/ ) + { + + } +// --------------------------------------------------------------------------- +// CSearchDataCache ::ItemLC +// --------------------------------------------------------------------------- +// +template< class Type > +Type& CSearchDataCache ::ItemLC( Type*& aItem ) + { + if( !aItem ) + { + aItem = Type::NewLC( *this ); + } + else + { + User::LeaveIfError( aItem->Open() ); + CleanupClosePushL( *aItem ); + } + return *aItem; + } +// --------------------------------------------------------------------------- +// CSearchDataCache ::CleanResources +// --------------------------------------------------------------------------- +// +EXPORT_C void CSearchDataCache ::CleanResources( MXIMPPscContext& /*aContext*/ ) + { + + } +// --------------------------------------------------------------------------- +// CSearchDataCache ::CleanExpired +// --------------------------------------------------------------------------- +// +EXPORT_C void CSearchDataCache ::CleanExpired() + { + + } +// --------------------------------------------------------------------------- +// CSearchDataCache ::RemoveMe +// --------------------------------------------------------------------------- +// +void CSearchDataCache ::RemoveMe( CSearchSubscriptionItem* aChild ) + { + RemoveMe< CSearchSubscriptionItem >( + iSearchSubscriptionItem, aChild ); + } +// --------------------------------------------------------------------------- +// CSearchDataCache ::CSearchSubscriptionItemLC +// --------------------------------------------------------------------------- +// +EXPORT_C CSearchSubscriptionItem& CSearchDataCache ::SearchSubscriptionItemLC() + { + return ItemLC< CSearchSubscriptionItem >( iSearchSubscriptionItem ); + } +// --------------------------------------------------------------------------- +// CSearchDataCache ::RemoveMe +// --------------------------------------------------------------------------- +// +void CSearchDataCache ::RemoveMe( CSearchKeysSubscriptionItem* aChild ) + { + RemoveMe< CSearchKeysSubscriptionItem >( + iSearchKeySubscriptionItem, aChild ); + } +// --------------------------------------------------------------------------- +// CSearchDataCache ::CSearchKeysSubscriptionItemLC +// --------------------------------------------------------------------------- +// +EXPORT_C CSearchKeysSubscriptionItem& CSearchDataCache ::SearchKeysSubscriptionItemLC() + { + return ItemLC< CSearchKeysSubscriptionItem >( iSearchKeySubscriptionItem ); + } +// --------------------------------------------------------------------------- +// CSearchDataCache ::GetInterface +// --------------------------------------------------------------------------- +// +TAny* CSearchDataCache ::GetInterface(TInt aInterfaceId) + { + if(aInterfaceId == SEARCH_ITEM_PARENT) + { + return static_cast(this) ; + } + else + { + User::Panic( _L("CXIMPIMCache"), KErrExtensionNotSupported ); + return NULL; // this line never gets executed :Just to remove warning + } + } + +// End of file diff -r 000000000000 -r e6b17d312c8b imservices/searchfeatureplugin/srcsearchdatamodel/searchdatacacheimp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/searchfeatureplugin/srcsearchdatamodel/searchdatacacheimp.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,164 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: SEARCH data cache implementation. +* +*/ + +#ifndef CSEARCHDATACACHEIMP_H +#define CSEARCHDATACACHEIMP_H + +#include +#include "searchapiobjbase.h" + +#include "searchitemparent.h" +#include "searchtypehelpers.h" + + +class MXIMPHost; +class CCSearchSubscriptionItem; +class CXIMPIdentityImp; +class MXIMPPscContext; +class CXIMPSubscriptionItemBase; +class MXIMPStatus; +class MXIMPIdentity; +class CSearchKeysSubscriptionItem; +/** + * search data cache implementation + * + * @lib searchdatamodel.dll + */ +class CSearchDataCache : public CBase, + public MSearchItemParent + { +public: // Definitions + + /** The class ID. */ + enum { KClassId = IMP_CLSID_CSEARCHDATACACHE }; + + +public: // Construction and destruction + + /** + * Construction + */ + IMPORT_C static CSearchDataCache * NewL( MXIMPHost& aHost ); + + /** + * Destruction + */ + virtual ~CSearchDataCache (); + +private: + /** + * construction + */ + CSearchDataCache ( MXIMPHost& aHost ); + /** + * leaving constructor + */ + void ConstructL(); + +private: // MXIMPItemParentBase + /** + * @see MXIMPItemParentBase + */ + + TAny* GetInterface(TInt aInterfaceId); + /** + * @see MXIMPItemParentBase + */ + void RegisterExpiringItemL( CXIMPSubscriptionItemBase* aExpireItem ); + /** + * @see MXIMPItemParentBase + */ + void UnregisterExpiringItem( CXIMPSubscriptionItemBase* aExpireItem ); + +private: // From MSearchItemParent + + /** + * @see MSearchItemParent + */ + void RemoveMe( CSearchSubscriptionItem* aChild ); + + void RemoveMe( CSearchKeysSubscriptionItem* aChild ); + + /** + * @see MSearchItemParent + */ + void AddEventL( CXIMPApiEventBase& aEvent, MXIMPPscContext* aContext ); + +public: // New methods + + /** + * - If CSearchSubscriptionItem is not found, data cache + * initializes new one and returns ownership to caller + * - If CSearchSubscriptionItem is found, data cache increases + * refcount by one, and returns the old object + */ + IMPORT_C CSearchSubscriptionItem& SearchSubscriptionItemLC(); + + /** + * - If CSearchKeysSubscriptionItem is not found, data cache + * initializes new one and returns ownership to caller + * - If CSearchKeysSubscriptionItem is found, data cache increases + * refcount by one, and returns the old object + */ + IMPORT_C CSearchKeysSubscriptionItem& SearchKeysSubscriptionItemLC(); + + /** + * Clean resources concerning context. + */ + IMPORT_C void CleanResources( MXIMPPscContext& aContext ); + + /** + * + */ + IMPORT_C void CleanExpired(); + +private: // Helper methods + + /** + * Template method for removeMe when one subscription item is target. + * @param aItem Reference to subscription item pointer to remove. + * @param Pointer of item to remove. + */ + template< class Type > + IMPORT_C static void RemoveMe( Type*& aItem, Type* aChild ); + + + /** + * Templated item instance creation. If item is not found it is created. + * @param aItem Reference to pointer where new item should be saved. + * @return Reference to item created. + */ + template< class Type > + Type& ItemLC( Type*& aItem ); + + + +private: // Data + + /** + * Access to host. not owned + */ + MXIMPHost& iHost; + + /** + * Does not own. Removed when RemoveMe called. + */ + CSearchSubscriptionItem* iSearchSubscriptionItem; + CSearchKeysSubscriptionItem* iSearchKeySubscriptionItem; + }; + +#endif // CSearchDataCache IMP_H diff -r 000000000000 -r e6b17d312c8b imservices/searchfeatureplugin/srcsearchdatamodel/searchdatamodelhook/searchdatamodelhook.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/searchfeatureplugin/srcsearchdatamodel/searchdatamodelhook/searchdatamodelhook.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,46 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework's search Data Model Hook implementation. +* +*/ + + +#include +#include "searchapidataobjfactoryaccessor.h" +#include +#include + + +// --------------------------------------------------------------------------- +// Key value pair table to identify correct constructor +// function for the requested interface. +// --------------------------------------------------------------------------- +// +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY( XIMP_ECOM_IMPL_UID_SEARCH_DATAMODEL_INTERFACE, + CSearchApiDataObjFactoryAccessor::NewL ) + }; + + +// --------------------------------------------------------------------------- +// Exported function to return the implementation proxy table +// --------------------------------------------------------------------------- +// +EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount ) + { + aTableCount = sizeof( ImplementationTable ) / sizeof( TImplementationProxy ); + return ImplementationTable; + } + diff -r 000000000000 -r e6b17d312c8b imservices/searchfeatureplugin/srcsearchdatamodel/searchdatamodelhook/searchdatamodelhook.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/searchfeatureplugin/srcsearchdatamodel/searchdatamodelhook/searchdatamodelhook.rss Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,52 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ECom registery info for ECom hook +* +*/ + + +#include +#include +#include +#include + +// --------------------------------------------------------------------------- +// ECom registery info for XIMP search data model ECom hook +// --------------------------------------------------------------------------- +// +RESOURCE REGISTRY_INFO theInfo + { + resource_format_version = RESOURCE_FORMAT_VERSION_2; + dll_uid = XIMP_DLL_UID_SEARCH_DATAMODEL_HOOK; + + interfaces = + { + INTERFACE_INFO + { + interface_uid = XIMP_ECOM_IF_UID_PROTOCOL_DATAMODEL_CODEC_INTERFACE; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = XIMP_ECOM_IMPL_UID_SEARCH_DATAMODEL_INTERFACE; + version_no = 1; + display_name = "S60 Default XIMP"; + default_data = XIMP_ECOM_DEFAULT_DATA_SEARCH_INTERFACE; + opaque_data = ""; + } + }; + } + }; + } + diff -r 000000000000 -r e6b17d312c8b imservices/searchfeatureplugin/srcsearchdatamodel/searcheventcodec.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/searchfeatureplugin/srcsearchdatamodel/searcheventcodec.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,253 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Base class for API implementations. +* +*/ + +#include +#include +#include "searcheventcodec.h" +#include "searcheventimp.h" +#include "ximpapieventbase.h" +#include "searchkeyseventimp.h" + +/** + * Type definition for exact API event constructor signature. + */ +typedef CXIMPApiEventBase* (*TApiEventConstructor)( RReadStream& ); + +/** + * Structure for mapping event interface IDs to + * to corect API event constructors. + */ +struct SApiEventConstructorMap + { + //Interface id + TInt32 iInterfaceId; + + //Function pointer to event interface implementation + TApiEventConstructor iConstructorPtr; + } ; + +/** + * Helper macro to initialise KApiEventConstructorTable members. + * + * Macro forces that each event implementation class to have static + * NewFromStreamLC() memeber function to instantiate the object. + * + * See TApiEventConstructor type definition for exact constructor + * signature. + */ +#define CONSTRUCTOR_ENTRY( TheImplementedIf, TheClass ) \ + { TheImplementedIf::KInterfaceId, TheClass::NewFromStreamLC } \ + + +/** + * Constructor function mapping for event interface implementations. + * + * When new event types are implemented, add them here. + */ + +const SApiEventConstructorMap KApiEventConstructorTable[] = + { + CONSTRUCTOR_ENTRY( MSearchEvent, CSearchEventImp ), + CONSTRUCTOR_ENTRY( MSearchKeysEvent, CSearchKeysEventImp ) + }; + + +/** + * Count of constructor mappings. + */ +const TInt KApiEventConstructorCount = sizeof( KApiEventConstructorTable ) + / sizeof( SApiEventConstructorMap ); + + + +// ============================ HELPER FUNCTIONS ============================= + + +/** + * Helper function to locate constructor function for + * event interface ID. + * + * @param aEventInterfaceId The event interface ID. + * @return Event object constructor function. + */ +TApiEventConstructor ConstructorForInterface( TInt32 aEventInterfaceId ) + { + //Locate correct constructor + for( TInt ix = 0; ix < KApiEventConstructorCount; ix++ ) + { + const SApiEventConstructorMap map = KApiEventConstructorTable[ ix ]; + if( map.iInterfaceId == aEventInterfaceId ) + { + return map.iConstructorPtr; + } + } + return NULL; + } + + +/** + * Helper function to instantiate new event object + * of requested type and construct it from the stream. + * + * @param aEventInterfaceId + * @return Event object constructor function. + */ +CXIMPApiEventBase* NewEventObjectFromStreamLC( TInt32 aEventInterfaceId, + RReadStream& aStream ) + { + TApiEventConstructor newFromStreamLC = NULL; + + //Locate correct constructor for interface ID + newFromStreamLC = ConstructorForInterface( aEventInterfaceId ); + + if( ! newFromStreamLC ) + { + return NULL; + } + //Instantiate the object + CXIMPApiEventBase* eventObject = newFromStreamLC( aStream ); + + return eventObject; + } + + +// ============================ MEMBER FUNCTIONS ============================= + + +// --------------------------------------------------------------------------- +// CSearchEventCodec::NewL() +// --------------------------------------------------------------------------- +// +CSearchEventCodec* CSearchEventCodec::NewL() + { + CSearchEventCodec* self = new( ELeave ) CSearchEventCodec() ; + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + + +// --------------------------------------------------------------------------- +// CSearchEventCodec::ConstructL() +// --------------------------------------------------------------------------- +// +void CSearchEventCodec::ConstructL() + { + } +// --------------------------------------------------------------------------- +// CSearchEventCodec::CSearchEventCodec() +// --------------------------------------------------------------------------- +// +CSearchEventCodec::CSearchEventCodec() + { + } + +// --------------------------------------------------------------------------- +// CSearchEventCodec::~CSearchEventCodec() +// --------------------------------------------------------------------------- +// +CSearchEventCodec::~CSearchEventCodec() + { + } + +// --------------------------------------------------------------------------- +// CSearchEventCodec::PackL() +// --------------------------------------------------------------------------- +// +HBufC8* CSearchEventCodec::PackL( CXIMPApiEventBase& aEventObj, + TInt32& aTypeOfEvent ) + { + CBufFlat* buffer = CBufFlat::NewL( 10 ); // initial granularity to 10 + CleanupStack::PushL( buffer ); + + RBufWriteStream ws; + CleanupClosePushL( ws ); + ws.Open( *buffer ); // CSI: 65 # + + //Ask real event type through the event base interface + TInt32 eventIfId = aEventObj.Base().GetInterfaceId(); + + //And write both event type and data + ws.WriteInt32L( eventIfId ); + aEventObj.ExternalizeL( ws ); + ws.CommitL(); + CleanupStack::PopAndDestroy(); //ws + + HBufC8* heapBuf = buffer->Ptr( 0 ).AllocL(); + + CleanupStack::PopAndDestroy( buffer ); + + + aTypeOfEvent = eventIfId; + return heapBuf; + } + + +// --------------------------------------------------------------------------- +// CSearchEventCodec::PackL() +// --------------------------------------------------------------------------- +// +void CSearchEventCodec::PackL( CXIMPApiEventBase& aEventObj, + TInt32& aTypeOfEvent, + CBufFlat* aBuffer ) + { + RBufWriteStream ws; + CleanupClosePushL( ws ); + ws.Open( *aBuffer ); // CSI: 65 # + + //Ask real event type through the event base interface + TInt32 eventIfId = aEventObj.Base().GetInterfaceId(); + + //And write both event type and data + ws.WriteInt32L( eventIfId ); + aEventObj.ExternalizeL( ws ); + ws.CommitL(); + CleanupStack::PopAndDestroy( ); //ws + + aTypeOfEvent = eventIfId; + } + + +// --------------------------------------------------------------------------- +// CSearchEventCodec::UnPackL() +// --------------------------------------------------------------------------- +// +CXIMPApiEventBase* CSearchEventCodec::UnPackL( const TDesC8& aEventData, + TInt32& aTypeOfEvent ) + { + RDesReadStream rs; + rs.Open( aEventData ); // CSI: 65 # + CleanupClosePushL( rs ); + + TInt32 eventIfId = rs.ReadInt32L(); + CXIMPApiEventBase* eventObject = NewEventObjectFromStreamLC( eventIfId, rs ); + if( eventObject ) + { + CleanupStack::Pop( eventObject ); //eventObject + } + + CleanupStack::PopAndDestroy( ); // rs + + + aTypeOfEvent = eventIfId; + return eventObject; + } + + +// End of file + diff -r 000000000000 -r e6b17d312c8b imservices/searchfeatureplugin/srcsearchdatamodel/searcheventcodec.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/searchfeatureplugin/srcsearchdatamodel/searcheventcodec.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,103 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Codec to pack and unpack event objects. +* +*/ + +#ifndef SEARCHEVENTCODEC_H +#define SEARCHEVENTCODEC_H + +#include + +#include "eventcodec.h" + +class CXIMPApiEventBase; +class RReadStream; + + +/** + * Codec to pack and unpack event objects. + * + * @lib searchdatamodel.dll + */ +NONSHARABLE_CLASS( CSearchEventCodec ): public MEventCodec + { + +public: + static CSearchEventCodec* NewL(); + + ~CSearchEventCodec(); + + + /** + * packs and allocates memory for the + * event object and event type + * + * @param aEventObj + * event object derived from CXIMPApiEventBase + * + * @param aTypeOfEvent + * holds type of the event after execution from aEventObj + * + * @return + * heap allocated which contains both + * event and event type + */ + HBufC8* PackL( CXIMPApiEventBase& aEventObj, + TInt32& aTypeOfEvent ); + + /** + * packs + * event object and event type into the buffer + * + * @param aEventObj + * event object derived from CXIMPApiEventBase + * + * @param aTypeOfEvent + * holds type of the event after execution from aEventObj + * + * @param + * buffer to be packed with + * event and event type + */ + + void PackL( CXIMPApiEventBase& aEventObj, + TInt32& aTypeOfEvent, + CBufFlat* aBuffer ); + + /** + * + * @param aEventData + * data desc which has the event type and id + * + * @param aTypeOfEvent + * holds type of the event after execution from aEventData + * + * @return new eventbase object constructed from aEventData + * + */ + CXIMPApiEventBase* UnPackL( const TDesC8& aEventData, + TInt32& aTypeOfEvent ); +protected: + void ConstructL(); + +private: + + CSearchEventCodec(); + + + }; + + +#endif // SEARCHEVENTCODEC_H diff -r 000000000000 -r e6b17d312c8b imservices/searchfeatureplugin/srcsearchdatamodel/searchitemparent.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/searchfeatureplugin/srcsearchdatamodel/searchitemparent.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,71 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Item parent interface. +* +*/ + +#ifndef CSEARCHITEMPARENT_H +#define CSEARCHITEMPARENT_H + +#include + + +class CXIMPApiEventBase; +class MXIMPPscContext; +class CSearchSubscriptionItem; +class CSearchKeysSubscriptionItem; + + +#define SEARCH_ITEM_PARENT 0xE000000A + +/** + * Item parent interface. + * + * + */ +class MSearchItemParent : public MXIMPItemParentBase + { + + public: + enum { KInterfaceId = SEARCH_ITEM_PARENT}; + + public: // Definitions + + /** + * Remove item + * @param aChild Item pointer to remove. + */ + virtual void RemoveMe( CSearchSubscriptionItem* aChild ) = 0; + + virtual void RemoveMe( CSearchKeysSubscriptionItem* aChild ) = 0; + + /** + * Add event to event pump + */ + virtual void AddEventL( CXIMPApiEventBase& aEvent, MXIMPPscContext* aContext ) = 0; + + +protected: // Destruction + + /** + * Object cannot be delted through this interface + */ + virtual ~MSearchItemParent(){} + }; + +/* ======================================================================== */ + + + +#endif // CXIMPIMITEMPARENT_H diff -r 000000000000 -r e6b17d312c8b imservices/searchfeatureplugin/srcsearchdatamodel/searchobjectfactoryimp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/searchfeatureplugin/srcsearchdatamodel/searchobjectfactoryimp.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,99 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of objectfactory + * +*/ + + + +#include "searchobjectfactoryimp.h" + +#include "searchelementimp.h" +#include "searchinfoimp.h" +#include "searchkeyinfoimp.h" + + +// ============================ MEMBER FUNCTIONS ============================= + +// --------------------------------------------------------------------------- +// CSearchObjectFactoryImp::NewL() +// --------------------------------------------------------------------------- +// +EXPORT_C CSearchObjectFactoryImp* CSearchObjectFactoryImp::NewL() + { + CSearchObjectFactoryImp* self = new( ELeave ) CSearchObjectFactoryImp; + return self; + + } + +// --------------------------------------------------------------------------- +// Implement supported interface access. +// --------------------------------------------------------------------------- +// +XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CSearchObjectFactoryImp, + MSearchObjectFactory ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + + +XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CSearchObjectFactoryImp, + MSearchObjectFactory ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + +// --------------------------------------------------------------------------- +// CSearchObjectFactoryImp::~CSearchObjectFactoryImp() +// --------------------------------------------------------------------------- +// +CSearchObjectFactoryImp::~CSearchObjectFactoryImp() + { + } + + +// --------------------------------------------------------------------------- +// CSearchObjectFactoryImp::CSearchObjectFactoryImp() +// --------------------------------------------------------------------------- +// +CSearchObjectFactoryImp::CSearchObjectFactoryImp() + { + } + + + + // --------------------------------------------------------------------------- +// CSearchObjectFactoryImp::NewSearchElementLC() +// --------------------------------------------------------------------------- +// +MSearchElement* CSearchObjectFactoryImp::NewSearchElementLC() + { + return CSearchElementImp::NewLC(); + } + + // --------------------------------------------------------------------------- +// CSearchObjectFactoryImp::NewSearchInfoLC() +// --------------------------------------------------------------------------- +// +MSearchInfo* CSearchObjectFactoryImp::NewSearchInfoLC() + { + return CSearchInfoImp::NewLC(); + } + +// --------------------------------------------------------------------------- +// CSearchObjectFactoryImp::NewSupportedSearchKeyLC() +// --------------------------------------------------------------------------- +// + MSearchKeyInfo* CSearchObjectFactoryImp::NewSearchKeyInfoLC() + { + return CSearchKeyInfoImp::NewLC(); + } + + diff -r 000000000000 -r e6b17d312c8b imservices/searchfeatureplugin/srcsearchdatamodel/searchobjectfactoryimp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/searchfeatureplugin/srcsearchdatamodel/searchobjectfactoryimp.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,79 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of MSearchObjectFactory + * +*/ + +#ifndef CSEARCHOBJECTFACTORYIMP_H +#define CSEARCHOBJECTFACTORYIMP_H + +#include +#include "ximpapiobjbase.h" +#include "searchapiobjbase.h" + + +/** + * MSearchObjectFactory API object implementation. + * + * @lib searchdatamodel.dll + * + */ +class CSearchObjectFactoryImp: public CXIMPApiObjBase, + public MSearchObjectFactory + { + public: + /** The class ID. */ + enum { KClassId = IMP_CLSID_CSEARCHOBJECTFACTORYIMP }; + + +public: + + IMPORT_C static CSearchObjectFactoryImp* NewL(); + ~CSearchObjectFactoryImp(); + +private: + CSearchObjectFactoryImp(); + + + +public: // From MXIMPBase + + /** + * Implementation of MXIMPBase interface methods + * @see MXIMPBase + */ + XIMPIMP_DECLARE_IF_BASE_METHODS + + +public: //From MSearchObjectFactory + /** + * Implementation of MSearchObjectFactory interface method + * @see MSearchObjectFactory + */ + MSearchElement* NewSearchElementLC(); + /** + * Implementation of MSearchObjectFactory interface method + * @see MSearchObjectFactory + */ + MSearchInfo* NewSearchInfoLC(); + /** + * Implementation of MSearchObjectFactory interface method + * @see MSearchObjectFactory + */ + MSearchKeyInfo* NewSearchKeyInfoLC(); + + }; + + +#endif // CSEARCHOBJECTFACTORYIMP_H diff -r 000000000000 -r e6b17d312c8b imservices/searchfeatureplugin/srcsearchdatamodel/searchtypehelpers.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/searchfeatureplugin/srcsearchdatamodel/searchtypehelpers.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,52 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Typedef helpers for really long typenames. + * +*/ + +#ifndef SEARCHTYPEHELPERS_H +#define SEARCHTYPEHELPERS_H + +#include "ximpapiobjbase.h" +#include "searchapiobjbase.h" +#include + +class CXIMPApiDataObjBase; +class CSearchInfoImp; +class CSearchKeyInfoImp; + +// Key for opening up the typedefs: +// +// R(Xyz)Array = RXIMPObjOwningPtrArray +// Im = IM +// GrpInfo = GroupInfo +// GrpMemInfo = GroupMemberInfo +// WatLstInfo = WatcherListInfo +// +// When adding new types, follow these conventions. +// + +struct SSearchReqParam + { + CXIMPApiDataObjBase* iParam; + TInt iParamType; + }; + +typedef RArray RSearchReqParamArray; +typedef RXIMPObjOwningPtrArray RSearchInfoImpArray; +typedef RXIMPObjOwningPtrArray RSearchKeyInfoImpArray; + +#endif // SEARCHTYPEHELPERS_H + + diff -r 000000000000 -r e6b17d312c8b imservices/searchfeatureplugin/srcsearchfrontend/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/searchfeatureplugin/srcsearchfrontend/group/bld.inf Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Build information file for project Search Feature Plugin +* +*/ + + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +PRJ_MMPFILES +searchmanager.mmp +searchecomhook.mmp + + +PRJ_TESTMMPFILES + +PRJ_TESTEXPORTS + diff -r 000000000000 -r e6b17d312c8b imservices/searchfeatureplugin/srcsearchfrontend/group/searchecomhook.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/searchfeatureplugin/srcsearchfrontend/group/searchecomhook.mmp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,61 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project definition file for Search Manager ECom Hook +* +*/ + +#include +#include +#include "../../group/searchdlluids.hrh" + + +TARGET searchecomhook.dll +CAPABILITY CAP_ECOM_PLUGIN +TARGETTYPE PLUGIN +UID XIMP_SEARCH_DLL_UID_ECOM_PLUGIN XIMP_DLL_UID_SEARCH_HOOK +VENDORID VID_DEFAULT + +VERSION 10.0 + +SOURCEPATH ../srcecomhook +START RESOURCE searchecomhook.rss +TARGET searchecomhook.rsc +END + + +SOURCEPATH ../srcecomhook +SOURCE searchecomhook.cpp + + +USERINCLUDE ../srcecomhook +USERINCLUDE ../srcsearchmanager +USERINCLUDE ../../srcsearchdatamodel +USERINCLUDE ../../group + + + +MW_LAYER_SYSTEMINCLUDE + + +LIBRARY euser.lib +LIBRARY searchmanager.lib +LIBRARY ecom.lib + + + +#if defined( ARMCC ) +DEFFILE ../../eabi/ +#elif defined ( WINSCW ) +deffile ../../bwins/ +#endif \ No newline at end of file diff -r 000000000000 -r e6b17d312c8b imservices/searchfeatureplugin/srcsearchfrontend/group/searchmanager.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/searchfeatureplugin/srcsearchfrontend/group/searchmanager.mmp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,76 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project definition file for search Manager +* +*/ + +#include +#include +#include "../../group/searchdlluids.hrh" + + +TARGET searchmanager.dll +TARGETTYPE dll +UID XIMP_SEARCH_DLL_UID_STATIC_INTERFACE XIMP_DLL_UID_SEARCH_MANAGER + +CAPABILITY CAP_GENERAL_DLL +VENDORID VID_DEFAULT + +VERSION 10.0 + +SOURCEPATH ../srcsearchmanager + + +SOURCE searchimp.cpp +SOURCE searchfeatureimp.cpp + + +SOURCEPATH ../../srcutils +SOURCE searchlogutils.cpp + + +USERINCLUDE ../../group + + +USERINCLUDE ../../srcutils +USERINCLUDE ../../srcsearchdatamodel +USERINCLUDE ../../srcsearchoperations +USERINCLUDE ../srcsearchmanager +USERINCLUDE ../../srcsearchdatamodel/search + +MW_LAYER_SYSTEMINCLUDE + + + +LIBRARY euser.lib +LIBRARY ecom.lib +LIBRARY bafl.lib +LIBRARY estor.lib +LIBRARY ximputils.lib +LIBRARY ximpdatamodel.lib +LIBRARY searchdatamodel.lib +LIBRARY ximpsrvclient.lib +LIBRARY flogger.lib + + +//EXPORTUNFROZEN + + +#if defined( ARMCC ) +DEFFILE ../../eabi/ +#elif defined ( WINSCW ) +deffile ../../bwins/ +#endif + +// End of file diff -r 000000000000 -r e6b17d312c8b imservices/searchfeatureplugin/srcsearchfrontend/srcecomhook/searchecomhook.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/searchfeatureplugin/srcsearchfrontend/srcecomhook/searchecomhook.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,46 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework's SEARCH Manager Ecom Hook implementation. +* +*/ + + +#include +#include "searchfeatureimp.h" +#include +#include + + +// --------------------------------------------------------------------------- +// Key value pair table to identify correct constructor +// function for the requested interface. +// --------------------------------------------------------------------------- +// +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY( XIMP_ECOM_IMPLEMENTATION_UID_SEARCH_INTERFACE, + CSearchFeatureImp::NewL ) + }; + + +// --------------------------------------------------------------------------- +// Exported function to return the implementation proxy table +// --------------------------------------------------------------------------- +// +EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount ) + { + aTableCount = sizeof( ImplementationTable ) / sizeof( TImplementationProxy ); + return ImplementationTable; + } + diff -r 000000000000 -r e6b17d312c8b imservices/searchfeatureplugin/srcsearchfrontend/srcecomhook/searchecomhook.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/searchfeatureplugin/srcsearchfrontend/srcecomhook/searchecomhook.rss Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,52 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ECom registery info for ECom hook +* +*/ + + +#include +#include +#include + + +// --------------------------------------------------------------------------- +// ECom registery info for XIMP SEARCH Manager ECom hook +// --------------------------------------------------------------------------- +// +RESOURCE REGISTRY_INFO theInfo + { + resource_format_version = RESOURCE_FORMAT_VERSION_2; + dll_uid = XIMP_DLL_UID_SEARCH_HOOK; + + interfaces = + { + INTERFACE_INFO + { + interface_uid = XIMP_ECOM_IF_UID_SEARCH_INTERFACE; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = XIMP_ECOM_IMPLEMENTATION_UID_SEARCH_INTERFACE ; + version_no = 1; + display_name = "S60 Default XIMP"; + default_data = XIMP_ECOM_DEFAULT_DATA_SEARCH_INTERFACE; + opaque_data = ""; + } + }; + } + }; + } + diff -r 000000000000 -r e6b17d312c8b imservices/searchfeatureplugin/srcsearchfrontend/srcsearchmanager/searchfeatureimp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/searchfeatureplugin/srcsearchfrontend/srcsearchmanager/searchfeatureimp.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,122 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of MsearchFeature + * +*/ + + +#include +#include "searchapiobjbase.h" + +#include "ximpcontextinternal.h" +#include "searchfeatureimp.h" + +#include "searchimp.h" +#include "searchobjectfactoryimp.h" + + + +// ============================ MEMBER FUNCTIONS ============================= + +// --------------------------------------------------------------------------- +// CSearchFeatureImp::NewL() +// --------------------------------------------------------------------------- +// +EXPORT_C CSearchFeatureImp* CSearchFeatureImp::NewL(MXIMPContext* aContext) + { + CSearchFeatureImp* self = new( ELeave ) CSearchFeatureImp(); + CleanupStack::PushL( self ); + self->ConstructL(aContext); + CleanupStack::Pop(); + return self; + } + +// --------------------------------------------------------------------------- +// Implement supported interface access. +// --------------------------------------------------------------------------- +// + +XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CSearchFeatureImp, + MSearchFeature ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + + +XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CSearchFeatureImp, + MSearchFeature) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + +// --------------------------------------------------------------------------- +// CSearchFeatureImp::~CSearchFeatureImp() +// --------------------------------------------------------------------------- +// +CSearchFeatureImp::~CSearchFeatureImp() + { + delete iSearch; + delete iSearchObjFactory; + iCtxInternal = NULL; + } + + +// --------------------------------------------------------------------------- +// CSearchFeatureImp::CSearchFeatureImp( CXIMPContextClientProxy& aCtxProxy ) +// --------------------------------------------------------------------------- +// +CSearchFeatureImp::CSearchFeatureImp() + { + } + +// --------------------------------------------------------------------------- +// CSearchFeatureImp::SetCtxL(MXIMPContext* aContext) +// --------------------------------------------------------------------------- +// +void CSearchFeatureImp::SetCtxL(MXIMPContext* aContext) + { + if(!aContext) + User::Leave(KErrArgument); + iCtxInternal = TXIMPGetInterface::From(*aContext,EReturnNullIfUnknown); + + } + +// --------------------------------------------------------------------------- +// CSearchFeatureImp::ConstructL(MXIMPContext* aContext) +// --------------------------------------------------------------------------- +// +void CSearchFeatureImp::ConstructL(MXIMPContext* aContext) + { + SetCtxL(aContext); + iSearchObjFactory = CSearchObjectFactoryImp::NewL(); + iSearch = CSearchImp::NewL( *iCtxInternal ); + + } + + +// --------------------------------------------------------------------------- +// CSearchFeatureImp::SearchObjectFactory() +// --------------------------------------------------------------------------- + MSearchObjectFactory& CSearchFeatureImp::SearchObjectFactory() const + { + return *iSearchObjFactory; + } + + + + // --------------------------------------------------------------------------- +// CSearchFeatureImp::Search() +// --------------------------------------------------------------------------- +// + MSearch& CSearchFeatureImp::Search() const + { + return *iSearch; + } + diff -r 000000000000 -r e6b17d312c8b imservices/searchfeatureplugin/srcsearchfrontend/srcsearchmanager/searchfeatureimp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/searchfeatureplugin/srcsearchfrontend/srcsearchmanager/searchfeatureimp.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,118 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of MsearchFeature +* +*/ + +#ifndef CSEARCHFEATUREIMP_H +#define CSEARCHFEATUREIMP_H + +#include +#include +#include "searchapiobjbase.h" + + +class MXIMPContext; +class MXIMPContextInternal; +class CSearchObjectFactoryImp; +class CSearchImp; + +/** + * MSearchFeature implementation. + * + * @lib searchmanager.dll + */ +NONSHARABLE_CLASS( CSearchFeatureImp ):public MSearchFeature, + public CXIMPApiObjBase + + + { + public: + /** The class ID. */ + enum { KClassId = IMP_CLSID_CSEARCHFEATUREIMP }; + + + public: + + /** + * Construction :NewL + */ + IMPORT_C static CSearchFeatureImp* NewL( MXIMPContext* aContext ); + /** + * Destructor + */ + virtual ~CSearchFeatureImp(); + + + private: + /** + * Destructor + */ + CSearchFeatureImp(); + /** + * inertnal context setting + */ + void SetCtxL(MXIMPContext* aContext); + /** + * constructor + */ + void ConstructL(MXIMPContext* aContext); + + + public: // From MXIMPBase + + /** + * Implementation of MXIMPBase interface methods + * @see MXIMPBase + */ + XIMPIMP_DECLARE_IF_BASE_METHODS + + + public: //From MSearchFeature + /** + * + * @see MSearchFeature + */ + + MSearchObjectFactory& SearchObjectFactory() const; + + /** + * + * @see MSearchFeature + */ + MSearch& Search() const; + + + + private: // data + + /** + * Context for having a connection context server. + */ + MXIMPContextInternal* iCtxInternal; + + + /** + * Object factory sub interface : OWNED + */ + CSearchObjectFactoryImp* iSearchObjFactory; + + /** + * SERACH sub interface. : OWNED + */ + CSearchImp* iSearch; + }; + + +#endif // CSEARCHFEATUREIMP_H diff -r 000000000000 -r e6b17d312c8b imservices/searchfeatureplugin/srcsearchfrontend/srcsearchmanager/searchimp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/searchfeatureplugin/srcsearchfrontend/srcsearchmanager/searchimp.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,146 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of MSearch +* +*/ + + + +#include +#include +#include + +#include "searchoperationdefs.h" +#include "searchimp.h" +#include "searchelementimp.h" + + + +// ============================ MEMBER FUNCTIONS ============================= + +// --------------------------------------------------------------------------- +// CSearchImp::NewL() +// --------------------------------------------------------------------------- +// + + CSearchImp* CSearchImp::NewL( MXIMPContextInternal& aContext ) + { + XSearchLogger::Log(_L("CSearchImp::NewL Started")); + CSearchImp* self = new( ELeave ) CSearchImp( aContext ); + XSearchLogger::Log(_L("CSearchImp::NewL Completed")); + return self; + } + + +// --------------------------------------------------------------------------- +// Implement supported interface access. +// --------------------------------------------------------------------------- +// + XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CSearchImp, + MSearch ) + XIMPIMP_IF_BASE_GET_INTERFACE_END() + + + XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CSearchImp, + MSearch ) + XIMPIMP_IF_BASE_GET_INTERFACE_END() + + + +// --------------------------------------------------------------------------- +// CSearchImp::~CSearchImp() +// --------------------------------------------------------------------------- +// +CSearchImp::~CSearchImp() + { + XSearchLogger::Log(_L("CSearchImp::~CSearchImp Started - Completed")); + } +// --------------------------------------------------------------------------- +// CSearchImp::CSearchImp() +// --------------------------------------------------------------------------- +// +CSearchImp::CSearchImp(MXIMPContextInternal& aContext ) + : iContext( aContext ) + { + } + + + // --------------------------------------------------------------------------- +// CSearchImp::SearchL +// --------------------------------------------------------------------------- +// + TXIMPRequestId CSearchImp::SearchL( const MXIMPIdentity& aSearchId, + const RPointerArray< MSearchElement >& aObjs, + TInt aSearchLimit ) + { + + CBufFlat* buffer = CBufFlat::NewL( 10 ); + CleanupStack::PushL( buffer ); + + RBufWriteStream ws; + CleanupClosePushL( ws ); + ws.Open( *buffer ); // CSI: 65 # Does not return a value + + + // identity + const CXIMPIdentityImp* identityImp = + TXIMPGetImpClassOrPanic< const CXIMPIdentityImp >::From( aSearchId ); + identityImp->ExternalizeL( ws ); + + + + // Get count of objects + TInt objCount( aObjs.Count() ); + // write the count + ws.WriteInt32L( objCount ); + // objects + for ( TInt count(0); count < objCount; count++ ) + { + const CSearchElementImp* eleImp = + TXIMPGetImpClassOrPanic< const CSearchElementImp >::From( *aObjs[count] ); + eleImp->ExternalizeL( ws ); + } + + // write the Search Limit + ws.WriteInt32L( aSearchLimit ); + + ws.CommitL(); + CleanupStack::PopAndDestroy(); //ws + + HBufC8* packedBuf = buffer->Ptr( 0 ).AllocL(); + CleanupStack::PopAndDestroy( buffer ); + CleanupStack::PushL( packedBuf ); + + + // Queue the operation + TXIMPRequestId reqId = + iContext.QueueOperationL( NSearchOps::ESearch, *packedBuf ); + CleanupStack::PopAndDestroy( packedBuf ); + + + return reqId ; + } + + // --------------------------------------------------------------------------- +// CSearchImp::GetSearchKeysL +// --------------------------------------------------------------------------- +// + TXIMPRequestId CSearchImp::GetSearchKeysL() + { + return iContext.QueueOperationL( NSearchOps::EGetSearchKeys , KNullDesC8); + } + +// end of file + + diff -r 000000000000 -r e6b17d312c8b imservices/searchfeatureplugin/srcsearchfrontend/srcsearchmanager/searchimp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/searchfeatureplugin/srcsearchfrontend/srcsearchmanager/searchimp.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,95 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of MSerach +* +*/ + +#ifndef CSEARCHIMP_H +#define CSEARCHIMP_H + +#include +#include +#include + +#include "searchapiobjbase.h" +#include "searchlogutils.h" + + +// FORWARD DECLARATIONS +class MXIMPContextInternal; +class MSearchElement; + +/** + * MSearch implementation. + * + * @lib searchmanager.dll + */ +NONSHARABLE_CLASS( CSearchImp ): public CXIMPApiObjBase,public MSearch + { + public: + /** The class ID. */ + enum { KClassId = IMP_CLSID_CSEARCHIMP }; + + public: + /** + * Construction :NewL + */ + static CSearchImp* NewL( MXIMPContextInternal& aContext ); + + /** + * Destructor + */ + ~CSearchImp(); + + public: + /** + * constructor + */ + CSearchImp( MXIMPContextInternal& aContext ); + + + public: // From MXIMPBase + + /** + * Implementation of MXIMPBase interface methods + * @see MXIMPBase + */ + XIMPIMP_DECLARE_IF_BASE_METHODS + + /** + * + * @see MSearch + */ + TXIMPRequestId SearchL( const MXIMPIdentity& aSearchId, + const RPointerArray< MSearchElement >& aObjs, + TInt aSearchLimit ) ; + /** + * + * @see MSearch + */ + TXIMPRequestId GetSearchKeysL() ; + + private: // data + + /** + * Context session proxy for accessing context server. + * Ref. : not owned + */ + MXIMPContextInternal& iContext; + + + }; + + +#endif // CSEARCHIMP_H diff -r 000000000000 -r e6b17d312c8b imservices/searchfeatureplugin/srcsearchoperations/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/searchfeatureplugin/srcsearchoperations/group/bld.inf Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Build information file for project Search Feature plugin +* +*/ + + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +PRJ_MMPFILES + +searchoperation.mmp +searchoperationshook.mmp + +PRJ_TESTMMPFILES + +PRJ_TESTEXPORTS + diff -r 000000000000 -r e6b17d312c8b imservices/searchfeatureplugin/srcsearchoperations/group/searchoperation.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/searchfeatureplugin/srcsearchoperations/group/searchoperation.mmp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,84 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project definition file for search Feature Plugin operations +* +*/ + +#include +#include +#include "../../group/searchdlluids.hrh" + + +TARGET searchoperation.dll +TARGETTYPE dll +UID XIMP_SEARCH_DLL_UID_STATIC_INTERFACE XIMP_DLL_UID_SEARCH_OPERATION + +CAPABILITY CAP_GENERAL_DLL +VENDORID VID_DEFAULT + +VERSION 10.0 +// --------------------------------------------------------------------------- +SOURCEPATH ../../srcsearchoperations +// --------------------------------------------------------------------------- +//SOURCE operationlaunchcleaner.cpp + +SOURCE searchoperationfactoryimp.cpp + +// --------------------------------------------------------------------------- +SOURCEPATH ../searchop +// --------------------------------------------------------------------------- +// Client - +SOURCE operationsearch.cpp +SOURCE operationhandlesearchresult.cpp +SOURCE operationgetsearchkeys.cpp +SOURCE operationhandlesearchkeys.cpp +// Adaptation - + + +// --------------------------------------------------------------------------- +SOURCEPATH ../../srcutils +// --------------------------------------------------------------------------- +SOURCE searchlogutils.cpp + + +USERINCLUDE ../../srcutils +USERINCLUDE ../../srcsearchdatamodel +USERINCLUDE ../../srcsearchdatamodel/search +USERINCLUDE ../../srcsearchprocessor +USERINCLUDE ../../srcsearchoperations +USERINCLUDE ../searchop + + + +MW_LAYER_SYSTEMINCLUDE + +LIBRARY euser.lib +LIBRARY ecom.lib +LIBRARY estor.lib +LIBRARY ximputils.lib +LIBRARY searchdatamodel.lib +LIBRARY ximpdatamodel.lib +LIBRARY ximpprocessor.lib +LIBRARY searchprocessor.lib +LIBRARY flogger.lib + + +#if defined( ARMCC ) +DEFFILE ../../eabi/ +#elif defined ( WINSCW ) +deffile ../../bwins/ +#endif + +// End of file + diff -r 000000000000 -r e6b17d312c8b imservices/searchfeatureplugin/srcsearchoperations/group/searchoperationshook.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/searchfeatureplugin/srcsearchoperations/group/searchoperationshook.mmp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,61 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project definition file for search Feature Plugin operations hook +* +*/ + + +#include +#include +#include "../../group/searchdlluids.hrh" + + +TARGET searchoperationshook.dll +CAPABILITY CAP_ECOM_PLUGIN +TARGETTYPE PLUGIN +UID XIMP_SEARCH_DLL_UID_ECOM_PLUGIN XIMP_DLL_UID_SEARCH_OPERATIONS_HOOK +VENDORID VID_DEFAULT + +VERSION 10.0 + +SOURCEPATH ../searchoperationshook +START RESOURCE searchoperationshook.rss +TARGET searchoperationshook.rsc +END + + +SOURCEPATH ../searchoperationshook +SOURCE searchoperationshook.cpp + + +USERINCLUDE ../searchoperationshook +USERINCLUDE ../../srcsearchoperations +USERINCLUDE ../../srcsearchdatamodel + + + + +MW_LAYER_SYSTEMINCLUDE + + +LIBRARY euser.lib +LIBRARY searchoperation.lib +LIBRARY ecom.lib + + +#if defined( ARMCC ) +DEFFILE ../../eabi/ +#elif defined ( WINSCW ) +deffile ../../bwins/ +#endif \ No newline at end of file diff -r 000000000000 -r e6b17d312c8b imservices/searchfeatureplugin/srcsearchoperations/searchop/operationgetsearchkeys.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/searchfeatureplugin/srcsearchoperations/searchop/operationgetsearchkeys.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,104 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Concrete get search keys operation + * +*/ + + + +#include +#include +#include +#include "operationgetsearchkeys.h" +#include "ximphost.h" + +#include +#include "protocolsearchdatahostimp.h" +#include "searchlogutils.h" + + + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// COperationGetSearchKeys::COperationGetSearchKeys() +// --------------------------------------------------------------------------- +// +EXPORT_C COperationGetSearchKeys::COperationGetSearchKeys() + { + } +// --------------------------------------------------------------------------- +// COperationGetSearchKeys::ConstructL +// --------------------------------------------------------------------------- +// +void COperationGetSearchKeys::ConstructL( const TDesC8& /*aParamPck*/) + { + XSearchLogger::Log(_L("COperationGetSearchKeys::ConstructL ")); + } + +// --------------------------------------------------------------------------- +// COperationGetSearchKeys::~COperationGetSearchKeys() +// --------------------------------------------------------------------------- +// +COperationGetSearchKeys::~COperationGetSearchKeys() + { + XSearchLogger::Log(_L("COperationGetSearchKeys::~COperationGetSearchKeys Start- End")); + } + + +// --------------------------------------------------------------------------- +// COperationGetSearchKeys::ProcessL() +// --------------------------------------------------------------------------- +// +void COperationGetSearchKeys::ProcessL() + { + XSearchLogger::Log(_L("COperationGetSearchKeys::ProcessL Started")); + CXIMPOperationBase::ProcessL(); + // Call to Adaptation. + MProtocolSearchFeature* srhFeature =static_cast< MProtocolSearchFeature*> + (iMyHost->GetConnection().GetProtocolInterface(MProtocolSearchFeature::KInterfaceId)); + if( srhFeature ) + { + srhFeature->Search().DoGetSearchKeysL( iReqId ); + } + else + { + User::Leave(KErrNotSupported); // if NULL leave : not supported by protocol plugin + } + + XSearchLogger::Log(_L("COperationGetSearchKeys::ProcessL Completed")); + } + +// --------------------------------------------------------------------------- +// COperationGetSearchKeys::RequestCompleted() +// --------------------------------------------------------------------------- +// +void COperationGetSearchKeys::RequestCompletedL() + { + XSearchLogger::Log(_L("COperationGetSearchKeys::RequestCompletedL Started")); + CXIMPOperationBase::RequestCompletedL(); + XSearchLogger::Log(_L("COperationGetSearchKeys::RequestCompletedL Completed")); + } + +// --------------------------------------------------------------------------- +// COperationGetSearchKeys::Type() +// --------------------------------------------------------------------------- +// +TInt COperationGetSearchKeys::Type() const + { + return NSearchOps::EGetSearchKeys; + } + + +// End of file diff -r 000000000000 -r e6b17d312c8b imservices/searchfeatureplugin/srcsearchoperations/searchop/operationgetsearchkeys.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/searchfeatureplugin/srcsearchoperations/searchop/operationgetsearchkeys.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,74 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: get search keys operation header + * +*/ + +#ifndef C_OPERATIONGETSEARCHKEYS_H +#define C_OPERATIONGETSEARCHKEYS_H + +#include +#include + +#include "ximpoperationbase.h" +#include "searchoperationdefs.h" + + +/** + * get search keys operation class + * + * @lib searchoperation.dll + */ +class COperationGetSearchKeys : public CXIMPOperationBase + { + + public: + /** + * constructor + */ + IMPORT_C COperationGetSearchKeys(); + + /** + * 2nd phase constructor + */ + void ConstructL( const TDesC8& aParamPck ); + + /** + * Destructor + */ + ~COperationGetSearchKeys(); + + public: // from CXIMPOperationBase + /** + * + * @see CXIMPOperationBase + */ + void ProcessL(); + + /** + * + * @see CXIMPOperationBase + */ + void RequestCompletedL(); + + /** + * + * @see CXIMPOperationBase + */ + TInt Type() const; + + }; + + +#endif // C_OPERATIONGETSEARCHKEYS_H diff -r 000000000000 -r e6b17d312c8b imservices/searchfeatureplugin/srcsearchoperations/searchop/operationhandlesearchkeys.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/searchfeatureplugin/srcsearchoperations/searchop/operationhandlesearchkeys.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,148 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Concrete handle search keys from protocol plugin operation + * +*/ + + +#include +#include +#include + +#include + +#include "searchinfoimp.h" +#include "operationhandlesearchkeys.h" +#include "ximpoperationbase.h" + +#include "searchdatacacheimp.h" + +#include "ximpobjecthelpers.h" +#include "ximprestrictedobjectcollectionimp.h" +#include "ximpobjectcollectionimp.h" +#include "ximphost.h" + +#include "protocolsearchdatahostimp.h" +#include "searchlogutils.h" +#include "searchdatacacheimp.h" + +#include "ximpsubscriptionitem.h" +#include "searchkeyinfoimp.h" +#include "searchkeyssubscriptionitem.h" + + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// COperationHandleSearchKeys::COperationHandleSearchKeys() +// --------------------------------------------------------------------------- +// +EXPORT_C COperationHandleSearchKeys::COperationHandleSearchKeys() + { + XSearchLogger::Log(_L("COperationHandleSearchKeys::COperationHandleSearchKeys Started")); + XSearchLogger::Log(_L("COperationHandleSearchKeys::COperationHandleSearchKeys Completed")); + } + + +// --------------------------------------------------------------------------- +// COperationHandleSearchKeys::ConstructL() +// --------------------------------------------------------------------------- +// +void COperationHandleSearchKeys::ConstructL( const TDesC8& /*aParamPck */) + { + XSearchLogger::Log(_L("COperationHandleSearchKeys::ConstructL Started")); + iKeyInfoArray=new ( ELeave ) RSearchKeyInfoImpArray; + XSearchLogger::Log(_L("COperationHandleSearchKeys::ConstructL Completed")); + } + +// --------------------------------------------------------------------------- +// COperationHandleSearchKeys::~COperationHandleSearchKeys() +// --------------------------------------------------------------------------- +// +COperationHandleSearchKeys::~COperationHandleSearchKeys() + { + XSearchLogger::Log(_L("COperationHandleSearchKeys::~COperationHandleSearchKeys Started")); + + XSearchLogger::Log(_L("COperationHandleSearchKeys::~COperationHandleSearchKeys Completed")); + } + + +// --------------------------------------------------------------------------- +// COperationHandleSearchKeys::ProcessL() +// --------------------------------------------------------------------------- +// +void COperationHandleSearchKeys::ProcessL() + { + XSearchLogger::Log(_L("COperationHandleSearchKeys::ProcessL Started")); + CXIMPOperationBase::ProcessL(); + MXIMPBase* object = NULL; + TBool force = ETrue; + CXIMPOperationBase::GetObjCollection()->GetByType( object, MXIMPObjectCollection::KInterfaceId ); + + if( object ) + { + MXIMPObjectCollection* objectCollection = static_cast(object->GetInterface(MXIMPObjectCollection::KInterfaceId,MXIMPBase::EPanicIfUnknown)) ; + + CleanupStack::PushL( objectCollection ); + + TLinearOrder< CSearchKeyInfoImp > order( ( CSearchKeyInfoImp::LinearOrder )); + TXIMPObjectMover< MSearchKeyInfo, CSearchKeyInfoImp >:: + MoveFromCollectionToArrayL( *objectCollection, *iKeyInfoArray, order ); + CleanupStack::Pop( objectCollection ); + delete objectCollection; + } + else + { + User::Leave( KErrArgument ); + } + + + CProtocolSearchDataHostImp* srchProtocolHost = + static_cast (iMyHost->GetProtocolHost(MProtocolSearchDataHost::KInterfaceId) ); + + CSearchKeysSubscriptionItem& searchKeySubsItem = + srchProtocolHost->SearchDataCache().SearchKeysSubscriptionItemLC() ; + + + searchKeySubsItem.SetKeyInfoArray( iKeyInfoArray ); // ownership trasferred + iKeyInfoArray=NULL; + + searchKeySubsItem.SynthesiseSubscriptionEventToL( CXIMPOperationBase::GetContext(), force ); + CleanupStack::PopAndDestroy(); // searchKeySubsItem + iMyHost->HandleAdaptationRequestCompleted( iReqId, KErrNone ); + XSearchLogger::Log(_L("COperationHandleSearchKeys::ProcessL Completed")); + } + +// --------------------------------------------------------------------------- +// COperationHandleSearchKeys::RequestCompleted() +// --------------------------------------------------------------------------- +// +void COperationHandleSearchKeys::RequestCompletedL() + { + XSearchLogger::Log(_L("COperationHandleSearchKeys::RequestCompletedL Started")); + CXIMPOperationBase::RequestCompletedL(); + XSearchLogger::Log(_L("COperationHandleSearchKeys::RequestCompletedL Completed")); + } + +// --------------------------------------------------------------------------- +// COperationHandleSearchKeys::Type() +// --------------------------------------------------------------------------- +// +TInt COperationHandleSearchKeys::Type() const + { + return NSearchOps::EHandleSearchKeys; + } + + +// End of file diff -r 000000000000 -r e6b17d312c8b imservices/searchfeatureplugin/srcsearchoperations/searchop/operationhandlesearchkeys.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/searchfeatureplugin/srcsearchoperations/searchop/operationhandlesearchkeys.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,84 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: handle search keys operation + * +*/ + +#ifndef C_OPERATIONHANDLESEARCHKEYS_H +#define C_OPERATIONHANDLESEARCHKEYS_H + +#include +#include + +#include +#include "searchoperationdefs.h" + +#include "searchinfoimp.h" + +#include "searchtypehelpers.h" +/** + * handle search keys operation + * + * @lib searchoperation.dll + */ +class COperationHandleSearchKeys : public CXIMPOperationBase + { + + public: + /** + * constructor + */ + IMPORT_C COperationHandleSearchKeys(); + + /** + * 2nd phase constructor + */ + void ConstructL( const TDesC8& aParamPck ); + + /** + * Destructor + */ + ~COperationHandleSearchKeys(); + + public: // from CXIMPOperationBase + /** + * + * @see CXIMPOperationBase + */ + void ProcessL(); + + /** + * + * @see CXIMPOperationBase + */ + void RequestCompletedL(); + + /** + * + * @see CXIMPOperationBase + */ + TInt Type() const; + + private: // data + + /** + * RSearchKeyInfoImpArray : Not owned + */ + RSearchKeyInfoImpArray* iKeyInfoArray; + + + }; + + +#endif // C_OPERATIONHANDLESEARCHKEYS_H diff -r 000000000000 -r e6b17d312c8b imservices/searchfeatureplugin/srcsearchoperations/searchop/operationhandlesearchresult.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/searchfeatureplugin/srcsearchoperations/searchop/operationhandlesearchresult.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,166 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Concrete handle search result operation + * +*/ + + +#include +#include +#include + +#include + +#include "searchinfoimp.h" +#include "operationhandlesearchresult.h" +#include "ximpoperationbase.h" +#include "ximpidentityimp.h" +#include "searchsubscriptionitem.h" +#include "searchdatacacheimp.h" + +#include "ximpobjecthelpers.h" +#include "ximprestrictedobjectcollectionimp.h" +#include "ximpobjectcollectionimp.h" +#include "ximphost.h" + +#include "protocolsearchdatahostimp.h" +#include "searchlogutils.h" +#include "searchdatacacheimp.h" + +#include "ximpsubscriptionitem.h" + +#include "searchsubscriptionitem.h" + + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// COperationHandleSearchResult::COperationHandleSearchResult() +// --------------------------------------------------------------------------- +// +EXPORT_C COperationHandleSearchResult::COperationHandleSearchResult() + { + XSearchLogger::Log(_L("COperationHandleSearchResult::COperationHandleSearchResult Started")); + XSearchLogger::Log(_L("COperationHandleSearchResult::COperationHandleSearchResult Completed")); + } + + +// --------------------------------------------------------------------------- +// COperationHandleSearchResult::ConstructL() +// --------------------------------------------------------------------------- +// +void COperationHandleSearchResult::ConstructL( const TDesC8& /*aParamPck */) + { + XSearchLogger::Log(_L("COperationHandleSearchResult::ConstructL Started")); + iSearchResults=new ( ELeave ) RSearchInfoImpArray; + XSearchLogger::Log(_L("COperationHandleSearchResult::ConstructL Completed")); + } + +// --------------------------------------------------------------------------- +// COperationHandleSearchResult::~COperationHandleSearchResult() +// --------------------------------------------------------------------------- +// +COperationHandleSearchResult::~COperationHandleSearchResult() + { + XSearchLogger::Log(_L("COperationHandleSearchResult::~COperationHandleSearchResult Started")); + + XSearchLogger::Log(_L("COperationHandleSearchResult::~COperationHandleSearchResult Completed")); + } + + +// --------------------------------------------------------------------------- +// COperationHandleSearchResult::ProcessL() +// --------------------------------------------------------------------------- +// +void COperationHandleSearchResult::ProcessL() + { + XSearchLogger::Log(_L("COperationHandleSearchResult::ProcessL Started")); + CXIMPOperationBase::ProcessL(); + MXIMPBase* object = NULL; + TBool force = ETrue; + CXIMPOperationBase::GetObjCollection()->GetByType( object, MXIMPIdentity::KInterfaceId ); + + if( object ) + { + iSearchId = TXIMPGetImpClassOrPanic< CXIMPIdentityImp >::From( *object ); + } + else + { + User::Leave( KErrArgument ); + } + + object = NULL; + CXIMPOperationBase::GetObjCollection()->GetByType( object, MXIMPObjectCollection::KInterfaceId ); + if( object ) + { + + MXIMPObjectCollection* objectCollection = static_cast(object->GetInterface(MXIMPObjectCollection::KInterfaceId,MXIMPBase::EPanicIfUnknown)) ; + + // CXIMPObjectCollectionImp* objectCollection = + // TXIMPGetImpClassOrPanic< CXIMPObjectCollectionImp >::From( *object ); + CleanupStack::PushL( objectCollection ); + + TLinearOrder< CSearchInfoImp > order( ( CSearchInfoImp::InfoLinearOrder )); + TXIMPObjectMover< MSearchInfo, CSearchInfoImp >:: + MoveFromCollectionToArrayL( *objectCollection, *iSearchResults, order ); + CleanupStack::Pop( objectCollection ); + delete objectCollection; + + } + else + { + User::Leave( KErrArgument ); + } + + CProtocolSearchDataHostImp* srchProtocolHost = + static_cast (iMyHost->GetProtocolHost(MProtocolSearchDataHost::KInterfaceId) ); + + CSearchSubscriptionItem& searchSubsItem = + srchProtocolHost->SearchDataCache().SearchSubscriptionItemLC() ; + + + searchSubsItem.SetSearchResults(iSearchResults); // ownership trasferred + searchSubsItem.SetSearchIdL(*iSearchId);// ownership trasferred + + iSearchResults=NULL; + iSearchId=NULL; + + searchSubsItem.SynthesiseSubscriptionEventToL( CXIMPOperationBase::GetContext(), force ); + CleanupStack::PopAndDestroy(); // searchItem + iMyHost->HandleAdaptationRequestCompleted( iReqId, KErrNone ); + XSearchLogger::Log(_L("COperationHandleSearchResult::ProcessL Completed")); + } + +// --------------------------------------------------------------------------- +// COperationHandleSearchResult::RequestCompleted() +// --------------------------------------------------------------------------- +// +void COperationHandleSearchResult::RequestCompletedL() + { + XSearchLogger::Log(_L("COperationHandleSearchResult::RequestCompletedL Started")); + CXIMPOperationBase::RequestCompletedL(); + XSearchLogger::Log(_L("COperationHandleSearchResult::RequestCompletedL Completed")); + } + +// --------------------------------------------------------------------------- +// COperationHandleSearchResult::Type() +// --------------------------------------------------------------------------- +// +TInt COperationHandleSearchResult::Type() const + { + return NSearchOps::EHandleSearchResults; + } + + +// End of file diff -r 000000000000 -r e6b17d312c8b imservices/searchfeatureplugin/srcsearchoperations/searchop/operationhandlesearchresult.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/searchfeatureplugin/srcsearchoperations/searchop/operationhandlesearchresult.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,91 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: handle search result operation + * +*/ + +#ifndef C_OPERATIONHANDLESEARCHRESULT_H +#define C_OPERATIONHANDLESEARCHRESULT_H + +#include +#include + +#include +#include "searchoperationdefs.h" + +#include "searchinfoimp.h" + +#include "searchtypehelpers.h" +/** + * handle search result operation + * + * @lib searchoperation.dll + */ +class COperationHandleSearchResult : public CXIMPOperationBase + { + + public: + /** + * constructor + */ + IMPORT_C COperationHandleSearchResult(); + + /** + * 2nd phase constructor + */ + void ConstructL( const TDesC8& aParamPck ); + + /** + * Destructor + */ + ~COperationHandleSearchResult(); + + public: // from CXIMPOperationBase + /** + * + * @see CXIMPOperationBase + */ + void ProcessL(); + + /** + * + * @see CXIMPOperationBase + */ + void RequestCompletedL(); + + /** + * + * @see CXIMPOperationBase + */ + TInt Type() const; + + private: // data + + /** + * CXIMPIdentityImp : Not owned + */ + + CXIMPIdentityImp* iSearchId; + + /** + * RSearchInfoImpArray : Not owned + */ + + RSearchInfoImpArray* iSearchResults; + + + }; + + +#endif // C_OPERATIONHANDLESEARCHRESULT_H diff -r 000000000000 -r e6b17d312c8b imservices/searchfeatureplugin/srcsearchoperations/searchop/operationsearch.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/searchfeatureplugin/srcsearchoperations/searchop/operationsearch.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,139 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Concrete search operation + * +*/ + + + +#include +#include +#include +#include "searchelementimp.h" +#include "operationsearch.h" +#include "ximpobjecthelpers.h" +#include +#include "ximphost.h" + +#include +#include "protocolsearchdatahostimp.h" +#include "searchlogutils.h" +#include + +#include + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// COperationSearch::COperationSearch() +// --------------------------------------------------------------------------- +// +EXPORT_C COperationSearch::COperationSearch() + { + } +// --------------------------------------------------------------------------- +// COperationSearch::ConstructL +// --------------------------------------------------------------------------- +// +void COperationSearch::ConstructL( const TDesC8& aParamPck ) + { + XSearchLogger::Log(_L("COperationSearch::ConstructL Started")); + + RDesReadStream rs; + CleanupClosePushL( rs ); + rs.Open( aParamPck ); // CSI: 65 # + + + iSearchId = CXIMPIdentityImp::NewLC(); + CleanupStack::Pop( iSearchId ); + iSearchId->InternalizeL( rs ); + + // read the object count + TInt objCount( rs.ReadInt32L() ); + + for ( TInt count = 0; count < objCount; count++ ) + { + // instantiate new object + CSearchElementImp* theObject = CSearchElementImp::NewLC(); + // extract its data + theObject->InternalizeL( rs ); + // append it to the object array + iSearchList.AppendL( theObject ); + CleanupStack::Pop( theObject ); // theObject + } + + iSearchLimit = rs.ReadInt32L(); + CleanupStack::PopAndDestroy(); // rs + + + XSearchLogger::Log(_L("COperationSearch::ConstructL Completed")); + } + +// --------------------------------------------------------------------------- +// COperationSearch::~COperationSearch() +// --------------------------------------------------------------------------- +// +COperationSearch::~COperationSearch() + { + XSearchLogger::Log(_L("COperationSearch::~COperationSearch Started")); + delete iSearchId; + iSearchList.ResetAndDestroy(); + XSearchLogger::Log(_L("COperationSearch::~COperationSearch Completed")); + } + + +// --------------------------------------------------------------------------- +// COperationSearch::ProcessL() +// --------------------------------------------------------------------------- +// +void COperationSearch::ProcessL() + { + XSearchLogger::Log(_L("COperationSearch::ProcessL Started")); + CXIMPOperationBase::ProcessL(); + // Call to Adaptation. + MProtocolSearchFeature* srhFeature =static_cast< MProtocolSearchFeature*> + (iMyHost->GetConnection().GetProtocolInterface(MProtocolSearchFeature::KInterfaceId)); + if( srhFeature ) + { + srhFeature->Search().DoSearchL(*iSearchId, iSearchList,iSearchLimit,iReqId ); + } + else + { + User::Leave( KErrNotSupported ); // if NULL leave : not supported by protocol plugin + } + XSearchLogger::Log(_L("COperationSearch::ProcessL Completed")); + } + +// --------------------------------------------------------------------------- +// COperationSearch::RequestCompleted() +// --------------------------------------------------------------------------- +// +void COperationSearch::RequestCompletedL() + { + XSearchLogger::Log(_L("COperationSearch::RequestCompletedL Started")); + CXIMPOperationBase::RequestCompletedL(); + XSearchLogger::Log(_L("COperationSearch::RequestCompletedL Completed")); + } + +// --------------------------------------------------------------------------- +// COperationSearch::Type() +// --------------------------------------------------------------------------- +// +TInt COperationSearch::Type() const + { + return NSearchOps::ESearch; + } + + +// End of file diff -r 000000000000 -r e6b17d312c8b imservices/searchfeatureplugin/srcsearchoperations/searchop/operationsearch.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/searchfeatureplugin/srcsearchoperations/searchop/operationsearch.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,93 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: search operation + * +*/ + +#ifndef C_OPERATIONSEARCH_H +#define C_OPERATIONSEARCH_H + +#include +#include + +#include "ximpoperationbase.h" +#include "searchoperationdefs.h" + +#include + +class MsearchElement; +class CSearchElementImp; +class CXIMPIdentityImp; +/** + * search operation + * + * @lib searchoperation.dll + */ +class COperationSearch : public CXIMPOperationBase + { + + public: + /** + * constructor + */ + IMPORT_C COperationSearch(); + + /** + * 2nd phase constructor + */ + void ConstructL( const TDesC8& aParamPck ); + + /** + * Destructor + */ + ~COperationSearch(); + + public: // from CXIMPOperationBase + /** + * + * @see CXIMPOperationBase + */ + void ProcessL(); + + /** + * + * @see CXIMPOperationBase + */ + void RequestCompletedL(); + + /** + * + * @see CXIMPOperationBase + */ + TInt Type() const; + + private: // data + + /** + * array of MSearchElement : Owned + */ + RPointerArray iSearchList; + /** + * CXIMPIdentityImp : Owned + */ + CXIMPIdentityImp* iSearchId; + + /** + * serachlimit + */ + TInt iSearchLimit; + }; + + +#endif // C_OPERATIONSEARCH_H diff -r 000000000000 -r e6b17d312c8b imservices/searchfeatureplugin/srcsearchoperations/searchoperationdefs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/searchfeatureplugin/srcsearchoperations/searchoperationdefs.h Thu Dec 17 08:54:49 2009 +0200 @@ -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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP framework SEARCH operation definitions. + * +*/ + +#ifndef SEARCHOPERATIONDEFS_H +#define SEARCHOPERATIONDEFS_H + +#include + + + +namespace NSearchOps + { + enum TSearchOpTypes + { + + ESearch = 300, + EHandleSearchResults, + ESearchCleaner, + EGetSearchKeys, + EHandleSearchKeys + }; + } + +#endif //SEARCHOPERATIONDEFS_H + + + + + diff -r 000000000000 -r e6b17d312c8b imservices/searchfeatureplugin/srcsearchoperations/searchoperationfactoryimp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/searchfeatureplugin/srcsearchoperations/searchoperationfactoryimp.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,123 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Search Service operation factory + * +*/ + + +#include "searchoperationfactoryimp.h" + +#include "searchlogutils.h" +#include "searchoperationdefs.h" +#include "operationsearch.h" +#include "operationhandlesearchresult.h" +#include "operationgetsearchkeys.h" +#include "operationhandlesearchkeys.h" + +using namespace NSearchOps; + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CXIMPOperationFactory::NewL() +// +// ----------------------------------------------------------------------------- +// +EXPORT_C CSearchOperationFactory* CSearchOperationFactory::NewL() + { + XSearchLogger::Log(_L("CSearchOperationFactory::NewL Started")); + CSearchOperationFactory* self = new ( ELeave ) CSearchOperationFactory(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + XSearchLogger::Log(_L("CSearchOperationFactory::NewL Completed")); + return self; + } + +// ----------------------------------------------------------------------------- +// CXIMPOperationFactory::CXIMPOperationFactory() +// ----------------------------------------------------------------------------- +// +CSearchOperationFactory::CSearchOperationFactory() + { + } + +// ----------------------------------------------------------------------------- +// CXIMPOperationFactory::~CXIMPOperationFactory() +// ----------------------------------------------------------------------------- +// +CSearchOperationFactory::~CSearchOperationFactory() + { + XSearchLogger::Log(_L("CSearchOperationFactory::~CSearchOperationFactory Started")); + XSearchLogger::Log(_L("CSearchOperationFactory::~CSearchOperationFactory Completed")); + } + + +// ----------------------------------------------------------------------------- +// CXIMPOperationFactory::ConstructL() +// ----------------------------------------------------------------------------- +// +void CSearchOperationFactory::ConstructL() + { + XSearchLogger::Log(_L("CSearchOperationFactory::ConstructL Started")); + XSearchLogger::Log(_L("CSearchOperationFactory::ConstructL Completed")); + } + + +// ----------------------------------------------------------------------------- +// CXIMPOperationFactory::CreateOperationL() +// ----------------------------------------------------------------------------- +// +CXIMPOperationBase* CSearchOperationFactory::CreateOperationL( TInt aOperation ) + { + XSearchLogger::Log(_L("CSearchOperationFactory::CreateOperationL Started")); + CXIMPOperationBase* op = NULL; + NSearchOps::TSearchOpTypes operation = ( NSearchOps::TSearchOpTypes ) aOperation; + switch( operation ) + { + case ESearch: + { + XSearchLogger::Log(_L("CSearchOperationFactory::CreateOperationL = ESearch")); + op = new ( ELeave ) COperationSearch(); + break; + } + case EHandleSearchResults: + { + XSearchLogger::Log(_L("CSearchOperationFactory::CreateOperationL = EHandleSearchResults")); + op = new ( ELeave ) COperationHandleSearchResult(); + break; + } + case EGetSearchKeys: + { + XSearchLogger::Log(_L("CSearchOperationFactory::CreateOperationL = EGetSearchKeys")); + op = new ( ELeave ) COperationGetSearchKeys(); + break; + } + case EHandleSearchKeys: + { + XSearchLogger::Log(_L("CSearchOperationFactory::CreateOperationL = EHandleSearchKeys")); + op = new ( ELeave ) COperationHandleSearchKeys(); + break; + } + default: + { + break; + } + } + XSearchLogger::Log(_L("CSearchOperationFactory::CreateOperationL Completed")); + return op; + } +// End of file + + diff -r 000000000000 -r e6b17d312c8b imservices/searchfeatureplugin/srcsearchoperations/searchoperationfactoryimp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/searchfeatureplugin/srcsearchoperations/searchoperationfactoryimp.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,80 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Search Service operation factory + * +*/ + + +#ifndef SEARCHOPERATIONFACTORYIMP_H +#define SEARCHOPERATIONFACTORYIMP_H + + +#include +#include +#include "searchapiobjbase.h" + +class CXIMPOperationBase; + +/** + * Operation factory + * + * @lib searchoperation.dll + */ + +NONSHARABLE_CLASS(CSearchOperationFactory): public MXIMPOperationFactory1 + { + + public: + /** The class ID. */ + enum { KClassId = IMP_CLSID_CSEARCHOPERATIONFACTORYIMP }; + + + public: // Construction and desctruction + + /** + * Construction :NewL + */ + IMPORT_C static CSearchOperationFactory* NewL(); + + /** + * Destructor + */ + virtual ~CSearchOperationFactory(); + + private: // Construction + + /** + * C++ default constructor. + */ + CSearchOperationFactory(); + + /** + * Symbian 2nd phase constructor + */ + void ConstructL(); + + + public: // From MXIMPOperationFactory1 + + /** + * @see MXIMPOperationFactory1 + */ + CXIMPOperationBase* CreateOperationL( TInt aOperation ); + + + + }; + +#endif // SEARCHCOPERATIONFACTORYIMP_H + diff -r 000000000000 -r e6b17d312c8b imservices/searchfeatureplugin/srcsearchoperations/searchoperationshook/searchoperationshook.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/searchfeatureplugin/srcsearchoperations/searchoperationshook/searchoperationshook.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,44 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework's search operations Hook implementation. +* +*/ + + +#include +#include +#include +#include "searchoperationfactoryimp.h" +// --------------------------------------------------------------------------- +// Key value pair table to identify correct constructor +// function for the requested interface. +// --------------------------------------------------------------------------- +// +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY( XIMP_ECOM_IMPL_UID_SEARCH_OPERATION_INTERFACE, + CSearchOperationFactory::NewL) + }; + + +// --------------------------------------------------------------------------- +// Exported function to return the implementation proxy table +// --------------------------------------------------------------------------- +// +EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount ) + { + aTableCount = sizeof( ImplementationTable ) / sizeof( TImplementationProxy ); + return ImplementationTable; + } + diff -r 000000000000 -r e6b17d312c8b imservices/searchfeatureplugin/srcsearchoperations/searchoperationshook/searchoperationshook.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/searchfeatureplugin/srcsearchoperations/searchoperationshook/searchoperationshook.rss Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,54 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ECom registery info for ECom serach operation hook +* +*/ + + +#include +#include +#include +#include + + + +// --------------------------------------------------------------------------- +// ECom registery info for XIMP search operation ECom hook +// --------------------------------------------------------------------------- +// +RESOURCE REGISTRY_INFO theInfo + { + resource_format_version = RESOURCE_FORMAT_VERSION_2; + dll_uid = XIMP_DLL_UID_SEARCH_OPERATIONS_HOOK; + + interfaces = + { + INTERFACE_INFO + { + interface_uid = XIMP_ECOM_IF_UID_OPERATIONS_INTERFACE; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = XIMP_ECOM_IMPL_UID_SEARCH_OPERATION_INTERFACE; + version_no = 1; + display_name = "S60 Default XIMP"; + default_data = "default"; + opaque_data = ""; + } + }; + } + }; + } + diff -r 000000000000 -r e6b17d312c8b imservices/searchfeatureplugin/srcsearchoperations/ximpobjectcollectionimp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/searchfeatureplugin/srcsearchoperations/ximpobjectcollectionimp.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,176 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Object collection implementation. + * +*/ + +#ifndef XIMPOBJECTCOLLECTIONIMP_H +#define XIMPOBJECTCOLLECTIONIMP_H + +#include "ximpapiobjbase.h" +#include +#include + + +/** + * Object collection implementation. + * + * @see MXIMPObjectCollection + * @ingroup ximpdatamodelapi + * @since S60 v3.2 + */ +class CXIMPObjectCollectionImp : public CXIMPApiObjBase, + public MXIMPObjectCollection + { + +private: // helper class + + class CXIMPCollectionElement : public CBase + { + public: + + static CXIMPCollectionElement* NewL( CXIMPApiObjBase* aObject, const TDesC8& aName ); + ~CXIMPCollectionElement(); + + /** + * Get the stored object. Ownership transferred + * to the caller. + * @param The stored object + */ + CXIMPApiObjBase* GetObject(); + + private: + + CXIMPCollectionElement(); + void ConstructL( CXIMPApiObjBase* aObject, const TDesC8& aName ); + + public: + // owns: the object + CXIMPApiObjBase* iObject; + + // owns: the name (always valid, but can be empty) + HBufC8* iName; + }; + +public: + + /** The class ID. */ + enum { KClassId = XIMPIMP_CLSID_CXIMPOBJECTCOLLECTIONIMP }; + +public: + + IMPORT_C static CXIMPObjectCollectionImp* NewLC(); + IMPORT_C static CXIMPObjectCollectionImp* NewL(); + +public: + + /** + * Destruction + */ + ~CXIMPObjectCollectionImp(); + + +private: + + CXIMPObjectCollectionImp(); + + +public: // From MXIMPBase + + /** + * Implementation of MXIMPBase interface methods + * @see MXIMPBase + */ + XIMPIMP_DECLARE_IF_BASE_METHODS + +public: // from MXIMPObjectCollection + + // object lookup + + /** + * @see MXIMPObjectCollection + */ + void LookupByType( + const MXIMPBase*& aObject, + TInt32 aInterfaceId ) const; + + /** + * @see MXIMPObjectCollection + */ + void LookupByTypeAndName( + const MXIMPBase*& aObject, + TInt32 aInterfaceId, + const TDesC8& aMatch ) const; + + // set management + + /** + * @see MXIMPObjectCollection + */ + void AddObjectL( + MXIMPBase* aObject ); + + /** + * @see MXIMPObjectCollection + */ + void AddObjectWithNameL( + MXIMPBase* aObject, + const TDesC8& aName ); + + + /** + * @see MXIMPObjectCollection + */ + TBool GetByType( + MXIMPBase*& aObject, + TInt32 aInterfaceId ); + + /** + * @see MXIMPObjectCollection + */ + TBool GetByTypeAndName( + MXIMPBase*& aObject, + TInt32 aInterfaceId, + const TDesC8& aMatch ); + +private: // helpers + + /** + * Find the index of the least recently used + * object. Since the internal array is LIFO, + * we walk the array forwards to find the index of + * least recently used object. + * @param aObject The object from which to start + * @return The index + */ + TInt FindLRUIndex( const MXIMPBase*& aObject ) const; + + /** + * Validate a given name. Checks that wildcard characters do not exist. + * @return KErrNone if the name is OK, KErrBadName otherwise + */ + TInt ValidateName( const TDesC8& aName ) const; + +private: // data + + /** + * OWN: Objects + */ + RXIMPObjOwningPtrArray< CXIMPCollectionElement > iCollection; + + }; + + +#endif // XIMPOBJECTCOLLECTIONIMP_H + diff -r 000000000000 -r e6b17d312c8b imservices/searchfeatureplugin/srcsearchoperations/ximprequestcompleteeventimp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/searchfeatureplugin/srcsearchoperations/ximprequestcompleteeventimp.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,149 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MXIMPRequestCompleteEvent API object implementation. +* +*/ + +#ifndef CXIMPREQUESTCOMPLETEEVENTIMP_H +#define CXIMPREQUESTCOMPLETEEVENTIMP_H + +#include "ximpapieventbase.h" +#include "ximptypehelpers.h" +#include + +class RWriteStream; +class RReadStream; +class CXIMPStatusImp; +class MXIMPStatus; +class CXIMPApiDataObjBase; + + +/** + * MXIMPRequestCompleteEvent API object implementation. + * + * @lib ximpdatamodel.dll + * @since S60 v3.2 + */ +NONSHARABLE_CLASS( CXIMPRequestCompleteEventImp ): + public CXIMPApiEventBase, + public MXIMPRequestCompleteEvent + { + public: + /** The class ID. */ + enum { KClassId = XIMPIMP_CLSID_CXIMPREQUESTCOMPLETEEVENTIMP }; + +public: + + /** + * Exported instantiation method for initializing + * new event object. + */ + IMPORT_C static CXIMPRequestCompleteEventImp* NewL(); + IMPORT_C static CXIMPRequestCompleteEventImp* NewLC( + TXIMPRequestId& aRequestId, TInt aDefaultErrorValue = KErrNone ); + + + /** + * Instantiation method for event automation. + * Method signature must be exactly this to work + * with event delivery automation system. + * + * Event implementation must be registered to + * XIMPEventCodec KXIMPEventConstructorTable. + */ + static CXIMPApiEventBase* NewFromStreamLC( RReadStream& aStream ); + + + virtual ~CXIMPRequestCompleteEventImp(); + +private: + CXIMPRequestCompleteEventImp( TXIMPRequestId& aRequestId ); + CXIMPRequestCompleteEventImp(); + void ConstructL( TInt aDefaultErrorValue ); + void ConstructL( RReadStream& aStream ); + +public: // From MXIMPRequestCompleteEvent + + /** + * Implementation of MXIMPRequestCompleteEvent interface methods + * @see MXIMPRequestCompleteEvent + */ + const TXIMPRequestId& RequestId() const; + const MXIMPStatus& CompletionResult() const; + const MXIMPBase* LookupCompletionDataByType( TInt32 aInterfaceId ) const; + + +public: + + /** + * Set request id + * @param aRequestId New requestId. + */ + IMPORT_C void SetRequestId( const TXIMPRequestId& aRequestId ); + + /** + * Add data object as a parameter to this event. Ownership + * transferred. + * @param aObj The fully constructed data object to add + */ + IMPORT_C void AppendParamL( CXIMPApiDataObjBase* aObj ); + + + IMPORT_C CXIMPStatusImp& CompletionResultImp(); + +public: // From API base interfaces + + /** + * Implementation of MXIMPBase interface methods + * @see MXIMPBase + */ + XIMPIMP_DECLARE_IF_BASE_METHODS + + + /** + * Implementation of MXIMPEventBase interface and + * CXIMPApiEventBase methods + * + * @see MXIMPEventBase + * @see CXIMPApiEventBase + */ + XIMPIMP_DECLARE_EVENT_BASE_METHODS + +private: // data + + /** + * Completed request. + * Own. + */ + TXIMPRequestId iReqId; + + + /** + * Request result. + * This is set to KErrNoMemory for default value. + * Reason for that is error handling in low memory situation + * CXIMPEventCapsule will send KErrNoMemory version of event if + * event cannot be updated because of low memory. + * Own. + */ + CXIMPStatusImp* iResult; + + /** + * Array of params + */ + RPrReqParamArray iParamArray; + }; + + +#endif // CXIMPREQUESTCOMPLETEEVENTIMP_H diff -r 000000000000 -r e6b17d312c8b imservices/searchfeatureplugin/srcsearchoperations/ximprestrictedobjectcollectionimp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/searchfeatureplugin/srcsearchoperations/ximprestrictedobjectcollectionimp.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,129 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MXIMPRestrictedObjectCollection implementation +* +*/ + +#ifndef CXIMPRESTRICTEDOBJECTCOLLECTIONIMP_H +#define CXIMPRESTRICTEDOBJECTCOLLECTIONIMP_H + +#include +#include +#include "ximpapiobjbase.h" + + +/** + * + * @since S60 v3.2 + */ +class CXIMPRestrictedObjectCollectionImp : public CXIMPApiObjBase, + public MXIMPRestrictedObjectCollection + { +public: + + /** The class ID. */ + enum { KClassId = XIMPIMP_CLSID_CXIMPRESTRICTEDOBJECTCOLLECTIONIMP }; + +public: + + /* + * Construction of instance + * @param aObjectOwning. ETrue objects are owned by instance. + * EFalse objects are not owned by instance. + * Default = ETrue + */ + IMPORT_C static CXIMPRestrictedObjectCollectionImp* NewLC( TBool aObjectOwning = ETrue ); + + /* + * Construction of instance + * @param aObjectOwning. ETrue objects are owned by instance. + * EFalse objects are not owned by instance. + * Default = ETrue + */ + IMPORT_C static CXIMPRestrictedObjectCollectionImp* NewL( TBool aObjectOwning = ETrue ); + + +public: + + /** + * Destruction + */ + ~CXIMPRestrictedObjectCollectionImp(); + + +private: + + /** + * Construction + * @param aObjectOwning. ETrue objects are owned by instance. + * EFalse objects are not owned by instance. + */ + CXIMPRestrictedObjectCollectionImp( TBool aObjectOwning ); + + +public: // From MXIMPBase + + /** + * Implementation of MXIMPBase interface methods + * @see MXIMPBase + */ + XIMPIMP_DECLARE_IF_BASE_METHODS + +public: // From MXIMPRestrictedObjectCollection + + void LookupByType( const MXIMPBase*& aObject, TInt32 aInterfaceId ) const; + void AddOrReplaceTypeL( MXIMPBase* aObject ); + void GetByType( MXIMPBase*& aObject, TInt32 aInterfaceId ); + + + +public: // New methods + + /** + * Set object ownership + * @param aObjectOwning. ETrue objects are owned by instance. + * EFalse objects are not owned by instance. + * Default = ETrue + */ + IMPORT_C void SetObjectOwnership( TBool aObjectOwning = ETrue ); + +private: // Helpers + static TInt OrderIfIdAndApiObject( const TInt32* aIfId, + const CXIMPApiObjBase& aRhs ); + + static TInt OrderApiObjects( const CXIMPApiObjBase& aLhs, + const CXIMPApiObjBase& aRhs ); + + + +private: // data + + /** + * Owning of objects. ETrue, Owns, EFalse does not own. + */ + TBool iOwnObjects; + + /** + * OWN: Check iOwnObjects + */ + RXIMPObjOwningPtrArray< CXIMPApiObjBase > iApiObjects; + + }; + + +#endif // CXIMPRESTRICTEDOBJECTCOLLECTIONIMP_H + + + + diff -r 000000000000 -r e6b17d312c8b imservices/searchfeatureplugin/srcsearchprocessor/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/searchfeatureplugin/srcsearchprocessor/group/bld.inf Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Build information file for project Search Feature Plugin +* +*/ + + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +PRJ_MMPFILES +searchprocessor.mmp +searchprocessorhook.mmp + + +PRJ_TESTMMPFILES + +PRJ_TESTEXPORTS + diff -r 000000000000 -r e6b17d312c8b imservices/searchfeatureplugin/srcsearchprocessor/group/searchprocessor.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/searchfeatureplugin/srcsearchprocessor/group/searchprocessor.mmp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,73 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project definition file for search Feature Plugin processor +* +*/ + +#include +#include +#include "../../group/searchdlluids.hrh" + + +TARGET searchprocessor.dll +TARGETTYPE dll +UID XIMP_SEARCH_DLL_UID_STATIC_INTERFACE XIMP_DLL_UID_SEARCH_PROCESSOR + +CAPABILITY CAP_GENERAL_DLL +VENDORID VID_DEFAULT + +VERSION 10.0 + +SOURCEPATH ../../srcsearchprocessor +SOURCE protocoldatahostimp.cpp +SOURCE protocolsearchdatahostimp.cpp + +SOURCEPATH ../searchdatahost +SOURCE protocolsearchfeaturedatahostimp.cpp + +SOURCEPATH ../../srcutils +SOURCE searchlogutils.cpp + + + +USERINCLUDE ../../group +USERINCLUDE ../../srcsearchprocessor +USERINCLUDE ../../srcsearchoperations +USERINCLUDE ../../srcsearchdatamodel +USERINCLUDE ../../srcutils +USERINCLUDE ../searchdatahost + + +MW_LAYER_SYSTEMINCLUDE + + +LIBRARY euser.lib +LIBRARY ecom.lib +LIBRARY estor.lib +LIBRARY centralrepository.lib +LIBRARY bafl.lib +LIBRARY ximputils.lib +LIBRARY ximpdatamodel.lib +LIBRARY searchdatamodel.lib +LIBRARY flogger.lib + +//EXPORTUNFROZEN + +#if defined( ARMCC ) +DEFFILE ../../eabi/ +#elif defined ( WINSCW ) +deffile ../../bwins/ +#endif + +// End of file diff -r 000000000000 -r e6b17d312c8b imservices/searchfeatureplugin/srcsearchprocessor/group/searchprocessorhook.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/searchfeatureplugin/srcsearchprocessor/group/searchprocessorhook.mmp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,61 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project definition file for search Feature Plugin processor hook +* +*/ + + +#include +#include +#include "../../group/searchdlluids.hrh" + + +TARGET searchprocessorhook.dll +CAPABILITY CAP_ECOM_PLUGIN +TARGETTYPE PLUGIN +UID XIMP_SEARCH_DLL_UID_ECOM_PLUGIN XIMP_DLL_UID_SEARCH_PROCESSOR_HOOK +VENDORID VID_DEFAULT + +VERSION 10.0 + +SOURCEPATH ../searchprocessorhook +START RESOURCE searchprocessorhook.rss +TARGET searchprocessorhook.rsc +END + + +SOURCEPATH ../searchprocessorhook +SOURCE searchprocessorhook.cpp + + +USERINCLUDE ../../group +USERINCLUDE ../searchprocessorhook +USERINCLUDE ../../srcsearchdatamodel +USERINCLUDE ../../srcsearchprocessor + + + +MW_LAYER_SYSTEMINCLUDE + + +LIBRARY euser.lib +LIBRARY searchprocessor.lib +LIBRARY ecom.lib + + +#if defined( ARMCC ) +DEFFILE ../../eabi/ +#elif defined ( WINSCW ) +deffile ../../bwins/ +#endif \ No newline at end of file diff -r 000000000000 -r e6b17d312c8b imservices/searchfeatureplugin/srcsearchprocessor/protocoldatahostimp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/searchfeatureplugin/srcsearchprocessor/protocoldatahostimp.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,152 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of protocol data host + * +*/ + + + +#include +#include +#include +#include + +#include "ximpapiobjbase.h" +#include "searchapiobjbase.h" +#include "searchobjectfactoryimp.h" + +#include "protocoldatahostimp.h" +#include "protocolsearchdatahostimp.h" +#include "protocolsearchfeaturedatahostimp.h" +#include "searchlogutils.h" + +#include "searchoperationdefs.h" + +// ======== MEMBER FUNCTIONS ======== + + +// This should be variated. Branding variation can be one +// possibility. One is to leave adaptation deside how soon +// cleanup will be done. +// Now 5 sec used for testing purposes. Better value could be +// some minutes. + +// --------------------------------------------------------------------------- +// CProtocolDataHostImp::CProtocolDataHostImp() +// --------------------------------------------------------------------------- +// +CProtocolDataHostImp::CProtocolDataHostImp( MXIMPHost& aHost ) +:iHost( aHost ) + { + XSearchLogger::Log(_L("CProtocolDataHostImp::CProtocolDataHostImp Started")); + XSearchLogger::Log(_L("CProtocolDataHostImp::CProtocolDataHostImp Completed")); + } + + +// --------------------------------------------------------------------------- +// CProtocolDataHostImp::ConstructL() +// --------------------------------------------------------------------------- +// +void CProtocolDataHostImp::ConstructL() + { + XSearchLogger::Log(_L("CProtocolDataHostImp::ConstructL Started")); + iSearchDataHost = CProtocolSearchDataHostImp::NewL(iHost) ; + XSearchLogger::Log(_L("CProtocolDataHostImp::ConstructL Completed")); + } + + +// --------------------------------------------------------------------------- +// CProtocolDataHostImp::NewLC() +// --------------------------------------------------------------------------- +// +EXPORT_C CProtocolDataHostImp* CProtocolDataHostImp::NewLC( MXIMPHost& aHost ) + { + XSearchLogger::Log(_L("CProtocolDataHostImp::NewLC Started")); + CProtocolDataHostImp* self = new( ELeave ) CProtocolDataHostImp( aHost ); + CleanupStack::PushL( self ); + self->ConstructL(); + XSearchLogger::Log(_L("CProtocolDataHostImp::NewLC Completed")); + return self; + } + +// --------------------------------------------------------------------------- +// CProtocolDataHostImp::NewL() +// --------------------------------------------------------------------------- +// +EXPORT_C CProtocolDataHostImp* CProtocolDataHostImp::NewL( MXIMPHost& aHost ) + { + XSearchLogger::Log(_L("CProtocolDataHostImp::NewL Started")); + CProtocolDataHostImp* self = new( ELeave ) CProtocolDataHostImp( aHost ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + XSearchLogger::Log(_L("CProtocolDataHostImp::NewL Completed")); + return self; + } +// --------------------------------------------------------------------------- +// CProtocolDataHostImp::~CProtocolDataHostImp() +// --------------------------------------------------------------------------- +// +CProtocolDataHostImp::~CProtocolDataHostImp() + { + XSearchLogger::Log(_L("CProtocolDataHostImp::~CProtocolDataHostImp Started")); + delete iSearchDataHost ; + XSearchLogger::Log(_L("CProtocolDataHostImp::~CProtocolDataHostImp Completed")); + } + +// --------------------------------------------------------------------------- +// CProtocolDataHostImp::SetHostToProtocol() +// --------------------------------------------------------------------------- +// +void CProtocolDataHostImp::SetHostToProtocol() + { + MProtocolSearchFeature* searchProtocolFeature = static_cast< MProtocolSearchFeature*> + (iHost.GetConnection().GetProtocolInterface(MProtocolSearchFeature::KInterfaceId) ); + + if(searchProtocolFeature ) + { + searchProtocolFeature->SetHost(*iSearchDataHost); + } + + } + +// --------------------------------------------------------------------------- +// CProtocolDataHostImp::GetInterface() +// --------------------------------------------------------------------------- +// +TAny* CProtocolDataHostImp::GetInterface(TInt aInterfaceId) + { + if(aInterfaceId == MProtocolSearchDataHost::KInterfaceId ) + { + return iSearchDataHost ; + } + + else + { + return NULL ; + } + + } + +// --------------------------------------------------------------------------- +// CProtocolDataHostImp::GetCleanupOperation() +// --------------------------------------------------------------------------- +// +TInt CProtocolDataHostImp::GetCleanupOperation() + { + return NSearchOps::ESearchCleaner ; // return cleaner operation : + // BUT NO CLEANING IS IMPLEMENTED IN SERACH PLUGIN ( NOT REQUIRED) + } +// End of file + diff -r 000000000000 -r e6b17d312c8b imservices/searchfeatureplugin/srcsearchprocessor/protocoldatahostimp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/searchfeatureplugin/srcsearchprocessor/protocoldatahostimp.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,117 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: protcol datahost imp header + * +*/ + +#ifndef CPROTOCOLDATAHOSTIMP_H +#define CPROTOCOLDATAHOSTIMP_H + +#include +#include +#include +#include "searchapiobjbase.h" +#include "ximpapiobjbase.h" + +#include "ximphost.h" + +class MXIMPHost; +class MImObjectFactory; +class CImObjectFactoryImp; + +class CXIMPPscContext; +class MImDataCache; +class CImDataCache; +class CXIMPContextStateEventImp; +class CPeriodic; +class MXIMPProtocolConnection; +class CProtocolImConversationDataHostImp; +class CXIMPOperationBase ; + +class CProtocolSearchDataHostImp ; + +/** + * protocol data host for serach + * + * @lib searchprocessor.dll + */ + +NONSHARABLE_CLASS(CProtocolDataHostImp): public MProtocolDataHost + { + + public: + /** The class ID. */ + enum { KClassId = IMP_CLSID_CPROTOCOLSEARCHDATAHOSTIMP }; + + public: + /** + * Construction :NewL + */ + IMPORT_C static CProtocolDataHostImp* NewL( MXIMPHost& aHost ); + + /** + * Construction :NewL + */ + IMPORT_C static CProtocolDataHostImp* NewLC( MXIMPHost& aHost ); + + /** + * Destructor + */ + virtual ~CProtocolDataHostImp(); + + private: + /** + * constructor + */ + CProtocolDataHostImp( MXIMPHost& aHost ); + + /** + * 2nd phase constructor + */ + void ConstructL(); + + public: // MProtocolDataHost + /** + * + * @see MProtocolDataHost + */ + void SetHostToProtocol() ; + /** + * + * @see MProtocolDataHost + */ + TAny* GetInterface(TInt aInterfaceId) ; + /** + * + * @see MProtocolDataHost + */ + + TInt GetCleanupOperation() ; + + + private: + /** + * Access to host. Not owned + */ + MXIMPHost& iHost; + /** + * CProtocolSearchDataHostImp : owned + */ + CProtocolSearchDataHostImp *iSearchDataHost ; + + }; + + +#endif // CPROTOCOLDATAHOSTIMP_H + diff -r 000000000000 -r e6b17d312c8b imservices/searchfeatureplugin/srcsearchprocessor/protocolsearchdatahostimp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/searchfeatureplugin/srcsearchprocessor/protocolsearchdatahostimp.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,150 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: searchdata host + * +*/ + + + +#include +#include +#include +#include +#include "ximpapiobjbase.h" +#include "searchapiobjbase.h" +#include "searchobjectfactoryimp.h" +#include "searchdatacacheimp.h" +#include "protocolsearchdatahostimp.h" +#include "protocolsearchfeaturedatahostimp.h" + +#include "searchlogutils.h" + + + + +// ======== MEMBER FUNCTIONS ======== + + +// This should be variated. Branding variation can be one +// possibility. One is to leave adaptation deside how soon +// cleanup will be done. +// Now 5 sec used for testing purposes. Better value could be +// some minutes. + +// --------------------------------------------------------------------------- +// CProtocolSearchDataHostImp::CProtocolSearchDataHostImp() +// --------------------------------------------------------------------------- +// +CProtocolSearchDataHostImp::CProtocolSearchDataHostImp( MXIMPHost& aHost ) +:iHost( aHost ) + { + XSearchLogger::Log(_L("CProtocolSearchDataHostImp::CProtocolSearchDataHostImp Started")); + XSearchLogger::Log(_L("CProtocolSearchDataHostImp::CProtocolSearchDataHostImp Completed")); + } + + +// --------------------------------------------------------------------------- +// CProtocolSearchDataHostImp::ConstructL() +// --------------------------------------------------------------------------- +// +void CProtocolSearchDataHostImp::ConstructL() + { + XSearchLogger::Log(_L("CProtocolSearchDataHostImp::ConstructL Started")); + + iSearchObjFactory= CSearchObjectFactoryImp::NewL(); + iSrchFeatureDataHost=CProtocolSearchFeatureDataHostImp::NewL(iHost); + iSearchDataCache= CSearchDataCache::NewL(iHost); + + XSearchLogger::Log(_L("CProtocolSearchDataHostImp::ConstructL Completed")); + } + + +// --------------------------------------------------------------------------- +// CProtocolSearchDataHostImp::NewLC() +// --------------------------------------------------------------------------- +// +CProtocolSearchDataHostImp* CProtocolSearchDataHostImp::NewLC( MXIMPHost& aHost ) + { + XSearchLogger::Log(_L("CProtocolSearchDataHostImp::NewLC Started")); + CProtocolSearchDataHostImp* self = new( ELeave ) CProtocolSearchDataHostImp( aHost ); + CleanupStack::PushL( self ); + self->ConstructL(); + XSearchLogger::Log(_L("CProtocolSearchDataHostImp::NewLC Completed")); + return self; + + } + +// --------------------------------------------------------------------------- +// CProtocolSearchDataHostImp::NewL() +// --------------------------------------------------------------------------- +// +CProtocolSearchDataHostImp* CProtocolSearchDataHostImp::NewL( MXIMPHost& aHost ) + { + XSearchLogger::Log(_L("CProtocolSearchDataHostImp::NewL Started")); + CProtocolSearchDataHostImp* self = new( ELeave ) CProtocolSearchDataHostImp( aHost ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + XSearchLogger::Log(_L("CProtocolSearchDataHostImp::NewL Completed")); + return self; + + } +// --------------------------------------------------------------------------- +// CProtocolSearchDataHostImp::~CProtocolSearchDataHostImp() +// --------------------------------------------------------------------------- +// +CProtocolSearchDataHostImp::~CProtocolSearchDataHostImp() + { + XSearchLogger::Log(_L("CProtocolSearchDataHostImp::~CProtocolSearchDataHostImp Started")); + delete iSearchDataCache; + delete iSrchFeatureDataHost; + delete iSearchObjFactory; + XSearchLogger::Log(_L("CProtocolSearchDataHostImp::~CProtocolSearchDataHostImp Completed")); + } + + +// --------------------------------------------------------------------------- +// CProtocolSearchDataHostImp::ImObjectFactory() +// --------------------------------------------------------------------------- +// +MSearchObjectFactory& CProtocolSearchDataHostImp::SearchObjectFactory() + { + XSearchLogger::Log(_L("CProtocolSearchDataHostImp::SearchObjectFactory Started")); + return *iSearchObjFactory; + } + + + + +// --------------------------------------------------------------------------- +// CProtocolSearchDataHostImp::ConversationDataAccess() +// --------------------------------------------------------------------------- +// +MProtocolSearchFeatureDataHost& CProtocolSearchDataHostImp::SearchFeatureDataAccess() + { + return *iSrchFeatureDataHost; + } +// --------------------------------------------------------------------------- +// CProtocolSearchDataHostImp::ConversationDataAccess() +// --------------------------------------------------------------------------- +// +EXPORT_C CSearchDataCache& CProtocolSearchDataHostImp::SearchDataCache() + { + return *iSearchDataCache; + } + + + +// End of file + diff -r 000000000000 -r e6b17d312c8b imservices/searchfeatureplugin/srcsearchprocessor/protocolsearchdatahostimp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/searchfeatureplugin/srcsearchprocessor/protocolsearchdatahostimp.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,132 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: searchdata host header + * +*/ + +#ifndef CPROTOCOLSEARCHDATAHOSTIMP_H +#define CPROTOCOLSEARCHDATAHOSTIMP_H + +#include +#include +#include +#include +#include + +#include "searchapiobjbase.h" +#include "ximpapiobjbase.h" +#include "ximphost.h" + + +class MXIMPHost; +class MSearchObjectFactory; +class CSearchObjectFactoryImp; + +class CXIMPPscContext; +class MSearchDataCache; +class CSearchDataCache; +class CXIMPContextStateEventImp; +class CPeriodic; +class MXIMPProtocolConnection; + +class CProtocolSearchFeatureDataHostImp; + +class MProtocolSearchFeatureDataHost; + + + + /** + * SearchData host. + * + * @lib searchprocessor.dll + */ + +NONSHARABLE_CLASS(CProtocolSearchDataHostImp) : public MProtocolSearchDataHost + { + public: + /** The class ID. */ + enum { KClassId = IMP_CLSID_CPROTOCOLSEARCHDATAHOSTIMP }; + + public: + + /** + * Construction :NewL + */ + static CProtocolSearchDataHostImp* NewL( MXIMPHost& aHost ); + + /** + * Construction :NewL + */ + static CProtocolSearchDataHostImp* NewLC( MXIMPHost& aHost ); + + /** + * Destructor + */ + virtual ~CProtocolSearchDataHostImp(); + + private: + /** + * constructor + */ + CProtocolSearchDataHostImp( MXIMPHost& aHost ); + + /** + * 2nd phase constructor + */ + void ConstructL(); + + public: // MProtocolSearchDataHost + /** + * + * @see MProtocolSearchDataHost + */ + MSearchObjectFactory& SearchObjectFactory(); + + /** + * + * @see MProtocolSearchDataHost + */ + MProtocolSearchFeatureDataHost& SearchFeatureDataAccess() ; + + /** + * returns the searchdatacache + * + * @return reference to CSearchDataCache : ownershipr not transfered + */ + IMPORT_C CSearchDataCache& SearchDataCache(); + + private: // data + /** + * Access to host. Not owned + */ + MXIMPHost& iHost; + + /** + * CProtocolSearchFeatureDataHostImp : owned + */ + CSearchObjectFactoryImp* iSearchObjFactory; + /** + * CProtocolSearchFeatureDataHostImp : owned + */ + CProtocolSearchFeatureDataHostImp* iSrchFeatureDataHost; + /** + * CProtocolSearchFeatureDataHostImp : owned + */ + CSearchDataCache* iSearchDataCache; + + }; + + +#endif // CCPROTOCOLSEARCHDATAHOSTIMP_H + diff -r 000000000000 -r e6b17d312c8b imservices/searchfeatureplugin/srcsearchprocessor/searchdatahost/protocolsearchfeaturedatahostimp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/searchfeatureplugin/srcsearchprocessor/searchdatahost/protocolsearchfeaturedatahostimp.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,110 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Searchdatafeature datahost. +* +*/ + + +#include +#include +#include +#include + +#include "ximphost.h" +#include "searchdatacacheimp.h" +#include "searchoperationdefs.h" +#include "searchlogutils.h" +#include "protocolsearchdatahostimp.h" +#include "protocolsearchfeaturedatahostimp.h" + + + +// ============================ MEMBER FUNCTIONS ============================= + + +// --------------------------------------------------------------------------- +// CProtocolSearchFeatureDataHostImp::CProtocolSearchFeatureDataHostImp() +// --------------------------------------------------------------------------- +// +CProtocolSearchFeatureDataHostImp::CProtocolSearchFeatureDataHostImp( MXIMPHost& aHost ) +:iHost( aHost ) + { + } + + +// --------------------------------------------------------------------------- +// CProtocolSearchFeatureDataHostImp::ConstructL() +// --------------------------------------------------------------------------- +// +void CProtocolSearchFeatureDataHostImp::ConstructL() + { + } + + +// --------------------------------------------------------------------------- +// CProtocolSearchFeatureDataHostImp::NewL() +// --------------------------------------------------------------------------- +// +EXPORT_C CProtocolSearchFeatureDataHostImp* CProtocolSearchFeatureDataHostImp::NewL( MXIMPHost& aHost ) + { + CProtocolSearchFeatureDataHostImp* self = new( ELeave ) CProtocolSearchFeatureDataHostImp( aHost ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// Implement supported interface access. +// --------------------------------------------------------------------------- +// +XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CProtocolSearchFeatureDataHostImp, + MProtocolSearchFeatureDataHost ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + + +XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CProtocolSearchFeatureDataHostImp, + MProtocolSearchFeatureDataHost ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + +// --------------------------------------------------------------------------- +// CProtocolSearchFeatureDataHostImp::~CProtocolSearchFeatureDataHostImp() +// --------------------------------------------------------------------------- +// +CProtocolSearchFeatureDataHostImp::~CProtocolSearchFeatureDataHostImp() + { + } + + +// --------------------------------------------------------------------------- +// CProtocolSearchFeatureDataHostImp::HandleSearchResultsL +// --------------------------------------------------------------------------- +// +TXIMPRequestId CProtocolSearchFeatureDataHostImp::HandleSearchResultsL(MXIMPIdentity* aSearchId, + MXIMPObjectCollection* aSearchResults) + { + XSearchLogger::Log(_L("CProtocolSearchFeatureDataHostImp::HandleSearchResultsL Started")); + return iHost.AddNewOperationL( NSearchOps::EHandleSearchResults,aSearchId,aSearchResults); + + } +// --------------------------------------------------------------------------- +// CProtocolSearchFeatureDataHostImp::HandleSearchKeysL +// --------------------------------------------------------------------------- +// +TXIMPRequestId CProtocolSearchFeatureDataHostImp::HandleSearchKeysL( MXIMPObjectCollection* aSearchKeyInfos ) + { + XSearchLogger::Log(_L("CProtocolSearchFeatureDataHostImp::HandleSearchKeysL Started")); + return iHost.AddNewOperationL( NSearchOps::EHandleSearchKeys, aSearchKeyInfos ); + + } diff -r 000000000000 -r e6b17d312c8b imservices/searchfeatureplugin/srcsearchprocessor/searchdatahost/protocolsearchfeaturedatahostimp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/searchfeatureplugin/srcsearchprocessor/searchdatahost/protocolsearchfeaturedatahostimp.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,103 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Searchdatafeature datahost. +* +*/ + +#ifndef CPROTOCOLSEARCHFEATUREDATAHOSTIMP_H +#define CPROTOCOLSEARCHFEATUREDATAHOSTIMP_H + +#include + +#include "ximpapiobjbase.h" +#include "searchapiobjbase.h" +#include "searchtypehelpers.h" + +class MXIMPHost; +class MXIMPObjectCollection; + + +/** + * Implementation for managing cached Invitation information + * + * @lib searchprocessor.dll + */ +class CProtocolSearchFeatureDataHostImp : public CXIMPApiObjBase, + public MProtocolSearchFeatureDataHost + { + public: // Definitions + + /** The class ID. */ + enum { KClassId = IMP_CLSID_CPROTOCOLSEARCHFEATUREDATAHOST }; + + public: // Construction and destruction + + /** + * Construction :NewL + */ + IMPORT_C static CProtocolSearchFeatureDataHostImp* NewL( MXIMPHost& aHost ); + + /** + * Destruction + */ + virtual ~CProtocolSearchFeatureDataHostImp(); + + private: + /** + * constructor + */ + CProtocolSearchFeatureDataHostImp( MXIMPHost& aHost ); + /** + * 2nd phase constructor + */ + void ConstructL(); + + + public: // From MXIMPBase + + /** + * Implementation of MXIMPBase interface methods + * @see MXIMPBase + */ + XIMPIMP_DECLARE_IF_BASE_METHODS + + + public: //From MProtocolSearchFeatureDataHost + /** + * + * @see MProtocolSearchFeatureDataHost + */ + + TXIMPRequestId HandleSearchResultsL( MXIMPIdentity* aSearchId, + MXIMPObjectCollection* aSearchResults ); + + /** + * + * @see MProtocolSearchFeatureDataHost + */ + TXIMPRequestId HandleSearchKeysL( MXIMPObjectCollection* aSearchKeyInfos ) ; + + private: // Data + + /** + * Access to host. Not owned + */ + MXIMPHost& iHost; + }; + + + + +#endif // CPROTOCOLSEARCHFEATUREDATAHOSTIMP_H + diff -r 000000000000 -r e6b17d312c8b imservices/searchfeatureplugin/srcsearchprocessor/searchprocessorhook/searchprocessorhook.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/searchfeatureplugin/srcsearchprocessor/searchprocessorhook/searchprocessorhook.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,45 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework's Search Processor Hook implementation. +* +*/ + + +#include +#include +#include +#include "protocoldatahostimp.h" + +// --------------------------------------------------------------------------- +// Key value pair table to identify correct constructor +// function for the requested interface. +// --------------------------------------------------------------------------- +// +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY( XIMP_ECOM_IMPL_UID_SEARCH_PROCESSOR_INTERFACE, + CProtocolDataHostImp::NewL) + }; + + +// --------------------------------------------------------------------------- +// Exported function to return the implementation proxy table +// --------------------------------------------------------------------------- +// +EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount ) + { + aTableCount = sizeof( ImplementationTable ) / sizeof( TImplementationProxy ); + return ImplementationTable; + } + diff -r 000000000000 -r e6b17d312c8b imservices/searchfeatureplugin/srcsearchprocessor/searchprocessorhook/searchprocessorhook.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/searchfeatureplugin/srcsearchprocessor/searchprocessorhook/searchprocessorhook.rss Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,53 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ECom registery info for ECom hook +* +*/ + + +#include +#include +#include +#include + + +// --------------------------------------------------------------------------- +// ECom registery info for Search processor ECom hook +// --------------------------------------------------------------------------- +// +RESOURCE REGISTRY_INFO theInfo + { + resource_format_version = RESOURCE_FORMAT_VERSION_2; + dll_uid = XIMP_DLL_UID_SEARCH_PROCESSOR_HOOK; + + interfaces = + { + INTERFACE_INFO + { + interface_uid = XIMP_ECOM_IF_UID_PROTOCOL_DATA_HOST_INTERFACE; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = XIMP_ECOM_IMPL_UID_SEARCH_PROCESSOR_INTERFACE; + version_no = 1; + display_name = "S60 Default XIMP"; + default_data = ""; + opaque_data = ""; + } + }; + } + }; + } + diff -r 000000000000 -r e6b17d312c8b imservices/searchfeatureplugin/srcutils/searchlogutils.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/searchfeatureplugin/srcutils/searchlogutils.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,38 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description:Implementation for XSearchLogger +* +*/ + + + +// INCLUDE FILES +#include "searchlogutils.h" + +// CONSTANTS +const TInt KLogBufferLength = 256; +_LIT(KImLogDir, "searchplugin"); +_LIT(KImLogFile, "search.txt"); + +void XSearchLogger::Log(TRefByValue aFmt,...) + { + VA_LIST list; + VA_START(list, aFmt); + // Print to log file + TBuf buf; + buf.FormatList(aFmt, list); + RFileLogger::Write(KImLogDir, KImLogFile, EFileLoggingModeAppend, buf); + } + +// End of File diff -r 000000000000 -r e6b17d312c8b imservices/searchfeatureplugin/srcutils/searchlogutils.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/searchfeatureplugin/srcutils/searchlogutils.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,49 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Log util header +* +*/ + + + +#ifndef SEARCHLOGUTILS_H +#define SEARCHLOGUTILS_H + +// INCLUDES +#include +#include + + +/** +* Debug log writer +* +* +*/ +class XSearchLogger + { + public: // New functions + + /** + * Writes log to log file + * @param + * @return + */ + static void Log(TRefByValue aFmt,...); + + + }; + +#endif // SEARCHLOGUTILS_H + +// End of File diff -r 000000000000 -r e6b17d312c8b imservices/xmppsettingsapi/bwins/xmppsettingsapiu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/xmppsettingsapi/bwins/xmppsettingsapiu.def Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,15 @@ +EXPORTS + ??1CXmppSettingsApi@@UAE@XZ @ 1 NONAME ; CXmppSettingsApi::~CXmppSettingsApi(void) + ?CreateSettingsRecordL@CXmppSettingsApi@@QAEXAAK@Z @ 2 NONAME ; void CXmppSettingsApi::CreateSettingsRecordL(unsigned long &) + ?DefaultSettingsRecordL@CXmppSettingsApi@@QAEXAAK@Z @ 3 NONAME ; void CXmppSettingsApi::DefaultSettingsRecordL(unsigned long &) + ?GetParamL@CXmppSettingsApi@@QAEXKABVTDesC16@@AAH@Z @ 4 NONAME ; void CXmppSettingsApi::GetParamL(unsigned long, class TDesC16 const &, int &) + ?GetParamL@CXmppSettingsApi@@QAEXKABVTDesC16@@AAVTDes16@@@Z @ 5 NONAME ; void CXmppSettingsApi::GetParamL(unsigned long, class TDesC16 const &, class TDes16 &) + ?GetRepositoryKeyL@CXmppSettingsApi@@QAEXKABVTDesC16@@HAAK@Z @ 6 NONAME ; void CXmppSettingsApi::GetRepositoryKeyL(unsigned long, class TDesC16 const &, int, unsigned long &) + ?GetSettingsRecordIdArrayL@CXmppSettingsApi@@QAEXAAV?$RArray@K@@@Z @ 7 NONAME ; void CXmppSettingsApi::GetSettingsRecordIdArrayL(class RArray &) + ?NewL@CXmppSettingsApi@@SAPAV1@XZ @ 8 NONAME ; class CXmppSettingsApi * CXmppSettingsApi::NewL(void) + ?NewLC@CXmppSettingsApi@@SAPAV1@XZ @ 9 NONAME ; class CXmppSettingsApi * CXmppSettingsApi::NewLC(void) + ?RemoveParamL@CXmppSettingsApi@@QAEXKABVTDesC16@@@Z @ 10 NONAME ; void CXmppSettingsApi::RemoveParamL(unsigned long, class TDesC16 const &) + ?RemoveSettingsRecordL@CXmppSettingsApi@@QAEXK@Z @ 11 NONAME ; void CXmppSettingsApi::RemoveSettingsRecordL(unsigned long) + ?SetParamL@CXmppSettingsApi@@QAEXKABVTDesC16@@0@Z @ 12 NONAME ; void CXmppSettingsApi::SetParamL(unsigned long, class TDesC16 const &, class TDesC16 const &) + ?SetParamL@CXmppSettingsApi@@QAEXKABVTDesC16@@H@Z @ 13 NONAME ; void CXmppSettingsApi::SetParamL(unsigned long, class TDesC16 const &, int) + diff -r 000000000000 -r e6b17d312c8b imservices/xmppsettingsapi/eabi/xmppsettingsapiu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/xmppsettingsapi/eabi/xmppsettingsapiu.def Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,23 @@ +EXPORTS + _ZN16CXmppSettingsApi12RemoveParamLEmRK7TDesC16 @ 1 NONAME + _ZN16CXmppSettingsApi17GetRepositoryKeyLEmRK7TDesC16iRm @ 2 NONAME + _ZN16CXmppSettingsApi21CreateSettingsRecordLERm @ 3 NONAME + _ZN16CXmppSettingsApi21RemoveSettingsRecordLEm @ 4 NONAME + _ZN16CXmppSettingsApi22DefaultSettingsRecordLERm @ 5 NONAME + _ZN16CXmppSettingsApi25GetSettingsRecordIdArrayLER6RArrayImE @ 6 NONAME + _ZN16CXmppSettingsApi4NewLEv @ 7 NONAME + _ZN16CXmppSettingsApi5NewLCEv @ 8 NONAME + _ZN16CXmppSettingsApi9GetParamLEmRK7TDesC16R6TDes16 @ 9 NONAME + _ZN16CXmppSettingsApi9GetParamLEmRK7TDesC16Ri @ 10 NONAME + _ZN16CXmppSettingsApi9SetParamLEmRK7TDesC16S2_ @ 11 NONAME + _ZN16CXmppSettingsApi9SetParamLEmRK7TDesC16i @ 12 NONAME + _ZN16CXmppSettingsApiD0Ev @ 13 NONAME + _ZN16CXmppSettingsApiD1Ev @ 14 NONAME + _ZN16CXmppSettingsApiD2Ev @ 15 NONAME + _ZTI16CXmppSettingsApi @ 16 NONAME ; ## + _ZTI19CXmppSettingsColumn @ 17 NONAME ; ## + _ZTI19CXmppSettingsRecord @ 18 NONAME ; ## + _ZTV16CXmppSettingsApi @ 19 NONAME ; ## + _ZTV19CXmppSettingsColumn @ 20 NONAME ; ## + _ZTV19CXmppSettingsRecord @ 21 NONAME ; ## + diff -r 000000000000 -r e6b17d312c8b imservices/xmppsettingsapi/group/1020E334.txt Binary file imservices/xmppsettingsapi/group/1020E334.txt has changed diff -r 000000000000 -r e6b17d312c8b imservices/xmppsettingsapi/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/xmppsettingsapi/group/bld.inf Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,34 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: bld.inf file for project XMPP Settings API +* +*/ + + +#include +// +// Platforms +// +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS +../rom/xmppsettingsapi.iby CORE_MW_LAYER_IBY_EXPORT_PATH(xmppsettingsapi.iby) +1020E334.txt /epoc32/data/Z/private/10202be9/1020E334.txt //temporary +1020E334.txt /epoc32/release/winscw/udeb/Z/private/10202be9/1020E334.txt //temporary + + +PRJ_MMPFILES +xmppsettingsapi.mmp +//#include "../internal/testui/group/bld.inf" diff -r 000000000000 -r e6b17d312c8b imservices/xmppsettingsapi/group/xmppsettingsapi.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/xmppsettingsapi/group/xmppsettingsapi.mmp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,44 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project definition file for project XMPP Settings API +* +*/ + + +#include + +TARGET jabbersettings.dll +TARGETTYPE DLL +UID 0x1000008d 0x200100BB + +CAPABILITY CAP_ECOM_PLUGIN + +VENDORID VID_DEFAULT + +VERSION 10.0 + +SOURCEPATH ../src +SOURCE xmppsettingsapi.cpp +SOURCE xmppsettingscolumn.cpp +SOURCE xmppsettingsrecord.cpp + +USERINCLUDE ../inc + +MW_LAYER_SYSTEMINCLUDE + +LIBRARY euser.lib +LIBRARY centralrepository.lib +DEBUGLIBRARY flogger.lib + +DEFFILE xmppsettingsapi.def diff -r 000000000000 -r e6b17d312c8b imservices/xmppsettingsapi/inc/xmppsettingscolumn.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/xmppsettingsapi/inc/xmppsettingscolumn.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,106 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: This class handles columns. +* +*/ + + + + +#ifndef C_XMPPSETTINGSCOLUMN_H +#define C_XMPPSETTINGSCOLUMN_H + +#include + +class CRepository; + +/** + * This class handles columns. + * + * This class contains all methods needed to read and write columns table. + * + * + * @lib jabbersettings.lib + * @since S60 5.0 + */ +class CXmppSettingsColumn: public CBase + { + +public: + + /** + * Two-phased constructor. + * @return Instance of this class + */ + static CXmppSettingsColumn* NewL( CRepository& aRepository ); + + static CXmppSettingsColumn* NewLC( CRepository& aRepository ); + + /** + * Destructor + */ + virtual ~CXmppSettingsColumn(); + + /** + * This method checks that does this column exist. If it does not, it + * creates it (if requested. Otherwise it leaves. + * + * @since S60 5.0 + * @param aAttrName Column name. + * @param aCreateColumnIfNotExist Should new column be created if it is + * not found. + * @param aColKey onn return contains the key of the column. + */ + void GetColumnKeyL( const TDesC& aAttrName, + TBool aCreateColumnIfNotExist, + TUint32& aColKey ); + + /** + * Tries to find columns key by it is name (value). + * + * @since S60 5.0 + * @param aColumnName Name of the column. + * @param aColumnKey on return contains the columns key. + */ + void FindByNameL( const TDesC& aColumnName, + TUint32& aColumnKey ); + +private: + + /** + * Default Contructor + */ + CXmppSettingsColumn( CRepository& aRepository ); + + void ConstructL(); + + /** + * This method resolves next free key to be used as column key. + * + * @since S60 5.0 + * @param aColKey On return contains next free column key. + */ + void NextFreeSlotL( TUint32& aColKey ); + +private: // data + + /** + * Handle to the Central Repository. Doesnt Own. + */ + CRepository& iRepository; + + }; + + +#endif // C_XMPPSETTINGSCOLUMN_H diff -r 000000000000 -r e6b17d312c8b imservices/xmppsettingsapi/inc/xmppsettingsrecord.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/xmppsettingsapi/inc/xmppsettingsrecord.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,125 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: This class is used for data table manipulations. +* +*/ + + + + +#ifndef C_XMPPSETTINGSRECORD_H +#define C_XMPPSETTINGSRECORD_H + +#include + +class CRepository; + +/** + * This class is used for data table manipulations. + * + * This class contains all methods needed to read and write to settings id + * table. + * + * + * @lib jabbersettings.lib + * @since S60 5.0 + */ +class CXmppSettingsRecord: public CBase + { + +public: + + /** + * Two-phased constructor. + * @return Instance of this class + */ + static CXmppSettingsRecord* NewL( CRepository& aRepository ); + + static CXmppSettingsRecord* NewLC( CRepository& aRepository ); + + /** + * Destructor + */ + virtual ~CXmppSettingsRecord(); + + /** + * This method checks does this setting id exist. Leaves with + * KErrNotFound if it does not. + * + * @since S60 5.0 + * @param aSettingsRecordId Setting id. + * @param aSettingsRecordKey If setting id is found, this contains the setting + * key on return. + */ + void FindSettingsRecordKeyL( TUint32 aSettingsRecordId, + TUint32& aSettingsRecordKey ); + + /** + * This method fids all setting keys. + * + * @since S60 5.0 + * @@param aSettingsRecordKeys On return contains all setting keys. + */ + void GetSettingsRecordkeysL( RArray& aResults ); + + /** + * This method creates unique setting id. + * + * @since S60 5.0 + * @param aNewSettingId On return contains new setting id. + */ + void CreateSettingsRecordIdL( TUint32& aNewSettingId ); + +private: + + /** + * Default Contructor + */ + CXmppSettingsRecord( CRepository& aRepository ); + + void ConstructL(); + + /** + * This method returns next available slot for settings record. It can + * be new index or it can use deleted slot. + * + * @since S60 5.0 + * @param aFreeKey On return contains the next free key. + */ + void NextFreeSlotL( TUint32& aFreeKey ); + + /** + * This method fids all setting keys. It fills the internal array with + * unique ids. + * + * @since S60 5.0 + */ + void GetSettingsRecordkeysL(); + +private: // Data + + /** + * Handle to the Central Repository. + */ + CRepository& iRepository; + + /** + * Contains setting id keys. + */ + RArray iSettingsRecordKeyArray; + + }; + + +#endif // C_XMPPSETTINGSRECORD_H diff -r 000000000000 -r e6b17d312c8b imservices/xmppsettingsapi/rom/xmppsettingsapi.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/xmppsettingsapi/rom/xmppsettingsapi.iby Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,27 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: iby file for XMPPSetting +* +*/ + +#ifndef __XMPPSETTINGSAPI_IBY__ +#define __XMPPSETTINGSAPI_IBY__ + +//xmpp settings + +file=ABI_DIR\BUILD_DIR\jabbersettings.dll SHARED_LIB_DIR\jabbersettings.dll + +#endif + + diff -r 000000000000 -r e6b17d312c8b imservices/xmppsettingsapi/src/xmppsettingsapi.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/xmppsettingsapi/src/xmppsettingsapi.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,419 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: This class handles dynamic name-value pair storing. +* Notice that "setting id"-is parameter used by users of this +* lib. The "Setting key" is used for Central Repository +* operations. +* +*/ + + + +#include + +//XMPP includes +// #include "GFLOGger.h" +#include "xmppservicesettingsapi.h" + +#include "xmppsettingsapicommon.h" +#include "xmppsettingscolumn.h" +#include "xmppsettingsrecord.h" + +const TUint32 KMaxDescLength = 255; + +// ======== MEMBER FUNCTIONS ======== + + +CXmppSettingsApi::CXmppSettingsApi() + { + + } + + +void CXmppSettingsApi::ConstructL() + { + iRepository = CRepository::NewL( KXmppSettingsApiCenRep ); + iRecords = CXmppSettingsRecord::NewL( *iRepository ); + iColumns = CXmppSettingsColumn::NewL( *iRepository ); + } + + +EXPORT_C CXmppSettingsApi* CXmppSettingsApi::NewL() + { + CXmppSettingsApi* self = CXmppSettingsApi::NewLC(); + CleanupStack::Pop( self ); + return self; + } + + +EXPORT_C CXmppSettingsApi* CXmppSettingsApi::NewLC() + { + CXmppSettingsApi* self = new( ELeave ) CXmppSettingsApi; + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + + +EXPORT_C CXmppSettingsApi::~CXmppSettingsApi() + { + delete iRepository; + delete iRecords; + delete iColumns; + } + + +// --------------------------------------------------------------------------- +// This method creates new setting record. +// --------------------------------------------------------------------------- +// +EXPORT_C void CXmppSettingsApi::CreateSettingsRecordL( + TUint32& aSettingsRecordId ) + { + // GFLOG1("CXmppSettingsApi::CreateSettingsRecordL - IN"); + + RArray array; + CleanupClosePushL( array ); + + iRecords->GetSettingsRecordkeysL( array ); + + if( 0 == array.Count() ) + { + RBuf tmp; + tmp.CreateL( KMaxDescLength ); + + TInt error = iRepository->Get( KXmppKeyColumnTable, + tmp ); + tmp.Close(); + // GFLOG2("CXmppSettingsApi::CreateSettingsrecord - error: %d",error); + if ( error ) + { + // GFLOG1("CXmppSettingsApi::CreateSettingsrecord - first time ever!"); + // GFLOG1("CXmppSettingsApi::CreateSettingsrecord - creating KColSettingId"); + + // create column for KColSettingId. + User::LeaveIfError( iRepository->Create( KXmppKeyColumnTable, + KColSettingId() ) ); + + // GFLOG1("CXmppSettingsApi::CreateSettingsrecord - Initialize settingId record"); + // Initialize settingId record. Initial value is zero + User::LeaveIfError( iRepository->Create( KCurrentSettingIdIndex, + 0 ) ); + } + } + + iRecords->CreateSettingsRecordIdL( aSettingsRecordId ); + + CleanupStack::PopAndDestroy( &array ); + + // GFLOG1("CXmppSettingsApi::CreateSettingsRecordL - OUT"); + } + +// --------------------------------------------------------------------------- +// This method removes settings record from the central repository. +// --------------------------------------------------------------------------- +// +EXPORT_C void CXmppSettingsApi::RemoveSettingsRecordL( + TUint32 aSettingsRecordId ) + { + // GFLOG1("CXmppSettingsApi::RemoveSettingsRecordL - IN"); + + TUint32 settingKey( 0 ); + // First, check that this setting id does exist + iRecords->FindSettingsRecordKeyL( aSettingsRecordId, + settingKey ); + + TUint32 key( KXmppKeyDataTable | settingKey ); + + TUint32 errorKey(0); + + User::LeaveIfError( iRepository->Delete( key, KXmppMaskColumns, errorKey ) ); + + // GFLOG2("CXmppSettingsApi::RemoveSettingStorageL - errorKey: 0x%08x",errorKey); + // GFLOG2("CXmppSettingsApi::RemoveSettingStorageL - errorKey: %d",errorKey); + // GFLOG1("CXmppSettingsApi::RemoveSettingsRecordL - OUT"); + } + +// --------------------------------------------------------------------------- +// This method returns the default settings record (the first). +// --------------------------------------------------------------------------- +// +EXPORT_C void CXmppSettingsApi::DefaultSettingsRecordL( + TUint32& aSettingsRecordId) + { + // GFLOG1("CXmppSettingsApi::DefaultSettingsRecordL - IN"); + RArray crArray; + CleanupClosePushL( crArray ); + + iRecords->GetSettingsRecordkeysL( crArray ); + + TInt settingId( 0 ); + + if( crArray.Count() > 0 ) + { + User::LeaveIfError( iRepository->Get( crArray[0], settingId ) ); + } + + + CleanupStack::PopAndDestroy( &crArray ); + + aSettingsRecordId = settingId; + + // GFLOG1("CXmppSettingsApi::DefaultSettingsRecordL - OUT"); + } + +// --------------------------------------------------------------------------- +// This method returns all setting id.s +// --------------------------------------------------------------------------- +// +EXPORT_C void CXmppSettingsApi::GetSettingsRecordIdArrayL( + RArray& aArray ) + { + // GFLOG1("CXmppSettingsApi::GetSettingsRecordIdArrayL - IN"); + + RArray crArray; + CleanupClosePushL( crArray ); + + iRecords->GetSettingsRecordkeysL( crArray ); + + TInt id( 0 ); + for ( TInt i=0; i < crArray.Count(); i++ ) + { + User::LeaveIfError( iRepository->Get( crArray[i], id ) ); + aArray.Append( id ); + } + + CleanupStack::PopAndDestroy( &crArray ); + // GFLOG1("CXmppSettingsApi::GetSettingsRecordIdArrayL - OUT"); + } + +// --------------------------------------------------------------------------- +// This method sets the parameter. If column does not exist. it creates new +// one. +// --------------------------------------------------------------------------- +// +EXPORT_C void CXmppSettingsApi::SetParamL( + TUint32 aSettingsRecordId, + const TDesC& aAttrName, + const TDesC& aAttrValue ) + { + // GFLOG1("CXmppSettingsApi::SetParamL - IN"); + // GFLOG4(" CXmppSettingsApi::SetParamL - aSettingsRecordId: %d: PARAM[ %S ][ %S ]",aSettingsRecordId,&aAttrName,&aAttrValue); + TUint32 theKey( 0 ); + + GetColumnKeyL( aSettingsRecordId, + aAttrName, + ETrue, // create column if not found. + theKey ); + + RBuf buf; + buf.CreateL( KMaxDescLength ); + + // We do this just make sure that the key exists. Overflow is just one of + // the indicators. + TInt error = iRepository->Get( theKey, buf ); + + buf.Close(); + + // If column is not created for this setting id, then create it (to SETTING-table). + if ( error != KErrNotFound && + error != KErrNone && + error != KErrOverflow ) + { + // GFLOG1("CXmppSettingsApi::SetParamL - leaving..."); + User::Leave( error ); + } + else if ( error == KErrNotFound ) + { + // GFLOG1("CXmppSettingsApi::SetParamL - Creating new column.."); + User::LeaveIfError( iRepository->Create( theKey, aAttrValue ) ); + } + else + { + // GFLOG1("CXmppSettingsApi::SetParamL - Setting value to the column.."); + // And finally, set the value to the column id in the setting id's row ( SETTING-table). + User::LeaveIfError( iRepository->Set( theKey, aAttrValue ) ); + } + + // GFLOG1("CXmppSettingsApi::SetParamL - OUT"); + } + +// --------------------------------------------------------------------------- +// This method sets the parameter. If column does not exist. it creates new +// one. +// --------------------------------------------------------------------------- +// +EXPORT_C void CXmppSettingsApi::SetParamL( + TUint32 aSettingsRecordId, + const TDesC& aAttrName, + TInt aAttrValue ) + { + // GFLOG1("CXmppSettingsApi::SetParamL - IN"); + // GFLOG4(" CXmppSettingsApi::SetParamL - aSettingsRecordId: %d: PARAM[ %S ][ %d ]",aSettingsRecordId,&aAttrName,aAttrValue); + TUint32 theKey( 0 ); + + GetColumnKeyL( aSettingsRecordId, + aAttrName, + ETrue, + theKey ); + + TInt paramValue( 0 ); + + TInt error = iRepository->Get( theKey, paramValue ); + + // If column is not created for this setting id, then create it (to SETTING-table). + if ( error != KErrNotFound && + error != KErrNone ) + { + // GFLOG1("CXmppSettingsApi::SetParamL - leaving..."); + User::Leave( error ); + } + else if ( error == KErrNotFound ) + { + // GFLOG1("CXmppSettingsApi::SetParamL - Creating new column.."); + User::LeaveIfError( iRepository->Create( theKey, aAttrValue ) ); + } + else + { + // GFLOG1("CXmppSettingsApi::SetParamL - Setting value to the column.."); + // And finally, set the value to the column id in the setting id's row ( SETTING-table). + User::LeaveIfError( iRepository->Set( theKey, aAttrValue ) ); + } + // GFLOG1("CXmppSettingsApi::SetParamL - OUT"); + } + +// --------------------------------------------------------------------------- +// This method gets the value. If column does not exits it leaves. +// --------------------------------------------------------------------------- +// +EXPORT_C void CXmppSettingsApi::GetParamL( + TUint32 aSettingsRecordId, + const TDesC& aAttrName, + TDes& aAttrValue ) + { + // GFLOG1("CXmppSettingsApi::GetParamL - IN"); + // GFLOG3(" CXmppSettingsApi::GetParamL - aSettingsRecordId: %d: PARAM[ %S ]",aSettingsRecordId,&aAttrName); + TUint32 theKey( 0 ); + + GetColumnKeyL( aSettingsRecordId, + aAttrName, + EFalse, // Don't create column but leave if not found. + theKey ); + + User::LeaveIfError( iRepository->Get( theKey, aAttrValue ) ); + // GFLOG1("CXmppSettingsApi::GetParamL - OUT"); + } + +// --------------------------------------------------------------------------- +// This method gets the value. If column does not exits it leaves. +// --------------------------------------------------------------------------- +// +EXPORT_C void CXmppSettingsApi::GetParamL( + TUint32 aSettingsRecordId, + const TDesC& aAttrName, + TInt& aAttrValue ) + { + // GFLOG1("CXmppSettingsApi::GetParamL - IN"); + // GFLOG3(" CXmppSettingsApi::GetParamL - aSettingsRecordId: %d: PARAM[ %S ]",aSettingsRecordId,&aAttrName); + TUint32 theKey( 0 ); + + GetColumnKeyL( aSettingsRecordId, + aAttrName, + EFalse, // Don't create column but leave if not found. + theKey ); + + User::LeaveIfError( iRepository->Get( theKey, aAttrValue ) ); + // GFLOG1("CXmppSettingsApi::GetParamL - OUT"); + } + +// --------------------------------------------------------------------------- +// This method removes the value of the param from given settings record. +// --------------------------------------------------------------------------- +// +EXPORT_C void CXmppSettingsApi::RemoveParamL( + TUint32 aSettingsRecordId, + const TDesC& aAttrName ) + { + // GFLOG1("CXmppSettingsApi::RemoveParamL - IN"); + TUint32 settingKey( 0 ); + // First, check that this setting id does exist + iRecords->FindSettingsRecordKeyL( aSettingsRecordId, + settingKey ); + + TUint32 colKey( 0 ); + + // Find out the id of the column (and does the column exist) + iColumns->FindByNameL( aAttrName, + colKey ); + + // GFLOG1("CXmppSettingsApi::RemoveParamL - Delete item"); + TUint32 removeKey( settingKey | colKey ); + + // GFLOG2("CXmppSettingsApi::RemoveParamL - colKey: 0x%08x", colKey ); + // GFLOG2("CXmppSettingsApi::RemoveParamL - settingKey: 0x%08x", settingKey ); + // GFLOG2("CXmppSettingsApi::RemoveParamL - removeKey: 0x%08x", removeKey ); + + User::LeaveIfError( iRepository->Delete( removeKey ) ); + // GFLOG1("CXmppSettingsApi::RemoveParamL - OUT"); + } + + +// --------------------------------------------------------------------------- +// Do-method for all the SetParam-methods. +// --------------------------------------------------------------------------- +// +EXPORT_C void CXmppSettingsApi::GetRepositoryKeyL( + TUint32 aSettingsRecordId, + const TDesC& aAttrName, + TBool aCreateColumnIfNotExist, + TUint32& aTheKey ) + { + GetColumnKeyL( aSettingsRecordId, + aAttrName, + aCreateColumnIfNotExist , // create column if not found. + aTheKey ); + } + +// PRIVATE + + +// --------------------------------------------------------------------------- +// Do-method for all the SetParam-methods. +// --------------------------------------------------------------------------- +// +void CXmppSettingsApi::GetColumnKeyL( + TUint32 aSettingsRecordId, + const TDesC& aAttrName, + TBool aCreateColumnIfNotExist, + TUint32& aTheKey ) + { + + TUint32 settingKey( 0 ); + // First, check that this setting id does exist. + iRecords->FindSettingsRecordKeyL( aSettingsRecordId, + settingKey ); + + // Try to find Column number from the COLUMN-TABLE. + TUint32 col( 0 ); + iColumns->GetColumnKeyL( aAttrName, + aCreateColumnIfNotExist, + col ); + + // Find that is column already created to this setting id in SETTING-table. + + aTheKey = KXmppKeyDataTable | settingKey | col; + + // GFLOG2("CXmppSettingsApi::GetColumnKey - table | settingKey | aTheKey: 0x%08x", aTheKey); + + } diff -r 000000000000 -r e6b17d312c8b imservices/xmppsettingsapi/src/xmppsettingscolumn.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/xmppsettingsapi/src/xmppsettingscolumn.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,191 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: This class handles columns. +* +*/ + + +#include + +//XMPP includes +//#include "// GFLOGger.h" + +#include "xmppsettingscolumn.h" +#include "xmppsettingsapicommon.h" + +// ======== MEMBER FUNCTIONS ======== + +CXmppSettingsColumn::CXmppSettingsColumn( + CRepository& aRepository ): + iRepository( aRepository ) + { + + } + + +void CXmppSettingsColumn::ConstructL() + { + + } + + +CXmppSettingsColumn* CXmppSettingsColumn::NewL( + CRepository& aRepository ) + { + CXmppSettingsColumn* self = CXmppSettingsColumn::NewLC( aRepository ); + CleanupStack::Pop( self ); + return self; + } + + +CXmppSettingsColumn* CXmppSettingsColumn::NewLC( + CRepository& aRepository ) + { + CXmppSettingsColumn* self + = new( ELeave ) CXmppSettingsColumn( aRepository ); + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + + +CXmppSettingsColumn::~CXmppSettingsColumn() + { + + } + + +// --------------------------------------------------------------------------- +// Checks does given column exist. If not, it creates new entry. +// --------------------------------------------------------------------------- +// +void CXmppSettingsColumn::GetColumnKeyL( + const TDesC& aAttrName, + TBool aCreateColumnIfNotExist, + TUint32& aColKey ) + { + TRAPD( error, FindByNameL( aAttrName, + aColKey ) ); + + // LOGERR("CXmppSettingsColumn::GetColumnKeyL - error: %d",error); + + // Column was not found, but user want's to create new one. + if ( error == KErrNotFound && aCreateColumnIfNotExist ) + { + // GFLOG1("CXmppSettingsColumn::GetColumnKeyL - column is not found => Create new"); + //create new + TUint32 newColKey( 0 ); + NextFreeSlotL( newColKey ); + // GFLOG2("CXmppSettingsColumn::GetColumnKeyL - newColKey: 0x%08x",newColKey); + + // Set column name to COLUMN-table. + User::LeaveIfError( iRepository.Create( newColKey, aAttrName ) ); + aColKey = newColKey; + } + // Column was not found, but user does not want to create new. + else if( error == KErrNotFound && !aCreateColumnIfNotExist ) + { + // GFLOG1("CXmppSettingsColumn::GetColumnKeyL - column is not found => New not wanted - leaving"); + User::Leave( KErrNotFound ); + } + // other error occured -> Leave. + else if ( error != KErrNone ) + { + // GFLOG1("CXmppSettingsColumn::GetColumnKeyL - error occured - leaving"); + User::Leave( error ); + } + // Col found. + else + { + // Everything ok. + } + } + +// --------------------------------------------------------------------------- +// Tries to find a column key by searching with the column name. +// --------------------------------------------------------------------------- +// +void CXmppSettingsColumn::FindByNameL( + const TDesC& aColumnName, + TUint32& aColumnKey ) + { + + RArray keys; + CleanupClosePushL( keys ); + + TInt error( KErrNone ); + + error = iRepository.FindEqL( KXmppKeyColumnTable, + KXmppMaskColumns, + aColumnName, + keys ); + + // LOGERR("CXmppSettingsColumn::FindByNameL - error: %d", error); + User::LeaveIfError ( error ); + + // GFLOG1("CXmppSettingsColumn::FindByColumnName - column found."); + aColumnKey = keys[0]; + + +// DEBUG_BLOCK( + + if ( keys.Count() > 1 ) + { + // this should not happen. if it does, it is bug in somewhere in this component. + // GFLOG1("CXmppSettingsColumn::FindByColumnName - WHAAAAT! TO MANY RESULTS -> LEAVE!"); + User::Leave( KErrGeneral ); + } + // ); + CleanupStack::PopAndDestroy( &keys ); + + } + + +// PRIVATE METHODS + + +// --------------------------------------------------------------------------- +// Returns the next free setting slot. +// --------------------------------------------------------------------------- +// +void CXmppSettingsColumn::NextFreeSlotL( + TUint32& aColKey ) + { + + RArray results; + CleanupClosePushL( results ); + + // First, find all rows and get count. + TInt error = iRepository.FindL( KXmppKeyColumnTable, + KXmppMaskColumns, + results ); + + TInt count = results.Count(); + // GFLOG2("CXmppSettingsColumn::NextFreeSlotL - count: %d",count); + CleanupStack::PopAndDestroy( &results ); + + if ( count > 0 ) + { + // Count can be used as new key + aColKey = count; + } + else + { + // First column ever + aColKey = 0; + } + + // GFLOG2("CXmppSettingsColumn::NextFreeSlotL - aColKey: 0x%08x",aColKey); + + } diff -r 000000000000 -r e6b17d312c8b imservices/xmppsettingsapi/src/xmppsettingsrecord.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/xmppsettingsapi/src/xmppsettingsrecord.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,204 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: This class is used for data table manipulations. +* +*/ + + +#include + +//XMPP includes +// #include "// GFLOGger.h" + +#include "xmppsettingsrecord.h" +#include "xmppsettingsapicommon.h" + +// ======== MEMBER FUNCTIONS ======== + +CXmppSettingsRecord::CXmppSettingsRecord( + CRepository& aRepository ): + iRepository( aRepository ) + { + + } + +CXmppSettingsRecord* CXmppSettingsRecord::NewL( + CRepository& aRepository ) + { + CXmppSettingsRecord* self = CXmppSettingsRecord::NewLC( aRepository ); + CleanupStack::Pop( self ); + return self; + } + +CXmppSettingsRecord* CXmppSettingsRecord::NewLC( + CRepository& aRepository ) + { + CXmppSettingsRecord* self + = new( ELeave ) CXmppSettingsRecord( aRepository ); + CleanupStack::PushL( self ); + return self; + } + + +CXmppSettingsRecord::~CXmppSettingsRecord() + { + // GFLOG1("CXmppSettingsRecord::~CXmppSettingsRecord"); + iSettingsRecordKeyArray.Reset(); + iSettingsRecordKeyArray.Close(); + } + + +// --------------------------------------------------------------------------- +// Finds settingsRecord key. Leaves if not found. +// --------------------------------------------------------------------------- +// +void CXmppSettingsRecord::FindSettingsRecordKeyL( + TUint32 aSettingsRecordId, + TUint32& aSettingsRecordKey ) + { + GetSettingsRecordkeysL(); + + TInt counter( iSettingsRecordKeyArray.Count() ); + TInt key = KErrNotFound; + for (TInt i = 0; i< counter; i++) + { + TInt id( 0 ); + User::LeaveIfError( iRepository.Get( iSettingsRecordKeyArray[i], + id ) ); + if ( id == aSettingsRecordId ) + { + key = iSettingsRecordKeyArray[i]; + break; + } + } + aSettingsRecordKey = key; + + } + +// --------------------------------------------------------------------------- +// returns list of all id keys. +// --------------------------------------------------------------------------- +// +void CXmppSettingsRecord::GetSettingsRecordkeysL( + RArray& aResults ) + { + GetSettingsRecordkeysL(); + + TInt count( iSettingsRecordKeyArray.Count() ); + for ( TInt i=0; i < count; i++ ) + { + aResults.Append( iSettingsRecordKeyArray[i] ); + } + } + +// --------------------------------------------------------------------------- +// This method creates new settings id. +// --------------------------------------------------------------------------- +// +void CXmppSettingsRecord::CreateSettingsRecordIdL( + TUint32& aNewSettingId ) + { + // GFLOG1("CXmppSettingsRecord::CreateSettingsRecordIdL - IN"); + + TUint32 nextFreeSlot( 0 ); + + NextFreeSlotL( nextFreeSlot ); + + TInt settingId( 0 ); + + TInt error( iRepository.Get( KCurrentSettingIdIndex, settingId ) ); + // LOGERR("CXmppSettingsRecord::CreateSettingsRecordIdL - iRepository.Get( KCurrentSettingIdIndex ) - error: %d", error); + + if ( !error ) + { + settingId++; + // GFLOG3("CXmppSettingsRecord::CreateSettingsRecordIdL - nextFreeSlot: 0x%08x, settingId: %d",nextFreeSlot, settingId); + error = iRepository.Create( nextFreeSlot, settingId ); + // LOGERR("CXmppSettingsRecord::CreateSettingsRecordIdL - iRepository.Create( nextFreeSlot ) - error: %d", error); + if ( !error ) + { + error = iRepository.Set( KCurrentSettingIdIndex, settingId ); + aNewSettingId = settingId; + } + } + User::LeaveIfError( error ); + // GFLOG1("CXmppSettingsRecord::CreateSettingsRecordIdL - OUT"); + } + + +// PRIVATE + + +// --------------------------------------------------------------------------- +// returns next free slot key. +// --------------------------------------------------------------------------- +// +void CXmppSettingsRecord::NextFreeSlotL( + TUint32& aFreekey ) + { + // First, find all rows and get count. + const TUint32 shift = 0x00010000; + + GetSettingsRecordkeysL(); + + const TInt count( iSettingsRecordKeyArray.Count() ); + // GFLOG2("CXmppSettingsRecord::NextFreeSlotL - count: %d",count); + + if ( count == 0 ) + { + aFreekey = KXmppKeyDataTable; + } + // check for free slots + else + { + TBool foundFreeSlot( EFalse ); + + // go through all indexes and try to find free one. + for ( TInt i=0; i < count; i++ ) + { + TUint32 tmpKey( KXmppKeyDataTable | ( i * shift ) ); + TInt answer( iSettingsRecordKeyArray.Find( tmpKey ) ); + + if ( answer == KErrNotFound ) + { + foundFreeSlot = ETrue; + aFreekey = tmpKey; + break; + } + } + if ( !foundFreeSlot ) + { + // GFLOG1("CXmppSettingsRecord::NextFreeSlotL - no free slots, creating new"); + aFreekey = KXmppKeyDataTable | ( count * shift ); + } + } + // GFLOG2("CXmppSettingsRecord::NextFreeSlotL - aFreekey: 0x%08x",aFreekey); + + } + +// --------------------------------------------------------------------------- +// Find all unique settings ids. +// --------------------------------------------------------------------------- +// +void CXmppSettingsRecord::GetSettingsRecordkeysL() + { + iSettingsRecordKeyArray.Reset(); + + TInt error = iRepository.FindL( KXmppKeyDataTable, + KXmppMaskAllRows, + iSettingsRecordKeyArray ); + + // GFLOG2("CXmppSettingsRecord::GetSettingsRecordkeysL - iSettingsRecordKeyArray.Count(): %d",iSettingsRecordKeyArray.Count()); + + } diff -r 000000000000 -r e6b17d312c8b imservices/xmppsettingsapi/tsrc/bmarm/xmppsettings_apiU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/xmppsettingsapi/tsrc/bmarm/xmppsettings_apiU.DEF Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + LibEntryL__FR13CTestModuleIf @ 1 NONAME R3UNUSED ; LibEntryL(CTestModuleIf &) + diff -r 000000000000 -r e6b17d312c8b imservices/xmppsettingsapi/tsrc/bwins/xmppsettings_apiu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/xmppsettingsapi/tsrc/bwins/xmppsettings_apiu.def Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + ?LibEntryL@@YAPAVCScriptBase@@AAVCTestModuleIf@@@Z @ 1 NONAME ; class CScriptBase * __cdecl LibEntryL(class CTestModuleIf &) + diff -r 000000000000 -r e6b17d312c8b imservices/xmppsettingsapi/tsrc/eabi/xmppsettings_apiu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/xmppsettingsapi/tsrc/eabi/xmppsettings_apiu.def Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + _Z9LibEntryLR13CTestModuleIf @ 1 NONAME + diff -r 000000000000 -r e6b17d312c8b imservices/xmppsettingsapi/tsrc/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/xmppsettingsapi/tsrc/group/bld.inf Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,54 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +PRJ_PLATFORMS +// specify the platforms your component needs to be built for here +// defaults to WINS MARM so you can ignore this if you just build these + + DEFAULT + +PRJ_TESTEXPORTS +// NOTE: If using ARS requirements all export operations should be done under this. +// 'abld test export' + +PRJ_EXPORTS +// Specify the source file followed by its destination here +// copy will be used to copy the source file to its destination +// If there's no destination then the source file will be copied +// +// Example: +/* + +*/ +../init/TestFramework.ini /epoc32/winscw/c/TestFramework/TestFramework.ini +../conf/xmppsettings_api.cfg /epoc32/winscw/c/TestFramework/xmppsettings_api.cfg +PRJ_TESTMMPFILES + + xmppsettings_api.mmp + + +// 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: +// + + +// End of File diff -r 000000000000 -r e6b17d312c8b imservices/xmppsettingsapi/tsrc/group/xmppsettings_api.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/xmppsettingsapi/tsrc/group/xmppsettings_api.mmp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,77 @@ +/*TYPE TESTCLASS*/ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MMP file for STIF Test Framework's TestScripter +* testclass test module. +* +*/ + +#include + +TARGET xmppsettings_api.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 xmppsettings_api.def + +USERINCLUDE ../inc + +OS_LAYER_SYSTEMINCLUDE +APP_LAYER_SYSTEMINCLUDE +MW_LAYER_SYSTEMINCLUDE +SOURCEPATH ../src + +SOURCE xmppsettings_api.cpp +SOURCE xmppsettings_apiBlocks.cpp + +//RESOURCE resource_file +//RESOURCE resource_file2 + +LIBRARY euser.lib +LIBRARY stiftestinterface.lib +LIBRARY stiftestengine.lib +LIBRARY jabbersettings.lib +LIBRARY centralrepository.lib +LANG SC + +/* +START WINS +?wins_specific_information +END + +START MARM +?marm_specific_information +END +*/ +// Other possible keywords: + +// DOCUMENT ?file, that is not compiled, but added to MSVC project workspace (i.e. release notes) +/* +START BITMAP ?target +TARGETPATH ?emulated_path_on_target_machine +HEADER +SOURCE ?color_depth ?source_bitmap +END +*/ +// DEFFILE ?filename +// AIF ?filename + +// End of File diff -r 000000000000 -r e6b17d312c8b imservices/xmppsettingsapi/tsrc/group/xmppsettings_api.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/xmppsettingsapi/tsrc/group/xmppsettings_api.pkg Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,66 @@ +; +; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +; All rights reserved. +; This component and the accompanying materials are made available +; under the terms of "Eclipse Public License v1.0" +; which accompanies this distribution, and is available +; at the URL "http://www.eclipse.org/legal/epl-v10.html". +; +; Initial Contributors: +; Nokia Corporation - initial contribution. +; +; Contributors: +; +; Description: +; +; Installation file for STIF +; + +; Languages +&EN + +; Provide value for uid +#{"STIF"},(0x00000000),1,1,0,TYPE=SA + +; Series60 product id for S60 3.0 +[0x101F7961], 0, 0, 0, {"Series60ProductID"} + +; Localised Vendor name +%{"Nokia"} + +; Unique Vendor name +:"Nokia" + +; Logo +; None + +; Package signature - Optional +; None + +; Start of Package body + +; Condition blocks +; None + +; Options list +; None + +;INI FILE +"..\init\testframework.ini" -"c:\Testframework\ttestframework.ini" + +;CFG FILES +"..\conf\xmppsettings_api.cfg" -"c:\Testframework\xmppsettings_api.cfg" + +; Install files +"\epoc32\release\armv5\udeb\xmppsettings_api.dll" - "!:\Sys\Bin\xmppsettings_api.dll" + +; Embedded SIS +; None + +; End of Package body + +; PKG dependencies +; None + +; PKG capabilities +; None diff -r 000000000000 -r e6b17d312c8b imservices/xmppsettingsapi/tsrc/group/xmppsettings_api_DoxyFile.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/xmppsettingsapi/tsrc/group/xmppsettings_api_DoxyFile.txt Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,239 @@ +# +# 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 "Symbian Foundation License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# +# + +# Doxyfile 1.4.1 + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = xmppsettings_api +PROJECT_NUMBER = +OUTPUT_DIRECTORY = \xmppsettings_api\ +CREATE_SUBDIRS = NO +OUTPUT_LANGUAGE = English +USE_WINDOWS_ENCODING = YES +BRIEF_MEMBER_DESC = YES +REPEAT_BRIEF = YES +ABBREVIATE_BRIEF = +ALWAYS_DETAILED_SEC = NO +INLINE_INHERITED_MEMB = NO +FULL_PATH_NAMES = NO +STRIP_FROM_PATH = +STRIP_FROM_INC_PATH = +SHORT_NAMES = NO +JAVADOC_AUTOBRIEF = NO +MULTILINE_CPP_IS_BRIEF = NO +DETAILS_AT_TOP = NO +INHERIT_DOCS = YES +DISTRIBUTE_GROUP_DOC = NO +TAB_SIZE = 8 +ALIASES = +OPTIMIZE_OUTPUT_FOR_C = YES +OPTIMIZE_OUTPUT_JAVA = NO +SUBGROUPING = YES +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- +EXTRACT_ALL = YES +EXTRACT_PRIVATE = NO +EXTRACT_STATIC = NO +EXTRACT_LOCAL_CLASSES = NO +EXTRACT_LOCAL_METHODS = NO +HIDE_UNDOC_MEMBERS = NO +HIDE_UNDOC_CLASSES = NO +HIDE_FRIEND_COMPOUNDS = NO +HIDE_IN_BODY_DOCS = NO +INTERNAL_DOCS = YES +CASE_SENSE_NAMES = YES +HIDE_SCOPE_NAMES = NO +SHOW_INCLUDE_FILES = YES +INLINE_INFO = YES +SORT_MEMBER_DOCS = YES +SORT_BRIEF_DOCS = NO +SORT_BY_SCOPE_NAME = NO +GENERATE_TODOLIST = NO +GENERATE_TESTLIST = NO +GENERATE_BUGLIST = NO +GENERATE_DEPRECATEDLIST= YES +ENABLED_SECTIONS = +MAX_INITIALIZER_LINES = 30 +SHOW_USED_FILES = YES +SHOW_DIRECTORIES = YES +FILE_VERSION_FILTER = +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- +QUIET = NO +WARNINGS = YES +WARN_IF_UNDOCUMENTED = YES +WARN_IF_DOC_ERROR = YES +WARN_NO_PARAMDOC = NO +WARN_FORMAT = "$file:$line: $text" +WARN_LOGFILE = +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = \xmppsettings_api\ +FILE_PATTERNS = *.h \ + *.rh \ + *.hrh +RECURSIVE = YES +EXCLUDE = +EXCLUDE_SYMLINKS = NO +EXCLUDE_PATTERNS = +EXAMPLE_PATH = +EXAMPLE_PATTERNS = +EXAMPLE_RECURSIVE = NO +IMAGE_PATH = +INPUT_FILTER = +FILTER_PATTERNS = +FILTER_SOURCE_FILES = NO +#--------------------------------------------------------------------------- +# configuration options related to source browsing +#--------------------------------------------------------------------------- +SOURCE_BROWSER = NO +INLINE_SOURCES = NO +STRIP_CODE_COMMENTS = YES +REFERENCED_BY_RELATION = YES +REFERENCES_RELATION = YES +VERBATIM_HEADERS = YES +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- +ALPHABETICAL_INDEX = NO +COLS_IN_ALPHA_INDEX = 5 +IGNORE_PREFIX = +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- +GENERATE_HTML = NO +HTML_OUTPUT = html +HTML_FILE_EXTENSION = .html +HTML_HEADER = +HTML_FOOTER = +HTML_STYLESHEET = +HTML_ALIGN_MEMBERS = YES +GENERATE_HTMLHELP = YES +CHM_FILE = +HHC_LOCATION = +GENERATE_CHI = NO +BINARY_TOC = YES +TOC_EXPAND = YES +DISABLE_INDEX = YES +ENUM_VALUES_PER_LINE = 4 +GENERATE_TREEVIEW = YES +TREEVIEW_WIDTH = 250 +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- +GENERATE_LATEX = NO +LATEX_OUTPUT = latex +LATEX_CMD_NAME = latex +MAKEINDEX_CMD_NAME = makeindex +COMPACT_LATEX = NO +PAPER_TYPE = a4wide +EXTRA_PACKAGES = +LATEX_HEADER = +PDF_HYPERLINKS = NO +USE_PDFLATEX = NO +LATEX_BATCHMODE = NO +LATEX_HIDE_INDICES = NO +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- +GENERATE_RTF = YES +RTF_OUTPUT = Doc +COMPACT_RTF = YES +RTF_HYPERLINKS = YES +RTF_STYLESHEET_FILE = +RTF_EXTENSIONS_FILE = +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- +GENERATE_MAN = NO +MAN_OUTPUT = man +MAN_EXTENSION = .3 +MAN_LINKS = NO +#--------------------------------------------------------------------------- +# configuration options related to the XML output +#--------------------------------------------------------------------------- +GENERATE_XML = NO +XML_OUTPUT = xml +XML_SCHEMA = +XML_DTD = +XML_PROGRAMLISTING = YES +#--------------------------------------------------------------------------- +# configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- +GENERATE_AUTOGEN_DEF = NO +#--------------------------------------------------------------------------- +# configuration options related to the Perl module output +#--------------------------------------------------------------------------- +GENERATE_PERLMOD = NO +PERLMOD_LATEX = NO +PERLMOD_PRETTY = YES +PERLMOD_MAKEVAR_PREFIX = +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- +ENABLE_PREPROCESSING = YES +MACRO_EXPANSION = YES +EXPAND_ONLY_PREDEF = NO +SEARCH_INCLUDES = YES +INCLUDE_PATH = +INCLUDE_FILE_PATTERNS = +PREDEFINED = NONSHARABLE_CLASS +EXPAND_AS_DEFINED = +SKIP_FUNCTION_MACROS = YES +#--------------------------------------------------------------------------- +# Configuration::additions related to external references +#--------------------------------------------------------------------------- +TAGFILES = +GENERATE_TAGFILE = +ALLEXTERNALS = NO +EXTERNAL_GROUPS = YES +PERL_PATH = /usr/bin/perl +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- +CLASS_DIAGRAMS = YES +HIDE_UNDOC_RELATIONS = YES +HAVE_DOT = NO +CLASS_GRAPH = YES +COLLABORATION_GRAPH = YES +GROUP_GRAPHS = YES +UML_LOOK = NO +TEMPLATE_RELATIONS = YES +INCLUDE_GRAPH = YES +INCLUDED_BY_GRAPH = YES +CALL_GRAPH = NO +GRAPHICAL_HIERARCHY = YES +DIRECTORY_GRAPH = YES +DOT_IMAGE_FORMAT = png +DOT_PATH = +DOTFILE_DIRS = +MAX_DOT_GRAPH_WIDTH = 1024 +MAX_DOT_GRAPH_HEIGHT = 1024 +MAX_DOT_GRAPH_DEPTH = 0 +DOT_TRANSPARENT = NO +DOT_MULTI_TARGETS = NO +GENERATE_LEGEND = YES +DOT_CLEANUP = YES +#--------------------------------------------------------------------------- +# Configuration::additions related to the search engine +#--------------------------------------------------------------------------- +SEARCHENGINE = NO diff -r 000000000000 -r e6b17d312c8b imservices/xmppsettingsapi/tsrc/group/xmppsettings_api_nrm.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/xmppsettingsapi/tsrc/group/xmppsettings_api_nrm.mmp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,75 @@ +/*TYPE TESTCLASS*/ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MMP file for STIF Test Framework's TestScripter +* testclass test module. +* +*/ + +#include + +TARGET xmppsettings_api.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 xmppsettings_api.def + +USERINCLUDE ../inc + +OS_LAYER_SYSTEMINCLUDE + +SOURCEPATH ../src + +SOURCE xmppsettings_api.cpp +SOURCE xmppsettings_apiBlocks.cpp + +//RESOURCE resource_file +//RESOURCE resource_file2 + +LIBRARY euser.lib +LIBRARY stiftestinterface.lib +LIBRARY stiftestengine.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 000000000000 -r e6b17d312c8b imservices/xmppsettingsapi/tsrc/inc/xmppsettings_api.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/xmppsettingsapi/tsrc/inc/xmppsettings_api.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,223 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: STIF testclass declaration +* +*/ + +#ifndef XMPPSETTINGS_API_H +#define XMPPSETTINGS_API_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( Kxmppsettings_apiLogPath, "\\logs\\testframework\\xmppsettings_api\\" ); +// Log file +_LIT( Kxmppsettings_apiLogFile, "xmppsettings_api.txt" ); +_LIT( Kxmppsettings_apiLogFileWithTitle, "xmppsettings_api_[%S].txt" ); + +// FUNCTION PROTOTYPES +//?type ?function_name(?arg_list); + +// FORWARD DECLARATIONS +//class ?FORWARD_CLASSNAME; +class CXmppSettingsApi; +class Cxmppsettings_api; + +// DATA TYPES +//enum ?declaration +//typedef ?declaration +//extern ?data_type; + +// CLASS DECLARATION + +/** +* Cxmppsettings_api test class for STIF Test Framework TestScripter. +* ?other_description_lines +* +* @lib ?library +* @since ?Series60_version +*/ +NONSHARABLE_CLASS(Cxmppsettings_api) : public CScriptBase + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static Cxmppsettings_api* NewL( CTestModuleIf& aTestModuleIf ); + + /** + * Destructor. + */ + virtual ~Cxmppsettings_api(); + + 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. + */ + Cxmppsettings_api( 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. + */ + + void ResetRepository(); + virtual TInt Test_CreateSettingsRecordL( CStifItemParser& aItem ); + virtual TInt Test_DefaultSettingsRecord( CStifItemParser& aItem ); + virtual TInt Test_GetSettingsRecordIdArray(CStifItemParser& aItem ); + virtual TInt Test_SetParamInt(CStifItemParser& aItem ); + virtual TInt Test_SetParamLDes(CStifItemParser& aItem ); + virtual TInt Test_GetParamInt(CStifItemParser& aItem ); + virtual TInt Test_GetParamLDes(CStifItemParser& aItem ); + virtual TInt Test_RemoveSettingsRecord(CStifItemParser& aItem ); + virtual TInt Test_RemoveParam(CStifItemParser& aItem ); + + /** + * Method used to log version of test class + */ + void SendTestClassVersion(); + + //ADD NEW METHOD DEC HERE + //[TestMethods] - Do not remove + + public: // Data + // ?one_line_short_description_of_data + //?data_declaration; + TInt iXmppSettingId; + TInt iXmppSnapId; + TInt iXmppServerPort; + TInt iMessageToneVolume; + TInt iLastRegistrationError; + + TBool iPublishOnThePhoneStatus; + TBool iRoamingWarning; + TBool iAllowBuddyReq; + TBool iAutoLogin; + TBool iDefaultProfile; + + HBufC* iMessageTone; + HBufC* iSnapName; + HBufC* iSettingsName; + HBufC* iStackVersion; + HBufC* iXmppServerAddress; + HBufC* iUsername; + HBufC* iPassword; + HBufC* iConnectionServer1; + HBufC* iConnectionServer2; + TUint32 iSettingId; + RArray iSettingIdArray; + + CXmppSettingsApi* iApi; + + + + + 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 // XMPPSETTINGS_API_H + +// End of File diff -r 000000000000 -r e6b17d312c8b imservices/xmppsettingsapi/tsrc/init/TestFramework.ini --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/xmppsettingsapi/tsrc/init/TestFramework.ini Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,45 @@ +# +# This is STIFTestFramework initialization file +# Comment lines start with '#'-character. +# See STIF TestFramework users guide.doc for instructions + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + +[Engine_Defaults] + +TestReportMode= FullReport # Possible values are: 'Empty', 'Summary', 'Environment', + 'TestCases' or 'FullReport' + +CreateTestReport= YES # Possible values: YES or NO + +TestReportFilePath= C:\LOGS\TestFramework\ +TestReportFileName= TestReport + +TestReportFormat= TXT # Possible values: TXT or HTML +TestReportOutput= FILE # Possible values: FILE or RDEBUG +TestReportFileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND + +DeviceResetDllName= StifResetForNokia.dll # e.g. 'StifHWResetStub.dll' for user specific reseting + +[End_Defaults] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Module configurations start + +[New_Module] +ModuleName= testscripter +TestCaseFile= C:\testframework\xmppsettings_api.cfg +[End_Module] + + + + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + +[Logger_Defaults] + +[End_Logger_Defaults] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + +# End of file diff -r 000000000000 -r e6b17d312c8b imservices/xmppsettingsapi/tsrc/src/xmppsettings_api.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/xmppsettingsapi/tsrc/src/xmppsettings_api.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,254 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: This file contains testclass implementation. +* +*/ + +// INCLUDE FILES +#include +#include "xmppsettings_api.h" +#include +#include + +// EXTERNAL DATA STRUCTURES +//extern ?external_data; + +// EXTERNAL FUNCTION PROTOTYPES +//extern ?external_function( ?arg_type,?arg_type ); + +// CONSTANTS +//const ?type ?constant_var = ?constant; + +// MACROS +//#define ?macro ?macro_def + +// LOCAL CONSTANTS AND MACROS +//const ?type ?constant_var = ?constant; +//#define ?macro_name ?macro_def + +// MODULE DATA STRUCTURES +//enum ?declaration +//typedef ?declaration + +// LOCAL FUNCTION PROTOTYPES +//?type ?function_name( ?arg_type, ?arg_type ); + +// FORWARD DECLARATIONS +//class ?FORWARD_CLASSNAME; + +// ============================= LOCAL FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// ?function_name ?description. +// ?description +// Returns: ?value_1: ?description +// ?value_n: ?description_line1 +// ?description_line2 +// ----------------------------------------------------------------------------- +// +/* +?type ?function_name( + ?arg_type arg, // ?description + ?arg_type arg) // ?description + { + + ?code // ?comment + + // ?comment + ?code + } +*/ + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// Cxmppsettings_api::Cxmppsettings_api +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +Cxmppsettings_api::Cxmppsettings_api( + CTestModuleIf& aTestModuleIf ): + CScriptBase( aTestModuleIf ) + { + } + +// ----------------------------------------------------------------------------- +// Cxmppsettings_api::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void Cxmppsettings_api::ConstructL() + { + iXmppSettingId = 0; + iXmppSnapId = 15; + + iXmppServerPort = 5223; + iMessageToneVolume = 7; + iLastRegistrationError = KErrNone; + + iPublishOnThePhoneStatus = ETrue; + iRoamingWarning = ETrue; + iAllowBuddyReq = ETrue; + iAutoLogin = EFalse; + iDefaultProfile = ETrue; + + iApi = CXmppSettingsApi::NewL(); + iMessageTone = HBufC::NewL( 50 ); + iMessageTone->Des().Copy( _L("c:\\system\\tones\\diipadaapa.wav") ); + + // LOGARG16("messagetone path: %S", iMessageTone); + + iSnapName = HBufC::NewL( 50 ); + iSnapName->Des().Copy( _L("Internet") ); + + iSettingsName = HBufC::NewL( 50 ); + iSettingsName->Des().Copy( _L("XMPP-SETTING 1") ); + + iStackVersion = HBufC::NewL( 50 ); + iStackVersion->Des().Copy( _L("XMPP STACK V1.021 build 127") ); + + iXmppServerAddress = HBufC::NewL( 50 ); + iXmppServerAddress->Des().Copy( _L("chat.gizmoproject.com") ); + + iUsername = HBufC::NewL( 50 ); + iUsername->Des().Copy( _L("lassi") ); + + iPassword = HBufC::NewL( 50 ); + iPassword->Des().Copy( _L("lassi123") ); + + iConnectionServer1 = HBufC::NewL( 50 ); + iConnectionServer1->Des().Copy( _L("Con.Server.gizmo.com") ); + + iConnectionServer2 = HBufC::NewL( 50 ); + iConnectionServer2->Des().Copy( _L("Con2.Server.gizmo.com") ); + + + + //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(Kxmppsettings_apiLogFileWithTitle, &title); + } + else + { + logFileName.Copy(Kxmppsettings_apiLogFile); + } + + iLog = CStifLogger::NewL( Kxmppsettings_apiLogPath, + logFileName, + CStifLogger::ETxt, + CStifLogger::EFile, + EFalse ); + + SendTestClassVersion(); + } + +// ----------------------------------------------------------------------------- +// Cxmppsettings_api::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +Cxmppsettings_api* Cxmppsettings_api::NewL( + CTestModuleIf& aTestModuleIf ) + { + Cxmppsettings_api* self = new (ELeave) Cxmppsettings_api( aTestModuleIf ); + + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); + + return self; + + } + +// Destructor +Cxmppsettings_api::~Cxmppsettings_api() + { + + // Delete resources allocated from test methods + Delete(); + delete iMessageTone; + delete iSnapName; + delete iSettingsName; + delete iStackVersion; + delete iXmppServerAddress; + delete iUsername; + delete iPassword; + delete iConnectionServer1; + delete iConnectionServer2; + delete iApi; + // Delete logger + delete iLog; + + } + +//----------------------------------------------------------------------------- +// Cxmppsettings_api::SendTestClassVersion +// Method used to send version of test class +//----------------------------------------------------------------------------- +// +void Cxmppsettings_api::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("xmppsettings_api.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* ) Cxmppsettings_api::NewL( aTestModuleIf ); + + } + + +// End of File diff -r 000000000000 -r e6b17d312c8b imservices/xmppsettingsapi/tsrc/src/xmppsettings_apiBlocks.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/xmppsettingsapi/tsrc/src/xmppsettings_apiBlocks.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,543 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: This file contains testclass implementation. +* +*/ + +// [INCLUDE FILES] - do not remove +#include +#include +#include +#include "xmppsettings_api.h" +#include +#include + +// EXTERNAL DATA STRUCTURES +//extern ?external_data; +const TUid KXmppSettingsApiCenRep ={0x1020e334}; +_LIT( KParamName, "XMPP-PARAM-NUMBER-0x%08d"); +_LIT( KParamValue16, "param value - 0x%08d"); +// 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 + } +*/ +void Cxmppsettings_api::ResetRepository() + { + CRepository* rep = CRepository::NewL( KXmppSettingsApiCenRep ); + User::LeaveIfError( rep->Reset() ); + delete rep; + } +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// Cxmppsettings_api::Delete +// Delete here all resources allocated and opened from test methods. +// Called from destructor. +// ----------------------------------------------------------------------------- +// +void Cxmppsettings_api::Delete() + { + + } + +// ----------------------------------------------------------------------------- +// Cxmppsettings_api::RunMethodL +// Run specified method. Contains also table of test mothods and their names. +// ----------------------------------------------------------------------------- +// +TInt Cxmppsettings_api::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( "Test_CreateSettingsRecordL", Cxmppsettings_api::Test_CreateSettingsRecordL ), + ENTRY( "Test_DefaultSettingsRecord", Cxmppsettings_api::Test_DefaultSettingsRecord ), + ENTRY( "Test_GetSettingsRecordIdArray", Cxmppsettings_api::Test_GetSettingsRecordIdArray ), + ENTRY( "Test_SetParamInt", Cxmppsettings_api::Test_SetParamInt ), + ENTRY( "Test_SetParamLDes", Cxmppsettings_api::Test_SetParamLDes ), + ENTRY( "Test_GetParamInt", Cxmppsettings_api::Test_GetParamInt ), + ENTRY( "Test_GetParamLDes", Cxmppsettings_api::Test_GetParamLDes ), + ENTRY( "Test_RemoveSettingsRecord", Cxmppsettings_api::Test_RemoveSettingsRecord ), + ENTRY( "Test_RemoveParam", Cxmppsettings_api::Test_RemoveParam ), + + + //ADD NEW ENTRY HERE + // [test cases entries] - Do not remove + + }; + + const TInt count = sizeof( KFunctions ) / + sizeof( TStifFunctionInfo ); + + return RunInternalL( KFunctions, count, aItem ); + + } + +// ----------------------------------------------------------------------------- +// Cxmppsettings_api::ExampleL +// Example test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Cxmppsettings_api::Test_CreateSettingsRecordL( CStifItemParser& aItem ) + { + + ResetRepository(); + iApi->CreateSettingsRecordL( iSettingId ); + if(0==iSettingId) + { + return KErrGeneral; + } + + RArray array; + + iApi->GetSettingsRecordIdArrayL( array ); + TInt arraycount = array.Count(); + if(0==arraycount) + { + return KErrGeneral; + } + if(iSettingId!=array[0]) + { + return KErrGeneral; + } + array.Reset(); + array.Close(); + ResetRepository(); + TInt count = 5; + for (TInt i=0; i< count; i++ ) + { + iApi->CreateSettingsRecordL( iSettingId ) ; + } + iApi->GetSettingsRecordIdArrayL( array ); + arraycount = array.Count(); + if(count!=arraycount) + { + return KErrGeneral; + } + array.Reset(); + array.Close(); + ResetRepository(); + return KErrNone; + } + +TInt Cxmppsettings_api::Test_DefaultSettingsRecord( CStifItemParser& aItem ) + { + ResetRepository(); + iApi->CreateSettingsRecordL( iSettingId ); + TUint32 settingId; + iApi->DefaultSettingsRecordL( settingId ); + if(settingId!=iSettingId) + { + return KErrGeneral; + } + ResetRepository(); + return KErrNone; + + } + +TInt Cxmppsettings_api::Test_GetSettingsRecordIdArray( CStifItemParser& aItem ) + { + + ResetRepository(); + iApi->CreateSettingsRecordL( iSettingId ); + if(0==iSettingId) + { + return KErrGeneral; + } + + RArray array; + + iApi->GetSettingsRecordIdArrayL( array ); + TInt arraycount = array.Count(); + if(0==arraycount) + { + return KErrGeneral; + } + if(iSettingId!=array[0]) + { + return KErrGeneral; + } + array.Reset(); + array.Close(); + ResetRepository(); + TInt count = 5; + for (TInt i=0; i< count; i++ ) + { + iApi->CreateSettingsRecordL( iSettingId ) ; + } + iApi->GetSettingsRecordIdArrayL( array ); + arraycount = array.Count(); + if(count!=arraycount) + { + return KErrGeneral; + } + array.Reset(); + array.Close(); + ResetRepository(); + return KErrNone; + } +TInt Cxmppsettings_api::Test_SetParamInt( CStifItemParser& aItem ) + { + ResetRepository(); + iApi->CreateSettingsRecordL( iSettingId ); + + _LIT( KParamName, "XMPP-PARAM-NUMBER-0x%08d"); + + TInt count = 128; // 0xFF + TInt err; + for (TInt i=0; i < count; i++ ) + { + HBufC* paramName = HBufC::NewL( KParamName().Length()+20 ); + paramName->Des().AppendFormat( KParamName(), i ); + + TInt paramValue(i); + + TRAP(err,iApi->SetParamL( iSettingId, *paramName, paramValue)); + if(err!=KErrNone) + { + ResetRepository(); + return KErrGeneral; + } + + delete paramName; + } + ResetRepository(); + return KErrNone; + } + +TInt Cxmppsettings_api::Test_SetParamLDes( CStifItemParser& aItem ) + { + TInt err; + ResetRepository(); + iApi->CreateSettingsRecordL( iSettingId ); + + TInt count = 128; // 0xFF + + for (TInt i=0; i < count; i++ ) + { + HBufC* paramName = HBufC::NewL( KParamName().Length()+20 ); + paramName->Des().AppendFormat( KParamName(), i ); + + HBufC* paramValue = HBufC::NewL( KParamValue16().Length()+20 ); + paramValue->Des().AppendFormat( KParamValue16(), i ); + + TRAP(err,iApi->SetParamL( iSettingId, *paramName, *paramValue)); + if(err!=KErrNone) + { + ResetRepository(); + delete paramName; + delete paramValue; + return KErrGeneral; + } + + delete paramName; + delete paramValue; + } + ResetRepository(); + return KErrNone; + + } + +TInt Cxmppsettings_api::Test_GetParamInt( CStifItemParser& aItem ) + { + ResetRepository(); + iApi->CreateSettingsRecordL( iSettingId ); + + _LIT( KParamName, "XMPP-PARAM-NUMBER-0x%08d"); + + TInt count = 128; // 0xFF + TInt err; + for (TInt i=0; i < count; i++ ) + { + HBufC* paramName = HBufC::NewL( KParamName().Length()+20 ); + paramName->Des().AppendFormat( KParamName(), i ); + + TInt paramValue(i); + + TRAP(err,iApi->SetParamL( iSettingId, *paramName, paramValue)); + if(err!=KErrNone) + { + ResetRepository(); + return KErrGeneral; + } + + delete paramName; + } + for ( TInt i=0; i < count; i++ ) + { + HBufC* paramName = HBufC::NewL( KParamName().Length()+20 ); + paramName->Des().AppendFormat( KParamName(), i ); + + TInt paramValue(0); + + iApi->GetParamL( iSettingId,*paramName,paramValue); + + if( i!= paramValue) + { + return KErrGeneral; + } + + delete paramName; + } + ResetRepository(); + return KErrNone; + } + +TInt Cxmppsettings_api::Test_GetParamLDes( CStifItemParser& aItem ) + { + ResetRepository(); + iApi->CreateSettingsRecordL( iSettingId ); + + _LIT( KParamName, "XMPP-PARAM-NUMBER-0x%08d"); + + TInt count = 128; // 0xFF + TInt err; + for (TInt i=0; i < count; i++ ) + { + HBufC* paramName = HBufC::NewL( KParamName().Length()+20 ); + paramName->Des().AppendFormat( KParamName(), i ); + + HBufC* paramValue = HBufC::NewL( KParamValue16().Length()+20 ); + paramValue->Des().AppendFormat( KParamValue16(), i ); + + TRAP(err,iApi->SetParamL( iSettingId, *paramName, *paramValue)); + if(err!=KErrNone) + { + ResetRepository(); + delete paramName; + delete paramValue; + return KErrGeneral; + } + + delete paramName; + delete paramValue; + } + for ( TInt i=0; i < count; i++ ) + { + HBufC* paramName = HBufC::NewL( KParamName().Length()+20 ); + paramName->Des().AppendFormat( KParamName(), i ); + + HBufC* paramValue = HBufC::NewL( KParamValue16().Length()+20 ); + paramValue->Des().AppendFormat( KParamValue16(), i ); + + RBuf buf; + buf.CreateL( 255 ); + + TRAP(err,iApi->GetParamL( iSettingId,*paramName, buf) ); + + if(err!=KErrNone) + { + return KErrGeneral; + } + //*paramValue, buf, ; + + delete paramName; + delete paramValue; + + buf.Close(); + } + ResetRepository(); + return KErrNone; + } + +TInt Cxmppsettings_api::Test_RemoveSettingsRecord( CStifItemParser& aItem ) + { + ResetRepository(); + iApi->CreateSettingsRecordL( iSettingId ); + iApi->RemoveSettingsRecordL( iSettingId ); + + RArray array; + + iApi->GetSettingsRecordIdArrayL( array ); + TInt arraycount = array.Count(); + if(1==arraycount) + { + return KErrGeneral; + } + + array.Reset(); + + iSettingId = 0; + + ResetRepository(); + + TInt count = 128; + + for (TInt i=1; i< count; i++ ) + { + iApi->CreateSettingsRecordL( iSettingId); + } + + // because cen rep is reseted after every test, indexes should start + // from zero and go up to count. So its safe to assume that these + // indexes exist :) + + iApi->RemoveSettingsRecordL( 1 ); + iApi->RemoveSettingsRecordL( 55 ); + iApi->RemoveSettingsRecordL( 123 ); + iApi->RemoveSettingsRecordL( 96 ) ; + iApi->RemoveSettingsRecordL( 2 ); + + iApi->GetSettingsRecordIdArrayL( array ); + arraycount = array.Count(); + if((count-6)!=arraycount) + { + return KErrGeneral; + } + + for( TInt i=0; i < array.Count(); i++ ) + { + iApi->RemoveSettingsRecordL( array[i] ); + } + + array.Reset(); + iApi->GetSettingsRecordIdArrayL( array ); + if( 0!=(array.Count())) + { + return KErrGeneral; + } + array.Reset(); + array.Close(); + ResetRepository(); + return KErrNone; + + } +TInt Cxmppsettings_api::Test_RemoveParam( CStifItemParser& aItem ) + { + + + ResetRepository(); + iApi->CreateSettingsRecordL( iSettingId ); + + _LIT( KParamName, "XMPP-PARAM-NUMBER-0x%08d"); + + TInt count = 128; // 0xFF + TInt err; + for (TInt i=0; i < count; i++ ) + { + HBufC* paramName = HBufC::NewL( KParamName().Length()+20 ); + paramName->Des().AppendFormat( KParamName(), i ); + + TInt paramValue(i); + + TRAP(err,iApi->SetParamL( iSettingId, *paramName, paramValue)); + if(err!=KErrNone) + { + ResetRepository(); + return KErrGeneral; + } + + delete paramName; + } + + count = 128; // 0xFF + + TInt param = 56; + + HBufC* paramName = HBufC::NewL( KParamName().Length()+20 ); + paramName->Des().AppendFormat( KParamName(), param ); + + iApi->RemoveParamL( iSettingId,*paramName); + TInt paramvalue; + + TRAP(err,iApi->GetParamL( iSettingId,*paramName,paramvalue)); + if(err!= -1) + { + return KErrGeneral; + } + iApi->SetParamL( iSettingId,*paramName,12345); + delete paramName; + + for (TInt i=0; i < count; i++ ) + { + HBufC* paramName = HBufC::NewL( KParamName().Length() + 20 ); + paramName->Des().AppendFormat( KParamName(), i ); + + iApi->RemoveParamL( iSettingId,*paramName); + + delete paramName; + } + + + ResetRepository(); + return KErrNone; + + + } +// ----------------------------------------------------------------------------- +// Cxmppsettings_api::?member_function +// ?implementation_description +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +/* +TInt Cxmppsettings_api::?member_function( + CItemParser& aItem ) + { + + ?code + + } +*/ + +// ========================== OTHER EXPORTED FUNCTIONS ========================= +// None + +// [End of File] - Do not remove diff -r 000000000000 -r e6b17d312c8b imservices/xmppsettingsfetcher/bwins/xmppsettingsfetcheru.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/xmppsettingsfetcher/bwins/xmppsettingsfetcheru.def Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,17 @@ +EXPORTS + ?ConnMgrBus@CXmppParameters@@QAEABVTDesC16@@XZ @ 1 NONAME ; class TDesC16 const & CXmppParameters::ConnMgrBus(void) + ?ConnMgrPath@CXmppParameters@@QAEABVTDesC16@@XZ @ 2 NONAME ; class TDesC16 const & CXmppParameters::ConnMgrPath(void) + ?IapId@CXmppParameters@@QAEJXZ @ 3 NONAME ; long CXmppParameters::IapId(void) + ?NewL@CXmppParameters@@SAPAV1@XZ @ 4 NONAME ; class CXmppParameters * CXmppParameters::NewL(void) + ?Passwd@CXmppParameters@@QAEABVTDesC16@@XZ @ 5 NONAME ; class TDesC16 const & CXmppParameters::Passwd(void) + ?Protocol@CXmppParameters@@QAEABVTDesC16@@XZ @ 6 NONAME ; class TDesC16 const & CXmppParameters::Protocol(void) + ?ProxyPort@CXmppParameters@@QAEJXZ @ 7 NONAME ; long CXmppParameters::ProxyPort(void) + ?ProxyServer@CXmppParameters@@QAEABVTDesC16@@XZ @ 8 NONAME ; class TDesC16 const & CXmppParameters::ProxyServer(void) + ?ReadSettingsL@CXmppSettingsFetcher@@SAHKAAVCXmppParameters@@@Z @ 9 NONAME ; int CXmppSettingsFetcher::ReadSettingsL(unsigned long, class CXmppParameters &) + ?Resource@CXmppParameters@@QAEABVTDesC16@@XZ @ 10 NONAME ; class TDesC16 const & CXmppParameters::Resource(void) + ?ServerAddress@CXmppParameters@@QAEABVTDesC16@@XZ @ 11 NONAME ; class TDesC16 const & CXmppParameters::ServerAddress(void) + ?ServerPort@CXmppParameters@@QAEJXZ @ 12 NONAME ; long CXmppParameters::ServerPort(void) + ?SettingsId@CXmppParameters@@QAEKXZ @ 13 NONAME ; unsigned long CXmppParameters::SettingsId(void) + ?Ssl@CXmppParameters@@QAEHXZ @ 14 NONAME ; int CXmppParameters::Ssl(void) + ?UserName@CXmppParameters@@QAEABVTDesC16@@XZ @ 15 NONAME ; class TDesC16 const & CXmppParameters::UserName(void) + diff -r 000000000000 -r e6b17d312c8b imservices/xmppsettingsfetcher/eabi/xmppsettingsfetcheru.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/xmppsettingsfetcher/eabi/xmppsettingsfetcheru.def Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,19 @@ +EXPORTS + _ZN15CXmppParameters10ServerPortEv @ 1 NONAME + _ZN15CXmppParameters10SettingsIdEv @ 2 NONAME + _ZN15CXmppParameters11ProxyServerEv @ 3 NONAME + _ZN15CXmppParameters13ServerAddressEv @ 4 NONAME + _ZN15CXmppParameters3SslEv @ 5 NONAME + _ZN15CXmppParameters4NewLEv @ 6 NONAME + _ZN15CXmppParameters5IapIdEv @ 7 NONAME + _ZN15CXmppParameters6PasswdEv @ 8 NONAME + _ZN15CXmppParameters8ResourceEv @ 9 NONAME + _ZN15CXmppParameters8UserNameEv @ 10 NONAME + _ZN15CXmppParameters9ProxyPortEv @ 11 NONAME + _ZN20CXmppSettingsFetcher13ReadSettingsLEmR15CXmppParameters @ 12 NONAME + _ZTI15CXmppParameters @ 13 NONAME ; ## + _ZTV15CXmppParameters @ 14 NONAME ; ## + _ZN15CXmppParameters10ConnMgrBusEv @ 15 NONAME + _ZN15CXmppParameters11ConnMgrPathEv @ 16 NONAME + _ZN15CXmppParameters8ProtocolEv @ 17 NONAME + diff -r 000000000000 -r e6b17d312c8b imservices/xmppsettingsfetcher/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/xmppsettingsfetcher/group/bld.inf Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,31 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: fetches the xmpp settings from the settings store +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS +../rom/xmppsettingsfetcher.iby CORE_MW_LAYER_IBY_EXPORT_PATH(xmppsettingsfetcher.iby) + +PRJ_MMPFILES + +xmppsettingsfetcher.mmp + +// End of File diff -r 000000000000 -r e6b17d312c8b imservices/xmppsettingsfetcher/group/xmppsettingsfetcher.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/xmppsettingsfetcher/group/xmppsettingsfetcher.mmp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,41 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: fetches the xmpp settings from the settings store +* +*/ + + +# include +TARGET xmppsettingsfetcher.dll +TARGETTYPE DLL +UID 0x1000008d 0x20010124 + +CAPABILITY CAP_ECOM_PLUGIN +VENDORID VID_DEFAULT + +VERSION 10.0 + +SOURCEPATH ../src +SOURCE xmppsettingsfetcher.cpp +SOURCE xmppparameters.cpp + +USERINCLUDE ../inc + + + MW_LAYER_SYSTEMINCLUDE + +LIBRARY euser.lib +LIBRARY jabbersettings.lib + +// End of File diff -r 000000000000 -r e6b17d312c8b imservices/xmppsettingsfetcher/inc/xmppparameters.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/xmppsettingsfetcher/inc/xmppparameters.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,312 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: stores the parameters needed for xmpp +* +*/ + +#ifndef __CXMPPPARAMETERS_H__ +#define __CXMPPPARAMETERS_H__ + +// INCLUDES +#include + +// FORWARD DECLARATIONS + +const TUint32 KMaxLength = 127; + +/** + * CXmppParameters + * + * parameters for xmpp + * + */ +class CXmppParameters: public CBase + { +public: + + /** + * Two Phase Constructor + */ + IMPORT_C static CXmppParameters* NewL(); + + /** + * Destructor + */ + virtual ~CXmppParameters(); + + +private: + + /** + * Default Constructor + */ + CXmppParameters(); + void ConstructL(); + + +public: + + /** + * Sets the value of the member variable iIapId + * + * @param aIapId value to set + */ + void SetIapId(TInt32 aIapId); + + /** + * Sets the value of the member variable iSettingsId + * + * @param aSettingsId value to set + */ + void SetSettingsId(TUint32 aSettingsId); + + /** + * Sets the value of the member variable iServerAddress + * + * @param aServerAddress value to set + */ + void SetServerAddress(const TDesC& aServerAddress); + + /** + * Sets the value of the member variable iUserName + * + * @param aUserName value to set + */ + void SetUserName(const TDesC& aUserName); + + /** + * Sets the value of the member variable iPassword + * + * @param aPassword value to set + */ + void SetPasswd(const TDesC& aPassword); + + /** + * Sets the value of the member variable iResource + * + * @param aResource value to set + */ + void SetResource(const TDesC& aResource); + + /** + * Sets the value of the member variable iProxyServer + * + * @param aProxyServer value to set + */ + void SetProxyServer(const TDesC& aProxyServer); + + /** + * Sets the value of the member variable iServerPort + * + * @param aServerPort value to set + */ + void SetServerPort(TInt32 aServerPort); + + /** + * Sets the value of the member variable iProxyPort + * + * @param aProxyPort value to set + */ + void SetProxyPort(TInt32 aProxyPort); + + /** + * Sets the value of the member variable iSsl + * + * @param aSsl value to set + */ + void SetSsl(TBool aSsl); + + /** + * Sets the value of the member variable iConnMgrBus + * + * @param aSsl value to set + */ + void CXmppParameters::SetConnMgrBus(const TDesC& aConnMgrBus); + + /** + * Sets the value of the member variable iConnMgrPath + * + * @param aSsl value to set + */ + void CXmppParameters::SetConnMgrPath(const TDesC& aConnMgrPath); + + /** + * Sets the value of the member variable iProtocol + * + * @param aSsl value to set + */ + void CXmppParameters::SetProtocol(const TDesC& aProtocol); + + /** + * Returns the value of the member variable iIapId + * + * @param None + */ + IMPORT_C TInt32 IapId(); + + /** + * Returns the value of the member variable iSettingsId + * + * @param None + */ + IMPORT_C TUint32 SettingsId(); + + /** + * Returns the value of the member variable iServerAddress + * + * @param None + */ + IMPORT_C const TDesC& ServerAddress(); + + /** + * Returns the value of the member variable iUserName + * + * @param None + */ + IMPORT_C const TDesC& UserName(); + + /** + * Returns the value of the member variable iPassword + * + * @param None + */ + IMPORT_C const TDesC& Passwd(); + + /** + * Returns the value of the member variable iResource + * + * @param None + */ + IMPORT_C const TDesC& Resource(); + + /** + * Returns the value of the member variable iProxyServer + * + * @param None + */ + IMPORT_C const TDesC& ProxyServer(); + + /** + * Returns the value of the member variable iServerPort + * + * @param None + */ + IMPORT_C TInt32 ServerPort(); + + /** + * Returns the value of the member variable iProxyPort + * + * @param None + */ + IMPORT_C TInt32 ProxyPort(); + + /** + * Returns the value of the member variable iSsl + * + * @param None + */ + IMPORT_C TBool Ssl(); + + /** + * Returns the value of the member variable iConnMgrBus + * + * @param None + */ + IMPORT_C const TDesC& CXmppParameters::ConnMgrBus(); + + /** + * Returns the value of the member variable iConnMgrPath + * + * @param None + */ + IMPORT_C const TDesC& CXmppParameters::ConnMgrPath(); + + /** + * Returns the value of iProtocol + * + * @param None + */ + IMPORT_C const TDesC& CXmppParameters::Protocol(); + +private: // data + + /** + * IapId to use for the xmpp connection + */ + TInt32 iIapId; + + /** + * settingsid in the xmpp settings store + */ + TInt32 iSettingsId; + + /** + * xmpp server to connect to + */ + HBufC* iServerAddress; + + /** + * username to use for the xmpp connection + */ + HBufC* iUserName; + + /** + * password of the user + */ + HBufC* iPassword; + + /** + * resource to use for the xmpp connection + */ + HBufC* iResource; + + /** + * proxy server to use for the xmpp connection + */ + HBufC* iProxyServer; + + /** + * port number to connect to in the xmpp server + */ + TInt32 iServerPort; + + /** + * port number of the proxy server to connect to + */ + TInt32 iProxyPort; + + /** + * indicates whether to use ssl or not for the connection + */ + TBool iSsl; + + /** + * Connection manager bus : Protocol specific + */ + HBufC* iConnMgrBus; + + /** + * Connection manager path : Protocol specific + */ + HBufC* iConnMgrPath; + + /** + * Protocol name + */ + HBufC* iProtocol; + }; + + +#endif // __CXMPPSETTINGSFETCHER_H__ + diff -r 000000000000 -r e6b17d312c8b imservices/xmppsettingsfetcher/inc/xmppsettingsfetcher.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/xmppsettingsfetcher/inc/xmppsettingsfetcher.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,49 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: fetches xmpp settings from settings store +* +*/ + +#ifndef __CXMPPSETTINGSFETCHER_H__ +#define __CXMPPSETTINGSFETCHER_H__ + +// INCLUDES +#include + +// FORWARD DECLARATIONS +class CXmppParameters; + +/** + * CXmppSettingsFetcher + * + * Fetches settings from the xmpp settings store + * + */ +class CXmppSettingsFetcher : public CBase + { + +public: + /** + * Reads the settings corresponding to the settingsid from + * the xmpp settings store and stores them to the out parameter + * + * @param aSettingsId provided settingsid + * @param aParams settings read from the store are stored in this parameter + */ + IMPORT_C static TInt ReadSettingsL( TUint32 aSettingsId, CXmppParameters& aParams ); + + }; + + +#endif // __CXMPPSETTINGSFETCHER_H__ diff -r 000000000000 -r e6b17d312c8b imservices/xmppsettingsfetcher/rom/xmppsettingsfetcher.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/xmppsettingsfetcher/rom/xmppsettingsfetcher.iby Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,27 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: IBY file for XMPP setting fetcher +* +*/ + +#ifndef __XMPPSETTINGSFETCHER_IBY__ +#define __XMPPSETTINGSFETCHER_IBY__ + +//xmpp settings + +file=ABI_DIR\BUILD_DIR\xmppsettingsfetcher.dll SHARED_LIB_DIR\xmppsettingsfetcher.dll + +#endif + + diff -r 000000000000 -r e6b17d312c8b imservices/xmppsettingsfetcher/src/xmppparameters.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/xmppsettingsfetcher/src/xmppparameters.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,323 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: stores the parameters needed for xmpp +* +*/ + +#include "xmppparameters.h" + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// CXmppParameters::CXmppParameters +// --------------------------------------------------------------------------- +// +CXmppParameters::CXmppParameters() + { + } + + +// --------------------------------------------------------------------------- +// CXmppParameters::ConstructL +// --------------------------------------------------------------------------- +// +void CXmppParameters::ConstructL() + { + iServerAddress = HBufC::NewL(KMaxLength); + iUserName = HBufC::NewL(KMaxLength); + iPassword = HBufC::NewL(KMaxLength); + iResource = HBufC::NewL(KMaxLength); + iProxyServer = HBufC::NewL(KMaxLength); + + iConnMgrBus = HBufC::NewL(KMaxLength); + iConnMgrPath = HBufC::NewL(KMaxLength); + iProtocol = HBufC::NewL(KMaxLength); + + } + + +// --------------------------------------------------------------------------- +// CXmppParameters::NewL() +// --------------------------------------------------------------------------- +// +EXPORT_C CXmppParameters* CXmppParameters::NewL() + { + + CXmppParameters* self = new( ELeave ) + CXmppParameters(); + + CleanupStack::PushL( self ); + + self->ConstructL(); + CleanupStack::Pop( self ); + + return self; + } + + +// --------------------------------------------------------------------------- +// CXmppParameters::~CXmppParameters +// --------------------------------------------------------------------------- +// +CXmppParameters::~CXmppParameters() + { + delete iServerAddress; + delete iUserName; + delete iPassword; + delete iResource; + delete iProxyServer; + + delete iProtocol; + delete iConnMgrPath; + delete iConnMgrBus; + // before destory cancel each of the active objects request + } + +// --------------------------------------------------------------------------- +// CXmppParameters::SetIapId +// --------------------------------------------------------------------------- +// +void CXmppParameters::SetIapId(TInt32 aIapId) + { + iIapId = aIapId; + } + +// --------------------------------------------------------------------------- +// CXmppParameters::SetSettingsId +// --------------------------------------------------------------------------- +// +void CXmppParameters::SetSettingsId(TUint32 aSettingsId) + { + iSettingsId = aSettingsId; + } + +// --------------------------------------------------------------------------- +// CXmppParameters::SetServerAddress +// --------------------------------------------------------------------------- +// +void CXmppParameters::SetServerAddress(const TDesC& aServerAddress) + { + iServerAddress->Des().Copy(aServerAddress); + } + +// --------------------------------------------------------------------------- +// CXmppParameters::SetUsername +// --------------------------------------------------------------------------- +// +void CXmppParameters::SetUserName(const TDesC& aUserName) + { + iUserName->Des().Copy(aUserName); + } + +// --------------------------------------------------------------------------- +// CXmppParameters::SetPasswd +// --------------------------------------------------------------------------- +// +void CXmppParameters::SetPasswd(const TDesC& aPassword) + { + iPassword->Des().Copy(aPassword); + } + +// --------------------------------------------------------------------------- +// CXmppParameters::SetResource +// --------------------------------------------------------------------------- +// +void CXmppParameters::SetResource(const TDesC& aResource) + { + iResource->Des().Copy(aResource); + } + +// --------------------------------------------------------------------------- +// CXmppParameters::SetProxyServer +// --------------------------------------------------------------------------- +// +void CXmppParameters::SetProxyServer(const TDesC& aProxyServer) + { + iProxyServer->Des().Copy(aProxyServer); + } + +// --------------------------------------------------------------------------- +// CXmppParameters::SetServerPort +// --------------------------------------------------------------------------- +// +void CXmppParameters::SetServerPort(TInt32 aServerPort) + { + iServerPort = aServerPort; + } + +// --------------------------------------------------------------------------- +// CXmppParameters::SetProxyPort +// --------------------------------------------------------------------------- +// +void CXmppParameters::SetProxyPort(TInt32 aProxyPort) + { + iProxyPort = aProxyPort; + } + +// --------------------------------------------------------------------------- +// CXmppParameters::SetSsl +// --------------------------------------------------------------------------- +// +void CXmppParameters::SetSsl(TBool aSsl) + { + iSsl = aSsl; + } + + +// --------------------------------------------------------------------------- +// CXmppParameters::SetProxyServer +// --------------------------------------------------------------------------- +// +void CXmppParameters::SetConnMgrBus(const TDesC& aConnMgrBus) + { + iConnMgrBus->Des().Copy(aConnMgrBus); + } + +// --------------------------------------------------------------------------- +// CXmppParameters::SetProxyServer +// --------------------------------------------------------------------------- +// +void CXmppParameters::SetConnMgrPath(const TDesC& aConnMgrPath) + { + iConnMgrPath->Des().Copy(aConnMgrPath); + } + +// --------------------------------------------------------------------------- +// CXmppParameters::SetProxyServer +// --------------------------------------------------------------------------- +// +void CXmppParameters::SetProtocol(const TDesC& aProtocol) + { + iProtocol->Des().Copy(aProtocol); + } +// --------------------------------------------------------------------------- +// CXmppParameters::IapId +// --------------------------------------------------------------------------- +// +EXPORT_C TInt32 CXmppParameters::IapId() + { + return iIapId; + } + +// --------------------------------------------------------------------------- +// CXmppParameters::SettingsId +// --------------------------------------------------------------------------- +// +EXPORT_C TUint32 CXmppParameters::SettingsId() + { + return iSettingsId; + } + +// --------------------------------------------------------------------------- +// CXmppParameters::ServerAddress +// --------------------------------------------------------------------------- +// +EXPORT_C const TDesC& CXmppParameters::ServerAddress() + { + return *iServerAddress; + } + +// --------------------------------------------------------------------------- +// CXmppParameters::Username +// --------------------------------------------------------------------------- +// +EXPORT_C const TDesC& CXmppParameters::UserName() + { + return *iUserName; + } + +// --------------------------------------------------------------------------- +// CXmppParameters::Passwd +// --------------------------------------------------------------------------- +// +EXPORT_C const TDesC& CXmppParameters::Passwd() + { + return *iPassword; + } + +// --------------------------------------------------------------------------- +// CXmppParameters::Resource +// --------------------------------------------------------------------------- +// +EXPORT_C const TDesC& CXmppParameters::Resource() + { + return *iResource; + } + +// --------------------------------------------------------------------------- +// CXmppParameters::ProxyServer +// --------------------------------------------------------------------------- +// +EXPORT_C const TDesC& CXmppParameters::ProxyServer() + { + return *iProxyServer; + } + +// --------------------------------------------------------------------------- +// CXmppParameters::ServerPort +// --------------------------------------------------------------------------- +// +EXPORT_C TInt32 CXmppParameters::ServerPort() + { + return iServerPort; + } + +// --------------------------------------------------------------------------- +// CXmppParameters::ProxyPort +// --------------------------------------------------------------------------- +// +EXPORT_C TInt32 CXmppParameters::ProxyPort() + { + return iProxyPort; + } + +// --------------------------------------------------------------------------- +// CXmppParameters::Ssl +// --------------------------------------------------------------------------- +// +EXPORT_C TBool CXmppParameters::Ssl() + { + return iSsl; + } + +// --------------------------------------------------------------------------- +// CXmppParameters::ConnMgrBus +// --------------------------------------------------------------------------- +// +EXPORT_C const TDesC& CXmppParameters::ConnMgrBus() + { + return *iConnMgrBus; + } + +// --------------------------------------------------------------------------- +// CXmppParameters::ConnMgrPath +// --------------------------------------------------------------------------- +// +EXPORT_C const TDesC& CXmppParameters::ConnMgrPath() + { + return *iConnMgrPath; + } + +// --------------------------------------------------------------------------- +// CXmppParameters::Protocol +// --------------------------------------------------------------------------- +// +EXPORT_C const TDesC& CXmppParameters::Protocol() + { + return *iProtocol; + } + + +// End of File + diff -r 000000000000 -r e6b17d312c8b imservices/xmppsettingsfetcher/src/xmppsettingsfetcher.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/xmppsettingsfetcher/src/xmppsettingsfetcher.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,136 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: fetches xmpp settings from settings store +* +*/ + +#include "xmppsettingsfetcher.h" +#include "xmppservicesettingsapi.h" + +#include "xmppparameters.h" +#include + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// CXmppSettingsFetcher::ReadSettings +// --------------------------------------------------------------------------- +// +EXPORT_C TInt CXmppSettingsFetcher::ReadSettingsL( TUint32 aSettingsId, CXmppParameters& aParams ) + { + TBool settingsFound = EFalse; + RArray settingIdArray; + CXmppSettingsApi* api = CXmppSettingsApi::NewLC(); + + CleanupClosePushL( settingIdArray ); + api->GetSettingsRecordIdArrayL( settingIdArray ); + + //first store the settingsid + aParams.SetSettingsId(aSettingsId); + + for ( TInt i=0; iGetParamL( settingIdArray[i], + XmppParams::KXmppParamServerPort(), + paramValueInt ); + aParams.SetServerPort(paramValueInt); + + api->GetParamL( settingIdArray[i], + XmppParams::KXmppParamHttpsProxyServerPort(), + paramValueInt ); + aParams.SetProxyPort(paramValueInt); + + api->GetParamL( settingIdArray[i], + XmppParams::KXmppParamSnapId(), + paramValueInt ); + aParams.SetIapId(paramValueInt); + + //settings with boolean values + TBool paramValueBool(EFalse); + api->GetParamL( settingIdArray[i], + XmppParams::KXmppParamOldSSLRequired(), + paramValueBool ); + aParams.SetSsl(paramValueBool); + + //settings with descriptor values + RBuf paramValueBuf; + paramValueBuf.CreateL( KMaxLength ); + paramValueBuf.CleanupClosePushL(); + + api->GetParamL( settingIdArray[i], + XmppParams::KXmppParamXmppServerAddress(), + paramValueBuf ); + aParams.SetServerAddress(paramValueBuf); + paramValueBuf.Zero(); + + api->GetParamL( settingIdArray[i], + XmppParams::KXmppParamUsername(), + paramValueBuf ); + aParams.SetUserName(paramValueBuf); + paramValueBuf.Zero(); + + api->GetParamL( settingIdArray[i], + XmppParams::KXmppParamPassword(), + paramValueBuf ); + aParams.SetPasswd(paramValueBuf); + paramValueBuf.Zero(); + + api->GetParamL( settingIdArray[i], + XmppParams::KXmppParamResource(), + paramValueBuf ); + aParams.SetResource(paramValueBuf); + paramValueBuf.Zero(); + + api->GetParamL( settingIdArray[i], + XmppParams::KXmppParamHttpsProxyServerAddress(), + paramValueBuf ); + aParams.SetProxyServer(paramValueBuf); + paramValueBuf.Zero(); + + api->GetParamL( settingIdArray[i], + XmppParams::KXmppParamConnMgrBus(), + paramValueBuf ); + aParams.SetConnMgrBus(paramValueBuf); + paramValueBuf.Zero(); + + api->GetParamL( settingIdArray[i], + XmppParams::KXmppParamConnMgrPath(), + paramValueBuf ); + aParams.SetConnMgrPath(paramValueBuf); + paramValueBuf.Zero(); + + api->GetParamL( settingIdArray[i], + XmppParams::KXmppParamProtocol(), + paramValueBuf ); + aParams.SetProtocol(paramValueBuf); + + CleanupStack::PopAndDestroy( ¶mValueBuf ); + settingsFound = ETrue; + break; + } + } + + CleanupStack::PopAndDestroy( &settingIdArray ); + CleanupStack::PopAndDestroy( api ); + if(!settingsFound) + return KErrNotFound; + return KErrNone; + } + +// End of File + diff -r 000000000000 -r e6b17d312c8b imservices/xmppsettingsfetcher/tsrc/xmppsettingsfetchermt/bmarm/xmppsettingsfetchermtu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/xmppsettingsfetcher/tsrc/xmppsettingsfetchermt/bmarm/xmppsettingsfetchermtu.def Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,4 @@ +EXPORTS + LibEntryL__Fv @ 1 NONAME R3UNUSED ; LibEntryL(void) + SetRequirements__FRP16CTestModuleParamRUl @ 2 NONAME R3UNUSED ; SetRequirements(CTestModuleParam *&, unsigned long &) + diff -r 000000000000 -r e6b17d312c8b imservices/xmppsettingsfetcher/tsrc/xmppsettingsfetchermt/bwins/xmppsettingsfetchermtu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/xmppsettingsfetcher/tsrc/xmppsettingsfetchermt/bwins/xmppsettingsfetchermtu.def Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,4 @@ +EXPORTS + ?LibEntryL@@YAPAVCTestModuleBase@@XZ @ 1 NONAME ; class CTestModuleBase * __cdecl LibEntryL(void) + ?SetRequirements@@YAHAAPAVCTestModuleParam@@AAK@Z @ 2 NONAME ; int __cdecl SetRequirements(class CTestModuleParam * &,unsigned long &) + diff -r 000000000000 -r e6b17d312c8b imservices/xmppsettingsfetcher/tsrc/xmppsettingsfetchermt/eabi/xmppsettingsfetchermtu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/xmppsettingsfetcher/tsrc/xmppsettingsfetchermt/eabi/xmppsettingsfetchermtu.def Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,4 @@ +EXPORTS + _Z9LibEntryLv @ 1 NONAME + _Z15SetRequirementsRP16CTestModuleParamRm @ 2 NONAME + diff -r 000000000000 -r e6b17d312c8b imservices/xmppsettingsfetcher/tsrc/xmppsettingsfetchermt/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/xmppsettingsfetcher/tsrc/xmppsettingsfetchermt/group/bld.inf Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,57 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: bld.inf +* +*/ + + + +PRJ_PLATFORMS +// specify the platforms your component needs to be built for here +// defaults to WINS MARM so you can ignore this if you just build these +DEFAULT + +PRJ_TESTEXPORTS +// NOTE: If using ARS requirements all export operations should be done under this. +// 'abld test export' + +PRJ_EXPORTS +// Specify the source file followed by its destination here +// copy will be used to copy the source file to its destination +// If there's no destination then the source file will be copied +// to the same name in /epoc32/include + +../init/TestFramework.ini /epoc32/winscw/c/TestFramework/TestFramework.ini + +PRJ_TESTMMPFILES +// NOTE: If using ARS requirements .mmp file operation should be done under this. +// 'abld test build' +xmppsettingsfetchermt.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 \ No newline at end of file diff -r 000000000000 -r e6b17d312c8b imservices/xmppsettingsfetcher/tsrc/xmppsettingsfetchermt/group/xmppsettingfetcher_test.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/xmppsettingsfetcher/tsrc/xmppsettingsfetchermt/group/xmppsettingfetcher_test.pkg Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,48 @@ +; +; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +; All rights reserved. +; This component and the accompanying materials are made available +; under the terms of "Eclipse Public License v1.0" +; which accompanies this distribution, and is available +; at the URL "http://www.eclipse.org/legal/epl-v10.html". +; +; Initial Contributors: +; Nokia Corporation - initial contribution. +; +; Contributors: +; +; Description: xmppsettingfetcher_test.pkg +; +;Header +#{"XmppSettingFetcher"}, (0x10202BE9), 1, 2, 3, TYPE=SP + +;Language - standard language definitions +&EN + +;Vendor ID +:"Nokia Corporation" + +;Localised vendor +%{"Vendor-EN"} + +;Supports Series 60 v 0.9 +[0x101F7961], 0, 0, 0, {"Series60ProductID"} + + +;rom will not allow to update it if name is testframework, after install need to rename it to testframework.ini +;INI FILE +"..\init\testframework.ini" -"c:\Testframework\ttestframework.ini" + + + +; Install keyspace in Central Repository private data cage +"..\init\10282CE5.txt" -"c:\private\10202be9\10282CE5.txt" +"..\init\1020E334.txt" -"c:\private\10202be9\1020E334.txt" +"..\init\200195A9.txt" -"c:\private\10202be9\200195A9.txt" +"..\init\2001B288.txt" -"c:\private\10202be9\2001B288.txt" + + +;xmppsettingsfetchermt dll files + +"\EPOC32\RELEASE\ARMV5\UREL\xmppsettingsfetchermt.dll" -"!:\sys\bin\xmppsettingsfetchermt.dll" + diff -r 000000000000 -r e6b17d312c8b imservices/xmppsettingsfetcher/tsrc/xmppsettingsfetchermt/group/xmppsettingsfetchermt.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/xmppsettingsfetcher/tsrc/xmppsettingsfetchermt/group/xmppsettingsfetchermt.mmp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,81 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: xmppsettingsfetchermt.mmp +* +*/ + + +#if defined(__S60_) +#include +#endif + +TARGET xmppsettingsfetchermt.dll +TARGETTYPE dll +UID 0x1000008D 0x101FB3E7 + +//CAPABILITY ALL -TCB +CAPABILITY CAP_ECOM_PLUGIN + +/* 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 xmppsettingsfetchermt.def + +SOURCEPATH ../src +SOURCE xmppsettingsfetchermt.cpp +SOURCE xmppsettingsfetchermtCases.cpp + +//RESOURCE resource_file +//RESOURCE resource_file2 + +USERINCLUDE ../inc +USERINCLUDE ../../../inc + +MW_LAYER_SYSTEMINCLUDE + + + + +LIBRARY euser.lib +LIBRARY stiftestinterface.lib +LIBRARY stiftestengine.lib +LIBRARY jabbersettings.lib +LIBRARY xmppsettingsfetcher.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 000000000000 -r e6b17d312c8b imservices/xmppsettingsfetcher/tsrc/xmppsettingsfetchermt/inc/xmppsettingsfetchermt.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/xmppsettingsfetcher/tsrc/xmppsettingsfetchermt/inc/xmppsettingsfetchermt.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,372 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: xmppsettingsfetchermt test module. +* +*/ + + + +#ifndef XMPPSETTINGSFETCHERMT_H +#define XMPPSETTINGSFETCHERMT_H + +// INCLUDES +#include "StifTestModule.h" +#include +#include "xmppparams.h" +#include + +// CONSTANTS +//const ?type ?constant_var = ?constant; + +// MACROS +//#define ?macro ?macro_def + +// Logging path +_LIT( KxmppsettingsfetchermtLogPath, "\\logs\\testframework\\xmppsettingsfetchermt\\" ); +// Log file +_LIT( KxmppsettingsfetchermtLogFile, "xmppsettingsfetchermt.txt" ); +_LIT( KxmppsettingsfetchermtLogFileWithTitle, "xmppsettingsfetchermt_[%S].txt" ); + +#define GETPTR & +#define ENTRY(str,func) {_S(str), GETPTR func,0,0,0} +#define FUNCENTRY(func) {_S(#func), GETPTR func,0,0,0} +#define OOM_ENTRY(str,func,a,b,c) {_S(str), GETPTR func,a,b,c} +#define OOM_FUNCENTRY(func,a,b,c) {_S(#func), GETPTR func,a,b,c} + +// FUNCTION PROTOTYPES +//?type ?function_name(?arg_list); + +// FORWARD DECLARATIONS +//class ?FORWARD_CLASSNAME; +class Cxmppsettingsfetchermt; +class CXmppParameters; +// DATA TYPES +//enum ?declaration +enum TTestCase + { + EPositiveTest, + EDescriptorTest, + EIntegerTest + }; +//typedef ?declaration +//extern ?data_type; +// A typedef for function that does the actual testing, +// function is a type +// TInt Cxmppsettingsfetchermt:: ( TTestResult& aResult ) +typedef TInt (Cxmppsettingsfetchermt::* TestFunction)(TTestResult&); + +// CLASS DECLARATION + +/** +* An internal structure containing a test case name and +* the pointer to function doing the test +* +* @lib ?library +* @since ?Series60_version +*/ +class TCaseInfoInternal + { + public: + const TText* iCaseName; + TestFunction iMethod; + TBool iIsOOMTest; + TInt iFirstMemoryAllocation; + TInt iLastMemoryAllocation; + }; + +// CLASS DECLARATION + +/** +* A structure containing a test case name and +* the pointer to function doing the test +* +* @lib ?library +* @since ?Series60_version +*/ +class TCaseInfo + { + public: + TPtrC iCaseName; + TestFunction iMethod; + TBool iIsOOMTest; + TInt iFirstMemoryAllocation; + TInt iLastMemoryAllocation; + + TCaseInfo( const TText* a ) : iCaseName( (TText*) a ) + { + }; + + }; + + + _LIT( KTestcasePassed, "test case passed" ); + _LIT( KTestcaseFailed, "test case failed" ); + _LIT( KVerificationFailed, "Verification of data failed" ); + + //parameter values to set + const TInt port = 2020; + const TBool httpsProxyPort = 19; + const TInt iapId = 3; + + _LIT( KXmppServerAddress , "Test.Server.com"); + _LIT( KUsername , "user@server.com"); + _LIT( KPassword , "password"); + +// gabble specific things + _LIT( KResouceText , "resource"); + _LIT( KHttpsProxyServerAddressText , "proxy.server.com"); + _LIT( KAliasText , "alias"); + _LIT( KConnMgrBus, "org.freedesktop.Telepathy.ConnectionManager.gabble" ); + _LIT( KConnMgrPath, "/org/freedesktop/Telepathy/ConnectionManager/gabble" ); + _LIT( KParamProtocol , "jabber" ); + const TBool oldSSL = ETrue; + const TBool resigter = EFalse; + +// values for error cases + _LIT( KNullUsername , ""); //empty string + const TInt portNegative = -20; + const TInt iapIdZero = 0; + + + +// CLASS DECLARATION + +/** +* This a xmppsettingsfetchermt class. +* ?other_description_lines +* +* @lib ?library +* @since ?Series60_version +*/ +NONSHARABLE_CLASS(Cxmppsettingsfetchermt) : public CTestModuleBase + { + public: // Constructors and destructor + + + /** + * Two-phased constructor. + */ + static Cxmppsettingsfetchermt* NewL(); + + /** + * Destructor. + */ + virtual ~Cxmppsettingsfetchermt(); + + public: // New functions + + /** + * ?member_description. + * @since ?Series60_version + * @param ?arg1 ?description + * @return ?description + */ + //?type ?member_function( ?type ?arg1 ); + + public: // Functions from base classes + + /** + * From CTestModuleBase InitL is used to initialize the + * xmppsettingsfetchermt. It is called once for every instance of + * TestModulexmppsettingsfetchermt after its creation. + * @since ?Series60_version + * @param aIniFile Initialization file for the test module (optional) + * @param aFirstTime Flag is true when InitL is executed for first + * created instance of xmppsettingsfetchermt. + * @return Symbian OS error code + */ + TInt InitL( TFileName& aIniFile, TBool aFirstTime ); + + /** + * From CTestModuleBase GetTestCasesL is used to inquiry test cases + * from xmppsettingsfetchermt. + * @since ?Series60_version + * @param aTestCaseFile Test case file (optional) + * @param aTestCases Array of TestCases returned to test framework + * @return Symbian OS error code + */ + TInt GetTestCasesL( const TFileName& aTestCaseFile, + RPointerArray& aTestCases ); + + /** + * From CTestModuleBase RunTestCaseL is used to run an individual + * test case. + * @since ?Series60_version + * @param aCaseNumber Test case number + * @param aTestCaseFile Test case file (optional) + * @param aResult Test case result returned to test framework (PASS/FAIL) + * @return Symbian OS error code (test case execution error, which is + * not reported in aResult parameter as test case failure). + */ + TInt RunTestCaseL( const TInt aCaseNumber, + const TFileName& aTestCaseFile, + TTestResult& aResult ); + + /** + * From CTestModuleBase; OOMTestQueryL is used to specify is particular + * test case going to be executed using OOM conditions + * @param aTestCaseFile Test case file (optional) + * @param aCaseNumber Test case number (optional) + * @param aFailureType OOM failure type (optional) + * @param aFirstMemFailure The first heap memory allocation failure value (optional) + * @param aLastMemFailure The last heap memory allocation failure value (optional) + * @return TBool + */ + virtual TBool OOMTestQueryL( const TFileName& /* aTestCaseFile */, + const TInt /* aCaseNumber */, + TOOMFailureType& aFailureType, + TInt& /* aFirstMemFailure */, + TInt& /* aLastMemFailure */ ); + + /** + * From CTestModuleBase; OOMTestInitializeL may be used to initialize OOM + * test environment + * @param aTestCaseFile Test case file (optional) + * @param aCaseNumber Test case number (optional) + * @return None + */ + virtual void OOMTestInitializeL( const TFileName& /* aTestCaseFile */, + const TInt /* aCaseNumber */ ); + + /** + * From CTestModuleBase; OOMHandleWarningL + * @param aTestCaseFile Test case file (optional) + * @param aCaseNumber Test case number (optional) + * @param aFailNextValue FailNextValue for OOM test execution (optional) + * @return None + * + * User may add implementation for OOM test warning handling. Usually no + * implementation is required. + */ + virtual void OOMHandleWarningL( const TFileName& /* aTestCaseFile */, + const TInt /* aCaseNumber */, + TInt& /* aFailNextValue */); + + /** + * From CTestModuleBase; OOMTestFinalizeL may be used to finalize OOM + * test environment + * @param aTestCaseFile Test case file (optional) + * @param aCaseNumber Test case number (optional) + * @return None + * + */ + virtual void OOMTestFinalizeL( const TFileName& /* aTestCaseFile */, + const TInt /* aCaseNumber */ ); + + 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. + */ + Cxmppsettingsfetchermt(); + + /** + * 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& ); + + /** + * Function returning test case name and pointer to test case function. + * @since ?Series60_version + * @param aCaseNumber test case number + * @return TCaseInfo + */ + const TCaseInfo Case ( const TInt aCaseNumber ) const; + + /** + * [test case declarations] - do not remove + */ + //ADD NEW METHOD DEC HERE" + + /** + * Positive test case. + * @since ?Series60_version + * @param aResult Test case result (PASS/FAIL) + * @return Symbian OS error code (test case execution error + * that is not returned as test case result in aResult) + */ + TInt SetAndReadSettingsL( TTestResult& aResult ); + TInt ReadUnexistingSettingsL( TTestResult& aResult ); + TInt ReadIncompleteSettingsL( TTestResult& aResult ); + TInt ReadDescSettingsL( TTestResult& aResult ); + TInt ReadIntSettingsL( TTestResult& aResult ); + + void WriteSettingsL( CXmppSettingsApi* aApi, TUint32 aSettingId, TTestCase aTestCase ); + TBool VerifySettingsL( CXmppParameters* aXmppParams, TUint32 settingId, TTestCase aTestCase ); + void WriteIncompleteSettingsL( CXmppSettingsApi* aApi, TUint32 aSettingId ); + + public: // Data + // ?one_line_short_description_of_data + //?data_declaration; + + protected: // Data + // ?one_line_short_description_of_data + //?data_declaration; + + private: // Data + // Pointer to test (function) to be executed + TestFunction iMethod; + + // Pointer to logger + CStifLogger * iLog; + + // Normal logger + CStifLogger* iStdLog; + + // Test case logger + CStifLogger* iTCLog; + + // Flag saying if test case title should be added to log file name + TBool iAddTestCaseTitleToLogName; + + // ?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 // XMPPSETTINGSFETCHERMT_H + +// End of File diff -r 000000000000 -r e6b17d312c8b imservices/xmppsettingsfetcher/tsrc/xmppsettingsfetchermt/init/1020E334.txt Binary file imservices/xmppsettingsfetcher/tsrc/xmppsettingsfetchermt/init/1020E334.txt has changed diff -r 000000000000 -r e6b17d312c8b imservices/xmppsettingsfetcher/tsrc/xmppsettingsfetchermt/init/10282CE5.txt Binary file imservices/xmppsettingsfetcher/tsrc/xmppsettingsfetchermt/init/10282CE5.txt has changed diff -r 000000000000 -r e6b17d312c8b imservices/xmppsettingsfetcher/tsrc/xmppsettingsfetchermt/init/200195A9.txt Binary file imservices/xmppsettingsfetcher/tsrc/xmppsettingsfetchermt/init/200195A9.txt has changed diff -r 000000000000 -r e6b17d312c8b imservices/xmppsettingsfetcher/tsrc/xmppsettingsfetchermt/init/2001B288.txt Binary file imservices/xmppsettingsfetcher/tsrc/xmppsettingsfetchermt/init/2001B288.txt has changed diff -r 000000000000 -r e6b17d312c8b imservices/xmppsettingsfetcher/tsrc/xmppsettingsfetchermt/init/TestFramework.ini --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/xmppsettingsfetcher/tsrc/xmppsettingsfetchermt/init/TestFramework.ini Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,199 @@ +# +# This is STIF initialization file +# Comment lines start with '#'-character. +# See STIF TestFramework users guide.doc for instructions + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Set following test engine settings: +# - Set Test Reporting mode. TestReportMode's possible values are: +# + 'Summary': Summary of the tested test cases. +# + 'Environment': Hardware and software info. +# + 'TestCases': Test case report. +# + 'FullReport': Set of all above ones. +# + Example 'TestReportMode= Summary TestCases' +# +# - CreateTestReport setting controls report creation mode +# + YES, Test report will created. +# + NO, No Test report. +# +# - File path indicates the base path of the test report. +# - File name indicates the name of the test report. +# +# - File format indicates the type of the test report. +# + TXT, Test report file will be txt type, for example 'TestReport.txt'. +# + HTML, Test report will be html type, for example 'TestReport.html'. +# + XML, Test report will be xml type, for example 'TestReport.xml'. +# Note, that xml format is available only when output is set to FILE. +# +# - File output indicates output source of the test report. +# + FILE, Test report logging to file. +# + RDEBUG, Test report logging to using rdebug. +# +# - File Creation Mode indicates test report overwriting if file exist. +# + OVERWRITE, Overwrites if the Test report file exist. +# + APPEND, Continue logging after the old Test report information if +# report exist. +# - Sets a device reset module's dll name(Reboot). +# + If Nokia specific reset module is not available or it is not correct one +# StifHWResetStub module may use as a template for user specific reset +# module. +# - Sets STIF test measurement disable options. e.g. pluging1 and pluging2 disablation +# DisableMeasurement= stifmeasurementplugin01 stifmeasurementplugin02 +# + +[Engine_Defaults] + +TestReportMode= FullReport # Possible values are: 'Empty', 'Summary', 'Environment', + 'TestCases' or 'FullReport' + +CreateTestReport= YES # Possible values: YES or NO + +TestReportFilePath= C:\LOGS\TestFramework\ +TestReportFileName= TestReport + +TestReportFormat= TXT # Possible values: TXT, HTML or XML +TestReportOutput= FILE # Possible values: FILE or RDEBUG +TestReportFileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND + +DeviceResetDllName= StifResetForNokia.dll # e.g. 'StifHWResetStub.dll' for user specific reseting + +DisableMeasurement= stifmeasurementdisablenone # Possible values are: + # 'stifmeasurementdisablenone', 'stifmeasurementdisableall' + # 'stifmeasurementplugin01', 'stifmeasurementplugin02', + # 'stifmeasurementplugin03', 'stifmeasurementplugin04', + # 'stifmeasurementplugin05' or 'stifbappeaprofiler' + +Timeout= 0 # Default timeout value for each test case. In milliseconds +#UITestingSupport= YES # Possible values: YES or NO +#SeparateProcesses= YES # Possible values: YES or NO (default: NO) +[End_Defaults] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + + + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Module configurations start +# Modules are added between module tags +# tags. Module name is specified after ModuleName= tag, like +# ModuleName= XXXXXXXXX +# Modules might have initialisation file, specified as +# IniFile= c:\testframework\YYYYYY +# Modules might have several configuration files, like +# TestCaseFile= c:\testframework\NormalCases.txt +# TestCaseFile= c:\testframework\SmokeCases.txt +# TestCaseFile= c:\testframework\ManualCases.txt + +# (TestCaseFile is synonym for old term ConfigFile) + +# Following case specifies demo module settings. Demo module +# does not read any settings from file, so tags +# IniFile and TestCaseFile are not used. +# In the simplest case it is enough to specify only the +# name of the test module when adding new test module + +[New_Module] +ModuleName= xmppsettingsfetchermt.dll +[End_Module] + + +# Load testmoduleXXX, optionally with initialization file and/or test case files +#[New_Module] +#ModuleName= testmodulexxx + +#TestModuleXXX used initialization file +#IniFile= c:\testframework\init.txt + +#TestModuleXXX used configuration file(s) +#TestCaseFile= c:\testframework\testcases1.cfg +#TestCaseFile= c:\testframework\testcases2.cfg +#TestCaseFile= c:\testframework\manualtestcases.cfg + +#[End_Module] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + + + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Set STIF logging overwrite parameters for Logger. +# Hardware and emulator environment logging path and styles can +# be configured from here to overwrite the Logger's implemented values. +# +# Settings description: +# - Indicates option for creation log directory/directories. If log directory/directories +# is/are not created by user they will make by software. +# + YES, Create log directory/directories if not allready exist. +# + NO, Log directory/directories not created. Only created one is used. +# +# - Overwrite emulator path setting. +# + Example: If 'EmulatorBasePath= C:\LOGS\TestFramework\' and in code is defined +# Logger's path 'D:\\LOGS\\Module\\' with those definition the path +# will be 'C:\LOGS\TestFramework\LOGS\Module\' +# +# - Overwrite emulator's logging format. +# + TXT, Log file(s) will be txt type(s), for example 'Module.txt'. +# + HTML, Log file(s) will be html type(s), for example 'Module.html'. +# +# - Overwrited emulator logging output source. +# + FILE, Logging to file(s). +# + RDEBUG, Logging to using rdebug(s). +# +# - Overwrite hardware path setting (Same description as above in emulator path). +# - Overwrite hardware's logging format(Same description as above in emulator format). +# - Overwrite hardware's logging output source(Same description as above in emulator output). +# +# - File Creation Mode indicates file overwriting if file exist. +# + OVERWRITE, Overwrites if file(s) exist. +# + APPEND, Continue logging after the old logging information if file(s) exist. +# +# - Will thread id include to the log filename. +# + YES, Thread id to log file(s) name, Example filename 'Module_b9.txt'. +# + NO, No thread id to log file(s), Example filename 'Module.txt'. +# +# - Will time stamps include the to log file. +# + YES, Time stamp added to each line in log file(s). Time stamp is +# for example'12.Nov.2003 115958 LOGGING INFO' +# + NO, No time stamp(s). +# +# - Will line breaks include to the log file. +# + YES, Each logging event includes line break and next log event is in own line. +# + NO, No line break(s). +# +# - Will event ranking include to the log file. +# + YES, Event ranking number added to each line in log file(s). Ranking number +# depends on environment's tics, for example(includes time stamp also) +# '012 12.Nov.2003 115958 LOGGING INFO' +# + NO, No event ranking. +# +# - Will write log file in unicode format. +# + YES, Log file will be written in unicode format +# + NO, Log will be written as normal, not unicode, file. +# + +[Logger_Defaults] + +#NOTE: If you want to set Logger using next setting(s) remove comment(s)'#' +#NOTE: TestEngine and TestServer logging settings cannot change here + +#CreateLogDirectories= YES # Possible values: YES or NO + +#EmulatorBasePath= C:\LOGS\TestFramework\ +#EmulatorFormat= HTML # Possible values: TXT or HTML +#EmulatorOutput= FILE # Possible values: FILE or RDEBUG + +#HardwareBasePath= D:\LOGS\TestFramework\ +#HardwareFormat= HTML # Possible values: TXT or HTML +#HardwareOutput= FILE # Possible values: FILE or RDEBUG + +#FileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND + +#ThreadIdToLogFile= YES # Possible values: YES or NO +#WithTimeStamp= YES # Possible values: YES or NO +#WithLineBreak= YES # Possible values: YES or NO +#WithEventRanking= YES # Possible values: YES or NO + +#FileUnicode= YES # Possible values: YES or NO +#AddTestCaseTitle= YES # Possible values: YES or NO +[End_Logger_Defaults] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + +# End of file diff -r 000000000000 -r e6b17d312c8b imservices/xmppsettingsfetcher/tsrc/xmppsettingsfetchermt/src/xmppsettingsfetchermt.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/xmppsettingsfetcher/tsrc/xmppsettingsfetchermt/src/xmppsettingsfetchermt.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,418 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: xmppsettingsfetchermt class member functions +* +*/ + + + +// [INCLUDE FILES] - do not remove +#include +#include "xmppsettingsfetchermt.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 =============================== + +// ----------------------------------------------------------------------------- +// Cxmppsettingsfetchermt::Cxmppsettingsfetchermt +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +Cxmppsettingsfetchermt::Cxmppsettingsfetchermt() + { + + } + +// ----------------------------------------------------------------------------- +// Cxmppsettingsfetchermt::ConstructL +// Symbian 2nd phase constructor can leave. +// +// Note: If OOM test case uses STIF Logger, then STIF Logger must be created +// with static buffer size parameter (aStaticBufferSize). Otherwise Logger +// allocates memory from heap and therefore causes error situations with OOM +// testing. For more information about STIF Logger construction, see STIF Users +// Guide. +// ----------------------------------------------------------------------------- +// +void Cxmppsettingsfetchermt::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(); + iAddTestCaseTitleToLogName = loggerSettings.iAddTestCaseTitle; + + iStdLog = CStifLogger::NewL( KxmppsettingsfetchermtLogPath, + KxmppsettingsfetchermtLogFile); + iLog = iStdLog; + + // Sample how to use logging + _LIT( KLogStart, "xmppsettingsfetchermt logging starts!" ); + iLog->Log( KLogStart ); + + } + +// ----------------------------------------------------------------------------- +// Cxmppsettingsfetchermt::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +Cxmppsettingsfetchermt* Cxmppsettingsfetchermt::NewL() + { + Cxmppsettingsfetchermt* self = new (ELeave) Cxmppsettingsfetchermt; + + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); + + return self; + + } + +// Destructor +Cxmppsettingsfetchermt::~Cxmppsettingsfetchermt() + { + iLog = NULL; + delete iStdLog; + iStdLog = NULL; + delete iTCLog; + iTCLog = NULL; + } + +// ----------------------------------------------------------------------------- +// Cxmppsettingsfetchermt::InitL +// InitL is used to initialize the Test Module. +// ----------------------------------------------------------------------------- +// +TInt Cxmppsettingsfetchermt::InitL( + TFileName& /*aIniFile*/, + TBool /*aFirstTime*/ ) + { + return KErrNone; + + } + +// ----------------------------------------------------------------------------- +// Cxmppsettingsfetchermt::GetTestCasesL +// GetTestCases is used to inquire test cases from the Test Module. Test +// cases are stored to array of test cases. The Test Framework will be +// the owner of the data in the RPointerArray after GetTestCases return +// and it does the memory deallocation. +// ----------------------------------------------------------------------------- +// +TInt Cxmppsettingsfetchermt::GetTestCasesL( + const TFileName& /*aConfig*/, + RPointerArray& aTestCases ) + { + + // Loop through all test cases and create new + // TTestCaseInfo items and append items to aTestCase array + for( TInt i = 0; Case(i).iMethod != NULL; i++ ) + { + + // Allocate new TTestCaseInfo from heap for a testcase definition. + TTestCaseInfo* newCase = new( ELeave ) TTestCaseInfo(); + + // PushL TTestCaseInfo to CleanupStack. + CleanupStack::PushL( newCase ); + + // Set number for the testcase. + // When the testcase is run, this comes as a parameter to RunTestCaseL. + newCase->iCaseNumber = i; + + // Set title for the test case. This is shown in UI to user. + newCase->iTitle.Copy( Case(i).iCaseName ); + + // Append TTestCaseInfo to the testcase array. After appended + // successfully the TTestCaseInfo object is owned (and freed) + // by the TestServer. + User::LeaveIfError(aTestCases.Append ( newCase ) ); + + // Pop TTestCaseInfo from the CleanupStack. + CleanupStack::Pop( newCase ); + + } + + return KErrNone; + + } + +// ----------------------------------------------------------------------------- +// Cxmppsettingsfetchermt::RunTestCaseL +// RunTestCaseL is used to run an individual test case specified +// by aTestCase. Test cases that can be run may be requested from +// Test Module by GetTestCases method before calling RunTestCase. +// ----------------------------------------------------------------------------- +// +TInt Cxmppsettingsfetchermt::RunTestCaseL( + const TInt aCaseNumber, + const TFileName& /*aConfig*/, + TTestResult& aResult ) + { + + // Return value + TInt execStatus = KErrNone; + + // Get the pointer to test case function + TCaseInfo tmp = Case ( aCaseNumber ); + + _LIT( KLogStartTC, "Starting testcase [%S]" ); + iLog->Log( KLogStartTC, &tmp.iCaseName); + + // Check that case number was valid + if ( tmp.iMethod != NULL ) + { + //Open new log file with test case title in file name + if(iAddTestCaseTitleToLogName) + { + //Delete test case logger if exists + if(iTCLog) + { + delete iTCLog; + iTCLog = NULL; + } + + TFileName logFileName; + TName title; + TestModuleIf().GetTestCaseTitleL(title); + + logFileName.Format(KxmppsettingsfetchermtLogFileWithTitle, &title); + + iTCLog = CStifLogger::NewL(KxmppsettingsfetchermtLogPath, + logFileName); + iLog = iTCLog; + } + + // Valid case was found, call it via function pointer + iMethod = tmp.iMethod; + //execStatus = ( this->*iMethod )( aResult ); + TRAPD(err, execStatus = ( this->*iMethod )( aResult )); + if(iAddTestCaseTitleToLogName) + { + //Restore standard log and destroy test case logger + iLog = iStdLog; + delete iTCLog; //Close test case log + iTCLog = NULL; + } + User::LeaveIfError(err); + } + else + { + // Valid case was not found, return error. + execStatus = KErrNotFound; + } + + // Return case execution status (not the result of the case execution) + return execStatus; + + } + +// ----------------------------------------------------------------------------- +// Cxmppsettingsfetchermt::OOMTestQueryL +// Used to check if a particular test case should be run in OOM conditions and +// which memory allocations should fail. +// ----------------------------------------------------------------------------- +// +TBool Cxmppsettingsfetchermt::OOMTestQueryL( + const TFileName& /* aTestCaseFile */, + const TInt aCaseNumber, + TOOMFailureType& /* aFailureType */, + TInt& aFirstMemFailure, + TInt& aLastMemFailure ) + { + _LIT( KLogOOMTestQueryL, "Cxmppsettingsfetchermt::OOMTestQueryL" ); + iLog->Log( KLogOOMTestQueryL ); + + aFirstMemFailure = Case( aCaseNumber ).iFirstMemoryAllocation; + aLastMemFailure = Case( aCaseNumber ).iLastMemoryAllocation; + + return Case( aCaseNumber ).iIsOOMTest; + + } + +// ----------------------------------------------------------------------------- +// Cxmppsettingsfetchermt::OOMTestInitializeL +// Used to perform the test environment setup for a particular OOM test case. +// Test Modules may use the initialization file to read parameters for Test +// Module initialization but they can also have their own configure file or +// some other routine to initialize themselves. +// +// NOTE: User may add implementation for OOM test environment initialization. +// Usually no implementation is required. +// ----------------------------------------------------------------------------- +// +void Cxmppsettingsfetchermt::OOMTestInitializeL( + const TFileName& /* aTestCaseFile */, + const TInt /* aCaseNumber */ ) + { + } + +// ----------------------------------------------------------------------------- +// Cxmppsettingsfetchermt::OOMHandleWarningL +// In some cases the heap memory allocation should be skipped, either due to +// problems in the OS code or components used by the code being tested, or even +// inside the tested components which are implemented this way on purpose (by +// design), so it is important to give the tester a way to bypass allocation +// failures. +// +// NOTE: User may add implementation for OOM test warning handling. Usually no +// implementation is required. +// ----------------------------------------------------------------------------- +// +void Cxmppsettingsfetchermt::OOMHandleWarningL( + const TFileName& /* aTestCaseFile */, + const TInt /* aCaseNumber */, + TInt& /* aFailNextValue */ ) + { + } + +// ----------------------------------------------------------------------------- +// Cxmppsettingsfetchermt::OOMTestFinalizeL +// Used to perform the test environment cleanup for a particular OOM test case. +// +// NOTE: User may add implementation for OOM test environment finalization. +// Usually no implementation is required. +// ----------------------------------------------------------------------------- +// +void Cxmppsettingsfetchermt::OOMTestFinalizeL( + const TFileName& /* aTestCaseFile */, + const TInt /* aCaseNumber */ ) + { + } + +// ========================== OTHER EXPORTED FUNCTIONS ========================= + +// ----------------------------------------------------------------------------- +// LibEntryL is a polymorphic Dll entry point +// Returns: CTestModuleBase*: Pointer to Test Module object +// ----------------------------------------------------------------------------- +// +EXPORT_C CTestModuleBase* LibEntryL() + { + return Cxmppsettingsfetchermt::NewL(); + + } + +// ----------------------------------------------------------------------------- +// SetRequirements handles test module parameters(implements evolution +// version 1 for test module's heap and stack sizes configuring). +// Returns: TInt: Symbian error code. +// ----------------------------------------------------------------------------- +// +EXPORT_C TInt SetRequirements( CTestModuleParam*& /*aTestModuleParam*/, + TUint32& /*aParameterValid*/ ) + { + + /* --------------------------------- NOTE --------------------------------- + USER PANICS occurs in test thread creation when: + 1) "The panic occurs when the value of the stack size is negative." + 2) "The panic occurs if the minimum heap size specified is less + than KMinHeapSize". + KMinHeapSize: "Functions that require a new heap to be allocated will + either panic, or will reset the required heap size to this value if + a smaller heap size is specified". + 3) "The panic occurs if the minimum heap size specified is greater than + the maximum size to which the heap can grow". + Other: + 1) Make sure that your hardware or Symbian OS is supporting given sizes. + e.g. Hardware might support only sizes that are divisible by four. + ------------------------------- NOTE end ------------------------------- */ + + // Normally STIF uses default heap and stack sizes for test thread, see: + // KTestThreadMinHeap, KTestThreadMinHeap and KStackSize. + // If needed heap and stack sizes can be configured here by user. Remove + // comments and define sizes. + +/* + aParameterValid = KStifTestModuleParameterChanged; + + CTestModuleParamVer01* param = CTestModuleParamVer01::NewL(); + // Stack size + param->iTestThreadStackSize= 16384; // 16K stack + // Heap sizes + param->iTestThreadMinHeap = 4096; // 4K heap min + param->iTestThreadMaxHeap = 1048576;// 1M heap max + + aTestModuleParam = param; +*/ + return KErrNone; + + } + + +// End of File diff -r 000000000000 -r e6b17d312c8b imservices/xmppsettingsfetcher/tsrc/xmppsettingsfetchermt/src/xmppsettingsfetchermtCases.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/xmppsettingsfetcher/tsrc/xmppsettingsfetchermt/src/xmppsettingsfetchermtCases.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,514 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: xmppsettingsfetchermtCases.cpp +* +*/ + + + +// [INCLUDE FILES] - do not remove +#include +#include "xmppsettingsfetchermt.h" +#include "xmppsettingsfetcher.h" +#include "xmppparameters.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 =============================== + +// ----------------------------------------------------------------------------- +// Cxmppsettingsfetchermt::Case +// Returns a test case by number. +// +// This function contains an array of all available test cases +// i.e pair of case name and test function. If case specified by parameter +// aCaseNumber is found from array, then that item is returned. +// +// The reason for this rather complicated function is to specify all the +// test cases only in one place. It is not necessary to understand how +// function pointers to class member functions works when adding new test +// cases. See function body for instructions how to add new test case. +// ----------------------------------------------------------------------------- +// +const TCaseInfo Cxmppsettingsfetchermt::Case ( + const TInt aCaseNumber ) const + { + + /** + * To add new test cases, implement new test case function and add new + * line to KCases array specify the name of the case and the function + * doing the test case + * In practice, do following + * 1) Make copy of existing test case function and change its name + * and functionality. Note that the function must be added to + * xmppsettingsfetchermt.cpp file and to xmppsettingsfetchermt.h + * header file. + * + * 2) Add entry to following KCases array either by using: + * + * 2.1: FUNCENTRY or ENTRY macro + * ENTRY macro takes two parameters: test case name and test case + * function name. + * + * FUNCENTRY macro takes only test case function name as a parameter and + * uses that as a test case name and test case function name. + * + * Or + * + * 2.2: OOM_FUNCENTRY or OOM_ENTRY macro. Note that these macros are used + * only with OOM (Out-Of-Memory) testing! + * + * OOM_ENTRY macro takes five parameters: test case name, test case + * function name, TBool which specifies is method supposed to be run using + * OOM conditions, TInt value for first heap memory allocation failure and + * TInt value for last heap memory allocation failure. + * + * OOM_FUNCENTRY macro takes test case function name as a parameter and uses + * that as a test case name, TBool which specifies is method supposed to be + * run using OOM conditions, TInt value for first heap memory allocation + * failure and TInt value for last heap memory allocation failure. + */ + + static TCaseInfoInternal const KCases[] = + { + // [test cases entries] - do not remove + + // NOTE: When compiled to GCCE, there must be Classname:: + // declaration in front of the method name, e.g. + // Cxmppsettingsfetchermt::PrintTest. Otherwise the compiler + // gives errors. + + ENTRY( "write and read valid settings", Cxmppsettingsfetchermt::SetAndReadSettingsL ), + ENTRY( "read unexisting settings", Cxmppsettingsfetchermt::ReadUnexistingSettingsL ), + ENTRY( "write and read incomplete settings", Cxmppsettingsfetchermt::ReadIncompleteSettingsL ), + ENTRY( "descriptor values test", Cxmppsettingsfetchermt::ReadDescSettingsL ), + ENTRY( "integer values test", Cxmppsettingsfetchermt::ReadIntSettingsL ), + +// FUNCENTRY( Cxmppsettingsfetchermt::PrintTest ), + + // Example how to use OOM functionality + //OOM_ENTRY( "Loop test with OOM", Cxmppsettingsfetchermt::LoopTest, ETrue, 2, 3), + //OOM_FUNCENTRY( Cxmppsettingsfetchermt::PrintTest, ETrue, 1, 3 ), + }; + + // Verify that case number is valid + if( (TUint) aCaseNumber >= sizeof( KCases ) / + sizeof( TCaseInfoInternal ) ) + { + // Invalid case, construct empty object + TCaseInfo null( (const TText*) L"" ); + null.iMethod = NULL; + null.iIsOOMTest = EFalse; + null.iFirstMemoryAllocation = 0; + null.iLastMemoryAllocation = 0; + return null; + } + + // Construct TCaseInfo object and return it + TCaseInfo tmp ( KCases[ aCaseNumber ].iCaseName ); + tmp.iMethod = KCases[ aCaseNumber ].iMethod; + tmp.iIsOOMTest = KCases[ aCaseNumber ].iIsOOMTest; + tmp.iFirstMemoryAllocation = KCases[ aCaseNumber ].iFirstMemoryAllocation; + tmp.iLastMemoryAllocation = KCases[ aCaseNumber ].iLastMemoryAllocation; + return tmp; + + } + +// ----------------------------------------------------------------------------- +// Cxmppsettingsfetchermt::LoopTest +// Another printing to UI test. +// ----------------------------------------------------------------------------- +// +TInt Cxmppsettingsfetchermt::SetAndReadSettingsL( TTestResult& aResult ) + { + TUint32 settingId = 0; + CXmppSettingsApi* api = CXmppSettingsApi::NewLC(); + + TRAPD( error, api->CreateSettingsRecordL( settingId ) ); + User::LeaveIfError( error ); + + WriteSettingsL( api, settingId, EPositiveTest ); + CleanupStack::PopAndDestroy( api ); + + CXmppParameters* xmppParams = CXmppParameters::NewL(); + CleanupStack::PushL( xmppParams ); + CXmppSettingsFetcher::ReadSettingsL( settingId, *xmppParams ); + + //verify that all settings read are correct + TBool verify = VerifySettingsL( xmppParams, settingId, EPositiveTest ); + CleanupStack::PopAndDestroy( xmppParams ); + + // Sets test case result and description(Maximum size is KStifMaxResultDes) + if(verify) + aResult.SetResult( KErrNone, KTestcasePassed ); + else + aResult.SetResult( KErrGeneral, KVerificationFailed ); + + // Case was executed + return KErrNone; + } + + +TInt Cxmppsettingsfetchermt::ReadUnexistingSettingsL( TTestResult& aResult ) + { + CXmppParameters* xmppParams = CXmppParameters::NewL(); + CleanupStack::PushL( xmppParams ); + CXmppSettingsFetcher::ReadSettingsL( 9999, *xmppParams ); //assuming 9999 records have not been created :) + + // Sets test case result and description(Maximum size is KStifMaxResultDes) + CleanupStack::PopAndDestroy( xmppParams ); + aResult.SetResult( KErrNone, KTestcasePassed ); + + // Case was executed + return KErrNone; + } + + +TInt Cxmppsettingsfetchermt::ReadIncompleteSettingsL( TTestResult& aResult ) + { + TUint32 settingId = 0; + CXmppSettingsApi* api = CXmppSettingsApi::NewLC(); + + TRAPD( error, api->CreateSettingsRecordL( settingId ) ); + User::LeaveIfError( error ); + + WriteIncompleteSettingsL( api, settingId ); + CleanupStack::PopAndDestroy( api ); + + CXmppParameters* xmppParams = CXmppParameters::NewL(); + CleanupStack::PushL( xmppParams ); + TRAP( error, CXmppSettingsFetcher::ReadSettingsL( settingId, *xmppParams ) ); + CleanupStack::PopAndDestroy( xmppParams ); + + // Sets test case result and description(Maximum size is KStifMaxResultDes) + if( error == KErrNotFound ) + aResult.SetResult( KErrNone, KTestcasePassed ); + else + aResult.SetResult( KErrGeneral, KTestcaseFailed ); + + // Case was executed + return KErrNone; + } + + +TInt Cxmppsettingsfetchermt::ReadDescSettingsL( TTestResult& aResult ) + { + TUint32 settingId = 0; + CXmppSettingsApi* api = CXmppSettingsApi::NewLC(); + + TRAPD( error, api->CreateSettingsRecordL( settingId ) ); + User::LeaveIfError( error ); + + WriteSettingsL( api, settingId, EDescriptorTest ); + CleanupStack::PopAndDestroy( api ); + + CXmppParameters* xmppParams = CXmppParameters::NewL(); + CleanupStack::PushL( xmppParams ); + CXmppSettingsFetcher::ReadSettingsL( settingId, *xmppParams ); + + //verify that all settings read are correct + TBool verify = VerifySettingsL( xmppParams, settingId, EDescriptorTest ); + CleanupStack::PopAndDestroy( xmppParams ); + + // Sets test case result and description(Maximum size is KStifMaxResultDes) + if(verify) + aResult.SetResult( KErrNone, KTestcasePassed ); + else + aResult.SetResult( KErrGeneral, KVerificationFailed ); + + // Case was executed + return KErrNone; + } + + +TInt Cxmppsettingsfetchermt::ReadIntSettingsL( TTestResult& aResult ) + { + TUint32 settingId = 0; + CXmppSettingsApi* api = CXmppSettingsApi::NewLC(); + + TRAPD( error, api->CreateSettingsRecordL( settingId ) ); + User::LeaveIfError( error ); + + WriteSettingsL( api, settingId, EIntegerTest ); + CleanupStack::PopAndDestroy( api ); + + CXmppParameters* xmppParams = CXmppParameters::NewL(); + CleanupStack::PushL( xmppParams ); + CXmppSettingsFetcher::ReadSettingsL( settingId, *xmppParams ); + + //verify that all settings read are correct + TBool verify = VerifySettingsL( xmppParams, settingId, EIntegerTest ); + CleanupStack::PopAndDestroy( xmppParams ); + + // Sets test case result and description(Maximum size is KStifMaxResultDes) + if(verify) + aResult.SetResult( KErrNone, KTestcasePassed ); + else + aResult.SetResult( KErrGeneral, KVerificationFailed ); + + // Case was executed + return KErrNone; + } + + +void Cxmppsettingsfetchermt::WriteSettingsL( CXmppSettingsApi* aApi, TUint32 aSettingId, TTestCase aTestCase ) +{ + TInt error = KErrNone; + + TRAP( error, aApi->SetParamL( aSettingId, + XmppParams::KXmppParamHttpsProxyServerPort(), + httpsProxyPort ) ); + if( aTestCase == EIntegerTest ) //integer test + { + TRAP( error, aApi->SetParamL( aSettingId, + XmppParams::KXmppParamServerPort(), + portNegative ) ); //negative value + TRAP( error, aApi->SetParamL( aSettingId, + XmppParams::KXmppParamSnapId(), + iapIdZero ) ); //zero + } + else + { + TRAP( error, aApi->SetParamL( aSettingId, + XmppParams::KXmppParamServerPort(), + port ) ); + TRAP( error, aApi->SetParamL( aSettingId, + XmppParams::KXmppParamSnapId(), + iapId ) ); + } + + // buffers + TRAP( error, aApi->SetParamL( aSettingId, + XmppParams::KXmppParamXmppServerAddress(), + KXmppServerAddress ) ); + + if( aTestCase == EDescriptorTest ) //descriptor test + { + TRAP( error, aApi->SetParamL( aSettingId, + XmppParams::KXmppParamUsername(), + KNullUsername ) ); //empty string + TRAP( error, aApi->SetParamL( aSettingId, + XmppParams::KXmppParamPassword(), + KNullDesC ) ); //null descriptor + } + else + { + TRAP( error, aApi->SetParamL( aSettingId, + XmppParams::KXmppParamUsername(), + KUsername ) ); + TRAP( error, aApi->SetParamL( aSettingId, + XmppParams::KXmppParamPassword(), + KPassword ) ); + } + + // gabble specific things......... + TRAP( error, aApi->SetParamL( aSettingId, + XmppParams::KXmppParamResource(), + KResouceText ) ); + TRAP( error, aApi->SetParamL( aSettingId, + XmppParams::KXmppParamHttpsProxyServerAddress(), + KHttpsProxyServerAddressText ) ); + TRAP( error, aApi->SetParamL( aSettingId, + XmppParams::KXmppParamAlais(), + KAliasText ) ); + TRAP( error, aApi->SetParamL( aSettingId, + XmppParams::KXmppParamOldSSLRequired(), + oldSSL ) ); + TRAP( error, aApi->SetParamL( aSettingId, + XmppParams::KXmppParamRegisterRequired(), + resigter ) ); + TRAP( error, aApi->SetParamL( aSettingId, + XmppParams::KXmppParamConnMgrBus(), + KConnMgrBus ) ); + + TRAP( error, aApi->SetParamL( aSettingId, + XmppParams::KXmppParamConnMgrPath(), + KConnMgrPath )); + + TRAP( error, aApi->SetParamL( aSettingId, + XmppParams::KXmppParamProtocol(), + KParamProtocol )); + + } + + +TBool Cxmppsettingsfetchermt::VerifySettingsL( CXmppParameters* aXmppParams, TUint32 aSettingsId, TTestCase aTestCase ) +{ + switch (aTestCase) + { + case EPositiveTest: + if ( + ( aXmppParams->SettingsId() == aSettingsId ) && + ( aXmppParams->ServerPort() == port ) && + ( aXmppParams->ProxyPort() == httpsProxyPort ) && + ( aXmppParams->IapId() == iapId ) && + ( aXmppParams->ServerAddress() == KXmppServerAddress ) && + ( aXmppParams->UserName() == KUsername ) && + ( aXmppParams->Passwd() == KPassword ) && + ( aXmppParams->Resource() == KResouceText ) && + ( aXmppParams->ProxyServer() == KHttpsProxyServerAddressText ) && + ( aXmppParams->Ssl() == oldSSL ) + ) + return ETrue; + else + return EFalse; + case EDescriptorTest: + if ( + ( aXmppParams->SettingsId() == aSettingsId ) && + ( aXmppParams->ServerPort() == port ) && + ( aXmppParams->ProxyPort() == httpsProxyPort ) && + ( aXmppParams->IapId() == iapId ) && + ( aXmppParams->ServerAddress() == KXmppServerAddress ) && + ( aXmppParams->UserName() == KNullUsername ) && //empty string + ( aXmppParams->Passwd() == KNullDesC ) && //null descriptor + ( aXmppParams->Resource() == KResouceText ) && + ( aXmppParams->ProxyServer() == KHttpsProxyServerAddressText ) && + ( aXmppParams->Ssl() == oldSSL ) + ) + return ETrue; + else + return EFalse; + case EIntegerTest: + if ( + ( aXmppParams->SettingsId() == aSettingsId ) && + ( aXmppParams->ServerPort() == portNegative ) && //negative + ( aXmppParams->ProxyPort() == httpsProxyPort ) && + ( aXmppParams->IapId() == iapIdZero ) && //zero + ( aXmppParams->ServerAddress() == KXmppServerAddress ) && + ( aXmppParams->UserName() == KUsername ) && + ( aXmppParams->Passwd() == KPassword ) && + ( aXmppParams->Resource() == KResouceText ) && + ( aXmppParams->ProxyServer() == KHttpsProxyServerAddressText ) && + ( aXmppParams->Ssl() == oldSSL ) + ) + return ETrue; + else + return EFalse; + } + return EFalse; + } + + +void Cxmppsettingsfetchermt::WriteIncompleteSettingsL( CXmppSettingsApi* aApi, TUint32 aSettingId ) +{ + TInt error = KErrNone; + + TRAP( error, aApi->SetParamL( aSettingId, + XmppParams::KXmppParamServerPort(), + port ) ); + + // buffers + TRAP( error, aApi->SetParamL( aSettingId, + XmppParams::KXmppParamXmppServerAddress(), + KXmppServerAddress ) ); + TRAP( error, aApi->SetParamL( aSettingId, + XmppParams::KXmppParamUsername(), + KUsername ) ); + TRAP( error, aApi->SetParamL( aSettingId, + XmppParams::KXmppParamPassword(), + KPassword ) ); + // gabble specific things......... + TRAP( error, aApi->SetParamL( aSettingId, + XmppParams::KXmppParamHttpsProxyServerAddress(), + KHttpsProxyServerAddressText ) ); + TRAP( error, aApi->SetParamL( aSettingId, + XmppParams::KXmppParamOldSSLRequired(), + oldSSL ) ); + } + +// ----------------------------------------------------------------------------- +// ?classname::?member_function +// ?implementation_description +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +/* +?type ?classname::?member_function( + ?arg_type arg, + ?arg_type arg ) + { + + ?code + + } +*/ + +// ========================== OTHER EXPORTED FUNCTIONS ========================= + +// ----------------------------------------------------------------------------- +// ?function_name implements... +// ?implementation_description. +// Returns: ?value_1: ?description +// ?value_n: ?description +// ?description +// ----------------------------------------------------------------------------- +// +/* +?type ?function_name( + ?arg_type arg, // ?description + ?arg_type arg ) // ?description + { + + ?code + + } +*/ +// [End of File] - do not remove diff -r 000000000000 -r e6b17d312c8b imsrv_plat/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/group/bld.inf Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,53 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Includes all the Domain API specific bld.inf files, which +* export files. +* +*/ + + + +#include "../ximp_core_data_model_api/group/bld.inf" +#include "../ximp_presence_protocol_plugin_host_api/group/bld.inf" +#include "../ximp_presence_data_model_api/group/bld.inf" +#include "../ximp_presence_protocol_plugin_api/group/bld.inf" +#include "../ximp_presence_management_api/group/bld.inf" +#include "../ximp_core_protocol_plugin_host_api/group/bld.inf" +#include "../ximp_core_management_api/group/bld.inf" +#include "../ximp_presence_base_api/group/bld.inf" +#include "../ximp_core_protocol_plugin_api/group/bld.inf" +#include "../ximp_core_base_api/group/bld.inf" +#include "../ximp_presence_cache_api/group/bld.inf" +#include "../ximp_core_feature_plugin_api/group/bld.inf" + +#include "../ximp_im_protocol_plugin_host_api/group/bld.inf" +#include "../ximp_im_data_model_api/group/bld.inf" +#include "../ximp_im_protocol_plugin_api/group/bld.inf" +#include "../ximp_im_management_api/group/bld.inf" +#include "../ximp_im_base_api/group/bld.inf" + +#include "../ximp_search_protocol_plugin_host_api/group/bld.inf" +#include "../ximp_search_data_model_api/group/bld.inf" +#include "../ximp_search_protocol_plugin_api/group/bld.inf" +#include "../ximp_search_management_api/group/bld.inf" +#include "../ximp_search_base_api/group/bld.inf" + +#include "../xmpp_settings_api/group/bld.inf" +#include "../im_cache_client_api/group/bld.inf" +#include "../im_cache_server_api/group/bld.inf" +#include "../presence_avabilitytext/group/bld.inf" + + + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/im_cache_client_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/im_cache_client_api/group/bld.inf Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,33 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: File that exports the files belonging to +: XIMP IM Base API +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +../inc/imcachedefs.h MW_LAYER_PLATFORM_EXPORT_PATH(imcachedefs.h) +../inc/mimcacheaccessor.h MW_LAYER_PLATFORM_EXPORT_PATH(mimcacheaccessor.h) +../inc/mimcacheeventhandler.h MW_LAYER_PLATFORM_EXPORT_PATH(mimcacheeventhandler.h) +../inc/mimcacheupdater.h MW_LAYER_PLATFORM_EXPORT_PATH(mimcacheupdater.h) +../inc/cimcachefactory.h MW_LAYER_PLATFORM_EXPORT_PATH(cimcachefactory.h) + +//end of file diff -r 000000000000 -r e6b17d312c8b imsrv_plat/im_cache_client_api/im_cache_client_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/im_cache_client_api/im_cache_client_api.metaxml Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,14 @@ + + +im_cache_client_api +This is a API that provides read and write to the instant messaging cache. Client can write the information using adapter APIs and read from cache using accessor APIs. +c++ +instantmessagingcache + + + + +yes +no + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/im_cache_client_api/inc/cimcachefactory.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/im_cache_client_api/inc/cimcachefactory.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,126 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: factory class to create access and updateer class +* +*/ + + + +#ifndef __CIMCACHEFACTORY_H +#define __CIMCACHEFACTORY_H + +// INCLUDES +#include + +// FORWARD DECLARATIONS +class MIMCacheUpdater; +class CIMCacheClient; +class CIMCacheUpdater; +class MIMCacheAccessor; +class CIMCacheAccessor; +// CLASS DECLARATION + +class CIMCacheFactory : public CBase + { + + public: + + /** + * read the instance from tls if exist or create return + * if exist instace return or create return + */ + IMPORT_C static CIMCacheFactory* InstanceL() ; + + /** + * release the all instaces create by client factory + * @param aApplicationId application id + */ + + IMPORT_C static void Release(); + + private: + + /** + * two phase construction + * return the new of CIMCacheFactory + */ + static CIMCacheFactory* NewL(); + + /** + * destructor + */ + ~CIMCacheFactory(); + + /** + * default constructor + */ + CIMCacheFactory(); + + /** + * ConstructL + */ + void ConstructL(); + + /** + * IncrementReference. + * Increments the count of the imcache factory reference. + */ + void IncrementReference(); + + /** + * DecrementReference. + * Decrements the count of the imcache factory reference. + * @return - Current Reference Count + */ + TInt DecrementReference(); + + public: + /** + * Creates a updater interface + * @param aServiceId ,the service id to be used with this interface instance + * @param aUserId the aUserId to be used with this interface instance + * @param aRegistrationNeeded , used for register ,iunregister e + * @return the access interface + */ + IMPORT_C MIMCacheUpdater* CreateUpdaterL(TInt aServiceId, + const TDesC& aUserId , + TBool aRegistrationNeeded ); + + /** + * Creates a accessor interface + * @param aServiceId ,the service id to be used with this interface instance + * @param aUserId the aUserId to be used with this interface instance + * @return the access interface + */ + EXPORT_C MIMCacheAccessor* CreateAccessorL(TInt aServiceId, + const TDesC& aUserId ); + private: // data + + // owned , instantmessagingcache client + CIMCacheClient* iServerKeepAlive; + + // owned , array to hold updater instaces + RPointerArray iUpdaterArray; + + // owned , array to hold accessor instaces + RPointerArray iAccessorArray; + + // Owns : factory reference count + TInt iReferenceCount; + + }; + +#endif // __CIMCACHEFACTORY_H + +// End of File diff -r 000000000000 -r e6b17d312c8b imsrv_plat/im_cache_client_api/inc/imcachedefs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/im_cache_client_api/inc/imcachedefs.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,226 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: constanst declaration files +* +*/ + + + +#ifndef __IMCACHEDEFS_H__ +#define __IMCACHEDEFS_H__ +#include + +const TInt KMaxSize( 1024 ); +/** +* Different message types +*/ +enum TIMCacheMessageType + { + EIMCMessagePTOP, + EIMCMessageSystem, + EIMCMessageInvalid + }; + + +/** +* Direction of message. Coming or going or other. +*/ +enum TIMCacheMessagerType + { + EIMCMessageSent, + EIMCMessageReceived, + EIMCMessageOther + }; + +/** +* Different message content types +*/ +enum TIMCacheContentType + { + EIMCContentText, + EIMCContentOther, + EIMCContentInvalid + }; + +/** +* struct for send and recieve message details +*/ +struct SIMCacheMessageData + { + TIMCacheMessageType iMessageType; + TIMCacheMessagerType iMessagerType; + TIMCacheContentType iContentType; + TTime iTime; + HBufC* iBuddyId; + HBufC* iText; + }; + +/** +* struct to contain newly added/removed chat details. +*/ +struct SIMCacheChatItem + { + TInt iServiceId; + HBufC* iBuddyId; + }; + +typedef TPckgBuf TIMCacheMessageBuf; +/** + * + *cahce versions + */ +const TInt KIMCacheVersionMajor = 1; +const TInt KIMCacheVersionMinor = 1; +const TInt KIMCacheVersionBuild = 1; + +/** + *cache server exe name + * + */ +_LIT( EIMCacheServerExe, "imcacheserver.exe" ); + + +/** + *cache server name + * + */ +_LIT( KIMCacheServerName, "imcacheserver" ); + + +/** + * + * + */ +const TUint KIMCacheMsgSlotCount = 4; + +/** + * transaction types + */ +enum TTransactionType + { + EIMCacheTxAppend, + EIMCacheTxReplace, + EIMCacheTxAccess + }; + +/** + * operation to perform + * + */ +enum EIMCacheOperations + { + // begining operation boundary for client-server + EIMCacheOperationFirst = 0, + + // access API + EIMCacheInitUpdate , + EIMCacheInitAccess , + EIMCacheInitConvesation, + // update + EIMCacheStartNewConversation, + EIMCacheAppendReceiveMessage, + EIMCacheAppendSendMessage, + EIMCacheAppendMessage, + EIMCacheCloseConversation, + EIMCacheCloseAllConversation, + + EIMCacheDeactivateConversation, + // access + EIMCacheGetUnreadCount, + EIMCacheGetAllUnreadCount, + EIMCacheIsConversationExist, + EIMCacheGetAllConversation, + // observer operation + // for already stored messages + EIMCacheObserveMessageUpdateRegister, + EIMCacheObserveMessageUpdateUnRegister, + + EIMCacheObserveMessageAccessRegister, + EIMCacheObserveMessageAccessUnRegister, + + //new/deleted chat items + EIMCacheGetBufferedPackets, + + //GetChatItemList + EIMCacheGetChatList, + EIMCacheCancelRequest, + + // this is last operation boundary supported by client-server ( range has been set ) + // do not add any operation after this + EIMCacheOperationLast + + }; + +/** + * operation error code + * + */ +enum TIMCacheOperationsCode + { + EIMOPerationBase = -1000, + // update + EIMOperationCompleted, + EIMOperationAborted, + // observer operation + EIMOperationRegistered, + EIMOperationUnRegistered, + + EIMOperationDataAvailable, + EIMOperationUnreadChange, + EIMOperationUnreadMessage, + + EIMOperationDataUnAvailable, + EIMOperationSessionDied, + EIMOperationCacheDataChaned, + EIMOperationConversationClosed, + EIMOperationFetchAll, + EIMOperationChatAdded, + EIMOperationMessageAdded, + EIMOperationChatDeleted, + EIMOperationAllChatDeleted, + EIMOperationChatStarted + }; + +/** + * operation to perform + * + */ +enum TIMCacheEventType + { + EIMCacheRequestCompleted = 0, + EIMCacheNewMessage , + EIMCacheUnreadMessage, + EIMCacheUnreadChange, + EIMCacheNewChat, + EIMCacheChatStarted, + EIMCacheChatClosed, + EIMCacheAllChatClosed + }; +/** + * + * + */ +enum TIMCacheChatListOperation + { + EIMChatId, + EIMChatList + }; + +#endif //__IMCACHEDEFS_H__ + +// END OF FILE + + + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/im_cache_client_api/inc/mimcacheaccessor.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/im_cache_client_api/inc/mimcacheaccessor.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,95 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: base class declaration for accessing the cache +* +*/ + + + +#ifndef __MIMCACHEACCESSOR_H +#define __MIMCACHEACCESSOR_H + +#include "imcachedefs.h" + +class MIMCacheEventHandler; + /** + * An interface for updating conversation information + * + * @since 5.0 + */ + class MIMCacheAccessor + { + public: + + /** + * Register to observer conversation data updates + * @param aObserver the observer interface + */ + virtual void RegisterObserverL( MIMCacheEventHandler& aObserver ) = 0; + + /** + * Unregister a conversation data update observer + * @param aObserver the observer interface + */ + virtual void UnRegisterObserver( MIMCacheEventHandler& aObserver ) = 0; + + /** + * to get the unread message count from server + * @param aOwnUserId , logged in user id + * @return number of unread msg count + */ + virtual TInt GetUnreadMessageCountL( const TDesC& aBuddyId ) = 0; + + /** + * to get the all unread message count from server + * @param , aOwnUserId logged in user id + * @return number of all unread msg count + */ + virtual TInt GetAllUnreadMessageCountL() = 0 ; + + /** + * check if already conversation opened + * @param aServiceId, serviceid to use + * @param aOwnUserId, own user id + * @param aRecipientId, the selected user id with whom conversation is started + * @return ETrue if already exist else EFlase. + */ + virtual TBool IsConversationExistL( const TDesC& aBuddyId ) = 0 ; + + /** + * closes conversation and commit operation + * @param aServiceId service id. + * @param aOwnId own user id. + * @param aRecipientId recipient's user id. + */ + virtual void CloseConversationL( const TDesC& aBuddyId ) = 0; + + + /** + * get the chat list corresponding to service + * @param aServiceId service id + * @return Array of chats + */ + virtual RArray GetChatListL( const TInt aServiceId ) = 0 ; + + + + protected: + /** + * Destructor + */ + virtual ~MIMCacheAccessor() {}; + }; + + #endif //__MIMCACHEUPDATER_H diff -r 000000000000 -r e6b17d312c8b imsrv_plat/im_cache_client_api/inc/mimcacheeventhandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/im_cache_client_api/inc/mimcacheeventhandler.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,57 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: client side obssrver class message change observer +* +*/ + + + +#ifndef __MIMCACHEEVENTHANDLER_H +#define __MIMCACHEEVENTHANDLER_H + +#include +#include "imcachedefs.h" + + +/** + * An interface through which client gets information + * about available data updates. + * + * @since + */ +class MIMCacheEventHandler + { + public: + + /** + * Gets called when data update is available. + * Client can then decide wether to use the old one + * or the updated one. + * @param aNewMessage, new message details + */ + virtual void HandleIMCacheEventL(TIMCacheEventType aEvent, TAny* aChatMessage = NULL ) = 0; + + +protected: + /** + * Destructor + */ + virtual ~MIMCacheEventHandler() {}; + }; + + + +#endif //__MIMCACHEEVENTHANDLER_H + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/im_cache_client_api/inc/mimcacheupdater.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/im_cache_client_api/inc/mimcacheupdater.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,111 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: base class declaration for updating the cache +* +*/ + + + +#ifndef __MIMCACHEUPDATER_H +#define __MIMCACHEUPDATER_H + +#include "imcachedefs.h" + +class MIMCacheEventHandler; + /** + * An interface for updating conversation information + * + * @since 5.0 + */ + class MIMCacheUpdater + { + public: + + /** + * Register to observer conversation data updates + * @param aObserver the observer interface + */ + virtual void RegisterObserverL( MIMCacheEventHandler& aObserver ) = 0; + + /** + * Unregister a conversation data update observer + * @param aObserver the observer interface + */ + virtual void UnRegisterObserver( MIMCacheEventHandler& aObserver ) = 0; + + + /** + * start a new conversation + * @param aRecipient a recipient user id + */ + virtual void StartNewConversationL(const TDesC& aBuddyId ) = 0; + + /** + * append the new recieve message + * @param aBuddyId a sender user id + * @param aText a text to append + */ + virtual void AppendReceiveMessageL(const TDesC& aBuddyId, + const TDesC& aText ) = 0; + + /** + * append the new send message + * @param aText a text to append + */ + virtual void AppendSendMessageL(const TDesC& aText ) = 0; + + /** + * append the normal information message message + * @param aBuddyId buddy id. + * @param aText a text to append + */ + virtual void AppendMessageL(const TDesC& aBuddyId, const TDesC& aText) = 0 ; + + + /** + * closes conversation and commit operation + * @param aServiceId service id. + * @param aRecipientId recipient's user id. + */ + virtual void CloseConversationL( const TDesC& aBuddyId ) = 0; + + + /* + * close all conversation in service Id + */ + virtual void CloseAllConversationL() = 0 ; + + + /** + * clos conversation and commit operation + */ + virtual TInt DeactivateConversationL() = 0; + + + + /** + * get the chat list corresponding to service + * @param aServiceId service id + * @return Array of chats + */ + virtual RArray GetChatListL( const TInt aServiceId ) = 0 ; + + protected: + /** + * Destructor + */ + virtual ~MIMCacheUpdater() {}; + }; + + #endif //__MIMCACHEUPDATER_H diff -r 000000000000 -r e6b17d312c8b imsrv_plat/im_cache_client_api/tsrc/bwins/imcache_testu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/im_cache_client_api/tsrc/bwins/imcache_testu.def Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + ?LibEntryL@@YAPAVCScriptBase@@AAVCTestModuleIf@@@Z @ 1 NONAME ; class CScriptBase * LibEntryL(class CTestModuleIf &) + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/im_cache_client_api/tsrc/conf/imcache_test.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/im_cache_client_api/tsrc/conf/imcache_test.cfg Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,156 @@ +/* +* ============================================================================== +* Name : imcache_test.cfg +* Part of : instantmessagingcache / imcache_test +* Description : instantmessagingcache related test cases +* Version: : % version:1 % +* +* Copyright (C) 2008 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 1. CreateSameUpdaterL +create imcache_test foobar +foobar CreateSameUpdaterL +delete foobar +[Endtest] + + +[Test] +title 2. CreateDifferentUpdaterL +create imcache_test foobar +foobar CreateDifferentUpdaterL +delete foobar +[Endtest] + + +[Test] +title 3. CreateSameAccessorL +create imcache_test foobar +foobar CreateSameAccessorL +delete foobar +[Endtest] + + +[Test] +title 4. CreateDifferentAccessorL +create imcache_test foobar +foobar CreateDifferentAccessorL +delete foobar +[Endtest] + +[Test] +title 5. StartNewConversationL +create imcache_test foobar +foobar StartNewConversationL +delete foobar +[Endtest] + + +[Test] +title 6. AppendSendMessageL +create imcache_test foobar +foobar AppendSendMessageL +delete foobar +[Endtest] + + +[Test] +title 7. AppendRecieveMessageL +create imcache_test foobar +foobar AppendRecieveMessageL +delete foobar +[Endtest] + + +[Test] +title 8. FetchExistingMessageL +create imcache_test foobar +foobar FetchExistingMessageL +delete foobar +[Endtest] + +[Test] +title 9. DeactivateConversationL +create imcache_test foobar +foobar DeactivateConversationL +delete foobar +[Endtest] + +[Test] +title 10. CloseConversationL +create imcache_test foobar +foobar CloseConversationL +delete foobar +[Endtest] + +[Test] +title 11. GetUnreadMsgCountL +create imcache_test foobar +foobar GetUnreadMsgCountL +delete foobar +[Endtest] + + +[Test] +title 12. GetNewMsgNotificationtL +create imcache_test foobar +foobar GetNewMsgNotificationtL +delete foobar +[Endtest] + +[Test] +title 13. ConversationUnExistTestL +create imcache_test foobar +foobar ConversationUnExistTestL +delete foobar +[Endtest] + + +[Test] +title 14. ConversationExistTestL +create imcache_test foobar +foobar ConversationExistTestL +delete foobar +[Endtest] + +[Test] +title 15. AppendMessageL +create imcache_test foobar +foobar AppendMessageL +delete foobar +[Endtest] + +[Test] +title 16. GetAllUnreadMsgCountL +create imcache_test foobar +foobar GetAllUnreadMsgCountL +delete foobar +[Endtest] + + +[Test] +title 17. GetChatListTestL +create imcache_test foobar +foobar GetChatListTestL +delete foobar +[Endtest] + +[Test] +title 18. AccessorCloseConversationTestL +create imcache_test foobar +foobar AccessorCloseConversationTestL +delete foobar +[Endtest] + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/im_cache_client_api/tsrc/conf/test.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/im_cache_client_api/tsrc/conf/test.xml Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,158 @@ + + + 1001 + MeCo Nightly Testing--IM Cache + + + + + + + + + + + + + + + + + + makedir + + + + + + + execute + + + + + + + + execute + + + + + + + makedir + + + + + + + install + + + + + + + + + + install + + + + + + + + + + + install + + + + + + + + + install + + + + + + + + + + + run-cases + + + + + + + + + + + execute + + + + + + + fetch-log + + + + + + + fetch-log + + + + + + + + fetch-log + + + + + + + + + + + + + + armv5_urel\imcache_test.dll + armv5_urel\system.conf + armv5_urel\TestFramework.ini + armv5_urel\imcache_test.cfg + build\MeCo.fpsx + build\MeCo_udaerase.fpsx + + + + FileStoreAction + + + + + + + STIF_COMPONENT_REPORT_ALL_CASES + ram.chauhan@nokia.com + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/im_cache_client_api/tsrc/eabi/imcache_testu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/im_cache_client_api/tsrc/eabi/imcache_testu.def Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + _Z9LibEntryLR13CTestModuleIf @ 1 NONAME + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/im_cache_client_api/tsrc/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/im_cache_client_api/tsrc/group/bld.inf Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,57 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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' + +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 +*/ +../init/TestFramework.ini /epoc32/winscw/c/TestFramework/TestFramework.ini +../conf/imcache_test.cfg /epoc32/winscw/c/TestFramework/imcache_test.cfg + +PRJ_TESTMMPFILES +// NOTE: If using ARS requirements .mmp file operation should be done under this. +// 'abld test build' +imcache_test.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: + + + +// End of File \ No newline at end of file diff -r 000000000000 -r e6b17d312c8b imsrv_plat/im_cache_client_api/tsrc/group/imcache_test.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/im_cache_client_api/tsrc/group/imcache_test.mmp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,54 @@ +/*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 "Eclipse Public License v1.0" +* which accompanies 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 +* +*/ + + + // To get the OSEXT_LAYER_SYSTEMINCLUDE-definition +#include +#include + +TARGET imcache_test.dll +TARGETTYPE dll +UID 0x1000008D 0x101FB3E3 + +CAPABILITY ALL -TCB + +//TARGETPATH ?target_path +DEFFILE imcache_test.def + +SOURCEPATH ../src +SOURCE imcache_test.cpp +SOURCE imcache_testBlocks.cpp + +USERINCLUDE ../inc +//USERINCLUDE ../../../../imcacheclient/inc +//USERINCLUDE ../../../../inc + +APP_LAYER_SYSTEMINCLUDE + +SYSTEMINCLUDE /epoc32/include/internal + +LIBRARY euser.lib +LIBRARY stiftestinterface.lib +LIBRARY stiftestengine.lib +// imcache +LIBRARY imcacheclient.lib + +LANG SC + + + +// End of File diff -r 000000000000 -r e6b17d312c8b imsrv_plat/im_cache_client_api/tsrc/group/imcache_test.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/im_cache_client_api/tsrc/group/imcache_test.pkg Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,42 @@ +; +; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +; All rights reserved. +; This component and the accompanying materials are made available +; under the terms of "Eclipse Public License v1.0" +; which accompanies this distribution, and is available +; at the URL "http://www.eclipse.org/legal/epl-v10.html". +; +; Initial Contributors: +; Nokia Corporation - initial contribution. +; +; Contributors: +; +; Description: +; +;Header +#{"Testcache"}, (0x101FB3E3), 1, 2, 3, TYPE=SP + +;Language - standard language definitions +&EN + +;Vendor ID +:"Nokia Corporation" + +;Localised vendor +%{"Vendor-EN"} + +;Supports Series 60 v 0.9 +[0x101F7961], 0, 0, 0, {"Series60ProductID"} + +;rom will not allow to update it if name is testframework, after install need to rename it to testframework.ini + +;INI FILE +"..\init\testframework.ini" -"c:\Testframework\ttestframework.ini" + +;CFG FILES +"..\conf\imcache_test.cfg" -"c:\Testframework\imcache_test.cfg" + +;imcache_test dll files + +"\EPOC32\RELEASE\ARMV5\UREL\imcache_test.dll" -"!:\sys\bin\imcache_test.dll" + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/im_cache_client_api/tsrc/inc/imcache_test.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/im_cache_client_api/tsrc/inc/imcache_test.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,225 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 IMCACHE_TEST_H +#define IMCACHE_TEST_H + +// INCLUDES +#include +#include +#include +// imcache +#include "mimcacheeventhandler.h" +#include "mimcacheeventhandler.h" +#include + +// CONSTANTS +//const ?type ?constant_var = ?constant; + +// MACROS +//#define ?macro ?macro_def +// Logging path +_LIT( Kimcache_testLogPath, "\\logs\\testframework\\imcache_test\\" ); +// Log file +_LIT( Kimcache_testLogFile, "imcache_test.txt" ); +_LIT( Kimcache_testLogFileWithTitle, "imcache_test_[%S].txt" ); + +// FUNCTION PROTOTYPES +//?type ?function_name(?arg_list); + +// FORWARD DECLARATIONS +//class ?FORWARD_CLASSNAME; +class Cimcache_test; +class CIMCacheFactory; +class MIMCacheEventHandler; + +// DATA TYPES +//enum ?declaration +//typedef ?declaration +//extern ?data_type; + +// CLASS DECLARATION + +/** +* Cimcache_test test class for STIF Test Framework TestScripter. +* ?other_description_lines +* +* @lib ?library +* @since ?Series60_version +*/ +NONSHARABLE_CLASS(Cimcache_test) : public CScriptBase, + public MIMCacheEventHandler + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static Cimcache_test* NewL( CTestModuleIf& aTestModuleIf ); + + /** + * Destructor. + */ + virtual ~Cimcache_test(); + + 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. + */ + Cimcache_test( 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. + */ + + + //ADD NEW METHOD DEC HERE + //[TestMethods] - Do not remove + + virtual TInt CreateSameUpdaterL( CStifItemParser& aItem ); + + virtual TInt CreateDifferentUpdaterL( CStifItemParser& aItem ); + + virtual TInt CreateSameAccessorL( CStifItemParser& aItem ); + + virtual TInt CreateDifferentAccessorL( CStifItemParser& aItem ); + + virtual TInt StartNewConversationL( CStifItemParser& aItem ) ; + + virtual TInt AppendSendMessageL( CStifItemParser& aItem ) ; + + virtual TInt AppendRecieveMessageL( CStifItemParser& aItem ) ; + + virtual TInt FetchExistingMessageL( CStifItemParser& aItem ); + + virtual TInt DeactivateConversationL( CStifItemParser& aItem ); + + virtual TInt CloseConversationL( CStifItemParser& aItem ); + + virtual TInt GetUnreadMsgCountL(CStifItemParser& aItem) ; + + virtual TInt GetNewMsgNotificationtL(CStifItemParser& aItem) ; + + virtual TInt ConversationUnExistTestL(CStifItemParser& aItem) ; + + virtual TInt ConversationExistTestL(CStifItemParser& aItem) ; + + virtual TInt AppendMessageL( CStifItemParser& aItem); + + virtual TInt GetAllUnreadMsgCountL( CStifItemParser& aItem); + + + virtual TInt GetChatListTestL( CStifItemParser& aItem); + + virtual TInt AccessorCloseConversationTestL( CStifItemParser& aItem); + + + + public: // MIMCacheEventHandler + + /** + * Gets called when data update is available. + * Client can then decide wether to use the old one + * or the updated one. + * @param aNewMessage, new message details + */ + void HandleIMCacheEventL(TIMCacheEventType aEvent, TAny* aChatMessage = NULL ) ; + + + protected: // Data + // ?one_line_short_description_of_data + //?data_declaration; + + private: // Data + + CActiveSchedulerWait iWait; + + TInt iMessageFetch; + // ?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 // IMCACHE_TEST_H + +// End of File diff -r 000000000000 -r e6b17d312c8b imsrv_plat/im_cache_client_api/tsrc/init/TestFramework.ini --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/im_cache_client_api/tsrc/init/TestFramework.ini Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,44 @@ +# +# This is STIFTestFramework initialization file +# Comment lines start with '#'-character. +# See STIF TestFramework users guide.doc for instructions + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + +[Engine_Defaults] + +TestReportMode= FullReport # Possible values are: 'Empty', 'Summary', 'Environment', + 'TestCases' or 'FullReport' + +CreateTestReport= YES # Possible values: YES or NO + +TestReportFilePath= C:\LOGS\TestFramework\ +TestReportFileName= TestReport + +TestReportFormat= TXT # Possible values: TXT or HTML +TestReportOutput= FILE # Possible values: FILE or RDEBUG +TestReportFileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND + +DeviceResetDllName= StifResetForNokia.dll # e.g. 'StifHWResetStub.dll' for user specific reseting + +[End_Defaults] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Module configurations start + +[New_Module] +ModuleName= testscripter +TestCaseFile= C:\testframework\imcache_test.cfg +[End_Module] + + + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + +[Logger_Defaults] + +[End_Logger_Defaults] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + +# End of file diff -r 000000000000 -r e6b17d312c8b imsrv_plat/im_cache_client_api/tsrc/src/imcache_test.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/im_cache_client_api/tsrc/src/imcache_test.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,187 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 "imcache_test.h" +#include + +#include "cimcachefactory.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 =============================== + +// ----------------------------------------------------------------------------- +// Cimcache_test::Cimcache_test +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +Cimcache_test::Cimcache_test( + CTestModuleIf& aTestModuleIf ): + CScriptBase( aTestModuleIf ) + { + } + +// ----------------------------------------------------------------------------- +// Cimcache_test::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void Cimcache_test::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(Kimcache_testLogFileWithTitle, &title); + } + else + { + logFileName.Copy(Kimcache_testLogFile); + } + + iLog = CStifLogger::NewL( Kimcache_testLogPath, + logFileName, + CStifLogger::ETxt, + CStifLogger::EFile, + EFalse ); + + TestModuleIf().SetBehavior( CTestModuleIf::ETestLeaksHandles ); + + + + } + +// ----------------------------------------------------------------------------- +// Cimcache_test::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +Cimcache_test* Cimcache_test::NewL( + CTestModuleIf& aTestModuleIf ) + { + Cimcache_test* self = new (ELeave) Cimcache_test( aTestModuleIf ); + + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); + + return self; + + } + +// Destructor +Cimcache_test::~Cimcache_test() + { + + // Delete resources allocated from test methods + Delete(); + + // 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* ) Cimcache_test::NewL( aTestModuleIf ); + + } + + +// End of File diff -r 000000000000 -r e6b17d312c8b imsrv_plat/im_cache_client_api/tsrc/src/imcache_testBlocks.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/im_cache_client_api/tsrc/src/imcache_testBlocks.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,648 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 "imcache_test.h" + +#include "cimcachefactory.h" +#include "mimcacheupdater.h" +#include "mimcacheaccessor.h" +#include "mimcacheeventhandler.h" + + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// Cimcache_test::Delete +// Delete here all resources allocated and opened from test methods. +// Called from destructor. +// ----------------------------------------------------------------------------- +// +void Cimcache_test::Delete() + { + + } + +// ----------------------------------------------------------------------------- +// Cimcache_test::RunMethodL +// Run specified method. Contains also table of test mothods and their names. +// ----------------------------------------------------------------------------- +// +TInt Cimcache_test::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( "CreateSameUpdaterL", Cimcache_test::CreateSameUpdaterL ), + ENTRY( "CreateDifferentUpdaterL", Cimcache_test::CreateDifferentUpdaterL ), + ENTRY( "CreateSameAccessorL", Cimcache_test::CreateSameAccessorL ), + ENTRY( "CreateDifferentAccessorL", Cimcache_test::CreateDifferentAccessorL ), + ENTRY( "StartNewConversationL", Cimcache_test::StartNewConversationL ), + ENTRY( "AppendSendMessageL", Cimcache_test::AppendSendMessageL ), + ENTRY( "AppendRecieveMessageL", Cimcache_test::AppendRecieveMessageL ), + ENTRY( "FetchExistingMessageL", Cimcache_test::FetchExistingMessageL), + ENTRY( "DeactivateConversationL", Cimcache_test::DeactivateConversationL), + ENTRY( "CloseConversationL", Cimcache_test::CloseConversationL ), + ENTRY( "GetUnreadMsgCountL", Cimcache_test::GetUnreadMsgCountL ), + ENTRY( "GetNewMsgNotificationtL", Cimcache_test::GetNewMsgNotificationtL ), + + ENTRY( "ConversationUnExistTestL", Cimcache_test::ConversationUnExistTestL ), + ENTRY( "ConversationExistTestL", Cimcache_test::ConversationExistTestL ), + + ENTRY( "AppendMessageL", Cimcache_test::AppendMessageL ), + ENTRY( "GetAllUnreadMsgCountL", Cimcache_test::GetAllUnreadMsgCountL ), + + ENTRY( "GetChatListTestL", Cimcache_test::GetChatListTestL ), + ENTRY( "AccessorCloseConversationTestL", Cimcache_test::AccessorCloseConversationTestL ), + + //ADD NEW ENTRY HERE + // [test cases entries] - Do not remove + + }; + + const TInt count = sizeof( KFunctions ) / + sizeof( TStifFunctionInfo ); + + return RunInternalL( KFunctions, count, aItem ); + + } + + +// ----------------------------------------------------------------------------- +// Cimcache_test::CreateSameUpdaterL +// Example test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Cimcache_test::CreateSameUpdaterL( CStifItemParser& /*aItem*/ ) + { + + CIMCacheFactory* instance = CIMCacheFactory::InstanceL(); + + MIMCacheUpdater* updater1 = instance->CreateUpdaterL(1, _L("testlm123@gmail.com"),ETrue ); + + MIMCacheUpdater* updater2 = instance->CreateUpdaterL(1, _L("testlm123@gmail.com") ,ETrue); + + TInt error = KErrGeneral; + + if(updater1 == updater2 ) + { + error = KErrNone; + } + + CIMCacheFactory::Release(); + + return error; + } + +// ----------------------------------------------------------------------------- +// Cimcache_test::CreateDifferentUpdaterL +// Example test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Cimcache_test::CreateDifferentUpdaterL( CStifItemParser& /*aItem*/ ) + { + + CIMCacheFactory* instance = CIMCacheFactory::InstanceL(); + + MIMCacheUpdater* updater1 = instance->CreateUpdaterL(1, _L("testlm123@gmail.com"),ETrue ); + + MIMCacheUpdater* updater2 = instance->CreateUpdaterL(2, _L("abc123@gmail.com") ,ETrue); + + TInt error = KErrGeneral; + + if(updater1 != updater2 ) + { + error = KErrNone; + } + + CIMCacheFactory::Release(); + + return error; + } + + // ----------------------------------------------------------------------------- +// Cimcache_test::CreateSameAccessorL +// Example test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Cimcache_test::CreateSameAccessorL( CStifItemParser& /*aItem*/ ) + { + + CIMCacheFactory* instance = CIMCacheFactory::InstanceL(); + + MIMCacheAccessor* accessor1 = instance->CreateAccessorL(1, _L("testlm123@gmail.com") ); + + MIMCacheAccessor* accessor2 = instance->CreateAccessorL(1, _L("testlm123@gmail.com") ); + + TInt error = KErrGeneral; + + if(accessor1 == accessor2 ) + { + error = KErrNone; + } + + CIMCacheFactory::Release(); + + return error; + } + +// ----------------------------------------------------------------------------- +// Cimcache_test::CreateDifferentAccessorL +// Example test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Cimcache_test::CreateDifferentAccessorL( CStifItemParser& /*aItem*/ ) + { + + CIMCacheFactory* instance = CIMCacheFactory::InstanceL(); + + MIMCacheAccessor* accessor1 = instance->CreateAccessorL(1, _L("testlm123@gmail.com") ); + + MIMCacheAccessor* accessor2 = instance->CreateAccessorL(2, _L("abc123@gmail.com") ); + + TInt error = KErrGeneral; + + if(accessor1 != accessor2 ) + { + error = KErrNone; + } + + CIMCacheFactory::Release(); + + return error; + } + // ----------------------------------------------------------------------------- +// Cimcache_test::StartNewConversationL +// Example test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Cimcache_test::StartNewConversationL( CStifItemParser& /*aItem*/ ) + { + CIMCacheFactory* instance = CIMCacheFactory::InstanceL(); + + MIMCacheUpdater* updater = instance->CreateUpdaterL(1, _L("testlm123@gmail.com"),ETrue ); + updater->RegisterObserverL(*this); + updater->StartNewConversationL( _L("testui123@gmail.com") ) ; + + if( !iWait.IsStarted() ) + { + iWait.Start(); + } + updater->UnRegisterObserver(*this); + CIMCacheFactory::Release(); + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// Cimcache_test::AppendSendMessageL +// Example test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Cimcache_test::AppendSendMessageL( CStifItemParser& /*aItem*/ ) + { + CIMCacheFactory* instance = CIMCacheFactory::InstanceL(); + + MIMCacheUpdater* updater = instance->CreateUpdaterL(1, _L("testlm123@gmail.com") ,ETrue); + updater->RegisterObserverL(*this); + updater->StartNewConversationL( _L("testui123@gmail.com") ) ; + + if( !iWait.IsStarted() ) + { + iWait.Start(); + } + updater->AppendSendMessageL( _L("hello this is test message appended") ) ; + updater->UnRegisterObserver(*this); + CIMCacheFactory::Release(); + return KErrNone; + } + + // ----------------------------------------------------------------------------- +// Cimcache_test::AppendRecieveMessageL +// Example test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Cimcache_test::AppendRecieveMessageL( CStifItemParser& /*aItem*/ ) + { + CIMCacheFactory* instance = CIMCacheFactory::InstanceL(); + + MIMCacheUpdater* updater = instance->CreateUpdaterL(1, _L("testlm123@gmail.com"),ETrue ); + updater->AppendReceiveMessageL( _L("testui123@gmail.com"),_L("hello this is test message appended") ) ; + + CIMCacheFactory::Release(); + return KErrNone; + } + + // ----------------------------------------------------------------------------- +// Cimcache_test::StartNewConversationL +// Example test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Cimcache_test::FetchExistingMessageL( CStifItemParser& /*aItem*/ ) + { + CIMCacheFactory* instance = CIMCacheFactory::InstanceL(); + TInt error = KErrNotFound; + MIMCacheUpdater* updater = instance->CreateUpdaterL(1, _L("testlm123@gmail.com") ,ETrue); + // tow message appended hence counter will be two. + updater->AppendReceiveMessageL( _L("testui123@gmail.com"),_L("hello this is test first message appended") ) ; + updater->AppendReceiveMessageL( _L("testui123@gmail.com"),_L("hello this is test second message appended") ) ; + + updater->RegisterObserverL(*this); + + if( !iWait.IsStarted() ) + { + iWait.Start(); + } + + updater->StartNewConversationL( _L("testui123@gmail.com") ) ; + + if( !iWait.IsStarted() ) + { + iWait.Start(); + } + updater->UnRegisterObserver(*this); + CIMCacheFactory::Release(); + if( iMessageFetch == 2) // two message should be fetched + { + error = KErrNone; + } + return error; + } + +// ----------------------------------------------------------------------------- +// Cimcache_test::DeactivateConversationL +// Example test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Cimcache_test::DeactivateConversationL( CStifItemParser& /*aItem*/ ) + { + CIMCacheFactory* instance = CIMCacheFactory::InstanceL(); + + MIMCacheUpdater* updater = instance->CreateUpdaterL(1, _L("testlm123@gmail.com"),ETrue ); + updater->RegisterObserverL(*this); + updater->StartNewConversationL( _L("testui123@gmail.com") ) ; + + if( !iWait.IsStarted() ) + { + iWait.Start(); + } + // close the active conversation + updater->DeactivateConversationL(); + + updater->UnRegisterObserver(*this); + CIMCacheFactory::Release(); + return KErrNone; + } +// ----------------------------------------------------------------------------- +// Cimcache_test::CloseConversationL +// Example test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Cimcache_test::CloseConversationL( CStifItemParser& /*aItem*/ ) + { + CIMCacheFactory* instance = CIMCacheFactory::InstanceL(); + + MIMCacheUpdater* updater = instance->CreateUpdaterL(1, _L("testlm123@gmail.com"),ETrue ); + updater->RegisterObserverL(*this); + + updater->StartNewConversationL( _L("testui123@gmail.com") ) ; + + if( !iWait.IsStarted() ) + { + iWait.Start(); + } + // close the active conversation + updater->CloseConversationL( _L("testui123@gmail.com") ); + + if( !iWait.IsStarted() ) + { + iWait.Start(); + } + + updater->UnRegisterObserver(*this); + CIMCacheFactory::Release(); + return KErrNone; + } + + +// ----------------------------------------------------------------------------- +// Cimcache_test::GetUnreadMsgCountL +// Example test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Cimcache_test::GetUnreadMsgCountL(CStifItemParser& /*aItem*/) + { + CIMCacheFactory* instance = CIMCacheFactory::InstanceL(); + + MIMCacheAccessor* accessor = instance->CreateAccessorL(1, _L("testlm123@gmail.com") ); + + MIMCacheUpdater* updater = instance->CreateUpdaterL(1, _L("testlm123@gmail.com"), ETrue ); + updater->AppendReceiveMessageL( _L("testui123@gmail.com"),_L("hello this is test message appended") ) ; + TInt count = accessor->GetUnreadMessageCountL( _L("testui123@gmail.com") ); + CIMCacheFactory::Release(); + if(count == 1) + { + return KErrNone; + } + return KErrArgument; + } + + +// ----------------------------------------------------------------------------- +// Cimcache_test::GetUnreadMsgCountChangeL +// Example test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Cimcache_test::GetAllUnreadMsgCountL(CStifItemParser& /*aItem*/) + { + CIMCacheFactory* instance = CIMCacheFactory::InstanceL(); + + MIMCacheAccessor* accessor = instance->CreateAccessorL(1, _L("testlm123@gmail.com") ); + + MIMCacheUpdater* updater = instance->CreateUpdaterL(1, _L("testlm123@gmail.com"), ETrue ); + updater->AppendReceiveMessageL( _L("testui123@gmail.com"),_L("hello this is test message appended") ) ; + updater->AppendReceiveMessageL( _L("meco1111@gmail.com"),_L("i am fine here") ) ; + + TInt count = accessor->GetAllUnreadMessageCountL( ); + CIMCacheFactory::Release(); + if(count == 2) + { + return KErrNone; + } + return KErrArgument; + } +// ----------------------------------------------------------------------------- +// Cimcache_test::ConversationUnExistTestL +// Example test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Cimcache_test::ConversationUnExistTestL(CStifItemParser& /*aItem*/) + { + CIMCacheFactory* instance = CIMCacheFactory::InstanceL(); + + MIMCacheAccessor* accessor = instance->CreateAccessorL(1, _L("testlm123@gmail.com") ); + // not yest conversation open so must be EFalse here + TBool ret = accessor->IsConversationExistL(_L("testui123@gmail.com") ); + + CIMCacheFactory::Release(); + + if(!ret) + { + return KErrNone; + } + return KErrArgument; + } + +// ----------------------------------------------------------------------------- +// Cimcache_test::ConversationExistTestL +// Example test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Cimcache_test::ConversationExistTestL(CStifItemParser& /*aItem*/) + { + CIMCacheFactory* instance = CIMCacheFactory::InstanceL(); + + MIMCacheUpdater* updater = instance->CreateUpdaterL(1, _L("testlm123@gmail.com"), ETrue ); + updater->RegisterObserverL(*this); + updater->StartNewConversationL( _L("testui123@gmail.com") ) ; + + if( !iWait.IsStarted() ) + { + iWait.Start(); + } + + MIMCacheAccessor* accessor = instance->CreateAccessorL(1, _L("testlm123@gmail.com") ); + // conversation already open so must be ETrue here + TBool ret = accessor->IsConversationExistL( _L("testui123@gmail.com") ); + + updater->UnRegisterObserver(*this); + + CIMCacheFactory::Release(); + + if(ret) + { + return KErrNone; + } + return KErrArgument; + } + +// ----------------------------------------------------------------------------- +// Cimcache_test::AppendMessageL +// Example test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Cimcache_test::AppendMessageL( CStifItemParser& /*aItem*/ ) + { + CIMCacheFactory* instance = CIMCacheFactory::InstanceL(); + + MIMCacheUpdater* updater = instance->CreateUpdaterL(1, _L("testlm123@gmail.com") ,ETrue); + updater->RegisterObserverL(*this); + updater->StartNewConversationL( _L("testui123@gmail.com") ) ; + + if( !iWait.IsStarted() ) + { + iWait.Start(); + } + updater->AppendMessageL(_L("testui123@gmail.com"), _L("this is system or information message message") ) ; + updater->UnRegisterObserver(*this); + CIMCacheFactory::Release(); + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// Cimcache_test::GetUnreadMsgCountL +// Example test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Cimcache_test::GetNewMsgNotificationtL(CStifItemParser& /*aItem*/) + { + CIMCacheFactory* instance = CIMCacheFactory::InstanceL(); + MIMCacheAccessor* accessor = instance->CreateAccessorL(1, _L("testlm123@gmail.com") ); + accessor->RegisterObserverL(*this); + MIMCacheUpdater* updater = instance->CreateUpdaterL(1, _L("testlm123@gmail.com"),ETrue); + updater->AppendReceiveMessageL( _L("testui123@gmail.com"),_L("hello this is new message notification") ) ; + + if( !iWait.IsStarted() ) + { + iWait.Start(); + } + accessor->UnRegisterObserver(*this); + + CIMCacheFactory::Release(); + + return KErrNone; + } + + +// ----------------------------------------------------------------------------- +// Cimcache_test::GetChatListTestL +// Example test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Cimcache_test::GetChatListTestL( CStifItemParser& /*aItem*/) + { + TInt error = KErrGeneral; + + CIMCacheFactory* instance = CIMCacheFactory::InstanceL(); + MIMCacheUpdater* updater = instance->CreateUpdaterL(1, _L("testlm123@gmail.com"), EFalse ); + + updater->AppendReceiveMessageL( _L("testui123@gmail.com"),_L("hello this is new message notification 1 ") ) ; + updater->AppendReceiveMessageL( _L("abc123@gmail.com"),_L("hello this is new message notification 2 ") ) ; + updater->AppendReceiveMessageL( _L("testgizmo123@gmail.com"),_L("hello this is new message notification 3 ") ) ; + + + RArray listArray = updater->GetChatListL( 1 ); + + if( listArray.Count() == 3 ) // total 3 chat created in server + { + error = KErrNone; + } + + CIMCacheFactory::Release(); + + return error; + } +// ----------------------------------------------------------------------------- +// Cimcache_test::AccessorCloseConversationTestL +// Example test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Cimcache_test::AccessorCloseConversationTestL( CStifItemParser& /*aItem*/) + { + TInt error = KErrGeneral; + + CIMCacheFactory* instance = CIMCacheFactory::InstanceL(); + + MIMCacheUpdater* updater = instance->CreateUpdaterL(1, _L("testlm123@gmail.com"),EFalse ); + updater->AppendReceiveMessageL( _L("testui123@gmail.com"),_L("hello this is new message notification 1 ") ) ; + + MIMCacheAccessor* accessor = instance->CreateAccessorL(1, _L("testlm123@gmail.com") ); + accessor->RegisterObserverL(*this); + + if( accessor->IsConversationExistL(_L("testui123@gmail.com") ) ) + { + // close the active conversation + accessor->CloseConversationL( _L("testui123@gmail.com") ); + + if( !iWait.IsStarted() ) + { + iWait.Start(); + } + error = KErrNone; + } + + accessor->UnRegisterObserver(*this); + + CIMCacheFactory::Release(); + + return error; + } + +// ----------------------------------------------------------------------------- +// Cimcache_test::HandleIMCacheNewMessageEventL +// Example test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// + +void Cimcache_test::HandleIMCacheEventL( TIMCacheEventType aEventType, TAny* /*aChatMessage*/ ) + { + switch( aEventType ) + { + case EIMCacheUnreadMessage : + { + if( iWait.IsStarted() ) + { + iWait.AsyncStop(); + } + break; + } + case EIMCacheUnreadChange : + { + if( iWait.IsStarted() ) + { + iWait.AsyncStop(); + } + break; + } + + case EIMCacheRequestCompleted : + { + if( iWait.IsStarted() ) + { + iWait.AsyncStop(); + } + break; + } + case EIMCacheNewMessage : + { + iMessageFetch++; + if( iWait.IsStarted() && iMessageFetch == 2 ) + { + iWait.AsyncStop(); + } + break; + } + case EIMCacheNewChat: + { + if( iWait.IsStarted() ) + { + iWait.AsyncStop(); + } + break; + } + case EIMCacheChatClosed: + { + if( iWait.IsStarted() ) + { + iWait.AsyncStop(); + } + break; + } + + } + } +// ========================== OTHER EXPORTED FUNCTIONS ========================= +// None + +// end of file diff -r 000000000000 -r e6b17d312c8b imsrv_plat/im_cache_server_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/im_cache_server_api/group/bld.inf Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,29 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: File that exports the files belonging to +: imcache server +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +../inc/cinstantmsgindicator.h MW_LAYER_PLATFORM_EXPORT_PATH(cinstantmsgindicator.h) + +//end of file diff -r 000000000000 -r e6b17d312c8b imsrv_plat/im_cache_server_api/im_cache_server_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/im_cache_server_api/im_cache_server_api.metaxml Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,13 @@ + + +im_cache_server_api +This is a API that providesthe interface for the plugins, the cache server passes on the infomation to the plugins. +c++ +instantmessagingcache + + + +yes +no + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/im_cache_server_api/inc/cinstantmsgindicator.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/im_cache_server_api/inc/cinstantmsgindicator.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,91 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: base class declaration for accessing the cache information +* +*/ + + + +#ifndef __CINSTNATMSGINDICATOR_H +#define __CINSTNATMSGINDICATOR_H +// INCLUDES +#include +#include + +//Constants +// interface uid for the instantmessagecache. +const TUid KINSTANTMSGINTERFACEUID={0x20026768}; + +// The general rule is that the (category) UID must be the same as the Security ID (the SID) +// of the process in which the code that is performing the define operation is running. +// In effect, this forms a data cage, preventing a process from defining, or "occupying", +// another process's property. +// hence this is the uid of imcacheserver. +const TUid KIMStatusProperty={0x2001242A}; +enum TIMStatusPropertyKeys + { + EIMStatusPropertyMessageCount, + EIMStatusPropertyServiceId, + EIMStatusPropertySenderId, + EIMMultipleSender + }; + + /** + * An interface for setting/resetting statuspane icon + * + * @since 5.0 + */ + class CInstantMsgIndicator: public CBase + { + public: + + static CInstantMsgIndicator* CreateImplementationL( TUid aUid ); + + virtual ~CInstantMsgIndicator(); + public: + + /** + * sets/resets the status pane indicator + * @param aNewMessages, new message count + * @param aSeriveId, service id. + * @param aSenderId, message sender id. + * @param aMultipleSender, count of number of P-2_p chats. + */ + virtual void MessageInfoL(TInt aNewMessages, TInt aSeriveId,const TDesC& aSenderId,TInt aMultipleSenders) = 0; + + private: + /** + * Instance identifier key. When instance of an implementation is + * created by ECOM framework, the framework will assign a UID for + * it. The UID is used in the destructor to notify framework that + * this instance is being destroyed and resources can be released. + * Plugin implementations should leave this untouched, as the inline + * destructor and constructor method take care of ECom releasing. + */ + TUid iDtor_ID_Key; + }; + + inline CInstantMsgIndicator* CInstantMsgIndicator::CreateImplementationL( TUid aUid ) + { + TAny* ptr = REComSession::CreateImplementationL( aUid, _FOFF( CInstantMsgIndicator, iDtor_ID_Key ) ); + CInstantMsgIndicator* impl = static_cast (ptr); + return impl; + } + + inline CInstantMsgIndicator::~CInstantMsgIndicator() + { + REComSession::DestroyedImplementation( iDtor_ID_Key ); + } + + #endif //__CINSTNATMSGINDICATOR_H diff -r 000000000000 -r e6b17d312c8b imsrv_plat/presence_avabilitytext/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/presence_avabilitytext/group/bld.inf Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,26 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: bld.inf for presence_avalability text +* +*/ + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +../inc/avabilitytext.h MW_LAYER_PLATFORM_EXPORT_PATH(avabilitytext.h) + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/presence_avabilitytext/inc/avabilitytext.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/presence_avabilitytext/inc/avabilitytext.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,105 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: presence_avalability text +* +*/ +#ifndef __AVABILITYTEXT_H +#define __AVABILITYTEXT_H + +//availability text to be used with MPresenceBuddyInfo2::EBusy. +//changed status values to sync with icons ids available in the branddata +_LIT(KAwayState,"away"); +_LIT(KOnPhoneState,"onmobile"); +_LIT(KDndState,"dnd"); + +//availability text to be used with MPresenceBuddyInfo2::EUnknownAvailability. +_LIT(KInvisibleState,"offline"); + +//Extension key-value to be used with MPresenceBuddyInfo2. +//Extension Keys +_LIT(KExtensionKey,"ExtensionKey"); + +//Extension Values. +_LIT8(KPendingRequestExtensionValue,"pending"); +_LIT8(KBlockedExtensionValue,"block"); +_LIT8(KServiceExtensionValue,"ServiceOut"); +_LIT8(KCallForwardExtensionValue,"CallForward"); + +/* +=========================Example For BUSY States ============================= +MPresenceBuddyInfo2* buddyPresInfo = MPresenceBuddyInfo2::NewLC(); + +//This will set presence status as On phone +buddyPresInfo->SetAvailabilityL( MPresenceBuddyInfo2::EBusy,KOnPhoneState); + +//This will set presence status as Away +buddyPresInfo->SetAvailabilityL( MPresenceBuddyInfo2::EBusy,KAwayState); + +//This will set presence status as do not disture +buddyPresInfo->SetAvailabilityL( MPresenceBuddyInfo2::EBusy,KDndState); + +NOTE:: if TDesC& aAvailabilityText(second arg) is other then mentioned and + TAvailabilityValues aAvailability is MPresenceBuddyInfo2::EBusy + then presence will be BUSY. +============================================================================== +*/ + +/* +=========================Example For INVISIBLE State=========================== +MPresenceBuddyInfo2* buddyPresInfo = MPresenceBuddyInfo2::NewLC(); + +//This will set presence status as Invisible. +buddyPresInfo->SetAvailabilityL( MPresenceBuddyInfo2::EUnknownAvailability,KInvisibleState); + +NOTE:: if TDesC& aAvailabilityText(second arg) is other then mentioned and + TAvailabilityValues aAvailability is MPresenceBuddyInfo2::EUnknownAvailability + then presence will be UNKNOWN. + +============================================================================== +*/ + +/* +=========================Example For BLOCKED And PENDING State================= +MPresenceBuddyInfo2* buddyPresInfo = MPresenceBuddyInfo2::NewLC(); + +//This will set presence status as pending +buddyPresInfo->SetAnyFieldL( KExtensionKey, KPendingRequestExtensionValue ); + +//This will set presence status as blocked +buddyPresInfo->SetAnyFieldL( KExtensionKey, KBlockedExtensionValue ); + +NOTE:: if TDesC8& aValue(second arg) is other then mentioned then the(blocked) +and pending states will not be shown +provided the prnding and blocked state are not required at the smae time. +============================================================================== +*/ + +/* +=========================Example For ServiceOut And CallForward State================= +MPresenceBuddyInfo2* buddyPresInfo = MPresenceBuddyInfo2::NewLC(); + +//This will set presence status as CallForward +buddyPresInfo->SetAnyFieldL( KExtensionKey, KCallForwardExtensionValue ); + +//This will set presence status as ServiceOut +buddyPresInfo->SetAnyFieldL( KExtensionKey, KServiceOutExtensionValue ); + +NOTE:: if TDesC8& aValue(second arg) is other then mentioned then the(blocked) +and pending states will not be shown +provided the prnding and blocked state are not required at the smae time. +============================================================================== +*/ +#endif //__AVABILITYTEXT_H + +// End of File diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_base_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_base_api/group/bld.inf Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,30 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: File that exports the files belonging to +: XIMP Core Base API +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +../inc/ximpbase.inl MW_LAYER_PLATFORM_EXPORT_PATH(ximpbase.inl) +../inc/ximpbase.h MW_LAYER_PLATFORM_EXPORT_PATH(ximpbase.h) +../inc/ximperrors.hrh MW_LAYER_PLATFORM_EXPORT_PATH(ximperrors.hrh) +../inc/ximpbaseifids.hrh MW_LAYER_PLATFORM_EXPORT_PATH(ximpbaseifids.hrh) diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_base_api/inc/ximpbase.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_base_api/inc/ximpbase.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,411 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Base interface and related helpers for XIMPFw interfaces. +* +*/ + +#ifndef XIMPBASE_H +#define XIMPBASE_H + +#include +#include + + +/** + * Base interface for XIMP Framework object interfaces. + * + * Base interface for XIMP Framework object interfaces. + * -# All other XIMP Framework object interfaces inherit + * directly from MXIMPBase. + * -# Future extended XIMP Framework interfaces may inherit + * also indirectly from MXIMPBase, by deriving from some current + * XIMP Framework interface, and extending the interface + * functionality with some new methods. + * -# Each XIMP Framework object derives only once + * from MXIMPBase. + * + * + * MXIMPBase::GetInterface() methods allows client to + * discover referencies to other interfaces that the object + * in question supports. MXIMPBase::GetInterfaceId() method + * lets client to discover the objects primary interface id. + * + * @ingroup ximpfwbaseapi + * @since S60 v3.2 + */ +class MXIMPBase + { +public: + + /** Interface ID for the MXIMPBase. */ + enum { KInterfaceId = XIMP_IF_ID_BASE }; + + +public: + + /** + * Options for interface resolving. + * + * Client gives one of these options for interface resolving, + * to select which way the client wants to handle possible + * unknown interface. + */ + enum TIfGetOps + { + /** + * Requestes the interface resolver to signal unknown + * interface by returning NULL. + */ + EReturnNullIfUnknown = 0, + + /** + * Requestes the interface resolver to signal unknown + * interface by raising a panic. + */ + EPanicIfUnknown + }; + + + +protected: + + /** + * Protected destructor. + * + * Concrete objects can't be + * deleted via base interface. + */ + virtual ~MXIMPBase() {}; + + + +public: + + + /** + * Const interface query. + * + * Interface query to access other XIMP Framework + * interfaces that the object in question supports. + * Returns const (read-only) interface. If unsupported + * interface type is tried to access, error is handle as + * defined by given aOps parameter. + * + * NOTE: Client may use method directly, and cast returned + * TAny pointer to requested interface type. Or client optionally + * use templated TXIMPGetInterface helper to encapsulate + * interface query and type cast. + * + * @param [in] aInterfaceId + * Interface identifier identifying the interface + * to retrieve. + * + * @param [in] aOps + * Options for interface query. + * + * @return Pointer to the retrieved interface type. + * NULL if the object in question does not support + * the requested interface. + */ + virtual const TAny* GetInterface( + TInt32 aInterfaceId, + TIfGetOps aOps ) const = 0; + + + /** + * Non-const interface query. + * + * Interface query to access other XIMP Framework + * interfaces that the object in question supports. + * Returns modifiable (non-const) interface. If unsupported + * interface type is tried to access, error is handle as + * defined by given aOps parameter. + * + * NOTE: Client may use method directly, and cast returned + * TAny pointer to requested interface type. Or client optionally + * use templated TXIMPGetInterface helper to encapsulate + * interface query and type cast. + * + * @param [in] aInterfaceId + * Interface identifier identifying the interface + * to retrieve. + * + * @param [in] aOps + * Options for interface query. + * + * @return Pointer to the retrieved interface type. + * NULL if the object in question does not support + * the requested interface. + */ + virtual TAny* GetInterface( + TInt32 aInterfaceId, + TIfGetOps aOps ) = 0; + + + /** + * Interface identifier access. + * + * Method to access object interface identifier. + * Returns always objects "primary" interface id. + * Primary interface id, is the interface id of the + * MXIMPBase derived interface that object + * implements. + * + * @return Object interface id. + */ + virtual TInt32 GetInterfaceId() const = 0; + + }; + + + +/** + * Templated array of pointers. + * + * Templated array of pointers, array owns the pointed objects + * and overwrites the normal RPointerArray::Close() + * behaviour to destroy objects, before reseting the + * array contents. + * + * Array is used with XIMP Framework interface objects. + * + * @ingroup ximpfwbaseapi + * @since S60 v3.2 + */ +template< class T > +class RXIMPObjOwningPtrArray : public RPointerArray + { + public: + + /** + * Default C++ constructor. + */ + inline RXIMPObjOwningPtrArray(); + + + /** + * Overwritten Close(). + * + * Calls ResetAndDestroy() to delete holded objects + * before reseting array contents. Thus array can be + * pushed on the cleanup stack with CleanupClosePushL(). + */ + inline void Close(); + + + /** + * @todo + * R-class destrcutor. This must be removed from interface, + * since by Symbian OS convention, R-classes do not have destructor. + */ + inline ~RXIMPObjOwningPtrArray(); + }; + + + + + +/** + * Request identifier. + * + * Request identifier to identify the asynchronous request + * made by client or protocoll adaptation to the XIMP Framework. + * Identifier type is also used to identify requests that + * XIMP Framework issues to Protocol Adaptation. + * + * @ingroup ximpfwbaseapi + * @since S60 v3.2 + */ +class TXIMPRequestId + { +public: + enum + { + /** The maximum size of the request id.*/ + EMaxSize = 16 + }; + +public: + + /** + * C++ default constructor. + * + * Initializes the request ID with TXIMPRequestId::Null() + * value. + */ + inline TXIMPRequestId(); + + + /** + * Equality operator. + * + * Tests request ID for equality with the specified request ID. + * + * @param [in] aRhs + * The request ID to be compared with. + * + * @return ETrue, if request ID equals to the specified one. + * Otherwise EFalse. + */ + inline TBool operator==( const TXIMPRequestId& aRhs ) const; + + + /** + * Inequality operator. + * + * Tests this request ID for inequality with the specified request ID. + * + * @param [in] aRhs + * The request ID to be compared with. + * + * @return ETrue, if request ID inequals to the specified one. + * Otherwise EFalse. + */ + inline TBool operator!=( const TXIMPRequestId& aRhs ) const; + + + /** + * Constructs a Null-valued TXIMPRequestId object. + * + * @return Null-valued TXIMPRequestId object. + */ + static inline TXIMPRequestId Null(); + + + /** + * Constructs a TXIMPRequestId object having + * given integer value. + * + * This method is ment for XIMP Framework + * client and adaptation level test code. + * In normal circumstances XIMP Framework + * fills the TXIMPRequestId contents internally. + * + * @param aValue Integer value for TXIMPRequestId. + * + * @return Integer-valued TXIMPRequestId object. + */ + static inline TXIMPRequestId Init( TInt aValue ); + + + +private: // data + + //OWN: Request id data + TUint8 iRequestId[ TXIMPRequestId::EMaxSize ]; + }; + + + + +/** + * Interface query and type cast helper. + * + * Templated interface query and type cast helper. + * Capable to retrieve const interface from const source object + * and non-const interface from non-const source object. + * + * Const interface usage example: + * @code + * const MXIMPBase* obj = GetObjectImplementingTheInterfaceLC(); + * + * const MXimpFwTheInterface* theInterface = + * TXIMPGetInterface< const MXimpFwTheInterface >::From( *obj, + * MXIMPBase::EPanicIfUnknown ); + * theInterface->DoSomething(); + * @endcode + * + * + * Non-const interface usage example: + * @code + * MXIMPBase* obj = GetObjectImplementingTheInterfaceLC(); + * + * MXimpFwTheInterface* theInterface = + * TXIMPGetInterface< MXimpFwTheInterface >::From( *obj, + * MXIMPBase::EPanicIfUnknown ); + * theInterface->DoSomething(); + * @endcode + * + * @ingroup ximpfwbaseapi + * @since S60 v3.2 + */ +template< class T > +class TXIMPGetInterface + { +public: + + /** + * Interface query and type cast. + * + * Encapsulates query of const interface from given + * const source object. The retrieved interface type is + * defined with template parameter. KInterfaceId identifier + * from template parameter, is used to identify + * the retrieved interface. + * + * @param [in] aObj + * Source object from where to retrieve interface. + * + * @param [in] aOps + * Options for interface resolving. + * Given options are delivered directly + * to MXIMPBase::GetInterface(). + * + * @return Pointer to the retrieved interface. + * NULL if the object in question does not support + * the requested interface. + */ + static inline T* From( + const MXIMPBase& aObj, + MXIMPBase::TIfGetOps aOps ); + + + + /** + * Interface query and type cast. + * + * Encapsulates query of interface from given source object. + * The retrieved interface type is defined with template + * parameter. KInterfaceId identifier from template parameter, + * is used to identify the retrieved interface. + * + * @param [in] aObj + * Source object from where to retrieve interface. + * + * @param [in] aOps + * Options for interface resolving. + * Given options are delivered directly + * to MXIMPBase::GetInterface(). + * + * @return Pointer to the retrieved interface. + * NULL if the object in question does not support + * the requested interface. + */ + static inline T* From( + MXIMPBase& aObj, + MXIMPBase::TIfGetOps aOps ); + + + +private: //Prohibited constructor + TXIMPGetInterface(); + }; + + +#include "ximpbase.inl" + +#endif // XIMPBASE_H + + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_base_api/inc/ximpbase.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_base_api/inc/ximpbase.inl Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,146 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Base interface and related helpers for XIMPFw interfaces. +* +*/ + +#include + +// ----------------------------------------------------------------------------- +// RXIMPObjOwningPtrArray::RXIMPObjOwningPtrArray() implementation. +// +// ----------------------------------------------------------------------------- +// +template +inline RXIMPObjOwningPtrArray::RXIMPObjOwningPtrArray() + { + } + +// ----------------------------------------------------------------------------- +// RXIMPObjOwningPtrArray::Close() implementation. +// Calls ResetAndDestroy() to destroy holded objects. +// ----------------------------------------------------------------------------- +// +template +inline void RXIMPObjOwningPtrArray::Close() + { + RPointerArray::ResetAndDestroy(); + } + +// ----------------------------------------------------------------------------- +// RXIMPObjOwningPtrArray::~RXIMPObjOwningPtrArray() +// @todo R-class destrcutor - will be removed from interface. +// ----------------------------------------------------------------------------- +// +template +inline RXIMPObjOwningPtrArray::~RXIMPObjOwningPtrArray() + { + Close(); + } + +// ----------------------------------------------------------------------------- +// TXIMPRequestId::TXIMPRequestId() +// C++ default constructor. +// ----------------------------------------------------------------------------- +// +inline TXIMPRequestId::TXIMPRequestId() + { + Mem::FillZ( iRequestId, TXIMPRequestId::EMaxSize ); + } + +// ----------------------------------------------------------------------------- +// TXIMPRequestId::operator==() +// Tests request ID for equality with the specified request ID. +// ----------------------------------------------------------------------------- +// +inline TBool TXIMPRequestId::operator==( const TXIMPRequestId& aRhs ) const + { + if ( Mem::Compare( aRhs.iRequestId, + TXIMPRequestId::EMaxSize, + iRequestId, + TXIMPRequestId::EMaxSize ) == 0 ) + { + return ETrue; + } + + return EFalse; + } + +// ----------------------------------------------------------------------------- +// TXIMPRequestId::operator!=() +// Tests this request ID for inequality with the specified request ID. +// ----------------------------------------------------------------------------- +// +inline TBool TXIMPRequestId::operator!=( const TXIMPRequestId& aRhs ) const + { + if ( Mem::Compare( aRhs.iRequestId, + TXIMPRequestId::EMaxSize, + iRequestId, + TXIMPRequestId::EMaxSize ) != 0 ) + { + return ETrue; + } + + return EFalse; + } + +// ----------------------------------------------------------------------------- +// TXIMPRequestId::Null() +// Returns a null-valued request ID +// ----------------------------------------------------------------------------- +// +inline TXIMPRequestId TXIMPRequestId::Null() + { + return TXIMPRequestId(); + } + +// ----------------------------------------------------------------------------- +// TXIMPRequestId::Init() +// Returns a integer-valued request ID +// ----------------------------------------------------------------------------- +// +inline TXIMPRequestId TXIMPRequestId::Init( TInt aValue ) + { + TXIMPRequestId id; + Mem::Copy( &id.iRequestId, &aValue, sizeof( TInt ) ); + return id; + } + +// ----------------------------------------------------------------------------- +// TXIMPGetInterface::From() +// Const interface query and type cast. +// ----------------------------------------------------------------------------- +// +template +inline T* TXIMPGetInterface::From( const MXIMPBase& aObj, + MXIMPBase::TIfGetOps aOps ) + { + const TAny* ifPtr = aObj.GetInterface( T::KInterfaceId, aOps ); + const T* ifTypePtr = static_cast< const T* >( ifPtr ); + return ifTypePtr; + } + +// ----------------------------------------------------------------------------- +// TXIMPGetInterface::From() +// Non-const interface query and type cast. +// ----------------------------------------------------------------------------- +// +template< class T > +inline T* TXIMPGetInterface::From( MXIMPBase& aObj, + MXIMPBase::TIfGetOps aOps ) + { + TAny* ifPtr = aObj.GetInterface( T::KInterfaceId, aOps ); + T* ifTypePtr = static_cast< T* >( ifPtr ); + return ifTypePtr; + } diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_base_api/inc/ximpbaseifids.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_base_api/inc/ximpbaseifids.hrh Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,47 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework Base API interface IDs. +* +*/ + +#ifndef XIMPBASEIFIDS_HRH +#define XIMPBASEIFIDS_HRH + + +/** + * @defgroup ximpcoreapi XIMP Framework Core API + * @defgroup ximpfwbaseapi XIMP Framework Base API + * @ingroup ximpcoreapi + * + * XIMP Framework Base API declares XIMP Framework + * specific base structures and definitions, which are used + * in all other XIMP Framework APIs. + * + * XIMP Framework Base API defines abstract base interface, + * from where all other XIMP Framework object interfaces + * derive from. XIMP Framework Base API contains also common + * helpers for interface use, common error codes, and comon + * request ID structures. + * + * @since S60 v3.2 + */ + + +// Interface UID for XIMPFw Base API interfaces +#define XIMP_IF_ID_BASE 0x10282DD5 + + + +#endif // XIMPBASEIFIDS_HRH + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_base_api/inc/ximperrors.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_base_api/inc/ximperrors.hrh Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,92 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Protocol agnostic error codes for XIMP Framework. +* +*/ + +#ifndef XIMPERRORS_HRH +#define XIMPERRORS_HRH + + + +/** + * XIMP Framework core error codes. + * + * Error codes returned from XIMP Framework core are either: + * -# System wide Symbian OS error codes (KErrNone, KErrNoMemory, etc.) + * -# Protocol agnostic core related error codes defined here. + * These error codes have range: KXIMPErrBase ... KXIMPErrLow. + * + * @ingroup ximpfwbaseapi + * @since S60 v3.2 + */ +enum + { + KXIMPErrBase = -30131, + + /** + * Generic error code to indicate that request processing + * has failed on ximp protocol level to some error, + * which isn't mapped to any other more detailed + * error code. + */ + KXIMPErrServiceGeneralError = KXIMPErrBase, + + + /** + * Error code to indicate that ximp service + * doesn't support the request issued by the client. + */ + KXIMPErrServiceRequestTypeNotSupported = KXIMPErrBase - 1, + + + /** + * Error code to indicate that request handling has + * failed because because the ximp service is + * shutting down. + */ + KXIMPErrServiceShutdown = KXIMPErrBase - 2, + + + /** + * Error code to indicate that ximp service + * has terminated the ximp session. + */ + KXIMPErrServiceForceClosedSession = KXIMPErrBase - 3, + + + /** + * Error code to indicate that request handling has + * failed on ximp protocol level to insufficient + * user authentication. + */ + KXIMPErrServiceAuthenticationFailed = KXIMPErrBase - 4, + + + /** + * Error code to indicate that request handling has + * timeouted on ximp protocol level. + */ + KXIMPErrServicRequestTimeouted = KXIMPErrBase - 5, + + KXIMPErrLow = -30137 + + // Note that presence uses codes from -30138 to -30150 + + }; + + +#endif // XIMPERRORS_HRH + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_base_api/ximp_core_base_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_base_api/ximp_core_base_api.metaxml Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,20 @@ + + +XIMP Core Base API +Contains common base interface and definitions shared between all other XIMP Framework APIs. +c++ +ximpfw + + + + + + + + + + +yes +no + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_data_model_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_data_model_api/group/bld.inf Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,38 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: File that exports the files belonging to +: XIMP Core Data Model API +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +../inc/ximpprotocolinfo.h MW_LAYER_PLATFORM_EXPORT_PATH(ximpprotocolinfo.h) +../inc/ximpcontextclientinfo.h MW_LAYER_PLATFORM_EXPORT_PATH(ximpcontextclientinfo.h) +../inc/ximpobjectfactory.h MW_LAYER_PLATFORM_EXPORT_PATH(ximpobjectfactory.h) +../inc/ximpdatamodelifids.hrh MW_LAYER_PLATFORM_EXPORT_PATH(ximpdatamodelifids.hrh) +../inc/ximpserviceinfo.h MW_LAYER_PLATFORM_EXPORT_PATH(ximpserviceinfo.h) +../inc/ximpfeatureinfo.h MW_LAYER_PLATFORM_EXPORT_PATH(ximpfeatureinfo.h) +../inc/ximpstatus.h MW_LAYER_PLATFORM_EXPORT_PATH(ximpstatus.h) +../inc/ximpcontextstate.h MW_LAYER_PLATFORM_EXPORT_PATH(ximpcontextstate.h) +../inc/ximpidentity.h MW_LAYER_PLATFORM_EXPORT_PATH(ximpidentity.h) +../inc/ximprestrictedobjectcollection.h MW_LAYER_PLATFORM_EXPORT_PATH(ximprestrictedobjectcollection.h) +../inc/ximpobjectcollection.h MW_LAYER_PLATFORM_EXPORT_PATH(ximpobjectcollection.h) +../inc/ximpdatasubscriptionstate.h MW_LAYER_PLATFORM_EXPORT_PATH(ximpdatasubscriptionstate.h) diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_data_model_api/inc/ximpcontextclientinfo.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_data_model_api/inc/ximpcontextclientinfo.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,89 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interface for presence context client info object. +* +*/ + +#ifndef MXIMPFWCONTEXTCLIENTINFO_H +#define MXIMPFWCONTEXTCLIENTINFO_H + +#include +#include +#include + + +class MXIMPIdentity; + + +/** + * Interface for XIMP context client info object. + * + * XIMP context client info object presents information + * about single XIMP context client. + * + * @ingroup ximpdatamodelapi + * @since S60 v3.2 + */ +class MXIMPContextClientInfo : public MXIMPBase + { +public: + + /** Interface ID for the MXIMPContextClientInfo. */ + enum { KInterfaceId = XIMP_IF_ID_CONTEXT_CLIENT_INFO }; + + +public: + + /** + * Public destructor. + * Objects can be deleted through this interface. + */ + virtual ~MXIMPContextClientInfo() {} + + +public: + + + /** + * Returns XIMP context client identity value. + * + * @return The XIMP context client + * identity value. + */ + virtual const MXIMPIdentity& ClientId() const = 0; + + + + /** + * Sets XIMP context client identity value. + * + * @param [in] aIdentity + * New XIMP context client identity value. + * Ownership of the argument is transfered to + * callee, if method succeeds without a leave. + * + * @leave KErrNoMemory if failed to allocate memory. + * @leave KErrArgument if NULL argument were provided. + */ + virtual void SetClientIdL( + MXIMPIdentity* aIdentity ) = 0; + + + }; + + + +#endif // MXIMPFWCONTEXTCLIENTINFO_H + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_data_model_api/inc/ximpcontextstate.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_data_model_api/inc/ximpcontextstate.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,84 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interface for XIMP context state object. +* +*/ + +#ifndef MXIMPFWCONTEXTSTATE_H +#define MXIMPFWCONTEXTSTATE_H + +#include +#include +#include + + +/** + * Interface for XIMP context state object. + * + * XIMP context state object presents state of the + * XIMP context. + * + * @ingroup ximpdatamodelapi + * @since S60 v3.2 + */ +class MXIMPContextState : public MXIMPBase + + { +public: + + /** Interface ID for the MXIMPContextState. */ + enum { KInterfaceId = XIMP_IF_ID_CONTEXT_STATE }; + + + /** XIMP context states. */ + enum TState + { + /** Context is inactive */ + EInactive = 0, + + /** Context is binding to service */ + EBinding, + + /** Context is active and binded to service */ + EActive, + + /** Context is unbinding from service */ + EUnbinding + }; + + +public: + + /** + * Public destructor. + * Objects can be deleted through this interface. + */ + virtual ~MXIMPContextState() {} + + +public: + + /** + * Gets the XIMP Context state value. + * + * @return The XIMP Context state value. + */ + virtual TState ContextState() const = 0; + + }; + + +#endif // MXIMPFWCONTEXTSTATE_H + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_data_model_api/inc/ximpdatamodelifids.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_data_model_api/inc/ximpdatamodelifids.hrh Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,60 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework Data Model API interface IDs. +* +*/ + +#ifndef XIMPDATAMODELIFIDS_HRH +#define XIMPDATAMODELIFIDS_HRH + + +/** + * @defgroup ximpdatamodelapi XIMP Core Data Model API + * @ingroup ximpcoreapi + * + * XIMP Core Data Model API contains generic object + * containers, status objects and identity objects. + * API provides also abstract object factory interface + * to instantiate other objects. + * + * Object types declared in XIMP Core Data Model API + * are used both in XIMP Framework - client communication + * and in XIMP Framework - protocol adaptation cummunication. + * + * @since S60 v3.2 + */ + +// Datamodel IF id's +// 10xx - ximp related +// 11xx - presence related +// 12xx - instant messaging related + +// Interface IDs for XIMP Data Model API interfaces +#define XIMP_IF_ID_OBJECT_FACTORY 1001 +#define XIMP_IF_ID_RESTRICTED_OBJECT_COLLECTION 1002 +#define XIMP_IF_ID_OBJECT_COLLECTION 1003 +#define XIMP_IF_ID_PROTOCOL_INFO 1004 +#define XIMP_IF_ID_SERVICE_INFO 1005 +#define XIMP_IF_ID_FEATURE_INFO 1006 +#define XIMP_IF_ID_CONTEXT_CLIENT_INFO 1007 +#define XIMP_IF_ID_STATUS 1008 +#define XIMP_IF_ID_CONTEXT_STATE 1009 +#define XIMP_IF_ID_DATA_SUBSCRIPTION_STATE 1010 +#define XIMP_IF_ID_IDENTITY 1011 + + +#endif // XIMPDATAMODELIFIDS_HRH + + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_data_model_api/inc/ximpdatasubscriptionstate.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_data_model_api/inc/ximpdatasubscriptionstate.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,133 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interface for data subscription state object. +* +*/ + +#ifndef MXIMPFWDATASUBSCRIPTIONSTATE_H +#define MXIMPFWDATASUBSCRIPTIONSTATE_H + +#include +#include +#include + +/** + * Interface for data subscription state object. + * + * Data subscription state object contains information + * about certain data item subscription state. + * + * Protocol adaptation can use this object type to check + * and update item subscription state. + * + * To client direction XIMP Framework uses this + * object type to inform client about item current + * status in data change events. + * + * + * @ingroup ximpdatamodelapi + * @since S60 v3.2 + */ +class MXIMPDataSubscriptionState : public MXIMPBase + + { +public: + + /** Interface ID for the MXIMPDataSubscriptionState. */ + enum { KInterfaceId = XIMP_IF_ID_DATA_SUBSCRIPTION_STATE }; + + + /** Data subscription state enumeration. */ + enum TSubscriptionState + { + /** Data item subscription isn't active. */ + ESubscriptionInactive, + + /** Data item subscription is active. */ + ESubscriptionActive + }; + + + + /** Data state enumeration. */ + enum TDataState + { + /** Data content isn't available. */ + EDataUnavailable, + + /** Data content is available. */ + EDataAvailable + }; + + +public: + + /** + * Public destructor. + * Objects can be deleted through this interface. + */ + virtual ~MXIMPDataSubscriptionState() {} + + + +public: + + + /** + * Returns data subscription state. + * + * @return The data subscription state. + */ + virtual TSubscriptionState SubscriptionState() const = 0; + + + + /** + * Returns data state. + * + * @return The data state. + */ + virtual TDataState DataState() const = 0; + + + + /** + * Sets data subscription state value. + * + * @param [in] aSubscriptionState + * New data subscription state value. + * + * @leave KErrNoMemory if failed to allocate memory. + */ + virtual void SetSubscriptionStateL( + TSubscriptionState aSubscriptionState ) = 0; + + + + /** + * Sets data state value. + * + * @param [in] aDataState + * New data state value. + * + * @leave KErrNoMemory if failed to allocate memory. + */ + virtual void SetDataStateL( + TDataState aDataState ) = 0; + }; + + +#endif // MXIMPFWDATASUBSCRIPTIONSTATE_H + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_data_model_api/inc/ximpfeatureinfo.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_data_model_api/inc/ximpfeatureinfo.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,129 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interface for presence feature info object. +* +*/ + +#ifndef MXIMPFWFEATUREINFO_H +#define MXIMPFWFEATUREINFO_H + +#include +#include +#include +#include + + +/** + * Literal feature IDs for XIMP Framework features. + * + * @ingroup ximpdatamodelapi + * @since S60 v3.2 + * + * @todo Exact features & their IDs need to be defined. + */ +namespace NXIMPFeature + { + namespace Presence + { + _LIT8( KPublish, "feat/pres/pub"); + _LIT8( KFetch, "feat/pres/fetch"); + _LIT8( KSubscribe, "feat/pres/subs"); + _LIT8( KUnsubscribe, "feat/pres/unsubs"); + _LIT8( KAddContact, "feat/pres/addcnt"); + _LIT8( KDeleteContact, "feat/pres/delcnt"); + _LIT8( KBlock, "feat/pres/block"); + _LIT8( KUnBlock, "feat/pres/unblock"); + _LIT8( KAvatar, "feat/pres/avatar"); + } + + namespace PresentityGroups + { + _LIT8( KCreate, "feat/entgroup/create"); + _LIT8( KDelete, "feat/entgroup/delete"); + } + namespace InstantMessage + { + _LIT8( KInstantMessage, "feat/im"); + } + namespace Search + { + _LIT8( KSearch, "feat/search"); + } + } + + + +/** + * Interface for XIMP feature info object. + * + * @TODO Improve comments: Container used to present either XIMP Framework, + * Presence Protocol or Presence Context features. + * + * @ingroup ximpdatamodelapi + * @since S60 v3.2 + */ +class MXIMPFeatureInfo : public MXIMPBase + { +public: + + /** The MXIMPFeatureInfo interface ID. */ + enum { KInterfaceId = XIMP_IF_ID_FEATURE_INFO }; + + +public: + + + /** + * Public destructor. + * Objects can be deleted through this interface. + */ + virtual ~MXIMPFeatureInfo() {} + + +public: + + + /** + * Gets the list of feature IDs. + * + * @return The list of features. Depending from where + * the MXIMPFeatureInfo object was retrieved, + * list contains either XIMP Framework, + * Presence Protocol or Presence Context features. + */ + virtual const MDesC8Array& FeatureIds() const = 0; + + + + /** + * Checks has the MXIMPFeatureInfo object the given feature + * ID or not. + * + * @param [in] aFeatureId + * The feature ID which status to check. + * XIMP Framework feature IDs are defined in + * NXIMPFeature namespace. + * + * @return KErrNone if the ID is found from the feature ID list. + * KErrNotFound if the ID is not found from feature ID list. + */ + virtual TInt HasFeatureId( + const TDesC8& aFeatureId ) = 0; + + }; + + +#endif // MXIMPFWFEATUREINFO_H + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_data_model_api/inc/ximpidentity.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_data_model_api/inc/ximpidentity.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,81 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interface for identity object. +* +*/ + +#ifndef MXIMPFWIDENTITY_H +#define MXIMPFWIDENTITY_H + +#include +#include +#include + + +/** + * Interface for identity object. + * + * Identity objects are used to identify + * presentities, presentity groups and + * presentity group members, XIMP framework + * client applications etc. entities in + * XIMP Framework. + * + * @ingroup ximpdatamodelapi + * @since S60 v3.2 + */ +class MXIMPIdentity : public MXIMPBase + { +public: + + /** Interface ID for the MXIMPIdentity. */ + enum { KInterfaceId = XIMP_IF_ID_IDENTITY }; + + +public: + + /** + * Public destructor. + * Objects can be deleted through this interface. + */ + virtual ~MXIMPIdentity() {} + + +public: + + + /** + * Returns identity string. + * + * @return The identity string. + */ + virtual const TDesC16& Identity() const = 0; + + + + /** + * Sets identity. + * + * @param [in] aIdentity + * Identity string. + * + * @leave KErrNoMemory if failed to allocate memory. + */ + virtual void SetIdentityL( + const TDesC16& aIdentity ) = 0; + + }; + + +#endif // MXIMPFWIDENTITY_H diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_data_model_api/inc/ximpobjectcollection.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_data_model_api/inc/ximpobjectcollection.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,228 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interface for object collection. +* +*/ + +#ifndef MXIMPFWOBJECTCOLLECTION_H +#define MXIMPFWOBJECTCOLLECTION_H + +#include +#include +#include + + + +/** + * Interface for object collection. + * + * Object collection is a generic container, capable to + * contain MXIMPBase derived objects, implemented by the + * XIMP Framework. + * + * Object collection can contain multiple instancies + * from single MXIMPBase derived object type at time. + * Object collection supports also attaching name to + * contained objects to further identify objects. + * + * Object collection supports adding and getting objects, + * and looking up objects by their interface type. + * Object collection takes the ownership of added + * objects. + * + * @ingroup ximpdatamodelapi + * @since S60 v3.2 + */ +class MXIMPObjectCollection : public MXIMPBase + { +public: + + /** Interface ID for the MXIMPObjectCollection. */ + enum { KInterfaceId = XIMP_IF_ID_OBJECT_COLLECTION }; + + +public: + + /** + * Public destructor. + * Objects can be deleted through this interface. + */ + virtual ~MXIMPObjectCollection() {} + + +public: // Object lookup + + + /** + * Looks up the object having given interface type + * and zero length name. Returns the first found + * object. + * + * @param [in,out] aObject + * Object of given interface type and zero length name + * or NULL if no object having given interface type is + * found. + * On entry, contains the object from where to start + * the lookup or NULL if lookup should be started from + * beginning of the set. If object given in entry is not + * found from set, lookup is started from beginning + * of the set. + * On return, if an matching object is found, this is + * set to point to the found object, else NULL. + * Found object ownership is not returned to caller. + * + * @param [in] aInterfaceId + * The interface type of the object + * to be looked up. + */ + virtual void LookupByType( + const MXIMPBase*& aObject, + TInt32 aInterfaceId ) const = 0; + + + /** + * Looks up the object having given interface + * type and matching object name. + * + * @param [in,out] aObject + * On entry, contains the object from where to start + * the lookup or NULL if lookup should be started from + * the beginning of the set. + * If object given in entry is not found from set, + * lookup is started from the beginning of the set. + * On return, if an matching object is found, this is + * set to point to the found object, else NULL. + * Found object ownership is not returned to caller. + * + * @param [in] aInterfaceId + * The interface type of the object + * to be looked up. + * + * @param [in] aMatch + * The object name match pattern. Match pattern may contain + * question mark and asterisk characters ("?", "*") + * resepectively to match single or multiple + * characters. Object names are handled as folded + * in pattern matching. + */ + virtual void LookupByTypeAndName( + const MXIMPBase*& aObject, + TInt32 aInterfaceId, + const TDesC8& aMatch ) const = 0; + + + +public: // Set management + + + /** + * Adds new object to the set, and assignes zero length + * name for it. + * + * @param [in] aObject + * New object to add to set. Takes object + * ownership in success. + * + * @leave KErrNoMemory if failed to allocate memory. + * @leave KErrArgument if NULL argument were provided. + */ + virtual void AddObjectL( + MXIMPBase* aObject ) = 0; + + + + /** + * Adds new object to the set. Allows multiple + * instancies from object type. + * + * @param [in] aObject + * New object to add to set. Takes object + * ownership in success. NULL value not + * allowed. + * + * @param [in] aName + * Name for the added object. Zero length descriptor + * or valid Symbian OS object name. I.e. asterisk, + * question mark and single colon characters + * ("*", "?", ":") are not allowed in the name. + * + * @leave KErrNoMemory if failed to allocate memory. + * @leave KErrArgument if NULL argument were provided. + * @leave KErrBadName if object name does not conform required syntax. + */ + virtual void AddObjectWithNameL( + MXIMPBase* aObject, + const TDesC8& aName ) = 0; + + + + /** + * Gets the object having given interface type, + * and removes object from the set and returns object + * ownership to caller. Searching is done from the beginning, + * i.e. least recently used order. + * + * Searches objects having zero length name + * and return the oldest inserted object + * among of those. + * + * @param [out] aObject + * Object of given interface type or NULL if + * no object having given interface type is found. + * Object ownership is returned to caller. + * + * @param [in] aInterfaceId + * The interface type of the object + * to be looked up. + * + * @return ETrue, if an object was found. + */ + virtual TBool GetByType( + MXIMPBase*& aObject, + TInt32 aInterfaceId ) = 0; + + + /** + * Gets up the object having given interface type and + * matching name, and removes object from the set and + * returns object ownership to caller. Searching is done + * from the beginning, i.e. least recently used order. + * + * @param [out] aObject + * Object of given interface type or NULL if + * no object having given interface type is found. + * Object ownership is returned to caller. + * + * @param [in] aInterfaceId + * The interface type of the object + * to be looked up. + * + * @param [in] aMatch + * The object name match pattern. Match pattern may contain + * question mark and asterisk characters ("?", "*") + * resepectively to match single or multiple + * characters. Names are folded in pattern matching. + * + * @return ETrue, if an object was found. + */ + virtual TBool GetByTypeAndName( + MXIMPBase*& aObject, + TInt32 aInterfaceId, + const TDesC8& aMatch ) = 0; + + }; + + +#endif // MXIMPFWOBJECTCOLLECTION_H + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_data_model_api/inc/ximpobjectfactory.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_data_model_api/inc/ximpobjectfactory.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,127 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interface for XIMP Framework object factory. +* +*/ + +#ifndef MXIMPOBJECTFACTORY_H +#define MXIMPOBJECTFACTORY_H + +#include +#include +#include + + +class MXIMPStatus; +class MXIMPIdentity; +class MXIMPObjectCollection; +class MXIMPRestrictedObjectCollection; +class MXIMPDataSubscriptionState; + + +/** + * Interface for XIMP Framework object factory. + * + * XIMP object factory is used to instantiate + * data objects declared in Data Model API. + * + * MXimpFwObjectFactory interface can be obtained from + * MXIMPContext or MXIMPProtocolConnectionHost + * interfaces. + * + * @ingroup ximpdatamodelapi + * @since S60 v3.2 + */ +class MXIMPObjectFactory : public MXIMPBase + { +public: + + /** Interface ID for the MXimpFwObjectFactory. */ + enum { KInterfaceId = XIMP_IF_ID_OBJECT_FACTORY }; + + +protected: + + /** + * Protected destructor. + * Object instancies can't be deleted via this interface. + */ + virtual ~MXIMPObjectFactory() {} + + + +public: // Base object types + + + /** + * Instantiates new status object. + * + * @return New status object instance. + * Object ownership is returned to caller. + * + * @leave KErrNoMemory if failed to allocate memory. + */ + virtual MXIMPStatus* NewStatusLC() = 0; + + + /** + * Instantiates new identity object. + * + * @return New identity object instance. + * Object ownership is returned to caller. + * + * @leave KErrNoMemory if failed to allocate memory. + */ + virtual MXIMPIdentity* NewIdentityLC() = 0; + + + /** + * Instantiates new restricted object collection object. + * + * @return New restricted object collection instance. + * Object ownership is returned to caller. + * + * @leave KErrNoMemory if failed to allocate memory. + */ + virtual MXIMPRestrictedObjectCollection* NewRestrictedObjectCollectionLC() = 0; + + + /** + * Instantiates new object collection object. + * + * @return New object collection instance. + * Object ownership is returned to caller. + * + * @leave KErrNoMemory if failed to allocate memory. + */ + virtual MXIMPObjectCollection* NewObjectCollectionLC() = 0; + + + /** + * Instantiates new data subscription state object. + * + * @return New data subscription state instance. + * Object ownership is returned to caller. + * + * @leave KErrNoMemory if failed to allocate memory. + */ + virtual MXIMPDataSubscriptionState* NewDataSubscriptionStateLC() = 0; + + + }; + +#endif // MXIMPOBJECTFACTORY_H + + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_data_model_api/inc/ximpprotocolinfo.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_data_model_api/inc/ximpprotocolinfo.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,93 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interface for XIMP protocol info object. +* +*/ + +#ifndef MXIMPFWPROTOCOLINFO_H +#define MXIMPFWPROTOCOLINFO_H + +#include +#include +#include + + +class MXIMPFeatureInfo; + + +/** + * Interface for XIMP protocol info object. + * + * Holds information about the XIMP protocol + * implementation. + * + * @ingroup ximpdatamodelapi + * @since S60 v3.2 + */ +class MXIMPProtocolInfo : public MXIMPBase + { +public: + + /** Interface ID for the MXIMPProtocolInfo. */ + enum { KInterfaceId = XIMP_IF_ID_PROTOCOL_INFO }; + + +public: + + /** + * Public destructor. + * Objects can be deleted through this interface. + */ + virtual ~MXIMPProtocolInfo() {} + + +public: + + /** + * Returns human readable protocol display name. + * + * @return Protocol display name + */ + virtual const TDesC16& DisplayName() const = 0; + + + /** + * Returns protocol implementation UID. + * + * @return The protocol implementation UID. + */ + virtual TUid ImplementationUid() const = 0; + + + /** + * Retrieves XIMP Protocol features. + * + * Retrieves features supported by the XIMP Protocol. + * Note that XIMP Protocol may indicate here more + * features than what will be actually available + * in XIMP Context since since connected remote + * XIMP Service may limit available XIMP Context + * features. + * + * @return Features supported in XIMP Protocol. + * Exact feature IDs are defined in NXIMPFeature + * namespace. Object ownership is returned + * to caller. + */ + virtual MXIMPFeatureInfo* GetProtocolFeaturesLC() const = 0; + + }; + + +#endif // MXIMPFWPROTOCOLINFO_H diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_data_model_api/inc/ximprestrictedobjectcollection.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_data_model_api/inc/ximprestrictedobjectcollection.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,128 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interface for restricted object collection. +* +*/ + +#ifndef MXIMPFWRESTRICTEDOBJECTCOLLECTION_H +#define MXIMPFWRESTRICTEDOBJECTCOLLECTION_H + +#include +#include +#include + + + +/** + * Interface for restricted object collection. + * + * Object collection is a generic container, capable to + * contain MXIMPBase derived objects, implemented by the + * XIMP Framework. + * + * Restricted object collection forces each contained + * object instance to be distinct interface type. + * I.e. at time there can be just single object + * instance of certain MXIMPBase derived type + * at the collection. + * + * Object collection supports adding and getting objects, + * and looking up objects by their interface type. + * Object collection takes the ownership of added + * objects. + * + * @ingroup ximpdatamodelapi + * @since S60 v3.2 + */ +class MXIMPRestrictedObjectCollection : public MXIMPBase + { +public: + + /** Interface ID for the MXIMPRestrictedObjectCollection. */ + enum { KInterfaceId = XIMP_IF_ID_RESTRICTED_OBJECT_COLLECTION }; + + +public: + + /** + * Public destructor. + * Objects can be deleted through this interface. + */ + virtual ~MXIMPRestrictedObjectCollection() {} + + + +public: // Object lookup + + /** + * Looks up the object having given interface type. + * + * @param [out] aObject + * Object of given interface type or NULL if + * no object having given interface type is found. + * Object ownership is not returned to caller. + * + * @param [in] aInterfaceId + * The interface type of the object + * to be looked up. + */ + virtual void LookupByType( + const MXIMPBase*& aObject, + TInt32 aInterfaceId ) const = 0; + + + +public: // Object management + + + /** + * Adds new object to the set. If there exists already + * a object in the set with equal interface type, + * existing object is deleted and replaced with new one. + * + * @param [in] aObject + * New object to add to set. Takes object + * ownership in success. + * + * @leave KErrNoMemory if failed to allocate memory. + * @leave KErrArgument if NULL argument were provided. + */ + virtual void AddOrReplaceTypeL( + MXIMPBase* aObject ) = 0; + + + + /** + * Gets the object having given interface type, + * and removes object from the set and returns object + * ownership to caller. + * + * @param [out] aObject + * Object of given interface type or NULL if + * no object having given interface type is found. + * Object ownership is returned to caller. + * + * @param [in] aInterfaceId + * The interface type of the object + * to be looked up. + */ + virtual void GetByType( + MXIMPBase*& aObject, + TInt32 aInterfaceId ) = 0; + + }; + + +#endif // MXIMPFWRESTRICTEDOBJECTCOLLECTION_H + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_data_model_api/inc/ximpserviceinfo.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_data_model_api/inc/ximpserviceinfo.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,96 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interface for XIMP service info object. +* +*/ + +#ifndef MXIMPFWSERVICEINFO_H +#define MXIMPFWSERVICEINFO_H + +#include +#include +#include + +/** + * Interface for XIMP service info object. + * + * Holds data that identifies the XIMP service. + * + * @ingroup ximpdatamodelapi + * @since S60 v3.2 + */ +class MXIMPServiceInfo : public MXIMPBase + { +public: + + /** Interface ID for the MXIMPServiceInfo. */ + enum { KInterfaceId = XIMP_IF_ID_SERVICE_INFO }; + + +public: + + /** + * Public destructor. + * Objects can be deleted through this interface. + */ + virtual ~MXIMPServiceInfo() {} + + +public: + + /** + * Gets service address. + * + * @return The service address. + */ + virtual const TDesC16& ServiceAddress() const = 0; + + + /** + * Gets service user ID. + * + * @return The service user ID. + */ + virtual const TDesC16& UserId() const = 0; + + + /** + * Gets service user password. + * + * @return The service user password. + */ + virtual const TDesC16& Password() const = 0; + + + /** + * Gets Internet accesspoint ID. + * + * @return The Internet accesspoint ID. + */ + virtual TInt32 IapId() const = 0; + + + /** + * Gets protocol implementation UID. + * + * @return The protocol implementation UID. + */ + virtual TUid ProtocolImplUid() const = 0; + + }; + + +#endif // MXIMPFWSERVICEINFO_H + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_data_model_api/inc/ximpstatus.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_data_model_api/inc/ximpstatus.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,125 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interface for status object. +* +*/ + +#ifndef MXIMPFWSTATUS_H +#define MXIMPFWSTATUS_H + +#include +#include +#include + + +/** + * Interface for status object. + * + * Status object is used in XIMP Framework API + * to present result code and additional textual + * details from request completions, context + * state changes and similar events. + * + * @ingroup ximpdatamodelapi + * @since S60 v3.2 + */ +class MXIMPStatus : public MXIMPBase + { +public: + + /** Interface ID for the MXIMPStatus. */ + enum { KInterfaceId = XIMP_IF_ID_STATUS }; + + +public: + + /** + * Public destructor. + * Objects can be deleted through this interface. + */ + virtual ~MXIMPStatus() {} + + +public: + + /** + * Gets request completion code. + * + * Result code can be: + * - one of the system wide errors + * - one of the ximp core specific errors defined in in ximperrors.hrh + * - one of the presence specific errors defined in in presenceerrors.hrh + * - error specific to the underlying communication channel + * + * @return The result code. + */ + virtual TInt ResultCode() const = 0; + + + /** + * Gets the protocol level response code. + * + * + * @return Protocol level response code. + * KErrNone if no protocol level response code available. + */ + virtual TInt ProtocolResultCode() const = 0; + + + + /** + * Get the textual result description. + * Textual descriptions are protocol specific. + * + * @return The textual result description. + * Empty descriptor if no description available. + */ + virtual const TDesC16& ProtocolResultDescription() const = 0; + + + + /** + * Sets request completion code. + * + * @param [in] aCode + * The result code. + */ + virtual void SetResultCode( + TInt aCode ) = 0; + + + + /** + * Sets textual result description. + * + * @param [in] aCode + */ + virtual void SetProtocolResultCode( + TInt aCode ) = 0; + + + + /** + * Sets textual result description. + * + * @param [in] aDescription + * The textual result description. + */ + virtual void SetProtocolResultDescriptionL( + const TDesC16& aDescription ) = 0; + + }; + + +#endif // MXIMPFWSTATUS_H diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_data_model_api/ximp_core_data_model_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_data_model_api/ximp_core_data_model_api.metaxml Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,23 @@ + + + XIMP Core Data Model API + XIMP Framework Data Model API contains generic object containers, status objects and identity objects. API provides also abstract object factory interface to instantiate other objects. + c++ + ximpfw + + + + + + + + + + + + + + yes + no + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/group/bld.inf Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,57 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: File that exports the files belonging to +: XIMP core api +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +../inc/apidataobjfactoryaccessor.h MW_LAYER_PLATFORM_EXPORT_PATH(apidataobjfactoryaccessor.h) +../inc/apidataobjfactoryaccessor.inl MW_LAYER_PLATFORM_EXPORT_PATH(apidataobjfactoryaccessor.inl) +../inc/eventcodec.h MW_LAYER_PLATFORM_EXPORT_PATH(eventcodec.h) +../inc/ximpapidataobjbase.h MW_LAYER_PLATFORM_EXPORT_PATH(ximpapidataobjbase.h) +../inc/ximpapieventbase.h MW_LAYER_PLATFORM_EXPORT_PATH(ximpapieventbase.h) +../inc/ximpapiobjbase.h MW_LAYER_PLATFORM_EXPORT_PATH(ximpapiobjbase.h) +../inc/ximpcontextinternal.h MW_LAYER_PLATFORM_EXPORT_PATH(ximpcontextinternal.h) + +../inc/ximphost.h MW_LAYER_PLATFORM_EXPORT_PATH(ximphost.h) +../inc/ximphoststates.h MW_LAYER_PLATFORM_EXPORT_PATH(ximphoststates.h) + +// FIX ME : Need change +../inc/ximpidentityimp.h MW_LAYER_PLATFORM_EXPORT_PATH(ximpidentityimp.h) + +../inc/ximpobjecthelpers.h MW_LAYER_PLATFORM_EXPORT_PATH(ximpobjecthelpers.h) +../inc/ximpoperationbase.h MW_LAYER_PLATFORM_EXPORT_PATH(ximpoperationbase.h) +../inc/ximpoperationdefs.h MW_LAYER_PLATFORM_EXPORT_PATH(ximpoperationdefs.h) +../inc/ximpoperationfactory1.h MW_LAYER_PLATFORM_EXPORT_PATH(ximpoperationfactory1.h) +../inc/ximpoperationfactory1.inl MW_LAYER_PLATFORM_EXPORT_PATH(ximpoperationfactory1.inl) +../inc/ximppanics.h MW_LAYER_PLATFORM_EXPORT_PATH(ximppanics.h) +../inc/ximprbufhelpers.h MW_LAYER_PLATFORM_EXPORT_PATH(ximprbufhelpers.h) +../inc/ximprequestidbuilder.h MW_LAYER_PLATFORM_EXPORT_PATH(ximprequestidbuilder.h) +../inc/ximpsubscriptionitem.h MW_LAYER_PLATFORM_EXPORT_PATH(ximpsubscriptionitem.h) +../inc/ximpobjecthelpers.inl MW_LAYER_PLATFORM_EXPORT_PATH(ximpobjecthelpers.inl) +../inc/ximppsccontext.h MW_LAYER_PLATFORM_EXPORT_PATH(ximppsccontext.h) + +../inc/protocoldatahost.h MW_LAYER_PLATFORM_EXPORT_PATH(protocoldatahost.h) +../inc/protocoldatahost.inl MW_LAYER_PLATFORM_EXPORT_PATH(protocoldatahost.inl) +../inc/ximpitemparentbase.h MW_LAYER_PLATFORM_EXPORT_PATH(ximpitemparentbase.h) +../inc/ximpsubscriptionitembase.h MW_LAYER_PLATFORM_EXPORT_PATH(ximpsubscriptionitembase.h) +../inc/ximpfeaturepluginifids.hrh MW_LAYER_PLATFORM_EXPORT_PATH(ximpfeaturepluginifids.hrh) diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/inc/apidataobjfactoryaccessor.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/inc/apidataobjfactoryaccessor.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,85 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: IMplementation of MApiDataObjFactoryAccessor +* +*/ + + + +#ifndef M_APIDATAOBJFACTORYACCESSOR_H +#define M_APIDATAOBJFACTORYACCESSOR_H + +#include +#include + +class MEventCodec; +class MApiDataObjFactory; + + +/** + * ?one_line_short_description + * + * ?more_complete_description + * + * @lib ?library + * @since S60 v4.0 + */ +class MApiDataObjFactoryAccessor + { + +public: + + inline static MApiDataObjFactoryAccessor* NewPresenceAccessorL( ); + + inline static MApiDataObjFactoryAccessor* NewL( TUid aImplUid ); + + /** + * Returns the feature plugin specific event codec object + */ + virtual MEventCodec& EventCodec() = 0; + + /** + * Returns the feature plugin specific api object data factory object + */ + virtual MApiDataObjFactory& ApiDataObjFactory() = 0; + + /** + * dustructor + */ + inline virtual ~MApiDataObjFactoryAccessor(); + + /** + * To get the list of implementation who implements this interface + */ + inline static void ListAllImplementationsL(RImplInfoPtrArray& aImplInfoArray) ; + +protected: + + /** + * Default constructor to zero initialize + * the iEcomDtorID member. + */ + inline MApiDataObjFactoryAccessor(); + + + +private: // Data + + //OWN: ECom destructor ID + TUid iEcomDtorID; + }; + +#include "apidataobjfactoryaccessor.inl" +#endif // M_APIDATAOBJFACTORYACCESSOR_H + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/inc/apidataobjfactoryaccessor.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/inc/apidataobjfactoryaccessor.inl Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,77 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Internal Interface for event codec +* +*/ + +#include +#include + +// Factory interface for internal data structures +#define XIMP_ECOM_IMPL_UID_PRESENCE_DATAMODEL_INTERFACE 0x2000B197 + +// ----------------------------------------------------------------------------- +// MApiDataObjFactoryAccessor::NewPresenceAccessorL( ) implementation +// ----------------------------------------------------------------------------- +// +inline MApiDataObjFactoryAccessor* MApiDataObjFactoryAccessor::NewPresenceAccessorL( ) + { + return NewL(TUid::Uid( XIMP_ECOM_IMPL_UID_PRESENCE_DATAMODEL_INTERFACE )); + } + +// ----------------------------------------------------------------------------- +// MApiDataObjFactoryAccessor::NewL( ) implementation +// ----------------------------------------------------------------------------- +// +inline MApiDataObjFactoryAccessor* MApiDataObjFactoryAccessor::NewL( TUid aImplUid ) + { + + TAny* imp = REComSession::CreateImplementationL( aImplUid, + _FOFF( MApiDataObjFactoryAccessor, iEcomDtorID )); + + + return reinterpret_cast< MApiDataObjFactoryAccessor* >( imp ); + } + +// Added : to get list of implementations plugins, this should be common for presence, im datamodels +// ----------------------------------------------------------------------------- +// MApiDataObjFactoryAccessor::NewL( ) implementation +// ----------------------------------------------------------------------------- +// +inline void MApiDataObjFactoryAccessor::ListAllImplementationsL(RImplInfoPtrArray& aImplInfoArray) + { + REComSession::ListImplementationsL(TUid::Uid( XIMP_ECOM_IF_UID_PROTOCOL_DATAMODEL_CODEC_INTERFACE), aImplInfoArray); + } + +// ----------------------------------------------------------------------------- +// MApiDataObjFactoryAccessor::MApiDataObjFactoryAccessor() implementation +// ----------------------------------------------------------------------------- +// +inline MApiDataObjFactoryAccessor::MApiDataObjFactoryAccessor() + { + iEcomDtorID = TUid::Null(); + } + + +// ----------------------------------------------------------------------------- +// MApiDataObjFactoryAccessor::~MApiDataObjFactoryAccessor() +// Destructor notifies the ECom from implementation destruction. +// ----------------------------------------------------------------------------- +// +inline MApiDataObjFactoryAccessor::~MApiDataObjFactoryAccessor() + { + REComSession::DestroyedImplementation( iEcomDtorID ); + } + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/inc/eventcodec.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/inc/eventcodec.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,53 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Header for MEventCodec +* +*/ + + + +#ifndef M_EVENTCODEC_H +#define M_EVENTCODEC_H + +#include + +class CXIMPApiEventBase; + + +/** + * ?one_line_short_description + * + * ?more_complete_description + * + * @lib ?library + * @since S60 v4.0 + */ +class MEventCodec + { +public: + + virtual HBufC8* PackL( CXIMPApiEventBase& aEventObj, + TInt32& aTypeOfEvent ) = 0; + + virtual void PackL( CXIMPApiEventBase& aEventObj, + TInt32& aTypeOfEvent, + CBufFlat* aBuffer ) = 0; + + virtual CXIMPApiEventBase* UnPackL( const TDesC8& aEventData, + TInt32& aTypeOfEvent ) = 0; + + }; + +#endif // M_EVENTCODEC_H + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/inc/protocoldatahost.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/inc/protocoldatahost.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,104 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: interface for protocol hosts + * +*/ + +#ifndef MPROTOCOLDATAHOST_H +#define MPROTOCOLDATAHOST_H + +#include +#include +#include +#include + +class MXIMPHost; + +/** + * protocol host. + * + * @lib ximpprocessor.lib + * @since S60 v3.2 + */ +class MProtocolDataHost + + { +public: + + enum { KInterfaceId = XIMP_ECOM_IF_UID_PROTOCOL_DATA_HOST_INTERFACE }; + + +public: + + /** + * Factory method to instantiate MImFeatures. + * + * Factory method to instantiate platform default + * MXIMPClient implementation through the ECom. + * If the default Feature isn't supported + * in the platform, leaves with errorcode signalled + * from ECom. + * + * @return The new protocol client object. Object + * ownership is returned to caller. + */ + static inline MProtocolDataHost* NewL( MXIMPHost& aHost ); + + static inline MProtocolDataHost* NewL(TUid aImpid, MXIMPHost& aHost ); + + /** + * Public destructor. + * Objects can be deleted through this interface. + */ + virtual inline ~MProtocolDataHost(); + + /** + * To get list of all plugins which implements this interface + */ + inline static void ListAllImplementationsL(RImplInfoPtrArray& aImplInfoArray) ; + + /** + * This allows hosts to set themselves to protocol plugins + */ + virtual void SetHostToProtocol() = 0 ; + + /** + * To get the host object pointer of this interface id + */ + virtual TAny* GetInterface(TInt aInterfaceId) = 0; + + /** + * Hosts can return the clean up id, to create cleanup operation + */ + virtual TInt GetCleanupOperation() = 0; + +protected: + + /** + * Default constructor to zero initialize + * the iEcomDtorID member. + */ + inline MProtocolDataHost(); + +private: // Data + + //OWN: ECom destructor ID + TUid iEcomDtorID; + }; + +#include + + +#endif // MPROTOCOLDATAHOST_H + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/inc/protocoldatahost.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/inc/protocoldatahost.inl Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,81 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: protocol data host interface used by XIMP clients. +* +*/ + +#include + + +// ----------------------------------------------------------------------------- +// MProtocolDataHost::NewL( MXIMPHost& aHost) implementation +// Factory method to instantiate the platform default +// MProtocolDataHost implementation through the ECom framework. +// ----------------------------------------------------------------------------- +// +inline MProtocolDataHost* MProtocolDataHost::NewL(MXIMPHost& aHost ) + { + _LIT8( KIMDefaultData, "" ); + + TEComResolverParams resolvingParams; + resolvingParams.SetDataType( KIMDefaultData ); + resolvingParams.SetWildcardMatch( ETrue ); + TAny* imp = REComSession::CreateImplementationL( TUid::Uid( MProtocolDataHost::KInterfaceId), + _FOFF( MProtocolDataHost, iEcomDtorID ), + &aHost, resolvingParams ); + return reinterpret_cast< MProtocolDataHost* >( imp ); + } + + +inline MProtocolDataHost* MProtocolDataHost::NewL( TUid aImplUid , MXIMPHost& aHost) + { + TAny* imp = REComSession::CreateImplementationL( aImplUid, + _FOFF( MProtocolDataHost, iEcomDtorID ),&aHost); + + + return reinterpret_cast< MProtocolDataHost* >( imp ); + } + + +// ----------------------------------------------------------------------------- +// MProtocolDataHost::MProtocolDataHost() implementation +// Zero initializes the iEcomDtorID member. +// ----------------------------------------------------------------------------- +// +inline MProtocolDataHost::MProtocolDataHost() + { + iEcomDtorID = TUid::Null(); + } + + +// ----------------------------------------------------------------------------- +// MProtocolDataHost::~MProtocolDataHost() +// Destructor notifies the ECom from implementation destruction. +// ----------------------------------------------------------------------------- +// +inline MProtocolDataHost::~MProtocolDataHost() + { + REComSession::DestroyedImplementation( iEcomDtorID ); + } + +// ----------------------------------------------------------------------------- +// MProtocolDataHost::ListAllImplementationsL() +// To get list of implementation plugins, who implements this interface +// ----------------------------------------------------------------------------- +// +inline void MProtocolDataHost::ListAllImplementationsL(RImplInfoPtrArray& aImplInfoArray) + { + REComSession::ListImplementationsL(TUid::Uid(MProtocolDataHost::KInterfaceId), aImplInfoArray); + } + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/inc/ximpapidataobjbase.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/inc/ximpapidataobjbase.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,96 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: API data object base implementation. +* +*/ + +#ifndef CXIMPAPIDATAOBJBASE_H +#define CXIMPAPIDATAOBJBASE_H + +#include "ximpapiobjbase.h" + +class RWriteStream; +class RReadStream; + + +/** + * API event object base. + * + * Concrete event types must implement static + * NewFromStreamLC() constructor and event types + * must be registered to event automation system. + * + * For details, see XIMPEventCodec implementation. + * @lib ximpdatamodel.dll + * @since S60 v3.2 + */ +class CXIMPApiDataObjBase : public CXIMPApiObjBase + { +public: + + enum { KClassId = XIMPIMP_CLSID_CXIMPAPIDATAOBJBASE }; + +public: + + IMPORT_C CXIMPApiDataObjBase(); + + IMPORT_C virtual ~CXIMPApiDataObjBase(); + +public: + + /** + * Compare the content of this data object with another + * data object of the same type. + * Volatile things (e.g. timestamps) are not compared, but things like user + * ids and such are. + * @return ETrue if the content matches. + */ + virtual TBool EqualsContent( const CXIMPApiDataObjBase& aOtherInstance ) const = 0; + + /** + * Virtual extenalize method for concrete data + * objects to externalize their data. + */ + virtual void ExternalizeL( RWriteStream& aStream ) const = 0; + }; + + + +/** + * Declares CXIMPApiDataObjBase methods for + * concrete event implementation class header (.h) file. + */ +#define XIMPIMP_DECLARE_DATAOBJ_BASE_METHODS \ + void ExternalizeL( RWriteStream& aStream ) const; \ + IMPORT_C static CXIMPApiDataObjBase* NewFromStreamLC( RReadStream& aStream ); \ + virtual TBool EqualsContent( const CXIMPApiDataObjBase& aOtherInstance ) const; \ + +#define XIMPIMP_DECLARE_DATAOBJ_BASE_PRIV_METHODS \ + // void ConstructL( RReadStream& aStream ); \ + + +/** + * Implements a NewFromStreamLC method + */ +#define XIMPIMP_IMPLEMENT_DATAOBJ_NEWFROMSTREAM( TheClass ) \ +EXPORT_C CXIMPApiDataObjBase* TheClass::NewFromStreamLC( RReadStream& aStream ) \ + { \ + TheClass* self = new( ELeave ) TheClass; \ + CleanupStack::PushL( self ); \ + self->ConstructL(); \ + self->InternalizeL( aStream ); \ + return self; \ + } \ + +#endif // CXIMPAPIDATAOBJBASE_H diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/inc/ximpapieventbase.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/inc/ximpapieventbase.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,91 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: API event object base implementation. +* +*/ + +#ifndef CXIMPAPIEVENTBASE_H +#define CXIMPAPIEVENTBASE_H + +#include "ximpapiobjbase.h" + +class RWriteStream; +class RReadStream; + + +/** + * API event object base. + * + * Concrete event types must implement static + * NewFromStreamLC() constructor and event types + * must be registered to event automation system. + * + * For details, see XIMPEventCodec implementation. + * @lib ximpdatamodel.dll + * @since S60 v3.2 + */ +class CXIMPApiEventBase: public CXIMPApiObjBase + { +public: + + enum { KClassId = XIMPIMP_CLSID_CXIMPAPIEVENTBASE }; + +public: + IMPORT_C CXIMPApiEventBase(); + +public: + IMPORT_C virtual ~CXIMPApiEventBase(); + +public: + + /** + * Compare the content of this event with another event of the same type. + * Volatile things (e.g. timestamps) are not compared, but things like user + * ids and such are. + * @return ETrue if the content matches. + */ + virtual TBool EqualsContent( const CXIMPApiEventBase& aOtherInstance ) const = 0; + + + /** + * Virtual extenalize method for concrete event + * objects to externalize their data. + */ + virtual void ExternalizeL( RWriteStream& aStream ) const = 0; + }; + + + +/** + * Declares MXIMPEventBase and CXIMPApiEventBase methods for + * concrete event implementation class header (.h) file. + */ +#define XIMPIMP_DECLARE_EVENT_BASE_METHODS \ + TInt32 EventInterfaceId() const; \ + void ExternalizeL( RWriteStream& aStream ) const; \ + TBool EqualsContent( const CXIMPApiEventBase& aOtherInstance ) const; \ + + +/** + * Implements EventInterfaceId() for MXIMPEventBase-derived + * implementation class (.cpp) file. + */ +#define XIMPIMP_IMPLEMENT_EVENT_BASE_METHODS( TheClass, TheImplementedIf ) \ + TInt32 TheClass::EventInterfaceId() const \ + { \ + return TheImplementedIf::KInterfaceId; \ + } \ + + +#endif // CXIMPREQUESTCOMPLETEEVENTIMP_H diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/inc/ximpapiobjbase.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/inc/ximpapiobjbase.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,422 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Base class for XIMP API implementations. +* +*/ + +#ifndef XIMPAPIOBJBASE_H +#define XIMPAPIOBJBASE_H + +#include +#include + + + +/** + * XIMP Framework class implementation UIDs. + * + * These do not have to be "real" Symbian UIDs, but such ID's, + * that they do not overlap with XIMP API interface IDs. + */ + +// 90xx - ximp related +// 91xx - presence related +// 92xx - instant messaging related + +//Data model classes +#define XIMPIMP_CLSID_CXIMPAPIDATAOBJBASE 9000 +#define XIMPIMP_CLSID_CXIMPAPIOBJBASE 9001 +#define XIMPIMP_CLSID_CXIMPFEATUREINFOIMP 9001 +#define XIMPIMP_CLSID_CXIMPIDENTITYIMP 9003 +#define XIMPIMP_CLSID_CXIMPPROTOCOLINFOIMP 9004 +#define XIMPIMP_CLSID_CXIMPSERVICEINFOIMP 9005 +#define XIMPIMP_CLSID_CXIMPSTATUSIMP 9006 +#define XIMPIMP_CLSID_CXIMPOBJECTFACTORYIMP 9007 +#define XIMPIMP_CLSID_CXIMPAPIEVENTBASE 9008 +#define XIMPIMP_CLSID_CXIMPRESTRICTEDOBJECTCOLLECTIONIMP 9009 +#define XIMPIMP_CLSID_CXIMPOBJECTCOLLECTIONIMP 9010 +#define XIMPIMP_CLSID_CXIMPCONTEXTCLIENTINFOIMP 9011 +#define XIMPIMP_CLSID_CXIMPCONTEXTSTATEIMP 9012 +#define XIMPIMP_CLSID_CXIMPDATASUBSCRIPTIONSTATEIMP 9013 + +// Plugin host environment classes +#define XIMPIMP_CLSID_CXIMPPSCHOST 9020 +#define XIMPIMP_CLSID_CXIMPPSCHOSTMANAGER 9021 + +// Management +#define XIMPIMP_CLSID_CXIMPCLIENTIMP 9030 +#define XIMPIMP_CLSID_CXIMPCONTEXTIMP 9031 + +// Events +#define XIMPIMP_CLSID_CXIMPPROTOCOLREQUESTCOMPLETEEVENTIMP 9040 +#define XIMPIMP_CLSID_CXIMPREQUESTCOMPLETEEVENTIMP 9041 +#define XIMPIMP_CLSID_CXIMPCONTEXTSTATEEVENTIMP 9042 + + +/** + * Declares a GetInterface() and similar methods for + * MXIMPBase and CXIMPApiObjBase derived implementation. + * + * To be used in class header (.h) file. + */ +#define XIMPIMP_DECLARE_IF_BASE_METHODS \ + MXIMPBase& Base(); \ + TAny* GetInterface( TInt32 aInterfaceId, TIfGetOps aOps ); \ + TInt32 GetInterfaceId() const; \ + const TAny* GetInterface( TInt32 aInterfaceId, TIfGetOps aOps ) const; \ + const MXIMPBase& Base() const; \ + + +/** + * Starts a non-const GetInterface() method + * block for CXIMPApiObjBase-derived implementation. + * + * To be used in class implementation (.cpp) file. + */ +#define XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( TheClass, TheImplementedIf ) \ + MXIMPBase& TheClass::Base() \ + { \ + return *this; \ + } \ + TAny* TheClass::GetInterface( TInt32 aInterfaceId, TIfGetOps aOps ) \ + { \ + if( aInterfaceId == CXIMPApiObjBase::KClassId ) \ + { \ + CXIMPApiObjBase* classPtr = this; \ + return classPtr; \ + } \ + if( aInterfaceId == TheClass::KClassId ) \ + { \ + TheClass* classPtr = this; \ + return classPtr; \ + } \ + if( aInterfaceId == TheImplementedIf::KInterfaceId ) \ + { \ + TheImplementedIf* ifPtr = this; \ + return ifPtr; \ + } \ + + +/** + * Non-const interface return statement for GetInterface() block. + * + * To be used in class implementation (.cpp) file. + */ +#define XIMPIMP_IF_BASE_GET_INTERFACE( AdditionalIf, FromPtr ) \ + if( aInterfaceId == AdditionalIf::KInterfaceId )\ + { \ + AdditionalIf* ifPtr = FromPtr; \ + return ifPtr; \ + } \ + + +/** + * Non-const class return statement for GetInterface() block. + * + * To be used in class implementation (.cpp) file. + */ +#define XIMPIMP_IF_BASE_GET_CLASS( AdditionalClass, FromPtr ) \ + if( aInterfaceId == AdditionalClass::KClassId )\ + { \ + AdditionalClass* classPtr = FromPtr; \ + return classPtr; \ + } \ + + +/** + * Starts a const GetInterface() method + * block for CXIMPApiObjBase-derived implementation. + * + * To be used in class implementation (.cpp) file. + */ +#define XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( TheClass, TheImplementedIf ) \ + TInt32 TheClass::GetInterfaceId() const \ + { \ + return TheImplementedIf::KInterfaceId; \ + } \ + const MXIMPBase& TheClass::Base() const \ + { \ + return *this; \ + } \ + const TAny* TheClass::GetInterface( TInt32 aInterfaceId, TIfGetOps aOps ) const \ + { \ + if( aInterfaceId == CXIMPApiObjBase::KClassId ) \ + { \ + const CXIMPApiObjBase* classPtr = this; \ + return classPtr; \ + } \ + if( aInterfaceId == TheClass::KClassId ) \ + { \ + const TheClass* classPtr = this; \ + return classPtr; \ + } \ + if( aInterfaceId == TheImplementedIf::KInterfaceId ) \ + { \ + const TheImplementedIf* ifPtr = this; \ + return ifPtr; \ + } \ + + +/** + * Const interface return statement for GetInterface() block. + * + * To be used in class implementation (.cpp) file. + */ +#define XIMPIMP_IF_BASE_GET_CONST_INTERFACE( AdditionalIf, FromPtr ) \ + if( aInterfaceId == AdditionalIf::KInterfaceId )\ + { \ + const AdditionalIf* ifPtr = FromPtr; \ + return ifPtr; \ + } \ + + +/** + * Const class return statement for GetInterface() block. + * + * To be used in class implementation (.cpp) file. + */ +#define XIMPIMP_IF_BASE_GET_CONST_CLASS( AdditionalClass, FromPtr ) \ + if( aInterfaceId == AdditionalClass::KClassId )\ + { \ + const AdditionalClass* classPtr = FromPtr; \ + return classPtr; \ + } \ + + + +/** + * Shared definition to end the + * - XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN and + * - XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN + * statements. + * + * To be used in class implementation (.cpp) file. + */ +#define XIMPIMP_IF_BASE_GET_INTERFACE_END()\ + return CXIMPApiObjBase::HandleUnknownGetInterface( aInterfaceId, aOps ); \ + } \ + + + +/** + * Macro for XIMP implementation to suppress warnings + * from unused formal parameters. + */ +#define XIMP_UNUSED_FORMAL_PARAM(p) (void) p + + + +/** + * Macro to implement the default statement + * from switch-case structure with panic call. + * + * If injected code is compiled under BullseyeCoverage, + * uses BullseyeCoverage specific guards, + * to exclude injected code from coverage + * calcualtion. + */ +#if _BullseyeCoverage + +#define XIMP_DEFAULT_CASE_UNSUPPORTED( aPanicReason ) \ + "BullseyeCoverage save off"; \ + default: \ + { \ + NXIMPPrivPanic::Panic( aPanicReason ); \ + break; \ + } \ + "BullseyeCoverage restore"; \ + +#else + +#define XIMP_DEFAULT_CASE_UNSUPPORTED( aPanicReason ) \ + default: \ + { \ + NXIMPPrivPanic::Panic( aPanicReason ); \ + break; \ + } \ + +#endif //_BullseyeCoverage + + +/** + * Base class for all XIMP API implementations. + * + * @lib ximpdatamodel.dll + * @since S60 v3.2 + */ +class CXIMPApiObjBase : public CBase + { +public: + + enum { KClassId = XIMPIMP_CLSID_CXIMPAPIOBJBASE }; + +protected: + + /** + * All XIMP Framework concrete API object + * implementations are derived from this class. + */ + IMPORT_C CXIMPApiObjBase(); + + +public: + + /** + * Virtual destructor CXIMPApiObjBase(). + */ + IMPORT_C virtual ~CXIMPApiObjBase(); + + + + +protected: //Protected handlers for derived classes + + /** + * Handler for unknown interface access cases. + * + * All XIMP Framework API object implementations + * should call this to handle access request for + * unknown interface type. + * + * @param aInterfaceId + * Interface identifier identifying the interface + * which was tried to retrieve. + * + * @param aOps + * Options for interface retrieval from client. + * + * @return NULL. + */ + IMPORT_C TAny* HandleUnknownGetInterface( + TInt32 aInterfaceId, + MXIMPBase::TIfGetOps aOps ) const; + + +public: + + /** + * Access to base virtual interface. + * + * @return XIMP base virtual interface. + */ + virtual MXIMPBase& Base() = 0; + + + /** + * Read-only access to base virtual interface. + * + * @return XIMP base virtual interface. + */ + virtual const MXIMPBase& Base() const = 0; + + }; + + + +/** + * Templated + * + * + * @since S60 v3.2 + */ +template< class Type > +class TXIMPGetImpClassOrPanic + { + +public: + /** + * + */ + static inline Type* From( MXIMPBase& aObj ) + { + TAny* ifPtr = aObj.GetInterface( Type::KClassId, MXIMPBase::EPanicIfUnknown ); + Type* ifTypePtr = static_cast< Type* >( ifPtr ); + return ifTypePtr; + } + + static inline Type* From( const MXIMPBase& aObj ) + { + const TAny* ifPtr = aObj.GetInterface( Type::KClassId, MXIMPBase::EPanicIfUnknown ); + const Type* ifTypePtr = static_cast< const Type* >( ifPtr ); + return ifTypePtr; + } + +private: //Prohibited constructor + TXIMPGetImpClassOrPanic(); + }; + + +/** + * Templated + * + * + * @since S60 v3.2 + */ +template< class Type > +class TXIMPGetImpClassOrNull + { + +public: + /** + * + */ + static inline Type* From( MXIMPBase& aObj ) + { + TAny* ifPtr = aObj.GetInterface( Type::KClassId, MXIMPBase::EReturnNullIfUnknown ); + Type* ifTypePtr = static_cast< Type* >( ifPtr ); + return ifTypePtr; + } + + static inline Type* From( const MXIMPBase& aObj ) + { + const TAny* ifPtr = aObj.GetInterface( Type::KClassId, MXIMPBase::EReturnNullIfUnknown ); + const Type* ifTypePtr = static_cast< const Type* >( ifPtr ); + return ifTypePtr; + } + +private: //Prohibited constructor + TXIMPGetImpClassOrNull(); + }; + + + +template< class Type > +class TXIMPEqualsContent + { + public: + /** + * Call equalcontent for all items in array + */ + static inline TBool Array( const RPointerArray< Type >& aObjArray, + const RPointerArray< Type >& aOtherObjArray ) + { + TInt count = aObjArray.Count(); + if( count != aOtherObjArray.Count() ) + { + return EFalse; + } + for( TInt a = 0; a < count; ++a ) + { + if( !aObjArray[ a ]->EqualsContent( *aOtherObjArray[ a ] ) ) + { + return EFalse; + } + } + return ETrue; + } + private: //Prohibited constructor + TXIMPEqualsContent(); + }; + +#endif // XIMPAPIOBJBASE_H diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/inc/ximpcontextinternal.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/inc/ximpcontextinternal.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,63 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interface for presence context. +* +*/ + +#ifndef MXIMPCONTEXTINTERNAL_H +#define MXIMPCONTEXTINTERNAL_H + +#include +//#include +#include + +/** + * Internal interface for presence context. + * This interface is implemented by the XIMP Framework. + * + * @ingroup ximpmanagementapi + * @since S60 v3.2 + */ +class MXIMPContextInternal + { +public: + + /** Interface ID for the MXIMPContext. */ + enum { KInterfaceId = XIMP_IF_ID_CONTEXT_INTERNAL }; + +public: + + /** + * Public destructor. + * Objects can be deleted through this interface. + */ + virtual ~MXIMPContextInternal() {} + + /** + * Issues context operation request to server. + * + * @param aOperationType In parameter identifying the operation. + * @param aOperationParams In parameter package for operation. + * @return Request ID identifying started request. + */ + virtual TXIMPRequestId QueueOperationL( TInt aOperationType, + const TDesC8& aOperationParams ) = 0; + + }; + + +#endif // MXIMPCONTEXTINTERNAL_H + + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/inc/ximpfeaturepluginifids.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/inc/ximpfeaturepluginifids.hrh Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,31 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: feature plugin if ids +* +*/ + +#ifndef XIMPFEATUREPLUGINIFIDS_HRH +#define XIMPFEATUREPLUGINIFIDS_HRH + +// datmodel +#define XIMP_ECOM_IF_UID_PROTOCOL_DATAMODEL_CODEC_INTERFACE 0x2000B5E9 + +// operations +#define XIMP_ECOM_IF_UID_OPERATIONS_INTERFACE 0x20015A0D + +//processor +#define XIMP_ECOM_IF_UID_PROTOCOL_DATA_HOST_INTERFACE 0x20015A0E + +#endif //XIMPFEATUREPLUGINIFIDS_HRH + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/inc/ximphost.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/inc/ximphost.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,185 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Header for MXIMPHost +* +*/ + + + +#ifndef M_PSCHOST_H +#define M_PSCHOST_H + +#include + +#include "ximphoststates.h" +#include "ximpoperationdefs.h" + +class MXIMPProtocolConnection; +class CXIMPApiEventBase; +class MXIMPPscContext; +class CXIMPPscContext; +class CXIMPServiceInfoImp; +class CPresenceDataCache; +class CXIMPOperationBase; +class CXIMPRestrictedObjectCollectionImp; +class CProtocolPresenceAuthorizationDataHostImp; +class CProtocolPresencePublishingDataHostImp; +class CProtocolPresenceWatchingDataHostImp; +class CProtocolPresentityGroupsDataHostImp; +class CProtocolPresenceDataHostImp; +class MProtocolDataHost; + +/** + * ?one_line_short_description + * + * ?more_complete_description + * + * @lib ?library + * @since S60 v4.0 + */ +class MXIMPHost + { +public: + + /** + * Mark a reference to this object. + */ + virtual void Open() = 0; + + /** + * Remove a reference to this object. + * Once all references are removed, the class destroys itself. + */ + virtual void Close() = 0; + + /** + * @return The currently used connection, Can be NULL if protocol not in use. + */ + virtual MXIMPProtocolConnection& GetConnection() const = 0; + + /** + * Add the given event to the event manager. The event will + * go to the given session. + * @param aEvent The event + * @param aContext The session context. If NULL -> send to all contexts. + */ + virtual void AddEventL( CXIMPApiEventBase& aEvent, MXIMPPscContext* aContext = NULL ) = 0; + + /** + * Add preserved event to the event manager. The event will + * go to the given session. + * @param aEvent The event + * @param aContext The session context + */ + virtual void ActivateEventL( CXIMPApiEventBase& aEvent, MXIMPPscContext* aContext ) = 0; + + /** + * Unregister session when not needed anymore. + * @param aContext Unregistered context. + */ + virtual void UnregisterSession( CXIMPPscContext* aContext ) = 0; + + /** + * Fake a request complete event to + * currently run operation. + * @param aResult The result + */ + virtual void FakeCompleteRequest( TXIMPRequestId aReqId, TInt aResult ) = 0; + + /** + * Request complete for adaptation operation + * @param aResult The result + */ + virtual void HandleAdaptationRequestCompleted( TXIMPRequestId aReqId, TInt aResult ) = 0; + + /** + * Request complete for adaptation operation, related + * to session management + * @param aResult The result + */ + virtual void HandleSessionMgmtRequestCompleted( TXIMPRequestId aReqId, TInt aResult ) = 0; + + /** + * Request complete for internal operation + * @param aResult The result + */ + virtual void HandleInternalRequestCompleted( TXIMPRequestId aReqId, TInt aResult ) = 0; + + /** + * Access to data cache. + */ + virtual CProtocolPresenceDataHostImp& PresenceDataAccess() = 0; + + /** + * to get corresponding protocol host from the array of hosts. + * @param aInterfaceId host object interface id + */ + virtual TAny* GetProtocolHost(TInt aInterfaceId) = 0 ; + +/* virtual CPresenceDataCache& DataAccess() = 0; + virtual CProtocolPresenceAuthorizationDataHostImp& AuthorizationDataAccess() = 0; + virtual CProtocolPresencePublishingDataHostImp& PublishingDataAccess() = 0; + virtual CProtocolPresenceWatchingDataHostImp& WatchingDataAccess() = 0; + virtual CProtocolPresentityGroupsDataHostImp& GroupsDataAccess() = 0; +*/ + + + /** + * Add new operation to the internal queue of operations. Ownership is transferred. + * @param aOperation The operation to add. + */ + virtual void AddNewOperationL( CXIMPOperationBase& aOperation ) = 0; + + /** + * Add new operation for processing. + */ + virtual TXIMPRequestId AddNewOperationL( CXIMPOperationBase* aOperation ) = 0; + + /** + * Do forced teardown by activating all valid cached unbinds. + */ + virtual void ForcedTeardownL() = 0; + + /** + * Start cleaner timer if not started already. + */ + virtual void StartCleanerTimer() = 0; + + /** + * Create operation and add it to process queue. + */ + virtual TXIMPRequestId AddNewOperationL( + TInt aOperation, MXIMPBase* aParam, MXIMPBase* aParam2 = NULL ) = 0; + + + /** + * Return the protocol ID of the host + */ + + virtual TInt32 ProtocolUID( ) = 0; + +protected: + + /** + * Protected destructor. + * Instancies can't be destroyed via this interface. + */ + virtual ~MXIMPHost() {}; + + }; + + +#endif // M_PSCHOST_H + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/inc/ximphoststates.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/inc/ximphoststates.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,79 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: States for PSC Host FSM + * +*/ + +#ifndef PSCHOSTSTATES_H +#define PSCHOSTSTATES_H + +#include + +/** + * PSC host states. + * Used as states for the finite state machine inside the host. + */ +namespace NXIMPHost + { + /** + * States for the host (internal FSA) + */ + enum THostStates + { + // actual states + EXIMPNotConnected = 0, // not connected + EXIMPConnecting, // connecting attempt ongoing + EXIMPConnected, // connected + EXIMPReconnecting, // attempting connection after nw suspend + EXIMPSuspended, // nw down + EXIMPDisconnecting, // disconnecting + + // helper states + EXIMPHelperReconnectFailed // reconnecting failed + }; + + /** + * Operation status, needed by host FSA state changes. + * Called by operations. Used to update internal state + * of host to determine whether network connection is up, down, + * inactive or network suspended. See PSC Host-Plugin FSA in design + * document. + */ + enum THostOperationState + { + EXIMPOpNone, // generic empty state + EXIMPOpBindBegin, // bind is beginning + EXIMPOpBindEnd, // bind has ended + EXIMPOpShareBegin, // share is beginning + EXIMPOpShareEnd, // share has ended + EXIMPOpUnshareBegin, // unshare is beginning + EXIMPOpUnshareEnd, // unshare has ended + EXIMPOpReconnectBegin, // reconnect is beginning + EXIMPOpReconnectEnd, // reconnect has ended + EXIMPOpUnbindBegin, // unbind is beginning + EXIMPOpUnbindEnd, // unbind has ended + + EXIMPOpSessionLostBegin, // session lost handling is beginning + EXIMPOpSessionLostEnd, // session lost handling has ended + EXIMPOpForcedTeardownBegin, // forced teardown is beginning + EXIMPOpForcedTeardownEnd, // forced teardown has ended + }; + } + +#endif // PSCHOSTSTATES_H + + + + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/inc/ximpidentityimp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/inc/ximpidentityimp.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,126 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MXIMPIdentity API object implementation. +* +*/ + +#ifndef CXIMPIDENTITYIMP_H +#define CXIMPIDENTITYIMP_H + +#include "ximpapidataobjbase.h" +//#include "presenceinfoimp.h" +#include "ximpidentity.h" +#include //needed? + + +/** + * MXIMPIdentity API object implementation. + * + * @lib ximpdatamodel.dll + * @since S60 v3.2 + */ +NONSHARABLE_CLASS( CXIMPIdentityImp ): public CXIMPApiDataObjBase, + public MXIMPIdentity + { +public: + /** The class ID. */ + enum { KClassId = XIMPIMP_CLSID_CXIMPIDENTITYIMP }; + +public: + + IMPORT_C static CXIMPIdentityImp* NewLC(); + IMPORT_C static CXIMPIdentityImp* NewL(); + IMPORT_C static CXIMPIdentityImp* NewLC( const TDesC16& aIdentity ); + virtual ~CXIMPIdentityImp(); + +private: + + CXIMPIdentityImp(); + void ConstructL(); + void ConstructL( const TDesC16& aIdentity ); + + /** + * @see CXIMPApiDataObjBase + */ + XIMPIMP_DECLARE_DATAOBJ_BASE_PRIV_METHODS + +public: // From MXIMPBase + + /** + * Implementation of MXIMPBase interface methods + * @see MXIMPBase + */ + XIMPIMP_DECLARE_IF_BASE_METHODS + + /** + * @see CXIMPApiDataObjBase + */ + XIMPIMP_DECLARE_DATAOBJ_BASE_METHODS + +public: // From MXIMPIdentity + + /** + * Implementation of MXIMPIdentity interface methods + * @see MXIMPIdentity + */ + /*const TDesC8& PresentityUri() const; + const TDesC16& DisplayName() const; + const TDesC16& ProtocolAddress() const; + MPresenceInfo& PresenceInfo();*/ + + void SetIdentityL( const TDesC16& aIdentity ); + const TDesC16& Identity() const; + +public: // New functions + + /** + * Extenalizes object data to given stream. + * @param aStream Stream to write. + */ + /* IMPORT_C void ExternalizeL( RWriteStream& aStream ) const; */ + + + /** + * Internalizes object data from given stream. + * @param aStream Stream to read. + */ + IMPORT_C void InternalizeL( RReadStream& aStream ); + + /** + * Compare identities. + * @param aOther Compared identity + * @return ETrue if identities are different. EFalse if same. + */ + IMPORT_C TBool operator!=( const CXIMPIdentityImp& aOther ) const; + + /** + * Compare identities. + * @param aOther Compared identity + * @return -1 if aOther is greater than this + * 0 if they are same + * 1 if this if greater than other. + */ + IMPORT_C TInt Compare( const CXIMPIdentityImp& aOther ) const; + +private: // data + + /** + * + */ + RBuf16 iIdentity; + + }; + + +#endif // CXIMPIDENTITYIMP_H diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/inc/ximpitemparentbase.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/inc/ximpitemparentbase.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,51 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Item parent interface. +* +*/ + +#ifndef CXIMPITEMPARENTBASE_H +#define CXIMPITEMPARENTBASE_H + +class CXIMPSubscriptionItemBase; + +class MXIMPItemParentBase + { + public: + /** + * Register item for expiration purposes. + */ + virtual void RegisterExpiringItemL( CXIMPSubscriptionItemBase* aExpireItem ) = 0; + + /** + * Unregister item from expiration purposes. + */ + virtual void UnregisterExpiringItem( CXIMPSubscriptionItemBase* aExpireItem ) = 0; + + /** + * Get requested object + */ + virtual TAny* GetInterface(TInt aInterfaceId) = 0; + +protected: // Destruction + + /** + * Object cannot be delted through this interface + */ + virtual ~MXIMPItemParentBase(){} + + }; + + +#endif //CXIMPITEMPARENTBASE_H diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/inc/ximpobjecthelpers.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/inc/ximpobjecthelpers.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,236 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Templated algorithms to simplify object handling +* +*/ + +#ifndef XIMPOBJECTHELPERS_H +#define XIMPOBJECTHELPERS_H + +#include + + +class MXIMPObjectCollection; +const TInt KObjectBufGranurality = 100; + + +/** + * Templated object mover to move + * objects from pointer array to another. + * + * @since S60 v3.2 + */ +template< class T1, class T2 > +class TXIMPObjectMover + { + +public: + /** + * Templated object move method. + * + * Moves objects from one RPointerArray to another. + * Object types in the arrays can be different as long as + * source type is castable to target type. + * + * @param aSource Source array from to move. + * @param aTarget Target array to move. + */ + static inline void MoveFromPtrArrayToL( RPointerArray< T1 >& aSource, + RPointerArray< T2 >& aTarget ); + + /** + * Templated object move method. + * + * Moves objects from object collection to array. + * Object types in object collection + * hast to be castable to target type. + * + * @param aSource Source object collection from to move. + * @param aTarget Target array to move. + */ + static inline void MoveFromCollectionToArrayL( MXIMPObjectCollection& aSource, + RPointerArray< T2 >& aTarget, + TLinearOrder< T2 >& aOrder ); + +private: //Prohibited constructor + TXIMPObjectMover(); + }; + +/** + * Templated object cloner. + * + * Object type must support: NewLC(), + * ExternalizeL() and InternalizeL(). + * + * @since S60 v3.2 + */ +template< class T > +class TXIMPObjectCloner + { + public: + + /** + * Templated object clone method. + * + * Instantiates a new object and copies data from + * given source object with externalize / internalize + * to new object. Returns new object ownership to caller. + * + * @param aObj Templated object to clone. + * Object type must support: NewLC(), + * ExternalizeL() and InternalizeL() methods. + * + * @return New cloned object. Returns new object + * ownership to caller. Object is left to + * CleanupStack. + */ + static inline T* CloneLC( const T& aObj ); + + + /** + * Templated object clone method. + * + * Similar to CloneLC() but object isn't + * left to CleanupStack. + * + * @param aObj Templated object to clone. + * + * @return New cloned object. Returns new object + * ownership to caller. + */ + static inline T* CloneL( const T& aObj ); + + +private: //Prohibited constructor + TXIMPObjectCloner(); + + }; + + + + + + + + +/** + * Templated object packer. + * + * Object type must support: NewLC(), + * ExternalizeL() and InternalizeL(). + * + * @since S60 v3.2 + */ +template< class T > +class TXIMPObjectPacker + { + public: + + /** + * Templated method to pack object. + * + * Packs given object data to flat buffer and + * returns buffer to caller. + * + * @param aObj Templated object to pack. + * Object type must support ExternalizeL() method. + * + * @return Buffer containing externalized object data. + * Buffer ownership is returned to caller. + */ + static inline HBufC8* PackL( const T& aObj ); + + + + /** + * Templated method to unpack object. + * + * Extracts object data from given flat buffer and + * returns objects ownership to caller. + * + * @param aObj Object which data to internalize from package. + * Concrete object type must support InternalizeL() method. + * + * @Param aPack Buffer containing object data. + */ + static void UnPackL( T& aObj, + const TDesC8& aPack ); + + + /** + * Templated method to pack object array. + * + * Packs given object array data to flat buffer and + * returns buffer to caller. + * + * @param aObjs Array of templated objects to pack. + * Concrete object type must support + * ExternalizeL() method. + * + * @return Buffer containing externalized object data. + * Buffer ownership is returned to caller. + */ + static inline HBufC8* PackArrayL( const RPointerArray< T >& aObjs ); + + + /** + * Templated method to unpack object array. + * + * Instantiates needed amount of new objects, + * extracts their data from given flat buffer and + * returns objects ownership to caller. + * + * @param aObjs Array where to store extracted objects. + * Concrete object type must support + * NewLC() and InternalizeL() methods. + * Array contents are not reseted during + * unpack. + * + * @Param aPack Buffer containing object data. + */ + static inline void UnPackArrayL( RPointerArray< T >& aObjs, + const TDesC8& aPack ); + + + + +private: //Prohibited constructor + TXIMPObjectPacker(); + + }; + + +class TXIMPHBuf8Packer + { +public: + /** + * Pack array of buffers to buffer. + * @param aBufferArray Array of buffers to pack. + * @return Buffer containing buffers. + */ + IMPORT_C static HBufC8* PackArrayL( const RPointerArray< HBufC8 >& aBufferArray ); + + /** + * Unpack array of buffers to array. + * @param aBufferArray. Target array for new buffers. Ownhersip of items in array is transferred to caller. + * @param aPack Packet containing array of buffers. + */ + IMPORT_C static void UnPackArrayL( RPointerArray< HBufC8 >& aBufferArray, const TDesC8& aPack ); + }; + + +#include "ximpobjecthelpers.inl" + + +#endif // XIMPOBJECTHELPERS_H diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/inc/ximpobjecthelpers.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/inc/ximpobjecthelpers.inl Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,225 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Templated algorithms to simplify object handling +* +*/ + + +#include +#include +#include + +#include "ximpapiobjbase.h" + + + +// ----------------------------------------------------------------------------- +// TXIMPObjectMover::MoveFromPtrArrayToL() implementation. +// ----------------------------------------------------------------------------- +// +template< class T1, class T2 > +void TXIMPObjectMover< T1, T2>::MoveFromPtrArrayToL( RPointerArray< T1 >& aSource, + RPointerArray< T2 >& aTarget ) + { + const TInt count = aSource.Count(); + for( TInt ix = 0; ix < count; ix++ ) + { + T2* targetHolder = aSource[ 0 ]; + aTarget.AppendL( targetHolder ); + aSource.Remove( 0 ); + } + } + +// ----------------------------------------------------------------------------- +// TXIMPObjectMover::MoveFromCollectionToArrayL() implementation. +// ----------------------------------------------------------------------------- +// +template< class T1, class T2 > +void TXIMPObjectMover< T1, T2>::MoveFromCollectionToArrayL( MXIMPObjectCollection& aSource, + RPointerArray< T2 >& aTarget, + TLinearOrder< T2 >& aOrder ) + { + MXIMPBase* object = NULL; + while( aSource.GetByType( object, T1::KInterfaceId ) ) + { + T2* instance = TXIMPGetImpClassOrPanic< T2 >::From( *object ); + CleanupStack::PushL( instance ); + aTarget.InsertInOrderL( instance, aOrder ); + CleanupStack::Pop( instance ); + } + } + + +// ----------------------------------------------------------------------------- +// TXIMPObjectCloner::CloneLC() implementation. +// ----------------------------------------------------------------------------- +// +template< class T > +T* TXIMPObjectCloner::CloneLC( const T& aObj ) + { + T* clone = T::NewLC(); + + CBufSeg* buffer = CBufSeg::NewL( KObjectBufGranurality ); + CleanupStack::PushL( buffer ); + + //Externalize + RBufWriteStream ws; + ws.Open( *buffer ); + CleanupClosePushL( ws ); + aObj.ExternalizeL( ws ); + CleanupStack::PopAndDestroy(); // ws + + //Internalize + RBufReadStream rs; + rs.Open( *buffer ); + CleanupClosePushL( rs ); + clone->InternalizeL( rs ); + CleanupStack::PopAndDestroy(); // rs + + CleanupStack::PopAndDestroy( buffer ); + + return clone; + } + + +// ----------------------------------------------------------------------------- +// TXIMPObjectCloner::CloneL() implementation. +// ----------------------------------------------------------------------------- +// +template< class T > +T* TXIMPObjectCloner::CloneL( const T& aObj ) + { + T* clone = TXIMPObjectCloner::CloneLC( aObj ); + CleanupStack::Pop( clone ); + return clone; + } + + +// ----------------------------------------------------------------------------- +// TXIMPObjectPacker::PackL() implementation. +// ----------------------------------------------------------------------------- +// +template< class T > +HBufC8* TXIMPObjectPacker::PackL( const T& aObj ) + { + // we don't know how large the returned descriptor is going to be + CBufFlat* packBuf = CBufFlat::NewL( KObjectBufGranurality ); + CleanupStack::PushL( packBuf ); + + RBufWriteStream ws; + ws.Open( *packBuf ); // CSI: 65 # + CleanupClosePushL( ws ); + + aObj.ExternalizeL( ws ); + + ws.CommitL(); + CleanupStack::PopAndDestroy(); //ws + + // now CBufFlat contains the descriptor + HBufC8* packBufDesc = packBuf->Ptr(0).AllocL(); + + CleanupStack::PopAndDestroy( packBuf ); + return packBufDesc; + + } + +// ----------------------------------------------------------------------------- +// TXIMPObjectPacker::UnPackL() implementation. +// ----------------------------------------------------------------------------- +// +template< class T > +void TXIMPObjectPacker::UnPackL( T& aObj, const TDesC8& aPack ) + { + if ( ! aPack.Length() ) + { + // empty, don't attempt to unpack. + return; + } + + RDesReadStream rs; + CleanupClosePushL( rs ); + rs.Open( aPack ); // CSI: 65 # + aObj.InternalizeL( rs ); + CleanupStack::PopAndDestroy(); // rs + + } + +// ----------------------------------------------------------------------------- +// TXIMPObjectPacker::PackArrayL() implementation. +// ----------------------------------------------------------------------------- +// +template< class T > +HBufC8* TXIMPObjectPacker::PackArrayL( const RPointerArray< T >& aObjs ) + { + CBufFlat* packBuf = CBufFlat::NewL( KObjectBufGranurality ); + CleanupStack::PushL( packBuf ); + + RBufWriteStream ws; + ws.Open( *packBuf ); // CSI: 65 # + CleanupClosePushL( ws ); + + // Get count of objects + TInt objCount( aObjs.Count() ); + // write the count + ws.WriteInt32L( objCount ); + // objects + for ( TInt count(0); count < objCount; count++ ) + { + aObjs[count]->ExternalizeL( ws ); + } + + ws.CommitL(); + CleanupStack::PopAndDestroy(); //ws + + HBufC8* packBufDesc = packBuf->Ptr(0).AllocL(); + CleanupStack::PopAndDestroy( packBuf ); + + return packBufDesc; + } + +// ----------------------------------------------------------------------------- +// TXIMPObjectPacker::UnPackArrayL() implementation. +// ----------------------------------------------------------------------------- +// +template< class T > +void TXIMPObjectPacker::UnPackArrayL( RPointerArray< T >& aObjs, + const TDesC8& aPack ) + { + // No reset + if ( ! aPack.Length() ) + { + // empty, don't attempt to unpack + return; + } + + RDesReadStream rs; + CleanupClosePushL( rs ); + rs.Open( aPack ); // CSI: 65 # + + // read the object count + TInt objCount( rs.ReadInt32L() ); + + for ( TInt count = 0; count < objCount; count++ ) + { + // instantiate new object + T* theObject = T::NewLC(); + // extract its data + theObject->InternalizeL( rs ); + // append it to the object array + aObjs.AppendL( theObject ); + CleanupStack::Pop( theObject ); // theObject + } + + CleanupStack::PopAndDestroy(); // rs + } diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/inc/ximpoperationbase.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/inc/ximpoperationbase.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,208 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Base class for operations + * +*/ + +#ifndef C_XIMPPSCOPERATIONBASE_H +#define C_XIMPPSCOPERATIONBASE_H + +#include + +class CXIMPRequestCompleteEventImp; +class CXIMPRestrictedObjectCollectionImp; +class CXIMPPscContext; +class MXIMPHost; +class MXIMPStatus; +class CXIMPStatusImp; +class MXIMPPscContext ; +class MXIMPRestrictedObjectCollection ; + + +/** + * Base C-class for operations + * + * @lib ximpoperation.lib + * @since S60 v4.0 + */ +class CXIMPOperationBase : public CBase + { + public: + + /** + * Call this, then BaseConstructL in derived class. + */ + IMPORT_C CXIMPOperationBase(); + + IMPORT_C virtual ~CXIMPOperationBase(); + + /** + * @param aRequestId The request id + */ + IMPORT_C void BaseConstructL( TXIMPRequestId aRequestId, + CXIMPPscContext* aContext ); + + public: // common services + + virtual void ConstructL( const TDesC8& aParamPck ) = 0; + + /** + * Set host for operation. ProcessL cannot be called before + * host is set. + */ + IMPORT_C virtual void SetHost( MXIMPHost& aMyHost ); + + /** + * Process this operation. + */ + IMPORT_C virtual void ProcessL(); + + /** + * Request made by the operation has been completed. + */ + IMPORT_C virtual void RequestCompletedL(); + + /** + * @return The request complete event + */ + IMPORT_C virtual CXIMPRequestCompleteEventImp* GetReqCompleteEvent(); + + /** + * @return The operation type which this operation implements. + */ + IMPORT_C virtual TInt Type() const; + + /** + * @param aContext The context of operation + */ + IMPORT_C virtual void SetOpL( CXIMPPscContext* aContext ); + + /** + * @param aRequestId The request id + */ + IMPORT_C virtual void SetReqId( TXIMPRequestId aRequestId ); + + /** + * @return Context object of operation + */ + IMPORT_C virtual CXIMPPscContext* Context(); + + /** + * @return The current request id + */ + IMPORT_C virtual TXIMPRequestId RequestId() const; + + /** + * Set result code for operation + */ + IMPORT_C virtual void SetResultCode( TInt aResultCode ); + + /** + * Set status for operation + */ + IMPORT_C virtual void SetStatus( MXIMPStatus* aStatus ); + + /** + * Set new object collection for operator. + */ + IMPORT_C virtual void SetObjectCollection( MXIMPBase* aCollection ); + + /** + * + */ + IMPORT_C virtual void BeginOperation(); + + /** + * + */ + IMPORT_C virtual void EndOperation(); + + /** + * + */ + IMPORT_C virtual MXIMPStatus& Status() const; + + + /** + * + */ + IMPORT_C TBool IsServerOperation() const; + + /** + * + */ + IMPORT_C void SetServerOperation(); + + /** + * + */ + IMPORT_C MXIMPPscContext* GetContext(); + + /** + * + */ + IMPORT_C MXIMPRestrictedObjectCollection* GetObjCollection(); + + protected: // Internal methods + + /** + * Create request complete event + */ + IMPORT_C virtual void CreateRequestCompleteEventL(); + + protected: // data + + /** + * Req id + */ + TXIMPRequestId iReqId; + + /** + * Host of this operation. Shared owning. Use close to destroy + */ + MXIMPHost* iMyHost; + + /** + * Request complete event + * Owned. + */ + CXIMPRequestCompleteEventImp* iReqCompleteEvent; + + /** + * Context of operation + */ + CXIMPPscContext* iContext; + + /** + * If ETrue, operation is not active + */ + TBool iNotActive; + + /** + * Internal state of the host + */ + CXIMPStatusImp* iStatusObj; + + /** + * Holder for parameters. Owned + */ + CXIMPRestrictedObjectCollectionImp* iObjCollection; + + /** + * True if server initiated operation + */ + TBool iServerOperation; + }; + +#endif // C_XIMPPSCOPERATIONBASE_H diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/inc/ximpoperationdefs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/inc/ximpoperationdefs.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,49 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Presence framework operation definitions. + * +*/ + +#ifndef XIMPOPERATIONDEFS_H +#define XIMPOPERATIONDEFS_H + +#include + +/** + * PSC operations. + */ +namespace NXIMPOps + { + enum TXIMPOpTypes + { + EPrNone = 0, // base class + + // ----------------------------------------------- + // From client + // + EXIMPBindContext, // 1 + EXIMPUnbindContext, // 2 + EXIMPBindContext2, // 3 + + // Session mgmt internal + EXIMPForcedTeardown = 100, // 100 + }; + } + +#endif //XIMPOPERATIONDEFS_H + + + + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/inc/ximpoperationfactory1.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/inc/ximpoperationfactory1.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,107 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Presence Service Connection operation factory + * +*/ + + +#ifndef XIMPCPSCOPERATIONFACTORY1_H +#define XIMPCPSCOPERATIONFACTORY1_H + +#include +#include +#include + +class CXIMPOperationBase; + +//#include + +/** + * Operation factory interface + * + * @lib ximpoperation.dll + * @since S60 v4.0 + */ +class MXIMPOperationFactory1 + { + + public: + + /** + * ECom interface UID for the MXIMPOperationFactory1. + * + * This interface ID is used: + * 1) In XIMPFw ECom registration file, to declare + * implemented interface. It is used also by + * the MXIMPClient::NewClientL() instantiation + * method, when creating MXIMPOperationFactory instance + * through the ECom. + * + * 2) By clients when resolving MXIMPOperationFactory interface + * through MXIMPBase::GetInterface(). + */ + enum { KInterfaceId = XIMP_ECOM_IF_UID_OPERATIONS_INTERFACE }; + + /** + * To get list of implementation plugins which supports this interface + */ + inline static void ListAllImplementationsL(RImplInfoPtrArray& aImplInfoArray) ; + +public: + + /** + * Object creation functions + */ + inline static MXIMPOperationFactory1* NewL(); + + /** + * Object creation functions + */ + inline static MXIMPOperationFactory1* NewL( TUid aImplUid ); + + /** + * Public destructor. + * Object can be deleted through this interface. + */ + virtual inline ~MXIMPOperationFactory1(); + + + +protected: + + /** + * Default constructor to zero initialize + * the iEcomDtorID member. + */ + inline MXIMPOperationFactory1(); + +public: // From MXIMPOperationFactory1 + + /** + * Create operation by operation id. + * @param aOperation. Identifies operation needed to create. + * @return Operation as base object. + */ + virtual CXIMPOperationBase* CreateOperationL( TInt aOperation ) = 0; + +private: // Data + + //OWN: ECom destructor ID + TUid iEcomDtorID; + }; +#include + +#endif // XIMPCPSCOPERATIONFACTORY1_H + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/inc/ximpoperationfactory1.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/inc/ximpoperationfactory1.inl Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,75 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Root interface used by Presence Framework clients. +* +*/ + +#include + + +// ----------------------------------------------------------------------------- +// MXIMPOperationFactory::NewClientL() implementation +// Factory method to instantiate the platform default +// MXIMPOperationFactory implementation through the ECom framework. +// ----------------------------------------------------------------------------- +// +inline MXIMPOperationFactory1* MXIMPOperationFactory1::NewL() + { + _LIT8( KXimpFwDefaultData, "" ); + + TEComResolverParams resolvingParams; + resolvingParams.SetDataType( KXimpFwDefaultData ); + resolvingParams.SetWildcardMatch( ETrue ); + + TAny* imp = REComSession::CreateImplementationL( TUid::Uid( MXIMPOperationFactory1::KInterfaceId ), + _FOFF( MXIMPOperationFactory1, iEcomDtorID ), + resolvingParams ); + + return reinterpret_cast< MXIMPOperationFactory1* >( imp ); + } + +inline MXIMPOperationFactory1* MXIMPOperationFactory1::NewL( TUid aImplUid ) + { + TAny* imp = REComSession::CreateImplementationL( aImplUid, + _FOFF( MXIMPOperationFactory1, iEcomDtorID )); + + + return reinterpret_cast< MXIMPOperationFactory1* >( imp ); + } + +// ----------------------------------------------------------------------------- +// MXIMPOperationFactory1::MXIMPOperationFactory1() implementation +// Zero initializes the iEcomDtorID member. +// ----------------------------------------------------------------------------- +// +inline MXIMPOperationFactory1::MXIMPOperationFactory1() + { + iEcomDtorID = TUid::Null(); + } + + +// ----------------------------------------------------------------------------- +// MXIMPOperationFactory1::~MXIMPOperationFactory1() +// Destructor notifies the ECom from implementation destruction. +// ----------------------------------------------------------------------------- +// +inline MXIMPOperationFactory1::~MXIMPOperationFactory1() + { + REComSession::DestroyedImplementation( iEcomDtorID ); + } + +inline void MXIMPOperationFactory1::ListAllImplementationsL(RImplInfoPtrArray& aImplInfoArray) + { + REComSession::ListImplementationsL(TUid::Uid(MXIMPOperationFactory1::KInterfaceId), aImplInfoArray); + } diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/inc/ximppanics.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/inc/ximppanics.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,135 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework panic defines. + * +*/ + +#ifndef XIMPPANICS_H +#define XIMPPANICS_H + +#include + +/** + * Panic category and reason codes for XIMP Framework client + * failures. + */ +namespace NXIMPPanic + { + _LIT( KCategory, "XIMPClnt" ); + + enum TReason + { + EOnSrvSessionImpAlreadyExists, + EOnSrvSessionImpNotFound, + EOnSrvRequestNotUnderstood, + EOnSrvAlreadyListeningEvents, + EOnSrvAlreadyHavingPrepearedData, + EOnSrvNoPrepearedDataToCopy, + EOnSrvUnknownCtxOperationType + }; + } + + +/** + * Panic category and reason codes for XIMP Framework server + * failures. + */ +namespace NXIMPPrivPanic + { + _LIT( KCategory, "XIMPPriv" ); + enum TReason + { + ECurrentMsgAlreadyExists, // 0 + ECurrentMsgNotFoundInServiceError, // 1 + ECurrentMsgNotValidInServiceError, // 2 + EMessageStillPendingOnDestruction, // 3 + EMessageSelfPtrAlreadyOccupied, // 4 + EPscEnvGlobalsExistsAlready, // 5 + EPscEnvGlobalsNotFound, // 6 + EFrontEndEventPumpNoServerClient, // 7 + EPtrArrayEntryAddUndoInitialized, // 8 + EPtrArrayEntryReplaceUndoInitialized, // 9 + EInvalidOperationType, // 10 + EProtocolAlreadyExistsInHost, // 11 + EHostMgrHostsHaveNotBeenDeleted, // 12 + EContextAlreadyHasAHost, // 13 + EContextHasNoHost, // 14 + EHostStillReferenced, // 15 + EHostNegativeReferenceCount, // 16 + EHostCurrentOperationStillActive, // 17 + EInvalidSubscriptionStatus, // 18 + EFakeRequestCompleteNotReady, // 19 + EOwnPresencePifNotSet, // 20 + EArrayCountNotValid, // 21 + EOwnPresencePresenceInfoDoesNotExist, // 22 + EInvalidSubscriptionType, // 23 + ESubscriptionItemLogicError, // 24 + EPresentityPresencePresenceInfoDoesNotExist,// 25 + EHostNotFound, // 26 + ENoCachedUnbindsFound, // 27 + EInvalidHostForProtocol, // 28 + ECurrentOperationNull, // 29 + EInvalidFilterType, // 30 + EMatchingClientSideReqNotFound, // 31 + + // invalid operation state transitions + EInvalidStateForSessionLost = 40, // 40 + EInvalidStateForOp, // 41 + EInvalidStateForOpBindBegin, // 42 + EInvalidStateForOpBindEnd, // 43 + EInvalidStateForOpShareBoth, // 44 + EInvalidStateForOpUnshareBoth, // 45 + EInvalidStateForOpReconnectBegin, // 46 + EInvalidStateForOpReconnectEnd, // 47 + EInvalidStateForOpUnbindBegin, // 48 + EInvalidStateForOpUnbindEnd, // 49 + EInvalidStateForOpSessionLostBegin, // 50 + EInvalidStateForOpSessionLostEnd, // 51 + EInvalidStateForOpTearDownBoth, // 52 + + // invalid state transitions + EInvalidStateTransUnknown = 60, // 60 + EInvalidStateTransForNotConnected, // 61 + EInvalidStateTransForConnecting, // 62 + EInvalidStateTransForConnected, // 63 + EInvalidStateTransForReconnecting, // 64 + EInvalidStateTransForSuspended, // 65 + EInvalidStateTransForDisconnecting, // 66 + }; + + + /** + * Panic function to trigger NXIMPPrivPanic + * panics. + */ + IMPORT_C void Panic( TReason aReason ); + } + +namespace NXIMPPlugin + { + _LIT( KCategory, "XIMPPlugin" ); + enum TReason + { + EInvalidRequestId + }; + + } + + +#endif //ximppanics_H + + + + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/inc/ximppsccontext.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/inc/ximppsccontext.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,67 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Context interface +* +*/ + +#ifndef MXIMPPSCCONTEXT_H +#define MXIMPPSCCONTEXT_H + +class CPresenceInfoFilterImp; +class CXIMPIdentityImp; + +/** + * Context interface. + * + * @since S60 v3.2 + */ +class MXIMPPscContext + { + +public: // Enumerations + + enum TFilterStoreType + { + EOwnPresenceFilter, + EPresentityPresenceFilter, + EPresentityGroupMemberPresenceFilter, + EGrantPresenceToEveryoneFilter, + EGrantPresenceToPresentityFilter, + EGrantPresenceToGroupMemberFilter + }; + +public: // Interface + + /* + * Access to current presence interest. + * @param Type of filter to access. + * @param aIdentity Identity to map filter. Default NULL + * @return Presence interest. NULL if not defined. + */ + virtual CPresenceInfoFilterImp* PresenceInfoFilter( TFilterStoreType aTypeOfFilter, + const CXIMPIdentityImp* aIdentity = NULL ) const = 0; + +protected: // Destruction + + /** + * Object cannot be deleted through this interface + */ + virtual ~MXIMPPscContext(){} + }; + +/* ======================================================================== */ + + + +#endif // MXIMPPSCCONTEXT_H diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/inc/ximprbufhelpers.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/inc/ximprbufhelpers.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,128 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Helpers for handling RBuf. +* +*/ + +#ifndef XIMPRBUFHELPERS_H +#define XIMPRBUFHELPERS_H + +#include +#include + + + +/** + * RBuf16 handling helper. + * + * @lib ximpdatamodel.dll + * @since S60 v3.2 + */ +class XIMPRBuf16Helper + { +public: + + /** + * Grows RBuf hold given max length. + * + * @param aBuf RBuf reference which to grow. + * @param aMaxLength Needed max length. + */ + IMPORT_C static void GrowIfNeededL( RBuf16& aBuf, const TInt aMaxLength ); + + + /** + * Sets new value for RBuf. + * + * @param aBuf RBuf reference where to set. + * ReAllocated if needed during the set. + * @param aValue Value to set. + */ + IMPORT_C static void SetNewValueL( RBuf16& aBuf, const TDesC16& aValue ); + + + /** + * Externalizes RBuf to stream. + * + * @param aBuf RBuf which to externalize. + * @param aStream The stream to write. + */ + IMPORT_C static void ExternalizeL( const RBuf16& aBuf, RWriteStream& aStream ); + + + /** + * Internalizes referenced RBuf from stream. + * ReAllocates the RBuf if needed during the internalization. + * + * @param aBuf RBuf reference where to internalize. + * @param aStream The stream from to read. + */ + IMPORT_C static void InternalizeL( RBuf16& aBuf, RReadStream& aStream ); + + }; + + + +/** + * RBuf8 handling helper. + * + * @lib ximpdatamodel.dll + * @since S60 v3.2 + */ +class XIMPRBuf8Helper + { +public: + + /** + * Grows RBuf hold given max length. + * + * @param aBuf RBuf reference which to grow. + * @param aMaxLength Needed max length. + */ + IMPORT_C static void GrowIfNeededL( RBuf8& aBuf, const TInt aMaxLength ); + + + /** + * Sets new value for RBuf. + * + * @param aBuf RBuf reference where to set. + * ReAllocated if needed during the set. + * @param aValue Value to set. + */ + IMPORT_C static void SetNewValueL( RBuf8& aBuf, const TDesC8& aValue ); + + + /** + * Externalizes RBuf to stream. + * + * @param aBuf RBuf which to externalize. + * @param aStream The stream to write. + */ + IMPORT_C static void ExternalizeL( const RBuf8& aBuf, RWriteStream& aStream ); + + + /** + * Internalizes referenced RBuf from stream. + * ReAllocates the RBuf if needed during the internalization. + * + * @param aBuf RBuf reference where to internalize. + * @param aStream The stream from to read. + */ + IMPORT_C static void InternalizeL( RBuf8& aBuf, RReadStream& aStream ); + + }; + + +#endif //XIMPRBUFHELPERS_H + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/inc/ximprequestidbuilder.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/inc/ximprequestidbuilder.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,88 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: TXIMPRequestId builder. + * +*/ + + + +#ifndef XIMPREQUESTIDBUILDER_H +#define XIMPREQUESTIDBUILDER_H + +#include + +class TXIMPRequestId; + +/** + * The request ID builder for XIMP internal use to + * construct valid TXIMPRequestId:s + * + * @since S60 v3.2 + */ +class TXIMPRequestIdBuilder + { +public: + + /** + * C++ default constructor. + * Initialises all parts to to their default values. + */ + IMPORT_C TXIMPRequestIdBuilder(); + + + /** + * Sets the protocol ID part. + */ + IMPORT_C void SetProtocolId( TUint32 aProtocol ); + + + /** + * Sets the session ID part. + */ + IMPORT_C void SetSessionId( TUint32 aSession ); + + + /** + * Sets the request ID part. + */ + IMPORT_C void SetRequestId( TUint32 aRequest ); + + + /** + * Constructs a TXIMPRequestId object having + * valued as specified in member parts. + */ + IMPORT_C TXIMPRequestId BuildRequestId() const; + + + +private: // data + + //OWN: Spare value reserved for future extension. + TUint32 iSpare; + + //OWN: Protocol id part + TUint32 iProtocol; + + //OWN: Session id part + TUint32 iSession; + + //OWN: Request id part + TUint32 iRequest; + }; + + +#endif // XIMPREQUESTIDBUILDER_H + +// End of file diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/inc/ximpsubscriptionitem.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/inc/ximpsubscriptionitem.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,70 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Subscription item interface +* +*/ + +#ifndef MXIMPPSCSUBSCRIPTIONITEM_H +#define MXIMPPSCSUBSCRIPTIONITEM_H + +class MXIMPPscContext; +class CXIMPDataSubscriptionStateImp; + +/** + * Context interface. + * + * @since S60 v3.2 + */ +class MXIMPSubscriptionItem + { + +public: // Interface + + /** + * Synthesise own presence information to given context. + * Presence information is filtered with context pif. + * @param aContext. Target context for presence information. + */ + virtual void SynthesiseSubscriptionEventToL( MXIMPPscContext* aContext, TBool aForceEvent ) = 0; + + /** + * Synthesise presence information to all subscribed contexts. + */ + virtual void SynthesiseSubscriptionEventToAllCtxsL() = 0; + + /** + * Activate subscriber that is added with AddSubscriberL method of subscriptionItem + * @param aContext. Target context. + */ + virtual void ActivateSubscriberL( MXIMPPscContext* aContext ) = 0; + + /** + * Set new subscriptionstate normally invoked by adaptation. + * @param aNewState New subscription state + */ + virtual void SetDataSubscriptionStateL( CXIMPDataSubscriptionStateImp& aNewState ) = 0; + +protected: // Destruction + + /** + * Object cannot be deleted through this interface + */ + virtual ~MXIMPSubscriptionItem(){} + }; + +/* ======================================================================== */ + + + +#endif // MXIMPPSCSUBSCRIPTIONITEM_H diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/inc/ximpsubscriptionitembase.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/inc/ximpsubscriptionitembase.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,253 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Presence Service Connection own presence subscription implementation. +* +*/ + +#ifndef CXIMPPSCSUBSCRIPTIONITEMBASE_H +#define CXIMPPSCSUBSCRIPTIONITEMBASE_H + +#include +#include +#include "ximpsubscriptionitem.h" + + +class MXIMPItemParentBase; +class MXIMPPscContext; +class CXIMPDataSubscriptionStateImp; + +/** + * PSC subscription implementation + * + * @since S60 v3.2 + */ +class CXIMPSubscriptionItemBase : public CObject, public MXIMPSubscriptionItem + { +public: // Definitions + + /** + * Subscription status + */ + enum TSubscriptionStatus + { + ENotSubscribedAtAll, + ESubscribedForOtherCtxOnly, + ESubscribedForCtxOnly, + ESubscribedForCtxAndOthers + }; + + /** + * Subscription update event. + * Update subscription based on event. + */ + enum TSubscriptionEvent + { + ECompleteDataReceived + }; + + /** + * For linear ordering by pointers + */ + static TInt OrderOfContexts( const MXIMPPscContext& aFirst, + const MXIMPPscContext& aSecond ); + + /** + * For linear ordering by pointers + */ + static TInt OrderOfItems( const CXIMPSubscriptionItemBase& aFirst, + const CXIMPSubscriptionItemBase& aSecond ); + +protected: // Construction and destruction + + /** + * Destruction + * - Remember to inform parent about delete. + */ + IMPORT_C virtual ~CXIMPSubscriptionItemBase(); + +public: // Construction and destruction + + /** + * Construction + * @param aParent. Parent has to be informed when this object is deleted by RemoveMe method. + */ + IMPORT_C CXIMPSubscriptionItemBase( MXIMPItemParentBase& aParent ); + + /** + * Base construction. Must be called from inherited classes ConstructL + */ + IMPORT_C void BaseConstructL(); + + +public: // New methods + + /** + * Subscriptionstatus for context. + * + * ENotSubscribedAtAll - Subscribe not done by any context. + * ESubscribedForOtherCtxOnly - Subscribe done by others but not aContext + * ESubscribedForCtxOnly - Subscribe done by aContext only. + * ESubscribedForCtxAndOthers - Subscribe done by others and aContext. + * + * @param aContext Check subscription status for aContext. + */ + IMPORT_C TSubscriptionStatus SubscriptionStatus( MXIMPPscContext* aContext ); + + /** + * Add subscriber for item. + * @param aContext. Context to be added. + */ + IMPORT_C void AddSubscriberL( MXIMPPscContext* aContext ); + + /** + * Remove subscriber from item + * @param aContext. Context to be removed. + */ + IMPORT_C void RemoveSubscriber( MXIMPPscContext* aContext ); + + /** + * Add subscriber for item. + * @param aItem. Item to be added. + */ + IMPORT_C void AddSubscriberL( CXIMPSubscriptionItemBase* aItem ); + + /** + * Remove subscriber from item + * @param aContext. Item to be removed. + */ + IMPORT_C void RemoveSubscriber( CXIMPSubscriptionItemBase* aItem ); + + /** + * Activate subscriber for item. + * @param aItem. Item to be activated. + */ + IMPORT_C void ActivateSubscriberL( CXIMPSubscriptionItemBase* aItem ); + + /** + * Call RemoveSubscriber for all contexts registered to item. + */ + IMPORT_C void ForceClose(); + + /** + * Clean item if expired. + * @return ETrue if expired and cleaned.EFalse if not. + */ + IMPORT_C TBool CleanIfExpired(); + + /** + * Update subscription based on event happened. + * @param aUpdateState. Event which happened. + */ + IMPORT_C void UpdateSubscriptionStateL( TSubscriptionEvent aUpdateState ); + + /** + * + */ + IMPORT_C const MXIMPDataSubscriptionState& DataSubscriptionState(); + + /** + * Count of subscribed contexts. + */ + IMPORT_C TInt ContextCount() const; + + /** + * Reference to context in index. + */ + IMPORT_C MXIMPPscContext& Context( TInt aIndex ); + + /** + * Can context be found from contexts. + */ + IMPORT_C TBool IsContext( MXIMPPscContext* aContext ) const; + +public: // From MXIMPSubscriptionItem + + /** + * @see MXIMPSubscriptionItem + */ + IMPORT_C void SynthesiseSubscriptionEventToAllCtxsL(); + + /** + * @see MXIMPSubscriptionItem + */ + IMPORT_C void ActivateSubscriberL( MXIMPPscContext* aContext ); + + /** + * @see MXIMPSubscriptionItem + */ + IMPORT_C void SetDataSubscriptionStateL( CXIMPDataSubscriptionStateImp& aNewState ); + +public: // Helpers + + /** + * Status for context + */ + IMPORT_C CXIMPDataSubscriptionStateImp* StatusLC( MXIMPPscContext* aContext ) const; + + /** + * Update time to new expire time. + */ + IMPORT_C void UpdateExpirationL(); + + /** + * Change status after subscriber is added/removed. + */ + IMPORT_C void ChangeStatusAfterAdd(); + IMPORT_C void ChangeStatusAfterRemove(); + + /** + * Count of subscribers. Items counted as 1. + */ + IMPORT_C TInt CountOfSubscribers(); + +protected: // New interface methods. + + /** + * Clean data because expiration + */ + virtual void CleanExpired() = 0; + +protected: // Data + + /** + * Parent object to inform when object is deleted. + * Used also for sending events. + */ + MXIMPItemParentBase& iParent; + + /** + * Subscribed contexts. + */ + RPointerArray< MXIMPPscContext > iContexts; + RPointerArray< MXIMPPscContext > iPreContexts; + RPointerArray< CXIMPSubscriptionItemBase > iItems; + RPointerArray< CXIMPSubscriptionItemBase > iPreItems; + + /** + * Current presence info status. + */ + CXIMPDataSubscriptionStateImp* iSubscriptionState; + + /** + * Time when ready for expire. + */ + TTime iExpireTime; + }; + + +/* ======================================================================== */ + + + +#endif // CXIMPPSCSUBSCRIPTIONITEMBASE_H diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/group/bld.inf Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,59 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Build information file for test dlls and related helpers +* +*/ + + +// tsrc utils, including test mover +//#include "../tsrcutils/bld.inf" + +// Test protocols +//#include "../tsrcprotocols/bld.inf" + +// Module release tests +//#include "../src/t_rootservices/bld.inf" +//#include "../src/t_sessionmng/bld.inf" +//#include "../src/t_presencepublishing/bld.inf" +//#include "../src/t_presencewatching/bld.inf" +//#include "../src/t_presencegrouplistmngt/bld.inf" +//#include "../src/t_presencegroupmembermngt/bld.inf" +//#include "../src/t_presencewatcherlistmngt/bld.inf" +//#include "../src/t_presencegrantrequestmngt/bld.inf" +//#include "../src/t_presenceauthorization/bld.inf" +//#"../src/t_presenceblocking/bld.inf" +//#include "../src/t_utils/bld.inf" +//#include "../src/t_presenceall/bld.inf" + +PRJ_TESTMMPFILES +../tsrcutils/testcaseutils/prfwtestcaseutils.mmp +../tsrcutils/processmaster/prfwtestprocessmaster.mmp +../tsrcprotocols/pr_prfwtestprotocol/pr_prfwtestprotocol.mmp +../src/t_rootservices/t_rootservices.mmp +../src/t_sessionmng/t_sessionmng.mmp +../src/t_presencepublishing/t_presencepublishing.mmp +../src/t_presencewatching/t_presencewatching.mmp +../src/t_presencegrouplistmngt/t_presencegrouplistmngt.mmp +../src/t_presencegroupmembermngt/t_presencegroupmembermngt.mmp +../src/t_presencewatcherlistmngt/t_presencewatcherlistmngt.mmp +../src/t_presencegrantrequestmngt/t_presencegrantrequestmngt.mmp +../src/t_presenceauthorization/t_presenceauthorization.mmp +../src/t_presenceblocking/t_presenceblocking.mmp +../src/t_utils/t_utils.mmp +../src/t_presenceall/t_presenceall.mmp + +// Export the .iby for module release tests +PRJ_EXPORTS +ximpfwmrt.iby /epoc32/rom/include/ximpfwmrt.iby + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/group/ximpfw_release_tests.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/group/ximpfw_release_tests.pkg Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,56 @@ +; +; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +; All rights reserved. +; This component and the accompanying materials are made available +; under the terms of "Eclipse Public License v1.0" +; which accompanies this distribution, and is available +; at the URL "http://www.eclipse.org/legal/epl-v10.html". +; +; Initial Contributors: +; Nokia Corporation - initial contribution. +; +; Contributors: +; +; Description: +; +;Header +#{"XIMPFW ReleaseTests"}, (0x10282DE4), 1, 0, 0 + +;Language +&EN + +;Localised VendorID +%{"Nokia"} + +;VendorID +:"Nokia" + + +;Supports Series 60 v 0.9 +(0x101F6F88), 0, 0, 0, +{"Series60ProductID"} + + +;Needed test protocols and test helpers +"\EPOC32\RELEASE\ARMV5\UREL\pr_prfwtestprotocol.dll" - "!:\sys\bin\pr_prfwtestprotocol.dll" +"\EPOC32\DATA\Z\Resource\Plugins\pr_prfwtestprotocol.RSC"-"!:\resource\plugins\pr_prfwtestprotocol.rsc" +"\EPOC32\RELEASE\ARMV5\UREL\prfwtestcaseutils.dll" - "!:\sys\bin\prfwtestcaseutils.dll" + + +;EUnit test dlls +;"\EPOC32\RELEASE\ARMV5\UREL\t_presenceall.dll" - "!:\sys\bin\t_presenceall.dll" +"\EPOC32\RELEASE\ARMV5\UREL\t_rootservices.dll" - "!:\sys\bin\t_rootservices.dll" +"\EPOC32\RELEASE\ARMV5\UREL\t_sessionmng.dll" - "!:\sys\bin\t_sessionmng.dll" +"\EPOC32\RELEASE\ARMV5\UREL\t_presencepublishing.dll" - "!:\sys\bin\t_presencepublishing.dll" +"\EPOC32\RELEASE\ARMV5\UREL\t_presencewatching.dll" - "!:\sys\bin\t_presencewatching.dll" +"\EPOC32\RELEASE\ARMV5\UREL\t_presencegrouplistmngt.dll" - "!:\sys\bin\t_presencegrouplistmngt.dll" +"\EPOC32\RELEASE\ARMV5\UREL\t_presencegroupmembermngt.dll" - "!:\sys\bin\t_presencegroupmembermngt.dll" +"\EPOC32\RELEASE\ARMV5\UREL\t_presencewatcherlistmngt.dll" - "!:\sys\bin\t_presencewatcherlistmngt.dll" +"\EPOC32\RELEASE\ARMV5\UREL\t_presencegrantrequestmngt.dll" - "!:\sys\bin\t_presencegrantrequestmngt.dll" +"\EPOC32\RELEASE\ARMV5\UREL\t_presenceauthorization.dll" - "!:\sys\bin\t_presenceauthorization.dll" +"\EPOC32\RELEASE\ARMV5\UREL\t_presenceblocking.dll" - "!:\sys\bin\t_presenceblocking.dll" +"\EPOC32\RELEASE\ARMV5\UREL\t_utils.dll" - "!:\sys\bin\t_utils.dll" + +;ProcessMaster +"\EPOC32\RELEASE\ARMV5\UREL\prfwtestprocessmaster.exe" - "!:\sys\bin\prfwtestprocessmaster.exe" + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/group/ximpfwmrt.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/group/ximpfwmrt.iby Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,47 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Image description file for module release tests +* +*/ + +#ifndef __prfwmrt_iby__ +#define __prfwmrt_iby__ + +#include + +// Test protocol (ECOM plugin) +ECOM_PLUGIN( pr_prfwtestprotocol.dll, pr_prfwtestprotocol.rsc ) + +// Test utils and helpers +file=ABI_DIR\BUILD_DIR\prfwtestcaseutils.dll SHARED_LIB_DIR\prfwtestcaseutils.dll + +// Test dlls +file=ABI_DIR\BUILD_DIR\t_presenceall.dll SHARED_LIB_DIR\t_presenceall.dll +file=ABI_DIR\BUILD_DIR\t_rootservices.dll SHARED_LIB_DIR\t_rootservices.dll +file=ABI_DIR\BUILD_DIR\t_sessionmng.dll SHARED_LIB_DIR\t_sessionmng.dll +file=ABI_DIR\BUILD_DIR\t_presencepublishing.dll SHARED_LIB_DIR\t_presencepublishing.dll +file=ABI_DIR\BUILD_DIR\t_presencewatching.dll SHARED_LIB_DIR\t_presencewatching.dll +file=ABI_DIR\BUILD_DIR\t_presencegrouplistmngt.dll SHARED_LIB_DIR\t_presencegrouplistmngt.dll +file=ABI_DIR\BUILD_DIR\t_presencegroupmembermngt.dll SHARED_LIB_DIR\t_presencegroupmembermngt.dll +file=ABI_DIR\BUILD_DIR\t_presencewatcherlistmngt.dll SHARED_LIB_DIR\t_presencewatcherlistmngt.dll +file=ABI_DIR\BUILD_DIR\t_presenceauthorization.dll SHARED_LIB_DIR\t_presenceauthorization.dll +file=ABI_DIR\BUILD_DIR\t_presenceblocking.dll SHARED_LIB_DIR\t_presenceblocking.dll +file=ABI_DIR\BUILD_DIR\t_utils.dll SHARED_LIB_DIR\t_utils.dll +file=ABI_DIR\BUILD_DIR\t_presencecache.dll SHARED_LIB_DIR\t_presencecache.dll + +//ProcessMaster +file=ABI_DIR\BUILD_DIR\prfwtestprocessmaster.exe SHARED_LIB_DIR\prfwtestprocessmaster.exe + +#endif //__prfwmrt_iby__ + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/init/ximpfw_install.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/init/ximpfw_install.pkg Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,63 @@ +; +; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +; All rights reserved. +; This component and the accompanying materials are made available +; under the terms of "Eclipse Public License v1.0" +; which accompanies this distribution, and is available +; at the URL "http://www.eclipse.org/legal/epl-v10.html". +; +; Initial Contributors: +; Nokia Corporation - initial contribution. +; +; Contributors: +; +; Description: +; +;Language +&EN + +;Header +#{"XIMPFramework"}, (0x10282DDC), 1, 0, 0, TYPE=SA + + +;Localised VendorID +%{"Nokia"} + +;VendorID +:"Nokia" + +(0x101F7961), 0, 0, 0, {"Series60ProductID"} + + +;binaries +"\EPOC32\RELEASE\ARMV5\UDEB\ximpdatamodel.dll"-"!:\sys\bin\ximpdatamodel.dll" +"\EPOC32\RELEASE\ARMV5\UDEB\ximpoperations.dll"-"!:\sys\bin\ximpoperations.dll" +"\EPOC32\RELEASE\ARMV5\UDEB\ximpprocessor.dll"-"!:\sys\bin\ximpprocessor.dll" +"\EPOC32\RELEASE\ARMV5\UDEB\ximpserver.exe"-"!:\sys\bin\ximpserver.exe" +"\EPOC32\RELEASE\ARMV5\UDEB\ximprootserver.exe"-"!:\sys\bin\ximprootserver.exe" +"\EPOC32\RELEASE\ARMV5\UDEB\ximpsrvclient.dll"-"!:\sys\bin\ximpsrvclient.dll" +"\EPOC32\RELEASE\ARMV5\UDEB\ximpmanager.dll"-"!:\sys\bin\ximpmanager.dll" +"\EPOC32\RELEASE\ARMV5\UDEB\ximpecomhook.dll"-"!:\sys\bin\ximpecomhook.dll" +"\EPOC32\RELEASE\ARMV5\UDEB\ximputils.dll"-"!:\sys\bin\ximputils.dll" +"\EPOC32\RELEASE\ARMV5\UDEB\presencemanager.dll"-"!:\sys\bin\presencemanager.dll" +"\EPOC32\RELEASE\ARMV5\UDEB\presencedatamodel.dll"-"!:\sys\bin\presencedatamodel.dll" +"\EPOC32\RELEASE\ARMV5\UDEB\presenceoperation.dll"-"!:\sys\bin\presenceoperation.dll" +"\EPOC32\RELEASE\ARMV5\UDEB\presencedatamodelhook.dll"-"!:\sys\bin\presencedatamodelhook.dll" +"\EPOC32\RELEASE\ARMV5\UDEB\presenceecomhook.dll"-"!:\sys\bin\presenceecomhook.dll" +"\EPOC32\RELEASE\ARMV5\UDEB\presencecacheclient.dll"-"!:\sys\bin\presencecacheclient.dll" +"\EPOC32\RELEASE\ARMV5\UDEB\presencecacheecomhook.dll"-"!:\sys\bin\presencecacheecomhook.dll" +"\EPOC32\RELEASE\ARMV5\UDEB\presencecacheserver.exe"-"!:\sys\bin\presencecacheserver.exe" +"\EPOC32\RELEASE\ARMV5\UDEB\immanager.dll"-"!:\sys\bin\immanager.dll" +"\EPOC32\RELEASE\ARMV5\UDEB\imdatamodel.dll"-"!:\sys\bin\imdatamodel.dll" +"\EPOC32\RELEASE\ARMV5\UDEB\imoperation.dll"-"!:\sys\bin\imoperation.dll" +"\EPOC32\RELEASE\ARMV5\UDEB\imdatamodelhook.dll"-"!:\sys\bin\imdatamodelhook.dll" +"\EPOC32\RELEASE\ARMV5\UDEB\imecomhook.dll"-"!:\sys\bin\imecomhook.dll" + +;resources +"\EPOC32\DATA\Z\Resource\Plugins\ximpecomhook.RSC"-"!:\resource\plugins\ximpecomhook.rsc" +"\EPOC32\DATA\Z\Resource\Plugins\presenceecomhook.RSC"-"!:\resource\plugins\presenceecomhook.rsc" +"\EPOC32\DATA\Z\Resource\Plugins\presencedatamodelhook.RSC"-"!:\resource\plugins\presencedatamodelhook.rsc" +"\EPOC32\DATA\Z\Resource\Plugins\presencecacheecomhook.RSC"-"!:\resource\plugins\presencecacheecomhook.rsc" +"\EPOC32\DATA\Z\Resource\Plugins\imecomhook.RSC"-"!:\resource\plugins\imecomhook.rsc" +"\EPOC32\DATA\Z\Resource\Plugins\imdatamodelhook.RSC"-"!:\resource\plugins\imdatamodelhook.rsc" + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/init/ximpfw_upgrade.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/init/ximpfw_upgrade.pkg Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,75 @@ +; +; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +; All rights reserved. +; This component and the accompanying materials are made available +; under the terms of "Eclipse Public License v1.0" +; which accompanies this distribution, and is available +; at the URL "http://www.eclipse.org/legal/epl-v10.html". +; +; Initial Contributors: +; Nokia Corporation - initial contribution. +; +; Contributors: +; +; Description: +; +; +; Package file for presencefw SIS stub in ROM +; and a ximp framework upgrade SIS. +; Including the stub in ROM enables components +; defined in stub to be updated by SIS installer. +; When adding or removing components from presencefw +; please update this pkg file and create an updated +; stub to group directory. +; +; To create SIS stub: makesis -s ximpfw_upgrade.pkg ximpfwstub.sis +; Copy ximpfwstub.sis to z:\system\install\ximpfwstub.sis +; or use abld export to export it automatically. +; + +;Language +&EN + +;Header +#{"PresenceFramework"}, (0x10282DDC), 1, 0, 0, TYPE=PU + + +;Localised VendorID +%{"Nokia"} + +;VendorID +:"Nokia" + +(0x101F7961), 0, 0, 0, {"Series60ProductID"} + + +;binaries +"\EPOC32\RELEASE\ARMV5\UREL\ximpdatamodel.dll"-"z:\sys\bin\ximpdatamodel.dll" +"\EPOC32\RELEASE\ARMV5\UREL\ximpoperations.dll"-"z:\sys\bin\ximpoperations.dll" +"\EPOC32\RELEASE\ARMV5\UREL\ximpprocessor.dll"-"z:\sys\bin\ximpprocessor.dll" +"\EPOC32\RELEASE\ARMV5\UREL\ximpserver.exe"-"z:\sys\bin\ximpserver.exe" +"\EPOC32\RELEASE\ARMV5\UREL\ximprootserver.exe"-"z:\sys\bin\ximprootserver.exe" +"\EPOC32\RELEASE\ARMV5\UREL\ximpsrvclient.dll"-"z:\sys\bin\ximpsrvclient.dll" +"\EPOC32\RELEASE\ARMV5\UREL\ximpmanager.dll"-"z:\sys\bin\ximpmanager.dll" +"\EPOC32\RELEASE\ARMV5\UREL\ximpecomhook.dll"-"z:\sys\bin\ximpecomhook.dll" +"\EPOC32\RELEASE\ARMV5\UREL\ximputils.dll"-"z:\sys\bin\ximputils.dll" +"\EPOC32\RELEASE\ARMV5\UREL\presencemanager.dll"-"z:\sys\bin\presencemanager.dll" +"\EPOC32\RELEASE\ARMV5\UREL\presencedatamodel.dll"-"z:\sys\bin\presencedatamodel.dll" +"\EPOC32\RELEASE\ARMV5\UREL\presenceoperation.dll"-"z:\sys\bin\presenceoperation.dll" +"\EPOC32\RELEASE\ARMV5\UREL\presencecacheclient.dll"-"z:\sys\bin\presencecacheclient.dll" +"\EPOC32\RELEASE\ARMV5\UREL\presencecacheecomhook.dll"-"z:\sys\bin\presencecacheecomhook.dll" +"\EPOC32\RELEASE\ARMV5\UREL\presencecacheserver.exe"-"z:\sys\bin\presencecacheserver.exe" +"\EPOC32\RELEASE\ARMV5\UREL\immanager.dll"-"z:\sys\bin\immanager.dll" +"\EPOC32\RELEASE\ARMV5\UREL\imdatamodel.dll"-"z:\sys\bin\imdatamodel.dll" +"\EPOC32\RELEASE\ARMV5\UREL\imoperation.dll"-"z:\sys\bin\imoperation.dll" +"\EPOC32\RELEASE\ARMV5\UREL\imdatamodelhook.dll"-"z:\sys\bin\imdatamodelhook.dll" +"\EPOC32\RELEASE\ARMV5\UREL\imecomhook.dll"-"z:\sys\bin\imecomhook.dll" + +;resources +"\EPOC32\DATA\z\Resource\Plugins\ximpecomhook.RSC"-"z:\resource\plugins\ximpecomhook.rsc" +"\EPOC32\DATA\z\Resource\Plugins\presenceecomhook.RSC"-"z:\resource\plugins\presenceecomhook.rsc" +"\EPOC32\DATA\z\Resource\Plugins\presencedatamodelhook.RSC"-"z:\resource\plugins\presencedatamodelhook.rsc" +"\EPOC32\DATA\z\Resource\Plugins\presencecacheecomhook.RSC"-"z:\resource\plugins\presencecacheecomhook.rsc" +"\EPOC32\DATA\z\Resource\Plugins\imecomhook.RSC"-"z:\resource\plugins\imecomhook.rsc" +"\EPOC32\DATA\z\Resource\Plugins\imdatamodelhook.RSC"-"z:\resource\plugins\imdatamodelhook.rsc" + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_eunittemplate/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_eunittemplate/bld.inf Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,22 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Build information file for T_EunitTemplate test dll. +* +*/ + +PRJ_PLATFORMS +DEFAULT + +PRJ_TESTMMPFILES +t_eunittemplate.mmp diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_eunittemplate/t_eunittemplate.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_eunittemplate/t_eunittemplate.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,124 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "t_eunittemplate.h" +#include "eunittools.h" +#include + + + +// ============================ MEMBER FUNCTIONS =============================== + +// CONSTRUCTION +T_EunitTemplate* T_EunitTemplate::NewL() + { + T_EunitTemplate* self = new( ELeave ) T_EunitTemplate; + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + + return self; + } + + +T_EunitTemplate::~T_EunitTemplate() + { + } + + +void T_EunitTemplate::ConstructL() + { + CEUnitTestSuiteClass::ConstructL(); + } + + +T_EunitTemplate::T_EunitTemplate() + { + } + + + +// =========================================================================== +// TEST CASE SETUP & TEARDOWN METHODS +// =========================================================================== +// +void T_EunitTemplate::Setup_L() + { + } + + + +void T_EunitTemplate::Teardown() + { + } + + + +// =========================================================================== +// TODO: Test case description & grouping +// =========================================================================== +// +void T_EunitTemplate::TestSomething_L() + { + EUNIT_ASSERT( EFalse ); + } + + + + +// =========================================================================== +// TEST CASE TABLE +// =========================================================================== +// +EUNIT_BEGIN_TEST_TABLE( + T_EunitTemplate, + "Add test suite description here.", + "MODULE" ) + + PRFW_NOT_DECORATED_TEST( + "Empty test skeleton", + "Add tested class name here", + "Add tested function names here", + "FUNCTIONALITY ERRORHANDLING BOUNDARY", + Setup_L, + TestSomething_L, + Teardown ) + + +EUNIT_END_TEST_TABLE + + + + + +// =========================================================================== +// TEST SUITE CONSTRUCTION +// =========================================================================== +// +EXPORT_C MEUnitTest* CreateTestSuiteL() + { + return T_EunitTemplate::NewL(); + } + + +// end of file + + + + + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_eunittemplate/t_eunittemplate.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_eunittemplate/t_eunittemplate.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,96 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef T_EUNITTEMPLATE_H +#define T_EUNITTEMPLATE_H + +#include + + + + + +/** + * XIMP Framework Eunit tests. + * + * TODO: Add test description here. + * + * @since S60 v4.0 + */ +class T_EunitTemplate : public CEUnitTestSuiteClass + { + +public: + + /** ?description */ + //enum ?declaration + + /** ?description */ + //typedef ?declaration + + static T_EunitTemplate* NewL(); + virtual ~T_EunitTemplate(); + +private: + + T_EunitTemplate(); + void ConstructL(); + + + +private: // Test case functions + + void Setup_L(); + void Teardown(); + + void TestSomething_L(); + + + +private: // Test helpers + + + + + +private: // Test data + + + /** + * Eunit test case table declaration. + */ + EUNIT_DECLARE_TEST_TABLE; + + + /** + * + * Own. / Not own. + */ + //?type* ?member_name; + + }; + + +#endif // T_EUNITTEMPLATE_H + + + +// end of file + + + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_eunittemplate/t_eunittemplate.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_eunittemplate/t_eunittemplate.mmp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,36 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "../../tsrcutils/eunitcommon/eunittstdllbase.mmh" + +TARGET t_eunittemplate.dll +CAPABILITY ALL -TCB + + +SOURCEPATH . +SOURCE t_eunittemplate.cpp + + + +// Dependencies to system components +//LIBRARY + + + +// end of file + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presenceall/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presenceall/bld.inf Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,25 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Build information file for t_presenceall.dll +* +*/ + + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +PRJ_TESTMMPFILES +t_presenceall.mmp diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presenceall/t_presenceall.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presenceall/t_presenceall.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,1003 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +#include "eunittools.h" + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + + +#include +#include +#include + +#include +#include +#include + +#include "t_presenceall.h" +#include "prfwteststatuseventlistener.h" +#include "prfwtestmessaging.h" +#include "prfwtestmessenger.h" +#include "prfwtestcontextwrappermgr.h" +#include "prfwtestcontextwrapper.h" + +#include "presenceinfoimp.h" +#include "presenceinfofilterimp.h" +#include "prfwtestpresencedatautils.h" +#include "ximpidentityimp.h" +#include "presentitygroupmemberinfoimp.h" +#include "ximpobjecthelpers.h" +#include "prfwtestfilesrvmsg.h" +#include "prfwtestwaithelper.h" +#include "prfwtestlistener.h" + + +#include "presentitygroupcontenteventimp.h" +#include "ximprequestcompleteeventimp.h" +#include "presentitygroupinfoimp.h" +#include "presentitygrouplisteventimp.h" +#include "presentitygroupmemberinfoimp.h" +#include "ximprequestcompleteeventimp.h" +#include "ximprestrictedobjectcollection.h" +#include "ximpobjectfactoryimp.h" + +#include "prfwtesteventfactory.h" + +#include "prfwtestpresencedatautils.h" + +#include "ximpobjecthelpers.h" +#include "presentitygroupinfoimp.h" +#include "presentitygrouplisteventimp.h" +#include "presentitygroupcontenteventimp.h" + +#include "prfwtestfiletool.h" + + +#include "prfwtestrobustnesstools.h" + +_LIT8( KPrefix1, "PreA_" ); +_LIT8( KPrefix2, "PreB_" ); +_LIT8( KPrefix3, "PreC_" ); +_LIT8( KPrefix4, "PreD_" ); + +_LIT( KPrefix5, "PreXX_" ); +_LIT( KPrefix6, "PreYY_" ); + +_LIT( KIdentity, "TestId@hello.world" ); + + +_LIT( KMemberId1, "tel:user1@foo.bar" ); +_LIT( KMemberDisplayName1, "user1" ); + +_LIT( KMemberId2, "tel:user2@foo.bar" ); +_LIT( KMemberDisplayName2, "user2" ); + +_LIT( KGroupId, "PrsDemoGrp" ); +_LIT( KGroupDisplayName, "demo group" ); + + + +// ============================ MEMBER FUNCTIONS =============================== + +// CONSTRUCTION +T_PresenceAll* T_PresenceAll::NewL() + { + T_PresenceAll* self = new( ELeave ) T_PresenceAll; + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + + return self; + } + + +T_PresenceAll::~T_PresenceAll() + { + } + + +void T_PresenceAll::ConstructL() + { + CEUnitTestSuiteClass::ConstructL(); + } + + +T_PresenceAll::T_PresenceAll() + { + } + + + +// =========================================================================== +// TEST CASE SETUP & TEARDOWN METHODS +// =========================================================================== +// + +void T_PresenceAll::Setup_L() + { + __UHEAP_MARK; + PrfwTestRobustness::DoPreCleaning(); + + iWrapperMgr = CXIMPTestContextWrapperMgr::NewL(); + iWrapperMgr->CreateWrapperL(); + } + +void T_PresenceAll::SetupMultiple_L() + { + PrfwTestRobustness::DoPreCleaning(); + + iWrapperMgr = CXIMPTestContextWrapperMgr::NewL(); + iWrapperMgr->CreateWrapperL(); + iWrapperMgr->CreateWrapperL(); + iWrapperMgr->CreateWrapperL(); + } + + +void T_PresenceAll::BindL() + { + CXIMPTestContextWrapper* wrapper0 = iWrapperMgr->GetWrapperL( 0 ); + + wrapper0->BindL( 0 ); + } + +void T_PresenceAll::BindAllL() + { + for( TInt a = 0; a < iWrapperMgr->WrapperCount(); ++a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + wrapper->BindL( 0 ); + } + } + + +void T_PresenceAll::Teardown() + { + delete iWrapperMgr; + iWrapperMgr = NULL; + + REComSession::FinalClose(); + + PrfwTestRobustness::DoPreCleaning(); + User::SetJustInTime( ETrue ); + __UHEAP_MARKEND; + } + +void T_PresenceAll::UnbindL() + { + // Do unbind + CXIMPTestContextWrapper* wrapper0 = iWrapperMgr->GetWrapperL( 0 ); + wrapper0->UnbindL(); + } + +void T_PresenceAll::UnbindAllL() + { + for( TInt a = 0; a < iWrapperMgr->WrapperCount(); ++a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + wrapper->UnbindL(); + } + } + + +// =========================================================================== +// TEST CASES for presentity presence subscription +// =========================================================================== + +// Jani +void T_PresenceAll::T_TMO_demo_Startup_L() + { + EUNIT_PRINT( _L("T_TMO_demo_Startup_L") ); + + BindL(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresencePublishing& presPub = presFeat->PresencePublishing(); + MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization(); + MPresentityGroups& presGroup = presFeat->PresentityGroups(); + MPresenceWatching& presWatch = presFeat->PresenceWatching(); + + + + ////////////////////////////////////////////////////////////////////////// + // SUBSCRIBE OWN PRESENCE + ////////////////////////////////////////////////////////////////////////// + + // Create own presence info filter + CPresenceInfoFilterImp* ownPif = CPresenceInfoFilterImp::NewLC(); // << ownPif + ownPif->AcceptPersonFilterL( NPresenceInfo::NFieldType::KAcceptAll ); + //ownPif->AcceptPersonFilterL( NPresenceInfo::NFieldType::KStatusMessage ); + //ownPif->AcceptPersonFilterL( NPresenceInfo::NFieldType::KAvatar ); + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + + // subscribe own presence + TXIMPRequestId reqId = presPub.SubscribeOwnPresenceL( *ownPif ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Subscribing own presence, complete with error: ") ); + + // verify that SubscribeOwnPresenceL was called + COMMONASSERT( messenger, EXIMPPlgTestSubscribeOwnPresenceCalled, "SubscribeOwnPresenceL was not called", ETrue, NULL ); + + ////////////////////////////////////////////////////////////////////////// + // SUBSCRIBE PRESENCE WATCHER LIST + ////////////////////////////////////////////////////////////////////////// + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + + // subscribe + reqId = presPub.SubscribePresenceWatcherListL(); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Subscribing presence watcher list, complete with error: ") ); + + COMMONASSERT( messenger, EXIMPPlgTestSubscribePresenceWatcherListCalled, "SubscribeWatcherListL was not called", ETrue, NULL ); + + + ////////////////////////////////////////////////////////////////////////// + // SUBSCRIBE PRESENCE BLOCK LIST + ////////////////////////////////////////////////////////////////////////// + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + + // subscribe + reqId = presAuth.SubscribePresenceBlockListL(); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Subscribing presence watcher list, complete with error: ") ); + + // verify that SubscribeBlockListL was called + COMMONASSERT( messenger, EXIMPPlgTestSubscribePresenceBlockListCalled, "SubscribeBlockListL was not called", ETrue, NULL ); + + + + ////////////////////////////////////////////////////////////////////////// + // SUBSCRIBE PRESENTITY GROUP LIST + ////////////////////////////////////////////////////////////////////////// + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + + // subscribe + reqId = presGroup.SubscribePresentityGroupListL(); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Subscribing presentity group list, complete with error: ") ); + + // verify that SubscribePresentityGroupListL was called + messenger->AssertSubscribePresentityGroupListCalled( ETrue ); + + + ////////////////////////////////////////////////////////////////////////// + // EMPTY GROUP LIST EVENT + ///////////////////////////////////////////////////////////////////////// + // According to design, this should not be called + // because the group list is empty, this can be removed + // Create help listener + +/* CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); // << listener2 + + // Create faked server message about group list + SendSrvMsgL( CXIMPTestFileSrvMsg::ETestSrvMsgPresentityGroupList ); + + // expect empty MPresentityGroupList event. + CPresentityGroupListEventImp* event = XIMPTestEventFactory::CreateGroupListEventLCX( + KNullDesC, KNullDesC, + XIMPTestEventFactory::ETestPGLEmpty, + KNullDesC, KNullDesC, + MXIMPDataSubscriptionState::ESubscriptionActive, + MXIMPDataSubscriptionState::EDataAvailable + ); + + listener2->ExpectL( event ); + CleanupStack::Pop( event ); // 4 more items in cleanupstack + + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "HandlePresentityGroupListL failed" ); + CleanupStack::PopAndDestroy( 4 ); // lists + CleanupStack::PopAndDestroy( listener2 ); // >>> listener2 + +*/ + ////////////////////////////////////////////////////////////////////////// + // CREATE PRESENTITY GROUP + ///////////////////////////////////////////////////////////////////////// + + // Setup status event listener for RequestComplete + // This will also produce HandlePresentityGroupListEvent, since the + // the group is subscribed + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + + + MXIMPIdentity* groupId = context->ObjectFactory().NewIdentityLC(); + CleanupStack::Pop(); // groupId + groupId->SetIdentityL( KGroupId ); + + // subscribe + reqId = presGroup.CreatePresentityGroupL( *groupId, KGroupDisplayName ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("CreatePresentityGroupL failed, complete with error: ") ); + + // verify that SubscribePresentityGroupListL was called + messenger->AssertCreatePresentityGroupCalled( ETrue ); + + + + ////////////////////////////////////////////////////////////////////////// + // ADD PRESENTITY GROUP MEMBER + ////////////////////////////////////////////////////////////////////////// + + CXIMPTestListener* listener4 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener4 ); // << listener4 + + MXIMPIdentity* member = context->ObjectFactory().NewIdentityLC(); // << member + member->SetIdentityL( KMemberId1 ); + + + // request complete + TXIMPRequestId reqIdDummy; + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + + // group id + CXIMPIdentityImp* identity2 = CXIMPIdentityImp::NewLC( groupId->Identity() ); + evReqComplete->AppendParamL( identity2 ); + CleanupStack::Pop(identity2); // identity2 + + // id for member info + CXIMPIdentityImp* miId = CXIMPIdentityImp::NewLC( KMemberId1 ); + if(*identity2 != *miId) + { + // nothing to do + } + // member info + CPresentityGroupMemberInfoImp* memInfoImp = + CPresentityGroupMemberInfoImp::NewLC( *miId, KMemberDisplayName1 ); + evReqComplete->AppendParamL( memInfoImp ); + CleanupStack::Pop(memInfoImp); // memInfoImp owned by AppendParamL + CleanupStack::PopAndDestroy( miId ); // copy was made + + listener4->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + // do the call + reqId = presGroup.AddPresentityGroupMemberL( + *groupId, *member, KMemberDisplayName1 ); + + // and wait + EUNIT_ASSERT_DESC( KErrNone == listener4->WaitAndAssertL(), "AddPresentityGroupMemberL (not subscribed) failed" ); + + messenger->AssertAddPresentityGroupMemberCalled( ETrue ); + CleanupStack::PopAndDestroy(); // >>> member + CleanupStack::PopAndDestroy( listener4 );// >>> listener4 + + + ////////////////////////////////////////////////////////////////////////// + // SUBSCRIBE PRESENTITY GROUP CONTENT + ////////////////////////////////////////////////////////////////////////// + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + + // subscribe group content + MXIMPIdentity* identity = context->ObjectFactory().NewIdentityLC(); + identity->SetIdentityL( KGroupId ); // << identity + + reqId = presGroup.SubscribePresentityGroupContentL( *identity ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Subscribe presentity group content, complete with error: ") ); + + COMMONASSERT( messenger, EXIMPPlgTestSubscribePresentityGroupContentCalled, "SubscribeGroupContentL was not called", ETrue, NULL ); + + ////////////////////////////////////////////////////////////////////////// + // SUBSCRIBE PRESENTITY GROUP MEMBERS PRESENCE + ////////////////////////////////////////////////////////////////////////// + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + + // This is the group we are interested in + MXIMPIdentity* group = context->ObjectFactory().NewIdentityLC(); + CleanupStack::Pop(); // group + group->SetIdentityL( KGroupId ); + // Set filter for the group + //CPresenceInfoFilterImp* gpif = CPresenceInfoFilterImp::NewLC(); + //gpif->AcceptPersonFilterL( NPresenceInfo::NFieldType::KStatusMessage ); + //gpif->AcceptPersonFilterL( NPresenceInfo::NFieldType::KAvatar ); + + + + CPresenceInfoFilterImp* gpif = + XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 ); + + CleanupStack::Pop(gpif); // gpif + + // register interest + reqId = presWatch.SubscribePresentityGroupMembersPresenceL( *group, *gpif ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Subscribe presentity group members, complete with error: ") ); + + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestSubscribePresentityGroupMembersPresesenceCalled, "SubscribePresentityGroupMembersPresenceL was not called", ETrue, NULL ); + + delete gpif; + + + ////////////////////////////////////////////////////////////////////////// + // ADD PRESENTITY GROUP MEMBER, GROUP CONTENT SUBSCRIBED + ////////////////////////////////////////////////////////////////////////// + + // Setup status event listener for RequestComplete + // This will also produce HandlePresentityGroupMemberAddedL, since the + // the group is subscribed + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + + MXIMPIdentity* member2 = context->ObjectFactory().NewIdentityLC(); // << member2 + member2->SetIdentityL( KMemberId2 ); + + // do the call + reqId = presGroup.AddPresentityGroupMemberL( + *groupId, *member2, KMemberDisplayName2 ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("AddPresentityGroupMemberL (subscribed) failed, complete with error: ") ); + + + messenger->AssertAddPresentityGroupMemberCalled( ETrue ); + CleanupStack::PopAndDestroy(); // >>> member2 + + + + ////////////////////////////////////////////////////////////////////////// + // GRANT PRESENTITY GROUP MEMBER + ////////////////////////////////////////////////////////////////////////// + + // This is the group we are interested in + MXIMPIdentity* ggroup = context->ObjectFactory().NewIdentityLC(); + CleanupStack::Pop(); // ggroup + ggroup->SetIdentityL( KGroupId ); + // Set filter for the group + CPresenceInfoFilterImp* ggpif = CPresenceInfoFilterImp::NewLC(); + //ggpif->AcceptPersonFilterL( NPresenceInfo::NFieldType::KAcceptAll ); + CleanupStack::Pop(); // ggpif + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + + // grant for all + reqId = presAuth.GrantPresenceForPresentityGroupMembersL( *ggroup, *ggpif ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForPresentityGroupMembersCalled, + "GrantPresenceForPresentityGroupMembersL was not called", ETrue, NULL ); + + delete ggpif; + + + ////////////////////////////////////////////////////////////////////////// + // WITHDRAW PRESENTITY GROUP MEMBER + ////////////////////////////////////////////////////////////////////////// + + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + + // withdraw from all + reqId = presAuth.WithdrawPresenceGrantFromPresentityGroupMembersL( *ggroup ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForPresentityGroupMembersCalled, + "GrantPresenceForPresentityGroupMembersL was not called", ETrue, NULL ); + + delete ggroup; + + + ////////////////////////////////////////////////////////////////////////// + // UNSUBSCRIBE PRESENTITY GROUP MEMBERS + ////////////////////////////////////////////////////////////////////////// + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + + // unregister interest + reqId = presWatch.UnsubscribePresentityGroupMembersPresenceL( *group ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Unsubscribe presentity group members, complete with error: ") ); + + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestUnsubscribePresentityGroupMembersPresesenceCalled, "UnsubscribePresentityGroupMembersPresenceL was not called", ETrue, NULL ); + + + + ////////////////////////////////////////////////////////////////////////// + // UNSUBSCRIBE PRESENTITY GROUP CONTENT + ////////////////////////////////////////////////////////////////////////// + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + + // unsubscribe + reqId = presGroup.UnsubscribePresentityGroupContentL( *identity ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Unsubscribe presentity group content, complete with error: ") ); + + // verify that UnsubscribePresentityGroupContentL was called + messenger->AssertUnsubscribePresentityGroupContentCalled( ETrue ); + + CleanupStack::PopAndDestroy(); // >>> identity + + ////////////////////////////////////////////////////////////////////////// + // UNSUBSCRIBE PRESENCE BLOCK LIST + ////////////////////////////////////////////////////////////////////////// + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + + // subscribe + reqId = presAuth.UnsubscribePresenceBlockListL(); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Unsubscribing presence watcher list, complete with error: ") ); + + // verify that SubscribeBlockListL was called + COMMONASSERT( messenger, EXIMPPlgTestUnsubscribePresenceBlockListCalled, "UnubscribeBlockListL was not called", ETrue, NULL ); + + ////////////////////////////////////////////////////////////////////////// + // UNSUBSCRIBE PRESENTITY GROUP LIST + ////////////////////////////////////////////////////////////////////////// + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + + // unsubscribe + reqId = presGroup.UnsubscribePresentityGroupListL(); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Unsubscribing presentity group list, complete with error: ") ); + + // verify that SubscribePresentityGroupListL was called + messenger->AssertUnsubscribePresentityGroupListCalled( ETrue ); + + + ////////////////////////////////////////////////////////////////////////// + // UNSUBSCRIBE PRESENCE WATCHER LIST + ////////////////////////////////////////////////////////////////////////// + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + + // unsubscribe + reqId = presPub.UnsubscribePresenceWatcherListL(); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Unsubscribing presence watcher list, complete with error: ") ); + + // verify that UnsubscribeWatcherListL was called + COMMONASSERT( messenger, EXIMPPlgTestUnsubscribePresenceWatcherListCalled, "UnsubscribeWatcherListL was not called", ETrue, NULL ); + + + //////////////////////////////////////////////////////////////////////////// + // UNSUBSCRIBE OWN PRESENCE + //////////////////////////////////////////////////////////////////////////// + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + + // unsubscribe own presence + reqId = presPub.UnsubscribeOwnPresenceL(); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + + wrapper->VerifyEventStackL( _L8("Unsubscribing own presence, complete with error: ") ); + + // verify that UnsubscribeOwnPresenceL was called + COMMONASSERT( messenger, EXIMPPlgTestUnsubscribeOwnPresenceCalled, "UnsubscribeOwnPresenceL was not called", ETrue, NULL ); + + CleanupStack::PopAndDestroy( ownPif ); // >>> ownPif + delete group; + delete groupId; + + + UnbindL(); + + wrapper = NULL; + context = NULL; + messenger = NULL; + + + + } + +// Grant/Withdraw from group +void T_PresenceAll::T_GrantWithdrawGroup_L() + { + EUNIT_PRINT( _L("T_GrantWithdrawGroup_L") ); + + BindL(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresencePublishing& presPub = presFeat->PresencePublishing(); + MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization(); + MPresentityGroups& presGroup = presFeat->PresentityGroups(); + MPresenceWatching& presWatch = presFeat->PresenceWatching(); + + + + ////////////////////////////////////////////////////////////////////////// + // CREATE PRESENTITY GROUP + ///////////////////////////////////////////////////////////////////////// + + // Setup status event listener for RequestComplete + // This will also produce HandlePresentityGroupListEvent, since the + // the group is subscribed + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + + + MXIMPIdentity* groupId = context->ObjectFactory().NewIdentityLC(); + CleanupStack::Pop(); // groupId + groupId->SetIdentityL( KGroupId ); + + // subscribe + TXIMPRequestId reqId = presGroup.CreatePresentityGroupL( *groupId, KGroupDisplayName ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("CreatePresentityGroupL failed, complete with error: ") ); + + // verify that SubscribePresentityGroupListL was called + messenger->AssertCreatePresentityGroupCalled( ETrue ); + + + + ////////////////////////////////////////////////////////////////////////// + // ADD PRESENTITY GROUP MEMBER + ////////////////////////////////////////////////////////////////////////// + + CXIMPTestListener* listener4 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener4 ); // << listener4 + + MXIMPIdentity* member = context->ObjectFactory().NewIdentityLC(); // << member + member->SetIdentityL( KMemberId1 ); + + + // request complete + TXIMPRequestId reqIdDummy; + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + + // group id + CXIMPIdentityImp* identity2 = CXIMPIdentityImp::NewLC( groupId->Identity() ); + evReqComplete->AppendParamL( identity2 ); + CleanupStack::Pop(); // identity2 + + // id for member info + CXIMPIdentityImp* miId = CXIMPIdentityImp::NewLC( KMemberId1 ); + // member info + CPresentityGroupMemberInfoImp* memInfoImp = + CPresentityGroupMemberInfoImp::NewLC( *miId, KMemberDisplayName1 ); + evReqComplete->AppendParamL( memInfoImp ); + CleanupStack::Pop(); // memInfoImp owned by AppendParamL + CleanupStack::PopAndDestroy( miId ); // copy was made + + listener4->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + // do the call + reqId = presGroup.AddPresentityGroupMemberL( + *groupId, *member, KMemberDisplayName1 ); + + // and wait + EUNIT_ASSERT_DESC( KErrNone == listener4->WaitAndAssertL(), "AddPresentityGroupMemberL (not subscribed) failed" ); + + messenger->AssertAddPresentityGroupMemberCalled( ETrue ); + CleanupStack::PopAndDestroy(); // >>> member + CleanupStack::PopAndDestroy( listener4 );// >>> listener4 + + delete groupId; + + ////////////////////////////////////////////////////////////////////////// + // ADD PRESENTITY GROUP MEMBER, GROUP CONTENT SUBSCRIBED + ////////////////////////////////////////////////////////////////////////// + + // Setup status event listener for RequestComplete + // This will also produce HandlePresentityGroupMemberAddedL, since the + // the group is subscribed + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + + MXIMPIdentity* member2 = context->ObjectFactory().NewIdentityLC(); // << member2 + member2->SetIdentityL( KMemberId2 ); + + // do the call + reqId = presGroup.AddPresentityGroupMemberL( + *groupId, *member2, KMemberDisplayName2 ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("AddPresentityGroupMemberL (subscribed) failed, complete with error: ") ); + + + messenger->AssertAddPresentityGroupMemberCalled( ETrue ); + CleanupStack::PopAndDestroy(); // >>> member2 + + + + ////////////////////////////////////////////////////////////////////////// + // GRANT PRESENTITY GROUP MEMBER + ////////////////////////////////////////////////////////////////////////// + + // This is the group we are interested in + MXIMPIdentity* ggroup = context->ObjectFactory().NewIdentityLC(); + CleanupStack::Pop(); // ggroup + ggroup->SetIdentityL( KGroupId ); + // Set filter for the group + CPresenceInfoFilterImp* ggpif = CPresenceInfoFilterImp::NewLC(); + ggpif->AcceptPersonFilterL( NPresenceInfo::NFieldType::KAcceptAll ); + CleanupStack::Pop(); // ggpif + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + + // grant for all + reqId = presAuth.GrantPresenceForPresentityGroupMembersL( *ggroup, *ggpif ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForPresentityGroupMembersCalled, + "GrantPresenceForPresentityGroupMembersL was not called", ETrue, NULL ); + + delete ggpif; + + + + ////////////////////////////////////////////////////////////////////////// + // WITHDRAW PRESENTITY GROUP MEMBER + ////////////////////////////////////////////////////////////////////////// + + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + + // withdraw from all + reqId = presAuth.WithdrawPresenceGrantFromPresentityGroupMembersL( *ggroup ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForPresentityGroupMembersCalled, + "GrantPresenceForPresentityGroupMembersL was not called", ETrue, NULL ); + + delete ggroup; + + UnbindL(); + + wrapper = NULL; + context = NULL; + messenger = NULL; + + } + + +// =========================================================================== +// SETUP HELPERS FOR THE LISTENER +// =========================================================================== +// +void T_PresenceAll::SetupListenerReqCompleteL( CXIMPTestContextWrapper* aWrapper, TXIMPTestStatusEventTemplate aEventType ) + { + RArray< TInt32 > array; + CleanupClosePushL( array ); + array.Append( MXIMPContextStateEvent::KInterfaceId ); + array.Append( MPresentityPresenceEvent::KInterfaceId ); + aWrapper->SetupListenerReqCompleteL( aEventType, &array ); + CleanupStack::PopAndDestroy(); // array + } + +void T_PresenceAll::SetupListenerReqCompleteAllowEventsL( CXIMPTestContextWrapper* aWrapper, TXIMPTestStatusEventTemplate aEventType ) + { + RArray< TInt32 > array; + CleanupClosePushL( array ); + array.AppendL( MXIMPRequestCompleteEvent::KInterfaceId ); + array.AppendL( MXIMPContextStateEvent::KInterfaceId ); + array.AppendL( MPresentityPresenceEvent::KInterfaceId ); + aWrapper->SetupListenerReqCompleteL( aEventType, &array ); + CleanupStack::PopAndDestroy(); // array + } + +void T_PresenceAll::SendSrvMsgL( + const TDesC& aUri, const TDesC& aDispName, + TInt aMsgType ) + { + // we'll use hard-coded wrapper 0 instance for now. + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + + // create a group info contained within the server-originated + // faked message + CXIMPIdentityImp* groupId = CXIMPIdentityImp::NewLC( aUri ); + CPresentityGroupInfoImp* groupItem = CPresentityGroupInfoImp::NewLC( *groupId, aDispName ); + HBufC8* packet = NULL; + if( aMsgType == CXIMPTestFileSrvMsg::ETestSrvMsgPresentityGroupDelete ) + { + packet = TXIMPObjectPacker< CXIMPIdentityImp >::PackL( *groupId ); + } + else + { + packet = TXIMPObjectPacker< CPresentityGroupInfoImp >::PackL( *groupItem ); + } + CleanupStack::PushL( packet ); + + // use filetool to send it for plugin. + CXIMPTestFileSrvMsg* srvMsg = CXIMPTestFileSrvMsg::NewL( aMsgType, *packet ); + CleanupStack::PushL( srvMsg ); + wrapper->FileTool().CleanAllL(); + wrapper->FileTool().SrvMsgStoreL( srvMsg ); + CleanupStack::PopAndDestroy( 4, groupId ); // srvMsg, packet, groupItem, groupId + } + +// send a faked server-originated message with empty contents +// +void T_PresenceAll::SendSrvMsgL( TInt aMsgType ) + { + // we'll use hard-coded wrapper 0 instance for now. + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + + // create a server-originated faked message with empty contents + RXIMPObjOwningPtrArray groupList; + + HBufC8* packedArray = TXIMPObjectPacker::PackArrayL( groupList ); + CleanupStack::PushL( packedArray ); + + // use filetool to send it for plugin. + CXIMPTestFileSrvMsg* srvMsg = CXIMPTestFileSrvMsg::NewL( aMsgType, + *packedArray ); + CleanupStack::PushL( srvMsg ); + wrapper->FileTool().CleanAllL(); + wrapper->FileTool().SrvMsgStoreL( srvMsg ); + CleanupStack::PopAndDestroy( 2 ); // srvMsg, packedArray + } + + +void T_PresenceAll::T_BindUnbindL() + { + EUNIT_PRINT( _L("T_BindUnbindL") ); + + BindL(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + + UnbindL(); + + wrapper = NULL; + context = NULL; + messenger = NULL; + } +// =========================================================================== +// TEST CASE TABLE +// =========================================================================== +// +EUNIT_BEGIN_TEST_TABLE( + T_PresenceAll, + "XIMP presence all tests", + "MODULE" ) + +PRFW_DECORATED_TEST( + "TMO_demo_Startup", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_TMO_demo_Startup_L, + Teardown ) + +PRFW_DECORATED_TEST( + "BindUnbind", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_BindUnbindL, + Teardown ) + +PRFW_DECORATED_TEST( + "GrantWithdrawGroup", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_GrantWithdrawGroup_L, + Teardown ) + +EUNIT_END_TEST_TABLE + + +// =========================================================================== +// TEST SUITE CONSTRUCTION +// =========================================================================== +// +EXPORT_C MEUnitTest* CreateTestSuiteL() + { + return T_PresenceAll::NewL(); + } + + +// end of file diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presenceall/t_presenceall.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presenceall/t_presenceall.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,101 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef T_PRESENCEALL_H +#define T_PRESENCEALL_H + +#include +#include +#include "prfwteststatuseventlistener.h" +#include "prfwtestmessaging.h" + +class CXIMPTestContextWrapper; +class CXIMPTestContextWrapperMgr; +class CXIMPTestMessenger; + +/** + * XIMP Framework Eunit tests. + * + * Tests for XIMP session management services. + * + * @since S60 v4.0 + */ +class T_PresenceAll : public CEUnitTestSuiteClass + { + +public: + static T_PresenceAll* NewL(); + virtual ~T_PresenceAll(); + + +private: + T_PresenceAll(); + void ConstructL(); + + + +private: // Test case functions + + void Setup_L(); + void SetupMultiple_L(); + void BindL(); + void BindAllL(); + void Teardown(); + void UnbindL(); + void UnbindAllL(); + + void T_TMO_demo_Startup_L(); + void T_GrantWithdrawGroup_L(); + + void T_BindUnbindL(); + +private: // Test helpers + +void SendSrvMsgL( + const TDesC& aUri, const TDesC& aDispName, + TInt aMsgType ); + + +// send a faked server-originated message with empty contents +// +void SendSrvMsgL( TInt aMsgType ); + + void SetupListenerReqCompleteL( CXIMPTestContextWrapper* aWrapper, TXIMPTestStatusEventTemplate aEventType ); + void SetupListenerReqCompleteAllowEventsL( CXIMPTestContextWrapper* aWrapper, TXIMPTestStatusEventTemplate aEventTypes ); + +private: // Test data + + /** + * Eunit test case table declaration. + */ + EUNIT_DECLARE_TEST_TABLE; + + // owned + CXIMPTestContextWrapperMgr* iWrapperMgr; + + }; + + +#endif // t_presenceall_H + + + +// end of file + + + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presenceall/t_presenceall.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presenceall/t_presenceall.mmp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,46 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "../../tsrcutils/eunitcommon/eunittstdllbase.hrh" +#include "../../tsrcutils/processmaster/pm.h" + +TARGET t_presenceall.dll +CAPABILITY ALL -TCB +SOURCEPATH . +SOURCE t_presenceall.cpp + + +USERINCLUDE ../../../../../ximpfw/core/srcdatamodel +USERINCLUDE ../../../../../ximpfw/presence/srcpresencedatamodel +USERINCLUDE ../../../../../ximpfw/presence/srcpresencedatamodel/presentitygroups +USERINCLUDE ../../../../../ximpfw/presence/srcpresencedatamodel/presencewatching +USERINCLUDE ../../../../../ximpfw/presence/srcpresencedatamodel/presenceauthorization +USERINCLUDE ../../../../../ximpfw/presence/srcpresencedatamodel/presencepublishing +USERINCLUDE ../../../../../ximpfw/presence/srcpresencedatamodel/presenceinfo +USERINCLUDE ../../../../../ximpfw/core/srcutils + +LIBRARY ecom.lib +LIBRARY bafl.lib +LIBRARY ximpdatamodel.lib +LIBRARY presencedatamodel.lib +LIBRARY estor.lib +LIBRARY ximputils.lib +LIBRARY eunit.lib + +// end of file + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presenceauthorization/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presenceauthorization/bld.inf Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,25 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Build information file for t_presenceauthorization.dll +* +*/ + + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +PRJ_TESTMMPFILES +t_presenceauthorization.mmp diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presenceauthorization/t_presenceauthorization.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presenceauthorization/t_presenceauthorization.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,2061 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +#include "eunittools.h" + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "prfwtestlistener.h" + +#include +#include +#include + +#include "t_presenceauthorization.h" +#include "prfwteststatuseventlistener.h" +#include "prfwtestmessaging.h" +#include "prfwtestmessenger.h" +#include "prfwtestcontextwrappermgr.h" +#include "prfwtestcontextwrapper.h" + +#include "presenceinfoimp.h" +#include "presenceinfofilterimp.h" +#include "prfwtestpresencedatautils.h" +#include "ximpidentityimp.h" +#include "presentitygroupmemberinfoimp.h" +#include "ximpobjecthelpers.h" +#include "prfwtestfilesrvmsg.h" +#include "prfwtestwaithelper.h" + +#include "prfwtestrobustnesstools.h" + + +#include "presentitygroupcontenteventimp.h" +#include "ximprequestcompleteeventimp.h" +#include "presentitygroupinfoimp.h" +#include "presentitygrouplisteventimp.h" +#include "presentitygroupmemberinfoimp.h" +#include "ximprequestcompleteeventimp.h" +#include "ximprestrictedobjectcollection.h" +#include "ximpobjectfactoryimp.h" + +_LIT8( KIdentity1, "Identity1" ); +_LIT8( KIdentity2, "Identity2" ); +_LIT8( KIdentity3, "Identity3" ); + +_LIT( KIdentity1_16, "Identity1" ); +_LIT( KIdentity2_16, "Identity2" ); +_LIT( KIdentity3_16, "Identity3" ); + + +_LIT( KGroupId, "Group" ); +_LIT( KGroupId1, "Group1" ); +_LIT( KGroupId2, "Group2" ); + + +_LIT( KGroupDisplayName, "GroupDisplayName" ); + + +_LIT8( KPrefix1, "PreA_" ); +_LIT8( KPrefix2, "PreB_" ); +_LIT8( KPrefix3, "PreC_" ); +_LIT8( KPrefix4, "PreD_" ); + +_LIT( KIdentity, "TestId@hello.world" ); + +// ============================ MEMBER FUNCTIONS =============================== + +// CONSTRUCTION +T_PresenceAuthorization* T_PresenceAuthorization::NewL() + { + T_PresenceAuthorization* self = new( ELeave ) T_PresenceAuthorization; + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + + return self; + } + + +T_PresenceAuthorization::~T_PresenceAuthorization() + { + } + + +void T_PresenceAuthorization::ConstructL() + { + CEUnitTestSuiteClass::ConstructL(); + } + + +T_PresenceAuthorization::T_PresenceAuthorization() + { + } + + + +// =========================================================================== +// TEST CASE SETUP & TEARDOWN METHODS +// =========================================================================== +// + +void T_PresenceAuthorization::Setup_L() + { + PrfwTestRobustness::DoPreCleaning(); + + iWrapperMgr = CXIMPTestContextWrapperMgr::NewL(); + iWrapperMgr->CreateWrapperL(); + } + +void T_PresenceAuthorization::SetupMultiple_L() + { + PrfwTestRobustness::DoPreCleaning(); + + iWrapperMgr = CXIMPTestContextWrapperMgr::NewL(); + iWrapperMgr->CreateWrapperL(); + iWrapperMgr->CreateWrapperL(); + iWrapperMgr->CreateWrapperL(); + } + + +void T_PresenceAuthorization::BindL() + { + CXIMPTestContextWrapper* wrapper0 = iWrapperMgr->GetWrapperL( 0 ); + + wrapper0->BindL( 0 ); + } + +void T_PresenceAuthorization::BindAllL() + { + for( TInt a = 0; a < iWrapperMgr->WrapperCount(); ++a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + wrapper->BindL( 0 ); + } + } + + +void T_PresenceAuthorization::Teardown() + { + delete iWrapperMgr; + iWrapperMgr = NULL; + + REComSession::FinalClose(); + + PrfwTestRobustness::DoPreCleaning(); + } + +void T_PresenceAuthorization::UnbindL() + { + // Do unbind + CXIMPTestContextWrapper* wrapper0 = iWrapperMgr->GetWrapperL( 0 ); + wrapper0->UnbindL(); + } + +void T_PresenceAuthorization::UnbindAllL() + { + for( TInt a = 0; a < iWrapperMgr->WrapperCount(); ++a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + wrapper->UnbindL(); + } + } + + +// =========================================================================== +// TEST CASES for presentity authorization +// =========================================================================== + +void T_PresenceAuthorization::T_GrantPresenceForPresentity_L() + { + EUNIT_PRINT( _L("Grant presence for presentity") ); + +// INITIALIZE + + BindL(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization(); + + CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 ); + CPresenceInfoFilterImp* pif = + XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 ); + +// GRANT + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + + // register interest + TXIMPRequestId reqId = presAuth.GrantPresenceForPresentityL( *identity, *pif ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForPresentityCalled, + "GrantPresenceForPresentityL was not called", ETrue, NULL ); + +// GRANT AGAIN + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + messenger->SetValueFor( EXIMPPlgTestGrantPresenceForPresentityCalled, 0 ); + + // register interest + reqId = presAuth.GrantPresenceForPresentityL( *identity, *pif ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForPresentityCalled, + "GrantPresenceForPresentityL was not called", EFalse, + "GrantPresenceForPresentityL was called" ); + +// WITHDRAW + + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + // register interest + reqId = presAuth.WithdrawPresenceGrantFromPresentityL( *identity ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Grantin presence to presentity, complete with error: ") ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestWithdrawPresenceFromPresentityCalled, + "WithdrawPresenceForPresentityL was not called", ETrue, NULL ); + +// DEINITIALIZE + + CleanupStack::PopAndDestroy( 2, identity ); //pif, identity + UnbindL(); + } + +// ============================================================================================== + +void T_PresenceAuthorization::T_WithdrawNotGrantedPresenceFromPresentity_L() + { + EUNIT_PRINT( _L("Withdraw presence from presentity not granted") ); + +// INITIALIZE + + BindL(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization(); + + CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 ); + +// WITHDRAW + + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + // register interest + TXIMPRequestId reqId = presAuth.WithdrawPresenceGrantFromPresentityL( *identity ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Grantin presence to presentity, complete with error: ") ); + // Changed for OPAA-73BCS( + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestWithdrawPresenceFromPresentityCalled, + "WithdrawPresenceForPresentityL was not called", ETrue/*EFalse*/, + "WithdrawPresenceForPresentityL was called" ); + +// DEINITIALIZE + + CleanupStack::PopAndDestroy( identity ); //identity + UnbindL(); + } + +// ============================================================================================== + + +void T_PresenceAuthorization::T_GrantPresenceForPresentityChangeId_L() + { + EUNIT_PRINT( _L("Grant presence for presentity change id") ); + +// INITIALIZE + + BindL(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // Get the management interface + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization(); + + + CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 ); + CPresenceInfoFilterImp* pif = + XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 ); + +// ID CHANGE REQUEST TO ADAPTATION + + MXIMPIdentity* identityParam = context->ObjectFactory().NewIdentityLC(); + identityParam->SetIdentityL( KIdentity ); + + CXIMPIdentityImp* identityParamImp = + ( CXIMPIdentityImp* ) identityParam->GetInterface( + CXIMPIdentityImp::KClassId, + MXIMPBase::EPanicIfUnknown ); + HBufC8* packedId = TXIMPObjectPacker< CXIMPIdentityImp >::PackL( *identityParamImp ); + CleanupStack::PopAndDestroy(); // identityParam + CleanupStack::PushL( packedId ); + CXIMPTestFileSrvMsg* srvMsg = CXIMPTestFileSrvMsg::NewL( CXIMPTestFileSrvMsg::ETestSrvMsgReqParamIdentity, + *packedId ); + CleanupStack::PopAndDestroy( packedId ); + CleanupStack::PushL( srvMsg ); + wrapper->FileTool().SrvMsgStoreL( srvMsg ); + CleanupStack::PopAndDestroy( srvMsg ); + + // Wait for server to handle srvmsg. + CXIMPTestWaitHelper* wait = CXIMPTestWaitHelper::NewL(); + CleanupStack::PushL( wait ); + wait->WaitForL( 2 ); + CleanupStack::PopAndDestroy( wait ); + +// GRANT + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + + // register interest + TXIMPRequestId reqId = presAuth.GrantPresenceForPresentityL( *identity, *pif ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForPresentityCalled, + "GrantPresenceForPresentityL was not called", ETrue, NULL ); + +// DEINITIALIZE + + CleanupStack::PopAndDestroy( 2, identity ); //pif, identity + UnbindL(); + } + +// ============================================================================================== + +void T_PresenceAuthorization::T_WithdrawNotGrantedPresenceFromPresentity_Multiple_L() + { + EUNIT_PRINT( _L("Withdraw presence from presentity not granted multiple clients") ); + + BindAllL(); + + CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 ); + CPresenceInfoFilterImp* pif = + XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 ); + +// GRANT ALL BUT FIRST + + TInt countOfWrappers = iWrapperMgr->WrapperCount(); + TInt a(0); + for( a = countOfWrappers - 1; a >= 1; --a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization(); + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + + // register interest + TXIMPRequestId reqId = presAuth.GrantPresenceForPresentityL( *identity, *pif ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForPresentityCalled, + "GrantPresenceForPresentityL was not called", + ( a > 1 ) ? ETrue : EFalse, + "GrantPresenceForPresentityL was called" ); + } + +// WITHDRAW + + for( a = 0; a < countOfWrappers; ++a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization(); + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); // allow events after reqcomplete + + // register interest + TXIMPRequestId reqId = presAuth.WithdrawPresenceGrantFromPresentityL( *identity ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Subscribing presentity presence, complete with error: ") ); + // Changed for OPAA-73BCS8 + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestWithdrawPresenceFromPresentityCalled, + "WithdrawPresenceForPresentityL was not called", + ( a < ( countOfWrappers -1 ) /*a < 2*/ ) ? EFalse : ETrue, + "WithdrawPresenceForPresentityL was called" ); + } + + CleanupStack::PopAndDestroy( pif ); + CleanupStack::PopAndDestroy( identity ); + + UnbindAllL(); + } + + +// ============================================================================================== + +void T_PresenceAuthorization::T_ErrFromPlg_LeaveOnGrantPresenceForPresentity_L() + { + EUNIT_PRINT( _L("Error from plug-in in grant presence for presentity") ); + +// INITIALIZE + + BindL(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization(); + + + CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 ); + CPresenceInfoFilterImp* pif = + XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 ); + +// GRANT + + messenger->SetLeave( KErrAbort ); + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_PresentitySubscribeFailKErrAbort ); + + // register interest + TXIMPRequestId reqId = presAuth.GrantPresenceForPresentityL( *identity, *pif ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForPresentityCalled, + "GrantPresenceForPresentityL was not called", EFalse, + "GrantPresenceForPresentityL was called" ); + + messenger->SetLeave( KErrNone ); + +// DEINITIALIZE + + CleanupStack::PopAndDestroy( 2, identity ); //pif, identity + UnbindL(); + } + + +// ============================================================================================== + +void T_PresenceAuthorization::T_ErrFromPlg_LeaveOnWithdrawPresenceFromPresentity_L() + { + EUNIT_PRINT( _L("Error from plug-in in withdraw presence from presentity") ); + +// INITIALIZE + + BindL(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization(); + + + CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 ); + CPresenceInfoFilterImp* pif = + XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 ); + +// GRANT + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + + // register interest + TXIMPRequestId reqId = presAuth.GrantPresenceForPresentityL( *identity, *pif ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForPresentityCalled, + "GrantPresenceForPresentityL was not called", ETrue, + "GrantPresenceForPresentityL was called" ); + +// WITHDRAW + + messenger->SetLeave( KErrAbort ); + + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_PresentitySubscribeFailKErrAbort ); + // register interest + reqId = presAuth.WithdrawPresenceGrantFromPresentityL( *identity ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Grantin presence to presentity, complete with error: ") ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestWithdrawPresenceFromPresentityCalled, + "WithdrawPresenceGrantFromPresentityL was not called", EFalse, + "WithdrawPresenceGrantFromPresentityL was called" ); + + messenger->SetLeave( KErrNone ); + +// DEINITIALIZE + + CleanupStack::PopAndDestroy( 2, identity ); //pif, identity + UnbindL(); + } + +// ============================================================================================== + +void T_PresenceAuthorization::T_GrantPresenceForPresentity_Multiple_L() + { + EUNIT_PRINT( _L("Grant presence for presentity multiple clients") ); + + BindAllL(); + + CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 ); + CPresenceInfoFilterImp* pif = + XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 ); + +// GRANT + + TInt countOfWrappers = iWrapperMgr->WrapperCount(); + TInt a(0); + for( a = 0; a < countOfWrappers; ++a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization(); + + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + + // register interest + TXIMPRequestId reqId = presAuth.GrantPresenceForPresentityL( *identity, *pif ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForPresentityCalled, + "GrantPresenceForPresentityL was not called", + ( a == 0 ) ? ETrue : EFalse, + "GrantPresenceForPresentityL was called" ); + } + +// GRANT AGAIN + + for( a = 0; a < countOfWrappers; ++a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization(); + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + messenger->SetValueFor( EXIMPPlgTestGrantPresenceForPresentityCalled, 0 ); + + // register interest + TXIMPRequestId reqId = presAuth.GrantPresenceForPresentityL( *identity, *pif ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForPresentityCalled, + "GrantPresenceForPresentityL was not called", EFalse, + "GrantPresenceForPresentityL was called" ); + } + + +// WITHDRAW + + for( a = 0; a < countOfWrappers; ++a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization(); + + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); // allow events after reqcomplete + + // register interest + TXIMPRequestId reqId = presAuth.WithdrawPresenceGrantFromPresentityL( *identity ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Subscribing presentity presence, complete with error: ") ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestWithdrawPresenceFromPresentityCalled, + "WithdrawPresenceForPresentityL was not called", + ( a < 2 ) ? EFalse : ETrue, + "WithdrawPresenceForPresentityL was called" ); + } + + CleanupStack::PopAndDestroy( pif ); + CleanupStack::PopAndDestroy( identity ); + + UnbindAllL(); + } + + +// ============================================================================================== + +void T_PresenceAuthorization::T_WithdrawNotGrantedPresenceFromGroupMembers_L() + { + EUNIT_PRINT( _L("Withdraw presence from group members not granted") ); + +// INITIALIZE + + BindL(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization(); + + + CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 ); + +// WITHDRAW + + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + // register interest + TXIMPRequestId reqId = presAuth.WithdrawPresenceGrantFromPresentityGroupMembersL( *identity ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Withdraw not granted group members, complete with error: ") ); + // Changed for OPAA-73BCS8 + COMMONASSERT( messenger, EXIMPPlgTestWithdrawPresenceFromPresentityGroupMembersCalled, + "WithdrawPresenceGrantFromPresentityGroupMembersL was not called", ETrue/*EFalse*/, + "WithdrawPresenceGrantFromPresentityGroupMembersL was called" ); + +// DEINITIALIZE + + CleanupStack::PopAndDestroy( identity ); //identity + UnbindL(); + } + + +// ============================================================================================== + +void T_PresenceAuthorization::T_WithdrawNotGrantedPresenceFromGroupMembers_Multiple_L() + { + EUNIT_PRINT( _L("Withdraw presence from group members not granted multiple clients") ); + + BindAllL(); + + CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 ); + CPresenceInfoFilterImp* pif = + XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 ); + +// GRANT ALL BUT FIRST + + TInt countOfWrappers = iWrapperMgr->WrapperCount(); + TInt a(0); + for( a = countOfWrappers - 1; a >= 1; --a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization(); + + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + + // register interest + TXIMPRequestId reqId = presAuth.GrantPresenceForPresentityGroupMembersL( *identity, *pif ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForPresentityGroupMembersCalled, + "GrantPresenceForPresentityGroupMembersL was not called", + ( a > 1 ) ? ETrue : EFalse, + "GrantPresenceForPresentityGroupMembersL was called" ); + } + +// WITHDRAW + + for( a = 0; a < countOfWrappers; ++a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization(); + + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); // allow events after reqcomplete + + // register interest + TXIMPRequestId reqId = presAuth.WithdrawPresenceGrantFromPresentityGroupMembersL( *identity ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Subscribing presentity presence, complete with error: ") ); + // Changed for OPAA-73BCS8 + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestWithdrawPresenceFromPresentityGroupMembersCalled, + "WithdrawPresenceForPresentityGroupMembersL was not called", + ( a < ( countOfWrappers - 1 )/*a < 2*/ ) ? EFalse : ETrue, + "WithdrawPresenceForPresentityGroupMembersL was called" ); + } + + CleanupStack::PopAndDestroy( pif ); + CleanupStack::PopAndDestroy( identity ); + + UnbindAllL(); + } + +// ============================================================================================== + + +void T_PresenceAuthorization::T_GrantPresenceForGroupMembers_Multiple_L() + { + EUNIT_PRINT( _L("Grant presence for group members multiple clients") ); + + BindAllL(); + + CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 ); + CPresenceInfoFilterImp* pif = + XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 ); + +// GRANT + + TInt countOfWrappers = iWrapperMgr->WrapperCount(); + TInt a(0); + for( a = 0; a < countOfWrappers; ++a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization(); + + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + + // register interest + TXIMPRequestId reqId = presAuth.GrantPresenceForPresentityGroupMembersL( *identity, *pif ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForPresentityGroupMembersCalled, + "GrantPresenceForPresentityGroupMembersL was not called", + ( a == 0 ) ? ETrue : EFalse, + "GrantPresenceForPresentityGroupMembersL was called" ); + } + +// GRANT AGAIN + + for( a = 0; a < countOfWrappers; ++a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization(); + + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + messenger->SetValueFor( EXIMPPlgTestGrantPresenceForPresentityGroupMembersCalled, 0 ); + + // register interest + TXIMPRequestId reqId = presAuth.GrantPresenceForPresentityGroupMembersL( *identity, *pif ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForPresentityGroupMembersCalled, + "GrantPresenceForPresentityGroupMembersL was not called", EFalse, + "GrantPresenceForPresentityGroupMembersL was called" ); + } + + +// WITHDRAW + + for( a = 0; a < countOfWrappers; ++a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization(); + + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); // allow events after reqcomplete + + // register interest + TXIMPRequestId reqId = presAuth.WithdrawPresenceGrantFromPresentityGroupMembersL( *identity ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Subscribing presentity presence, complete with error: ") ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestWithdrawPresenceFromPresentityGroupMembersCalled, + "WithdrawPresenceForPresentityGroupMembersL was not called", + ( a < 2 ) ? EFalse : ETrue, + "WithdrawPresenceForPresentityGroupMembersL was called" ); + } + + CleanupStack::PopAndDestroy( pif ); + CleanupStack::PopAndDestroy( identity ); + + UnbindAllL(); + } + +// ============================================================================================== + +void T_PresenceAuthorization::T_ErrFromPlg_LeaveOnGrantPresenceForGroupMembers_L() + { + EUNIT_PRINT( _L("Error from plug-in in grant presence for group members") ); + +// INITIALIZE + + BindL(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization(); + + CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 ); + CPresenceInfoFilterImp* pif = + XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 ); + +// GRANT + + messenger->SetLeave( KErrAbort ); + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_PresentitySubscribeFailKErrAbort ); + + // register interest + TXIMPRequestId reqId = presAuth.GrantPresenceForPresentityGroupMembersL( *identity, *pif ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForPresentityGroupMembersCalled, + "GrantPresenceForPresentityGroupMembersL was not called", EFalse, + "GrantPresenceForPresentityGroupMembersL was called" ); + + messenger->SetLeave( KErrNone ); + +// DEINITIALIZE + + CleanupStack::PopAndDestroy( 2, identity ); //pif, identity + UnbindL(); + } + +// ============================================================================================== + +void T_PresenceAuthorization::T_ErrFromPlg_LeaveOnWithdrawPresenceFromGroupMembers_L() + { + EUNIT_PRINT( _L("Error from plug-in in withdraw presence from group members") ); + +// INITIALIZE + + BindL(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization(); + + CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 ); + CPresenceInfoFilterImp* pif = + XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 ); + +// GRANT + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + + // register interest + TXIMPRequestId reqId = presAuth.GrantPresenceForPresentityGroupMembersL( *identity, *pif ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForPresentityGroupMembersCalled, + "GrantPresenceForPresentityGroupMembersL was not called", ETrue, + "GrantPresenceForPresentityGroupMembersL was called" ); + +// WITHDRAW + + messenger->SetLeave( KErrAbort ); + + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_PresentitySubscribeFailKErrAbort ); + // register interest + reqId = presAuth.WithdrawPresenceGrantFromPresentityGroupMembersL( *identity ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Grantin presence to presentity, complete with error: ") ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestWithdrawPresenceFromPresentityGroupMembersCalled, + "WithdrawPresenceGrantFromPresentityGroupMembersL was not called", EFalse, + "WithdrawPresenceGrantFromPresentityGroupMembersL was called" ); + + messenger->SetLeave( KErrNone ); + +// DEINITIALIZE + + CleanupStack::PopAndDestroy( 2, identity ); //pif, identity + UnbindL(); + } + +// ============================================================================================== + +// To Everyone, empty filter +void T_PresenceAuthorization::T_GrantPresenceForEveryone_L() + { + EUNIT_PRINT( _L("Grant presence for everyone") ); + + BindL(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization(); + + CPresenceInfoFilterImp* pif = XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 ); + +// GRANT + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + + TXIMPRequestId reqId = presAuth.GrantPresenceForEveryoneL( *pif ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForEveryoneCalled, "GrantPresenceForEveryoneL was not called", ETrue, NULL ); + +// GRANT AGAIN + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + messenger->SetValueFor( EXIMPPlgTestGrantPresenceForEveryoneCalled, 0 ); + + reqId = presAuth.GrantPresenceForEveryoneL( *pif ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForEveryoneCalled, "GrantPresenceForEveryoneL was not called", EFalse, "GrantPresenceForEveryoneL was called" ); + +// WITHDRAW + + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + // register interest + reqId = presAuth.WithdrawPresenceGrantFromEveryoneL(); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Granting presence to everyone, complete with error: ") ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestWithdrawPresenceFromEveryoneCalled, "WithdrawPresenceForEveryoneL was not called", ETrue, NULL ); + + CleanupStack::PopAndDestroy( pif ); //pif + UnbindL(); + } + +// ============================================================================================== + +void T_PresenceAuthorization::T_ErrFromPlg_LeaveOnGrantPresenceForEveryone_L() + { + EUNIT_PRINT( _L("Error from plug-in in grant presence for everyone") ); + +// INITIALIZE + + BindL(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization(); + + CPresenceInfoFilterImp* pif = + XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 ); + +// GRANT + + messenger->SetLeave( KErrAbort ); + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_PresentitySubscribeFailKErrAbort ); + + // register interest + TXIMPRequestId reqId = presAuth.GrantPresenceForEveryoneL( *pif ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForEveryoneCalled, + "GrantPresenceForEveryoneL was not called", EFalse, + "GrantPresenceForEveryoneL was called" ); + + messenger->SetLeave( KErrNone ); + +// DEINITIALIZE + + CleanupStack::PopAndDestroy( pif ); //pif + UnbindL(); + } + +// ============================================================================================== + +void T_PresenceAuthorization::T_GrantPresenceForEveryone_Multiple_L() + { + EUNIT_PRINT( _L("Grant presence for presentity multiple clients") ); + + BindAllL(); + + CPresenceInfoFilterImp* pif = + XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 ); + +// GRANT + + TInt countOfWrappers = iWrapperMgr->WrapperCount(); + TInt a(0); + for( a = 0; a < countOfWrappers; ++a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization(); + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + + // register interest + TXIMPRequestId reqId = presAuth.GrantPresenceForEveryoneL( *pif ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForEveryoneCalled, + "GrantPresenceForEveryoneL was not called", + ( a == 0 ) ? ETrue : EFalse, + "GrantPresenceForEveryoneL was called" ); + } + +// GRANT AGAIN + + for( a = 0; a < countOfWrappers; ++a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization(); + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + messenger->SetValueFor( EXIMPPlgTestGrantPresenceForEveryoneCalled, 0 ); + + + // register interest + TXIMPRequestId reqId = presAuth.GrantPresenceForEveryoneL( *pif ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForEveryoneCalled, + "GrantPresenceForEveryoneL was not called", EFalse, + "GrantPresenceForEveryoneL was called" ); + } + + +// WITHDRAW + + for( a = 0; a < countOfWrappers; ++a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization(); + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); // allow events after reqcomplete + + // register interest + TXIMPRequestId reqId = presAuth.WithdrawPresenceGrantFromEveryoneL(); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Subscribing presentity presence, complete with error: ") ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestWithdrawPresenceFromEveryoneCalled, + "WithdrawPresenceGrantFromEveryoneL was not called", + ( a < 2 ) ? EFalse : ETrue, + "WithdrawPresenceGrantFromEveryoneL was called" ); + } + + CleanupStack::PopAndDestroy( pif ); + + UnbindAllL(); + } + + +// ============================================================================================== + +void T_PresenceAuthorization::T_ErrFromPlg_LeaveOnWithdrawPresenceFromEveryone_L() + { + EUNIT_PRINT( _L("Error from plug-in in withdraw presence from everyone") ); + +// INITIALIZE + + BindL(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization(); + + CPresenceInfoFilterImp* pif = + XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 ); + +// GRANT + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + + // register interest + TXIMPRequestId reqId = presAuth.GrantPresenceForEveryoneL( *pif ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForEveryoneCalled, + "GrantPresenceForEveryoneL was not called", ETrue, + "GrantPresenceForEveryoneL was called" ); + +// WITHDRAW + + messenger->SetLeave( KErrAbort ); + + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_PresentitySubscribeFailKErrAbort ); + // register interest + reqId = presAuth.WithdrawPresenceGrantFromEveryoneL(); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Grantin presence to presentity, complete with error: ") ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestWithdrawPresenceFromPresentityCalled, + "WithdrawPresenceGrantFromEveryoneL was not called", EFalse, + "WithdrawPresenceGrantFromEveryoneL was called" ); + + messenger->SetLeave( KErrNone ); + +// DEINITIALIZE + + CleanupStack::PopAndDestroy( pif ); //pif + UnbindL(); + } + + + +// ============================================================================================== + +void T_PresenceAuthorization::T_GrantPresenceForGroupMembers_L() + { + EUNIT_PRINT( _L("Grant presence for presentity group members") ); + + BindL(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization(); + + CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 ); + CPresenceInfoFilterImp* pif = + XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 ); + +// GRANT + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + + // register interest + TXIMPRequestId reqId = presAuth.GrantPresenceForPresentityGroupMembersL( *identity, *pif ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForPresentityGroupMembersCalled, "GrantPresenceForPresentityGroupMembers was not called", ETrue, NULL ); + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); // allow events after reqcomplete + +// GRANT AGAIN + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + messenger->SetValueFor( EXIMPPlgTestGrantPresenceForPresentityGroupMembersCalled, 0 ); + + reqId = presAuth.GrantPresenceForPresentityGroupMembersL( *identity, *pif ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForPresentityGroupMembersCalled, "GrantPresenceForPresentityGroupMembers was not called", EFalse, "GrantPresenceForPresentityGroupMembers was called" ); + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); // allow events after reqcomplete + +// WITHDRAW + // register interest + reqId = presAuth.WithdrawPresenceGrantFromPresentityGroupMembersL( *identity ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Granting presence for presentity group members complete with error: ") ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestWithdrawPresenceFromPresentityGroupMembersCalled, "WithdrawPresenceFromPresentityGroupMembers was not called", ETrue, NULL ); + + CleanupStack::PopAndDestroy( 2, identity ); //pif, identity + UnbindL(); + } + +// ============================================================================================== + +void T_PresenceAuthorization::T_GrantPresenceForGroupMembersChangeId_L() + { + EUNIT_PRINT( _L("Grant presence for presentity group members change id") ); + +// INITIALIZE + + BindL(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization(); + +// ID CHANGE REQUEST TO ADAPTATION + + MXIMPIdentity* identityParam = context->ObjectFactory().NewIdentityLC(); + identityParam->SetIdentityL( KIdentity ); + + CXIMPIdentityImp* identityParamImp = + ( CXIMPIdentityImp* ) identityParam->GetInterface( + CXIMPIdentityImp::KClassId, + MXIMPBase::EPanicIfUnknown ); + HBufC8* packedId = TXIMPObjectPacker< CXIMPIdentityImp >::PackL( *identityParamImp ); + CleanupStack::PopAndDestroy(); // identityParam + CleanupStack::PushL( packedId ); + CXIMPTestFileSrvMsg* srvMsg = CXIMPTestFileSrvMsg::NewL( CXIMPTestFileSrvMsg::ETestSrvMsgReqParamIdentity, + *packedId ); + CleanupStack::PopAndDestroy( packedId ); + CleanupStack::PushL( srvMsg ); + wrapper->FileTool().SrvMsgStoreL( srvMsg ); + CleanupStack::PopAndDestroy( srvMsg ); + + // Wait for server to handle srvmsg. + CXIMPTestWaitHelper* wait = CXIMPTestWaitHelper::NewL(); + CleanupStack::PushL( wait ); + wait->WaitForL( 2 ); + CleanupStack::PopAndDestroy( wait ); + +// GRANT + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + + CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 ); + CPresenceInfoFilterImp* pif = + XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 ); + + // register interest + TXIMPRequestId reqId = presAuth.GrantPresenceForPresentityGroupMembersL( *identity, *pif ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForPresentityGroupMembersCalled, "GrantPresenceForPresentityGroupMembers was not called", ETrue, NULL ); + +// DEINITIALIZE + + CleanupStack::PopAndDestroy( 2, identity ); //pif, identity + UnbindL(); + } + + +// ============================================================================================== + +void T_PresenceAuthorization::T_WithdrawNotGrantedPresenceFromEveryone_L() + { + EUNIT_PRINT( _L("Withdraw presence from everyone not granted") ); + +// INITIALIZE + + BindL(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization(); + +// WITHDRAW + + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + // register interest + TXIMPRequestId reqId = presAuth.WithdrawPresenceGrantFromEveryoneL(); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + // Changed for OPAA-73BCS8 + wrapper->VerifyEventStackL( _L8("Withdraw not granted everyone, complete with error: ") ); + COMMONASSERT( messenger, EXIMPPlgTestWithdrawPresenceFromEveryoneCalled, + "WithdrawPresenceGrantFromEveryoneL was not called", ETrue /*EFalse*/, + "WithdrawPresenceGrantFromEveryoneL was called" ); + +// DEINITIALIZE + UnbindL(); + } + + +// ============================================================================================== + +void T_PresenceAuthorization::T_WithdrawNotGrantedPresenceFromEveryone_Multiple_L() + { + EUNIT_PRINT( _L("Withdraw presence from everyone not granted multiple clients") ); + + BindAllL(); + + CPresenceInfoFilterImp* pif = + XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 ); + +// GRANT ALL BUT FIRST + + TInt countOfWrappers = iWrapperMgr->WrapperCount(); + TInt a(0); + for( a = countOfWrappers - 1; a >= 1; --a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization(); + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + + // register interest + TXIMPRequestId reqId = presAuth.GrantPresenceForEveryoneL( *pif ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForEveryoneCalled, + "GrantPresenceForEveryoneL was not called", + ( a > 1 ) ? ETrue : EFalse, + "GrantPresenceForEveryoneL was called" ); + } + +// WITHDRAW + + for( a = 0; a < countOfWrappers; ++a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization(); + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); // allow events after reqcomplete + + // register interest + TXIMPRequestId reqId = presAuth.WithdrawPresenceGrantFromEveryoneL(); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Subscribing presentity presence, complete with error: ") ); + // verify that UpdateInterest was called + // Changed for OPAA-73BCS8 + COMMONASSERT( messenger, EXIMPPlgTestWithdrawPresenceFromEveryoneCalled, + "WithdrawPresenceGrantFromEveryoneL was not called", + ( a < ( countOfWrappers -1 )/*a < 2^*/ ) ? EFalse : ETrue, + "WithdrawPresenceGrantFromEveryoneL was called" ); + } + + CleanupStack::PopAndDestroy( pif ); + + UnbindAllL(); + } + + +// ============================================================================================== +void T_PresenceAuthorization::T_MakeAndGrantGroup_WithdrawOneID_L() + { + EUNIT_PRINT( _L("T_MakeAndGrantGroup_WithdrawOneID_L") ); + + BindL(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization(); + MPresentityGroups& presGroup = presFeat->PresentityGroups(); + + + // CREATE PRESENTITY GROUP + + // Setup status event listener for RequestComplete + // This will also produce HandlePresentityGroupListEvent, since the + // the group is subscribed + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + + + MXIMPIdentity* groupId = context->ObjectFactory().NewIdentityLC(); + CleanupStack::Pop(); // groupId + groupId->SetIdentityL( KGroupId ); + + // subscribe + TXIMPRequestId reqId; + reqId = presGroup.CreatePresentityGroupL( *groupId, KGroupDisplayName ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("CreatePresentityGroupL failed, complete with error: ") ); + + // verify that SubscribePresentityGroupListL was called + messenger->AssertCreatePresentityGroupCalled( ETrue ); + + + // ADD PRESENTITY GROUP MEMBER 1 + + CXIMPTestListener* listener4 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener4 ); // << listener4 + + MXIMPIdentity* member = context->ObjectFactory().NewIdentityLC(); // << member + member->SetIdentityL( KIdentity1_16 ); + + + // request complete + TXIMPRequestId reqIdDummy; + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + + // group id + CXIMPIdentityImp* identity2 = CXIMPIdentityImp::NewLC( groupId->Identity() ); + evReqComplete->AppendParamL( identity2 ); + CleanupStack::Pop(identity2); // identity2 + + // id for member info + CXIMPIdentityImp* miId = CXIMPIdentityImp::NewLC( KIdentity1_16 ); + // member info + CPresentityGroupMemberInfoImp* memInfoImp = + CPresentityGroupMemberInfoImp::NewLC( *miId, KIdentity1_16 ); + evReqComplete->AppendParamL( memInfoImp ); + CleanupStack::Pop(memInfoImp); // memInfoImp owned by AppendParamL + CleanupStack::PopAndDestroy( miId ); // copy was made + + listener4->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + // do the call + reqId = presGroup.AddPresentityGroupMemberL( + *groupId, *member, KIdentity1_16 ); + + // and wait + EUNIT_ASSERT_DESC( KErrNone == listener4->WaitAndAssertL(), "AddPresentityGroupMemberL (not subscribed) failed" ); + + messenger->AssertAddPresentityGroupMemberCalled( ETrue ); + CleanupStack::PopAndDestroy(); // >>> member + CleanupStack::PopAndDestroy( listener4 );// >>> listener4 + + // ADD PRESENTITY GROUP MEMBER 2 + + listener4 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener4 ); // << listener4 + + member = context->ObjectFactory().NewIdentityLC(); // << member + member->SetIdentityL( KIdentity2_16 ); + + + // request complete + evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + + // group id + //delete identity2; + identity2 = CXIMPIdentityImp::NewLC( groupId->Identity() ); + evReqComplete->AppendParamL( identity2 ); + CleanupStack::Pop(identity2); // identity2 + + // id for member info + miId = CXIMPIdentityImp::NewLC( KIdentity2_16 ); + // member info + memInfoImp = CPresentityGroupMemberInfoImp::NewLC( *miId, KIdentity2_16 ); + evReqComplete->AppendParamL( memInfoImp ); + CleanupStack::Pop(memInfoImp); // memInfoImp owned by AppendParamL + CleanupStack::PopAndDestroy( miId ); // copy was made + + listener4->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + // do the call + reqId = presGroup.AddPresentityGroupMemberL( *groupId, *member, KIdentity2_16 ); + + // and wait + EUNIT_ASSERT_DESC( KErrNone == listener4->WaitAndAssertL(), "AddPresentityGroupMemberL (not subscribed) failed" ); + + messenger->AssertAddPresentityGroupMemberCalled( ETrue ); + CleanupStack::PopAndDestroy(); // >>> member + CleanupStack::PopAndDestroy( listener4 );// >>> listener4 + + // ADD PRESENTITY GROUP MEMBER 3 + + //delete identity2; + listener4 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener4 ); // << listener4 + + member = context->ObjectFactory().NewIdentityLC(); // << member + member->SetIdentityL( KIdentity3_16 ); + + + // request complete + evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + + // group id + identity2 = CXIMPIdentityImp::NewLC( groupId->Identity() ); + evReqComplete->AppendParamL( identity2 ); + CleanupStack::Pop(identity2); // identity2 + + // id for member info + miId = CXIMPIdentityImp::NewLC( KIdentity3_16 ); + // member info + memInfoImp = CPresentityGroupMemberInfoImp::NewLC( *miId, KIdentity3_16 ); + evReqComplete->AppendParamL( memInfoImp ); + CleanupStack::Pop(memInfoImp); // memInfoImp owned by AppendParamL + CleanupStack::PopAndDestroy( miId ); // copy was made + + listener4->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + // do the call + reqId = presGroup.AddPresentityGroupMemberL( + *groupId, *member, KIdentity3_16 ); + + // and wait + EUNIT_ASSERT_DESC( KErrNone == listener4->WaitAndAssertL(), "AddPresentityGroupMemberL (not subscribed) failed" ); + + messenger->AssertAddPresentityGroupMemberCalled( ETrue ); + CleanupStack::PopAndDestroy(); // >>> member + CleanupStack::PopAndDestroy( listener4 );// >>> listener4 + + + // GRANT PRESENTITY GROUP MEMBER + + // This is the group we are interested in + MXIMPIdentity* ggroup = context->ObjectFactory().NewIdentityLC(); + CleanupStack::Pop(); // ggroup + ggroup->SetIdentityL( KGroupId ); + // Set filter for the group + CPresenceInfoFilterImp* ggpif = CPresenceInfoFilterImp::NewLC(); + //ggpif->AcceptPersonFilterL( NPresenceInfo::NFieldType::KAcceptAll ); + CleanupStack::Pop(ggpif); // ggpif + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + + // grant for all + reqId = presAuth.GrantPresenceForPresentityGroupMembersL( *ggroup, *ggpif ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForPresentityGroupMembersCalled, + "GrantPresenceForPresentityGroupMembersL was not called", ETrue, NULL ); + delete ggroup; + delete ggpif; + + + // Withdraw one of group's member's ID + + MXIMPIdentity* identity = context->ObjectFactory().NewIdentityLC(); + identity->SetIdentityL( KIdentity2_16 ); // << identity + + + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + // register interest + reqId = presAuth.WithdrawPresenceGrantFromPresentityL( *identity ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Grantin presence to presentity, complete with error: ") ); + + // Changed for OPAA-73BCS8 + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestWithdrawPresenceFromPresentityCalled, + "WithdrawPresenceForPresentityL was not called", ETrue/*EFalse*/, + "WithdrawPresenceForPresentityL was called" ); + + CleanupStack::PopAndDestroy(); // identity + delete groupId; + + UnbindL(); + + wrapper = NULL; + context = NULL; + messenger = NULL; + } + + +// =========================================================================== +// SETUP HELPERS FOR THE LISTENER +// =========================================================================== +// +void T_PresenceAuthorization::SetupListenerReqCompleteL( CXIMPTestContextWrapper* aWrapper, TXIMPTestStatusEventTemplate aEventType ) + { + RArray< TInt32 > array; + CleanupClosePushL( array ); + array.Append( MXIMPContextStateEvent::KInterfaceId ); + array.Append( MPresentityPresenceEvent::KInterfaceId ); + aWrapper->SetupListenerReqCompleteL( aEventType, &array ); + CleanupStack::PopAndDestroy(); // array + } + +void T_PresenceAuthorization::SetupListenerReqCompleteAllowEventsL( CXIMPTestContextWrapper* aWrapper, TXIMPTestStatusEventTemplate aEventType ) + { + RArray< TInt32 > array; + CleanupClosePushL( array ); + array.AppendL( MXIMPRequestCompleteEvent::KInterfaceId ); + array.AppendL( MXIMPContextStateEvent::KInterfaceId ); + array.AppendL( MPresentityPresenceEvent::KInterfaceId ); + aWrapper->SetupListenerReqCompleteL( aEventType, &array ); + CleanupStack::PopAndDestroy(); // array + } + +// =========================================================================== +// TEST CASE TABLE +// =========================================================================== +// +EUNIT_BEGIN_TEST_TABLE( + T_PresenceAuthorization, + "XIMP presence authorization tests", + "MODULE" ) + +PRFW_DECORATED_TEST( + "Grant presence for presentity", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_GrantPresenceForPresentity_L, + Teardown ) + + +PRFW_DECORATED_TEST( + "MakeAndGrantGroup_WithdrawOneID", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_MakeAndGrantGroup_WithdrawOneID_L, + Teardown ) + + +PRFW_DECORATED_TEST( + "Grant presence for presentity multiple", + "", + "", + "FUNCTIONALITY", + SetupMultiple_L, + T_GrantPresenceForPresentity_Multiple_L, + Teardown ) + + +PRFW_DECORATED_TEST( + "Withdraw not granted presence for presentity", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_WithdrawNotGrantedPresenceFromPresentity_L, + Teardown ) + + +PRFW_DECORATED_TEST( + "Grant presence for presentity change id", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_GrantPresenceForPresentityChangeId_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Grant presence for group members change id", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_GrantPresenceForGroupMembersChangeId_L, + Teardown ) + + +PRFW_DECORATED_TEST( + "Withdraw not granted presence from presentity multiple", + "", + "", + "FUNCTIONALITY", + SetupMultiple_L, + T_WithdrawNotGrantedPresenceFromPresentity_Multiple_L, + Teardown ) + +PRFW_DECORATED_TEST( + "ErrorPlugin - Leave on grant", + "", + "", + "ERRORHANDLING", + Setup_L, + T_ErrFromPlg_LeaveOnGrantPresenceForPresentity_L, + Teardown ) + +PRFW_DECORATED_TEST( + "ErrorPlugin - Leave on withdraw", + "", + "", + "ERRORHANDLING", + Setup_L, + T_ErrFromPlg_LeaveOnWithdrawPresenceFromPresentity_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Withdraw not granted presence for group members", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_WithdrawNotGrantedPresenceFromGroupMembers_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Withdraw not granted presence for group members multiple", + "", + "", + "FUNCTIONALITY", + SetupMultiple_L, + T_WithdrawNotGrantedPresenceFromGroupMembers_Multiple_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Grant presence for group members", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_GrantPresenceForGroupMembers_L, + Teardown ) + + +PRFW_DECORATED_TEST( + "Grant presence for group members multiple", + "", + "", + "FUNCTIONALITY", + SetupMultiple_L, + T_GrantPresenceForGroupMembers_Multiple_L, + Teardown ) + + +PRFW_DECORATED_TEST( + "ErrorPlugin - Leave on withdraw for group members", + "", + "", + "ERRORHANDLING", + Setup_L, + T_ErrFromPlg_LeaveOnGrantPresenceForGroupMembers_L, + Teardown ) + +PRFW_DECORATED_TEST( + "ErrorPlugin - Leave on withdraw from group members", + "", + "", + "ERRORHANDLING", + Setup_L, + T_ErrFromPlg_LeaveOnWithdrawPresenceFromGroupMembers_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Grant presence for everyone", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_GrantPresenceForEveryone_L, + Teardown ) + +PRFW_DECORATED_TEST( + "ErrorPlugin - Leave on grant to everyone", + "", + "", + "ERRORHANDLING", + Setup_L, + T_ErrFromPlg_LeaveOnGrantPresenceForEveryone_L, + Teardown ) + +PRFW_DECORATED_TEST( + "ErrorPlugin - Leave on withdraw from everyone", + "", + "", + "ERRORHANDLING", + Setup_L, + T_ErrFromPlg_LeaveOnWithdrawPresenceFromEveryone_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Grant presence for everyone multiple ", + "", + "", + "FUNCTIONALITY", + SetupMultiple_L, + T_GrantPresenceForEveryone_Multiple_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Withdraw not granted presence from everyone", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_WithdrawNotGrantedPresenceFromEveryone_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Withdraw not granted presence from everyone multiple", + "", + "", + "FUNCTIONALITY", + SetupMultiple_L, + T_WithdrawNotGrantedPresenceFromEveryone_Multiple_L, + Teardown ) + + +EUNIT_END_TEST_TABLE + + +// =========================================================================== +// TEST SUITE CONSTRUCTION +// =========================================================================== +// +EXPORT_C MEUnitTest* CreateTestSuiteL() + { + return T_PresenceAuthorization::NewL(); + } + + + +// end of file diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presenceauthorization/t_presenceauthorization.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presenceauthorization/t_presenceauthorization.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,112 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef T_PRESENCEAUTHORIZATION_H +#define T_PRESENCEAUTHORIZATION_H + +#include +#include +#include "prfwteststatuseventlistener.h" +#include "prfwtestmessaging.h" + +class CXIMPTestContextWrapper; +class CXIMPTestContextWrapperMgr; +class CXIMPTestMessenger; + +/** + * XIMP Framework Eunit tests. + * + * Tests for XIMP session management services. + * + * @since S60 v4.0 + */ +class T_PresenceAuthorization : public CEUnitTestSuiteClass + { + +public: + static T_PresenceAuthorization* NewL(); + virtual ~T_PresenceAuthorization(); + + +private: + T_PresenceAuthorization(); + void ConstructL(); + +private: // Test case functions + + void Setup_L(); + void SetupMultiple_L(); + void BindL(); + void BindAllL(); + void Teardown(); + void UnbindL(); + void UnbindAllL(); + + void T_GrantPresenceForPresentity_L(); + void T_GrantPresenceForPresentityChangeId_L(); + void T_WithdrawNotGrantedPresenceFromPresentity_L(); + void T_ErrFromPlg_LeaveOnGrantPresenceForPresentity_L(); + void T_ErrFromPlg_LeaveOnWithdrawPresenceFromPresentity_L(); + + void T_GrantPresenceForPresentity_Multiple_L(); + void T_WithdrawNotGrantedPresenceFromPresentity_Multiple_L(); + + void T_GrantPresenceForGroupMembers_L(); + void T_GrantPresenceForGroupMembersChangeId_L(); + void T_ErrFromPlg_LeaveOnGrantPresenceForGroupMembers_L(); + void T_ErrFromPlg_LeaveOnWithdrawPresenceFromGroupMembers_L(); + + void T_GrantPresenceForGroupMembers_Multiple_L(); + void T_WithdrawNotGrantedPresenceFromGroupMembers_L(); + void T_WithdrawNotGrantedPresenceFromGroupMembers_Multiple_L(); + + void T_GrantPresenceForEveryone_L(); + void T_ErrFromPlg_LeaveOnGrantPresenceForEveryone_L(); + void T_ErrFromPlg_LeaveOnWithdrawPresenceFromEveryone_L(); + + void T_GrantPresenceForEveryone_Multiple_L(); + void T_WithdrawNotGrantedPresenceFromEveryone_L(); + void T_WithdrawNotGrantedPresenceFromEveryone_Multiple_L(); + + void T_MakeAndGrantGroup_WithdrawOneID_L(); + +private: // Test helpers + + void SetupListenerReqCompleteL( CXIMPTestContextWrapper* aWrapper, TXIMPTestStatusEventTemplate aEventType ); + void SetupListenerReqCompleteAllowEventsL( CXIMPTestContextWrapper* aWrapper, TXIMPTestStatusEventTemplate aEventTypes ); + +private: // Test data + + /** + * Eunit test case table declaration. + */ + EUNIT_DECLARE_TEST_TABLE; + + // owned + CXIMPTestContextWrapperMgr* iWrapperMgr; + }; + + +#endif // T_PRESENCEAUTHORIZATION_H + + + +// end of file + + + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presenceauthorization/t_presenceauthorization.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presenceauthorization/t_presenceauthorization.mmp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,58 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "../../tsrcutils/eunitcommon/eunittstdllbase.hrh" +#include "../../tsrcutils/processmaster/pm.h" + + +TARGET t_presenceauthorization.dll +CAPABILITY ALL -TCB +SOURCEPATH . +SOURCE t_presenceauthorization.cpp + + +USERINCLUDE ../../../../../ximpfw/core/srcdatamodel +USERINCLUDE ../../../../../ximpfw/presence/srcpresencedatamodel +USERINCLUDE ../../../../../ximpfw/presence/srcpresencedatamodel/presentitygroups +USERINCLUDE ../../../../../ximpfw/presence/srcpresencedatamodel/presencewatching +USERINCLUDE ../../../../../ximpfw/presence/srcpresencedatamodel/presenceauthorization +USERINCLUDE ../../../../../ximpfw/presence/srcpresencedatamodel/presencepublishing +USERINCLUDE ../../../../../ximpfw/presence/srcpresencedatamodel/presenceinfo +USERINCLUDE ../../../../../ximpfw/core/srcutils + +// TODO remove unnecessary +SYSTEMINCLUDE ../../../../../ximpfw/inc/core/base +SYSTEMINCLUDE ../../../../../ximpfw/inc/core/datamodel +SYSTEMINCLUDE ../../../../../ximpfw/inc/core/protocolplugin +SYSTEMINCLUDE ../../../../../ximpfw/inc/core/protocolpluginhost +SYSTEMINCLUDE ../../../../../ximpfw/inc/presence/presencedatamodel +SYSTEMINCLUDE ../../../../../ximpfw/inc/presence/presencemanagement +SYSTEMINCLUDE ../../../../../ximpfw/inc/presence/presenceprotocolplugin +SYSTEMINCLUDE ../../../../../ximpfw/inc/presence/presenceprotocolpluginhost + +LIBRARY ecom.lib +LIBRARY bafl.lib +LIBRARY ximpdatamodel.lib +LIBRARY presencedatamodel.lib +LIBRARY estor.lib +LIBRARY ximputils.lib +LIBRARY eunit.lib + + +// end of file + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presenceblocking/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presenceblocking/bld.inf Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,23 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Build information file for t_presenceblocking.dll +* +*/ + + +PRJ_PLATFORMS +DEFAULT + +PRJ_TESTMMPFILES +t_presenceblocking.mmp diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presenceblocking/t_presenceblocking.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presenceblocking/t_presenceblocking.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,1280 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +#include "eunittools.h" + +#include +#include +#include + + +#include +#include +#include +#include + + +#include +#include +#include + +#include "t_presenceblocking.h" + +// blocking includes +#include "presenceblockinfoimp.h" +#include "presenceblocklisteventimp.h" + +// other datamodel and utils includes +#include "ximpidentityimp.h" +#include "ximpobjecthelpers.h" + + +// testing tool includes +#include "prfwtestpresencedatautils.h" + +#include "prfwtestmessaging.h" +#include "prfwtestmessenger.h" +#include "prfwtestcontextwrappermgr.h" +#include "prfwtestcontextwrapper.h" + + +#include "prfwtestfilesrvmsg.h" +#include "prfwtestfiletool.h" +#include "prfwtestlistener.h" +#include "ximprequestcompleteeventimp.h" + +#include "prfwtestrobustnesstools.h" + + +// ============================ MEMBER FUNCTIONS =============================== + +// CONSTRUCTION +T_PresenceBlocking* T_PresenceBlocking::NewL() + { + T_PresenceBlocking* self = new( ELeave ) T_PresenceBlocking; + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + + return self; + } + + +T_PresenceBlocking::~T_PresenceBlocking() + { + PrfwTestRobustness::DoPreCleaning(); + } + + +void T_PresenceBlocking::ConstructL() + { + CEUnitTestSuiteClass::ConstructL(); + } + + +T_PresenceBlocking::T_PresenceBlocking() + { + } + + + +// =========================================================================== +// TEST CASE SETUP & TEARDOWN METHODS +// =========================================================================== +// + +void T_PresenceBlocking::Setup_L() + { + PrfwTestRobustness::DoPreCleaning(); + + iWrapperMgr = CXIMPTestContextWrapperMgr::NewL(); + iWrapperMgr->CreateWrapperL(); + } + +void T_PresenceBlocking::SetupMultiple_L() + { + PrfwTestRobustness::DoPreCleaning(); + + iWrapperMgr = CXIMPTestContextWrapperMgr::NewL(); + iWrapperMgr->CreateWrapperL(); + iWrapperMgr->CreateWrapperL(); + iWrapperMgr->CreateWrapperL(); + } + + +void T_PresenceBlocking::BindL() + { + CXIMPTestContextWrapper* wrapper0 = iWrapperMgr->GetWrapperL( 0 ); + + wrapper0->BindL( 0 ); + } + +void T_PresenceBlocking::BindAllL() + { + for( TInt a = 0; a < iWrapperMgr->WrapperCount(); ++a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + wrapper->BindL( 0 ); + } + } + + +void T_PresenceBlocking::Teardown() + { + delete iWrapperMgr; + iWrapperMgr = NULL; + + REComSession::FinalClose(); + + PrfwTestRobustness::DoPreCleaning(); + } + +void T_PresenceBlocking::UnbindL() + { + // Do unbind + CXIMPTestContextWrapper* wrapper0 = iWrapperMgr->GetWrapperL( 0 ); + wrapper0->UnbindL(); + } + +void T_PresenceBlocking::UnbindAllL() + { + for( TInt a = 0; a < iWrapperMgr->WrapperCount(); ++a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + wrapper->UnbindL(); + } + } + + +// =========================================================================== +// TEST CASES for presentity presence subscription +// =========================================================================== + + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// Single client, empty filter +void T_PresenceBlocking::T_SubscribeBlockList_Single_L() + { + EUNIT_PRINT( _L("Single presence block list subscription") ); + + BindL(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + + MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization(); + + // Setup status event listener for RequestComplete + // --------------------------------------------- + listener2->Reset(); + + // normal request complete + TXIMPRequestId reqIdDummy; // not checked + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + // --------------------------------------------- + + // subscribe + // --------------------------------------------- + TXIMPRequestId reqId = presAuth.SubscribePresenceBlockListL(); + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Subscribe failed" ); + // --------------------------------------------- + + // verify that SubscribeBlockListL was called + COMMONASSERT( messenger, EXIMPPlgTestSubscribePresenceBlockListCalled, "SubscribeBlockListL was not called", ETrue, NULL ); + + // Setup status event listener for RequestComplete + // --------------------------------------------- + listener2->Reset(); + + evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + // --------------------------------------------- + + // unsubscribe + // --------------------------------------------- + reqId = presAuth.UnsubscribePresenceBlockListL(); + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Unsubscribe failed" ); + // --------------------------------------------- + + // verify that UnsubscribeBlockListL was called + COMMONASSERT( messenger, EXIMPPlgTestUnsubscribePresenceBlockListCalled, "UnsubscribeBlockListL was not called", ETrue, NULL ); + + // Deinitiliaze event source from listener. + listener2->SetEventSourceL( NULL ); + + UnbindL(); + + //CleanupStack::Pop(presFeat); + //delete presFeat; + //CleanupStack::PopAndDestroy(); + CleanupStack::PopAndDestroy( listener2 ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// Single client, empty filter +void T_PresenceBlocking::T_SubscribeBlockListRefresh_Single_L() + { + EUNIT_PRINT( _L("Single presence block list subscription refresh") ); + + BindL(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization(); + + // Setup status event listener for RequestComplete + // --------------------------------------------- + listener2->Reset(); + + // normal request complete + TXIMPRequestId reqIdDummy; // not checked + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + // --------------------------------------------- + + // subscribe + // --------------------------------------------- + TXIMPRequestId reqId = presAuth.SubscribePresenceBlockListL(); + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Subscribe failed" ); + // --------------------------------------------- + + // verify that SubscribeBlockListL was called + COMMONASSERT( messenger, EXIMPPlgTestSubscribePresenceBlockListCalled, "SubscribeBlockListL was not called", ETrue, NULL ); + + // Setup status event listener for RequestComplete + // --------------------------------------------- + listener2->Reset(); + + evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + RPrBlockInfoImpArray* currentList(NULL); + CPresenceBlockListEventImp* event = CreateBlockListEventLCX( + KNullDesC, KNullDesC, + MXIMPDataSubscriptionState::ESubscriptionActive, + MXIMPDataSubscriptionState::EDataUnavailable, + ETestPBlCurrent, currentList ); + listener2->ExpectL( event ); + CleanupStack::Pop(); //event 4 to go. + // --------------------------------------------- + + // subscribe again + // --------------------------------------------- + reqId = presAuth.SubscribePresenceBlockListL(); + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Refresh failed" ); + CleanupStack::PopAndDestroy( 4 ); // rest of the items. + // --------------------------------------------- + + // Setup status event listener for RequestComplete + // --------------------------------------------- + listener2->Reset(); + + evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + // --------------------------------------------- + + // unsubscribe + // --------------------------------------------- + reqId = presAuth.UnsubscribePresenceBlockListL(); + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Unsubscribe failed" ); + // --------------------------------------------- + + // verify that UnsubscribeBlockListL was called + COMMONASSERT( messenger, EXIMPPlgTestUnsubscribePresenceBlockListCalled, "UnsubscribeBlockListL was not called", ETrue, NULL ); + + listener2->SetEventSourceL( NULL ); + + UnbindL(); + + CleanupStack::PopAndDestroy( listener2 ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// Single client, empty filter +void T_PresenceBlocking::T_SubscribeBlockList_Multiple_L() + { + EUNIT_PRINT( _L("Multiple presence block list subscription") ); + + BindAllL(); + + TInt countOfWrappers = iWrapperMgr->WrapperCount(); + TInt a(0); + for( a = 0; a < countOfWrappers; ++a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization(); + + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // expect normal request complete + TXIMPRequestId reqIdDummy; // not checked + CXIMPRequestCompleteEventImp* evReqComplete = + CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + // subscribe + TXIMPRequestId reqId = presAuth.SubscribePresenceBlockListL(); + + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Subscribe failed" ); + + // verify that SubscribePresenceBlockListL was called + COMMONASSERT( messenger, EXIMPPlgTestSubscribePresenceBlockListCalled, "SubscribePresenceBlockListL was not called", ETrue, NULL ); + + CleanupStack::PopAndDestroy( listener2 ); + } + + for( a = 0; a < countOfWrappers; ++a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization(); + + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // expect normal request complete + TXIMPRequestId reqIdDummy; // not checked + CXIMPRequestCompleteEventImp* evReqComplete = + CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + // unsubscribe + TXIMPRequestId reqId = presAuth.UnsubscribePresenceBlockListL(); + + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Unsubscribe failed" ); + + // verify that EXIMPPlgTestUnsubscribeBlockListCalled was called + COMMONASSERT( messenger, EXIMPPlgTestUnsubscribePresenceBlockListCalled, + "UnsubscribePresenceBlockListL was not called", + ( a < 2 ) ? EFalse : ETrue, + "UnsubscribePresenceBlockListL was called" ); + + CleanupStack::PopAndDestroy( listener2 ); + } + + UnbindAllL(); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +void T_PresenceBlocking::SubscribeL() + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization(); + + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + + // ------------------------------------------------------ + // expect normal request complete + TXIMPRequestId reqIdDummy; // not checked + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + // ------------------------------------------------------ + + // subscribe + TXIMPRequestId reqId = presAuth.SubscribePresenceBlockListL(); + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Subscribe failed" ); + + COMMONASSERT( messenger, EXIMPPlgTestSubscribePresenceBlockListCalled, "SubscribeBlockListL was not called", ETrue, NULL ); + + CleanupStack::PopAndDestroy( listener2 ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +void T_PresenceBlocking::UnsubscribeL() + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization(); + + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + + // ------------------------------------------------------ + // expect normal request complete + TXIMPRequestId reqIdDummy; // not checked + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + // ------------------------------------------------------ + + // unsubscribe + TXIMPRequestId reqId = presAuth.UnsubscribePresenceBlockListL(); + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Unsubscribe failed" ); + + COMMONASSERT( messenger, EXIMPPlgTestUnsubscribePresenceBlockListCalled, "UnsubscribeBlockListL was not called", ETrue, NULL ); + + CleanupStack::PopAndDestroy( listener2 ); + } + + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +void T_PresenceBlocking::T_HandlePresenceBlockList_L() + { + EUNIT_PRINT( _L("Handle presence block list.") ); + + // log in and subscribe a block list + BindL(); + SubscribeL(); + + // ------------------------------------------------------ + // some startup stuff + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + // ------------------------------------------------------ + + // Tell the protocol it should act normally + wrapper->GetMessenger()->SetNoError(); + + // ------------------------------------------------------ + // 1. Create faked server message about block list + SendSrvMsgL( CXIMPTestFileSrvMsg::ETestSrvMsgPresenceBlockList ); + + // ------------------------------------------------------ + // expect current(empty) MPresenceBlockList event. + RPrBlockInfoImpArray* currentList(NULL); + CPresenceBlockListEventImp* event = CreateBlockListEventLCX( + KNullDesC, KNullDesC, + MXIMPDataSubscriptionState::ESubscriptionActive, + MXIMPDataSubscriptionState::EDataAvailable, + ETestPBlCurrent, currentList); + + listener2->ExpectL( event ); + CleanupStack::Pop( event ); // 4 more items in cleanupstack + + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "HandlePresenceBlockListL failed" ); + CleanupStack::PopAndDestroy( 4 ); // lists + // ------------------------------------------------------ + + CleanupStack::PopAndDestroy( listener2 ); + + // clean it up + UnsubscribeL(); + UnbindL(); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// Single client, empty filter +void T_PresenceBlocking::T_BlockPresence_L() + { + EUNIT_PRINT( _L("Block presence") ); + + BindL(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization(); + + // Setup status event listener for RequestComplete + // --------------------------------------------- + listener2->Reset(); + + // normal request complete + TXIMPRequestId reqIdDummy; // not checked + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + // subscribe + TXIMPRequestId reqId = presAuth.SubscribePresenceBlockListL(); + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Subscribe failed" ); + + // verify that SubscribePresenceBlockListL was called + COMMONASSERT( messenger, EXIMPPlgTestSubscribePresenceBlockListCalled, "SubscribePresenceBlockListL was not called", ETrue, NULL ); + + + // --------------------------------------------- + // 1. Block presence + + CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 ); + _LIT16( KDisplayName1, "DispnameA, LoremI" ); + + + // Setup status event listener for RequestComplete + // --------------------------------------------- + listener2->Reset(); + + evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + RPrBlockInfoImpArray* currentList(NULL); + CPresenceBlockListEventImp* event = + CreateBlockListEventLCX( identity->Identity(), + KNullDesC, + MXIMPDataSubscriptionState::ESubscriptionActive, + MXIMPDataSubscriptionState::EDataAvailable, + ETestPBlAdded, currentList ); + + listener2->ExpectL( event ); + CleanupStack::Pop( event ); + + // block + reqId = presAuth.BlockPresenceForPresentityL( *identity ); + + //Waqas: fixed current list in event + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Block failed" ); + + // verify that BlockPresenceForPresentityL was called + COMMONASSERT( messenger, EXIMPPlgTestBlockPresenceForPresentityCalled, "BlockPresenceForPresentityL was not called", ETrue, NULL ); + + CleanupStack::PopAndDestroy( 4 ); // lists + // --------------------------------------------- + + + // --------------------------------------------- + // 2. Re-block + + // Setup status event listener for RequestComplete + listener2->Reset(); + + evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + // we need to create current list to give to the event + currentList = new ( ELeave ) RPrBlockInfoImpArray; // previous is destroyed + CleanupDeletePushL( currentList ); + // create the group info + CPresenceBlockInfoImp* blockInfoForEvent = + CPresenceBlockInfoImp::NewLC( *identity, KNullDesC ); + currentList->AppendL( blockInfoForEvent ); + CleanupStack::Pop( blockInfoForEvent ); + CleanupStack::Pop( currentList ); + + // now make the event + event = CreateBlockListEventLCX( identity->Identity(), + KNullDesC, + MXIMPDataSubscriptionState::ESubscriptionActive, + MXIMPDataSubscriptionState::EDataAvailable, + ETestPBlCurrent, currentList ); + + listener2->ExpectL( event ); + CleanupStack::Pop( event ); + + // re-block + reqId = presAuth.BlockPresenceForPresentityL( *identity ); + + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Block failed" ); + + // verify that BlockPresenceForPresentityL was called + COMMONASSERT( messenger, EXIMPPlgTestBlockPresenceForPresentityCalled, "BlockPresenceForPresentityL was not called", ETrue, NULL ); + + + CleanupStack::PopAndDestroy( 4 ); // lists + + + // Deinitiliaze event source from listener. + listener2->SetEventSourceL( NULL ); + + UnbindL(); + + CleanupStack::PopAndDestroy( identity ); + + CleanupStack::PopAndDestroy( listener2 ); + + } +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// Single client, empty filter +void T_PresenceBlocking::T_CancelBlockedPresence_L() + { + EUNIT_PRINT( _L("Cancel presence block") ); + + BindL(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization(); + + // Setup status event listener for RequestComplete + // --------------------------------------------- + listener2->Reset(); + + // normal request complete + TXIMPRequestId reqIdDummy; // not checked + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + // --------------------------------------------- + + // subscribe + // --------------------------------------------- + TXIMPRequestId reqId = presAuth.SubscribePresenceBlockListL(); + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Subscribe failed" ); + // --------------------------------------------- + + // verify that SubscribePresenceBlockListL was called + COMMONASSERT( messenger, EXIMPPlgTestSubscribePresenceBlockListCalled, "SubscribePresenceBlockListL was not called", ETrue, NULL ); + + + CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 ); + + // --------------------------------------------- + // 1. Cancel non-existing block (no blocks) + + // Setup status event listener for RequestComplete + listener2->Reset(); + + evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + RPrBlockInfoImpArray* currentList(NULL); + CPresenceBlockListEventImp* event = + CreateBlockListEventLCX( KNullDesC, + KNullDesC, + MXIMPDataSubscriptionState::ESubscriptionActive, + MXIMPDataSubscriptionState::EDataUnavailable, + ETestPBlRemoved, currentList ); + listener2->ExpectL( event ); + CleanupStack::Pop( event ); + + // cancel nonexisting block + reqId = presAuth.CancelPresenceBlockFromPresentityL( *identity ); + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Cancel failed" ); + // --------------------------------------------- + + // verify that method was called + COMMONASSERT( messenger, EXIMPPlgTestCancelPresenceBlockFromPresentityCalled, "CancelPresenceBlockFromPresentityL was not called", ETrue, NULL ); + + CleanupStack::PopAndDestroy( 4 ); // lists + + + // --------------------------------------------- + // 2. Cancel block + + + // Setup status event listener for RequestComplete + listener2->Reset(); + + evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + currentList = NULL; // previous is destroyed + event = CreateBlockListEventLCX( identity->Identity(), + KNullDesC, + MXIMPDataSubscriptionState::ESubscriptionActive, + MXIMPDataSubscriptionState::EDataAvailable, + ETestPBlAdded, currentList ); + listener2->ExpectL( event ); + CleanupStack::Pop( event ); + + // block a presentity + reqId = presAuth.BlockPresenceForPresentityL( *identity ); + // Waqas: Fixed current list in event + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Block failed" ); + + // verify that method was called + COMMONASSERT( messenger, EXIMPPlgTestBlockPresenceForPresentityCalled, "BlockPresenceForPresentityL was not called", ETrue, NULL ); + CleanupStack::PopAndDestroy( 4 ); // lists + // --------------------------------------------- + + + // Setup status event listener for RequestComplete + listener2->Reset(); + + evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + // we need to create current list to give to the event + currentList = new ( ELeave ) RPrBlockInfoImpArray; // previous is destroyed + CleanupDeletePushL( currentList ); + CPresenceBlockInfoImp* blockInfoForEvent = + CPresenceBlockInfoImp::NewLC( *identity, KNullDesC ); + currentList->AppendL( blockInfoForEvent ); + CleanupStack::Pop( blockInfoForEvent ); + CleanupStack::Pop( currentList ); + + // now create event and give currentList to it + event = CreateBlockListEventLCX( identity->Identity(), + KNullDesC, + MXIMPDataSubscriptionState::ESubscriptionActive, + MXIMPDataSubscriptionState::EDataAvailable, + ETestPBlRemoved, currentList ); + listener2->ExpectL( event ); + CleanupStack::Pop( event ); + + // cancel the existing block + reqId = presAuth.CancelPresenceBlockFromPresentityL( *identity ); + // Waqas: Fixed current list in event + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Cancel block failed" ); + + // verify that method was called + COMMONASSERT( messenger, EXIMPPlgTestCancelPresenceBlockFromPresentityCalled, "CancelPresenceBlockFromPresentityL was not called", ETrue, NULL ); + CleanupStack::PopAndDestroy( 4 ); // lists + // --------------------------------------------- + + + // --------------------------------------------- + // TODO 3. Cancel block (non-existing block, other blocks exist) + + + // Deinitiliaze event source from listener. + listener2->SetEventSourceL( NULL ); + + UnbindL(); + + CleanupStack::PopAndDestroy( identity ); + + CleanupStack::PopAndDestroy( listener2 ); + } + + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +void T_PresenceBlocking::T_HandlePresenceBlocked_L() + { + EUNIT_PRINT( _L("Handle presence blocked") ); + + // log in and subscribe a block list + BindL(); + SubscribeL(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + + // Tell the protocol it should act normally + wrapper->GetMessenger()->SetNoError(); + + + CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 ); + + // ------------------------------------------------------ + // 1. Create faked server message about blocked + SendBlockedSrvMsgL( identity->Identity(), + KNullDesC, + CXIMPTestFileSrvMsg::ETestSrvMsgPresenceBlocked ); + + RPrBlockInfoImpArray* currentList(NULL); + CPresenceBlockListEventImp* event = CreateBlockListEventLCX( + identity->Identity(), KNullDesC, + MXIMPDataSubscriptionState::ESubscriptionActive, + MXIMPDataSubscriptionState::EDataAvailable, + ETestPBlAdded, currentList ); + + listener2->ExpectL( event ); + CleanupStack::Pop( event ); // 4 more items in cleanupstack + + // Waqas: Fixed current list handling + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "HandlePresenceBlocked failed" ); + + CleanupStack::PopAndDestroy( 4 ); // lists + // ------------------------------------------------------ + + CleanupStack::PopAndDestroy( identity ); + CleanupStack::PopAndDestroy( listener2 ); + + // clean it up + UnsubscribeL(); + UnbindL(); + + } +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +void T_PresenceBlocking::T_HandlePresenceBlockCanceled_L() + { + + EUNIT_PRINT( _L("Handle presence block canceled") ); + + // log in and subscribe a block list + BindL(); + SubscribeL(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + + // Tell the protocol it should act normally + wrapper->GetMessenger()->SetNoError(); + + + CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 ); + + // ------------------------------------------------------ + // 1. Cancel block (with no blocks) + SendCanceledSrvMsgL( identity->Identity(), + KNullDesC, + CXIMPTestFileSrvMsg::ETestSrvMsgPresenceBlockCanceled ); + + RPrBlockInfoImpArray* currentList(NULL); + CPresenceBlockListEventImp* event = CreateBlockListEventLCX( + KNullDesC, KNullDesC, + MXIMPDataSubscriptionState::ESubscriptionActive, + MXIMPDataSubscriptionState::EDataUnavailable, + ETestPBlRemoved, currentList ); + + listener2->ExpectL( event ); + CleanupStack::Pop( event ); // 4 more items in cleanupstack + + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "HandlePresenceBlockCanceled failed" ); + CleanupStack::PopAndDestroy( 4 ); // lists + // ------------------------------------------------------ + + CleanupStack::PopAndDestroy( identity ); + CleanupStack::PopAndDestroy( listener2 ); + + // clean it up + UnsubscribeL(); + UnbindL(); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// send a faked server-originated message with group info made +// from the given uri and displayname +// +void T_PresenceBlocking::SendSrvMsgL( + const TDesC& aUri, const TDesC& aDispName, + TInt aMsgType ) + { + // we'll use hard-coded wrapper 0 instance for now. + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + + // create a grant req info contained within the server-originated + // faked message + RXIMPObjOwningPtrArray blockList; + CleanupClosePushL( blockList ); + + CXIMPIdentityImp* blockId = CXIMPIdentityImp::NewLC( aUri ); + CPresenceBlockInfoImp* blockItem = + CPresenceBlockInfoImp::NewLC( *blockId, aDispName ); + blockList.AppendL( blockItem ); + CleanupStack::Pop( blockItem ); + CleanupStack::PopAndDestroy( blockId ); + + HBufC8* packedArray = + TXIMPObjectPacker::PackArrayL( blockList ); + CleanupStack::PushL( packedArray ); + + // use filetool to send it for plugin. + CXIMPTestFileSrvMsg* srvMsg = CXIMPTestFileSrvMsg::NewL( aMsgType, + *packedArray ); + CleanupStack::PushL( srvMsg ); + wrapper->FileTool().CleanAllL(); + wrapper->FileTool().SrvMsgStoreL( srvMsg ); + CleanupStack::PopAndDestroy( 3 ); // srvMsg, packedArray, blockList + } + +void T_PresenceBlocking::SendBlockedSrvMsgL( + const TDesC& aUri, const TDesC& aDispName, + TInt aMsgType ) + { + // we'll use hard-coded wrapper 0 instance for now. + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + + // create a grant req info contained within the server-originated + // faked message + CXIMPIdentityImp* blockId = CXIMPIdentityImp::NewLC( aUri ); + CPresenceBlockInfoImp* blockItem = + CPresenceBlockInfoImp::NewLC( *blockId, aDispName ); + + + HBufC8* packedArray = + TXIMPObjectPacker::PackL( *blockItem ); + CleanupStack::PushL( packedArray ); + + // use filetool to send it for plugin. + CXIMPTestFileSrvMsg* srvMsg = CXIMPTestFileSrvMsg::NewL( aMsgType, + *packedArray ); + CleanupStack::PushL( srvMsg ); + wrapper->FileTool().CleanAllL(); + wrapper->FileTool().SrvMsgStoreL( srvMsg ); + CleanupStack::PopAndDestroy( 4 ); // blockId, blockItem, packedArray, srvMsg + } + +void T_PresenceBlocking::SendCanceledSrvMsgL( + const TDesC& aUri, const TDesC& aDispName, + TInt aMsgType ) + { + // we'll use hard-coded wrapper 0 instance for now. + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + + CXIMPIdentityImp* blockId = CXIMPIdentityImp::NewLC( aUri ); + + HBufC8* packedArray = + TXIMPObjectPacker::PackL( *blockId ); + CleanupStack::PushL( packedArray ); + + // use filetool to send it for plugin. + CXIMPTestFileSrvMsg* srvMsg = CXIMPTestFileSrvMsg::NewL( aMsgType, + *packedArray ); + CleanupStack::PushL( srvMsg ); + wrapper->FileTool().CleanAllL(); + wrapper->FileTool().SrvMsgStoreL( srvMsg ); + CleanupStack::PopAndDestroy( 3 ); // blockId, packedArray, srvMsg + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// send a faked server-originated message with empty contents +// +void T_PresenceBlocking::SendSrvMsgL( TInt aMsgType ) + { + // we'll use hard-coded wrapper 0 instance for now. + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + + // create a server-originated faked message with empty contents + RXIMPObjOwningPtrArray blockList; + + HBufC8* packedArray = TXIMPObjectPacker::PackArrayL( blockList ); + CleanupStack::PushL( packedArray ); + + // use filetool to send it for plugin. + CXIMPTestFileSrvMsg* srvMsg = CXIMPTestFileSrvMsg::NewL( aMsgType, + *packedArray ); + CleanupStack::PushL( srvMsg ); + wrapper->FileTool().CleanAllL(); + wrapper->FileTool().SrvMsgStoreL( srvMsg ); + CleanupStack::PopAndDestroy( 2 ); // srvMsg, packedArray + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// create a block list event with given arrays +// +CPresenceBlockListEventImp* + T_PresenceBlocking::CreateBlockListEventLCX( + const TDesC& aUri, + const TDesC& aDispName, + MXIMPDataSubscriptionState::TSubscriptionState aSubscriptionState, + MXIMPDataSubscriptionState::TDataState aDataState, + TTestPBlOperationSpecifier aOperation, + RPrBlockInfoImpArray* aCurrentList) + { + // create the arrays + + // new list + RPrBlockInfoImpArray* newList = new ( ELeave ) RPrBlockInfoImpArray; + CleanupDeletePushL( newList ); + + // current list, created by caller + if(!aCurrentList) // if client didnt created the list + aCurrentList = new ( ELeave ) RPrBlockInfoImpArray; + CleanupDeletePushL( aCurrentList ); + + // removed list + RPrBlockInfoImpArray* removedList = new ( ELeave ) RPrBlockInfoImpArray; + CleanupDeletePushL( removedList ); + + // updated list + RPrBlockInfoImpArray* updatedList = new ( ELeave ) RPrBlockInfoImpArray; + CleanupDeletePushL( updatedList ); + + // create subscription state + CXIMPDataSubscriptionStateImp* subsState = CXIMPDataSubscriptionStateImp::NewLC(); + + + // create the group info + CPresenceBlockInfoImp* blockInfoForEvent1 = NULL; + { + CXIMPIdentityImp* idForEvent = CXIMPIdentityImp::NewLC( aUri ); + blockInfoForEvent1 = CPresenceBlockInfoImp::NewLC( *idForEvent, aDispName ); + + CleanupStack::Pop( blockInfoForEvent1 ); + CleanupStack::PopAndDestroy( idForEvent ); + CleanupStack::PushL( blockInfoForEvent1 ); + } + + CPresenceBlockInfoImp* blockInfoForEvent2 = + TXIMPObjectCloner< CPresenceBlockInfoImp >::CloneLC( *blockInfoForEvent1 ); + + TInt count(0); + TBool found(EFalse); + TInt i(0); + + // put the given group info into the specified array + switch ( aOperation ) + { + case ETestPBlAdded: + { + newList->AppendL( blockInfoForEvent2 ); + CleanupStack::Pop( blockInfoForEvent2 ); + + aCurrentList->AppendL( blockInfoForEvent1 ); + CleanupStack::Pop( blockInfoForEvent1 ); + + break; + } + + case ETestPBlRemoved: + { + // search the given id in current list + count = aCurrentList->Count(); + for(i=0;iBlockedEntityId()).Identity()) == aUri ) + && ( (((*aCurrentList)[i])->BlockedEntityDisplayName()) == aDispName )) + { + found = ETrue; + break; + } + } + if(found) // do we need to leave if error? Waqas + { + delete (*aCurrentList)[i]; + aCurrentList->Remove(i); + removedList->AppendL( blockInfoForEvent2 ); + CleanupStack::Pop( blockInfoForEvent2 ); + } + else + CleanupStack::PopAndDestroy( blockInfoForEvent2 ); + + CleanupStack::PopAndDestroy( blockInfoForEvent1 ); + } + break; + case ETestPBlUpdated: + { + updatedList->AppendL( blockInfoForEvent2 ); + CleanupStack::Pop( blockInfoForEvent2); + CleanupStack::PopAndDestroy( blockInfoForEvent1 ); + } + break; + + case ETestPBlCurrent: + { + // don't add, thus return what user has given + CleanupStack::PopAndDestroy( blockInfoForEvent2 ); // blockInfoForEvent2 + CleanupStack::PopAndDestroy( blockInfoForEvent1 ); // blockInfoForEvent1 + } + break; + + default: + { + User::Leave( KErrArgument ); + } + break; + } + + subsState->SetSubscriptionStateL(aSubscriptionState); + subsState->SetDataStateL(aDataState); + + // create the actual event + CPresenceBlockListEventImp* tmp = + CPresenceBlockListEventImp::NewLC( + newList, + aCurrentList, + removedList, + updatedList, + subsState ); + + // subState is owned by the event, we need to pop it out from the stack + CleanupStack::Pop( tmp ); + CleanupStack::Pop( subsState ); + CleanupStack::PushL( tmp ); + + /* + * In cleanupstack there are 5 items, FIFO + * - added/new list + * - current list + * - removed list + * - updated list + * - event imp + */ + + return tmp; + } + +// =========================================================================== +// TEST CASE TABLE +// =========================================================================== +// +EUNIT_BEGIN_TEST_TABLE( + T_PresenceBlocking, + "XIMPFW presence blocking tests", + "MODULE" ) + +PRFW_DECORATED_TEST( + "Subscribe block list", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_SubscribeBlockList_Single_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Refresh block list subscription", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_SubscribeBlockListRefresh_Single_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Subscribe block list, multiple", + "", + "", + "FUNCTIONALITY", + SetupMultiple_L, + T_SubscribeBlockList_Multiple_L, + Teardown ) + + +PRFW_DECORATED_TEST( + "Handle presence block list", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_HandlePresenceBlockList_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Block presence", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_BlockPresence_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Cancel presence block", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_CancelBlockedPresence_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Handle blocked and canceled blocks", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_HandlePresenceBlocked_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Handle blocked and canceled blocks", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_HandlePresenceBlockCanceled_L, + Teardown ) + +EUNIT_END_TEST_TABLE + + +// =========================================================================== +// TEST SUITE CONSTRUCTION +// =========================================================================== +// +EXPORT_C MEUnitTest* CreateTestSuiteL() + { + return T_PresenceBlocking::NewL(); + } + + +// end of file diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presenceblocking/t_presenceblocking.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presenceblocking/t_presenceblocking.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,177 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef T_PRESENCEBLOCKING_H +#define T_PRESENCEBLOCKING_H + +#include +#include +#include "prfwteststatuseventlistener.h" +#include "prfwtestmessaging.h" +#include "ximpdatasubscriptionstateimp.h" +#include "presencetypehelpers.h" + +class CXIMPTestContextWrapper; +class CXIMPTestContextWrapperMgr; +class CXIMPTestMessenger; +class CPresenceBlockInfoImp; +class CPresenceBlockListEventImp; + +/** + * XIMP Framework Eunit tests. + * + * Tests for XIMP session management services. + * + * @since S60 v4.0 + */ +class T_PresenceBlocking : public CEUnitTestSuiteClass + { + +public: + static T_PresenceBlocking* NewL(); + virtual ~T_PresenceBlocking(); + + +private: + T_PresenceBlocking(); + void ConstructL(); + +private: // Test case functions + + void Setup_L(); + void SetupMultiple_L(); + void BindL(); + void BindAllL(); + void Teardown(); + void UnbindL(); + void UnbindAllL(); + void SubscribeL(); + void UnsubscribeL(); + + void T_SubscribeBlockList_Single_L(); + void T_SubscribeBlockListRefresh_Single_L(); + void T_SubscribeBlockList_Multiple_L(); + void T_HandlePresenceBlockList_L(); + void T_BlockPresence_L(); + void T_CancelBlockedPresence_L(); + void T_HandlePresenceBlocked_L(); + void T_HandlePresenceBlockCanceled_L(); + + +private: // Test helpers + + /** + * Fake a server-originated (=mobile terminated) message. + * The message appears to adaptation and framework as if + * it came from the network. Uses only one group. + * @param aUri The URI of group + * @param aDispName The display name for the group + * @param aMsgType The message type for CXIMPTestFileSrvMsg + */ + void SendSrvMsgL( + const TDesC& aUri, const TDesC& aDispName, + TInt aMsgType ); + void SendBlockedSrvMsgL( + const TDesC& aUri, const TDesC& aDispName, + TInt aMsgType ); + void SendCanceledSrvMsgL( + const TDesC& aUri, const TDesC& aDispName, + TInt aMsgType ); + + /** + * Fake a server-originated message with empty content. + * Whether to use this depends on the event you expect. + * @see SendSrvMsgL + */ + void SendSrvMsgL( TInt aMsgType ); + + // @see below + /* + enum TTestPBlArraySpecifier //Waqas: Not used anymore, use next one + { + ETestPBlNewList = 0, // new block list + ETestPBlAdded, // added block + ETestPBlCurrent, // current block list + ETestPBlRemoved, // removed block + ETestPBlUpdated, // updated block + ETestPBlEmpty, // make an empty array for empty event + };*/ + + enum TTestPBlOperationSpecifier + { + ETestPBlAdded = 0, // added block + ETestPBlCurrent, // current block list + ETestPBlRemoved, // removed block + ETestPBlUpdated // updated block + }; + + /** + * Creates an event for adding, current, removing or updating + * block list. The caller provides an identity and current blocked list + * and depending on the provided operation an event is created. + * + * In cleanupstack there are 4 items, FIFO: + * - created list + * - updated list + * - deleted list + * - event imp + * + * This is because this event won't take ownership to the arrays + * when created this way. + * + * @param aUri Uri + * @param aDispName Displayname + * @param aOperation operation for which caller wants to generates event + * @param aCurrentList Current blocked list provided by caller, method takes + * ownership of the current list, and it is included in above 4 items. + * a NULL pointer with operation ETestPBlCurrent causes empty event. + * @return The suitably filled event. + */ + CPresenceBlockListEventImp* CreateBlockListEventLCX( + const TDesC& aUri, + const TDesC& aDispName, + MXIMPDataSubscriptionState::TSubscriptionState aSubscriptionState, + MXIMPDataSubscriptionState::TDataState aDataState, + TTestPBlOperationSpecifier aOperation, + RPrBlockInfoImpArray* aCurrentList = NULL + ); + + +private: // Test data + + /** + * Eunit test case table declaration. + */ + EUNIT_DECLARE_TEST_TABLE; + + // owned + CXIMPTestContextWrapperMgr* iWrapperMgr; + + // + TInt iLastError; + RXIMPObjOwningPtrArray< CPresenceBlockInfoImp > iValidateArray; + }; + + +#endif // T_PRESENCEBLOCKING_H + + + +// end of file + + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presenceblocking/t_presenceblocking.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presenceblocking/t_presenceblocking.mmp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,56 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "../../tsrcutils/eunitcommon/eunittstdllbase.hrh" +#include "../../tsrcutils/processmaster/pm.h" + +TARGET t_presenceblocking.dll +CAPABILITY ALL -TCB -DRM +SOURCEPATH . +SOURCE t_presenceblocking.cpp + + +USERINCLUDE ../../../../../ximpfw/core/srcdatamodel +USERINCLUDE ../../../../../ximpfw/presence/srcpresencedatamodel +USERINCLUDE ../../../../../ximpfw/presence/srcpresencedatamodel/presentitygroups +USERINCLUDE ../../../../../ximpfw/presence/srcpresencedatamodel/presencewatching +USERINCLUDE ../../../../../ximpfw/presence/srcpresencedatamodel/presenceauthorization +USERINCLUDE ../../../../../ximpfw/presence/srcpresencedatamodel/presencepublishing +USERINCLUDE ../../../../../ximpfw/presence/srcpresencedatamodel/presenceinfo +USERINCLUDE ../../../../../ximpfw/core/srcutils + +// TODO remove unnecessary +SYSTEMINCLUDE ../../../../../ximpfw/inc/core/base +SYSTEMINCLUDE ../../../../../ximpfw/inc/core/datamodel +SYSTEMINCLUDE ../../../../../ximpfw/inc/core/protocolplugin +SYSTEMINCLUDE ../../../../../ximpfw/inc/core/protocolpluginhost +SYSTEMINCLUDE ../../../../../ximpfw/inc/presence/presencedatamodel +SYSTEMINCLUDE ../../../../../ximpfw/inc/presence/presencemanagement +SYSTEMINCLUDE ../../../../../ximpfw/inc/presence/presenceprotocolplugin +SYSTEMINCLUDE ../../../../../ximpfw/inc/presence/presenceprotocolpluginhost + +LIBRARY ecom.lib +LIBRARY bafl.lib +LIBRARY ximpdatamodel.lib +LIBRARY presencedatamodel.lib +LIBRARY ximputils.lib +LIBRARY estor.lib +LIBRARY eunit.lib + +// end of file + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencecache/T_PresenceCache.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencecache/T_PresenceCache.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,978 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +// CLASS HEADER +#include "T_PresenceCache.h" + +// EXTERNAL INCLUDES +#include +#include + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + + +// Implementation files used for testing only +#include "presencebuddyinfoimp.h" +#include "presenceinfoimp.h" +#include "presencebuddyinfolistimp.h" + + +// CONSTANTS +_LIT8( KIdentityField, "Identity" ); + +_LIT( KBuddyId1sip, "sip:BuddyId1@xyz.com" ); +_LIT( KBuddyId2sip, "sip:BuddyId2@xyz.com" ); +_LIT( KBuddyId3sip, "sip:BuddyId3@xyz.com" ); +_LIT( KBuddyId1ECE, "ECE:BuddyId1@xyz.com" ); +_LIT( KBuddyId2ECE, "ECE:BuddyId2@xyz.com" ); +_LIT( KBuddyId3ECE, "ECE:BuddyId3@xyz.com" ); +_LIT( KBuddyId1MSN, "MSN:BuddyId1@xyz.com" ); +_LIT( KBuddyId2MSN, "MSN:BuddyId2@xyz.com" ); +_LIT( KBuddyId3MSN, "MSN:BuddyId3@xyz.com" ); +_LIT( KBuddyId1VoIP, "VoIP:BuddyId1@xyz.com" ); +_LIT( KBuddyId2VoIP, "VoIP:BuddyId2@xyz.com" ); +_LIT( KBuddyId3VoIP, "VoIP:BuddyId3@xyz.com" ); +_LIT( KBuddyId1ICQ, "ICQ:BuddyId1@xyz.com" ); +_LIT( KBuddyId2ICQ, "ICQ:BuddyId2@xyz.com" ); +_LIT( KBuddyId3ICQ, "ICQ:BuddyId3@xyz.com" ); +_LIT( KBuddyId1no, "no:BuddyId1@xyz.com" ); +_LIT( KBuddyId2no, "no:BuddyId2@xyz.com" ); +_LIT( KBuddyId3no, "no:BuddyId3@xyz.com" ); + +_LIT( KBuddyId1, "BuddyId1@xyz.com" ); +_LIT( KBuddyId2, "BuddyId2@xyz.com" ); +_LIT( KBuddyId3, "BuddyId3@xyz.com" ); + +_LIT( KText1, "KText1" ); +_LIT( KText2, "KText2" ); +_LIT( KText3, "KText3" ); +_LIT( KText4, "KText4" ); +_LIT( KText5, "KText5" ); +_LIT( KText6, "KText6" ); + +_LIT( KService1, "sip" ); +_LIT( KService2, "ECE" ); +_LIT( KService3, "MSN" ); +_LIT( KService4, "VoIP" ); +_LIT( KService5, "ICQ" ); +_LIT( KService6, "no" ); + +// INTERNAL INCLUDES + + +// CONSTRUCTION +T_PresenceCache* T_PresenceCache::NewL() + { + T_PresenceCache* self = T_PresenceCache::NewLC(); + CleanupStack::Pop(); + + return self; + } + +T_PresenceCache* T_PresenceCache::NewLC() + { + T_PresenceCache* self = new( ELeave ) T_PresenceCache(); + CleanupStack::PushL( self ); + + self->ConstructL(); + + return self; + } + +// Destructor (virtual by CBase) +T_PresenceCache::~T_PresenceCache() + { + } + +// Default constructor +T_PresenceCache::T_PresenceCache() + { + } + +// Second phase construct +void T_PresenceCache::ConstructL() + { + // The ConstructL from the base class CEUnitTestSuiteClass must be called. + // It generates the test case table. + CEUnitTestSuiteClass::ConstructL(); + + iCoverageTesting=EFalse; + } + +// METHODS + + +void T_PresenceCache::SetupL( ) + { + __UHEAP_MARK; + iMPresenceCacheWriter = MPresenceCacheWriter::NewL(); + iMPresenceCacheReader = MPresenceCacheReader::NewL(); + + iPresenceFeeder = MPresenceFeeder::NewL(KService6); + } + + +void T_PresenceCache::Teardown( ) + { + if(iMPresenceCacheReader) + delete iMPresenceCacheReader; + delete iMPresenceCacheWriter; + delete iPresenceFeeder; + delete iExpectedNotifyContent; + + if(iPresBuddyInfoList) + delete iPresBuddyInfoList; + REComSession::FinalClose(); + User::SetJustInTime( ETrue ); + __UHEAP_MARKEND; + } + +void T_PresenceCache::T__PresenceInfoL() + { + // Try to read while empty + MXIMPIdentity* identity = iMPresenceCacheReader->NewIdentityLC(); + identity->SetIdentityL(KBuddyId1); + + //KErrArgument + MPresenceInfo* presInfoRead = iMPresenceCacheReader->PresenceInfoLC(*identity); + EUNIT_ASSERT_EQUALS( (TInt)presInfoRead, NULL ); + + //empty read + identity->SetIdentityL(KBuddyId1sip); + presInfoRead = iMPresenceCacheReader->PresenceInfoLC(*identity); + EUNIT_ASSERT_EQUALS( (TInt)presInfoRead, NULL ); + + // write buddy presence info + MPresenceBuddyInfo* buddyPresInfoWrite = + MakeBuddyPresenceInfoLC(KBuddyId1sip, KText1); + TInt err = iMPresenceCacheWriter->WritePresenceL(buddyPresInfoWrite); + + // Now read it + presInfoRead = iMPresenceCacheReader->PresenceInfoLC(*identity); + + + //Now verify it + const CPresenceInfoImp* actualInfo = + TXIMPGetImpClassOrPanic::From(*(buddyPresInfoWrite->PresenceInfo())); + + CPresenceInfoImp* readInfo = + TXIMPGetImpClassOrPanic::From(*presInfoRead); + + TBool same = actualInfo->EqualsContent(*readInfo); + + CleanupStack::PopAndDestroy(3); //identity, buddyPresInfoWrite, presInfoRead; + + EUNIT_ASSERT_EQUALS( same, ETrue ); + } + + +void T_PresenceCache::T_WriteReadPresenceAsyncL() + { + + //MPresenceBuddyInfoList* buddyInfoList = CPresenceBuddyInfoListImp::NewLC(); + MPresenceBuddyInfoList* buddyInfoList = + iMPresenceCacheWriter->NewPresenceBuddyInfoListLC(KNullDesC); + //buddyInfoList->SetServiceNameL(KService1); + // write buddies in all services + MPresenceBuddyInfo* buddyPresInfoWrite(NULL); + + TInt err2(KErrNone); + + buddyPresInfoWrite =MakeBuddyPresenceInfoLC(KBuddyId1sip, KText1); + buddyInfoList->AddOrReplace(buddyPresInfoWrite);CleanupStack::Pop(1); + + buddyPresInfoWrite =MakeBuddyPresenceInfoLC(KBuddyId2sip, KText1); + buddyInfoList->AddOrReplace(buddyPresInfoWrite);CleanupStack::Pop(1); + + buddyPresInfoWrite =MakeBuddyPresenceInfoLC(KBuddyId3sip, KText1); + buddyInfoList->AddOrReplace(buddyPresInfoWrite);CleanupStack::Pop(1); + + buddyPresInfoWrite =MakeBuddyPresenceInfoLC(KBuddyId1ECE, KText1); + buddyInfoList->AddOrReplace(buddyPresInfoWrite);CleanupStack::Pop(1); + + buddyPresInfoWrite =MakeBuddyPresenceInfoLC(KBuddyId2ECE, KText1); + buddyInfoList->AddOrReplace(buddyPresInfoWrite);CleanupStack::Pop(1); + + buddyPresInfoWrite =MakeBuddyPresenceInfoLC(KBuddyId3ECE, KText1); + buddyInfoList->AddOrReplace(buddyPresInfoWrite);CleanupStack::Pop(1); + + buddyPresInfoWrite =MakeBuddyPresenceInfoLC(KBuddyId1MSN, KText1); + buddyInfoList->AddOrReplace(buddyPresInfoWrite);CleanupStack::Pop(1); + + buddyPresInfoWrite =MakeBuddyPresenceInfoLC(KBuddyId2MSN, KText1); + buddyInfoList->AddOrReplace(buddyPresInfoWrite);CleanupStack::Pop(1); + + buddyPresInfoWrite =MakeBuddyPresenceInfoLC(KBuddyId3MSN, KText1); + buddyInfoList->AddOrReplace(buddyPresInfoWrite);CleanupStack::Pop(1); + + + //Only For increasing coverage for lists + MXIMPIdentity* identity = CXIMPIdentityImp::NewLC(); + identity->SetIdentityL(KBuddyId3no); + EUNIT_ASSERT_EQUALS( buddyInfoList->FindAndRemove(*identity), KErrNotFound); + EUNIT_ASSERT_EQUALS( buddyInfoList->Count(), 9); + buddyPresInfoWrite =MakeBuddyPresenceInfoLC(KBuddyId3no, KText1); + EUNIT_ASSERT_EQUALS( buddyInfoList->AddOrReplace(buddyPresInfoWrite), KErrNone); + + EUNIT_ASSERT_EQUALS( buddyInfoList->Count(), 10); + EUNIT_ASSERT_EQUALS( buddyInfoList->FindAndRemove(*identity), KErrNone); + EUNIT_ASSERT_EQUALS( buddyInfoList->Count(), 9); + EUNIT_ASSERT_EQUALS( buddyInfoList->FindAndRemove(*identity), KErrNotFound); + CleanupStack::Pop(1); // buddyPresInfoWrite + EUNIT_ASSERT_EQUALS( (TInt)(buddyInfoList->FindAndGet(*identity)), NULL); + CleanupStack::PopAndDestroy(1); // identity + + //calling async write function + TInt err = iMPresenceCacheWriter->WritePresenceL(buddyInfoList,this); + //if (err==KErrNone) + // WaitComplete(); + //Try Cancelling + err = iMPresenceCacheWriter->CancelWrite(); //always cancels receiving callback + //Write Again + err = iMPresenceCacheWriter->WritePresenceL(buddyInfoList,this); + if (err==KErrNone) + WaitComplete(); + else //Try again + { + err = iMPresenceCacheWriter->WritePresenceL(buddyInfoList,this); + if (err==KErrNone) + WaitComplete(); + } + EUNIT_ASSERT_EQUALS( iErrorFromHandler, KErrNone); + + + // read from 3rd service MSN + err = iMPresenceCacheReader->AllBuddiesPresenceInService(KService3, this); + //Try Cancelling + err = iMPresenceCacheReader->CancelRead(); + // Try reading again + err = iMPresenceCacheReader->AllBuddiesPresenceInService(KService3, this); + if (err+1) + WaitComplete(); + EUNIT_ASSERT_EQUALS( iErrorFromHandler, KErrNone); + + + //Now verify it, pick something to verify + CPresenceBuddyInfoImp* actualInfo(NULL); + CPresenceBuddyInfoImp* readInfo(NULL); + RPointerArray myArraywrite = buddyInfoList->GetObjectCollection(); + + RPointerArray myArrayread; // wont be owned + + TBool same1(EFalse); + if(iPresBuddyInfoList) // if list is received, compare for 3rd service MSN + { + myArrayread = iPresBuddyInfoList->GetObjectCollection(); //not owned + //1 + actualInfo = + TXIMPGetImpClassOrPanic::From(*(myArraywrite[6])); + + readInfo = + TXIMPGetImpClassOrPanic::From(*(myArrayread[0])); + + same1 = actualInfo->EqualsContent(*readInfo); + } + + + // read for first service sip + err = iMPresenceCacheReader->AllBuddiesPresenceInService(KService1, this); + if (err+1) + WaitComplete(); + EUNIT_ASSERT_EQUALS( iErrorFromHandler, KErrNone); + TBool same2(EFalse); + if(iPresBuddyInfoList) // if list is received, compare for 1st service SIP + { + myArrayread = iPresBuddyInfoList->GetObjectCollection(); //not owned + + actualInfo = + TXIMPGetImpClassOrPanic::From(*(myArraywrite[2])); + + readInfo = + TXIMPGetImpClassOrPanic::From(*(myArrayread[2])); + + same2 = actualInfo->EqualsContent(*readInfo); + } + + + // All buddies count + TInt count = iMPresenceCacheReader->BuddyCountInAllServices(); + + // buddies count in specific service + TInt count2 = iMPresenceCacheReader->BuddyCountInService(KService2); + + + // Testing DeletePresenceL + MXIMPIdentity* identity2 = CXIMPIdentityImp::NewLC(); + identity2->SetIdentityL(KBuddyId3MSN); + TInt remove = iMPresenceCacheWriter->DeletePresenceL(*identity2); + EUNIT_ASSERT_EQUALS( remove, KErrNone ); + remove = iMPresenceCacheWriter->DeletePresenceL(*identity2); + EUNIT_ASSERT_EQUALS( remove, KErrNotFound ); + identity2->SetIdentityL(KBuddyId3ICQ); + remove = iMPresenceCacheWriter->DeletePresenceL(*identity2); + EUNIT_ASSERT_EQUALS( remove, KErrNotFound ); + CleanupStack::PopAndDestroy(1); //identity2; + + + + TInt serviceCount = iMPresenceCacheReader->ServicesCount(); + + CleanupStack::PopAndDestroy(1); //buddyInfoList; + + EUNIT_ASSERT_EQUALS( same1, ETrue ); + EUNIT_ASSERT_EQUALS( same2, ETrue ); + EUNIT_ASSERT_EQUALS( count, 9 ); + EUNIT_ASSERT_EQUALS( count2, 3 ); + EUNIT_ASSERT_EQUALS( serviceCount, 3 ); + + } + + +void T_PresenceCache::T_DeletingAndCancellingL() + { + //Empty Reading + MXIMPIdentity* identity = CXIMPIdentityImp::NewLC(); + identity->SetIdentityL(KBuddyId1); + + + CleanupStack::PopAndDestroy(1); //identity + + //Empty counting functions + + // All buddies count + TInt count = iMPresenceCacheReader->BuddyCountInAllServices(); + EUNIT_ASSERT_EQUALS( count, 0 ); + + // buddies count in specific service + TInt count2 = iMPresenceCacheReader->BuddyCountInService(KService2); + EUNIT_ASSERT_EQUALS( count2, KErrNotFound ); + + + //Services count + TInt serviceCount = iMPresenceCacheReader->ServicesCount(); + EUNIT_ASSERT_EQUALS( serviceCount, 0 ); + + + //Empty async reading + TInt err = iMPresenceCacheReader->AllBuddiesPresenceInService(KService3, this); + if (err+1) + WaitComplete(); + EUNIT_ASSERT_EQUALS( iErrorFromHandler, KErrNotFound); + + //Writing async and verify results// this checks cancelling also + T_WriteReadPresenceAsyncL(); + + // Now try deleting + err = iMPresenceCacheWriter->DeleteService(KService3); + EUNIT_ASSERT_EQUALS( err, KErrNone); + + //Try deleting again + err = iMPresenceCacheWriter->DeleteService(KService3); + EUNIT_ASSERT_EQUALS( err, KErrNotFound); + + //Try reading the deleted presence + err = iMPresenceCacheReader->AllBuddiesPresenceInService(KService3, this); + if (err==KErrNone) + WaitComplete(); + EUNIT_ASSERT_EQUALS( iErrorFromHandler, KErrNotFound); + } + +void T_PresenceCache::T_PerformanceL() + { + + + + + } + +void T_PresenceCache::T_RunAllL() + { + T__PresenceInfoL(); + T_DeleteAllCacheL(); + + T_WriteReadPresenceAsyncL(); + T_DeleteAllCacheL(); + + T_DeletingAndCancellingL(); + // let the destructor delete the cache + } + + +//Utility Functions +MPresenceInfo* T_PresenceCache::MakePresenceInfoLC() + { + MPresenceInfo* presInfo = CPresenceInfoImp::NewLC(); + + MPresenceInfoFieldValueText* value = CPresenceInfoFieldValueTextImp::NewLC(); + value->SetTextValueL(KBuddyId1); + + MPresenceInfoField* infoField = CPresenceInfoFieldImp::NewLC(); + infoField->SetFieldTypeL(KIdentityField); + infoField->SetFieldValue(value); + + + MPersonPresenceInfo* personPres = CPersonPresenceInfoImp::NewLC(); + MPresenceInfoFieldCollection& fieldCol = personPres->Fields(); + fieldCol.AddOrReplaceFieldL(infoField); + TInt fieldCount= fieldCol.FieldCount(); + + presInfo->SetPersonPresenceL(personPres); + + CleanupStack::Pop(3);//personPres,infoField,value + + return presInfo; + } + +// Utility function but also test some code +MPresenceBuddyInfo* T_PresenceCache::MakeBuddyPresenceInfoLC( + const TDesC& id, const TDesC& text) + { + // it sets objects differently for different flag values of iCoverageTesting + // just of code coverage purpose + if(iCoverageTesting) + { // make the new + iCoverageTesting = !iCoverageTesting; + MPresenceBuddyInfo* buddyPresInfo = iMPresenceCacheWriter->NewBuddyPresenceInfoLC(); + MPresenceInfo* presInfo = iMPresenceCacheWriter->NewPresenceInfoLC(); + + MPresenceInfoFieldValueText* value = CPresenceInfoFieldValueTextImp::NewLC(); + value->SetTextValueL(text); + + MPresenceInfoField* infoField = CPresenceInfoFieldImp::NewLC(); + infoField->SetFieldTypeL(KIdentityField); + infoField->SetFieldValue(value); + + + MPersonPresenceInfo* personPres = CPersonPresenceInfoImp::NewLC(); + MPresenceInfoFieldCollection& fieldCol = personPres->Fields(); + fieldCol.AddOrReplaceFieldL(infoField); + TInt fieldCount= fieldCol.FieldCount(); + + presInfo->SetPersonPresenceL(personPres); + + MXIMPIdentity* identity = CXIMPIdentityImp::NewLC(); + identity->SetIdentityL(id); + + buddyPresInfo->Set(identity, presInfo); + + CleanupStack::Pop(5);//personPres,infoField,value,buddyPresInfo, identity + + return buddyPresInfo; + } + + iCoverageTesting = !iCoverageTesting; + MPresenceBuddyInfo* buddyPresInfo = iMPresenceCacheWriter->NewBuddyPresenceInfoLC(); + MPresenceInfo* presInfo = iMPresenceCacheWriter->NewPresenceInfoLC(); + + MPresenceInfoFieldValueText* value = CPresenceInfoFieldValueTextImp::NewLC(); + value->SetTextValueL(text); + + MPresenceInfoField* infoField = CPresenceInfoFieldImp::NewLC(); + infoField->SetFieldTypeL(KIdentityField); + infoField->SetFieldValue(value); + + + MPersonPresenceInfo* personPres = CPersonPresenceInfoImp::NewLC(); + MPresenceInfoFieldCollection& fieldCol = personPres->Fields(); + fieldCol.AddOrReplaceFieldL(infoField); + TInt fieldCount= fieldCol.FieldCount(); + + presInfo->SetPersonPresenceL(personPres); + + MXIMPIdentity* identity = CXIMPIdentityImp::NewLC(); + identity->SetIdentityL(id); + + + //Call again for the sake of code coverage + EUNIT_ASSERT_EQUALS( buddyPresInfo->SetBuddyId(identity), KErrNone); + EUNIT_ASSERT_EQUALS( buddyPresInfo->SetPresenceInfo(presInfo), KErrNone); + + CleanupStack::Pop(5);//personPres,infoField,value,buddyPresInfo, identity + + return buddyPresInfo; + } + +void T_PresenceCache::T_DeleteAllCacheL() + { + // all service uids + TInt count = iMPresenceCacheReader->ServicesCount(); + TInt err(KErrNone); + + err = iMPresenceCacheWriter->DeleteService(KService1); + err = iMPresenceCacheWriter->DeleteService(KService2); + err = iMPresenceCacheWriter->DeleteService(KService3); + err = iMPresenceCacheWriter->DeleteService(KService4); + err = iMPresenceCacheWriter->DeleteService(KService5); + err = iMPresenceCacheWriter->DeleteService(KService6); + } + +void T_PresenceCache::T_MakePerformancePreconditionsL() + { + } + +// Buddy with status text and avater +MPresenceBuddyInfo* T_PresenceCache::T_MakePerformanceBuddyLC(const TDesC& /*id*/ ) + { + /* + MPresenceBuddyInfo* buddyPresInfo = iMPresenceCacheWriter->NewBuddyPresenceInfoLC(); + MPresenceInfo* presInfo = iMPresenceCacheWriter->NewPresenceInfoLC(); + + //Text field + MPresenceInfoFieldValueText* value = CPresenceInfoFieldValueTextImp::NewLC(); + value->SetTextValueL(text); + + MPresenceInfoField* infoField = CPresenceInfoFieldImp::NewLC(); + infoField->SetFieldTypeL(KIdentityField); + infoField->SetFieldValue(value); + + //Binary field + MPresenceInfoFieldValueBinay* value = CPresenceInfoFieldValueBinaryImp::NewLC(); + value->SetBinaryValueL(text); + + MPresenceInfoField* infoField = CPresenceInfoFieldImp::NewLC(); + infoField->SetFieldTypeL(KIdentityField); + infoField->SetFieldValue(value); + + + + MPersonPresenceInfo* personPres = CPersonPresenceInfoImp::NewLC(); + MPresenceInfoFieldCollection& fieldCol = personPres->Fields(); + fieldCol.AddOrReplaceFieldL(infoField); + TInt fieldCount= fieldCol.FieldCount(); + + presInfo->SetPersonPresenceL(personPres); + + MXIMPIdentity* identity = CXIMPIdentityImp::NewLC(); + identity->SetIdentityL(id); + + TUid serviceid; + serviceid.iUid = service; + + buddyPresInfo->Set(serviceid, identity, presInfo); + + CleanupStack::Pop(5);//personPres,infoField,value,buddyPresInfo, identity + + return buddyPresInfo;*/ + } + + +void T_PresenceCache::T_SubscribeBuddy1Response() + { + // Notice: First set the initial state for User1, this is needed at least now. + MPresenceBuddyInfo* initInfo = MakeBuddyPresenceInfoLC(KBuddyId1no, KText1); + TInt err = iMPresenceCacheWriter->WritePresenceL(initInfo); + CleanupStack::PopAndDestroy( ); // initInfo + EUNIT_ASSERT_EQUALS( err, 0 ); + + err = iMPresenceCacheReader->SetObserverForSubscribedNotifications( this ); + EUNIT_ASSERT_EQUALS( err, 0 ); + + MXIMPIdentity* identity = CXIMPIdentityImp::NewLC(); + identity->SetIdentityL(KBuddyId1no); + + err = iMPresenceCacheReader->SubscribePresenceBuddyChangeL( *identity); + CleanupStack::PopAndDestroy(1); //identity + EUNIT_ASSERT_EQUALS( err, 0 ); + + // Presence feeder + iExpectedNotifyStatus = KErrNone; + iNbrNotifys = 1; + iPresenceFeeder->SetAvailabilityL( KBuddyId1, MPresenceFeeder::ENotAvailable, KText2); + + // TODO: + delete iExpectedNotifyContent; + iExpectedNotifyContent = NULL; + iExpectedNotifyContent = + MakeBuddyPresenceInfoLC(KBuddyId1no, KText2); + CleanupStack::Pop( ); // iExpectedNotifyContent + err = iMPresenceCacheWriter->WritePresenceL(iExpectedNotifyContent); + EUNIT_ASSERT_EQUALS( err, 0 ); + + iPresenceFeeder->RemoveAvailabilityL(KBuddyId2); + + // Now we start to wait callback method HandlePresenceNotificationL + WaitComplete(); + } + +void T_PresenceCache::T_SubscribeBuddyAndUnsubscribe() + { + // Test few error cases first + + // Test null parameter error case + TInt err = iMPresenceCacheReader->SetObserverForSubscribedNotifications( NULL ); + EUNIT_ASSERT_EQUALS( err, KErrArgument ); + + // Test subscription without callback registeration + MXIMPIdentity* identity = CXIMPIdentityImp::NewLC(); + identity->SetIdentityL(KBuddyId1ECE); + + err = iMPresenceCacheReader->SubscribePresenceBuddyChangeL( *identity); + EUNIT_ASSERT_EQUALS( err, KErrNotReady ); + + // Now make successful subscription + err = iMPresenceCacheReader->SetObserverForSubscribedNotifications( this ); + EUNIT_ASSERT_EQUALS( err, 0 ); + err = iMPresenceCacheReader->SubscribePresenceBuddyChangeL( *identity); + EUNIT_ASSERT_EQUALS( err, 0); + + // Make successful unsubscription + iMPresenceCacheReader->UnSubscribePresenceBuddyChangeL( *identity); + + CleanupStack::PopAndDestroy(1); //identity + // Now we start to wait callback method HandlePresenceNotificationL + } + +void T_PresenceCache::T_SubscribeBuddyManyResponses() + { + // Notice: First set the initial state for User1, this is needed at least now. + MPresenceBuddyInfo* initInfo = MakeBuddyPresenceInfoLC(KBuddyId1no, KText1); + TInt err = iMPresenceCacheWriter->WritePresenceL(initInfo); + CleanupStack::PopAndDestroy( ); // initInfo + EUNIT_ASSERT_EQUALS( err, 0 ); + + err = iMPresenceCacheReader->SetObserverForSubscribedNotifications( this ); + EUNIT_ASSERT_EQUALS( err, 0 ); + + MXIMPIdentity* identity = CXIMPIdentityImp::NewLC(); + identity->SetIdentityL(KBuddyId1no); + + err = iMPresenceCacheReader->SubscribePresenceBuddyChangeL( *identity); + CleanupStack::PopAndDestroy(1); //identity + EUNIT_ASSERT_EQUALS( err, 0 ); + + // Presence feeder + iExpectedNotifyStatus = KErrNone; + iNbrNotifys = 4; + iPresenceFeeder->SetAvailabilityL( KBuddyId1, MPresenceFeeder::ENotAvailable, KText2); + + delete iExpectedNotifyContent; + iExpectedNotifyContent = NULL; + iExpectedNotifyContent = + MakeBuddyPresenceInfoLC(KBuddyId1no, KText1); + CleanupStack::Pop( ); // iExpectedNotifyContent + err = iMPresenceCacheWriter->WritePresenceL(iExpectedNotifyContent); + EUNIT_ASSERT_EQUALS( err, 0 ); + + // Now we start to wait callback method HandlePresenceNotificationL + WaitComplete(); + } + +void T_PresenceCache::T_DeleteBeforeNotify() + { + // Notice: First set the initial state for User1, this is needed at least now. + TInt err; + /* + MPresenceBuddyInfo* initInfo = MakeBuddyPresenceInfoLC( KServiceUid6, KBuddyId1, KText1); + TInt err = iMPresenceCacheWriter->WritePresenceL(initInfo); + CleanupStack::PopAndDestroy( ); // initInfo + EUNIT_ASSERT_EQUALS( err, 0 ); */ + + err = iMPresenceCacheReader->SetObserverForSubscribedNotifications( this ); + EUNIT_ASSERT_EQUALS( err, 0 ); + + MXIMPIdentity* identity = CXIMPIdentityImp::NewLC(); + identity->SetIdentityL(KBuddyId1no); + + err = iMPresenceCacheReader->SubscribePresenceBuddyChangeL( *identity); + CleanupStack::PopAndDestroy(1); //identity + EUNIT_ASSERT_EQUALS( err, 0 ); + + // Presence feeder + iExpectedNotifyStatus = KErrNone; + iNbrNotifys = 1; + + + delete iMPresenceCacheReader; + iMPresenceCacheReader = NULL; + + // TODO: + delete iExpectedNotifyContent; + iExpectedNotifyContent = NULL; + iExpectedNotifyContent = + MakeBuddyPresenceInfoLC(KBuddyId1no, KText2); + CleanupStack::Pop( ); // iExpectedNotifyContent + err = iMPresenceCacheWriter->WritePresenceL(iExpectedNotifyContent); + EUNIT_ASSERT_EQUALS( err, 0 ); + + //no notification should come, since we have deleted the subscriber + } + + +// Callback observers + +void T_PresenceCache::HandlePresenceWriteL(TInt aErrorCode) + { + EUNIT_PRINT(_L("HandlePresenceWriteL")); + EUNIT_PRINT(_L(" aErrorCode: %d"), aErrorCode); + iCbReceived = ETrue; + iErrorFromHandler = aErrorCode; + + if( iWait.IsStarted() ) + { + iWait.AsyncStop(); + } + } + +void T_PresenceCache::HandlePresenceReadL(TInt aErrorCode, + MPresenceBuddyInfoList* aPresenceBuddyInfoList) + { + EUNIT_PRINT(_L("HandlePresenceReadL")); + EUNIT_PRINT(_L(" aErrorCode: %d"), aErrorCode); + iCbReceived = ETrue; + iErrorFromHandler = aErrorCode; + + + if(iPresBuddyInfoList) + delete iPresBuddyInfoList; iPresBuddyInfoList=NULL; + iPresBuddyInfoList = aPresenceBuddyInfoList; + + if( iWait.IsStarted() ) + { + iWait.AsyncStop(); + } + } + +// ***************************************************************************** + +void T_PresenceCache::HandlePresenceNotificationL(TInt aErrorCode, + MPresenceBuddyInfo* aPresenceBuddyInfo) + { + EUNIT_PRINT(_L("HandlePresenceNotiicationL")); + EUNIT_PRINT(_L(" aErrorCode: %d"), aErrorCode); + iCbReceived = ETrue; + iErrorFromHandler = aErrorCode; + + // check what is expected + EUNIT_ASSERT_EQUALS( aErrorCode, iExpectedNotifyStatus ); + + if ( aPresenceBuddyInfo ) + { + // We do not want to get anything when not expecting it. + TBool isNull = iExpectedNotifyContent ? EFalse : ETrue; + EUNIT_ASSERT_EQUALS( isNull, EFalse ); + // just check that this does not crash + const MXIMPIdentity* buddyId = aPresenceBuddyInfo->BuddyId(); + // Then test the whole content + TBool eq = iExpectedNotifyContent->EqualsIdentity( aPresenceBuddyInfo ); + EUNIT_ASSERT_EQUALS( eq, ETrue ); + } + else + { + EUNIT_PRINT(_L(" received buddyInfo is NULL")); + } + + delete aPresenceBuddyInfo; + + iNbrNotifys--; + + /* The test sequence of complicated case is + * sub Usr1 + * write Usr1 -> Notify + * sub Usr2 + * write Usr1 -> Notify + * write Usr2 -> Notify + * unsub Usr2 + * write Usr2 + * delete Usr1 -> notify(empty) + */ + + switch ( iNbrNotifys ) + { + case 3: + // subscribe U2 + { + // Notice: First set the initial state for User1, this is needed at least now. + MPresenceBuddyInfo* initInfo = MakeBuddyPresenceInfoLC(KBuddyId2no, KText2); + TInt err = iMPresenceCacheWriter->WritePresenceL(initInfo); + CleanupStack::PopAndDestroy( ); // initInfo + EUNIT_ASSERT_EQUALS( err, 0 ); + + MXIMPIdentity* identity = CXIMPIdentityImp::NewLC(); + identity->SetIdentityL(KBuddyId2no); + err = iMPresenceCacheReader->SubscribePresenceBuddyChangeL( *identity); + CleanupStack::PopAndDestroy(1); //identity + EUNIT_ASSERT_EQUALS( err, 0 ); + + // Presence feeder + iExpectedNotifyStatus = KErrNone; + delete iExpectedNotifyContent; + iExpectedNotifyContent = NULL; + iExpectedNotifyContent = + MakeBuddyPresenceInfoLC(KBuddyId1no, KText1); + CleanupStack::Pop( ); // iExpectedNotifyContent + err = iMPresenceCacheWriter->WritePresenceL(iExpectedNotifyContent); + EUNIT_ASSERT_EQUALS( err, 0 ); + // Now we start to wait callback method HandlePresenceNotificationL + } + break; + case 2: + { + // Presence feeder + iExpectedNotifyStatus = KErrNone; + delete iExpectedNotifyContent; + iExpectedNotifyContent = NULL; + iExpectedNotifyContent = + MakeBuddyPresenceInfoLC(KBuddyId2no, KText3); + CleanupStack::Pop( ); // iExpectedNotifyContent + TInt err = iMPresenceCacheWriter->WritePresenceL(iExpectedNotifyContent); + EUNIT_ASSERT_EQUALS( err, 0 ); + // Now we start to wait callback method HandlePresenceNotificationL + } + break; + case 1: + { + // Unsubscribe Usr2 + MXIMPIdentity* identity = CXIMPIdentityImp::NewLC(); + identity->SetIdentityL(KBuddyId2no); + iMPresenceCacheReader->UnSubscribePresenceBuddyChangeL( *identity ); + CleanupStack::PopAndDestroy(1); //identity + + // Write Usr2 + iExpectedNotifyStatus = KErrNone; + delete iExpectedNotifyContent; + iExpectedNotifyContent = NULL; + + // delete Usr1 + iPresenceFeeder->RemovePresenceL(KBuddyId1no); + iExpectedNotifyContent = + MakeBuddyPresenceInfoLC( KBuddyId1no, KText3); + TInt err = iExpectedNotifyContent->SetPresenceInfo( NULL ); + EUNIT_ASSERT_EQUALS( err, KErrArgument ); + CleanupStack::Pop( ); // iExpectedNotifyContent + + // Now we start to wait callback method HandlePresenceNotificationL + } + break; + case 0: + default: + if( iWait.IsStarted() ) + { + iWait.AsyncStop(); + } + break; + }; + + } + +// ***************************************************************************** + + +void T_PresenceCache::T_TestFeeder() + { + iPresenceFeeder->SetAvailabilityL(KBuddyId1,MPresenceFeeder::ENotAvailable,KText2); + iPresenceFeeder->SetAvailabilityL(KBuddyId1,MPresenceFeeder::ENotAvailable,KText2); + iPresenceFeeder->RemoveAvailabilityL(KBuddyId2); + iPresenceFeeder->RemoveAvailabilityL(KBuddyId1); + iPresenceFeeder->SetAvailabilityL(KBuddyId1,MPresenceFeeder::ENotAvailable,KText2); + iPresenceFeeder->RemovePresenceL(KBuddyId2); + iPresenceFeeder->RemovePresenceL(KBuddyId1); + iPresenceFeeder->SetAvailabilityL(KBuddyId1,MPresenceFeeder::ENotAvailable,KText2); + iPresenceFeeder->RemoveAllPresences(); + } + +// TEST TABLE +EUNIT_BEGIN_TEST_TABLE( + T_PresenceCache, + "Presence Cache module tests.", + "MODULE" ) + +EUNIT_TEST( + "T__PresenceInfoL", + "PresenceCache", + "T__PresenceInfoL", + "FUNCTIONALITY", + SetupL, T__PresenceInfoL, Teardown) + +EUNIT_TEST( + "T_WriteReadPresenceAsyncL", + "PresenceCache", + "T_WriteReadPresenceAsyncL", + "FUNCTIONALITY", + SetupL, T_WriteReadPresenceAsyncL, Teardown) + +EUNIT_TEST( + "T_DeletingAndCancellingL", + "PresenceCache", + "T_DeletingAndCancellingL", + "FUNCTIONALITY", + SetupL, T_DeletingAndCancellingL, Teardown) + +EUNIT_TEST( + "T_RunAllL", + "PresenceCache", + "T_RunAllL", + "FUNCTIONALITY", + SetupL, T_RunAllL, Teardown) + +EUNIT_TEST( + "T_TestFeeder", + "PresenceFeeder", + "T_TestFeeder", + "FUNCTIONALITY", + SetupL, T_TestFeeder, Teardown) + +EUNIT_TEST( + "T_SubscribeBuddyAndUnsubscribe", + "PresenceCache", + "T_SubscribeBuddyAndUnsubscribe", + "FUNCTIONALITY", + SetupL, T_SubscribeBuddyAndUnsubscribe, Teardown) + +EUNIT_TEST( + "T_SubscribeBuddy1Response", + "PresenceCache", + "T_SubscribeBuddy1Response", + "FUNCTIONALITY", + SetupL, T_SubscribeBuddy1Response, Teardown) + +EUNIT_TEST( + "T_SubscribeBuddyManyResponses", + "PresenceCache", + "T_SubscribeBuddyManyResponses", + "FUNCTIONALITY", + SetupL, T_SubscribeBuddyManyResponses, Teardown) + +EUNIT_TEST( + "T_DeleteBeforeNotify", + "PresenceCache", + "T_DeleteBeforeNotify", + "FUNCTIONALITY", + SetupL, T_DeleteBeforeNotify, Teardown) + +EUNIT_END_TEST_TABLE + +// END OF FILE diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencecache/T_PresenceCache.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencecache/T_PresenceCache.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,161 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +#ifndef __T_MPRESENCECACHEREADER_H__ +#define __T_MPRESENCECACHEREADER_H__ + +// EXTERNAL INCLUDES +#include +#include +#include +#include +#include +#include + +#include + +class MPresenceBuddyInfo; +class MPresenceFeeder; + + +// INTERNAL INCLUDES + + +// FORWARD DECLARATIONS + + +// CLASS DEFINITION +/** + * TODO Auto-generated EUnit test suite + * + */ +NONSHARABLE_CLASS( T_PresenceCache ) + : public CEUnitTestSuiteClass, + public MPresCacheReadHandler, + public MPresCacheWriteHandler + { + public: // Constructors and destructors + + /** + * Two phase construction + */ + static T_PresenceCache* NewL(); + static T_PresenceCache* NewLC(); + /** + * Destructor + */ + ~T_PresenceCache(); + + public: // from handlers + void HandlePresenceWriteL(TInt aErrorCode); + void HandlePresenceReadL(TInt aErrorCode, + MPresenceBuddyInfoList* aPresenceBuddyInfoList); + void HandlePresenceNotificationL(TInt aErrorCode, + MPresenceBuddyInfo* aPresenceBuddyInfo); + + private: // Constructors and destructors + + T_PresenceCache(); + void ConstructL(); + + private: // New methods + + void SetupL(); + + void Teardown(); + + void T__PresenceInfoL(); + + void T_WriteReadPresenceAsyncL(); + + void T_DeletingAndCancellingL(); + + void T_PerformanceL(); + + void T_RunAllL(); + + void T_TestFeeder(); + + void T_SubscribeBuddy1Response(); + + void T_SubscribeBuddyAndUnsubscribe(); + + void T_SubscribeBuddyManyResponses(); + + void T_DeleteBeforeNotify(); + + + private: // utilities + MPresenceInfo* MakePresenceInfoLC(); + + MPresenceBuddyInfo* MakeBuddyPresenceInfoLC( + const TDesC& id, const TDesC& text); + + void T_DeleteAllCacheL(); + + void T_MakePerformancePreconditionsL(); + + MPresenceBuddyInfo* T_MakePerformanceBuddyLC(const TDesC& id); + + inline void WaitComplete(); + + + private: // Data + + MPresenceCacheReader* iMPresenceCacheReader; + MPresenceCacheWriter* iMPresenceCacheWriter; + + MPresenceFeeder* iPresenceFeeder; + + + MPresenceBuddyInfoList* iPresBuddyInfoList; + + EUNIT_DECLARE_TEST_TABLE; + TUid iUid; + + TBool iCoverageTesting; + + // we will record the error from handler here + TInt iErrorFromHandler; + + //OWN: Active scheduler wait and Cb received indication + CActiveSchedulerWait iWait; + TBool iCbReceived; + + // expected status of next notification + TInt iExpectedNotifyStatus; + // How many notifications are waicted until test is done. + TInt iNbrNotifys; + // Expected content of notification + // OWN + MPresenceBuddyInfo* iExpectedNotifyContent; + + }; + +inline void T_PresenceCache::WaitComplete() + { + iCbReceived = EFalse; + if( !iCbReceived ) + { + iWait.Start(); + } + } + +#endif // __T_MPRESENCECACHEREADER_H__ + +// End of file diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencecache/T_PresenceCache.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencecache/T_PresenceCache.mmp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,72 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include + + +TARGET t_presencecache.dll +TARGETTYPE dll +UID 0x1000af5a 0x01700000 + +CAPABILITY ALL -TCB +VENDORID 0x00000000 + +SOURCEPATH . +SOURCE t_presencecache.cpp +SOURCE t_presencecache_dllmain.cpp + + +USERINCLUDE . +USERINCLUDE ../../../../../ximpfw/presence/srcpresencedatamodel +USERINCLUDE ../../../../../ximpfw/presence/srcpresencedatamodel/presencecache + +SYSTEMINCLUDE /epoc32/../../epoc32/include +SYSTEMINCLUDE /epoc32/../../epoc32/include/Digia/EUnit + +// System include folders required by the tested code +//SYSTEMINCLUDE ../../../inc/presence/presencecache +SYSTEMINCLUDE ../../../../../ximpfw/inc/presence/presencedatamodel + + +//Following internal headers we are using +SYSTEMINCLUDE ../../../../../ximpfw/core/srcdatamodel +SYSTEMINCLUDE ../../../../../ximpfw/core/srcutils + + +SYSTEMINCLUDE ../../../../../ximpfw/presence/srcpresencedatamodel/presencepublishing +SYSTEMINCLUDE ../../../../../ximpfw/presence/srcpresencedatamodel/presenceinfo +SYSTEMINCLUDE ../../../../../ximpfw/presence/srcpresencedatamodel/presentitygroups +SYSTEMINCLUDE ../../../../../ximpfw/presence/srcpresencedatamodel +SYSTEMINCLUDE ../../../../../ximpfw/presence/srcpresencedatamodel/presencewatching +SYSTEMINCLUDE ../../../../../ximpfw/presence/srcpresencedatamodel/presenceauthorization +SYSTEMINCLUDE ../../../../../ximpfw/presence/srcpresencecache/presencecacheclient +SYSTEMINCLUDE ../../../../../ximpfw/presence/srcpresencecache/presencecacheserver + +MW_LAYER_SYSTEMINCLUDE + +LIBRARY EUnit.lib +LIBRARY EUnitUtil.lib +LIBRARY euser.lib +LIBRARY ecom.lib +LIBRARY presencedatamodel.lib +LIBRARY ximpdatamodel.lib +LIBRARY presencecacheclient.lib +LIBRARY ximputils.lib + +LIBRARY presencefeeder.lib + +// End of file diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencecache/T_PresenceCache_DllMain.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencecache/T_PresenceCache_DllMain.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,37 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +// CLASS HEADER +#include "T_PresenceCache.h" + +// EXTERNAL INCLUDES +#include + +EXPORT_C MEUnitTest* CreateTestSuiteL() + { + return T_PresenceCache::NewL(); + } + +#ifndef EKA2 +GLDEF_C TInt E32Dll( TDllReason ) + { + return KErrNone; + } +#endif + +// END OF FILE diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencecache/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencecache/bld.inf Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,28 @@ +/* +* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS +// /epoc32/RELEASE/winscw/UDEB/T_PresenceCache.dll /epoc32/RELEASE/winscw/UDEB/z/sys/bin/T_PresenceCache.dll + +PRJ_TESTMMPFILES +T_PresenceCache.mmp + +// End of file diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencegrantrequestmngt/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencegrantrequestmngt/bld.inf Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,25 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Build information file for t_presencegrantrequestmngt.dll +* +*/ + + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +PRJ_TESTMMPFILES +t_presencegrantrequestmngt.mmp diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencegrantrequestmngt/t_presencegrantrequestmngt.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencegrantrequestmngt/t_presencegrantrequestmngt.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,911 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +#include "eunittools.h" + +#include +#include +#include + +#include +#include +#include +#include +#include + +#include "t_presencegrantrequestmngt.h" + +#include "ximprequestcompleteeventimp.h" + +//#include "prfwtestpresencedatautils.h" + +// grant req includes +#include "presencegrantrequestinfoimp.h" +#include "presencegrantrequestlisteventimp.h" + + +// other data model includes +#include "ximpidentityimp.h" + +// utils includes +#include "ximpobjecthelpers.h" + +// testing tool includes +#include "prfwtestmessaging.h" +#include "prfwtestmessenger.h" +#include "prfwtestcontextwrappermgr.h" +#include "prfwtestcontextwrapper.h" + +#include "prfwtestfilesrvmsg.h" +#include "prfwtestfiletool.h" +#include "prfwtestlistener.h" + +#include "prfwtestrobustnesstools.h" + +_LIT8( KPrefix1, "PreA_" ); +_LIT8( KPrefix2, "PreB_" ); +_LIT8( KPrefix3, "PreC_" ); +_LIT8( KPrefix4, "PreD_" ); + +// ============================ MEMBER FUNCTIONS =============================== + +// CONSTRUCTION +T_PresenceGrantRequestManagement* T_PresenceGrantRequestManagement::NewL() + { + T_PresenceGrantRequestManagement* self = new( ELeave ) T_PresenceGrantRequestManagement; + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + + return self; + } + + +T_PresenceGrantRequestManagement::~T_PresenceGrantRequestManagement() + { + PrfwTestRobustness::DoPreCleaning(); + } + + +void T_PresenceGrantRequestManagement::ConstructL() + { + CEUnitTestSuiteClass::ConstructL(); + } + + +T_PresenceGrantRequestManagement::T_PresenceGrantRequestManagement() + { + } + + + +// =========================================================================== +// TEST CASE SETUP & TEARDOWN METHODS +// =========================================================================== +// + +void T_PresenceGrantRequestManagement::Setup_L() + { + PrfwTestRobustness::DoPreCleaning(); + + iWrapperMgr = CXIMPTestContextWrapperMgr::NewL(); + iWrapperMgr->CreateWrapperL(); + } + +void T_PresenceGrantRequestManagement::SetupMultiple_L() + { + PrfwTestRobustness::DoPreCleaning(); + + iWrapperMgr = CXIMPTestContextWrapperMgr::NewL(); + iWrapperMgr->CreateWrapperL(); + iWrapperMgr->CreateWrapperL(); + iWrapperMgr->CreateWrapperL(); + } + + +void T_PresenceGrantRequestManagement::BindL() + { + CXIMPTestContextWrapper* wrapper0 = iWrapperMgr->GetWrapperL( 0 ); + + wrapper0->BindL( 0 ); + } + +void T_PresenceGrantRequestManagement::BindAllL() + { + for( TInt a = 0; a < iWrapperMgr->WrapperCount(); ++a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + wrapper->BindL( 0 ); + } + } + + +void T_PresenceGrantRequestManagement::Teardown() + { + delete iWrapperMgr; + iWrapperMgr = NULL; + + REComSession::FinalClose(); + + PrfwTestRobustness::DoPreCleaning(); + } + +void T_PresenceGrantRequestManagement::UnbindL() + { + // Do unbind + CXIMPTestContextWrapper* wrapper0 = iWrapperMgr->GetWrapperL( 0 ); + wrapper0->UnbindL(); + } + +void T_PresenceGrantRequestManagement::UnbindAllL() + { + for( TInt a = 0; a < iWrapperMgr->WrapperCount(); ++a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + wrapper->UnbindL(); + } + } + + +// =========================================================================== +// TEST CASES for presentity presence subscription +// =========================================================================== + + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +void T_PresenceGrantRequestManagement::T_SubscribeGrantRequestList_Single_L() + { + EUNIT_PRINT( _L("Single presence grant request list subscription") ); + + BindL(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization(); + + // --------------------------------------------- + // 1. Subscribe grant request list + + // Setup status event listener for RequestComplete + listener2->Reset(); + + // normal request complete + TXIMPRequestId reqIdDummy; // not checked + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + // --------------------------------------------- + + // subscribe + // --------------------------------------------- + TXIMPRequestId reqId = presAuth.SubscribePresenceGrantRequestListL(); + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Subscribe failed" ); + // --------------------------------------------- + + // verify that SubscribeGrantListL was called + COMMONASSERT( messenger, EXIMPPlgTestSubscribePresenceGrantRequestListCalled, "SubscribeGrantListL was not called", ETrue, NULL ); + + + // --------------------------------------------- + // 2. refresh subscription + + // Setup status event listener for RequestComplete + listener2->Reset(); + + evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + RPrGrntReqInfoImpArray* pendingList(NULL); + CPresenceGrantRequestListEventImp* event = CreateGrantRequestListEventLCX( + KNullDesC, KNullDesC, + MXIMPDataSubscriptionState::ESubscriptionActive, + MXIMPDataSubscriptionState::EDataUnavailable, + ETestPGRPending, pendingList ); + listener2->ExpectL( event ); + CleanupStack::Pop(); //event 3 to go. + + // refresh subscription + // --------------------------------------------- + reqId = presAuth.SubscribePresenceGrantRequestListL(); + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Refresh failed" ); + CleanupStack::PopAndDestroy( 3 ); // rest of the items. + + + // --------------------------------------------- + // 3. Unsubscribe grant request list + + // Setup status event listener for RequestComplete + listener2->Reset(); + + evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + // unsubscribe + // --------------------------------------------- + reqId = presAuth.UnsubscribePresenceGrantRequestListL(); + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Unsubscribe failed" ); + + + // verify that UnsubscribeGrantListL was called + COMMONASSERT( messenger, EXIMPPlgTestUnsubscribePresenceGrantRequestListCalled, "UnsubscribeGrantListL was not called", ETrue, NULL ); + + + // --------------------------------------------- + // 4. Unsubscribe grant request list (non-subscribed) + + // Setup status event listener for RequestComplete + listener2->Reset(); + + evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + // unsubscribe + // --------------------------------------------- + reqId = presAuth.UnsubscribePresenceGrantRequestListL(); + + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Unsubscribe failed" ); + + // verify that UnsubscribeGrantListL was called + COMMONASSERT( messenger, EXIMPPlgTestUnsubscribePresenceGrantRequestListCalled, "UnsubscribeGrantListL was not called", ETrue, NULL ); + + // Deinitiliaze event source from listener. + listener2->SetEventSourceL( NULL ); + + UnbindL(); + + CleanupStack::PopAndDestroy( listener2 ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +void T_PresenceGrantRequestManagement::T_SubscribeGrantRequestList_Multiple_L() + { + EUNIT_PRINT( _L("Multiple presence grant request list subscription") ); + + BindAllL(); + + TInt countOfWrappers = iWrapperMgr->WrapperCount(); + TInt a(0); + for( a = 0; a < countOfWrappers; ++a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization(); + + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // expect normal request complete + TXIMPRequestId reqIdDummy; // not checked + CXIMPRequestCompleteEventImp* evReqComplete = + CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + // subscribe + TXIMPRequestId reqId = presAuth.SubscribePresenceGrantRequestListL(); + + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Subscribe failed" ); + + // verify that SubscribePresenceGrantRequestListL was called + COMMONASSERT( messenger, EXIMPPlgTestSubscribePresenceGrantRequestListCalled, "SubscribePresenceGrantRequestListL was not called", ETrue, NULL ); + + CleanupStack::PopAndDestroy( listener2 ); + } + + for( a = 0; a < countOfWrappers; ++a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization(); + + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // expect normal request complete + TXIMPRequestId reqIdDummy; // not checked + CXIMPRequestCompleteEventImp* evReqComplete = + CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + // unsubscribe + TXIMPRequestId reqId = presAuth.UnsubscribePresenceGrantRequestListL(); + + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Unsubscribe failed" ); + + // verify that EXIMPPlgTestUnsubscribeGroupListCalled was called + COMMONASSERT( messenger, EXIMPPlgTestUnsubscribeGroupListCalled, + "UnsubscribePresenceGrantRequestListL was not called", + EFalse, + "UnsubscribePresenceGrantRequestListL was called" ); + + CleanupStack::PopAndDestroy( listener2 ); + } + + UnbindAllL(); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +void T_PresenceGrantRequestManagement::SubscribeL() + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization(); + + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + + // ------------------------------------------------------ + // expect normal request complete + TXIMPRequestId reqIdDummy; // not checked + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + // ------------------------------------------------------ + + // subscribe + TXIMPRequestId reqId = presAuth.SubscribePresenceGrantRequestListL(); + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Subscribe failed" ); + + COMMONASSERT( messenger, EXIMPPlgTestSubscribePresenceGrantRequestListCalled, "SubscribeGrantRequestListL was not called", ETrue, NULL ); + + CleanupStack::PopAndDestroy( listener2 ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +void T_PresenceGrantRequestManagement::UnsubscribeL() + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization(); + + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + + // ------------------------------------------------------ + // expect normal request complete + TXIMPRequestId reqIdDummy; // not checked + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + // ------------------------------------------------------ + + // unsubscribe + TXIMPRequestId reqId = presAuth.UnsubscribePresenceGrantRequestListL(); + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Unsubscribe failed" ); + + COMMONASSERT( messenger, EXIMPPlgTestUnsubscribePresenceGrantRequestListCalled, "UnsubscribeGrantRequestListL was not called", ETrue, NULL ); + + CleanupStack::PopAndDestroy( listener2 ); + } + + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +void T_PresenceGrantRequestManagement::T_HandlePresenceGrantRequestList_L() + { + EUNIT_PRINT( _L("Handle presence grant request list.") ); + + // log in and subscribe a group list + BindL(); + SubscribeL(); + + // ------------------------------------------------------ + // some startup stuff + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + // ------------------------------------------------------ + + // Tell the protocol it should act normally + wrapper->GetMessenger()->SetNoError(); + + // ------------------------------------------------------ + // 1. Create faked server message about grant req list (empty) + SendSrvMsgL( CXIMPTestFileSrvMsg::ETestSrvMsgPresenceGrantRequestList ); + + // ------------------------------------------------------ + // expect empty MPresentityGroupList event. + + RPrGrntReqInfoImpArray* pendingList(NULL); + CPresenceGrantRequestListEventImp* event = CreateGrantRequestListEventLCX( + KNullDesC, KNullDesC, + MXIMPDataSubscriptionState::ESubscriptionActive, + MXIMPDataSubscriptionState::EDataAvailable, + ETestPGRPending, pendingList ); + + listener2->ExpectL( event ); + CleanupStack::Pop( event ); // 3 more items in cleanupstack + + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "HandlePresenceGrantRequestListL failed" ); + CleanupStack::PopAndDestroy( 3 ); // lists + // ------------------------------------------------------ + + + _LIT16( KGrantReqUri, "http://carpe.diem.com" ); + _LIT16( KGrantReqDispName, "DispnameA, LoremI" ); + + // ------------------------------------------------------ + // 2. Create faked server message about grant req list (new) + listener2->Reset(); + + pendingList = NULL; // previous one was destroyed + event = CreateGrantRequestListEventLCX( KGrantReqUri, + KGrantReqDispName, + MXIMPDataSubscriptionState::ESubscriptionActive, + MXIMPDataSubscriptionState::EDataAvailable, + ETestPGRNewReq, pendingList ); + + SendSrvMsgL( KGrantReqUri, + KGrantReqDispName, + CXIMPTestFileSrvMsg::ETestSrvMsgPresenceGrantRequestList ); + + listener2->ExpectL( event ); + CleanupStack::Pop( event ); // 3 more items in cleanupstack + + // Waqas: Fixed Ticket #18 + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "HandlePresenceGrantRequestListL failed" ); + + CleanupStack::PopAndDestroy( 3 ); // lists + // ------------------------------------------------------ + + + CleanupStack::PopAndDestroy( listener2 ); + + // clean it up + UnsubscribeL(); + UnbindL(); + } + + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +_LIT16( KPresentUri1, "http://lorem.ipsum.com" ); +_LIT16( KPresentUri2, "http://carpe.diem.com" ); +_LIT16( KPresentDispName1, "DispnameA, LoremI" ); +_LIT16( KPresentDispName2, "DispnameB, CarpeD" ); +_LIT16( KPresentProtAddr1, "ABC" ); +_LIT16( KPresentProtAddr2, "HIJ" ); + +void T_PresenceGrantRequestManagement::T_HandlePresenceGrantRequestReceivedObsoleted_L() + { + EUNIT_PRINT( _L("Handle presence grant request received") ); + + BindL(); + SubscribeL(); + + // ------------------------------------------------------ + // some startup stuff + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + // ------------------------------------------------------ + + // Tell the protocol it should act normally + wrapper->GetMessenger()->SetNoError(); + + // ------------------------------------------------------ + // 1. Create faked server message about grant req received + SendSrvMsgInfoL( KPresentUri1, + KPresentDispName1, + CXIMPTestFileSrvMsg::ETestSrvMsgPresenceGrantRequestReceived ); + + // ------------------------------------------------------ + // expect MPresenceGrantRequestList event. + + CPresenceGrantRequestListEventImp* event = CreateGrantRequestListEventLCX( + KPresentUri1, KPresentDispName1, + MXIMPDataSubscriptionState::ESubscriptionActive, + MXIMPDataSubscriptionState::EDataAvailable, + ETestPGRNewReq, NULL ); + + listener2->ExpectL( event ); + CleanupStack::Pop( event ); // 3 more items in cleanupstack + + // Waqas: Fixed Ticket #18 + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "HandlePresenceGrantRequesReceivedL failed" ); + + + CleanupStack::PopAndDestroy( 3 ); // lists + // ------------------------------------------------------ + + + // ------------------------------------------------------ + // 2. Create faked server message about grant req obsoleted + listener2->Reset(); + + SendSrvMsgInfoL( KPresentUri1, + KPresentDispName1, + CXIMPTestFileSrvMsg::ETestSrvMsgPresenceGrantRequestObsoleted ); + + + // we need to create pending list to give to the event + RPrGrntReqInfoImpArray* pendingList = new ( ELeave ) RPrGrntReqInfoImpArray; + CleanupDeletePushL( pendingList ); + // create the group info + CXIMPIdentityImp* idForEvent = CXIMPIdentityImp::NewLC( KPresentUri1 ); + CPresenceGrantRequestInfoImp* grantInfoForEvent = + CPresenceGrantRequestInfoImp::NewLC( *idForEvent, KPresentDispName1 ); + pendingList->AppendL( grantInfoForEvent ); + CleanupStack::Pop( grantInfoForEvent ); + CleanupStack::PopAndDestroy( idForEvent ); + CleanupStack::Pop( pendingList ); + + //Now create the event + event = CreateGrantRequestListEventLCX( + KPresentUri1, KPresentDispName1, + MXIMPDataSubscriptionState::ESubscriptionActive, + MXIMPDataSubscriptionState::EDataAvailable, + ETestPGRObsoleted, pendingList ); + + listener2->ExpectL( event ); + CleanupStack::Pop( event ); // 3 more items in cleanupstack + + // Waqas: Fixed Ticket #18 + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "HandlePresenceGrantRequesObsoletedL failed" ); + + CleanupStack::PopAndDestroy( 3 ); // lists + // ------------------------------------------------------ + + CleanupStack::PopAndDestroy( listener2 ); + + // clean it up + UnsubscribeL(); + UnbindL(); + } + + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// send a faked server-originated message with grant request list made +// from the given uri and displayname +// +void T_PresenceGrantRequestManagement::SendSrvMsgL( + const TDesC& aUri, const TDesC& aDispName, + TInt aMsgType ) + { + // we'll use hard-coded wrapper 0 instance for now. + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + + // create a grant req info contained within the server-originated + // faked message + RXIMPObjOwningPtrArray grantList; + CleanupClosePushL( grantList ); + + CXIMPIdentityImp* grantId = CXIMPIdentityImp::NewLC( aUri ); + CPresenceGrantRequestInfoImp* grantItem = + CPresenceGrantRequestInfoImp::NewLC( *grantId, aDispName ); + grantList.AppendL( grantItem ); + CleanupStack::Pop( grantItem ); + CleanupStack::PopAndDestroy( grantId ); + + HBufC8* packedArray = + TXIMPObjectPacker::PackArrayL( grantList ); + CleanupStack::PushL( packedArray ); + + // use filetool to send it for plugin. + CXIMPTestFileSrvMsg* srvMsg = CXIMPTestFileSrvMsg::NewL( aMsgType, + *packedArray ); + CleanupStack::PushL( srvMsg ); + wrapper->FileTool().CleanAllL(); + wrapper->FileTool().SrvMsgStoreL( srvMsg ); + CleanupStack::PopAndDestroy( 3 ); // srvMsg, packedArray, grantList + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// send a faked server-originated message with grant request info made +// from the given uri and displayname +// +void T_PresenceGrantRequestManagement::SendSrvMsgInfoL( + const TDesC& aUri, const TDesC& aDispName, + TInt aMsgType ) + { + // we'll use hard-coded wrapper 0 instance for now. + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + + CXIMPIdentityImp* grantId = CXIMPIdentityImp::NewLC( aUri ); + CPresenceGrantRequestInfoImp* grantItem = + CPresenceGrantRequestInfoImp::NewLC( *grantId, aDispName ); + + HBufC8* packedInfo = + TXIMPObjectPacker::PackL( *grantItem ); + CleanupStack::PushL( packedInfo ); + + // use filetool to send it for plugin. + CXIMPTestFileSrvMsg* srvMsg = CXIMPTestFileSrvMsg::NewL( aMsgType, + *packedInfo ); + CleanupStack::PushL( srvMsg ); + wrapper->FileTool().CleanAllL(); + wrapper->FileTool().SrvMsgStoreL( srvMsg ); + CleanupStack::PopAndDestroy( 4 ); // srvMsg, packedItem, grantItem, grantId + } + + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// send a faked server-originated message with empty contents +// +void T_PresenceGrantRequestManagement::SendSrvMsgL( TInt aMsgType ) + { + // we'll use hard-coded wrapper 0 instance for now. + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + + // create a server-originated faked message with empty contents + RXIMPObjOwningPtrArray grantList; + + HBufC8* packedArray = TXIMPObjectPacker::PackArrayL( grantList ); + CleanupStack::PushL( packedArray ); + + // use filetool to send it for plugin. + CXIMPTestFileSrvMsg* srvMsg = CXIMPTestFileSrvMsg::NewL( aMsgType, + *packedArray ); + CleanupStack::PushL( srvMsg ); + wrapper->FileTool().CleanAllL(); + wrapper->FileTool().SrvMsgStoreL( srvMsg ); + CleanupStack::PopAndDestroy( 2 ); // srvMsg, packedArray + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// create a grant request list event with given arrays +// +CPresenceGrantRequestListEventImp* + T_PresenceGrantRequestManagement::CreateGrantRequestListEventLCX( + const TDesC& aUri, + const TDesC& aDispName, + MXIMPDataSubscriptionState::TSubscriptionState aSubscriptionState, + MXIMPDataSubscriptionState::TDataState aDataState, + TTestPGROperation aOperation, + RPrGrntReqInfoImpArray* aPendingList + ) + { + // create the arrays + + + // new list + RPrGrntReqInfoImpArray* newList = new ( ELeave ) RPrGrntReqInfoImpArray; + CleanupDeletePushL( newList ); + + // pending list + if(!aPendingList) // if client didnt created the list + aPendingList = new ( ELeave ) RPrGrntReqInfoImpArray; + CleanupDeletePushL( aPendingList ); + + // obsoleted list + RPrGrntReqInfoImpArray* obsoletedList = new ( ELeave ) RPrGrntReqInfoImpArray; + CleanupDeletePushL( obsoletedList ); + + // create subscription state + CXIMPDataSubscriptionStateImp* subsState = CXIMPDataSubscriptionStateImp::NewLC(); + + // create the group info + CPresenceGrantRequestInfoImp* grantInfoForEvent1 = NULL; + { + CXIMPIdentityImp* idForEvent = CXIMPIdentityImp::NewLC( aUri ); + grantInfoForEvent1 = CPresenceGrantRequestInfoImp::NewLC( *idForEvent, aDispName ); + CleanupStack::Pop( grantInfoForEvent1 ); + CleanupStack::PopAndDestroy( idForEvent ); + CleanupStack::PushL( grantInfoForEvent1 ); + } + + CPresenceGrantRequestInfoImp* grantInfoForEvent2 = + TXIMPObjectCloner< CPresenceGrantRequestInfoImp >::CloneLC( *grantInfoForEvent1 ); + + TInt count(0); + TBool found(EFalse); + TInt i(0); + + + // put the given grant info into the specified array + switch ( aOperation ) + { + case ETestPGRNewReq: + { + newList->AppendL( grantInfoForEvent2 ); + CleanupStack::Pop( grantInfoForEvent2 ); + + aPendingList->AppendL( grantInfoForEvent1 ); + CleanupStack::Pop( grantInfoForEvent1 ); + + break; + } + case ETestPGRPending: + { + // don't add, thus return what user has given + CleanupStack::PopAndDestroy( grantInfoForEvent2 ); // grantInfoForEvent2 + CleanupStack::PopAndDestroy( grantInfoForEvent1 ); // grantInfoForEvent1 + break; + } + + case ETestPGRObsoleted: + { + // search the given id in pending list + count = aPendingList->Count(); + for(i=0;iRequestorId()).Identity()) == aUri ) + && ( (((*aPendingList)[i])->RequestorDisplayName()) == aDispName )) + { + found = ETrue; + break; + } + } + if(found) // do we need to leave if error? Waqas + { + delete (*aPendingList)[i]; + aPendingList->Remove(i); + obsoletedList->AppendL( grantInfoForEvent2 ); + CleanupStack::Pop( grantInfoForEvent2 ); + } + else + CleanupStack::PopAndDestroy( grantInfoForEvent2 ); + + CleanupStack::PopAndDestroy( grantInfoForEvent1 ); + break; + } + + default: + { + User::Leave( KErrArgument ); + break; + } + }; + + subsState->SetSubscriptionStateL(aSubscriptionState); + subsState->SetDataStateL(aDataState); + + // create the actual event + CPresenceGrantRequestListEventImp* tmp = + CPresenceGrantRequestListEventImp::NewLC( + newList, + aPendingList, + obsoletedList, + subsState ); + + // subState is owned by the event, we need to pop it out from the stack + CleanupStack::Pop( tmp ); + CleanupStack::Pop( subsState ); + CleanupStack::PushL( tmp ); + + /* + * In cleanupstack there are 4 items, FIFO: + * - new list + * - pending list + * - obsoleted list + * - event imp + */ + + return tmp; + } + +// =========================================================================== +// TEST CASE TABLE +// =========================================================================== +// +EUNIT_BEGIN_TEST_TABLE( + T_PresenceGrantRequestManagement, + "XIMP presence grant request management tests", + "MODULE" ) + +PRFW_DECORATED_TEST( + "Grant request list subscription, single client", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_SubscribeGrantRequestList_Single_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Grant request list subscription, multiple clients", + "", + "", + "FUNCTIONALITY", + SetupMultiple_L, + T_SubscribeGrantRequestList_Multiple_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Handle presence grant request List", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_HandlePresenceGrantRequestList_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Handle presence grant request received and obsoleted", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_HandlePresenceGrantRequestReceivedObsoleted_L, + Teardown ) + + +/* +PRFW_DECORATED_TEST( + "New and obsolete request.", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_HandlePresentityGroupCreateAndDelete_L, + Teardown ) +*/ + +EUNIT_END_TEST_TABLE + + +// =========================================================================== +// TEST SUITE CONSTRUCTION +// =========================================================================== +// +EXPORT_C MEUnitTest* CreateTestSuiteL() + { + return T_PresenceGrantRequestManagement::NewL(); + } + + +// end of file diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencegrantrequestmngt/t_presencegrantrequestmngt.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencegrantrequestmngt/t_presencegrantrequestmngt.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,168 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef T_PRESENCEGRANTREQUESTMANAGEMENT_H +#define T_PRESENCEGRANTREQUESTMANAGEMENT_H + +#include +#include +#include "prfwteststatuseventlistener.h" +#include "prfwtestmessaging.h" +#include "ximpdatasubscriptionstateimp.h" +#include "presencetypehelpers.h" + +class CXIMPTestContextWrapper; +class CXIMPTestContextWrapperMgr; +class CXIMPTestMessenger; +class CPresenceGrantRequestInfoImp; +class CPresenceGrantRequestListEventImp; + +/** + * XIMP Framework Eunit tests. + * + * Tests for XIMP session management services. + * + * @since S60 v4.0 + */ +class T_PresenceGrantRequestManagement : public CEUnitTestSuiteClass + { + +public: + static T_PresenceGrantRequestManagement* NewL(); + virtual ~T_PresenceGrantRequestManagement(); + + +private: + T_PresenceGrantRequestManagement(); + void ConstructL(); + +private: // Test case functions + + void Setup_L(); + void SetupMultiple_L(); + void BindL(); + void BindAllL(); + void Teardown(); + void UnbindL(); + void UnbindAllL(); + void SubscribeL(); + void UnsubscribeL(); + + void T_SubscribeGrantRequestList_Single_L(); + void T_SubscribeGrantRequestListRefresh_Single_L(); + void T_SubscribeGrantRequestList_Multiple_L(); + void T_HandlePresenceGrantRequestList_L(); + void T_HandlePresenceGrantRequestReceivedObsoleted_L(); + +private: // Test helpers + + /** + * Fake a server-originated (=mobile terminated) message. + * The message appears to adaptation and framework as if + * it came from the network. Uses only one group. + * @param aUri The URI of group + * @param aDispName The display name for the group + * @param aMsgType The message type for CXIMPTestFileSrvMsg + */ + void SendSrvMsgL( + const TDesC& aUri, const TDesC& aDispName, + TInt aMsgType ); + + // version for sending just the info instead of array + void SendSrvMsgInfoL( + const TDesC& aUri, const TDesC& aDispName, + TInt aMsgType ); + /** + * Fake a server-originated message with empty content. + * Whether to use this depends on the event you expect. + * @see SendSrvMsgL + */ + void SendSrvMsgL( TInt aMsgType ); + + // @see below + /* + enum TTestPGRArraySpecifier //Waqas: Not used anymore, use the next one + { + ETestPGRNewList = 0, // grant request list + ETestPGRNewReq, // new grant request + ETestPGRPending, // new grant request + ETestPGRObsoleted, // obsoleted grant request + ETestPGREmpty, // make an empty array for empty event + };*/ + + enum TTestPGROperation + { + ETestPGRNewReq = 0, // new grant request i.e. new req comes + ETestPGRPending, // new grant request i.e. subscribe to + ETestPGRObsoleted // obsoleted grant request i.e. req expired + }; + + /** + * Creates an event for newRequest, pending, or obselete presence grant + * request list. The caller provides an identity and current presence grant + * request listand depending on the provided operation an event is created. + * + * In cleanupstack there are 4 items, FIFO: + * - new list + * - pending list + * - obsoleted list + * - event imp + * + * This is because this event won't take ownership to the arrays + * when created this way. + * + * @param aUri Uri + * @param aDispName Displayname + * @param aOperation operation for which caller wants to generates event + * @param aPendingList Current pending list provided by caller, method takes + * ownership of the pending list, and it is included in above 3 lists. + * a NULL pointer with operation ETestPGRPending causes empty event. + * @return The suitably filled event. + */ + CPresenceGrantRequestListEventImp* CreateGrantRequestListEventLCX( + const TDesC& aUri, + const TDesC& aDispName, + MXIMPDataSubscriptionState::TSubscriptionState aSubscriptionState, + MXIMPDataSubscriptionState::TDataState aDataState, + TTestPGROperation aOperation, + RPrGrntReqInfoImpArray* aPendingList = NULL + ); + +private: // Test data + + /** + * Eunit test case table declaration. + */ + EUNIT_DECLARE_TEST_TABLE; + + // owned + CXIMPTestContextWrapperMgr* iWrapperMgr; + + // + TInt iLastError; + RXIMPObjOwningPtrArray< CPresenceGrantRequestInfoImp > iValidateArray; + }; + + +#endif // T_PRESENCEGRANTREQUESTMANAGEMENT_H + + + +// end of file + + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencegrantrequestmngt/t_presencegrantrequestmngt.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencegrantrequestmngt/t_presencegrantrequestmngt.mmp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,56 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "../../tsrcutils/eunitcommon/eunittstdllbase.hrh" +#include "../../tsrcutils/processmaster/pm.h" + +TARGET t_presencegrantrequestmngt.dll +CAPABILITY ALL -TCB +SOURCEPATH . +SOURCE t_presencegrantrequestmngt.cpp + + +USERINCLUDE ../../../../../ximpfw/core/srcdatamodel +USERINCLUDE ../../../../../ximpfw/presence/srcpresencedatamodel +USERINCLUDE ../../../../../ximpfw/presence/srcpresencedatamodel/presentitygroups +USERINCLUDE ../../../../../ximpfw/presence/srcpresencedatamodel/presencewatching +USERINCLUDE ../../../../../ximpfw/presence/srcpresencedatamodel/presenceauthorization +USERINCLUDE ../../../../../ximpfw/presence/srcpresencedatamodel/presencepublishing +USERINCLUDE ../../../../../ximpfw/presence/srcpresencedatamodel/presenceinfo +USERINCLUDE ../../../../../ximpfw/core/srcutils + +// TODO remove unnecessary +SYSTEMINCLUDE ../../../../../ximpfw/inc/core/base +SYSTEMINCLUDE ../../../../../ximpfw/inc/core/datamodel +SYSTEMINCLUDE ../../../../../ximpfw/inc/core/protocolplugin +SYSTEMINCLUDE ../../../../../ximpfw/inc/core/protocolpluginhost +SYSTEMINCLUDE ../../../../../ximpfw/inc/presence/presencedatamodel +SYSTEMINCLUDE ../../../../../ximpfw/inc/presence/presencemanagement +SYSTEMINCLUDE ../../../../../ximpfw/inc/presence/presenceprotocolplugin +SYSTEMINCLUDE ../../../../../ximpfw/inc/presence/presenceprotocolpluginhost + +LIBRARY ecom.lib +LIBRARY bafl.lib +LIBRARY ximpdatamodel.lib +LIBRARY presencedatamodel.lib +LIBRARY ximputils.lib +LIBRARY estor.lib +LIBRARY EUnit.lib + +// end of file + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencegrouplistmngt/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencegrouplistmngt/bld.inf Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,23 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Build information file for t_presencegrouplistmngt.dll +* +*/ + + +PRJ_PLATFORMS +DEFAULT + +PRJ_TESTMMPFILES +t_presencegrouplistmngt.mmp diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencegrouplistmngt/t_presencegrouplistmngt.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencegrouplistmngt/t_presencegrouplistmngt.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,1447 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +#include "eunittools.h" + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "ximpstatusimp.h" +#include "ximprequestcompleteeventimp.h" +#include "t_presencegrouplistmngt.h" +#include "prfwteststatuseventlistener.h" +#include "prfwtestmessaging.h" +#include "prfwtestmessenger.h" +#include "prfwtestcontextwrappermgr.h" +#include "prfwtestcontextwrapper.h" +#include "prfwtesteventfactory.h" + +#include "presenceinfoimp.h" +#include "presenceinfofilterimp.h" +#include "prfwtestpresencedatautils.h" +#include "ximpidentityimp.h" +#include "ximpobjecthelpers.h" +#include "presentitygroupinfoimp.h" +#include "presentitygrouplisteventimp.h" +#include "presentitygroupcontenteventimp.h" +#include "prfwtestfilesrvmsg.h" +#include "prfwtestfiletool.h" +#include "prfwtestlistener.h" + +#include "prfwtestrobustnesstools.h" + +// ============================ MEMBER FUNCTIONS =============================== + +// CONSTRUCTION +T_PresenceGroupListManagement* T_PresenceGroupListManagement::NewL() + { + T_PresenceGroupListManagement* self = new( ELeave ) T_PresenceGroupListManagement; + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + + return self; + } + + +T_PresenceGroupListManagement::~T_PresenceGroupListManagement() + { + PrfwTestRobustness::DoPreCleaning(); + } + + +void T_PresenceGroupListManagement::ConstructL() + { + CEUnitTestSuiteClass::ConstructL(); + } + + +T_PresenceGroupListManagement::T_PresenceGroupListManagement() + { + } + + + +// =========================================================================== +// TEST CASE SETUP & TEARDOWN METHODS +// =========================================================================== +// + +void T_PresenceGroupListManagement::Setup_L() + { + PrfwTestRobustness::DoPreCleaning(); + + iWrapperMgr = CXIMPTestContextWrapperMgr::NewL(); + iWrapperMgr->CreateWrapperL(); + } + +void T_PresenceGroupListManagement::SetupMultiple_L() + { + PrfwTestRobustness::DoPreCleaning(); + + + iWrapperMgr = CXIMPTestContextWrapperMgr::NewL(); + iWrapperMgr->CreateWrapperL(); + iWrapperMgr->CreateWrapperL(); + iWrapperMgr->CreateWrapperL(); + } + + +void T_PresenceGroupListManagement::BindL() + { + CXIMPTestContextWrapper* wrapper0 = iWrapperMgr->GetWrapperL( 0 ); + + wrapper0->BindL( 0 ); + } + +void T_PresenceGroupListManagement::BindAllL() + { + for( TInt a = 0; a < iWrapperMgr->WrapperCount(); ++a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + wrapper->BindL( 0 ); + } + } + + +void T_PresenceGroupListManagement::Teardown() + { + delete iWrapperMgr; + iWrapperMgr = NULL; + + REComSession::FinalClose(); + + PrfwTestRobustness::DoPreCleaning(); + } + +void T_PresenceGroupListManagement::UnbindL() + { + // Do unbind + CXIMPTestContextWrapper* wrapper0 = iWrapperMgr->GetWrapperL( 0 ); + wrapper0->UnbindL(); + } + +void T_PresenceGroupListManagement::UnbindAllL() + { + for( TInt a = 0; a < iWrapperMgr->WrapperCount(); ++a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + wrapper->UnbindL(); + } + } + + +// =========================================================================== +// TEST CASES for presentity presence subscription +// =========================================================================== + + +// Single client, empty filter +void T_PresenceGroupListManagement::T_SubscribePresentityGroup_Single_L() + { + EUNIT_PRINT( _L("Single presentity group list subscription") ); + + BindL(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresentityGroups& presGroup = presFeat->PresentityGroups(); + + + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // --------------------------------------------- + // normal request complete + TXIMPRequestId reqIdDummy; // not checked + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + // subscribe + TXIMPRequestId reqId = presGroup.SubscribePresentityGroupListL(); + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Subscribe failed" ); + messenger->AssertSubscribePresentityGroupListCalled( ETrue ); + + // --------------------------------------------- + evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + + + CPresentityGroupListEventImp* event = XIMPTestEventFactory::CreateGroupListEventLCX( + KNullDesC, KNullDesC, + XIMPTestEventFactory::ETestPGLEmpty, + KNullDesC, KNullDesC, + MXIMPDataSubscriptionState::ESubscriptionInactive, + MXIMPDataSubscriptionState::EDataUnavailable + ); + + listener2->ExpectL( event ); + CleanupStack::Pop( event ); // 4 more items in cleanupstack + + // unsubscribe + // --------------------------------------------- + reqId = presGroup.UnsubscribePresentityGroupListL(); + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Unsubscribe failed" ); + CleanupStack::PopAndDestroy( 4 ); // group list event imp + messenger->AssertUnsubscribePresentityGroupListCalled( ETrue ); + + CleanupStack::PopAndDestroy( listener2 ); + + UnbindL(); + } + +// Single client, empty filter, error in unsubscribe +void T_PresenceGroupListManagement::T_UnsubscribePresentityGroup_Error_Single_L() + { + EUNIT_PRINT( _L("Single presentity group list unsubscribe with error") ); + + BindL(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresentityGroups& presGroup = presFeat->PresentityGroups(); + + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // --------------------------------------------- + // subscribe + TXIMPRequestId reqIdDummy; // not checked + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + TXIMPRequestId reqId = presGroup.SubscribePresentityGroupListL(); + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Subscribe failed" ); + messenger->AssertSubscribePresentityGroupListCalled( ETrue ); + + // --------------------------------------------- + // unsubscribe + messenger->SetError( KErrArgument ); + evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + evReqComplete->CompletionResultImp().SetResultCode( KErrArgument ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + reqId = presGroup.UnsubscribePresentityGroupListL(); + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Unsubscribe failed" ); + messenger->AssertUnsubscribePresentityGroupListCalled( ETrue ); + + CleanupStack::PopAndDestroy( listener2 ); + + UnbindL(); + } + +// Single client, empty filter, error in sub +void T_PresenceGroupListManagement::T_SubscribePresentityGroup_Error_Single_L() + { + EUNIT_PRINT( _L("Single presentity group list subscribe with error") ); + + BindL(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresentityGroups& presGroup = presFeat->PresentityGroups(); + + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + + // Tell the protocol it should act normally + messenger->SetError( KErrArgument ); + + // --------------------------------------------- + // subscribe + TXIMPRequestId reqIdDummy; // not checked + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + evReqComplete->CompletionResultImp().SetResultCode( KErrArgument ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + TXIMPRequestId reqId = presGroup.SubscribePresentityGroupListL(); + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Subscribe failed" ); + messenger->AssertSubscribePresentityGroupListCalled( ETrue ); + + CleanupStack::PopAndDestroy( listener2 ); + + UnbindL(); + } + + +// multiple clients, all subscribe + unsubscribe +void T_PresenceGroupListManagement::T_SubscribePresentityGroup_Multiple_L() + { + EUNIT_PRINT( _L("Multiple presentity group list subscription") ); + + BindAllL(); + + TInt countOfWrappers = iWrapperMgr->WrapperCount(); + for( TInt a = 0; a < countOfWrappers; ++a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresentityGroups& presGroup = presFeat->PresentityGroups(); + + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // expect normal request complete + TXIMPRequestId reqIdDummy; // not checked + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + // subscribe + TXIMPRequestId reqId = presGroup.SubscribePresentityGroupListL(); + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Subscribe failed" ); + messenger->AssertSubscribePresentityGroupListCalled( ETrue ); + + CleanupStack::PopAndDestroy( listener2 ); + } + + for( TInt a = 0; a < countOfWrappers; ++a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresentityGroups& presGroup = presFeat->PresentityGroups(); + + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // expect normal request complete + TXIMPRequestId reqIdDummy; // not checked + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + CPresentityGroupListEventImp* event = XIMPTestEventFactory::CreateGroupListEventLCX( + KNullDesC, KNullDesC, + XIMPTestEventFactory::ETestPGLEmpty, + KNullDesC, KNullDesC, + MXIMPDataSubscriptionState::ESubscriptionInactive, + MXIMPDataSubscriptionState::EDataUnavailable + ); + + listener2->ExpectL( event ); + CleanupStack::Pop( event ); // 4 more items in cleanupstack + + // unsubscribe + TXIMPRequestId reqId = presGroup.UnsubscribePresentityGroupListL(); + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Unsubscribe failed" ); + CleanupStack::PopAndDestroy( 4 ); // group list event imp + messenger->AssertUnsubscribePresentityGroupListCalled( a == countOfWrappers-1 ? ETrue : EFalse ); + + CleanupStack::PopAndDestroy( listener2 ); + } + + UnbindAllL(); + } + +// Multiple clients, all subscribe and refresh +void T_PresenceGroupListManagement::T_RefreshPresentityGroup_Multiple_L() + { + EUNIT_PRINT( _L("Multiple presentity group list subscription refresh") ); + + BindAllL(); + + // SUBSCRIBE + TInt countOfWrappers = iWrapperMgr->WrapperCount(); + for( TInt a = 0; a < countOfWrappers; ++a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresentityGroups& presGroup = presFeat->PresentityGroups(); + + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // expect normal request complete + TXIMPRequestId reqIdDummy; // not checked + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + // subscribe + TXIMPRequestId reqId = presGroup.SubscribePresentityGroupListL(); + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Subscribe failed" ); + messenger->AssertSubscribePresentityGroupListCalled( ETrue ); + + CleanupStack::PopAndDestroy( listener2 ); + } + + // REFRESH + for( TInt a = 0; a < countOfWrappers; ++a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresentityGroups& presGroup = presFeat->PresentityGroups(); + + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // refresh subscription + TXIMPRequestId reqIdDummy; // not checked + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + CPresentityGroupListEventImp* event = XIMPTestEventFactory::CreateGroupListEventLCX( + KNullDesC, KNullDesC, + XIMPTestEventFactory::ETestPGLUpdated, + KNullDesC, KNullDesC, + MXIMPDataSubscriptionState::ESubscriptionActive, + MXIMPDataSubscriptionState::EDataUnavailable + ); + + listener2->ExpectL( event ); + CleanupStack::Pop( event ); // 4 more items in cleanupstack + + TXIMPRequestId reqId = presGroup.SubscribePresentityGroupListL(); + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Subscribe failed" ); + CleanupStack::PopAndDestroy( 4 ); // group list event imp + messenger->AssertSubscribePresentityGroupListCalled( ETrue ); + + CleanupStack::PopAndDestroy( listener2 ); + } + + // unsubscribe all + for( TInt a = 0; a < countOfWrappers; ++a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresentityGroups& presGroup = presFeat->PresentityGroups(); + + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // expect normal request complete + TXIMPRequestId reqIdDummy; // not checked + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + CPresentityGroupListEventImp* event = XIMPTestEventFactory::CreateGroupListEventLCX( + KNullDesC, KNullDesC, + XIMPTestEventFactory::ETestPGLEmpty, + KNullDesC, KNullDesC, + MXIMPDataSubscriptionState::ESubscriptionInactive, + MXIMPDataSubscriptionState::EDataUnavailable + ); + + listener2->ExpectL( event ); + CleanupStack::Pop( event ); // 4 more items in cleanupstack + + // unsubscribe + TXIMPRequestId reqId = presGroup.UnsubscribePresentityGroupListL(); + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Unsubscribe failed" ); + CleanupStack::PopAndDestroy( 4 ); // group list event imp + messenger->AssertUnsubscribePresentityGroupListCalled( a == countOfWrappers-1 ? ETrue : EFalse ); + + CleanupStack::PopAndDestroy( listener2 ); + } + + UnbindAllL(); + } + + +// Multiple clients, all but one subscribe and all do unsubscribe +void T_PresenceGroupListManagement::T_SubscribeAll_One_Unsub_Multiple_L() + { + EUNIT_PRINT( _L("Multiple, all but one subscribes and all unsubscribe") ); + + BindAllL(); + + // SUBSCRIBE + TInt countOfWrappers = iWrapperMgr->WrapperCount(); + TInt skipIndex = 1; + for( TInt a = 0; a < countOfWrappers; ++a ) + { + if ( skipIndex != a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresentityGroups& presGroup = presFeat->PresentityGroups(); + + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // expect normal request complete + TXIMPRequestId reqIdDummy; // not checked + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + // subscribe + TXIMPRequestId reqId = presGroup.SubscribePresentityGroupListL(); + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Subscribe failed" ); + messenger->AssertSubscribePresentityGroupListCalled( ETrue ); + + CleanupStack::PopAndDestroy( listener2 ); + } + } + + // unsubscribe all + for( TInt a = 0; a < countOfWrappers; ++a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresentityGroups& presGroup = presFeat->PresentityGroups(); + + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // expect normal request complete + TXIMPRequestId reqIdDummy; // not checked + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + CPresentityGroupListEventImp* event = XIMPTestEventFactory::CreateGroupListEventLCX( + KNullDesC, KNullDesC, + XIMPTestEventFactory::ETestPGLEmpty, + KNullDesC, KNullDesC, + MXIMPDataSubscriptionState::ESubscriptionInactive, + MXIMPDataSubscriptionState::EDataUnavailable + ); + + listener2->ExpectL( event ); + CleanupStack::Pop( event ); // 4 more items in cleanupstack + + // unsubscribe + TXIMPRequestId reqId = presGroup.UnsubscribePresentityGroupListL(); + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Unsubscribe failed" ); + CleanupStack::PopAndDestroy( 4 ); // group list event imp + + messenger->AssertUnsubscribePresentityGroupListCalled( a == countOfWrappers-1 ? ETrue : EFalse ); + + CleanupStack::PopAndDestroy( listener2 ); + } + + UnbindAllL(); + } + +// Multiple clients, refresh case for one +void T_PresenceGroupListManagement::T_RefreshPresentityGroup_One_Multiple_L() + { + EUNIT_PRINT( _L("Multiple, one context does presentity group list refresh") ); + + BindAllL(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresentityGroups& presGroup = presFeat->PresentityGroups(); + + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // --------------------------------------------- + // subscribe + TXIMPRequestId reqIdDummy; // not checked + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + TXIMPRequestId reqId = presGroup.SubscribePresentityGroupListL(); + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Subscribe failed" ); + messenger->AssertSubscribePresentityGroupListCalled( ETrue ); + + // --------------------------------------------- + // refresh subscribe + + messenger->SetValueFor( + EXIMPPlgTestSubscribeGroupListCalled, + EFalse ); + + evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + CPresentityGroupListEventImp* event = XIMPTestEventFactory::CreateGroupListEventLCX( + KNullDesC, KNullDesC, + XIMPTestEventFactory::ETestPGLUpdated, + KNullDesC, KNullDesC, + MXIMPDataSubscriptionState::ESubscriptionActive, + MXIMPDataSubscriptionState::EDataUnavailable + ); + + listener2->ExpectL( event ); + CleanupStack::Pop( event ); // 4 more items in cleanupstack + + reqId = presGroup.SubscribePresentityGroupListL(); + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Subscribe refresh failed" ); + CleanupStack::PopAndDestroy( 4 ); // group list event imp + messenger->AssertSubscribePresentityGroupListCalled( EFalse ); + + // --------------------------------------------- + // unsubscribe + evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + event = XIMPTestEventFactory::CreateGroupListEventLCX( + KNullDesC, KNullDesC, + XIMPTestEventFactory::ETestPGLEmpty, + KNullDesC, KNullDesC, + MXIMPDataSubscriptionState::ESubscriptionInactive, + MXIMPDataSubscriptionState::EDataUnavailable + ); + + listener2->ExpectL( event ); + CleanupStack::Pop( event ); // 4 more items in cleanupstack + + reqId = presGroup.UnsubscribePresentityGroupListL(); + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Unsubscribe failed" ); + CleanupStack::PopAndDestroy( 4 ); // group list event imp + messenger->AssertUnsubscribePresentityGroupListCalled( ETrue ); + + CleanupStack::PopAndDestroy( listener2 ); + + UnbindAllL(); + } + + + +void T_PresenceGroupListManagement::SubscribeL() + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresentityGroups& presGroup = presFeat->PresentityGroups(); + + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + + // ------------------------------------------------------ + // expect normal request complete + TXIMPRequestId reqIdDummy; // not checked + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + // ------------------------------------------------------ + + // subscribe + TXIMPRequestId reqId = presGroup.SubscribePresentityGroupListL(); + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Subscribe failed" ); + messenger->AssertSubscribePresentityGroupListCalled( ETrue ); + + CleanupStack::PopAndDestroy( listener2 ); + } + + + +void T_PresenceGroupListManagement::SubscribeGroupL( const TDesC& aGroupId ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresentityGroups& presGroup = presFeat->PresentityGroups(); + + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + + // ------------------------------------------------------ + // expect normal request complete + TXIMPRequestId reqIdDummy; // not checked + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + // ------------------------------------------------------ + + // subscribe group content + MXIMPIdentity* identity = context->ObjectFactory().NewIdentityLC(); + identity->SetIdentityL( aGroupId ); + + TXIMPRequestId reqId = presGroup.SubscribePresentityGroupContentL( *identity ); + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Subscribe content failed" ); + + COMMONASSERT( messenger, EXIMPPlgTestSubscribePresentityGroupContentCalled, "SubscribeGroupContentL was not called", ETrue, NULL ); + + CleanupStack::PopAndDestroy(); // identity + CleanupStack::PopAndDestroy( listener2 ); + } + + + +void T_PresenceGroupListManagement::UnsubscribeL() + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresentityGroups& presGroup = presFeat->PresentityGroups(); + + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + + // ------------------------------------------------------ + // expect normal request complete + TXIMPRequestId reqIdDummy; // not checked + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + CPresentityGroupListEventImp* event = XIMPTestEventFactory::CreateGroupListEventLCX( + KNullDesC, KNullDesC, + XIMPTestEventFactory::ETestPGLEmpty, + KNullDesC, KNullDesC, + MXIMPDataSubscriptionState::ESubscriptionInactive, + MXIMPDataSubscriptionState::EDataUnavailable + ); + + listener2->ExpectL( event ); + CleanupStack::Pop( event ); // 4 more items in cleanupstack + + // unsubscribe + TXIMPRequestId reqId = presGroup.UnsubscribePresentityGroupListL(); + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Unsubscribe failed" ); + CleanupStack::PopAndDestroy( 4 ); // group list event imp + messenger->AssertUnsubscribePresentityGroupListCalled( ETrue ); + + CleanupStack::PopAndDestroy( listener2 ); + } + + +void T_PresenceGroupListManagement::UnsubscribeGroupL( const TDesC& aGroupId ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresentityGroups& presGroup = presFeat->PresentityGroups(); + + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + + // ------------------------------------------------------ + // expect normal request complete + TXIMPRequestId reqIdDummy; // not checked + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + // and a group content event, IF we have subscribed the group beforehand + // i.e. SubscribeGroupL has been called before this + + MXIMPIdentity* identity = context->ObjectFactory().NewIdentityLC(); + identity->SetIdentityL( aGroupId ); + + CPresentityGroupContentEventImp* groupCntEvent = + XIMPTestEventFactory::CreateGroupContentEventLCX( + aGroupId, + KNullDesC, + KNullDesC, + XIMPTestEventFactory::ETestPGLCntRemoved, + KNullDesC, + KNullDesC, + MXIMPDataSubscriptionState::ESubscriptionInactive, + MXIMPDataSubscriptionState::EDataUnavailable + ); + + listener2->ExpectL( groupCntEvent ); + CleanupStack::Pop( groupCntEvent ); + + // ------------------------------------------------------ + + // unsubscribe + + TXIMPRequestId reqId = presGroup.UnsubscribePresentityGroupContentL( *identity ); + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Unsubscribe group content failed" ); + messenger->AssertUnsubscribePresentityGroupContentCalled( ETrue ); + + CleanupStack::PopAndDestroy( 5 ); // rest of the group content event + CleanupStack::PopAndDestroy(); // identity + + CleanupStack::PopAndDestroy( listener2 ); + } + + + +// Single client, empty filter +void T_PresenceGroupListManagement::T_HandlePresentityGroupList_L() + { + EUNIT_PRINT( _L("Handle presentity group list.") ); + + // log in and subscribe a group list + BindL(); + SubscribeL(); + + // ------------------------------------------------------ + // some startup stuff + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + // ------------------------------------------------------ + + // Tell the protocol it should act normally + wrapper->GetMessenger()->SetNoError(); + + // ------------------------------------------------------ + // 1. Create faked server message about group list + SendSrvMsgL( CXIMPTestFileSrvMsg::ETestSrvMsgPresentityGroupList ); + + // ------------------------------------------------------ + // expect empty MPresentityGroupList event. + + CPresentityGroupListEventImp* event = XIMPTestEventFactory::CreateGroupListEventLCX( + KNullDesC, KNullDesC, + XIMPTestEventFactory::ETestPGLEmpty, + KNullDesC, KNullDesC, + MXIMPDataSubscriptionState::ESubscriptionActive, + MXIMPDataSubscriptionState::EDataAvailable + ); + + listener2->ExpectL( event ); + CleanupStack::Pop( event ); // 4 more items in cleanupstack + + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "HandlePresentityGroupListL failed" ); + CleanupStack::PopAndDestroy( 4 ); // lists + // ------------------------------------------------------ + + CleanupStack::PopAndDestroy( listener2 ); + + // clean it up + UnsubscribeL(); + UnbindL(); + } + + + +_LIT16( KPresentUri1, "http://lorem.ipsum.com" ); +_LIT16( KPresentUri2, "http://carpe.diem.com" ); +_LIT16( KPresentDispName1, "DispnameA, LoremI" ); +_LIT16( KPresentDispName2, "DispnameB, CarpeD" ); +_LIT16( KPresentProtAddr1, "ABC" ); +_LIT16( KPresentProtAddr2, "HIJ" ); + +void T_PresenceGroupListManagement::T_HandlePresentityGroupCreateAndDelete_L() + { + EUNIT_PRINT( _L("Handle presentity group creation and deletion.") ); + + // log in and subscribe a group list + BindL(); + SubscribeL(); + + // ------------------------------------------------------ + // some startup stuff + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + // ------------------------------------------------------ + + // Tell the protocol it should act normally + wrapper->GetMessenger()->SetNoError(); + + // ------------------------------------------------------ + // 1. Create faked notification about create + SendSrvMsgL( KPresentUri1, KPresentDispName1, + CXIMPTestFileSrvMsg::ETestSrvMsgPresentityGroupCreate ); + + // ------------------------------------------------------ + // expect MPresentityGroupList event. + CPresentityGroupListEventImp* event = XIMPTestEventFactory::CreateGroupListEventLCX( + KPresentUri1, KPresentDispName1, + XIMPTestEventFactory::ETestPGLCreated, + + KPresentUri1, KPresentDispName1, + MXIMPDataSubscriptionState::ESubscriptionActive, + MXIMPDataSubscriptionState::EDataAvailable + ); + + listener2->ExpectL( event ); + CleanupStack::Pop( event ); // 4 more items in cleanupstack + + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "HandlePresentityGroupListL failed (Creation)" ); + CleanupStack::PopAndDestroy( 4 ); // lists + + // ------------------------------------------------------ + // Send a faked delete message + + SendSrvMsgL( KPresentUri1, KPresentDispName1, + CXIMPTestFileSrvMsg::ETestSrvMsgPresentityGroupDelete ); + + // ------------------------------------------------------ + // expect MPresentityGroupList event. + + event = XIMPTestEventFactory::CreateGroupListEventLCX( + KPresentUri1, KNullDesC, + XIMPTestEventFactory::ETestPGLDeleted, + KNullDesC, KNullDesC, + MXIMPDataSubscriptionState::ESubscriptionActive, + MXIMPDataSubscriptionState::EDataAvailable + ); + + listener2->ExpectL( event ); + CleanupStack::Pop( event ); // 4 more items in cleanupstack + + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "HandlePresentityGroupListL failed (Deletion)" ); + CleanupStack::PopAndDestroy( 4 ); // lists + // ------------------------------------------------------ + + CleanupStack::PopAndDestroy( listener2 ); + + // unsubscribe group list and log out + UnsubscribeL(); + UnbindL(); + } + +// Single client, subscribed to the group, then subscribe list +void T_PresenceGroupListManagement::T_HandlePresentityGroupList_Subscribed_L() + { + EUNIT_PRINT( _L("Handle presentity group list, subscribed to the group.") ); + + // log in + BindL(); + SubscribeGroupL( KPresentUri1 ); + SubscribeL(); + + // ------------------------------------------------------ + // some startup stuff + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + // ------------------------------------------------------ + + // Tell the protocol it should act normally + wrapper->GetMessenger()->SetNoError(); + + // ------------------------------------------------------ + // 1. Create faked server message about group list + SendSrvMsgL( KPresentUri1, + KPresentDispName1, + CXIMPTestFileSrvMsg::ETestSrvMsgPresentityGroupCreate ); + + // ------------------------------------------------------ + // expect empty MPresentityGroupList event. + + CPresentityGroupListEventImp* event = XIMPTestEventFactory::CreateGroupListEventLCX( + KPresentUri1, KPresentDispName1, + XIMPTestEventFactory::ETestPGLCreated, + KPresentUri1, KPresentDispName1, + MXIMPDataSubscriptionState::ESubscriptionActive, + MXIMPDataSubscriptionState::EDataAvailable + ); + + listener2->ExpectL( event ); + CleanupStack::Pop( event ); // 4 more items in cleanupstack + + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "HandlePresentityGroupListL failed" ); + CleanupStack::PopAndDestroy( 4 ); // lists + // ------------------------------------------------------ + + CleanupStack::PopAndDestroy( listener2 ); + + // clean it up + UnsubscribeL(); + UnsubscribeGroupL( KPresentUri1 ); + UnbindL(); + } + +void T_PresenceGroupListManagement::T_HandlePresentityGroupUpdate_L() + { + EUNIT_PRINT( _L("Handle presentity group displayname update.") ); + + // log in and subscribe a group list + BindL(); + SubscribeL(); + + // ------------------------------------------------------ + // some startup stuff + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + // ------------------------------------------------------ + + // Tell the protocol it should act normally + wrapper->GetMessenger()->SetNoError(); + + // ------------------------------------------------------ + // 1. Create faked notification about create + SendSrvMsgL( KPresentUri1, KPresentDispName1, + CXIMPTestFileSrvMsg::ETestSrvMsgPresentityGroupCreate ); + + // ------------------------------------------------------ + // expect MPresentityGroupList event. + + CPresentityGroupListEventImp* event = XIMPTestEventFactory::CreateGroupListEventLCX( + KPresentUri1, KPresentDispName1, + XIMPTestEventFactory::ETestPGLCreated, + KPresentUri1, KPresentDispName1, + MXIMPDataSubscriptionState::ESubscriptionActive, + MXIMPDataSubscriptionState::EDataAvailable + ); + + listener2->ExpectL( event ); + CleanupStack::Pop( event ); // 4 more items in cleanupstack + + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "HandlePresentityGroupListL failed (Creation)" ); + CleanupStack::PopAndDestroy( 4 ); // lists + + // ------------------------------------------------------ + // 4. Change displayname of group and send faked notification about + // update + + SendSrvMsgL( KPresentUri1, KPresentDispName2, + CXIMPTestFileSrvMsg::ETestSrvMsgPresentityGroupUpdate ); + + // ------------------------------------------------------ + // expect MPresentityGroupList event. + + event = XIMPTestEventFactory::CreateGroupListEventLCX( + KPresentUri1, KPresentDispName2, + XIMPTestEventFactory::ETestPGLUpdated, + KPresentUri1, KPresentDispName2, + MXIMPDataSubscriptionState::ESubscriptionActive, + MXIMPDataSubscriptionState::EDataAvailable + ); + + listener2->ExpectL( event ); + CleanupStack::Pop( event ); // 4 more items in cleanupstack + + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "HandlePresentityGroupListL failed (Update)" ); + CleanupStack::PopAndDestroy( 4 ); // lists + // ------------------------------------------------------ + + CleanupStack::PopAndDestroy( listener2 ); + + // unsubscribe group list and log out + UnsubscribeL(); + UnbindL(); + } + +// =========================================================================== +// SETUP HELPERS FOR THE LISTENER +// =========================================================================== +// + +// send a faked server-originated message with group info made +// from the given uri and displayname +// +void T_PresenceGroupListManagement::SendSrvMsgL( + const TDesC& aUri, const TDesC& aDispName, + TInt aMsgType ) + { + // we'll use hard-coded wrapper 0 instance for now. + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + + // create a group info contained within the server-originated + // faked message + CXIMPIdentityImp* groupId = CXIMPIdentityImp::NewLC( aUri ); + CPresentityGroupInfoImp* groupItem = CPresentityGroupInfoImp::NewLC( *groupId, aDispName ); + HBufC8* packet = NULL; + if( aMsgType == CXIMPTestFileSrvMsg::ETestSrvMsgPresentityGroupDelete ) + { + packet = TXIMPObjectPacker< CXIMPIdentityImp >::PackL( *groupId ); + } + else + { + packet = TXIMPObjectPacker< CPresentityGroupInfoImp >::PackL( *groupItem ); + } + CleanupStack::PushL( packet ); + + // use filetool to send it for plugin. + CXIMPTestFileSrvMsg* srvMsg = CXIMPTestFileSrvMsg::NewL( aMsgType, *packet ); + CleanupStack::PushL( srvMsg ); + wrapper->FileTool().CleanAllL(); + wrapper->FileTool().SrvMsgStoreL( srvMsg ); + CleanupStack::PopAndDestroy( 4, groupId ); // srvMsg, packet, groupItem, groupId + } + +// send a faked server-originated message with empty contents +// +void T_PresenceGroupListManagement::SendSrvMsgL( TInt aMsgType ) + { + // we'll use hard-coded wrapper 0 instance for now. + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + + // create a server-originated faked message with empty contents + RXIMPObjOwningPtrArray groupList; + + HBufC8* packedArray = TXIMPObjectPacker::PackArrayL( groupList ); + CleanupStack::PushL( packedArray ); + + // use filetool to send it for plugin. + CXIMPTestFileSrvMsg* srvMsg = CXIMPTestFileSrvMsg::NewL( aMsgType, + *packedArray ); + CleanupStack::PushL( srvMsg ); + wrapper->FileTool().CleanAllL(); + wrapper->FileTool().SrvMsgStoreL( srvMsg ); + CleanupStack::PopAndDestroy( 2 ); // srvMsg, packedArray + } + +// update display name of group without having subscribed to it +void T_PresenceGroupListManagement::T_UpdateDisplayNameL( + const TDesC& aGroupId, + const TDesC& aDispName ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresentityGroups& presGroup = presFeat->PresentityGroups(); + + wrapper->GetMessenger()->SetNoError(); + + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + + MXIMPIdentity* groupId = context->ObjectFactory().NewIdentityLC(); + groupId->SetIdentityL( aGroupId ); + + // ------------------------------------------------------ + // expect request complete with a group info imp inside + TXIMPRequestId reqIdDummy; // not checked + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + + CPresentityGroupInfoImp* grpInfo = CPresentityGroupInfoImp::NewLC( + *groupId, + aDispName ); + + evReqComplete->AppendParamL( grpInfo ); + CleanupStack::Pop(); // grpInfo + + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + // ------------------------------------------------------ + // update + TXIMPRequestId reqId = presGroup.UpdatePresentityGroupDisplayNameL( + *groupId, + aDispName ); + + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Unsubscribe group content failed" ); + + messenger->AssertUpdatePresentityGroupDisplayNameCalled( ETrue ); + + CleanupStack::PopAndDestroy(); // groupId + CleanupStack::PopAndDestroy( listener2 ); + } + + +// test method for updating display name of group without having subscribed +// to it +void T_PresenceGroupListManagement::T_UpdateDisplayName_Single_L() + { + EUNIT_PRINT( _L("Update presentity group displayname, single.") ); + + BindL(); + + T_UpdateDisplayNameL( KPresentUri1, KPresentDispName1 ); + + UnbindL(); + } + + + +// Single client, unsubscribe nonsubscribed +void T_PresenceGroupListManagement::T_UnsubNonsubscribed_Single_L() + { + EUNIT_PRINT( _L("Single unsubscribe nonsubscribed") ); + + BindL(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresentityGroups& presGroup = presFeat->PresentityGroups(); + + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // --------------------------------------------- + // unsubscribe + TXIMPRequestId reqIdDummy; // not checked + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + // group list event with Unsubscribed + CPresentityGroupListEventImp* event = XIMPTestEventFactory::CreateGroupListEventLCX( + KNullDesC, KNullDesC, + XIMPTestEventFactory::ETestPGLEmpty, + + KNullDesC, KNullDesC, + MXIMPDataSubscriptionState::ESubscriptionInactive, + MXIMPDataSubscriptionState::EDataUnavailable + ); + + listener2->ExpectL( event ); + CleanupStack::Pop( event ); // 4 more items in cleanupstack + + TXIMPRequestId reqId = presGroup.UnsubscribePresentityGroupListL(); + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Unsubscribe failed" ); + CleanupStack::PopAndDestroy( 4 ); // rest of the group list event + messenger->AssertUnsubscribePresentityGroupListCalled( EFalse ); // should not be called, no subscriptions + + CleanupStack::PopAndDestroy( listener2 ); + + UnbindL(); + } + +// =========================================================================== +// TEST CASE TABLE +// =========================================================================== +// +EUNIT_BEGIN_TEST_TABLE( + T_PresenceGroupListManagement, + "XIMP presence group list management tests", + "MODULE" ) + +PRFW_DECORATED_TEST( + "Subscribe single presence", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_SubscribePresentityGroup_Single_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Subscribe single presence with error", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_SubscribePresentityGroup_Error_Single_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Unsubscribe single presence with error", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_UnsubscribePresentityGroup_Error_Single_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Unsubscribe nonsubscribed", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_UnsubNonsubscribed_Single_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Subscribe multiple presence", + "", + "", + "FUNCTIONALITY", + SetupMultiple_L, + T_SubscribePresentityGroup_Multiple_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Multiple subscribe all but one, unsub all", + "", + "", + "FUNCTIONALITY", + SetupMultiple_L, + T_SubscribeAll_One_Unsub_Multiple_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Single refresh multiple presence", + "", + "", + "FUNCTIONALITY", + SetupMultiple_L, + T_RefreshPresentityGroup_One_Multiple_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Multiple refresh presence", + "", + "", + "FUNCTIONALITY", + SetupMultiple_L, + T_RefreshPresentityGroup_Multiple_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Handle Presentity Group List", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_HandlePresentityGroupList_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Handle Presentity Group List (subscribed group)", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_HandlePresentityGroupList_Subscribed_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Create and delete group.", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_HandlePresentityGroupCreateAndDelete_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Handle update displayname", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_HandlePresentityGroupUpdate_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Update displayname", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_UpdateDisplayName_Single_L, + Teardown ) + +EUNIT_END_TEST_TABLE + + +// =========================================================================== +// TEST SUITE CONSTRUCTION +// =========================================================================== +// +EXPORT_C MEUnitTest* CreateTestSuiteL() + { + return T_PresenceGroupListManagement::NewL(); + } + + +// end of file diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencegrouplistmngt/t_presencegrouplistmngt.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencegrouplistmngt/t_presencegrouplistmngt.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,129 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef T_PRESENCEGROUPLISTMANAGEMENT_H +#define T_PRESENCEGROUPLISTMANAGEMENT_H + +#include +#include +#include "prfwteststatuseventlistener.h" +#include "prfwtestmessaging.h" + +class CXIMPTestContextWrapper; +class CXIMPTestContextWrapperMgr; +class CXIMPTestMessenger; +class CPresentityGroupInfoImp; +class CPresentityGroupListEventImp; + +/** + * XIMP Framework Eunit tests. + * + * Tests for XIMP session management services. + * + * @since S60 v4.0 + */ +class T_PresenceGroupListManagement : public CEUnitTestSuiteClass + { + +public: + static T_PresenceGroupListManagement* NewL(); + virtual ~T_PresenceGroupListManagement(); + + +private: + T_PresenceGroupListManagement(); + void ConstructL(); + +private: // Test case functions + + void Setup_L(); + void SetupMultiple_L(); + void BindL(); + void BindAllL(); + void Teardown(); + void UnbindL(); + void UnbindAllL(); + void SubscribeL(); + void SubscribeGroupL( const TDesC& aGroupId ); + void UnsubscribeGroupL( const TDesC& aGroupId ); + void UnsubscribeL(); + + void T_SubscribePresentityGroup_Single_L(); + void T_UnsubscribePresentityGroup_Error_Single_L(); + void T_SubscribePresentityGroup_Error_Single_L(); + void T_SubscribePresentityGroup_Multiple_L(); + void T_UpdateDisplayName_Single_L(); + void T_HandlePresentityGroupList_L(); + void T_HandlePresentityGroupList_Subscribed_L(); + void T_HandlePresentityGroupCreateAndDelete_L(); + void T_HandlePresentityGroupUpdate_L(); + void T_HandlePresentityGroupUpdate_WithHelpers_L(); + void T_SubscribePresentityGroup_One_Multiple_L(); + void T_RefreshPresentityGroup_One_Multiple_L(); + void T_UnsubNonsubscribed_Single_L(); + void T_RefreshPresentityGroup_Multiple_L(); + void T_SubscribeAll_One_Unsub_Multiple_L(); + + void T_UpdateDisplayNameL( + const TDesC& aGroupId, + const TDesC& aDispName ); + +private: // Test helpers + + /** + * Fake a server-originated (=mobile terminated) message. + * The message appears to adaptation and framework as if + * it came from the network. Uses only one group. + * @param aUri The URI of group + * @param aDispName The display name for the group + * @param aMsgType The message type for CXIMPTestFileSrvMsg + */ + void SendSrvMsgL( + const TDesC& aUri, const TDesC& aDispName, + TInt aMsgType ); + + /** + * Fake a server-originated message with empty content. + * Whether to use this depends on the event you expect. + * @see SendSrvMsgL + */ + void SendSrvMsgL( TInt aMsgType ); + +private: // Test data + + /** + * Eunit test case table declaration. + */ + EUNIT_DECLARE_TEST_TABLE; + + // owned + CXIMPTestContextWrapperMgr* iWrapperMgr; + + // + TInt iLastError; + RXIMPObjOwningPtrArray< CPresentityGroupInfoImp > iValidateArray; + }; + + +#endif // T_PRESENCEGROUPLISTMANAGEMENT_H + + + +// end of file + + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencegrouplistmngt/t_presencegrouplistmngt.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencegrouplistmngt/t_presencegrouplistmngt.mmp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,55 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "../../tsrcutils/eunitcommon/eunittstdllbase.hrh" +#include "../../tsrcutils/processmaster/pm.h" + +TARGET t_presencegrouplistmngt.dll +CAPABILITY ALL -TCB +SOURCEPATH . +SOURCE t_presencegrouplistmngt.cpp + +USERINCLUDE ../../../../../ximpfw/core/srcdatamodel +USERINCLUDE ../../../../../ximpfw/presence/srcpresencedatamodel +USERINCLUDE ../../../../../ximpfw/presence/srcpresencedatamodel/presentitygroups +USERINCLUDE ../../../../../ximpfw/presence/srcpresencedatamodel/presencewatching +USERINCLUDE ../../../../../ximpfw/presence/srcpresencedatamodel/presenceauthorization +USERINCLUDE ../../../../../ximpfw/presence/srcpresencedatamodel/presencepublishing +USERINCLUDE ../../../../../ximpfw/presence/srcpresencedatamodel/presenceinfo +USERINCLUDE ../../../../../ximpfw/core/srcutils + +// TODO remove unnecessary +SYSTEMINCLUDE ../../../../../ximpfw/inc/core/base +SYSTEMINCLUDE ../../../../../ximpfw/inc/core/datamodel +SYSTEMINCLUDE ../../../../../ximpfw/inc/core/protocolplugin +SYSTEMINCLUDE ../../../../../ximpfw/inc/core/protocolpluginhost +SYSTEMINCLUDE ../../../../../ximpfw/inc/presence/presencedatamodel +SYSTEMINCLUDE ../../../../../ximpfw/inc/presence/presencemanagement +SYSTEMINCLUDE ../../../../../ximpfw/inc/presence/presenceprotocolplugin +SYSTEMINCLUDE ../../../../../ximpfw/inc/presence/presenceprotocolpluginhost + + +LIBRARY ecom.lib +LIBRARY bafl.lib +LIBRARY ximpdatamodel.lib +LIBRARY presencedatamodel.lib +LIBRARY ximputils.lib +LIBRARY estor.lib +LIBRARY EUnit.lib +// end of file + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencegroupmembermngt/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencegroupmembermngt/bld.inf Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,23 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Build information file for t_presencegroupmngt.dll + * +*/ + + +PRJ_PLATFORMS +DEFAULT + +PRJ_TESTMMPFILES +t_presencegroupmembermngt.mmp diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencegroupmembermngt/t_presencegroupmembermngt.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencegroupmembermngt/t_presencegroupmembermngt.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,2280 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +#include "eunittools.h" + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +#include "ximpeventcodec.h" + +#include "t_presencegroupmembermngt.h" +#include "prfwteststatuseventlistener.h" +#include "prfwtestmessaging.h" +#include "prfwtestmessenger.h" +#include "prfwtestlistener.h" +#include "prfwtestcontextwrappermgr.h" +#include "prfwtestcontextwrapper.h" +#include "ximpcontextstateeventimp.h" +#include "ximpcontextstateevent.h" + +#include "presenceinfoimp.h" +#include "presenceinfofilterimp.h" +#include "prfwtestpresencedatautils.h" +#include "ximpidentityimp.h" +#include "presentitygroupcontenteventimp.h" +#include "ximprequestcompleteeventimp.h" +#include "presentitygroupinfoimp.h" +#include "presentitygrouplisteventimp.h" +#include "presentitygroupmemberinfoimp.h" +#include "ximprequestcompleteeventimp.h" +#include "ximprestrictedobjectcollection.h" +#include "ximpobjectfactoryimp.h" + +#include "prfwtestrobustnesstools.h" +#include "ximpobjecthelpers.h" +#include "prfwtestfilesrvmsg.h" +#include "prfwtestfiletool.h" +#include "prfwtestwaithelper.h" +#include "prfwtesteventfactory.h" + + +_LIT( KGroupId, "wv:group/member@imps.com" ); +_LIT( KGroupId2, "wv:group2/chutney@naan.com" ); +_LIT( KGroupDisplayName, "Salamapartio Z" ); + +_LIT( KMemberId, "wv:member@imps.com" ); +_LIT( KMemberDisplayName, "Stroustrup" ); +_LIT( KMemberDisplayName2, "Bjarne" ); + +// ============================ MEMBER FUNCTIONS =============================== + +// CONSTRUCTION +T_PresenceGroupMemberManagement* T_PresenceGroupMemberManagement::NewL() + { + T_PresenceGroupMemberManagement* self = new( ELeave ) T_PresenceGroupMemberManagement; + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + + return self; + } + +T_PresenceGroupMemberManagement::~T_PresenceGroupMemberManagement() + { + delete iLastEvent; + + if ( iASWait && iASWait->IsStarted() ) + { + iASWait->AsyncStop(); + } + delete iASWait; + + delete iListener2; + + delete iCurrentGrId; + } + +void T_PresenceGroupMemberManagement::ConstructL() + { + CEUnitTestSuiteClass::ConstructL(); + iASWait = new ( ELeave ) CActiveSchedulerWait(); + } + + +T_PresenceGroupMemberManagement::T_PresenceGroupMemberManagement() + { + } + +// =========================================================================== +// TEST CASE SETUP & TEARDOWN METHODS +// =========================================================================== +// + +void T_PresenceGroupMemberManagement::Setup_L() + { + PrfwTestRobustness::DoPreCleaning(); + + iWrapperMgr = CXIMPTestContextWrapperMgr::NewL(); + iWrapperMgr->CreateWrapperL(); + + // must reset these to EFalse + iSkipSubscribe = EFalse; + iSkipUnsubscribe = EFalse; + } + +void T_PresenceGroupMemberManagement::SetupMultiple_L() + { + PrfwTestRobustness::DoPreCleaning(); + + iWrapperMgr = CXIMPTestContextWrapperMgr::NewL(); + iWrapperMgr->CreateWrapperL(); + iWrapperMgr->CreateWrapperL(); + iWrapperMgr->CreateWrapperL(); + + // must reset these to EFalse + iSkipSubscribe = EFalse; + iSkipUnsubscribe = EFalse; + } + +// bind helper +void T_PresenceGroupMemberManagement::BindAllL() + { + for( TInt a = 0; a < iWrapperMgr->WrapperCount(); ++a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + wrapper->BindL( 0 ); + } + } + +// unbind helper +void T_PresenceGroupMemberManagement::UnbindAllL() + { + for( TInt a = 0; a < iWrapperMgr->WrapperCount(); ++a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + wrapper->UnbindL(); + } + } + +void T_PresenceGroupMemberManagement::TeardownTestSupport() + { + // anything NOT initialized by test case Setup method, + // but initialized in the test case itself, goes here + delete iCurrentGrId; + iCurrentGrId = NULL; + + delete iListener2; + iListener2 = NULL; + + delete iLastEvent; + iLastEvent = NULL; + } + +void T_PresenceGroupMemberManagement::Teardown() + { + TeardownTestSupport(); + // just in case to avoid memleaks. should not have anything to + // delete anyway + + delete iWrapperMgr; + iWrapperMgr = NULL; + + REComSession::FinalClose(); + + // must reset these to EFalse + iSkipSubscribe = EFalse; + iSkipUnsubscribe = EFalse; + + // it's best to nuke the servers during exit too. + PrfwTestRobustness::DoPreCleaning(); + } + +// =========================================================================== +// TEST CASES for presentity presence subscription +// =========================================================================== + +// General test case for single member +void T_PresenceGroupMemberManagement::T_GenericSubAndUnsubL( + TXIMPCallBack& aCbFuncL ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + wrapper->BindL( 0 ); + + // ------------------------------------------------------ + // some startup stuff + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresentityGroups& presGroup = presFeat->PresentityGroups(); + + iListener2 = CXIMPTestListener::NewL( context ); + // ------------------------------------------------------ + + // Tell the protocol it should act normally + wrapper->GetMessenger()->SetNoError(); + + iCurrentGrId = context->ObjectFactory().NewIdentityLC(); + CleanupStack::Pop(); // iCurrentGrId + iCurrentGrId->SetIdentityL( KGroupId ); + + // ------------------------------------------------------ + // create presentity group + // + // expect events: + // - request complete. + // NOTE: no presentitygrouplistevent as we've not subscribed the group lists + + // normal request complete + TXIMPRequestId reqIdDummy; // not checked + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + + // identity + displayname + CPresentityGroupInfoImp* infoImp = CPresentityGroupInfoImp::NewLC( *iCurrentGrId, KGroupDisplayName ); + evReqComplete->AppendParamL( infoImp ); + CleanupStack::Pop( infoImp ); + + iListener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + TXIMPRequestId reqId = presGroup.CreatePresentityGroupL( *iCurrentGrId, KGroupDisplayName ); + + // and wait + EUNIT_ASSERT_DESC( KErrNone == iListener2->WaitAndAssertL(), "CreatePresentityGroupL failed" ); + messenger->AssertCreatePresentityGroupCalled( ETrue ); + + if ( ! iSkipSubscribe ) + { + // ------------------------------------------------------ + // subscribe presentity group CONTENT + // + // expect events: + // - request complete + evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + iListener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + // do the call + reqId = presGroup.SubscribePresentityGroupContentL( *iCurrentGrId ); + + // and wait + EUNIT_ASSERT_DESC( KErrNone == iListener2->WaitAndAssertL(), "SubscribePresentityGroupContentL failed" ); + + // verify that subscribe was called + messenger->AssertSubscribePresentityGroupContentCalled( ETrue ); + } + + // ------------------------------------------------------ + // do the actual test. this is a function pointer because the + // "red tape" of each test is similar (create group, subscribe content, do + // actual test, unsubscribe content, delete group) - this is the variable + // part, the "do actual test". + (this->*aCbFuncL)(); + + if ( ! iSkipUnsubscribe ) + { + // ------------------------------------------------------ + // unsubscribe presentity group content + // + // expect events: + // - request complete + // - presentity group content event + + evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + iListener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + CPresentityGroupContentEventImp* groupCntEvent = + XIMPTestEventFactory::CreateGroupContentEventLCX( + KGroupId, + KNullDesC, + KNullDesC, + XIMPTestEventFactory::ETestPGLCntRemoved, + KNullDesC, + KNullDesC, + MXIMPDataSubscriptionState::ESubscriptionInactive, + MXIMPDataSubscriptionState::EDataUnavailable + ); + + iListener2->ExpectL( groupCntEvent ); + CleanupStack::Pop( groupCntEvent ); // 5 more items in cleanupstack + + // do the call + reqId = presGroup.UnsubscribePresentityGroupContentL( *iCurrentGrId ); + + // and wait + EUNIT_ASSERT_DESC( KErrNone == iListener2->WaitAndAssertL(), "UnsubscribePresentityGroupContentL failed" ); + CleanupStack::PopAndDestroy( 5 ); // lists + + // verify that unsubscribe was called + messenger->AssertUnsubscribePresentityGroupContentCalled( ETrue ); + } + + // ------------------------------------------------------ + // delete presentity group + // + // expect events: + // - request complete + // NO presentity group content event as we've just unsubscribed it. + + evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + iListener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + // do the call + reqId = presGroup.DeletePresentityGroupL( *iCurrentGrId ); + + // and wait + EUNIT_ASSERT_DESC( KErrNone == iListener2->WaitAndAssertL(), "DeletePresentityGroupL failed" ); + + // ------------------------------------------------------ + + // make sure the new listener is not listening for events! + iListener2->SetEventSourceL( NULL ); + + wrapper->UnbindL(); + + TeardownTestSupport(); + } + +// =========================================================================== +// Variant methods, this is where the actual testing happens. +// Called by the generic subscribe and unsubscribe -method +// =========================================================================== + +// ------------------------------------------------------ +// empty test variant method +// test only the creation, subscribe and unsubcscribe +// ------------------------------------------------------ +// +void T_PresenceGroupMemberManagement::T_EmptyFunc() + { + // nothing + } + +// ------------------------------------------------------ +// test adding members +// ------------------------------------------------------ +// +void T_PresenceGroupMemberManagement::T_TestAddMembersL() + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresentityGroups& presGroup = presFeat->PresentityGroups(); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // ------------------------------------------------------ + // add presentity group member + // + // expect events: + // - request complete, + // - presentitygroupcontentevent + + MXIMPIdentity* member = context->ObjectFactory().NewIdentityLC(); + member->SetIdentityL( KMemberId ); + + // normal request complete + TXIMPRequestId reqIdDummy; // not checked + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + + // group id + CXIMPIdentityImp* identity = CXIMPIdentityImp::NewLC( iCurrentGrId->Identity() ); + evReqComplete->AppendParamL( identity ); + CleanupStack::Pop(); // identity + + // id for member info + CXIMPIdentityImp* miId = CXIMPIdentityImp::NewLC( KMemberId ); + // member info + CPresentityGroupMemberInfoImp* memInfoImp = + CPresentityGroupMemberInfoImp::NewLC( *miId, KMemberDisplayName ); + evReqComplete->AppendParamL( memInfoImp ); + CleanupStack::Pop(); // memInfoImp owned by AppendParamL + CleanupStack::PopAndDestroy( miId ); // copy was made + + iListener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + // group content event + CPresentityGroupContentEventImp* groupCntEvent = + XIMPTestEventFactory::CreateGroupContentEventLCX( + iCurrentGrId->Identity(), + KMemberId, + KMemberDisplayName, + XIMPTestEventFactory::ETestPGLCntAdded, + KMemberId, + KMemberDisplayName, + MXIMPDataSubscriptionState::ESubscriptionActive, + MXIMPDataSubscriptionState::EDataAvailable + ); + + iListener2->ExpectL( groupCntEvent ); + CleanupStack::Pop( groupCntEvent ); // 5 more items in cleanupstack + + // do the call + TXIMPRequestId reqId = presGroup.AddPresentityGroupMemberL( + *iCurrentGrId, *member, KMemberDisplayName ); + + // and wait + EUNIT_ASSERT_DESC( KErrNone == iListener2->WaitAndAssertL(), "AddPresentityGroupMemberL failed" ); + CleanupStack::PopAndDestroy( 5 ); // lists from groupCntEvent + + messenger->AssertAddPresentityGroupMemberCalled( ETrue ); + + // ------------------------------------------------------ + CleanupStack::PopAndDestroy(); // member + } + +// ------------------------------------------------------ +// test adding members when not subscribed +// ------------------------------------------------------ +// +void T_PresenceGroupMemberManagement::T_TestAddMembers_NonSub_L() + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresentityGroups& presGroup = presFeat->PresentityGroups(); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // ------------------------------------------------------ + // add presentity group member + // + // expect events: + // - request complete, + + MXIMPIdentity* member = context->ObjectFactory().NewIdentityLC(); + member->SetIdentityL( KMemberId ); + + // normal request complete + TXIMPRequestId reqIdDummy; // not checked + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + + // group id + CXIMPIdentityImp* identity = CXIMPIdentityImp::NewLC( iCurrentGrId->Identity() ); + evReqComplete->AppendParamL( identity ); + CleanupStack::Pop(); // identity + + // id for member info + CXIMPIdentityImp* miId = CXIMPIdentityImp::NewLC( KMemberId ); + // member info + CPresentityGroupMemberInfoImp* memInfoImp = + CPresentityGroupMemberInfoImp::NewLC( *miId, KMemberDisplayName ); + evReqComplete->AppendParamL( memInfoImp ); + CleanupStack::Pop(); // memInfoImp owned by AppendParamL + CleanupStack::PopAndDestroy( miId ); // copy was made + + iListener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + // do the call + TXIMPRequestId reqId = presGroup.AddPresentityGroupMemberL( + *iCurrentGrId, *member, KMemberDisplayName ); + + // and wait + EUNIT_ASSERT_DESC( KErrNone == iListener2->WaitAndAssertL(), "AddPresentityGroupMemberL failed" ); + + messenger->AssertAddPresentityGroupMemberCalled( ETrue ); + + // ------------------------------------------------------ + CleanupStack::PopAndDestroy(); // member + } + +// ------------------------------------------------------ +// test removing members +// ------------------------------------------------------ +// +void T_PresenceGroupMemberManagement::T_TestRemoveMembersL() + { + // add a member + T_TestAddMembersL(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresentityGroups& presGroup = presFeat->PresentityGroups(); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // ------------------------------------------------------ + // remove presentity group member + // + // expect events: + // - request complete, + // - presentitygroupcontentevent + + MXIMPIdentity* member = context->ObjectFactory().NewIdentityLC(); + member->SetIdentityL( KMemberId ); + + // normal request complete + TXIMPRequestId reqIdDummy; // not checked + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + iListener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + // group content event + CPresentityGroupContentEventImp* groupCntEvent = + XIMPTestEventFactory::CreateGroupContentEventLCX( + iCurrentGrId->Identity(), + KMemberId, + KNullDesC, + XIMPTestEventFactory::ETestPGLCntRemoved, + KNullDesC, + KNullDesC, + MXIMPDataSubscriptionState::ESubscriptionActive, + MXIMPDataSubscriptionState::EDataAvailable + ); + + iListener2->ExpectL( groupCntEvent ); + CleanupStack::Pop( groupCntEvent ); // 5 more items in cleanupstack + + // do the call + TXIMPRequestId reqId = presGroup.RemovePresentityGroupMemberL( + *iCurrentGrId, *member ); + + // and wait + EUNIT_ASSERT_DESC( KErrNone == iListener2->WaitAndAssertL(), "RemovePresentityGroupMemberL failed" ); + CleanupStack::PopAndDestroy( 5 ); // lists from groupCntEvent + + messenger->AssertRemovePresentityGroupMemberCalled( ETrue ); + + // ------------------------------------------------------ + CleanupStack::PopAndDestroy(); //member + } + +// ------------------------------------------------------ +// test removing members when non-subscribed +// ------------------------------------------------------ +// +void T_PresenceGroupMemberManagement::T_TestRemoveMembers_NonSub_L() + { + // add a member + T_TestAddMembers_NonSub_L(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresentityGroups& presGroup = presFeat->PresentityGroups(); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // ------------------------------------------------------ + // remove presentity group member + // + // expect events: + // - request complete, + // - presentitygroupcontentevent + + MXIMPIdentity* member = context->ObjectFactory().NewIdentityLC(); + member->SetIdentityL( KMemberId ); + + // normal request complete + TXIMPRequestId reqIdDummy; // not checked + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + iListener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + // do the call + TXIMPRequestId reqId = presGroup.RemovePresentityGroupMemberL( + *iCurrentGrId, *member ); + + // and wait + EUNIT_ASSERT_DESC( KErrNone == iListener2->WaitAndAssertL(), "RemovePresentityGroupMemberL failed" ); + + messenger->AssertRemovePresentityGroupMemberCalled( ETrue ); + + // ------------------------------------------------------ + CleanupStack::PopAndDestroy(); //member + } + +// test removing nonexisting members +void T_PresenceGroupMemberManagement::T_TestRemoveMembers_NonExisting_L() + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresentityGroups& presGroup = presFeat->PresentityGroups(); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // ------------------------------------------------------ + // remove presentity group member + // + // expect events: + // - request complete, + + MXIMPIdentity* member = context->ObjectFactory().NewIdentityLC(); + member->SetIdentityL( KMemberId ); + + // normal request complete + TXIMPRequestId reqIdDummy; // not checked + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + iListener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + // do the call + TXIMPRequestId reqId = presGroup.RemovePresentityGroupMemberL( + *iCurrentGrId, *member ); + + // and wait + EUNIT_ASSERT_DESC( KErrNone == iListener2->WaitAndAssertL(), "RemovePresentityGroupMemberL failed" ); + + messenger->AssertRemovePresentityGroupMemberCalled( ETrue ); + + // ------------------------------------------------------ + CleanupStack::PopAndDestroy(); //member + } + +// ------------------------------------------------------ +// test updating members +// ------------------------------------------------------ +// +void T_PresenceGroupMemberManagement::T_TestUpdateMembers_L() + { + // add a member + T_TestAddMembersL(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresentityGroups& presGroup = presFeat->PresentityGroups(); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // ------------------------------------------------------ + // update presentity group member + // + // expect events: + // - request complete, + // - presentitygroupcontentevent + + MXIMPIdentity* member = context->ObjectFactory().NewIdentityLC(); + member->SetIdentityL( KMemberId ); + + // group content request complete + TXIMPRequestId reqIdDummy; // not checked + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + CXIMPIdentityImp* identity = CXIMPIdentityImp::NewLC( iCurrentGrId->Identity() ); + evReqComplete->AppendParamL( identity ); + CleanupStack::Pop( identity ); + + CPresentityGroupMemberInfoImp* mbrInfo = CPresentityGroupMemberInfoImp::NewLC( *member, KMemberDisplayName2 ); + evReqComplete->AppendParamL( mbrInfo ); + CleanupStack::Pop( mbrInfo ); + + iListener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + // group content event + CPresentityGroupContentEventImp* groupCntEvent = + XIMPTestEventFactory::CreateGroupContentEventLCX( + iCurrentGrId->Identity(), + KMemberId, + KMemberDisplayName2, + XIMPTestEventFactory::ETestPGLCntUpdated, + KMemberId, + KMemberDisplayName2, + MXIMPDataSubscriptionState::ESubscriptionActive, + MXIMPDataSubscriptionState::EDataAvailable + ); + + iListener2->ExpectL( groupCntEvent ); + CleanupStack::Pop( groupCntEvent ); // 5 more items in cleanupstack + + // do the call + TXIMPRequestId reqId = presGroup.UpdatePresentityGroupMemberDisplayNameL( + *iCurrentGrId, *member, KMemberDisplayName2 ); + + // and wait + EUNIT_ASSERT_DESC( KErrNone == iListener2->WaitAndAssertL(), "UpdatePresentityGroupMemberDisplayNameL failed" ); + CleanupStack::PopAndDestroy( 5 ); // lists from groupCntEvent + + messenger->AssertUpdatePresentityGroupMemberDisplayNameCalled( ETrue ); + + // ------------------------------------------------------ + CleanupStack::PopAndDestroy(); + } + +// ------------------------------------------------------ +// test updating members (nonsubscribed) +// ------------------------------------------------------ +// +void T_PresenceGroupMemberManagement::T_TestUpdateMembers_NonSub_L() + { + // add a member + T_TestAddMembers_NonSub_L(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresentityGroups& presGroup = presFeat->PresentityGroups(); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // ------------------------------------------------------ + // update presentity group member + // + // expect events: + // - request complete, + + MXIMPIdentity* member = context->ObjectFactory().NewIdentityLC(); + member->SetIdentityL( KMemberId ); + + // group content request complete + TXIMPRequestId reqIdDummy; // not checked + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + CXIMPIdentityImp* identity = CXIMPIdentityImp::NewLC( iCurrentGrId->Identity() ); + evReqComplete->AppendParamL( identity ); + CleanupStack::Pop( identity ); + + CPresentityGroupMemberInfoImp* mbrInfo = CPresentityGroupMemberInfoImp::NewLC( *member, KMemberDisplayName2 ); + evReqComplete->AppendParamL( mbrInfo ); + CleanupStack::Pop( mbrInfo ); + + iListener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + // do the call + TXIMPRequestId reqId = presGroup.UpdatePresentityGroupMemberDisplayNameL( + *iCurrentGrId, *member, KMemberDisplayName2 ); + + // and wait + EUNIT_ASSERT_DESC( KErrNone == iListener2->WaitAndAssertL(), "UpdatePresentityGroupMemberDisplayNameL failed" ); + + messenger->AssertUpdatePresentityGroupMemberDisplayNameCalled( ETrue ); + + // ------------------------------------------------------ + CleanupStack::PopAndDestroy(); + } + +// ------------------------------------------------------ +// test updating members with non-existing id +// ------------------------------------------------------ +// +void T_PresenceGroupMemberManagement::T_TestUpdateMembers_NonExisting_L() + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresentityGroups& presGroup = presFeat->PresentityGroups(); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // ------------------------------------------------------ + // update presentity group member + // + // expect events: + // - request complete, + + MXIMPIdentity* member = context->ObjectFactory().NewIdentityLC(); + member->SetIdentityL( KMemberId ); + + // group content request complete + TXIMPRequestId reqIdDummy; // not checked + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + CXIMPIdentityImp* identity = CXIMPIdentityImp::NewLC( iCurrentGrId->Identity() ); + evReqComplete->AppendParamL( identity ); + CleanupStack::Pop( identity ); + + CPresentityGroupMemberInfoImp* mbrInfo = CPresentityGroupMemberInfoImp::NewLC( *member, KMemberDisplayName2 ); + evReqComplete->AppendParamL( mbrInfo ); + CleanupStack::Pop( mbrInfo ); + + iListener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + // do the call + TXIMPRequestId reqId = presGroup.UpdatePresentityGroupMemberDisplayNameL( + *iCurrentGrId, *member, KMemberDisplayName2 ); + + // and wait + EUNIT_ASSERT_DESC( KErrNone == iListener2->WaitAndAssertL(), "UpdatePresentityGroupMemberDisplayNameL failed" ); + + messenger->AssertUpdatePresentityGroupMemberDisplayNameCalled( ETrue ); + + // ------------------------------------------------------ + CleanupStack::PopAndDestroy(); + } + +// =========================================================================== +// Test case methods +// =========================================================================== + +// Subscribe and unsubscribe test +void T_PresenceGroupMemberManagement::T_SubUnsubGroupContent_Single_L() + { + EUNIT_PRINT( _L("Single presentity group content sub and unsub") ); + + TXIMPCallBack callback = &T_PresenceGroupMemberManagement::T_EmptyFunc; + T_GenericSubAndUnsubL( callback ); + } + +// subscribe and unsubscribe, altered id +void T_PresenceGroupMemberManagement::T_SubUnsubGroupContent_Altered_Single_L() + { + EUNIT_PRINT( _L("Single presentity group content sub and unsub with altered id") ); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + wrapper->BindL( 0 ); + + // ------------------------------------------------------ + // some startup stuff + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresentityGroups& presGroup = presFeat->PresentityGroups(); + + iListener2 = CXIMPTestListener::NewL( context ); + // ------------------------------------------------------ + + // Tell the protocol it should act normally + wrapper->GetMessenger()->SetNoError(); + + iCurrentGrId = context->ObjectFactory().NewIdentityLC(); + CleanupStack::Pop(); // iCurrentGrId + iCurrentGrId->SetIdentityL( KGroupId ); + + // ------------------------------------------------------ + // create presentity group + // + // expect events: + // - request complete. + // NOTE: no presentitygrouplistevent as we've not subscribed the group lists + + // normal request complete + TXIMPRequestId reqIdDummy; // not checked + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + + // identity + displayname + CPresentityGroupInfoImp* infoImp = CPresentityGroupInfoImp::NewLC( *iCurrentGrId, KGroupDisplayName ); + evReqComplete->AppendParamL( infoImp ); + CleanupStack::Pop( infoImp ); + + iListener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + TXIMPRequestId reqId = presGroup.CreatePresentityGroupL( *iCurrentGrId, KGroupDisplayName ); + + // and wait + EUNIT_ASSERT_DESC( KErrNone == iListener2->WaitAndAssertL(), "CreatePresentityGroupL failed" ); + messenger->AssertCreatePresentityGroupCalled( ETrue ); + + // ------------------------------------------------------ + // subscribe presentity group CONTENT + // + // expect events: + // - request complete + evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + iListener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + // tell the test protocol to send back an altered id + MXIMPIdentity* identityParam = context->ObjectFactory().NewIdentityLC(); + identityParam->SetIdentityL( KGroupId2 ); + + CXIMPIdentityImp* identityParamImp = + ( CXIMPIdentityImp* ) identityParam->GetInterface( + CXIMPIdentityImp::KClassId, + MXIMPBase::EPanicIfUnknown ); + HBufC8* packedId = TXIMPObjectPacker< CXIMPIdentityImp >::PackL( *identityParamImp ); + CleanupStack::PopAndDestroy(); // identityParam + CleanupStack::PushL( packedId ); + CXIMPTestFileSrvMsg* srvMsg = CXIMPTestFileSrvMsg::NewL( CXIMPTestFileSrvMsg::ETestSrvMsgReqParamIdentity, + *packedId ); + CleanupStack::PopAndDestroy( packedId ); + CleanupStack::PushL( srvMsg ); + wrapper->FileTool().SrvMsgStoreL( srvMsg ); + CleanupStack::PopAndDestroy( srvMsg ); + + // Wait for server to handle srvmsg. + User::After( 2 ); + // now the adaptation should know how to answer + + // do the call + reqId = presGroup.SubscribePresentityGroupContentL( *iCurrentGrId ); + + // and wait + EUNIT_ASSERT_DESC( KErrNone == iListener2->WaitAndAssertL(), "SubscribePresentityGroupContentL failed" ); + + // verify that subscribe was called + messenger->AssertSubscribePresentityGroupContentCalled( ETrue ); + + // ------------------------------------------------------ + + // make sure the new listener is not listening for events! + iListener2->SetEventSourceL( NULL ); + + wrapper->UnbindL(); + + TeardownTestSupport(); + } + +// subscribe and unsubscribe, altered id is the same +void T_PresenceGroupMemberManagement::T_SubUnsubGroupContent_AlteredSame_Single_L() + { + EUNIT_PRINT( _L("Single presentity group content sub and unsub with altered but same id") ); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + wrapper->BindL( 0 ); + + // ------------------------------------------------------ + // some startup stuff + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresentityGroups& presGroup = presFeat->PresentityGroups(); + + iListener2 = CXIMPTestListener::NewL( context ); + // ------------------------------------------------------ + + // Tell the protocol it should act normally + wrapper->GetMessenger()->SetNoError(); + + iCurrentGrId = context->ObjectFactory().NewIdentityLC(); + CleanupStack::Pop(); // iCurrentGrId + iCurrentGrId->SetIdentityL( KGroupId ); + + // ------------------------------------------------------ + // create presentity group + // + // expect events: + // - request complete. + // NOTE: no presentitygrouplistevent as we've not subscribed the group lists + + // normal request complete + TXIMPRequestId reqIdDummy; // not checked + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + + // identity + displayname + CPresentityGroupInfoImp* infoImp = CPresentityGroupInfoImp::NewLC( *iCurrentGrId, KGroupDisplayName ); + evReqComplete->AppendParamL( infoImp ); + CleanupStack::Pop( infoImp ); + + iListener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + TXIMPRequestId reqId = presGroup.CreatePresentityGroupL( *iCurrentGrId, KGroupDisplayName ); + + // and wait + EUNIT_ASSERT_DESC( KErrNone == iListener2->WaitAndAssertL(), "CreatePresentityGroupL failed" ); + messenger->AssertCreatePresentityGroupCalled( ETrue ); + + // ------------------------------------------------------ + // subscribe presentity group CONTENT + // + // expect events: + // - request complete + evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + iListener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + // tell the test protocol to send back an altered id + MXIMPIdentity* identityParam = context->ObjectFactory().NewIdentityLC(); + identityParam->SetIdentityL( KGroupId ); + + CXIMPIdentityImp* identityParamImp = + ( CXIMPIdentityImp* ) identityParam->GetInterface( + CXIMPIdentityImp::KClassId, + MXIMPBase::EPanicIfUnknown ); + HBufC8* packedId = TXIMPObjectPacker< CXIMPIdentityImp >::PackL( *identityParamImp ); + CleanupStack::PopAndDestroy(); // identityParam + CleanupStack::PushL( packedId ); + CXIMPTestFileSrvMsg* srvMsg = CXIMPTestFileSrvMsg::NewL( CXIMPTestFileSrvMsg::ETestSrvMsgReqParamIdentity, + *packedId ); + CleanupStack::PopAndDestroy( packedId ); + CleanupStack::PushL( srvMsg ); + wrapper->FileTool().SrvMsgStoreL( srvMsg ); + CleanupStack::PopAndDestroy( srvMsg ); + + // Wait for server to handle srvmsg. + User::After( 2 ); + // now the adaptation should know how to answer + + // do the call + reqId = presGroup.SubscribePresentityGroupContentL( *iCurrentGrId ); + + // and wait + EUNIT_ASSERT_DESC( KErrNone == iListener2->WaitAndAssertL(), "SubscribePresentityGroupContentL failed" ); + + // verify that subscribe was called + messenger->AssertSubscribePresentityGroupContentCalled( ETrue ); + + // ------------------------------------------------------ + + // make sure the new listener is not listening for events! + iListener2->SetEventSourceL( NULL ); + + wrapper->UnbindL(); + + TeardownTestSupport(); + } + + +// Add members +void T_PresenceGroupMemberManagement::T_AddGroupMembers_Single_L() + { + EUNIT_PRINT( _L("Single add members to group") ); + + TXIMPCallBack callback = &T_PresenceGroupMemberManagement::T_TestAddMembersL; + T_GenericSubAndUnsubL( callback ); + } + +// Remove members +void T_PresenceGroupMemberManagement::T_RemoveGroupMembers_Single_L() + { + EUNIT_PRINT( _L("Single remove member of group") ); + + TXIMPCallBack callback = &T_PresenceGroupMemberManagement::T_TestRemoveMembersL; + T_GenericSubAndUnsubL( callback ); + } + +// Update members +void T_PresenceGroupMemberManagement::T_UpdateGroupMembers_Single_L() + { + EUNIT_PRINT( _L("Single update member of group") ); + + TXIMPCallBack callback = &T_PresenceGroupMemberManagement::T_TestUpdateMembers_L; + T_GenericSubAndUnsubL( callback ); + } + +// Update members without subscription +void T_PresenceGroupMemberManagement::T_UpdateGroupMembers_NonSub_Single_L() + { + EUNIT_PRINT( _L("Single update member of group, unsubscribed") ); + + TXIMPCallBack callback = &T_PresenceGroupMemberManagement::T_TestUpdateMembers_NonSub_L; + iSkipSubscribe = ETrue; + iSkipUnsubscribe = ETrue; + T_GenericSubAndUnsubL( callback ); + } + +// Update members with non-existing member +void T_PresenceGroupMemberManagement::T_UpdateGroupMembers_NonExist_Single_L() + { + EUNIT_PRINT( _L("Single update nonexisting member of group") ); + + TXIMPCallBack callback = &T_PresenceGroupMemberManagement::T_TestUpdateMembers_NonExisting_L; + T_GenericSubAndUnsubL( callback ); + } + +// Remove members without subscription +void T_PresenceGroupMemberManagement::T_RemoveGroupMembers_NonSub_Single_L() + { + EUNIT_PRINT( _L("Single remove member of group, unsubscribed") ); + + TXIMPCallBack callback = &T_PresenceGroupMemberManagement::T_TestRemoveMembers_NonSub_L; + iSkipSubscribe = ETrue; + iSkipUnsubscribe = ETrue; + T_GenericSubAndUnsubL( callback ); + } + +// Remove members with non-existing member +void T_PresenceGroupMemberManagement::T_RemoveGroupMembers_NonExist_Single_L() + { + EUNIT_PRINT( _L("Single remove nonexisting member of group") ); + + TXIMPCallBack callback = &T_PresenceGroupMemberManagement::T_TestRemoveMembers_NonExisting_L; + T_GenericSubAndUnsubL( callback ); + } + +// ------------------------------------------------------ +// expire non-subscribed data +// ------------------------------------------------------ +// +void T_PresenceGroupMemberManagement::T_ExpireNonSubscribedData_L() + { + EUNIT_PRINT( _L("Expire non subscribed data") ); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + wrapper->BindL( 0 ); + + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresentityGroups& presGroup = presFeat->PresentityGroups(); + + iCurrentGrId = context->ObjectFactory().NewIdentityLC(); + CleanupStack::Pop(); // iCurrentGrId + iCurrentGrId->SetIdentityL( KGroupId ); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // 1. Create notification + RXIMPObjOwningPtrArray groupMemberList; + CXIMPIdentityImp* identityImp = + ( CXIMPIdentityImp* ) iCurrentGrId->GetInterface( + CXIMPIdentityImp::KClassId, + MXIMPBase::EPanicIfUnknown ); + HBufC8* packedId = TXIMPObjectPacker< CXIMPIdentityImp >::PackL( *identityImp ); + CleanupStack::PushL( packedId ); + HBufC8* packedArray = TXIMPObjectPacker::PackArrayL( groupMemberList ); + CleanupStack::PushL( packedArray ); + RPointerArray< HBufC8 > bufferArray; + CleanupClosePushL( bufferArray ); + bufferArray.AppendL( packedId ); + bufferArray.AppendL( packedArray ); + HBufC8* packedBufferArray = TXIMPHBuf8Packer::PackArrayL( bufferArray ); + CleanupStack::PopAndDestroy( 2, packedArray ); // bufferArray, packedArray + CleanupStack::PushL( packedBufferArray ); + + // 2. Use filetool to send it for plugin. + CXIMPTestFileSrvMsg* srvMsg = CXIMPTestFileSrvMsg::NewL( CXIMPTestFileSrvMsg::ETestSrvMsgPresentityGroupMemberList, + *packedBufferArray ); + CleanupStack::PopAndDestroy( packedBufferArray ); + CleanupStack::PushL( srvMsg ); + wrapper->FileTool().CleanAllL(); + wrapper->FileTool().SrvMsgStoreL( srvMsg ); + CleanupStack::PopAndDestroy( srvMsg ); + + // Wait for server to handle srvmsg. + CXIMPTestWaitHelper* wait = CXIMPTestWaitHelper::NewL(); + CleanupStack::PushL( wait ); + wait->WaitForL( 2 ); + + // 3. Create and send check notification to server + srvMsg = CXIMPTestFileSrvMsg::NewL( CXIMPTestFileSrvMsg::ETestCheckIfGroupMemberExists, + *packedId ); + CleanupStack::PushL( srvMsg ); + wrapper->FileTool().SrvMsgStoreL( srvMsg ); + + // Wait for server to handle srvmsg. + wait->WaitForL( 2 ); + + TInt value = messenger->GetValueFor( EXIMPPlgTestExistsGroupContentInCache ); + EUNIT_ASSERT_DESC( value == 1, "Data not cached temporarly" ); + + // 4. Wait for cache to clear. + wait->WaitForL( 15 ); + + // 5. Send check notification to server + wrapper->FileTool().SrvMsgStoreL( srvMsg ); + CleanupStack::PopAndDestroy( srvMsg ); + + // Wait for server to handle srvmsg. + wait->WaitForL( 2 ); + CleanupStack::PopAndDestroy( wait ); + CleanupStack::PopAndDestroy( packedId ); + value = messenger->GetValueFor( EXIMPPlgTestExistsGroupContentInCache ); + EUNIT_ASSERT_DESC( value == KErrNotFound, "Data not cleared like it should" ); + wrapper->UnbindL(); + } + +// ------------------------------------------------------ +// expire non-subscribed data, update multiple +// ------------------------------------------------------ +// +void T_PresenceGroupMemberManagement::T_ExpireNonSubscribedDataUpdateMultiple_L() + { + EUNIT_PRINT( _L("Expire non subscribed data, update multiple") ); + + // Wait for server to handle srvmsg. + CXIMPTestWaitHelper* wait = CXIMPTestWaitHelper::NewL(); + CleanupStack::PushL( wait ); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + wrapper->BindL( 0 ); + + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresentityGroups& presGroup = presFeat->PresentityGroups(); + + iCurrentGrId = context->ObjectFactory().NewIdentityLC(); + CleanupStack::Pop(); // iCurrentGrId + iCurrentGrId->SetIdentityL( KGroupId ); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // 1. Create notification + RXIMPObjOwningPtrArray groupMemberList; + CXIMPIdentityImp* identityImp = + ( CXIMPIdentityImp* ) iCurrentGrId->GetInterface( + CXIMPIdentityImp::KClassId, + MXIMPBase::EPanicIfUnknown ); + HBufC8* packedId = TXIMPObjectPacker< CXIMPIdentityImp >::PackL( *identityImp ); + CleanupStack::PushL( packedId ); + HBufC8* packedArray = TXIMPObjectPacker::PackArrayL( groupMemberList ); + CleanupStack::PushL( packedArray ); + RPointerArray< HBufC8 > bufferArray; + CleanupClosePushL( bufferArray ); + bufferArray.AppendL( packedId ); + bufferArray.AppendL( packedArray ); + HBufC8* packedBufferArray = TXIMPHBuf8Packer::PackArrayL( bufferArray ); + CleanupStack::PopAndDestroy( 2, packedArray ); // bufferArray, packedArray + CleanupStack::PushL( packedBufferArray ); + + // 2. Use filetool to send it for plugin. + CXIMPTestFileSrvMsg* srvMsg = CXIMPTestFileSrvMsg::NewL( CXIMPTestFileSrvMsg::ETestSrvMsgPresentityGroupMemberList, + *packedBufferArray ); + CleanupStack::PopAndDestroy( packedBufferArray ); + CleanupStack::PushL( srvMsg ); + wrapper->FileTool().CleanAllL(); + wrapper->FileTool().SrvMsgStoreL( srvMsg ); + + wait->WaitForL( 2 ); + + // 3. Create and send check notification to server + CXIMPTestFileSrvMsg* srvMsg2 = CXIMPTestFileSrvMsg::NewL( CXIMPTestFileSrvMsg::ETestCheckIfGroupMemberExists, + *packedId ); + CleanupStack::PushL( srvMsg2 ); + wrapper->FileTool().SrvMsgStoreL( srvMsg2 ); + + // Wait for server to handle srvmsg. + wait->WaitForL( 2 ); + + TInt value = messenger->GetValueFor( EXIMPPlgTestExistsGroupContentInCache ); + EUNIT_ASSERT_DESC( value == 1, "Data not cached temporarly" ); + + // 4. Wait for cache to clear. + wait->WaitForL( 5 ); + + // Refresh temporar cache. + wrapper->FileTool().SrvMsgStoreL( srvMsg ); + + // 4. Wait for cache to clear. + wait->WaitForL( 10 ); + + // 5. Send check notification to server + wrapper->FileTool().SrvMsgStoreL( srvMsg2 ); + CleanupStack::PopAndDestroy( 3, packedId ); //packedId, srvMsg, srvMsg2 + + // Wait for server to handle srvmsg. + wait->WaitForL( 2 ); + value = messenger->GetValueFor( EXIMPPlgTestExistsGroupContentInCache ); + EUNIT_ASSERT_DESC( value == 1, "Data not cached temporarly, but it should be" ); + + wrapper->UnbindL(); + + CleanupStack::PopAndDestroy( wait ); + } + +// ------------------------------------------------------ +// General subscribe and unsubscribe for multiple +// ------------------------------------------------------ +// +void T_PresenceGroupMemberManagement::T_SubUnsubGroupContent_Multi_L() + { + BindAllL(); + + TInt countOfWrappers = iWrapperMgr->WrapperCount(); + + CXIMPObjectFactoryImp* factory = CXIMPObjectFactoryImp::NewL(); + CleanupStack::PushL( factory ); + + MXIMPIdentity* currentGrId = factory->NewIdentityLC(); + currentGrId->SetIdentityL( KGroupId ); + + // create group to all connections + for ( TInt i = 0; i < countOfWrappers; i++ ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( i ); + + // ------------------------------------------------------ + // some startup stuff + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresentityGroups& presGroup = presFeat->PresentityGroups(); + + CXIMPTestListener* listener = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener ); + // ------------------------------------------------------ + + // Tell the protocol it should act normally + wrapper->GetMessenger()->SetNoError(); + + // ------------------------------------------------------ + // create presentity group + // + // expect events: + // - request complete. + // NOTE: no presentitygrouplistevent as we've not subscribed the group lists + + // normal request complete + TXIMPRequestId reqIdDummy; // not checked + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + + // identity + displayname + CPresentityGroupInfoImp* infoImp = CPresentityGroupInfoImp::NewLC( *currentGrId, KGroupDisplayName ); + evReqComplete->AppendParamL( infoImp ); + CleanupStack::Pop( infoImp ); + + listener->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + TXIMPRequestId reqId = presGroup.CreatePresentityGroupL( *currentGrId, KGroupDisplayName ); + + // and wait + EUNIT_ASSERT_DESC( KErrNone == listener->WaitAndAssertL(), "CreatePresentityGroupL failed" ); + + // verify that create was called + messenger->AssertCreatePresentityGroupCalled( ETrue ); + + CleanupStack::PopAndDestroy( listener ); + } + + // subscribe presentity group content in all connections + for ( TInt i = 0; i < countOfWrappers; i++ ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( i ); + + // ------------------------------------------------------ + // some startup stuff + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresentityGroups& presGroup = presFeat->PresentityGroups(); + + CXIMPTestListener* listener = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener ); + // ------------------------------------------------------ + + // ------------------------------------------------------ + // subscribe presentity group CONTENT + // + // expect events: + // - request complete + TXIMPRequestId reqIdDummy; // not checked + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + // do the call + TXIMPRequestId reqId = presGroup.SubscribePresentityGroupContentL( *currentGrId ); + + // and wait + EUNIT_ASSERT_DESC( KErrNone == listener->WaitAndAssertL(), "SubscribePresentityGroupContentL failed" ); + + // verify that subscribe was called + messenger->AssertSubscribePresentityGroupContentCalled( ETrue ); + + CleanupStack::PopAndDestroy( listener ); + } + + // unsubscribe presentity group content in all connections + for ( TInt i = 0; i < countOfWrappers; i++ ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( i ); + + // ------------------------------------------------------ + // some startup stuff + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresentityGroups& presGroup = presFeat->PresentityGroups(); + + CXIMPTestListener* listener = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener ); + // ------------------------------------------------------ + + // ------------------------------------------------------ + // unsubscribe presentity group content + // + // expect events: + // - request complete + // - presentity group content event + + TXIMPRequestId reqIdDummy; // not checked + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + CPresentityGroupContentEventImp* groupCntEvent = + XIMPTestEventFactory::CreateGroupContentEventLCX( + KGroupId, + KNullDesC, + KNullDesC, + XIMPTestEventFactory::ETestPGLCntRemoved, + KNullDesC, + KNullDesC, + MXIMPDataSubscriptionState::ESubscriptionInactive, + MXIMPDataSubscriptionState::EDataUnavailable + ); + + listener->ExpectL( groupCntEvent ); + CleanupStack::Pop( groupCntEvent ); // 5 more items in cleanupstack + + // do the call + TXIMPRequestId reqId = presGroup.UnsubscribePresentityGroupContentL( *currentGrId ); + + // and wait + EUNIT_ASSERT_DESC( KErrNone == listener->WaitAndAssertL(), "UnsubscribePresentityGroupContentL failed" ); + CleanupStack::PopAndDestroy( 5 ); // lists + + // verify that unsubscribe was called + // unsubscribe really called only on the last one + messenger->AssertUnsubscribePresentityGroupContentCalled( i == countOfWrappers-1 ? ETrue : EFalse ); + + CleanupStack::PopAndDestroy( listener ); + } + + // delete presentity group in all connections + for ( TInt i = 0; i < countOfWrappers; i++ ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( i ); + + // ------------------------------------------------------ + // some startup stuff + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresentityGroups& presGroup = presFeat->PresentityGroups(); + + CXIMPTestListener* listener = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener ); + // ------------------------------------------------------ + + // ------------------------------------------------------ + // delete presentity group + // + // expect events: + // - request complete + // NO presentity group content event as we've just unsubscribed it. + + TXIMPRequestId reqIdDummy; // not checked + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + // do the call + TXIMPRequestId reqId = presGroup.DeletePresentityGroupL( *currentGrId ); + + // and wait + EUNIT_ASSERT_DESC( KErrNone == listener->WaitAndAssertL(), "DeletePresentityGroupL failed" ); + + CleanupStack::PopAndDestroy( listener ); + } + + // ------------------------------------------------------ + + CleanupStack::PopAndDestroy( 2 ); // currentGrId, factory + + + UnbindAllL(); + + TeardownTestSupport(); + } + +// ------------------------------------------------------ +// General subscribe and unsubscribe for multiple +// Subscribed for all contexts, force refresh +// ------------------------------------------------------ +// +void T_PresenceGroupMemberManagement::T_SubUnsubGroupContent_All_Multi_L() + { + BindAllL(); + + TInt countOfWrappers = iWrapperMgr->WrapperCount(); + + CXIMPObjectFactoryImp* factory = CXIMPObjectFactoryImp::NewL(); + CleanupStack::PushL( factory ); + + MXIMPIdentity* currentGrId = factory->NewIdentityLC(); + currentGrId->SetIdentityL( KGroupId ); + + // create group to all connections + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + + // ------------------------------------------------------ + // some startup stuff + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresentityGroups& presGroup = presFeat->PresentityGroups(); + + CXIMPTestListener* listener = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener ); + // ------------------------------------------------------ + + // Tell the protocol it should act normally + wrapper->GetMessenger()->SetNoError(); + + // ------------------------------------------------------ + // create presentity group + // + // expect events: + // - request complete. + // NOTE: no presentitygrouplistevent as we've not subscribed the group lists + + // normal request complete + TXIMPRequestId reqIdDummy; // not checked + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + + // identity + displayname + CPresentityGroupInfoImp* infoImp = CPresentityGroupInfoImp::NewLC( *currentGrId, KGroupDisplayName ); + evReqComplete->AppendParamL( infoImp ); + CleanupStack::Pop( infoImp ); + + listener->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + TXIMPRequestId reqId = presGroup.CreatePresentityGroupL( *currentGrId, KGroupDisplayName ); + + // and wait + EUNIT_ASSERT_DESC( KErrNone == listener->WaitAndAssertL(), "CreatePresentityGroupL failed" ); + + // verify that create was called + messenger->AssertCreatePresentityGroupCalled( ETrue ); + + // we'll make a new listener below, disable temporarily + listener->SetEventSourceL( NULL ); + + // subscribe presentity group content in all connections + for ( TInt i = 0; i < countOfWrappers; i++ ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( i ); + + // ------------------------------------------------------ + // some startup stuff + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresentityGroups& presGroup = presFeat->PresentityGroups(); + + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + // ------------------------------------------------------ + + // ------------------------------------------------------ + // subscribe presentity group content for ALL contexts + // + // expect events: + // - request complete + evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + // do the call + reqId = presGroup.SubscribePresentityGroupContentL( *currentGrId ); + + // and wait + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "SubscribePresentityGroupContentL failed" ); + + // verify that subscribe was called for first only + if ( i == 0 ) + { + messenger->AssertSubscribePresentityGroupContentCalled( ETrue ); + // reset flag + messenger->SetValueFor( + EXIMPPlgTestSubscribePresentityGroupContentCalled, + EFalse ); + } + else + { + messenger->AssertSubscribePresentityGroupContentCalled( EFalse ); + } + + CleanupStack::PopAndDestroy( listener2 ); + } + + for ( TInt i = 0; i < countOfWrappers; i++ ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( i ); + + // ------------------------------------------------------ + // some startup stuff + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresentityGroups& presGroup = presFeat->PresentityGroups(); + + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + // ------------------------------------------------------ + + // ------------------------------------------------------ + // subscribe presentity group content, making a REFRESH case + // with multiple contexts + // + // expect events: + // - request complete + // - group content event + + evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + CPresentityGroupContentEventImp* groupCntEvent = + XIMPTestEventFactory::CreateGroupContentEventLCX( + KGroupId, + KNullDesC, + KNullDesC, + XIMPTestEventFactory::ETestPGLCntUpdated, + KNullDesC, + KNullDesC, + MXIMPDataSubscriptionState::ESubscriptionActive, + MXIMPDataSubscriptionState::EDataUnavailable + ); + + listener2->ExpectL( groupCntEvent ); + CleanupStack::Pop( groupCntEvent ); // 5 more items in cleanupstack + + // do the call + reqId = presGroup.SubscribePresentityGroupContentL( *currentGrId ); + + // and wait + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "SubscribePresentityGroupContentL failed" ); + + CleanupStack::PopAndDestroy( 5 ); // rest of group the content event + + // subscribe is not called in the adaptation, this is a refresh case + messenger->AssertSubscribePresentityGroupContentCalled( EFalse ); + + CleanupStack::PopAndDestroy( listener2 ); + } + + // continue listening + listener->SetEventSourceL( context ); + + // ------------------------------------------------------ + // unsubscribe presentity group content + // + // expect events: + // - request complete + // - presentity group content event + + evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + CPresentityGroupContentEventImp* groupCntEvent = + XIMPTestEventFactory::CreateGroupContentEventLCX( + KGroupId, + KNullDesC, + KNullDesC, + XIMPTestEventFactory::ETestPGLCntRemoved, + KNullDesC, + KNullDesC, + MXIMPDataSubscriptionState::ESubscriptionInactive, + MXIMPDataSubscriptionState::EDataUnavailable + ); + + listener->ExpectL( groupCntEvent ); + CleanupStack::Pop( groupCntEvent ); // 5 more items in cleanupstack + + // do the call + reqId = presGroup.UnsubscribePresentityGroupContentL( *currentGrId ); + + // and wait + EUNIT_ASSERT_DESC( KErrNone == listener->WaitAndAssertL(), "UnsubscribePresentityGroupContentL failed" ); + CleanupStack::PopAndDestroy( 5 ); // lists + + // verify that unsubscribe was NOT called (other contexts are listening too), + // and it will be unscubscribed on the last call + messenger->AssertUnsubscribePresentityGroupContentCalled( EFalse ); + + // ------------------------------------------------------ + // delete presentity group + // + // expect events: + // - request complete + // NO presentity group content event as we've just unsubscribed it. + + evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + // do the call + reqId = presGroup.DeletePresentityGroupL( *currentGrId ); + + // and wait + EUNIT_ASSERT_DESC( KErrNone == listener->WaitAndAssertL(), "DeletePresentityGroupL failed" ); + + // ------------------------------------------------------ + + CleanupStack::PopAndDestroy( 3 ); // listener, currentGrId, factory + + UnbindAllL(); + + TeardownTestSupport(); + } + +// ------------------------------------------------------ +// General subscribe and unsubscribe for multiple +// Subscribed for one context only +// ------------------------------------------------------ +// +void T_PresenceGroupMemberManagement::T_SubUnsubGroupContent_One_Multi_L() + { + BindAllL(); + + CXIMPObjectFactoryImp* factory = CXIMPObjectFactoryImp::NewL(); + CleanupStack::PushL( factory ); + + MXIMPIdentity* currentGrId = factory->NewIdentityLC(); + currentGrId->SetIdentityL( KGroupId ); + + // create group to all connections + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + + // ------------------------------------------------------ + // some startup stuff + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresentityGroups& presGroup = presFeat->PresentityGroups(); + + CXIMPTestListener* listener = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener ); + // ------------------------------------------------------ + + // Tell the protocol it should act normally + wrapper->GetMessenger()->SetNoError(); + + // ------------------------------------------------------ + // create presentity group + // + // expect events: + // - request complete. + // NOTE: no presentitygrouplistevent as we've not subscribed the group lists + + // normal request complete + TXIMPRequestId reqIdDummy; // not checked + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + + // identity + displayname + CPresentityGroupInfoImp* infoImp = CPresentityGroupInfoImp::NewLC( *currentGrId, KGroupDisplayName ); + evReqComplete->AppendParamL( infoImp ); + CleanupStack::Pop( infoImp ); + + listener->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + TXIMPRequestId reqId = presGroup.CreatePresentityGroupL( *currentGrId, KGroupDisplayName ); + + // and wait + EUNIT_ASSERT_DESC( KErrNone == listener->WaitAndAssertL(), "CreatePresentityGroupL failed" ); + + // verify that create was called + messenger->AssertCreatePresentityGroupCalled( ETrue ); + + // ------------------------------------------------------ + // subscribe presentity group CONTENT + // + // expect events: + // - request complete + evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + // do the call + reqId = presGroup.SubscribePresentityGroupContentL( *currentGrId ); + + // and wait + EUNIT_ASSERT_DESC( KErrNone == listener->WaitAndAssertL(), "SubscribePresentityGroupContentL failed" ); + + // verify that subscribe was called + messenger->AssertSubscribePresentityGroupContentCalled( ETrue ); + + // ------------------------------------------------------ + // subscribe presentity group content, making a REFRESH case + // with multiple contexts + // + // expect events: + // - request complete + // - group content event + + evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + CPresentityGroupContentEventImp* groupCntEvent = + XIMPTestEventFactory::CreateGroupContentEventLCX( + KGroupId, + KNullDesC, + KNullDesC, + XIMPTestEventFactory::ETestPGLCntUpdated, + KNullDesC, + KNullDesC, + MXIMPDataSubscriptionState::ESubscriptionActive, + MXIMPDataSubscriptionState::EDataUnavailable + ); + + listener->ExpectL( groupCntEvent ); + CleanupStack::Pop( groupCntEvent ); // 5 more items in cleanupstack + + // do the call + reqId = presGroup.SubscribePresentityGroupContentL( *currentGrId ); + + // and wait + EUNIT_ASSERT_DESC( KErrNone == listener->WaitAndAssertL(), "SubscribePresentityGroupContentL failed" ); + + CleanupStack::PopAndDestroy( 5 ); // rest of group the content event + + // verify that subscribe was called + messenger->AssertSubscribePresentityGroupContentCalled( ETrue ); + + // ------------------------------------------------------ + // unsubscribe presentity group content + // + // expect events: + // - request complete + // - presentity group content event + + evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + groupCntEvent = + XIMPTestEventFactory::CreateGroupContentEventLCX( + KGroupId, + KNullDesC, + KNullDesC, + XIMPTestEventFactory::ETestPGLCntRemoved, + KNullDesC, + KNullDesC, + MXIMPDataSubscriptionState::ESubscriptionInactive, + MXIMPDataSubscriptionState::EDataUnavailable + ); + + listener->ExpectL( groupCntEvent ); + CleanupStack::Pop( groupCntEvent ); // 5 more items in cleanupstack + + // do the call + reqId = presGroup.UnsubscribePresentityGroupContentL( *currentGrId ); + + // and wait + EUNIT_ASSERT_DESC( KErrNone == listener->WaitAndAssertL(), "UnsubscribePresentityGroupContentL failed" ); + CleanupStack::PopAndDestroy( 5 ); // lists + + // verify that unsubscribe was called + // unsubscribe really called only on the last one + messenger->AssertUnsubscribePresentityGroupContentCalled( ETrue ); + + // ------------------------------------------------------ + // delete presentity group + // + // expect events: + // - request complete + // NO presentity group content event as we've just unsubscribed it. + + evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + // do the call + reqId = presGroup.DeletePresentityGroupL( *currentGrId ); + + // and wait + EUNIT_ASSERT_DESC( KErrNone == listener->WaitAndAssertL(), "DeletePresentityGroupL failed" ); + + // ------------------------------------------------------ + + CleanupStack::PopAndDestroy( 3 ); // listener, currentGrId, factory + + UnbindAllL(); + + TeardownTestSupport(); + } + +// Unsubscribe non-subscribed +void T_PresenceGroupMemberManagement::T_UnsubscribeNonSubscribed_L() + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + wrapper->BindL( 0 ); + + // ------------------------------------------------------ + // some startup stuff + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresentityGroups& presGroup = presFeat->PresentityGroups(); + + iListener2 = CXIMPTestListener::NewL( context ); + // ------------------------------------------------------ + + // Tell the protocol it should act normally + wrapper->GetMessenger()->SetNoError(); + + iCurrentGrId = context->ObjectFactory().NewIdentityLC(); + CleanupStack::Pop(); // iCurrentGrId + iCurrentGrId->SetIdentityL( KGroupId ); + + // ------------------------------------------------------ + // create presentity group + // + // expect events: + // - request complete. + // NOTE: no presentitygrouplistevent as we've not subscribed the group lists + + // normal request complete + TXIMPRequestId reqIdDummy; // not checked + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + + // identity + displayname + CPresentityGroupInfoImp* infoImp = CPresentityGroupInfoImp::NewLC( *iCurrentGrId, KGroupDisplayName ); + evReqComplete->AppendParamL( infoImp ); + CleanupStack::Pop( infoImp ); + + iListener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + TXIMPRequestId reqId = presGroup.CreatePresentityGroupL( *iCurrentGrId, KGroupDisplayName ); + + // and wait + EUNIT_ASSERT_DESC( KErrNone == iListener2->WaitAndAssertL(), "CreatePresentityGroupL failed" ); + messenger->AssertCreatePresentityGroupCalled( ETrue ); + + // ------------------------------------------------------ + // unsubscribe presentity group content + // + // expect events: + // - request complete + // - presentity group content event + + evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + iListener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + CPresentityGroupContentEventImp* groupCntEvent = + XIMPTestEventFactory::CreateGroupContentEventLCX( + KGroupId, + KNullDesC, + KNullDesC, + XIMPTestEventFactory::ETestPGLCntRemoved, + KNullDesC, + KNullDesC, + MXIMPDataSubscriptionState::ESubscriptionInactive, + MXIMPDataSubscriptionState::EDataUnavailable + ); + + iListener2->ExpectL( groupCntEvent ); + CleanupStack::Pop( groupCntEvent ); // 5 more items in cleanupstack + + // do the call + reqId = presGroup.UnsubscribePresentityGroupContentL( *iCurrentGrId ); + + // and wait + EUNIT_ASSERT_DESC( KErrNone == iListener2->WaitAndAssertL(), "UnsubscribePresentityGroupContentL failed" ); + + CleanupStack::PopAndDestroy( 5 ); // lists + + // verify that unsubscribe was not called, not subscribed, so won't + // unsubscribe + messenger->AssertUnsubscribePresentityGroupContentCalled( EFalse ); + + // make sure the new listener is not listening for events! + iListener2->SetEventSourceL( NULL ); + + wrapper->UnbindL(); + + TeardownTestSupport(); + } + +// =========================================================================== +// SETUP HELPERS FOR THE LISTENER +// =========================================================================== +// +void T_PresenceGroupMemberManagement::SetupListenerReqCompleteL( CXIMPTestContextWrapper* aWrapper, TXIMPTestStatusEventTemplate aEventType ) + { + RArray< TInt32 > array; + CleanupClosePushL( array ); + array.Append( MXIMPContextStateEvent::KInterfaceId ); + array.Append( MPresentityGroupListEvent::KInterfaceId ); + aWrapper->SetupListenerReqCompleteL( aEventType, &array ); + CleanupStack::PopAndDestroy(); // array + } + +void T_PresenceGroupMemberManagement::SetupListenerReqCompleteAllowEventsL( CXIMPTestContextWrapper* aWrapper, TXIMPTestStatusEventTemplate aEventType ) + { + RArray< TInt32 > array; + CleanupClosePushL( array ); + array.AppendL( MXIMPRequestCompleteEvent::KInterfaceId ); + array.AppendL( MXIMPContextStateEvent::KInterfaceId ); + array.Append( MPresentityGroupListEvent::KInterfaceId ); + array.Append( MXIMPContextStateEvent::KInterfaceId ); + array.Append( MPresentityGroupListEvent::KInterfaceId ); + array.Append( MPresentityGroupContentEvent::KInterfaceId ); + aWrapper->SetupListenerReqCompleteL( aEventType, &array ); + CleanupStack::PopAndDestroy(); // array + } + +// =========================================================================== +// TEST CASE TABLE +// =========================================================================== +// +EUNIT_BEGIN_TEST_TABLE( + T_PresenceGroupMemberManagement, + "XIMP presence group member management tests", + "MODULE" ) + +PRFW_DECORATED_TEST( + "Subscribe and unsubscribe presentity group content", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_SubUnsubGroupContent_Single_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Subscribe and unsubscribe multiple", + "", + "", + "FUNCTIONALITY", + SetupMultiple_L, + T_SubUnsubGroupContent_Multi_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Refresh subscription for one, multiple", + "", + "", + "FUNCTIONALITY", + SetupMultiple_L, + T_SubUnsubGroupContent_One_Multi_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Refresh subscription for all, multiple", + "", + "", + "FUNCTIONALITY", + SetupMultiple_L, + T_SubUnsubGroupContent_All_Multi_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Subscribe content and receive altered id", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_SubUnsubGroupContent_Altered_Single_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Subscribe content and receive altered but same id", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_SubUnsubGroupContent_AlteredSame_Single_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Unsubscribe non-subscribed", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_UnsubscribeNonSubscribed_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Add members to group", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_AddGroupMembers_Single_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Remove members from group", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_RemoveGroupMembers_Single_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Remove members from unsubscribed group", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_RemoveGroupMembers_NonSub_Single_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Remove nonexisting member from group", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_RemoveGroupMembers_NonExist_Single_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Updated members from group", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_UpdateGroupMembers_Single_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Updated members from nonsubscribed group", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_UpdateGroupMembers_NonSub_Single_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Updated nonexisting member of group", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_UpdateGroupMembers_NonExist_Single_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Expire non-subscribed data", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_ExpireNonSubscribedData_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Expire non-subscribed data. Update multiple times", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_ExpireNonSubscribedDataUpdateMultiple_L, + Teardown ) + + +EUNIT_END_TEST_TABLE + + +// =========================================================================== +// TEST SUITE CONSTRUCTION +// =========================================================================== +// +EXPORT_C MEUnitTest* CreateTestSuiteL() + { + return T_PresenceGroupMemberManagement::NewL(); + } + +// TODO implement this (split this file to multiple parts): +/* +// =========================================================================== +// TEST SUITE CONSTRUCTION +// =========================================================================== +// +EXPORT_C MEUnitTest* CreateTestSuiteL() + { + CEUnitTestSuite* suiteCollection = CEUnitTestSuite::NewLC( _L("XIMP group list management tests") ); + + CEUnitTestSuite* suite = T_PresenceGroupListManagement::NewL(); + CleanupStack::PushL( suite ); + suiteCollection->AddL( suite ); + CleanupStack::Pop( suite ); + + suite = T_xxx::NewL(); + CleanupStack::PushL( suite ); + suiteCollection->AddL( suite ); + CleanupStack::Pop( suite ); + + CleanupStack::Pop( suiteCollection ); + return suiteCollection; + } + +*/ + + + +// =========================================================================== +// MISC +// =========================================================================== +// +//Exception handler function +void MyExceptionHandler( TExcType /*aType*/ ) + { + __BREAKPOINT(); + } + +void T_PresenceGroupMemberManagement::UseMyOwnExceptionHandler() + { + //Register exeption handler + TInt r = User::SetExceptionHandler( MyExceptionHandler, 0xFFFFFFFF ); + if (r != KErrNone) + { + User::Panic( _L("MyExHandler"), 1 ); + } + } + + +// end of file diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencegroupmembermngt/t_presencegroupmembermngt.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencegroupmembermngt/t_presencegroupmembermngt.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,153 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef T_PRESENCEGROUPMEMBERMANAGEMENT_H +#define T_PRESENCEGROUPMEMBERMANAGEMENT_H + +#include +#include +#include +#include "prfwteststatuseventlistener.h" +#include "prfwtestmessaging.h" + +class CXIMPTestContextWrapper; +class CXIMPTestContextWrapperMgr; +class CXIMPTestMessenger; +class CPresentityGroupListEventImp; +class CPresentityGroupContentEventImp; + +class T_PresenceGroupMemberManagement; + +class CXIMPTestListener; + +// function pointer to a method +typedef void (T_PresenceGroupMemberManagement::* TXIMPCallBack )(); + +/** + * XIMP Framework Eunit tests. + * + * Tests for XIMP group member management services. + * + * @since S60 v4.0 + */ +class T_PresenceGroupMemberManagement : public CEUnitTestSuiteClass + { + +public: + static T_PresenceGroupMemberManagement* NewL(); + virtual ~T_PresenceGroupMemberManagement(); + + +private: + T_PresenceGroupMemberManagement(); + void ConstructL(); + +private: // Test case functions + + void Setup_L(); + void SetupMultiple_L(); + void BindAllL(); + void Teardown(); + + // destroy test case support things, which cannot + // be known in Setup method. + void TeardownTestSupport(); + + void UnbindAllL(); + + void T_SubUnsubGroupContent_Single_L(); + void T_SubUnsubGroupContent_Multi_L(); + void T_SubUnsubGroupContent_One_Multi_L(); + void T_SubUnsubGroupContent_All_Multi_L(); + void T_SubUnsubGroupContent_Altered_Single_L(); + void T_SubUnsubGroupContent_AlteredSame_Single_L(); + void T_UnsubscribeNonSubscribed_L(); + void T_AddGroupMembers_Single_L(); + void T_RemoveGroupMembers_Single_L(); + void T_RemoveGroupMembers_NonSub_Single_L(); + void T_RemoveGroupMembers_NonExist_Single_L(); + void T_UpdateGroupMembers_Single_L(); + void T_UpdateGroupMembers_NonSub_Single_L(); + void T_UpdateGroupMembers_NonExist_Single_L(); + void T_ExpireNonSubscribedData_L(); + void T_ExpireNonSubscribedDataUpdateMultiple_L(); + + // variable test method support + void T_GenericSubAndUnsubL( TXIMPCallBack& aCbFuncL ); + + void T_EmptyFunc(); + void T_TestAddMembersL(); + void T_TestAddMembers_NonSub_L(); + void T_TestRemoveMembersL(); + void T_TestRemoveMembers_NonSub_L(); + void T_TestRemoveMembers_NonExisting_L(); + void T_TestUpdateMembers_L(); + void T_TestUpdateMembers_NonSub_L(); + void T_TestUpdateMembers_NonExisting_L(); + +private: // Test helpers + + void SetupListenerReqCompleteL( CXIMPTestContextWrapper* aWrapper, TXIMPTestStatusEventTemplate aEventType ); + void SetupListenerReqCompleteAllowEventsL( CXIMPTestContextWrapper* aWrapper, TXIMPTestStatusEventTemplate aEventTypes ); + + // sometimes EUnit might eat e.g. an Access violation. + // Call this method in the test case to break when it happens, + // hopefully you will find the cause. + void UseMyOwnExceptionHandler(); + +private: // Test data + + /** + * Eunit test case table declaration. + */ + EUNIT_DECLARE_TEST_TABLE; + + // owned + CXIMPTestContextWrapperMgr* iWrapperMgr; + + CActiveSchedulerWait* iASWait; + + // current group id + // owned. + MXIMPIdentity* iCurrentGrId; + + /** + * Last received group content event. + * Owned. + */ + CPresentityGroupContentEventImp* iLastEvent; + + CXIMPTestListener* iListener2; + + // ETrue, if you want to skip group content subscription in generic + // sub and unsub + TBool iSkipSubscribe; + + // EFalse, if you want to skip group content unsubscription + TBool iSkipUnsubscribe; + }; + + +#endif // T_PRESENCEGROUPMEMBERMANAGEMENT_H + + + +// end of file + + + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencegroupmembermngt/t_presencegroupmembermngt.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencegroupmembermngt/t_presencegroupmembermngt.mmp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,56 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "../../tsrcutils/eunitcommon/eunittstdllbase.hrh" +#include "../../tsrcutils/processmaster/pm.h" + +TARGET t_presencegroupmembermngt.dll +CAPABILITY ALL -TCB +SOURCEPATH . +SOURCE t_presencegroupmembermngt.cpp + + +USERINCLUDE ../../../../../ximpfw/core/srcdatamodel +USERINCLUDE ../../../../../ximpfw/presence/srcpresencedatamodel +USERINCLUDE ../../../../../ximpfw/presence/srcpresencedatamodel/presentitygroups +USERINCLUDE ../../../../../ximpfw/presence/srcpresencedatamodel/presencewatching +USERINCLUDE ../../../../../ximpfw/presence/srcpresencedatamodel/presenceauthorization +USERINCLUDE ../../../../../ximpfw/presence/srcpresencedatamodel/presencepublishing +USERINCLUDE ../../../../../ximpfw/presence/srcpresencedatamodel/presenceinfo +USERINCLUDE ../../../../../ximpfw/core/srcutils + +// TODO remove unnecessary +SYSTEMINCLUDE ../../../../../ximpfw/inc/core/base +SYSTEMINCLUDE ../../../../../ximpfw/inc/core/datamodel +SYSTEMINCLUDE ../../../../../ximpfw/inc/core/protocolplugin +SYSTEMINCLUDE ../../../../../ximpfw/inc/core/protocolpluginhost +SYSTEMINCLUDE ../../../../../ximpfw/inc/presence/presencedatamodel +SYSTEMINCLUDE ../../../../../ximpfw/inc/presence/presencemanagement +SYSTEMINCLUDE ../../../../../ximpfw/inc/presence/presenceprotocolplugin +SYSTEMINCLUDE ../../../../../ximpfw/inc/presence/presenceprotocolpluginhost + +LIBRARY ecom.lib +LIBRARY bafl.lib +LIBRARY ximpdatamodel.lib +LIBRARY presencedatamodel.lib +LIBRARY ximputils.lib +LIBRARY estor.lib +LIBRARY EUnit.lib + +// end of file + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencepublishing/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencepublishing/bld.inf Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,26 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Build information file for t_presencemng.dll +* +*/ + + +PRJ_PLATFORMS +DEFAULT + +PRJ_TESTMMPFILES +t_presencepublishing.mmp + +PRJ_TESTMMPFILES +///epoc32/RELEASE/winscw/UDEB/t_presencepublishing.dll /epoc32/RELEASE/winscw/UDEB/z/sys/bin/t_presencepublishing.dll diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencepublishing/t_presencepublishing.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencepublishing/t_presencepublishing.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,1211 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +#include "eunittools.h" + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "t_presencepublishing.h" + +#include "prfwtestmessaging.h" +#include "prfwtestmessenger.h" +#include "prfwtestcontextwrappermgr.h" +#include "prfwtestcontextwrapper.h" + +#include "prfwtestpresencedatautils.h" + +#include "ximprequestcompleteeventimp.h" +#include "ximpcontextstateeventimp.h" +#include "ximpcontextstateimp.h" +#include "ximpstatusimp.h" +#include "ownpresenceeventimp.h" + +// new test stuff +#include "prfwtestlistener.h" +#include "prfwtestfilesrvmsg.h" +#include "prfwtestfiletool.h" + + +#include "prfwtestrobustnesstools.h" + +_LIT8( KPrefix1, "PreA_" ); +_LIT8( KPrefix2, "PreB_" ); +_LIT8( KPrefix3, "PreC_" ); +_LIT8( KPrefix4, "PreD_" ); + +_LIT8( KServiceType, "test_service" ); +_LIT( KStatusMsg, "This is my status." ); + +const TInt KTestAvailability = 1; + +// ============================ MEMBER FUNCTIONS =============================== + +// CONSTRUCTION +T_PresencePublishing* T_PresencePublishing::NewL() + { + T_PresencePublishing* self = new( ELeave ) T_PresencePublishing; + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + + return self; + } + + +T_PresencePublishing::~T_PresencePublishing() + { + } + + +void T_PresencePublishing::ConstructL() + { + CEUnitTestSuiteClass::ConstructL(); + } + + +T_PresencePublishing::T_PresencePublishing() + { + } + + + +// =========================================================================== +// TEST CASE SETUP & TEARDOWN METHODS +// =========================================================================== +// + +void T_PresencePublishing::Setup_L() + { + PrfwTestRobustness::DoPreCleaning(); + + iWrapperMgr = CXIMPTestContextWrapperMgr::NewL(); + iWrapperMgr->CreateWrapperL(); + } + +void T_PresencePublishing::SetupMultiple_L() + { + PrfwTestRobustness::DoPreCleaning(); + + iWrapperMgr = CXIMPTestContextWrapperMgr::NewL(); + iWrapperMgr->CreateWrapperL(); + iWrapperMgr->CreateWrapperL(); + iWrapperMgr->CreateWrapperL(); + } + + +void T_PresencePublishing::BindL() + { + CXIMPTestContextWrapper* wrapper0 = iWrapperMgr->GetWrapperL( 0 ); + + wrapper0->BindL( 0 ); + } + +void T_PresencePublishing::Bind2L() + { + CXIMPTestContextWrapper* wrapper0 = iWrapperMgr->GetWrapperL( 0 ); + wrapper0->BindWithSettingsL( 0 ); + } + +void T_PresencePublishing::BindAllL() + { + for( TInt a = 0; a < iWrapperMgr->WrapperCount(); ++a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + wrapper->BindL( 0 ); + } + } + + +void T_PresencePublishing::Teardown() + { + delete iWrapperMgr; + iWrapperMgr = NULL; + + REComSession::FinalClose(); + + PrfwTestRobustness::DoPreCleaning(); + } + +void T_PresencePublishing::UnbindL() + { + // Do unbind + CXIMPTestContextWrapper* wrapper0 = iWrapperMgr->GetWrapperL( 0 ); + wrapper0->UnbindL(); + } + +void T_PresencePublishing::UnbindAllL() + { + for( TInt a = 0; a < iWrapperMgr->WrapperCount(); ++a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + wrapper->UnbindL(); + } + } + + +// =========================================================================== +// TEST CASES for presence publish +// =========================================================================== +void T_PresencePublishing::T_Publish_Single_L() + { + EUNIT_PRINT( _L("Single Presence Publish test") ); + + BindL(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresencePublishing& presPub = presFeat->PresencePublishing(); + + // Generate a doc + CPresenceInfoImp* presInfo = + XIMPTestPresenceDataUtils::GenerateInfoLC( &KPrefix1 ); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // Publish the presence + TXIMPRequestId reqId = presPub.PublishOwnPresenceL( *presInfo ); + + // Setup status event listener + CXIMPRequestCompleteEventImp* evReqComplete = + CXIMPRequestCompleteEventImp::NewLC( reqId ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + // Wait for events on the request + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Publishing presence failed" ); + + + COMMONASSERT( messenger, EXIMPPlgTestPublishPresenceCalled, "PublishPresenceL was not called", ETrue, NULL ); + + CleanupStack::PopAndDestroy( presInfo ); + CleanupStack::PopAndDestroy( listener2 ); + UnbindL(); + } + +void T_PresencePublishing::T_NetworkUnplugError_L() + { + EUNIT_PRINT( _L("Error from plug-in in publish own presence") ); + + // Creating the error which comes from KErrTimedOut and protocol sends Connection terminated. + +// BIND AND SETUP + + Bind2L(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresencePublishing& presPub = presFeat->PresencePublishing(); + + +// PUBLISH OWN + + //messenger->SetLeave( KErrAbort ); + messenger->SetError(KErrTimedOut); + + // publish own presence in here + MPresenceInfo* info = CreateInfoLC(); + + TXIMPRequestId reqId = presPub.PublishOwnPresenceL( *info ); + + + // Setup status event listener for RequestComplete + listener2->Reset(); + // request complete with KErrAbort + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqId ); + evReqComplete->CompletionResultImp().SetResultCode( KErrTimedOut ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + CXIMPContextStateEventImp* evContextEvent = CXIMPContextStateEventImp::NewLC(); + evContextEvent->ContextStateImp().SetStateValue( MXIMPContextState::EUnbinding); + listener2->ExpectL( evContextEvent ); + CleanupStack::Pop( evContextEvent ); + + CXIMPContextStateEventImp* evContextEvent2 = CXIMPContextStateEventImp::NewLC(); + evContextEvent2->ContextStateImp().SetStateValue( MXIMPContextState::EInactive); + listener2->ExpectL( evContextEvent2 ); + CleanupStack::Pop( evContextEvent2 ); + + listener2->WaitAndAssertL(); + +// UNBIND + + CleanupStack::PopAndDestroy(1);//info + CleanupStack::PopAndDestroy( listener2 ); + + messenger->SetError( KErrNone ); + + UnbindL(); + } + + +void T_PresencePublishing::T_NetworkUnplugErrorMultiple_L() + { + EUNIT_PRINT( _L("Network disconnect from plug-in in publish own presence, multiple contexts") ); + + // Bind 2 contexts + BindAllL(); + + /* + * Make the 1st client publish someting and then the disconnect would happen + */ + CXIMPTestContextWrapper* wrapper0 = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context0 = wrapper0->GetContext(); + CXIMPTestMessenger* messenger0 = wrapper0->GetMessenger(); + + + CXIMPTestListener* listener0 = CXIMPTestListener::NewL( context0); + CleanupStack::PushL( listener0); + + MPresenceFeatures* presFeat0 = wrapper0->GetPresenceFeatures(); + MPresencePublishing& presPub0 = presFeat0->PresencePublishing(); + + //messenger->SetLeave( KErrAbort ); + messenger0->SetError(KErrTimedOut); + + + // publish own presence in here + MPresenceInfo* info = CreateInfoLC(); + TXIMPRequestId reqId = presPub0.PublishOwnPresenceL( *info ); + + /* Setup status event listener for RequestComplete for client 1 */ + listener0->Reset(); + // request complete with KErrTimedOut + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqId ); + evReqComplete->CompletionResultImp().SetResultCode( KErrTimedOut ); + listener0->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + // Create the context state events for unbinding + CXIMPContextStateEventImp* evContextEvent = CXIMPContextStateEventImp::NewLC(); + evContextEvent->ContextStateImp().SetStateValue( MXIMPContextState::EUnbinding); + listener0->ExpectL( evContextEvent ); + CleanupStack::Pop( evContextEvent ); + + CXIMPContextStateEventImp* evContextEvent2 = CXIMPContextStateEventImp::NewLC(); + evContextEvent2->ContextStateImp().SetStateValue( MXIMPContextState::EInactive); + listener0->ExpectL( evContextEvent2 ); + CleanupStack::Pop( evContextEvent2 ); + + + + /* + * Create a request for client 2, this will not be processed by the protocol plug-in + */ + CXIMPTestContextWrapper* wrapper1 = iWrapperMgr->GetWrapperL( 1 ); + MXIMPContext* context1 = wrapper1->GetContext(); + + MPresenceFeatures* presFeat1 = wrapper1->GetPresenceFeatures(); + MPresencePublishing& presPub1 = presFeat1->PresencePublishing(); + + + // Create the empty presence info filter + CPresenceInfoFilterImp* pif = CPresenceInfoFilterImp::NewLC(); + TXIMPRequestId reqId1 = presPub1.SubscribeOwnPresenceL( *pif ); + CleanupStack::PopAndDestroy(pif); + + // Setup status event listener for RequestComplete + CXIMPTestListener* listener1 = CXIMPTestListener::NewL( context1); + CleanupStack::PushL( listener1); + listener1->Reset(); + // normal request complete + CXIMPRequestCompleteEventImp* evReqComplete1 = CXIMPRequestCompleteEventImp::NewLC( reqId1 ); + evReqComplete1->CompletionResultImp().SetResultCode( KErrTimedOut ); + listener1->ExpectL( evReqComplete1 ); + CleanupStack::Pop( evReqComplete1 ); + + // Create the context state events for unbinding + evContextEvent = CXIMPContextStateEventImp::NewLC(); + evContextEvent->ContextStateImp().SetStateValue( MXIMPContextState::EUnbinding); + listener1->ExpectL( evContextEvent ); + CleanupStack::Pop( evContextEvent ); + + evContextEvent2 = CXIMPContextStateEventImp::NewLC(); + evContextEvent2->ContextStateImp().SetStateValue( MXIMPContextState::EInactive); + listener1->ExpectL( evContextEvent2 ); + CleanupStack::Pop( evContextEvent2 ); + + + // Wait for events on the request + + EUNIT_ASSERT_DESC( KErrNone == listener0->WaitAndAssertL(), "Publish own presence failed in client 1"); + + EUNIT_ASSERT_DESC( KErrNone == listener1->WaitAndAssertL(), "SubscribeOwnPresence failed in client 2" ); + + CleanupStack::PopAndDestroy( listener1 ); + CleanupStack::PopAndDestroy(1);//info + CleanupStack::PopAndDestroy( listener0 ); + + // Finish the test case + UnbindAllL(); + } + +void T_PresencePublishing::T_Publish_ErrFromPlg_Leave_L() + { + EUNIT_PRINT( _L("Single Presence Publish test") ); + EUNIT_PRINT( _L("Plugin leaves from PublishOwnPresenceL") ); + + BindL(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresencePublishing& presPub = presFeat->PresencePublishing(); + + // Generate a doc + CPresenceInfoImp* presDoc = + XIMPTestPresenceDataUtils::GenerateInfoLC( &KPrefix1 ); + + // Setup status event listener + SetupListenerReqCompleteL( wrapper, EXIMPTestStatusEvents_RequestOk ); + + // Tell the test protocol to leave on next operation + messenger->SetLeave( KErrAbort ); + + // Publish the presence + TXIMPRequestId reqId = presPub.PublishOwnPresenceL( *presDoc ); + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Publishing single presence, leave with error: ") ); + + // Verify that plugin left and didn't go through the PublishOwnPresenceL. + COMMONASSERT( messenger, EXIMPPlgTestPublishPresenceCalled, "PublishPresenceL was not called", + EFalse, "PublishPresenceL was called." ); + + + // TODO wait and verify the events + EUNIT_FAIL_TEST( "Under construction." ); + + CleanupStack::PopAndDestroy( presDoc ); + CleanupStack::PopAndDestroy( listener2 ); + UnbindL(); + } + +void T_PresencePublishing::T_Publish_ErrFromPlg_CompleteWithError_L() + { + EUNIT_PRINT( _L("Single Presence Publish test") ); + EUNIT_PRINT( _L("Plugin completes PublishOwnPresenceL with error") ); + + BindL(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresencePublishing& presPub = presFeat->PresencePublishing(); + + // Generate a doc + CPresenceInfoImp* presDoc = + XIMPTestPresenceDataUtils::GenerateInfoLC( &KPrefix1 ); + + // Setup status event listener: + //TODO Setup presence event listener + SetupListenerReqCompleteL( wrapper, EXIMPTestStatusEvents_RequestOk ); + + // Tell the test protocol to return with error on next operation + messenger->SetError( KErrAbort ); + + // Publish the presence + TXIMPRequestId reqId = presPub.PublishOwnPresenceL( *presDoc ); + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Publishing single presence, complete with error: ") ); + + // Verify that we did go through PublishOwnPresenceL. + COMMONASSERT( messenger, EXIMPPlgTestPublishPresenceCalled, "PublishPresenceL was not called", ETrue, NULL ); + + // TODO wait and verify presence events + EUNIT_FAIL_TEST( "Under construction." ); + + CleanupStack::PopAndDestroy( presDoc ); + CleanupStack::PopAndDestroy( listener2 ); + + UnbindL(); + } + + +// =========================================================================== +// TEST CASES for presence interest registration +// =========================================================================== + +// Single client, empty filter +void T_PresencePublishing::T_SubscribeOwnPresence_Single_Empty_L() + { + EUNIT_PRINT( _L("Single interest registration") ); + + BindL(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresencePublishing& presPub = presFeat->PresencePublishing(); + + // Create the empty presence info filter + CPresenceInfoFilterImp* pif = CPresenceInfoFilterImp::NewLC(); + + // Setup status event listener for RequestComplete + listener2->Reset(); + // normal request complete + TXIMPRequestId reqIdDummy; // not checked + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + // subscribe own presence + TXIMPRequestId reqId = presPub.SubscribeOwnPresenceL( *pif ); + + // Wait for events on the request + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "SubscribeOwnPresence failed" ); + + // verify that SubscribeOwnPresenceL was called + COMMONASSERT( messenger, EXIMPPlgTestSubscribeOwnPresenceCalled, "SubscribeOwnPresenceL was not called", ETrue, NULL ); + + // Setup status event listener for RequestComplete + listener2->Reset(); + evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + // unsubscribe own presence + reqId = presPub.UnsubscribeOwnPresenceL(); + + // Wait for events on the request + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "UnsubscribeOwnPresence failed" ); + + // verify that UnsubscribeOwnPresenceL was called + COMMONASSERT( messenger, EXIMPPlgTestUnsubscribeOwnPresenceCalled, "UnsubscribeOwnPresenceL was not called", ETrue, NULL ); + + CleanupStack::PopAndDestroy( pif ); + CleanupStack::PopAndDestroy( listener2 ); + UnbindL(); + } + +// Single client, empty filter +void T_PresencePublishing::T_SubscribeOwnPresence_Multiple_Empty_L() + { + EUNIT_PRINT( _L("Multiple client filter registration") ); + + BindAllL(); + + // Create the empty presence info filter + CPresenceInfoFilterImp* pif = CPresenceInfoFilterImp::NewLC(); + + TInt countOfWrappers = iWrapperMgr->WrapperCount(); + + CXIMPTestListener* listeners[ 50 ]; + TXIMPRequestId reqIdDummy; // not checked + + + +// Setup listeners + for( TInt a = 0; a < countOfWrappers; a++ ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + MXIMPContext* context = wrapper->GetContext(); + listeners[ a ] = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listeners[ a ] ); + } + + +// SUBSCRIBE + for( TInt a = countOfWrappers - 1; a > 0 ; --a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresencePublishing& presPub = presFeat->PresencePublishing(); + + // Setup status event listener for RequestComplete + listeners[ a ]->Reset(); + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listeners[ a ]->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + messenger->SetValueFor( EXIMPPlgTestSubscribeOwnPresenceCalled, 0 ); + // subscribe own presence + TXIMPRequestId reqId = presPub.SubscribeOwnPresenceL( *pif ); + + // Wait for events on the request + EUNIT_ASSERT_DESC( KErrNone == listeners[ a ]->WaitAndAssertL(), "SubscribeOwnPresence failed" ); + + // verify that SubscribeOwnPresenceL was called + COMMONASSERT( messenger, EXIMPPlgTestSubscribeOwnPresenceCalled, "SubscribeOwnPresenceL was not called", + ( a > 1 ) ? ETrue : EFalse , "SubscribeOwnPresenceL was called." ); + } + +// REFRESH + + for( TInt a = countOfWrappers - 1; a > 0 ; --a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresencePublishing& presPub = presFeat->PresencePublishing(); + + // Setup status event listener for RequestComplete + listeners[ a ]->Reset(); + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listeners[ a ]->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + CXIMPDataSubscriptionStateImp* stateImp = CXIMPDataSubscriptionStateImp::NewLC(); + stateImp->SetDataStateL( MXIMPDataSubscriptionState::EDataUnavailable ); + stateImp->SetSubscriptionStateL( MXIMPDataSubscriptionState::ESubscriptionActive ); + COwnPresenceEventImp* evOwnPresence = COwnPresenceEventImp::NewLC( stateImp ); + CleanupStack::Pop( 2, stateImp ); + CleanupStack::PushL( evOwnPresence ); + listeners[ a ]->ExpectL( evOwnPresence ); + CleanupStack::Pop( evOwnPresence ); + + // TODO check if this call is still needed + messenger->SetValueFor( EXIMPPlgTestSubscribeOwnPresenceCalled, 0 ); + + // subscribe own presence + TXIMPRequestId reqId = presPub.SubscribeOwnPresenceL( *pif ); + + // Wait for events on the request + EUNIT_ASSERT_DESC( KErrNone == listeners[ a ]->WaitAndAssertL(), "SubscribeOwnPresence failed" ); + + // verify that SubscribeOwnPresenceL was called + COMMONASSERT( messenger, EXIMPPlgTestSubscribeOwnPresenceCalled, + "SubscribeOwnPresenceL was not called", + EFalse , "SubscribeOwnPresenceL was called." ); + } + + +// UNSUBSCRIBE + + for( TInt a = 0; a < countOfWrappers; ++a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresencePublishing& presPub = presFeat->PresencePublishing(); + + // Setup status event listener for RequestComplete + listeners[ a ]->Reset(); + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listeners[ a ]->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + + // register interest + TXIMPRequestId reqId = presPub.UnsubscribeOwnPresenceL(); + + // Wait for events on the request + EUNIT_ASSERT_DESC( KErrNone == listeners[ a ]->WaitAndAssertL(), "UnsubscribeOwnPresence failed" ); + + + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestUnsubscribeOwnPresenceCalled, + "UnsubscribeOwnPresenceL was not called", + ( a < 2 ) ? EFalse : ETrue, + "UnsubscribeOwnPresenceL was called" ); + } + + + // delete the listeners + CleanupStack::PopAndDestroy( countOfWrappers ); // the contents of listeners[] + + CleanupStack::PopAndDestroy( pif ); + + UnbindAllL(); + } + + +// Single client, filled filter +void T_PresencePublishing::T_SubscribeOwnPresence_Single_L() + { + EUNIT_PRINT( _L("Single interest registration") ); + + BindL(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresencePublishing& presPub = presFeat->PresencePublishing(); + + // Create the filled interest document + CPresenceInfoFilterImp* pif = + XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 ); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + +// SUBSCRIBE + + // subscribe own presence + TXIMPRequestId reqId = presPub.SubscribeOwnPresenceL( *pif ); + + // Setup status event listener for RequestComplete + listener2->Reset(); + SetupListenerReqCompleteL( wrapper, EXIMPTestStatusEvents_RequestOk ); + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqId ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + // Wait for events on the request + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "SubscribeOwnPresence failed" ); + + // verify that SubscribeOwnPresenceL was called + COMMONASSERT( messenger, EXIMPPlgTestSubscribeOwnPresenceCalled, "SubscribeOwnPresenceL was not called", ETrue, NULL ); + +// REFRESH + + // subscribe own presence (refresh) + reqId = presPub.SubscribeOwnPresenceL( *pif ); + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteL( wrapper, EXIMPTestStatusEvents_RequestOk ); + messenger->SetValueFor( EXIMPPlgTestSubscribeOwnPresenceCalled, 0 ); + listener2->Reset(); + evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqId ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + // also the event + + CXIMPDataSubscriptionStateImp* stateImp = CXIMPDataSubscriptionStateImp::NewLC(); + stateImp->SetDataStateL( MXIMPDataSubscriptionState::EDataUnavailable ); + stateImp->SetSubscriptionStateL( MXIMPDataSubscriptionState::ESubscriptionActive ); + COwnPresenceEventImp* event = COwnPresenceEventImp::NewLC( stateImp ); + CleanupStack::Pop( 2, stateImp ); + CleanupStack::PushL( event ); + listener2->ExpectL( event ); + CleanupStack::Pop( event ); + + // Wait for events on the request + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Refreshing own presence subscription failed" ); + + // verify that SubscribeOwnPresenceL was called + COMMONASSERT( messenger, EXIMPPlgTestSubscribeOwnPresenceCalled, "SubscribeOwnPresenceL was not called", EFalse, "SubscribeOwnPresenceL was called" ); + + CleanupStack::PopAndDestroy( pif ); + CleanupStack::PopAndDestroy( listener2 ); + UnbindL(); + } + +void T_PresencePublishing::T_ErrFromPlg_LeaveOnSubscribeOwnPresence_L() + { + EUNIT_PRINT( _L("Error from plug-in in presentity presence subscribe") ); + EUNIT_PRINT( _L("Plug-in leaves from SubscribePresence().") ); + +// BIND AND SETUP + + BindL(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresencePublishing& presPub = presFeat->PresencePublishing(); + + // Create the filled interest document + CPresenceInfoFilterImp* pif = + XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 ); + +// SUBSCRIBE + + messenger->SetLeave( KErrAbort ); + + // subscribe own presence + TXIMPRequestId reqId = presPub.SubscribeOwnPresenceL( *pif ); + + // Setup status event listener for RequestComplete + listener2->Reset(); + // request complete with KErrAbort + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqId ); + evReqComplete->CompletionResultImp().SetResultCode( KErrAbort ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + // Wait for events on the request + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Subscribing presentity presence, didn't complete with error" ); + + // verify that SubscribeOwnPresenceL was called + COMMONASSERT( messenger, EXIMPPlgTestSubscribeOwnPresenceCalled, "SubscribeOwnPresenceL was not called", EFalse, "SubscribeOwnPresenceL was called" ); + + +// SUBSCRIBE + + messenger->SetLeave( KErrNone ); + + // subscribe own presence + reqId = presPub.SubscribeOwnPresenceL( *pif ); + + // Setup status event listener for RequestComplete + listener2->Reset(); + evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqId ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + // Wait for events on the request + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Subscribing presentity presence failed" ); + + // verify that SubscribeOwnPresenceL was called + COMMONASSERT( messenger, EXIMPPlgTestSubscribeOwnPresenceCalled, "SubscribeOwnPresenceL was not called", ETrue, "SubscribeOwnPresenceL was called" ); + + +// UNSUBSCRIBE + + messenger->SetLeave( KErrAbort ); + + // register interest + reqId = presPub.UnsubscribeOwnPresenceL(); + + // Setup status event listener for RequestComplete + listener2->Reset(); + evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqId ); + evReqComplete->CompletionResultImp().SetResultCode( KErrAbort ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + // Wait for events on the request + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Unsubscribing presentity presence with error failed" ); + + // verify that UnsubscribeOwnPresenceL was called + COMMONASSERT( messenger, EXIMPPlgTestUnsubscribeOwnPresenceCalled, "UnsubscribeOwnPresenceL was not called", EFalse, + "UnsubscribeOwnPresenceL was called." ); + +// UNBIND + + CleanupStack::PopAndDestroy( pif ); + CleanupStack::PopAndDestroy( listener2 ); + + messenger->SetLeave( KErrNone ); + + UnbindL(); + } + +// =========================================================================== +// Single client, filled filter, publish. +// =========================================================================== +// + +void T_PresencePublishing::T_SubscribeOwnPresence_Publish_Single_L() + { + EUNIT_PRINT( _L("Single interest registration with publish") ); + + /* + * TODO: + * + * case 1 + * + * - subscribetä oma presence + * - luo filtteri + * - luo info + * - publishaa oma presence + info + * - tsekkaa että alakerta on saanut infon + * - subscribetä uudelleen (=refresh case) + * - tsekkaa että kaikki ok + * + * case 2 + * + * - sama filtteri kuin edellä + * - feikkaa verkkoserveriltä tuleva viesti, jossa sama info kuin edellä + * - tsekkaa, että frameworkin läpi tuleva info sisältää vain ne kamat + * jotka on sallittu ja että muut on blokattu. ts. "test_service":n + * "availability" pitäisi tulla läpi. person-presenceen tungettu kama jää + * pois + * + */ + + BindL(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresencePublishing& presPub = presFeat->PresencePublishing(); + + // Create the filter + MPresenceInfoFilter* pif = presFeat->PresenceObjectFactory().NewPresenceInfoFilterLC(); + pif->AcceptServiceFilterL( KServiceType, NPresenceInfo::NFieldType::KAvailability ); // "test_service", "availability" + // note, the person info will be filtered out now since we don't accept it. + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // SUBSCRIBE + + // subscribe own presence + TXIMPRequestId reqId = presPub.SubscribeOwnPresenceL( *pif ); + + // Setup status event listener for RequestComplete + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqId ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + // Wait for events on the request + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "SubscribeOwnPresence failed" ); + + // verify that SubscribeOwnPresenceL was called + COMMONASSERT( messenger, EXIMPPlgTestSubscribeOwnPresenceCalled, "SubscribeOwnPresenceL was not called", ETrue, NULL ); + + // publish own presence in here + MPresenceInfo* info = CreateInfoLC(); + + reqId = presPub.PublishOwnPresenceL( *info ); + + // Setup status event listener + evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqId ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + CXIMPDataSubscriptionStateImp* stateImp = CXIMPDataSubscriptionStateImp::NewLC(); + stateImp->SetDataStateL( MXIMPDataSubscriptionState::EDataAvailable ); + stateImp->SetSubscriptionStateL( MXIMPDataSubscriptionState::ESubscriptionActive ); + COwnPresenceEventImp* event = COwnPresenceEventImp::NewLC( stateImp ); + CleanupStack::Pop( 2, stateImp ); + CleanupStack::PushL( event ); + listener2->ExpectL( event ); + CleanupStack::Pop( event ); + + // Wait for events on the request + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Publishing presence failed" ); + COMMONASSERT( messenger, EXIMPPlgTestPublishPresenceCalled, "PublishPresenceL was not called", ETrue, NULL ); + + // REFRESH + + // subscribe own presence (refresh) + reqId = presPub.SubscribeOwnPresenceL( *pif ); + + // Setup status event listener for RequestComplete + messenger->SetValueFor( EXIMPPlgTestSubscribeOwnPresenceCalled, 0 ); + evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqId ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + // also the event + + stateImp = CXIMPDataSubscriptionStateImp::NewLC(); + stateImp->SetDataStateL( MXIMPDataSubscriptionState::EDataAvailable ); + stateImp->SetSubscriptionStateL( MXIMPDataSubscriptionState::ESubscriptionActive ); + event = COwnPresenceEventImp::NewLC( stateImp ); + CleanupStack::Pop( 2, stateImp ); + CleanupStack::PushL( event ); + listener2->ExpectL( event ); + CleanupStack::Pop( event ); + + // Wait for events on the request + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Refreshing own presence subscription failed" ); + + // verify that SubscribeOwnPresenceL was called + COMMONASSERT( messenger, EXIMPPlgTestSubscribeOwnPresenceCalled, "SubscribeOwnPresenceL was not called", EFalse, "SubscribeOwnPresenceL was called" ); + + CleanupStack::PopAndDestroy( 3, listener2 ); // info, pif, listener2 + UnbindL(); + } + + +// =========================================================================== +// SETUP HELPERS FOR THE LISTENER +// =========================================================================== +// +void T_PresencePublishing::SetupListenerReqCompleteL( CXIMPTestContextWrapper* aWrapper, TXIMPTestStatusEventTemplate aEventType ) + { + RArray< TInt32 > array; + CleanupClosePushL( array ); + array.Append( MXIMPContextStateEvent::KInterfaceId ); + array.Append( MOwnPresenceEvent::KInterfaceId ); + aWrapper->SetupListenerReqCompleteL( aEventType, &array ); + CleanupStack::PopAndDestroy(); // array + } + +void T_PresencePublishing::SetupListenerReqCompleteAllowEventsL( CXIMPTestContextWrapper* aWrapper, TXIMPTestStatusEventTemplate aEventType ) + { + RArray< TInt32 > array; + CleanupClosePushL( array ); + array.AppendL( MXIMPRequestCompleteEvent::KInterfaceId ); + array.AppendL( MXIMPContextStateEvent::KInterfaceId ); + array.AppendL( MOwnPresenceEvent::KInterfaceId ); + aWrapper->SetupListenerReqCompleteL( aEventType, &array ); + CleanupStack::PopAndDestroy(); // array + } + +MPresenceInfo* T_PresencePublishing::CreateInfoLC() + { + // fill up the info structure with: + // service info imp: + // - info name: "test_service" + // - field name: availability + // - field value: enum type, value 1 + // person info imp: + // - field name: "status-message" + // - field value: "This is my status message." + // + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + + // Get the interface + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceInfo* info = presFeat->PresenceObjectFactory().NewPresenceInfoLC(); + + // fill service info + MServicePresenceInfo* srvInfo = presFeat->PresenceObjectFactory().NewServicePresenceInfoLC(); + srvInfo->SetServiceTypeL( KServiceType ); // test + + MPresenceInfoField* infoField = presFeat->PresenceObjectFactory().NewInfoFieldLC(); + + MPresenceInfoFieldValueEnum* enumField = presFeat->PresenceObjectFactory().NewEnumInfoFieldLC(); + enumField->SetValueL( KTestAvailability ); // 1 + infoField->SetFieldTypeL( NPresenceInfo::NFieldType::KAvailability ); // "availability" + infoField->SetFieldValue( enumField ); + CleanupStack::Pop(); // enumField + + srvInfo->Fields().AddOrReplaceFieldL( infoField ); + CleanupStack::Pop(); // infoField + + info->AddServicePresenceL( srvInfo ); + CleanupStack::Pop(); // srvInfo + + // fill person info + MPersonPresenceInfo* persInfo = presFeat->PresenceObjectFactory().NewPersonPresenceInfoLC(); + MPresenceInfoField* infoField2 = presFeat->PresenceObjectFactory().NewInfoFieldLC(); + + MPresenceInfoFieldValueText* textField = presFeat->PresenceObjectFactory().NewTextInfoFieldLC(); + textField->SetTextValueL( KStatusMsg ); + + infoField2->SetFieldTypeL( NPresenceInfo::NFieldType::KStatusMessage ); + infoField2->SetFieldValue( textField ); + CleanupStack::Pop(); // textField + + persInfo->Fields().AddOrReplaceFieldL( infoField2 ); + CleanupStack::Pop(); // infoField2 + + info->SetPersonPresenceL( persInfo ); + CleanupStack::Pop(); // persInfo + // that's it + + return info; + } + +// =========================================================================== +// TEST CASE TABLE +// =========================================================================== +// +EUNIT_BEGIN_TEST_TABLE( + T_PresencePublishing, + "XIMP presence management tests", + "MODULE" ) + + +PRFW_DECORATED_TEST( + "Publish single presence", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_Publish_Single_L, + Teardown ) + +/* +PRFW_NOT_DECORATED_TEST( + "Publish, error leave", + "", + "", + "ERRORHANDLING", + Setup_Bind_L, + T_Publish_ErrFromPlg_Leave_L, + Teardown_Unbind ) + +PRFW_NOT_DECORATED_TEST( + "Publish, error complete", + "", + "", + "ERRORHANDLING", + Setup_Bind_L, + T_Publish_ErrFromPlg_CompleteWithError_L, + Teardown_Unbind ) +*/ + +PRFW_DECORATED_TEST( + "Empty own presence subscribtion", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_SubscribeOwnPresence_Single_Empty_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Empty own presence subscribtion for multiple clients", + "", + "", + "FUNCTIONALITY", + SetupMultiple_L, + T_SubscribeOwnPresence_Multiple_Empty_L, + Teardown ) + + +PRFW_DECORATED_TEST( + "Single own presence subscribtion", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_SubscribeOwnPresence_Single_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Single own presence subscribtion with publish", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_SubscribeOwnPresence_Publish_Single_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Error - Fail subscription", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_ErrFromPlg_LeaveOnSubscribeOwnPresence_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Error - Network UnplugError", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_NetworkUnplugError_L, + Teardown ) + +/* +PRFW_DECORATED_TEST( + "Error - Network UnplugError", + "", + "", + "FUNCTIONALITY", + SetupMultiple_L, + T_NetworkUnplugErrorMultiple_L, + Teardown ) +*/ + +EUNIT_END_TEST_TABLE + + +// =========================================================================== +// TEST SUITE CONSTRUCTION +// =========================================================================== +// +EXPORT_C MEUnitTest* CreateTestSuiteL() + { + return T_PresencePublishing::NewL(); + } + + +// end of file + + + + + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencepublishing/t_presencepublishing.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencepublishing/t_presencepublishing.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,131 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef T_PRESENCEPUBLISHING_H +#define T_PRESENCEPUBLISHING_H + +#include +#include +#include "prfwteststatuseventlistener.h" +#include "prfwtestmessaging.h" + +class CXIMPTestContextWrapper; +class CXIMPTestContextWrapperMgr; +class CXIMPTestMessenger; + +/** + * XIMP Framework Eunit tests. + * + * Tests for XIMP session management services. + * + * @since S60 v4.0 + */ +class T_PresencePublishing : public CEUnitTestSuiteClass + { + +public: + static T_PresencePublishing* NewL(); + virtual ~T_PresencePublishing(); + + +private: + T_PresencePublishing(); + void ConstructL(); + + + +private: // Test case functions + + void Setup_L(); + void SetupMultiple_L(); + void BindL(); + void Bind2L(); + void BindAllL(); + void Teardown(); + void UnbindL(); + void UnbindAllL(); + + + //------------------------------------------ + //Presence Publish + // + void T_Publish_Single_L(); + + // Maybe unneeded cases. All events should act likewise and these + // kind of situations are tested in t_sessionmng already. + void T_Publish_ErrFromPlg_Leave_L(); + void T_Publish_ErrFromPlg_CompleteWithError_L(); + + + //------------------------------------------ + //Presence interest registration + // + void T_SubscribeOwnPresence_Single_Empty_L(); + void T_SubscribeOwnPresence_Multiple_Empty_L(); + void T_SubscribeOwnPresence_Single_L(); + void T_SubscribeOwnPresence_Publish_Single_L(); + void T_SubscribeOwnPresence_Two_Clients_L(); + void T_ErrFromPlg_LeaveOnSubscribeOwnPresence_L(); + void T_NetworkUnplugError_L(); + void T_NetworkUnplugErrorMultiple_L(); + + // Plugin leaves with error, returns error. Same as above. + //void T_InterestRegistration_ErrorFromPlg_Leave_L(); + //void T_InterestRegistration_ErrorFromPlg_Error_L(); + + //------------------------------------------ + // Input data verification tests + // TODO when the mechanism for + // + // Verify that plugin receives correct input data + // - single publish + // - single registration + // - aggregated registrations + // Verify that the test case received correct data (verify plugin output data) + // - own presence event + // - UpdatePresenceL / presentity event + // - filter registration verifications on presentity events + +private: // Test helpers + + void SetupListenerReqCompleteL( CXIMPTestContextWrapper* aWrapper, TXIMPTestStatusEventTemplate aEventType ); + void SetupListenerReqCompleteAllowEventsL( CXIMPTestContextWrapper* aWrapper, TXIMPTestStatusEventTemplate aEventTypes ); + // TODO move these to some TOOL part - could be common + // among all components + + MPresenceInfo* CreateInfoLC(); + +private: // Test data + + /** + * Eunit test case table declaration. + */ + EUNIT_DECLARE_TEST_TABLE; + + // owned + CXIMPTestContextWrapperMgr* iWrapperMgr; + }; + +#endif // T_PRESENCEPUBLISHING_H + + + +// end of file + + + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencepublishing/t_presencepublishing.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencepublishing/t_presencepublishing.mmp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,53 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "../../tsrcutils/eunitcommon/eunittstdllbase.hrh" +#include "../../tsrcutils/processmaster/pm.h" + +TARGET t_presencepublishing.dll +CAPABILITY ALL -TCB +SOURCEPATH . +SOURCE t_presencepublishing.cpp + + +USERINCLUDE ../../../../../ximpfw/core/srcdatamodel +USERINCLUDE ../../../../../ximpfw/presence/srcpresencedatamodel +USERINCLUDE ../../../../../ximpfw/presence/srcpresencedatamodel/presentitygroups +USERINCLUDE ../../../../../ximpfw/presence/srcpresencedatamodel/presencewatching +USERINCLUDE ../../../../../ximpfw/presence/srcpresencedatamodel/presenceauthorization +USERINCLUDE ../../../../../ximpfw/presence/srcpresencedatamodel/presencepublishing +USERINCLUDE ../../../../../ximpfw/presence/srcpresencedatamodel/presenceinfo +USERINCLUDE ../../../../../ximpfw/core/srcutils + +// TODO remove unnecessary +SYSTEMINCLUDE ../../../../../ximpfw/inc/core/base +SYSTEMINCLUDE ../../../../../ximpfw/inc/core/datamodel +SYSTEMINCLUDE ../../../../../ximpfw/inc/core/protocolplugin +SYSTEMINCLUDE ../../../../../ximpfw/inc/core/protocolpluginhost +SYSTEMINCLUDE ../../../../../ximpfw/inc/presence/presencedatamodel +SYSTEMINCLUDE ../../../../../ximpfw/inc/presence/presencemanagement +SYSTEMINCLUDE ../../../../../ximpfw/inc/presence/presenceprotocolplugin +SYSTEMINCLUDE ../../../../../ximpfw/inc/presence/presenceprotocolpluginhost + +LIBRARY ecom.lib +LIBRARY bafl.lib +LIBRARY ximpdatamodel.lib +LIBRARY presencedatamodel.lib +LIBRARY EUnit.lib +// end of file + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencewatcherlistmngt/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencewatcherlistmngt/bld.inf Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,23 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Build information file for t_presencewatcherlistmngt.dll +* +*/ + + +PRJ_PLATFORMS +DEFAULT + +PRJ_TESTMMPFILES +t_presencewatcherlistmngt.mmp diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencewatcherlistmngt/t_presencewatcherlistmngt.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencewatcherlistmngt/t_presencewatcherlistmngt.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,1353 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +#include "eunittools.h" + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "prfwtestpresencedatautils.h" + + + +#include "t_presencewatcherlistmngt.h" + +// watcher list related includes +#include "presencewatcherinfoimp.h" +#include "presencewatcherlisteventimp.h" + +// other data model includes +#include "ximpidentityimp.h" +#include "ximpdatasubscriptionstateimp.h" +#include "presentitygroupmemberinfoimp.h" +#include "presenceinfofilterimp.h" + +// utils includes +#include "ximpobjecthelpers.h" + +#include "ximprequestcompleteeventimp.h" + +// testing tool includes +#include "prfwtestmessaging.h" +#include "prfwtestmessenger.h" +#include "prfwtestcontextwrappermgr.h" +#include "prfwtestcontextwrapper.h" +#include "prfwtestwaithelper.h" + +#include "prfwtestfilesrvmsg.h" +#include "prfwtestfiletool.h" +#include "prfwtestlistener.h" + +#include "prfwtestrobustnesstools.h" + + + + + +/*#include "presenceinfoimp.h" +#include "presenceinfofilterimp.h" +#include "prfwtestpresencedatautils.h" +#include "ximpidentityimp.h" +#include "presentitygroupmemberinfoimp.h" +#include "ximpobjecthelpers.h" +#include "prfwtestfilesrvmsg.h" +#include "prfwtestwaithelper.h"*/ + +_LIT8( KPrefix1, "PreA_" ); +_LIT8( KPrefix2, "PreB_" ); +_LIT8( KPrefix3, "PreC_" ); +_LIT8( KPrefix4, "PreD_" ); + +// ============================ MEMBER FUNCTIONS =============================== + +// CONSTRUCTION +T_PresenceWatcherListManagement* T_PresenceWatcherListManagement::NewL() + { + T_PresenceWatcherListManagement* self = new( ELeave ) T_PresenceWatcherListManagement; + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + + return self; + } + + +T_PresenceWatcherListManagement::~T_PresenceWatcherListManagement() + { + } + + +void T_PresenceWatcherListManagement::ConstructL() + { + CEUnitTestSuiteClass::ConstructL(); + } + + +T_PresenceWatcherListManagement::T_PresenceWatcherListManagement() + { + } + + + +// =========================================================================== +// TEST CASE SETUP & TEARDOWN METHODS +// =========================================================================== +// + +void T_PresenceWatcherListManagement::Setup_L() + { + + __UHEAP_MARK; + PrfwTestRobustness::DoPreCleaning(); + + iWrapperMgr = CXIMPTestContextWrapperMgr::NewL(); + iWrapperMgr->CreateWrapperL(); + } + +void T_PresenceWatcherListManagement::SetupMultiple_L() + { + __UHEAP_MARK; + PrfwTestRobustness::DoPreCleaning(); + + iWrapperMgr = CXIMPTestContextWrapperMgr::NewL(); + iWrapperMgr->CreateWrapperL(); + iWrapperMgr->CreateWrapperL(); + iWrapperMgr->CreateWrapperL(); + } + + +void T_PresenceWatcherListManagement::BindL() + { + CXIMPTestContextWrapper* wrapper0 = iWrapperMgr->GetWrapperL( 0 ); + + wrapper0->BindL( 0 ); + } + +void T_PresenceWatcherListManagement::BindAllL() + { + for( TInt a = 0; a < iWrapperMgr->WrapperCount(); ++a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + wrapper->BindL( 0 ); + } + } + + +void T_PresenceWatcherListManagement::Teardown() + { + delete iWrapperMgr; + iWrapperMgr = NULL; + + REComSession::FinalClose(); + + PrfwTestRobustness::DoPreCleaning(); + + __UHEAP_MARKEND; + } + +void T_PresenceWatcherListManagement::UnbindL() + { + // Do unbind + CXIMPTestContextWrapper* wrapper0 = iWrapperMgr->GetWrapperL( 0 ); + wrapper0->UnbindL(); + } + +void T_PresenceWatcherListManagement::UnbindAllL() + { + for( TInt a = 0; a < iWrapperMgr->WrapperCount(); ++a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + wrapper->UnbindL(); + } + } + + +// =========================================================================== +// TEST CASES for presentity presence subscription +// =========================================================================== +// Check that this don't leak memory +void T_PresenceWatcherListManagement::T_BindUnbind_L() + { + BindL(); + UnbindL(); + } +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// Subscribe, unsubscribe - Single client +void T_PresenceWatcherListManagement::T_SubscribePresenceWatcherList_Single_L() + { + + EUNIT_PRINT( _L("Single client presence watcher list subscription") ); + + BindL(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresencePublishing& presPub = presFeat->PresencePublishing(); + + //------------------------------------------------- + // subscribe + + // Setup status event listener for RequestComplete + // --------------------------------------------- + listener2->Reset(); + + // normal request complete + TXIMPRequestId reqIdDummy; // not checked + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + + // Subscribe + TXIMPRequestId reqId = presPub.SubscribePresenceWatcherListL(); + + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Subscribe failed" ); + + // verify that SubscribePresenceWatcherListL was called + COMMONASSERT( messenger, EXIMPPlgTestSubscribePresenceWatcherListCalled, "SubscribePresenceWatcherListL was not called", ETrue, NULL ); + + //------------------------------------------------- + // refresh subscribe + + // Setup status event listener for RequestComplete + listener2->Reset(); + + evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + RPrWatLstInfoImpArray* currentList(NULL); + CPresenceWatcherListEventImp* event = CreateWatcherListEventLCX( + KNullDesC, KNullDesC, + MXIMPDataSubscriptionState::ESubscriptionActive, + MXIMPDataSubscriptionState::EDataUnavailable, + ETestPWlCurrent, currentList); + listener2->ExpectL( event ); + CleanupStack::Pop(); //event 3 to go. + // --------------------------------------------- + + // Subscribe second time + reqId = presPub.SubscribePresenceWatcherListL(); + + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Refresh failed" ); + CleanupStack::PopAndDestroy( 3 ); // rest of the items. + + // verify that SubscribePresenceWatcherListL was called + COMMONASSERT( messenger, EXIMPPlgTestSubscribePresenceWatcherListCalled, "SubscribePresenceWatcherListL was not called", ETrue, NULL ); + + + //------------------------------------------------- + // unsubscribe + + // Setup status event listener for RequestComplete + listener2->Reset(); + + evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + // register interest + reqId = presPub.UnsubscribePresenceWatcherListL(); + + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Unsubscribe failed" ); + + // verify that UnsubscribePresenceWatcherListL was called + COMMONASSERT( messenger, EXIMPPlgTestUnsubscribePresenceWatcherListCalled, "UnsubscribePresenceWatcherListL was not called", ETrue, NULL ); + + //------------------------------------------------- + // unsubscribe nonsubscribed + + // Setup status event listener for RequestComplete + listener2->Reset(); + + evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + // register interest + reqId = presPub.UnsubscribePresenceWatcherListL(); + + // Wait for events on the request + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Unsubscribe failed" ); + + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestUnsubscribePresenceWatcherListCalled, "UnsubscribePresenceWatcherListL was not called", ETrue, NULL ); + + + + listener2->SetEventSourceL( NULL ); + + UnbindL(); + + CleanupStack::PopAndDestroy( listener2 ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// Subscribe, Unsubscribe - Multiple clients +void T_PresenceWatcherListManagement::T_SubscribePresenceWatcherList_Multiple_L() + { + EUNIT_PRINT( _L("Multiple client presence watcher list subscription") ); + + BindAllL(); + + TInt countOfWrappers = iWrapperMgr->WrapperCount(); + for( TInt a = 0; a < countOfWrappers; ++a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresencePublishing& presPub = presFeat->PresencePublishing(); + + // Setup status event listener for RequestComplete + listener2->Reset(); + + TXIMPRequestId reqIdDummy; // not checked + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + // Subscribe + TXIMPRequestId reqId = presPub.SubscribePresenceWatcherListL(); + + // Wait for events on the request + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Subscribe failed" ); + + // verify that SubscribePresenceWatcherListL was called + COMMONASSERT( messenger, EXIMPPlgTestSubscribePresenceWatcherListCalled, "SubscribePresenceWatcherListL was not called", ETrue, NULL ); + + CleanupStack::PopAndDestroy( listener2 ); + } + for( TInt a = 0; a < countOfWrappers; ++a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresencePublishing& presPub = presFeat->PresencePublishing(); + + // Setup status event listener for RequestComplete + listener2->Reset(); + + TXIMPRequestId reqIdDummy; // not checked + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + // Unsubscribe + TXIMPRequestId reqId = presPub.UnsubscribePresenceWatcherListL(); + + // Wait for events on the request + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Unsubscribe failed" ); + + // verify that unsubscribe was called + COMMONASSERT( messenger, EXIMPPlgTestUnsubscribePresenceWatcherListCalled, + "UnsubscribePresenceWatcherListL was not called", + ( a < 2 ) ? EFalse : ETrue, + "UnsubscribePresenceWatcherListL was called" ); + + CleanupStack::PopAndDestroy( listener2 ); + } + + UnbindAllL(); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +void T_PresenceWatcherListManagement::SubscribeL() + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresencePublishing& presPub = presFeat->PresencePublishing(); + + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + + // Setup status event listener for RequestComplete + listener2->Reset(); + + TXIMPRequestId reqIdDummy; // not checked + CXIMPRequestCompleteEventImp* evReqComplete = + CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + // subscribe + TXIMPRequestId reqId = presPub.SubscribePresenceWatcherListL(); + + // Wait for events on the request + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Subscribe failed" ); + + COMMONASSERT( messenger, EXIMPPlgTestSubscribePresenceWatcherListCalled, "SubscribeWatcherListL was not called", ETrue, NULL ); + + CleanupStack::PopAndDestroy( listener2 ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +void T_PresenceWatcherListManagement::UnsubscribeL() + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresencePublishing& presPub = presFeat->PresencePublishing(); + + // Setup status event listener for RequestComplete + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + + // Setup status event listener for RequestComplete + listener2->Reset(); + + TXIMPRequestId reqIdDummy; // not checked + CXIMPRequestCompleteEventImp* evReqComplete = + CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + // unsubscribe + TXIMPRequestId reqId = presPub.UnsubscribePresenceWatcherListL(); + + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Unsbscribe failed" ); + + // verify that UnsubscribeWatcherListL was called + COMMONASSERT( messenger, EXIMPPlgTestUnsubscribePresenceWatcherListCalled, "UnsubscribeWatcherListL was not called", ETrue, NULL ); + + CleanupStack::PopAndDestroy( listener2 ); + + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +void T_PresenceWatcherListManagement::T_HandlePresenceWatcherList_L() + { + EUNIT_PRINT( _L("Handle presence watcher list.") ); + + BindL(); + SubscribeL(); + + // ------------------------------------------------------ + // some startup stuff + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + // ------------------------------------------------------ + + // Tell the protocol it should act normally + wrapper->GetMessenger()->SetNoError(); + + // ------------------------------------------------------ + // 1. Create faked server message about watcher list (empty) + SendSrvMsgL( CXIMPTestFileSrvMsg::ETestSrvMsgPresenceWatcherList ); + + // ------------------------------------------------------ + // expect empty MPresencewatcherList event. + + RPrWatLstInfoImpArray* currentList(NULL); + CPresenceWatcherListEventImp* event = CreateWatcherListEventLCX( + KNullDesC, KNullDesC, + MXIMPDataSubscriptionState::ESubscriptionActive, + MXIMPDataSubscriptionState::EDataAvailable, + ETestPWlCurrent, currentList); + + listener2->ExpectL( event ); + CleanupStack::Pop( event ); // 3 more items in cleanupstack + + //Waqas: Fixed task Ticket#22 + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "HandlePresenceWatcherListL failed" ); + CleanupStack::PopAndDestroy( 3 ); // lists + // ------------------------------------------------------ + + + // ------------------------------------------------------ + // 2. Create faked server message about watcher list (new) + listener2->Reset(); + + _LIT16( KWatcherUri1, "http://carpe.diem.com" ); + _LIT16( KWatcherDispName1, "DispnameA, LoremI" ); + + SendSrvMsgL( KWatcherUri1, + KWatcherDispName1, + CXIMPTestFileSrvMsg::ETestSrvMsgPresenceWatcherList ); + + // ------------------------------------------------------ + // MPresencewatcherList event. + + currentList = NULL; // previous one was destroyed + //Now create the actual event + event = CreateWatcherListEventLCX( // previous event was destroyed + KWatcherUri1, KWatcherDispName1, + MXIMPDataSubscriptionState::ESubscriptionActive, + MXIMPDataSubscriptionState::EDataAvailable, + ETestPWlNew, currentList); + + + listener2->ExpectL( event ); + CleanupStack::Pop( event ); // 3 more items in cleanupstack + + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "HandlePresenceWatcherListL failed" ); + CleanupStack::PopAndDestroy( 3 ); // lists + + + // ------------------------------------------------------ + // 3. Create faked server message about watcher list (disappeared) + listener2->Reset(); + + SendSrvMsgL( CXIMPTestFileSrvMsg::ETestSrvMsgPresenceWatcherList ); + // ------------------------------------------------------ + // MPresencewatcherList event. + + CXIMPIdentityImp* idForEvent = CXIMPIdentityImp::NewLC( KWatcherUri1 ); + // we need to create current list to give to the event + currentList = new ( ELeave ) RPrWatLstInfoImpArray; // previous is destroyed + CleanupDeletePushL( currentList ); + // create the group info + CPresenceWatcherInfoImp* watcherInfoForEvent = + CPresenceWatcherInfoImp::NewLC( (MPresenceWatcherInfo::TWatcherType)0, *idForEvent, KWatcherDispName1); + currentList->AppendL( watcherInfoForEvent ); + CleanupStack::Pop( watcherInfoForEvent ); + CleanupStack::Pop( currentList ); + CleanupStack::PopAndDestroy( idForEvent ); + + + //Now create the actual event + event = CreateWatcherListEventLCX( + KWatcherUri1, KWatcherDispName1, + MXIMPDataSubscriptionState::ESubscriptionActive, + MXIMPDataSubscriptionState::EDataAvailable, + ETestPWlDisappeared, currentList); + + listener2->ExpectL( event ); + CleanupStack::Pop( event ); // 3 more items in cleanupstack + + //Waqas: Fixed task Ticket#22 + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "HandlePresenceWatcherListL failed" ); + + CleanupStack::PopAndDestroy( 3 ); // lists + + + // clean it up + UnsubscribeL(); + + /* TODO later on better time. + // ------------------------------------------------------ + // 4. Create faked server message about watcher list (no subscribers to list) + // Make sure no event is + listener2->Reset(); + + event = CreateWatcherListEventLCX( + KNullDesC, KNullDesC, + ETestPWlEmpty ); + + //EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "HandlePresenceWatcherListL failed" ); + + */ + CleanupStack::PopAndDestroy( listener2 ); + + UnbindL(); + } + +//////////////////////////////////////////////////// +//// INTIA CASE +//////////////////////////////////////////////////// +void T_PresenceWatcherListManagement::T_IndiaCase_L() + { + + EUNIT_PRINT( _L("Presence notification subscribed list, Intia") ); + + + BindL(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* presenceCtx = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + CXIMPTestListener* ctxObserver = CXIMPTestListener::NewL( presenceCtx ); + CleanupStack::PushL( ctxObserver ); // << ctxObserver + + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresencePublishing& presPub = presFeat->PresencePublishing(); + MPresentityGroups& presGroups = presFeat->PresentityGroups(); + MPresenceWatching& presWatch = presFeat->PresenceWatching(); + + MXIMPObjectFactory& objFactory = presenceCtx->ObjectFactory(); + + _LIT( KGroupId, "rakesh.harsh/Friends" ); + _LIT( KGroupDisplayName, "my_friend" ); + _LIT( KMemberId1, "user1" ); + _LIT( KMember1DisplayName, "user1DisplayName" ); + _LIT( KMemberId2, "user2" ); + _LIT( KMember2DisplayName, "user2DisplayName" ); + + + // Create test variables + MXIMPIdentity* testGroupId = objFactory.NewIdentityLC(); // << testGroupId + testGroupId->SetIdentityL( KGroupId ); + + MXIMPIdentity* member1 = objFactory.NewIdentityLC(); // << member1 + member1->SetIdentityL( KMemberId1 ); + + MXIMPIdentity* member2 = objFactory.NewIdentityLC(); // << member2 + member2->SetIdentityL( KMemberId2 ); + + ////////////////////////////////////////////////////////////////////////// + // SUBSCRIBE PRESENTITY GROUP LIST + ////////////////////////////////////////////////////////////////////////// + + // Setup status event listener for RequestComplete + TXIMPRequestId reqId; + ctxObserver->Reset(); + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqId );// << evReqComplete + ctxObserver->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); // >> evReqComplete + + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + + // subscribe PresentityGroupList + reqId = presGroups.SubscribePresentityGroupListL(); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Subscribing presentity group list, complete with error: ") ); + + // verify that SubscribePresentityGroupListL was called + messenger->AssertSubscribePresentityGroupListCalled( ETrue ); + + + // get list request +/* TXIMPRequestId req = presGroups.SubscribePresentityGroupListL(); + ctxObserver->WaitOpToCompleteL( req ); + + CUserAfter::AfterL( 1000000 ); +*/ + + ////////////////////////////////////////////////////////////////////////// + // SUBSCRIBE PRESENTITY GROUP CONTENT + ////////////////////////////////////////////////////////////////////////// + + // Setup status event listener for RequestComplete + ctxObserver->Reset(); + evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqId ); + ctxObserver->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + SetupListenerReqCompleteL( wrapper, EXIMPTestStatusEvents_RequestOk ); + + // subscribe group content + reqId = presGroups.SubscribePresentityGroupContentL( *testGroupId ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Subscribe presentity group content, complete with error: ") ); + + COMMONASSERT( messenger, EXIMPPlgTestSubscribePresentityGroupContentCalled, "SubscribeGroupContentL was not called", ETrue, NULL ); + +/* TInt count = ctxObserver->gidcount; + // List manage request + for(TInt i = 0; iSetIdentityL( ctxObserver->gid[i] ); + // tgid->SetIdentityL( _L("rakesh.harsh/basu2@nokia.com") ); + + TXIMPRequestId req = presGroups.SubscribePresentityGroupContentL( *tgid ); + + ctxObserver->WaitOpToCompleteL( req ); + + CleanupStack::PopAndDestroy( 1 ); // tgid + } */ + + ////////////////////////////////////////////////////////////////////////// + // CREATE PRESENTITY GROUP + ///////////////////////////////////////////////////////////////////////// + + // Setup status event listener for RequestComplete + // This will also produce HandlePresentityGroupListEvent, since the + // the group is subscribed + ctxObserver->Reset(); + evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqId ); + ctxObserver->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete );//TODO??? + + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + + // Create group + reqId = presGroups.CreatePresentityGroupL( *testGroupId, KGroupDisplayName ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("CreatePresentityGroupL failed, complete with error: ") ); + + // verify that SubscribePresentityGroupListL was called + messenger->AssertCreatePresentityGroupCalled( ETrue ); + + + + // first make a test group in our roster + /* MXIMPIdentity* newGroupId = objFactory.NewIdentityLC();//1 + newGroupId->SetIdentityL( _L("rakesh.harsh/Friends") ); + + req = presGroups.CreatePresentityGroupL( *newGroupId,_L("my_friend") ); + // wait completion + ctxObserver->WaitOpToCompleteL( req ); + + CUserAfter::AfterL( 1000000 );*/ + + ////////////////////////////////////////////////////////////////////////// + // ADD PRESENTITY GROUP MEMBER + ////////////////////////////////////////////////////////////////////////// + + // Setup event listener for RequestComplete + ctxObserver->Reset(); + evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqId ); // << evReqComplete + + // group id + CXIMPIdentityImp* grid = CXIMPIdentityImp::NewLC( testGroupId->Identity() ); // << grid + evReqComplete->AppendParamL( grid ); + CleanupStack::Pop(); // >> grid + + // id for member info + CXIMPIdentityImp* miId = CXIMPIdentityImp::NewLC( KMemberId1 ); // << miId + // member info + CPresentityGroupMemberInfoImp* memInfoImp = + CPresentityGroupMemberInfoImp::NewLC( *miId, KMember1DisplayName ); // << memInfoImp + evReqComplete->AppendParamL( memInfoImp ); + CleanupStack::Pop(); // memInfoImp owned by AppendParamL // >> memInfoImp + CleanupStack::PopAndDestroy( miId ); // copy was made // >>> miId + + ctxObserver->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); // >> evReqComplete + + // do the call + reqId = presGroups.AddPresentityGroupMemberL( + *testGroupId, *member1, KMember1DisplayName ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + messenger->AssertAddPresentityGroupMemberCalled( ETrue ); + + + //add a member +/* MXIMPIdentity* testContactId = objFactory.NewIdentityLC(); + testContactId->SetIdentityL( _L("mukesh") ); + req = presGroups.AddPresentityGroupMemberL( *newGroupId, + *testContactId, + _L("h2") ); + // wait completion + ctxObserver->WaitOpToCompleteL( req ); + + + CUserAfter::AfterL( 1000000 );*/ + + + ////////////////////////////////////////////////////////////////////////// + // ADD PRESENTITY GROUP MEMBER + ////////////////////////////////////////////////////////////////////////// + + // Setup event listener for RequestComplete + ctxObserver->Reset(); + evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqId ); // << evReqComplete + + // group id + CXIMPIdentityImp* grid2 = CXIMPIdentityImp::NewLC( testGroupId->Identity() ); + evReqComplete->AppendParamL( grid2 ); + CleanupStack::Pop(); // grid2 + + // id for member info + CXIMPIdentityImp* miId2 = CXIMPIdentityImp::NewLC( KMemberId2 ); + // member info + CPresentityGroupMemberInfoImp* memInfoImp2 = + CPresentityGroupMemberInfoImp::NewLC( *miId2, KMember2DisplayName ); + evReqComplete->AppendParamL( memInfoImp2 ); + CleanupStack::Pop(); // memInfoImp owned by AppendParamL + CleanupStack::PopAndDestroy( miId2 ); // copy was made + + ctxObserver->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + // reset the variable + messenger->SetValueFor( EXIMPPlgTestAddPresentityGroupMemberCalled, 0 ); + // do the call + reqId = presGroups.AddPresentityGroupMemberL( + *testGroupId, *member2, KMember2DisplayName ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + messenger->AssertAddPresentityGroupMemberCalled( ETrue ); + + +/* testContactId->SetIdentityL( _L("bb0") ); + req = presGroups.AddPresentityGroupMemberL( *newGroupId, + *testContactId, + _L("b1") ); + // wait completion + ctxObserver->WaitOpToCompleteL( req ); + +*/ + ////////////////////////////////////////////////////////////////////////// + // SUBSCRIBE PRESENTITY GROUP MEMBERS PRESENCE + ////////////////////////////////////////////////////////////////////////// + + // Setup status event listener for RequestComplete + ctxObserver->Reset(); + evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqId ); + ctxObserver->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + SetupListenerReqCompleteL( wrapper, EXIMPTestStatusEvents_RequestOk ); + + + // Set filter for the group + MPresenceInfoFilter* gpif = presFeat->PresenceObjectFactory().NewPresenceInfoFilterLC(); + gpif->AcceptPersonFilterL( NPresenceInfo::NFieldType::KStatusMessage ); + gpif->AcceptPersonFilterL( NPresenceInfo::NFieldType::KAvatar ); + + // register interest + reqId = presWatch.SubscribePresentityGroupMembersPresenceL( *testGroupId, *gpif ); + + CleanupStack::PopAndDestroy(); // >>> gpif + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Subscribe presentity group members, complete with error: ") ); + + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestSubscribePresentityGroupMembersPresesenceCalled, "SubscribePresentityGroupMembersPresenceL was not called", ETrue, NULL ); + + + +/* CUserAfter::AfterL( 1000000 ); + MPresenceWatching& presWatch = presenceCtx->PresenceWatching(); + MPresenceInfoFilter* infoFilt = objFactory.NewPresenceInfoFilterLC(); + req = presWatch.SubscribePresentityGroupMembersPresenceL( *newGroupId, *infoFilt ); + // wait completion + ctxObserver->WaitOpToCompleteL( req ); + + // req = presWatch.SubscribePresentityPresenceL( *testContactId, *infoFilt ); + // wait completion + // ctxObserver->WaitOpToCompleteL( req ); + //MXIMPClient* presClient1 = NULL; + // MXIMPContext* presenceCtx1 = NULL; + //CUSContextObserver* ctxObserver1 = NULL; + + /*TInt pushCount1 = DoSetupDefaultContext1LC( presClient1, + presenceCtx1, + ctxObserver1 ); + + ctxObserver->WaitOpToCompleteL( req );*/ + // CUserAfter::AfterL( 60000000 ); //60 seconds + + /*if ( !iWait.IsStarted() ) + { + iWait.Start(); // CSI: 10 # iWait is not an active object + } + */ + //code is for login with diff id + //Initialize XIMP client + /* #if 0 + MXIMPClient* presClient1 = MXIMPClient::NewClientL(); + CleanupDeletePushL( presClient ); + + //Create new sink to receive presence context events + CUSContextObserver* eventObserver1 = CUSContextObserver::NewLC(); + + //Create new presence context + MXIMPContext* presecenCtx1 = presClient->NewPresenceContextLC(); + presecenCtx1->RegisterObserverL( *eventObserver1 ); + + //Bind context to desired presence service + TUid protocolUid = TUid::Uid( KProtocolUid ); + + + //Bind context to desired presence service + req = presecenCtx1->BindToL( protocolUid, + KServerAddress, + KUserName2, + KPassword2, + KIAP ); + + //Wait with CActiveSchedulerWait the binding to complete + //If binding fails, it is handled with leave + eventObserver1->WaitOpToCompleteL( req ); + MXIMPIdentity* newGroupId1 = objFactory.NewIdentityLC();//1 + newGroupId1->SetIdentityL( _L("bb0/jaya") ); + + req = presGroups.CreatePresentityGroupL( *newGroupId1,_L("my_sweety") ); + // wait completion + ctxObserver->WaitOpToCompleteL( req ); + + CUserAfter::AfterL( 1000000 ); + presecenCtx1->UnbindL(); + eventObserver1->WaitOpToCompleteL( req ); + CleanupStack::PopAndDestroy( 4 ); //newGroupId1,presecenCtx1,eventObserver1,presClient1 + + #endif*/ + //code is for login with diff id end + + //add this user to bb0's contact list.i should recieve notification + + // delete group friend which is created above statement + //req = presGroups.DeletePresentityGroupL( *newGroupId ); + // wait completion + // ctxObserver->WaitOpToCompleteL( req ); + // CUserAfter::AfterL( 60000000 ); + //Unbind the context and wait completion + // req = presenceCtx->UnbindL(); + // ctxObserver->WaitOpToCompleteL( req ); + + //Destroy the context (it is automaticly unbind) + // CleanupStack::PopAndDestroy( 3 ); // infoFilt,testContactId,newGroupId + // CleanupStack::PopAndDestroy( pushCount ); + + + ////////////////////////////////////////////////////////////////////////// + // SEND DATA FOR GROUP MEMBER -> HANDLE PRESENTITY PRESENCE + ////////////////////////////////////////////////////////////////////////// + + + // create test message + CPresenceInfoImp* presenceInfo = CPresenceInfoImp::NewLC(); // << presenceInfo + HBufC8* packedInfo = TXIMPObjectPacker< CPresenceInfoImp >::PackL( *presenceInfo ); + CleanupStack::PopAndDestroy( presenceInfo );// >>> presenceInfo + CleanupStack::PushL( packedInfo ); // << packedInfo + + CXIMPIdentityImp* changed = CXIMPIdentityImp::NewLC( ); // << changed + changed->SetIdentityL( KMemberId1 ); + HBufC8* packedId = TXIMPObjectPacker< CXIMPIdentityImp >::PackL( *changed ); + CleanupStack::PopAndDestroy(); // >>> changed + CleanupStack::PushL( packedId );// << packedId + + RPointerArray< HBufC8 > bufferArray; + CleanupClosePushL( bufferArray ); // << bufferArray + bufferArray.AppendL( packedId ); + bufferArray.AppendL( packedInfo ); + + HBufC8* packedBufferArray = TXIMPHBuf8Packer::PackArrayL( bufferArray ); + CleanupStack::PopAndDestroy( 2 ); // >>> packedId, packedInfo + CleanupStack::PopAndDestroy(); // >>> bufferArray + CleanupStack::PushL( packedBufferArray ); // << packedBufferArray + + // Send it to plugin + CXIMPTestFileSrvMsg* srvMsg = CXIMPTestFileSrvMsg::NewL( CXIMPTestFileSrvMsg::ETestSrvMsgPresentityPresence, + *packedBufferArray ); + CleanupStack::PopAndDestroy( packedBufferArray ); // >>> packedBufferArray + + CleanupStack::PushL( srvMsg ); // << srvMsg + wrapper->FileTool().SrvMsgStoreL( srvMsg ); + CleanupStack::PopAndDestroy( srvMsg ); // >>> srvMsg + wrapper->FileTool().CleanAllL(); + + // Wait for server to handle srvmsg. + User::After( 4 * 1000000 ); + + COMMONASSERT( messenger, EXIMPPlgTestHandlePresentityPresenceCalled, "HandlePresentityPresenceL was not called", ETrue, NULL ); + + CleanupStack::PopAndDestroy( 3 ); // >>> testGroupId, member1, member2 + CleanupStack::PopAndDestroy( ctxObserver ); // >>> ctxObserver + + UnbindL(); + +} +// =========================================================================== +// SETUP HELPERS FOR THE LISTENER +// =========================================================================== +// + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// send a faked server-originated message with watcher info made +// from the given uri and displayname +// +void T_PresenceWatcherListManagement::SendSrvMsgL( + const TDesC& aUri, const TDesC& aDispName, + TInt aMsgType ) + { + // we'll use hard-coded wrapper 0 instance for now. + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + + // create a grant req info contained within the server-originated + // faked message + RXIMPObjOwningPtrArray watcherList; + CleanupClosePushL( watcherList ); + + CXIMPIdentityImp* watcherId = CXIMPIdentityImp::NewLC( aUri ); + CPresenceWatcherInfoImp* watcherItem = + CPresenceWatcherInfoImp::NewLC( + (MPresenceWatcherInfo::TWatcherType)0, + *watcherId, + aDispName ); + watcherList.AppendL( watcherItem ); + CleanupStack::Pop( watcherItem ); + CleanupStack::PopAndDestroy( watcherId ); + + HBufC8* packedArray = + TXIMPObjectPacker::PackArrayL( watcherList ); + CleanupStack::PushL( packedArray ); + + // use filetool to send it for plugin. + CXIMPTestFileSrvMsg* srvMsg = CXIMPTestFileSrvMsg::NewL( aMsgType, + *packedArray ); + CleanupStack::PushL( srvMsg ); + wrapper->FileTool().CleanAllL(); + wrapper->FileTool().SrvMsgStoreL( srvMsg ); + CleanupStack::PopAndDestroy( 3 ); // srvMsg, packedArray, watcherList + } + + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// send a faked server-originated message with empty contents +// +void T_PresenceWatcherListManagement::SendSrvMsgL( TInt aMsgType ) + { + // we'll use hard-coded wrapper 0 instance for now. + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + + // create a server-originated faked message with empty contents + RXIMPObjOwningPtrArray watcherList; + + HBufC8* packedArray = TXIMPObjectPacker::PackArrayL( watcherList ); + CleanupStack::PushL( packedArray ); + + // use filetool to send it for plugin. + CXIMPTestFileSrvMsg* srvMsg = CXIMPTestFileSrvMsg::NewL( aMsgType, + *packedArray ); + CleanupStack::PushL( srvMsg ); + wrapper->FileTool().CleanAllL(); + wrapper->FileTool().SrvMsgStoreL( srvMsg ); + CleanupStack::PopAndDestroy( 2 ); // srvMsg, packedArray + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// create a watcher list event with given arrays +// +CPresenceWatcherListEventImp* T_PresenceWatcherListManagement::CreateWatcherListEventLCX( + const TDesC& aUri, + const TDesC& aDispName, + MXIMPDataSubscriptionState::TSubscriptionState aSubscriptionState, + MXIMPDataSubscriptionState::TDataState aDataState, + TTestPWlOperation aOperation, + RPrWatLstInfoImpArray* aCurrentList) + { + // create the arrays + + + // new list + RPrWatLstInfoImpArray* newList = new ( ELeave ) RPrWatLstInfoImpArray; + CleanupDeletePushL( newList ); + + // current list, created by caller + if(!aCurrentList) // if client didnt created the list + aCurrentList = new ( ELeave ) RPrWatLstInfoImpArray; + CleanupDeletePushL( aCurrentList ); + + // disappeared list + RPrWatLstInfoImpArray* disappearedList = new ( ELeave ) RPrWatLstInfoImpArray; + CleanupDeletePushL( disappearedList ); + + // create the watcher info + CPresenceWatcherInfoImp* watcherInfoForEvent1 = NULL; + { + CXIMPIdentityImp* idForEvent = CXIMPIdentityImp::NewLC( aUri ); + watcherInfoForEvent1 = CPresenceWatcherInfoImp::NewLC( (MPresenceWatcherInfo::TWatcherType)0, *idForEvent, aDispName ); + CleanupStack::Pop( watcherInfoForEvent1 ); + CleanupStack::PopAndDestroy( idForEvent ); + CleanupStack::PushL( watcherInfoForEvent1 ); + } + + CPresenceWatcherInfoImp* watcherInfoForEvent2 = + TXIMPObjectCloner< CPresenceWatcherInfoImp >::CloneLC( *watcherInfoForEvent1 ); + + TInt count(0); + TBool found(EFalse); + TInt i(0); + + // put the given watcher info into the specified array + switch ( aOperation ) + { + case ETestPWlNew: + { + newList->AppendL( watcherInfoForEvent2 ); + CleanupStack::Pop( watcherInfoForEvent2 ); + + aCurrentList->AppendL( watcherInfoForEvent1 ); + CleanupStack::Pop( watcherInfoForEvent1 ); + } + break; + case ETestPWlCurrent: + { + // don't add, thus return what user has given + CleanupStack::PopAndDestroy( watcherInfoForEvent2 ); // watcherInfoForEvent2 + CleanupStack::PopAndDestroy( watcherInfoForEvent1 ); // watcherInfoForEvent1 + } + break; + case ETestPWlDisappeared: + { + // search the given id in current list + count = aCurrentList->Count(); + for(i=0;iWatcherId()).Identity()) == aUri ) + && ( (((*aCurrentList)[i])->WatcherDisplayName()) == aDispName )) + { + found = ETrue; + break; + } + } + if(found) // do we need to leave if error? Waqas + { + delete (*aCurrentList)[i]; + aCurrentList->Remove(i); + disappearedList->AppendL( watcherInfoForEvent2 ); + CleanupStack::Pop( watcherInfoForEvent2 ); + } + else + CleanupStack::PopAndDestroy( watcherInfoForEvent2 ); + + CleanupStack::PopAndDestroy( watcherInfoForEvent1 ); + } + break; + default: + { + User::Leave( KErrArgument ); + } + break; + }; + + CXIMPDataSubscriptionStateImp* stateImp = CXIMPDataSubscriptionStateImp::NewLC(); + stateImp->SetDataStateL( aDataState ); + stateImp->SetSubscriptionStateL( aSubscriptionState ); + CleanupStack::Pop( stateImp ); + + // create the actual event + CPresenceWatcherListEventImp* tmp = + CPresenceWatcherListEventImp::NewLC( + newList, + aCurrentList, + disappearedList, + stateImp ); + + + /* + * In cleanupstack there are 4 items, FIFO + * - new list + * - current list + * - disappeared list + * - event imp + */ + + return tmp; + } + +void T_PresenceWatcherListManagement::SetupListenerReqCompleteL( CXIMPTestContextWrapper* aWrapper, TXIMPTestStatusEventTemplate aEventType ) + { + RArray< TInt32 > array; + CleanupClosePushL( array ); + array.AppendL( MXIMPRequestCompleteEvent::KInterfaceId ); + array.Append( MXIMPContextStateEvent::KInterfaceId ); + array.Append( MPresentityPresenceEvent::KInterfaceId ); + aWrapper->SetupListenerReqCompleteL( aEventType, &array ); + CleanupStack::PopAndDestroy(); // array + } + +void T_PresenceWatcherListManagement::SetupListenerReqCompleteAllowEventsL( CXIMPTestContextWrapper* aWrapper, TXIMPTestStatusEventTemplate aEventType ) + { + RArray< TInt32 > array; + CleanupClosePushL( array ); + array.AppendL( MXIMPRequestCompleteEvent::KInterfaceId ); + array.AppendL( MXIMPContextStateEvent::KInterfaceId ); + array.AppendL( MPresentityPresenceEvent::KInterfaceId ); + aWrapper->SetupListenerReqCompleteL( aEventType, &array ); + CleanupStack::PopAndDestroy(); // array + } + +// =========================================================================== +// EVENT OBSERVER METHODS +// =========================================================================== +// +void T_PresenceWatcherListManagement::HandlePresenceContextEvent( + const MXIMPContext& aContext, + const MXIMPBase& aEvent ) + { + iLastError = KErrNone; + TInt ifId = aEvent.GetInterfaceId(); + TInt gg = MPresentityPresenceEvent::KInterfaceId; + if( ifId == MPresenceWatcherListEvent::KInterfaceId ) + { + const MPresenceWatcherListEvent* watcherListEvent = + TXIMPGetInterface< const MPresenceWatcherListEvent >::From( aEvent, MXIMPBase::EPanicIfUnknown ); + + if( watcherListEvent->NewWatchersCount() ) + { + iLastEvent = EWatcherList; + TInt count = watcherListEvent->NewWatchersCount(); + for( TInt a = 0; a < count; ++a ) + { + TRAPD( error, + CPresenceWatcherInfoImp* watcherInfo = CPresenceWatcherInfoImp::NewLC( + watcherListEvent->NewWatcher( a ).WatcherType(), + watcherListEvent->NewWatcher( a ).WatcherId(), + watcherListEvent->NewWatcher( a ).WatcherDisplayName() ); + iValidateArray.AppendL( watcherInfo ); + CleanupStack::Pop( watcherInfo ); + ); + if( error != KErrNone ) + { + iLastError = error; + return; + } + } + } + } + else if( ifId == MPresentityPresenceEvent::KInterfaceId ) + { + const MPresentityPresenceEvent* presentityPresenceEvent = + TXIMPGetInterface< const MPresentityPresenceEvent >::From( aEvent, MXIMPBase::EPanicIfUnknown ); + const MXIMPIdentity& prId = presentityPresenceEvent->PresentityId(); + const MPresenceInfo& prPif = presentityPresenceEvent->SubscribedPresence(); + const MXIMPDataSubscriptionState& prDataStae = presentityPresenceEvent->DataSubscriptionState(); + } + else + { + iLastEvent = EInvalid; + } + } + +// =========================================================================== +// TEST CASE TABLE +// =========================================================================== +// +EUNIT_BEGIN_TEST_TABLE( + T_PresenceWatcherListManagement, + "XIMP presence watching tests", + "MODULE" ) + +PRFW_DECORATED_TEST( + "Bind Unbind", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_BindUnbind_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Single client watcher list subscription", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_SubscribePresenceWatcherList_Single_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Multiple client watcher list subscription", + "", + "", + "FUNCTIONALITY", + SetupMultiple_L, + T_SubscribePresenceWatcherList_Multiple_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Handle Presence Watcher List", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_HandlePresenceWatcherList_L, + Teardown ) + + PRFW_DECORATED_TEST( + "Test India Case", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_IndiaCase_L, + Teardown ) + + +EUNIT_END_TEST_TABLE + + +// =========================================================================== +// TEST SUITE CONSTRUCTION +// =========================================================================== +// +EXPORT_C MEUnitTest* CreateTestSuiteL() + { + return T_PresenceWatcherListManagement::NewL(); + } + + +// end of file diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencewatcherlistmngt/t_presencewatcherlistmngt.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencewatcherlistmngt/t_presencewatcherlistmngt.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,179 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef T_PRESENCEWATCHERLISTMANAGEMENT_H +#define T_PRESENCEWATCHERLISTMANAGEMENT_H + +#include +#include +#include +#include "presencetypehelpers.h" +#include "prfwteststatuseventlistener.h" +#include "prfwtestmessaging.h" + +class CXIMPTestContextWrapper; +class CXIMPTestContextWrapperMgr; +class CXIMPTestMessenger; +class CPresenceWatcherInfoImp; +class CPresenceWatcherListEventImp; + +/** + * XIMP Framework Eunit tests. + * + * Tests for XIMP presence watcher list. + * + * @since S60 v4.0 + */ +class T_PresenceWatcherListManagement : public CEUnitTestSuiteClass, + public MXIMPContextObserver + { + +public: + static T_PresenceWatcherListManagement* NewL(); + virtual ~T_PresenceWatcherListManagement(); + + +private: + T_PresenceWatcherListManagement(); + void ConstructL(); + + enum TValidateType + { + EWatcherList, + EInvalid = 1000 + }; + +private: // Test case functions + + void Setup_L(); + void SetupMultiple_L(); + void BindL(); + void BindAllL(); + void Teardown(); + void UnbindL(); + void UnbindAllL(); + void SubscribeL(); + void UnsubscribeL(); + + void T_BindUnbind_L(); + void T_SubscribePresenceWatcherList_Single_L(); + void T_SubscribePresenceWatcherList_Multiple_L(); + void T_HandlePresenceWatcherList_L(); + void T_IndiaCase_L(); + void SetupListenerReqCompleteL( CXIMPTestContextWrapper* aWrapper, + TXIMPTestStatusEventTemplate aEventType ); + + void SetupListenerReqCompleteAllowEventsL( CXIMPTestContextWrapper* aWrapper, + TXIMPTestStatusEventTemplate aEventType ); + + //TBool ValidateWatcherListEvent( RXIMPObjOwningPtrArray& aExpectedArray, TValidateType aType ); + + +private: // From MXIMPContextObserver + + void HandlePresenceContextEvent( + const MXIMPContext& aContext, + const MXIMPBase& aEvent ); + + +private: // Test helpers + + /** + * Fake a server-originated (=mobile terminated) message. + * The message appears to adaptation and framework as if + * it came from the network. Uses only one group. + * @param aUri The URI of group + * @param aDispName The display name for the group + * @param aMsgType The message type for CXIMPTestFileSrvMsg + */ + void SendSrvMsgL( + const TDesC& aUri, const TDesC& aDispName, + TInt aMsgType ); + + /** + * Fake a server-originated message with empty content. + * Whether to use this depends on the event you expect. + * @see SendSrvMsgL + */ + void SendSrvMsgL( TInt aMsgType ); + + // @see below + enum TTestPWlOperation + { + ETestPWlNew = 0, // new watchers + ETestPWlCurrent, // current watchers + ETestPWlDisappeared // disappeared watchers + }; + + + /** + * Creates an event for new watcher, current, or disappred presence watcher + * list. The caller provides an identity and current presence watcher list. + * Depending on the provided operation an event is created. + * + * In cleanupstack there are 4 items, FIFO: + * - new list + * - current list + * - disappeared list + * - event imp + * + * This is because this event won't take ownership to the arrays + * when created this way. + * + * @param aUri Uri + * @param aDispName Displayname + * @param aOperation operation for which caller wants to generates event + * @param aCurrentList Current watcher list provided by caller, method takes + * ownership of the current list, and it is included in above 3 lists. + * a NULL pointer with operation ETestPWlCurrent causes empty event. + * @return The suitably filled event. + */ + CPresenceWatcherListEventImp* CreateWatcherListEventLCX( + const TDesC& aUri, + const TDesC& aDispName, + MXIMPDataSubscriptionState::TSubscriptionState aSubscriptionState, + MXIMPDataSubscriptionState::TDataState aDataState, + TTestPWlOperation aOperation, + RPrWatLstInfoImpArray* aCurrentList = NULL + ); + + +private: // Test data + + /** + * Eunit test case table declaration. + */ + EUNIT_DECLARE_TEST_TABLE; + + // owned + CXIMPTestContextWrapperMgr* iWrapperMgr; + + // + TValidateType iLastEvent; + TInt iLastError; + RXIMPObjOwningPtrArray< CPresenceWatcherInfoImp > iValidateArray; + }; + + +#endif // T_PRESENCEWATCHERLISTMANAGEMENT_H + + + +// end of file + + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencewatcherlistmngt/t_presencewatcherlistmngt.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencewatcherlistmngt/t_presencewatcherlistmngt.mmp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,54 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "../../tsrcutils/eunitcommon/eunittstdllbase.hrh" +#include "../../tsrcutils/processmaster/pm.h" + +TARGET t_presencewatcherlistmngt.dll +CAPABILITY ALL -TCB +SOURCEPATH . +SOURCE t_presencewatcherlistmngt.cpp + +USERINCLUDE ../../../../../ximpfw/core/srcdatamodel +USERINCLUDE ../../../../../ximpfw/presence/srcpresencedatamodel +USERINCLUDE ../../../../../ximpfw/presence/srcpresencedatamodel/presentitygroups +USERINCLUDE ../../../../../ximpfw/presence/srcpresencedatamodel/presencewatching +USERINCLUDE ../../../../../ximpfw/presence/srcpresencedatamodel/presenceauthorization +USERINCLUDE ../../../../../ximpfw/presence/srcpresencedatamodel/presencepublishing +USERINCLUDE ../../../../../ximpfw/presence/srcpresencedatamodel/presenceinfo +USERINCLUDE ../../../../../ximpfw/core/srcutils + +// TODO remove unnecessary +SYSTEMINCLUDE ../../../../../ximpfw/inc/core/base +SYSTEMINCLUDE ../../../../../ximpfw/inc/core/datamodel +SYSTEMINCLUDE ../../../../../ximpfw/inc/core/protocolplugin +SYSTEMINCLUDE ../../../../../ximpfw/inc/core/protocolpluginhost +SYSTEMINCLUDE ../../../../../ximpfw/inc/presence/presencedatamodel +SYSTEMINCLUDE ../../../../../ximpfw/inc/presence/presencemanagement +SYSTEMINCLUDE ../../../../../ximpfw/inc/presence/presenceprotocolplugin +SYSTEMINCLUDE ../../../../../ximpfw/inc/presence/presenceprotocolpluginhost + +LIBRARY ecom.lib +LIBRARY bafl.lib +LIBRARY ximpdatamodel.lib +LIBRARY presencedatamodel.lib +LIBRARY ximputils.lib +LIBRARY estor.lib +LIBRARY EUnit.lib +// end of file + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencewatching/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencewatching/bld.inf Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,23 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Build information file for t_presencewatching.dll +* +*/ + + +PRJ_PLATFORMS +DEFAULT + +PRJ_TESTMMPFILES +t_presencewatching.mmp diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencewatching/t_presencewatching.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencewatching/t_presencewatching.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,1520 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +#include "eunittools.h" + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "t_presencewatching.h" +#include "prfwteststatuseventlistener.h" +#include "prfwtestmessaging.h" +#include "prfwtestmessenger.h" +#include "prfwtestcontextwrappermgr.h" +#include "prfwtestcontextwrapper.h" + +#include "presenceinfoimp.h" +#include "presenceinfofilterimp.h" +#include "prfwtestpresencedatautils.h" +#include "ximpidentityimp.h" +#include "presentitygroupmemberinfoimp.h" +#include "ximpobjecthelpers.h" +#include "prfwtestfilesrvmsg.h" +#include "prfwtestwaithelper.h" + +#include "prfwtestrobustnesstools.h" +#include "presenceinfofieldimp.h" +#include "presenceinfofieldcollectionimp.h" +#include "presenceinfofieldvaluetextimp.h" +#include "personpresenceinfoimp.h" + +#include + +// For the protocol UID +#include "prfwtestprotocols.h" + + +_LIT8( KPrefix1, "PreA_" ); +_LIT8( KPrefix2, "PreB_" ); +_LIT8( KPrefix3, "PreC_" ); +_LIT8( KPrefix4, "PreD_" ); + +_LIT( KIdentity, "TestId@hello.world" ); +_LIT8( KIdentity8, "TestId@hello.world" ); + +_LIT( KText, "Hello World" ); + + +const TUid KTestProtocolUid = { K_PRFW_TST_PROTOCOL_1_IMPLEMENTATION_UID }; // hardcoded... + +// ============================ MEMBER FUNCTIONS =============================== + +// CONSTRUCTION +T_PresenceWatching* T_PresenceWatching::NewL() + { + T_PresenceWatching* self = new( ELeave ) T_PresenceWatching; + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + + return self; + } + + +T_PresenceWatching::~T_PresenceWatching() + { + } + + +void T_PresenceWatching::ConstructL() + { + CEUnitTestSuiteClass::ConstructL(); + } + + +T_PresenceWatching::T_PresenceWatching() + { + } + + + +// =========================================================================== +// TEST CASE SETUP & TEARDOWN METHODS +// =========================================================================== +// + +void T_PresenceWatching::Setup_L() + { + __UHEAP_MARK; + PrfwTestRobustness::DoPreCleaning(); + + iWrapperMgr = CXIMPTestContextWrapperMgr::NewL(); + iWrapperMgr->CreateWrapperL(); + + iMPresenceCacheReader = MPresenceCacheReader::NewL(); + } + +void T_PresenceWatching::SetupMultiple_L() + { + PrfwTestRobustness::DoPreCleaning(); + + iWrapperMgr = CXIMPTestContextWrapperMgr::NewL(); + iWrapperMgr->CreateWrapperL(); + iWrapperMgr->CreateWrapperL(); + iWrapperMgr->CreateWrapperL(); + } + + +void T_PresenceWatching::BindL() + { + CXIMPTestContextWrapper* wrapper0 = iWrapperMgr->GetWrapperL( 0 ); + + wrapper0->BindL( 0 ); + } + +void T_PresenceWatching::BindAllL() + { + for( TInt a = 0; a < iWrapperMgr->WrapperCount(); ++a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + wrapper->BindL( 0 ); + } + } + + +void T_PresenceWatching::Teardown() + { + delete iWrapperMgr; + iWrapperMgr = NULL; + + delete iMPresenceCacheReader; + + REComSession::FinalClose(); + + PrfwTestRobustness::DoPreCleaning(); + __UHEAP_MARKEND; + } + +void T_PresenceWatching::UnbindL() + { + // Do unbind + CXIMPTestContextWrapper* wrapper0 = iWrapperMgr->GetWrapperL( 0 ); + wrapper0->UnbindL(); + } + +void T_PresenceWatching::UnbindAllL() + { + for( TInt a = 0; a < iWrapperMgr->WrapperCount(); ++a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + wrapper->UnbindL(); + } + } + + +// =========================================================================== +// TEST CASES for presentity presence subscription +// =========================================================================== + +// Single client, empty filter +void T_PresenceWatching::T_SubscribePresentityPresence_Single_L() + { + EUNIT_PRINT( _L("Single presentity subscription") ); + +// BIND AND SETUP + + BindL(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceWatching& presWatch = presFeat->PresenceWatching(); + +// SUBSCRIBE + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + + CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 ); + CPresenceInfoFilterImp* pif = XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 ); + + // register interest + TXIMPRequestId reqId = presWatch.SubscribePresentityPresenceL( *identity, *pif ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Subscribing presentity presence, complete with error: ") ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestSubscribePresentityPresesenceCalled, "SubscribePresentityPresenceL was not called", ETrue, NULL ); + + +// REFRESH + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + messenger->SetValueFor( EXIMPPlgTestSubscribePresentityPresesenceCalled, 0 ); + + // register interest + reqId = presWatch.SubscribePresentityPresenceL( *identity, *pif ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Subscribing presentity presence, complete with error: ") ); + + // Wait for event because refresh happened + SetupListenerReqCompleteL( wrapper, EXIMPTestStatusEvents_HandlePresentityPresencePending ); + // Wait for events + wrapper->WaitAnyEvent(); + wrapper->VerifyEventStackL( _L8("Handle presence watcher list. Wrong event occurred.") ); + + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestSubscribePresentityPresesenceCalled, + "SubscribePresentityPresenceL was not called", EFalse, + "SubscribePresentityPresenceL was called" ); + +// UNSUBSCRIBE + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); // allow events after reqcomplete + + // register interest + reqId = presWatch.UnsubscribePresentityPresenceL( *identity ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("UnSubscribing presentity presence, complete with error: ") ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestUnsubscribePresentityPresesenceCalled, "UnsubscribePresentityPresenceL was not called", ETrue, NULL ); + +// UNBIND + + CleanupStack::PopAndDestroy( pif ); + CleanupStack::PopAndDestroy( identity ); + + UnbindL(); + } + +// Single client, empty filter, presence cache checking +void T_PresenceWatching::T_SubscribeHandlePresentityPresence_Single_L() + { + EUNIT_PRINT( _L("Single presentity subscription") ); + +// BIND AND SETUP + + BindL(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceWatching& presWatch = presFeat->PresenceWatching(); + +// SUBSCRIBE + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + + CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KIdentity8 ); + CPresenceInfoFilterImp* pif = XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 ); + + // register interest + TXIMPRequestId reqId = presWatch.SubscribePresentityPresenceL( *identity, *pif ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Subscribing presentity presence, complete with error: ") ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestSubscribePresentityPresesenceCalled, "SubscribePresentityPresenceL was not called", ETrue, NULL ); + +// SEND DATA + + // Create some meaningful data + CPresenceInfoImp* presenceInfo = CPresenceInfoImp::NewLC(); + + MPresenceInfoFieldValueText* value = CPresenceInfoFieldValueTextImp::NewLC(); + value->SetTextValueL(KText); + + MPresenceInfoField* infoField = CPresenceInfoFieldImp::NewLC(); + infoField->SetFieldTypeL(NPresenceInfo::NFieldType::KStatusMessage); + infoField->SetFieldValue(value); + + MPersonPresenceInfo* personPres = CPersonPresenceInfoImp::NewLC(); + MPresenceInfoFieldCollection& fieldCol = personPres->Fields(); + fieldCol.AddOrReplaceFieldL(infoField); + TInt fieldCount= fieldCol.FieldCount(); + + presenceInfo->SetPersonPresenceL(personPres); + CleanupStack::Pop(3); // value, infoField, personPres + + // Pack the data for FileTool + HBufC8* packedInfo = TXIMPObjectPacker< CPresenceInfoImp >::PackL( *presenceInfo ); + CleanupStack::PushL( packedInfo ); + HBufC8* packedId = TXIMPObjectPacker< CXIMPIdentityImp >::PackL( *identity ); + CleanupStack::PushL( packedId ); + RPointerArray< HBufC8 > bufferArray; + CleanupClosePushL( bufferArray ); + bufferArray.AppendL( packedId ); + bufferArray.AppendL( packedInfo ); + HBufC8* packedBufferArray = TXIMPHBuf8Packer::PackArrayL( bufferArray ); + CleanupStack::PopAndDestroy( 3, packedInfo ); // packedId, packedInfo, bufferArray + CleanupStack::PushL( packedBufferArray ); + + // Use filetool to send it for plugin. + CXIMPTestFileSrvMsg* srvMsg = CXIMPTestFileSrvMsg::NewL( CXIMPTestFileSrvMsg::ETestSrvMsgPresentityPresence, + *packedBufferArray ); + CleanupStack::PopAndDestroy( packedBufferArray ); + CleanupStack::PushL( srvMsg ); + wrapper->FileTool().SrvMsgStoreL( srvMsg ); + CleanupStack::PopAndDestroy( srvMsg ); + + // Wait for event + SetupListenerReqCompleteL( wrapper, EXIMPTestStatusEvents_HandlePresentityPresence ); + + // Wait for events + wrapper->WaitAnyEvent(); + wrapper->VerifyEventStackL( _L8("Handle presentity presence. Wrong event occurred.") ); + + // Verify the cache + MPresenceInfo* presInfoRead = iMPresenceCacheReader->PresenceInfoLC(*identity); + + CPresenceInfoImp* readInfo = + TXIMPGetImpClassOrPanic::From(*presInfoRead); + + + EUNIT_ASSERT( presenceInfo->EqualsContent(*readInfo) ); + + CleanupStack::PopAndDestroy( 2 ); // readInfo, presenceInfo + + +// UNSUBSCRIBE + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); // allow events after reqcomplete + + // unsubscribe + reqId = presWatch.UnsubscribePresentityPresenceL( *identity ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("UnSubscribing presentity presence, complete with error: ") ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestUnsubscribePresentityPresesenceCalled, "UnsubscribePresentityPresenceL was not called", ETrue, NULL ); + +// UNBIND + + CleanupStack::PopAndDestroy( pif ); + CleanupStack::PopAndDestroy( identity ); + + UnbindL(); + } + + +// Single client, empty filter +void T_PresenceWatching::T_SubscribePresentityPresenceChangeId_Single_L() + { + EUNIT_PRINT( _L("Single presentity subscription") ); + +// BIND AND SETUP + + BindL(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceWatching& presWatch = presFeat->PresenceWatching(); + +// ID CHANGE REQUEST TO ADAPTATION + + MXIMPIdentity* identityParam = context->ObjectFactory().NewIdentityLC(); + identityParam->SetIdentityL( KIdentity ); + + CXIMPIdentityImp* identityParamImp = + ( CXIMPIdentityImp* ) identityParam->GetInterface( + CXIMPIdentityImp::KClassId, + MXIMPBase::EPanicIfUnknown ); + HBufC8* packedId = TXIMPObjectPacker< CXIMPIdentityImp >::PackL( *identityParamImp ); + CleanupStack::PopAndDestroy(); // identityParam + CleanupStack::PushL( packedId ); + CXIMPTestFileSrvMsg* srvMsg = CXIMPTestFileSrvMsg::NewL( CXIMPTestFileSrvMsg::ETestSrvMsgReqParamIdentity, + *packedId ); + CleanupStack::PopAndDestroy( packedId ); + CleanupStack::PushL( srvMsg ); + wrapper->FileTool().SrvMsgStoreL( srvMsg ); + CleanupStack::PopAndDestroy( srvMsg ); + + // Wait for server to handle srvmsg. + CXIMPTestWaitHelper* wait = CXIMPTestWaitHelper::NewL(); + CleanupStack::PushL( wait ); + wait->WaitForL( 2 ); + CleanupStack::PopAndDestroy( wait ); + +// SUBSCRIBE + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + + CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 ); + CPresenceInfoFilterImp* pif = XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 ); + + // register interest + TXIMPRequestId reqId = presWatch.SubscribePresentityPresenceL( *identity, *pif ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Subscribing presentity presence, complete with error: ") ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestSubscribePresentityPresesenceCalled, "SubscribePresentityPresenceL was not called", ETrue, NULL ); + +// UNBIND + + CleanupStack::PopAndDestroy( pif ); + CleanupStack::PopAndDestroy( identity ); + + UnbindL(); + } + + +void T_PresenceWatching::T_UnsubscribeNotSubscribedPresentityPresence_Single_L() + { + EUNIT_PRINT( _L("Unsubscribe not subscribed presentity presence") ); + +// BIND AND SETUP + + BindL(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceWatching& presWatch = presFeat->PresenceWatching(); + + CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 ); + CPresenceInfoFilterImp* pif = XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 ); + +// UNSUBSCRIBE + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); // allow events after reqcomplete + + // register interest + TXIMPRequestId reqId = presWatch.UnsubscribePresentityPresenceL( *identity ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("UnSubscribing presentity presence, complete with error: ") ); + + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestUnsubscribePresentityPresesenceCalled, "UnsubscribePresentityPresenceL was not called", EFalse, + "UnsbuscribePresentityPresenceL was called." ); + +// UNBIND + + CleanupStack::PopAndDestroy( pif ); + CleanupStack::PopAndDestroy( identity ); + + UnbindL(); + } + +void T_PresenceWatching::T_UnsubscribeNotSubscribedPresentityPresence_Multiple_L() + { + EUNIT_PRINT( _L("Multiple client filter registration") ); + + BindAllL(); + + CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 ); + CPresenceInfoFilterImp* pif = XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 ); + + TInt countOfWrappers = iWrapperMgr->WrapperCount(); + for( TInt a = countOfWrappers - 1; a >= 1 ; --a ) // Don't subscribe the first one. + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceWatching& presWatch = presFeat->PresenceWatching(); + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + + // register interest + TXIMPRequestId reqId = presWatch.SubscribePresentityPresenceL( *identity, *pif ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestSubscribePresentityPresesenceCalled, + "SubscribePresentityPresenceL was not called", + ( a > 1 ) ? ETrue : EFalse, + "SubscribePresentityPresenceL was called" ); + } + + for( TInt a = 0; a < countOfWrappers; ++a ) // Try to unsubscribe first one first. + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceWatching& presWatch = presFeat->PresenceWatching(); + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); // allow events after reqcomplete + + // register interest + TXIMPRequestId reqId = presWatch.UnsubscribePresentityPresenceL( *identity ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Subscribing presentity presence, complete with error: ") ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestUnsubscribePresentityPresesenceCalled, + "UnsubscribePresentityPresenceL was not called", + ( a < 2 ) ? EFalse : ETrue, + "UnsubscribePresentityPresenceL was called" ); + } + + CleanupStack::PopAndDestroy( pif ); + CleanupStack::PopAndDestroy( identity ); + + UnbindAllL(); + } + + +void T_PresenceWatching::T_ErrFromPlg_LeaveOnSubscribePresentityPresence_L() + { + EUNIT_PRINT( _L("Error from plug-in in presentity presence subscribe") ); + EUNIT_PRINT( _L("Plug-in leaves from SubscribePresence().") ); + +// BIND AND SETUP + + BindL(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + messenger->SetLeave( KErrAbort ); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceWatching& presWatch = presFeat->PresenceWatching(); + +// SUBSCRIBE + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_PresentitySubscribeFailKErrAbort ); + + CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 ); + CPresenceInfoFilterImp* pif = XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 ); + + // register interest + TXIMPRequestId reqId = presWatch.SubscribePresentityPresenceL( *identity, *pif ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Subscribing presentity presence, complete with error: ") ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestSubscribePresentityPresesenceCalled, "SubscribePresentityPresenceL was not called", EFalse, "SubscribePresentityPresenceL was called" ); + +// UNBIND + + CleanupStack::PopAndDestroy( pif ); + CleanupStack::PopAndDestroy( identity ); + + messenger->SetLeave( KErrNone ); + + UnbindL(); + } + + +void T_PresenceWatching::T_ErrFromPlg_LeaveOnUnsubscribePresentityPresence_L() + { + EUNIT_PRINT( _L("Error from plug-in in presentity presence subscribe") ); + EUNIT_PRINT( _L("Plug-in leaves from SubscribePresence().") ); + +// BIND AND SETUP + + BindL(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceWatching& presWatch = presFeat->PresenceWatching(); + +// SUBSCRIBE + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + + CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 ); + CPresenceInfoFilterImp* pif = XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 ); + + // register interest + TXIMPRequestId reqId = presWatch.SubscribePresentityPresenceL( *identity, *pif ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Subscribing presentity presence, complete with error: ") ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestSubscribePresentityPresesenceCalled, "SubscribePresentityPresenceL was not called", ETrue, NULL ); + +// UNSUBSCRIBE + + messenger->SetLeave( KErrAbort ); + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_PresentitySubscribeFailKErrAbort ); // allow events after reqcomplete + + // register interest + reqId = presWatch.UnsubscribePresentityPresenceL( *identity ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("UnSubscribing presentity presence, complete with error: ") ); + + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestUnsubscribePresentityPresesenceCalled, "UnsubscribePresentityPresenceL was not called", EFalse, + "UnsbuscribePresentityPresenceL was called." ); + +// UNBIND + + CleanupStack::PopAndDestroy( pif ); + CleanupStack::PopAndDestroy( identity ); + + messenger->SetLeave( KErrNone ); + + UnbindL(); + } + + +// Multiple client, empty filter +void T_PresenceWatching::T_SubscribePresentityPresence_Multiple_L() + { + EUNIT_PRINT( _L("Multiple client filter registration") ); + + BindAllL(); + + CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 ); + CPresenceInfoFilterImp* pif = XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 ); + + TInt countOfWrappers = iWrapperMgr->WrapperCount(); + for( TInt a = 0; a < countOfWrappers; ++a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceWatching& presWatch = presFeat->PresenceWatching(); + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + + // register interest + TXIMPRequestId reqId = presWatch.SubscribePresentityPresenceL( *identity, *pif ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestSubscribePresentityPresesenceCalled, + "SubscribePresentityPresenceL was not called", + ( a == 0 ) ? ETrue : EFalse, + "SubscribePresentityPresenceL was called" ); + } + + for( TInt a = 0; a < countOfWrappers; ++a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceWatching& presWatch = presFeat->PresenceWatching(); + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + messenger->SetValueFor( EXIMPPlgTestSubscribePresentityPresesenceCalled, 0 ); + + // register interest + TXIMPRequestId reqId = presWatch.SubscribePresentityPresenceL( *identity, *pif ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Subscribing presentity presence, complete with error: ") ); + + // Wait for event because refresh happened + SetupListenerReqCompleteL( wrapper, EXIMPTestStatusEvents_HandlePresentityPresencePending ); + // Wait for events + wrapper->WaitAnyEvent(); + wrapper->VerifyEventStackL( _L8("Handle presence watcher list. Wrong event occurred.") ); + + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestSubscribePresentityPresesenceCalled, + "SubscribePresentityPresenceL was not called", EFalse, + "SubscribePresentityPresenceL was called" ); + } + + + for( TInt a = 0; a < countOfWrappers; ++a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceWatching& presWatch = presFeat->PresenceWatching(); + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); // allow events after reqcomplete + + // register interest + TXIMPRequestId reqId = presWatch.UnsubscribePresentityPresenceL( *identity ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Subscribing presentity presence, complete with error: ") ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestUnsubscribePresentityPresesenceCalled, + "UnsubscribePresentityPresenceL was not called", + ( a < 2 ) ? EFalse : ETrue, + "UnsubscribePresentityPresenceL was called" ); + } + + CleanupStack::PopAndDestroy( pif ); + CleanupStack::PopAndDestroy( identity ); + + + UnbindAllL(); + } + + +// =========================================================================== +// TEST CASES for presentity group members presence subscription +// =========================================================================== + +// Single client, empty filter +void T_PresenceWatching::T_SubscribePresentityGroupMembersPresence_Single_L() + { + EUNIT_PRINT( _L("Single presentity group members subscription") ); + + BindL(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceWatching& presWatch = presFeat->PresenceWatching(); + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + + CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 ); + CPresenceInfoFilterImp* pif = XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 ); + +// SUBSCRIBE + + // register interest + TXIMPRequestId reqId = presWatch.SubscribePresentityGroupMembersPresenceL( *identity, *pif ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestSubscribePresentityGroupMembersPresesenceCalled, "SubscribePresentityGroupMembersPresenceL was not called", ETrue, NULL ); + +// REFRESH + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + messenger->SetValueFor( EXIMPPlgTestSubscribePresentityGroupMembersPresesenceCalled, 0 ); + + // register interest + reqId = presWatch.SubscribePresentityGroupMembersPresenceL( *identity, *pif ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestSubscribePresentityGroupMembersPresesenceCalled, + "SubscribePresentityPresenceL was not called", EFalse, + "SubscribePresentityPresenceL was called" ); + +// UNSUBSCRIBE + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); // allow events after reqcomplete + + + // register interest + reqId = presWatch.UnsubscribePresentityGroupMembersPresenceL( *identity ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Subscribing presentity group members presence, complete with error: ") ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestUnsubscribePresentityGroupMembersPresesenceCalled, "UnsubscribePresentityGroupMembersPresenceL was not called", ETrue, NULL ); + + + CleanupStack::PopAndDestroy( pif ); + CleanupStack::PopAndDestroy( identity ); + + UnbindL(); + } + +void T_PresenceWatching::T_UnsubscribeNotSubscribedPresentityGroupMembersPresence_Single_L() + { + EUNIT_PRINT( _L("Unsubscribe not subscribed presentity group members presence") ); + +// BIND AND SETUP + + BindL(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceWatching& presWatch = presFeat->PresenceWatching(); + CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 ); + CPresenceInfoFilterImp* pif = XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 ); + +// UNSUBSCRIBE + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); // allow events after reqcomplete + + // register interest + TXIMPRequestId reqId = presWatch.UnsubscribePresentityGroupMembersPresenceL( *identity ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("UnSubscribing presentity presence, complete with error: ") ); + + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestUnsubscribePresentityGroupMembersPresesenceCalled, "UnsubscribePresentityGroupMembersPresenceL was not called", EFalse, + "UnsubscribePresentityGroupMembersPresenceL was called." ); + +// UNBIND + + CleanupStack::PopAndDestroy( pif ); + CleanupStack::PopAndDestroy( identity ); + + UnbindL(); + } + + +void T_PresenceWatching::T_UnsubscribeNotSubscribedPresentityGroupMembersPresence_Multiple_L() + { + EUNIT_PRINT( _L("Multiple client filter registration") ); + + BindAllL(); + + CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 ); + CPresenceInfoFilterImp* pif = XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 ); + + TInt countOfWrappers = iWrapperMgr->WrapperCount(); + for( TInt a = countOfWrappers - 1; a >= 1; --a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceWatching& presWatch = presFeat->PresenceWatching(); + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + + // register interest + TXIMPRequestId reqId = presWatch.SubscribePresentityGroupMembersPresenceL( *identity, *pif ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestSubscribePresentityGroupMembersPresesenceCalled, + "SubscribePresentityPresenceL was not called", + ( a > 1 ) ? ETrue : EFalse, + "SubscribePresentityPresenceL was called" ); + } + + for( TInt a = 0; a < countOfWrappers; ++a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceWatching& presWatch = presFeat->PresenceWatching(); + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); // allow events after reqcomplete + + // register interest + TXIMPRequestId reqId = presWatch.UnsubscribePresentityGroupMembersPresenceL( *identity ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Subscribing presentity presence, complete with error: ") ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestUnsubscribePresentityGroupMembersPresesenceCalled, + "UnsubscribePresentityPresenceL was not called", + ( a < 2 ) ? EFalse : ETrue, + "UnsubscribePresentityPresenceL was called" ); + } + + CleanupStack::PopAndDestroy( pif ); + CleanupStack::PopAndDestroy( identity ); + + UnbindAllL(); + } + + + +// Multiple client, empty filter +void T_PresenceWatching::T_SubscribeGroupMembersPresence_Multiple_L() + { + EUNIT_PRINT( _L("Multiple client filter registration") ); + + BindAllL(); + + CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 ); + CPresenceInfoFilterImp* pif = XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 ); + + TInt countOfWrappers = iWrapperMgr->WrapperCount(); + for( TInt a = 0; a < countOfWrappers; ++a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceWatching& presWatch = presFeat->PresenceWatching(); + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + + // register interest + TXIMPRequestId reqId = presWatch.SubscribePresentityGroupMembersPresenceL( *identity, *pif ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestSubscribePresentityGroupMembersPresesenceCalled, + "SubscribePresentityPresenceL was not called", + ( a == 0 ) ? ETrue : EFalse, + "SubscribePresentityPresenceL was called" ); + } + + for( TInt a = 0; a < countOfWrappers; ++a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceWatching& presWatch = presFeat->PresenceWatching(); + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + messenger->SetValueFor( EXIMPPlgTestSubscribePresentityGroupMembersPresesenceCalled, 0 ); + + // register interest + TXIMPRequestId reqId = presWatch.SubscribePresentityGroupMembersPresenceL( *identity, *pif ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Subscribing presentity presence, complete with error: ") ); + + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestSubscribePresentityGroupMembersPresesenceCalled, + "SubscribePresentityPresenceL was not called", EFalse, + "SubscribePresentityPresenceL was called" ); + } + + + for( TInt a = 0; a < countOfWrappers; ++a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceWatching& presWatch = presFeat->PresenceWatching(); + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); // allow events after reqcomplete + + // register interest + TXIMPRequestId reqId = presWatch.UnsubscribePresentityGroupMembersPresenceL( *identity ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Subscribing presentity presence, complete with error: ") ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestUnsubscribePresentityGroupMembersPresesenceCalled, + "UnsubscribePresentityPresenceL was not called", + ( a < 2 ) ? EFalse : ETrue, + "UnsubscribePresentityPresenceL was called" ); + } + + CleanupStack::PopAndDestroy( pif ); + CleanupStack::PopAndDestroy( identity ); + + + UnbindAllL(); + } + + +void T_PresenceWatching::T_ErrFromPlg_LeaveOnSubscribePresentityGroupMembersPresence_L() + { + EUNIT_PRINT( _L("Error from plug-in in presentity group members presence subscribe") ); + EUNIT_PRINT( _L("Plug-in leaves from SubscribeGroupMembersPresence().") ); + +// BIND AND SETUP + + BindL(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + messenger->SetLeave( KErrAbort ); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceWatching& presWatch = presFeat->PresenceWatching(); + +// SUBSCRIBE + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_PresentitySubscribeFailKErrAbort ); + + CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 ); + CPresenceInfoFilterImp* pif = XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 ); + + // register interest + TXIMPRequestId reqId = presWatch.SubscribePresentityGroupMembersPresenceL( *identity, *pif ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Subscribing presentity presence, complete with error: ") ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestSubscribePresentityGroupMembersPresesenceCalled, "SubscribePresentityPresenceL was not called", EFalse, "SubscribePresentityPresenceL was called" ); + +// UNBIND + + CleanupStack::PopAndDestroy( pif ); + CleanupStack::PopAndDestroy( identity ); + + messenger->SetLeave( KErrNone ); + + UnbindL(); + } + + +void T_PresenceWatching::T_ErrFromPlg_LeaveOnUnsubscribePresentityGroupMembersPresence_L() + { + EUNIT_PRINT( _L("Error from plug-in in presentity group members presence unsubscribe") ); + EUNIT_PRINT( _L("Plug-in leaves from UnsubscribeGroupMembersPresence().") ); + +// BIND AND SETUP + + BindL(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceWatching& presWatch = presFeat->PresenceWatching(); + +// SUBSCRIBE + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + + CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 ); + CPresenceInfoFilterImp* pif = XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 ); + + // register interest + TXIMPRequestId reqId = presWatch.SubscribePresentityGroupMembersPresenceL( *identity, *pif ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Subscribing presentity presence, complete with error: ") ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestSubscribePresentityGroupMembersPresesenceCalled, "SubscribePresentityPresenceL was not called", ETrue, "SubscribePresentityPresenceL was called" ); + +// UNSUBSCRIBE + + messenger->SetLeave( KErrAbort ); + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_PresentitySubscribeFailKErrAbort ); // allow events after reqcomplete + + // register interest + reqId = presWatch.UnsubscribePresentityGroupMembersPresenceL( *identity ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("UnSubscribing presentity presence, complete with error: ") ); + + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestUnsubscribePresentityGroupMembersPresesenceCalled, "UnsubscribePresentityGroupMembersPresenceL was not called", EFalse, + "UnsubscribePresentityGroupMembersPresenceL was called." ); + +// UNBIND + + CleanupStack::PopAndDestroy( pif ); + CleanupStack::PopAndDestroy( identity ); + + messenger->SetLeave( KErrNone ); + + UnbindL(); + } + + +void T_PresenceWatching::T_ContentChangePresentityGroupMembersPresence_Single_L() + { + EUNIT_PRINT( _L("Presentity group members content change") ); + + BindL(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceWatching& presWatch = presFeat->PresenceWatching(); + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + + CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 ); + CPresenceInfoFilterImp* pif = CPresenceInfoFilterImp::NewLC(); + + + // register interest + TXIMPRequestId reqId = presWatch.SubscribePresentityGroupMembersPresenceL( *identity, *pif ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestSubscribePresentityGroupMembersPresesenceCalled, "SubscribePresentityGroupMembersPresenceL was not called", ETrue, NULL ); + + +// TODO THINGSIES + // Get the interface + MPresencePublishing& presPub = presFeat->PresencePublishing(); + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + + // register interest + reqId = presPub.SubscribeOwnPresenceL( *pif ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + + + + // Create member to grouplist we are interested in. + // 1. Create notification + RXIMPObjOwningPtrArray groupMemberList; + CleanupClosePushL( groupMemberList ); + CPresentityGroupMemberInfoImp* info = CPresentityGroupMemberInfoImp::NewLC( *identity, KNullDesC ); + User::LeaveIfError( groupMemberList.Append( info ) ); + CleanupStack::Pop(); //info + HBufC8* packedId = TXIMPObjectPacker< CXIMPIdentityImp >::PackL( *identity ); + CleanupStack::PushL( packedId ); + HBufC8* packedArray = TXIMPObjectPacker::PackArrayL( groupMemberList ); + CleanupStack::PushL( packedArray ); + RPointerArray< HBufC8 > bufferArray; + CleanupClosePushL( bufferArray ); + bufferArray.AppendL( packedId ); + bufferArray.AppendL( packedArray ); + HBufC8* packedBufferArray = TXIMPHBuf8Packer::PackArrayL( bufferArray ); + CleanupStack::PopAndDestroy( 4 ); // packedId, bufferArray, packedArray, groupMemberList + CleanupStack::PushL( packedBufferArray ); + + // 2. Use filetool to send it for plugin. + CXIMPTestFileSrvMsg* srvMsg = CXIMPTestFileSrvMsg::NewL( CXIMPTestFileSrvMsg::ETestSrvMsgPresentityGroupMemberList, + *packedBufferArray ); + CleanupStack::PopAndDestroy( packedBufferArray ); + CleanupStack::PushL( srvMsg ); + wrapper->FileTool().CleanAllL(); + wrapper->FileTool().SrvMsgStoreL( srvMsg ); + CleanupStack::PopAndDestroy( srvMsg ); + + // 3. Send data to member + CPresenceInfoImp* presenceInfo = CPresenceInfoImp::NewLC(); + HBufC8* packedInfo = TXIMPObjectPacker< CPresenceInfoImp >::PackL( *presenceInfo ); + CleanupStack::PopAndDestroy( presenceInfo ); + CleanupStack::PushL( packedInfo ); + packedId = TXIMPObjectPacker< CXIMPIdentityImp >::PackL( *identity ); + CleanupStack::PushL( packedId ); + CleanupClosePushL( bufferArray ); + bufferArray.AppendL( packedId ); + bufferArray.AppendL( packedInfo ); + packedBufferArray = TXIMPHBuf8Packer::PackArrayL( bufferArray ); + CleanupStack::PopAndDestroy( 3, packedInfo ); // packedId, packedInfo + CleanupStack::PushL( packedBufferArray ); + + // 4. Use filetool to send it for plugin. + srvMsg = CXIMPTestFileSrvMsg::NewL( CXIMPTestFileSrvMsg::ETestSrvMsgPresentityPresence, + *packedBufferArray ); + CleanupStack::PopAndDestroy( packedBufferArray ); + CleanupStack::PushL( srvMsg ); + wrapper->FileTool().SrvMsgStoreL( srvMsg ); + CleanupStack::PopAndDestroy( srvMsg ); + + // Wait for event + // 5. Wait for event. + SetupListenerReqCompleteL( wrapper, EXIMPTestStatusEvents_HandlePresentityPresence ); + // Wait for events + wrapper->WaitAnyEvent(); + wrapper->VerifyEventStackL( _L8("Handle presence watcher list. Wrong event occurred.") ); + + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); // allow events after reqcomplete + + // register interest + reqId = presPub.UnsubscribeOwnPresenceL(); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Subscribing own presence, complete with error: ") ); + +// TODO THINGSIES + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); // allow events after reqcomplete + + // register interest + reqId = presWatch.UnsubscribePresentityGroupMembersPresenceL( *identity ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Subscribing presentity group members presence, complete with error: ") ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestUnsubscribePresentityGroupMembersPresesenceCalled, "UnsubscribePresentityGroupMembersPresenceL was not called", ETrue, NULL ); + + CleanupStack::PopAndDestroy( 2, identity ); //pif, identity + + UnbindL(); + } + + +// =========================================================================== +// SETUP HELPERS FOR THE LISTENER +// =========================================================================== +// +void T_PresenceWatching::SetupListenerReqCompleteL( CXIMPTestContextWrapper* aWrapper, TXIMPTestStatusEventTemplate aEventType ) + { + RArray< TInt32 > array; + CleanupClosePushL( array ); + array.Append( MXIMPContextStateEvent::KInterfaceId ); + array.Append( MPresentityPresenceEvent::KInterfaceId ); + aWrapper->SetupListenerReqCompleteL( aEventType, &array ); + CleanupStack::PopAndDestroy(); // array + } + +void T_PresenceWatching::SetupListenerReqCompleteAllowEventsL( CXIMPTestContextWrapper* aWrapper, TXIMPTestStatusEventTemplate aEventType ) + { + RArray< TInt32 > array; + CleanupClosePushL( array ); + array.AppendL( MXIMPRequestCompleteEvent::KInterfaceId ); + array.AppendL( MXIMPContextStateEvent::KInterfaceId ); + array.AppendL( MPresentityPresenceEvent::KInterfaceId ); + aWrapper->SetupListenerReqCompleteL( aEventType, &array ); + CleanupStack::PopAndDestroy(); // array + } + +// =========================================================================== +// TEST CASE TABLE +// =========================================================================== +// +EUNIT_BEGIN_TEST_TABLE( + T_PresenceWatching, + "XIMP presence watching tests", + "MODULE" ) + +PRFW_DECORATED_TEST( + "Subscribe single presence", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_SubscribePresentityPresence_Single_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Subscribe single presence and handle the presence data with cache checking", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_SubscribeHandlePresentityPresence_Single_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Subscribe single presence change id", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_SubscribePresentityPresenceChangeId_Single_L, + Teardown ) + + +PRFW_DECORATED_TEST( + "Unsubscribe single presence", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_UnsubscribeNotSubscribedPresentityPresence_Single_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Unsubscribe multiple presence", + "", + "", + "FUNCTIONALITY", + SetupMultiple_L, + T_UnsubscribeNotSubscribedPresentityPresence_Multiple_L, + Teardown ) + + +PRFW_DECORATED_TEST( + "Error From Plugin -> Leave when presentity subscribe is called", + "", + "", + "ERROHANDLING", + Setup_L, + T_ErrFromPlg_LeaveOnSubscribePresentityPresence_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Error From Plugin -> Leave when presentity unsubscribe is called", + "", + "", + "ERROHANDLING", + Setup_L, + T_ErrFromPlg_LeaveOnUnsubscribePresentityPresence_L, + Teardown ) + + +PRFW_DECORATED_TEST( + "Subscribe multiple presence", + "", + "", + "FUNCTIONALITY", + SetupMultiple_L, + T_SubscribePresentityPresence_Multiple_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Subscribe group members single presence", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_SubscribePresentityGroupMembersPresence_Single_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Unsubscribe single group members presence", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_UnsubscribeNotSubscribedPresentityGroupMembersPresence_Single_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Unsubscribe multiple group members presence", + "", + "", + "FUNCTIONALITY", + SetupMultiple_L, + T_UnsubscribeNotSubscribedPresentityGroupMembersPresence_Multiple_L, + Teardown ) + + +PRFW_DECORATED_TEST( + "Subscribe multiple presence for group members", + "", + "", + "FUNCTIONALITY", + SetupMultiple_L, + T_SubscribeGroupMembersPresence_Multiple_L, + Teardown ) + + +PRFW_DECORATED_TEST( + "Error From Plugin -> Leave when presentity group members subscribe is called", + "", + "", + "ERROHANDLING", + Setup_L, + T_ErrFromPlg_LeaveOnSubscribePresentityGroupMembersPresence_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Error From Plugin -> Leave when presentity group members unsubscribe is called", + "", + "", + "ERROHANDLING", + Setup_L, + T_ErrFromPlg_LeaveOnUnsubscribePresentityGroupMembersPresence_L, + Teardown ) + + +PRFW_DECORATED_TEST( + "Handle group members single presence", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_ContentChangePresentityGroupMembersPresence_Single_L, + Teardown ) + + +EUNIT_END_TEST_TABLE + + +// =========================================================================== +// TEST SUITE CONSTRUCTION +// =========================================================================== +// +EXPORT_C MEUnitTest* CreateTestSuiteL() + { + return T_PresenceWatching::NewL(); + } + + +// end of file diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencewatching/t_presencewatching.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencewatching/t_presencewatching.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,108 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef T_PRESENCEWATCHING_H +#define T_PRESENCEWATCHING_H + +#include +#include +#include "prfwteststatuseventlistener.h" +#include "prfwtestmessaging.h" + +class CXIMPTestContextWrapper; +class CXIMPTestContextWrapperMgr; +class CXIMPTestMessenger; +class MPresenceCacheReader; + +/** + * XIMP Framework Eunit tests. + * + * Tests for XIMP session management services. + * + * @since S60 v4.0 + */ +class T_PresenceWatching : public CEUnitTestSuiteClass + { + +public: + static T_PresenceWatching* NewL(); + virtual ~T_PresenceWatching(); + + +private: + T_PresenceWatching(); + void ConstructL(); + + + +private: // Test case functions + + void Setup_L(); + void SetupMultiple_L(); + void BindL(); + void BindAllL(); + void Teardown(); + void UnbindL(); + void UnbindAllL(); + + void T_SubscribePresentityPresence_Single_L(); + void T_SubscribeHandlePresentityPresence_Single_L(); + void T_SubscribePresentityPresenceChangeId_Single_L(); + void T_UnsubscribeNotSubscribedPresentityPresence_Single_L(); + void T_UnsubscribeNotSubscribedPresentityPresence_Multiple_L(); + + void T_SubscribePresentityPresence_Multiple_L(); + void T_SubscribePresentityGroupMembersPresence_Single_L(); + void T_UnsubscribeNotSubscribedPresentityGroupMembersPresence_Single_L(); + void T_UnsubscribeNotSubscribedPresentityGroupMembersPresence_Multiple_L(); + void T_ContentChangePresentityGroupMembersPresence_Single_L(); + + void T_ErrFromPlg_LeaveOnSubscribePresentityPresence_L(); + void T_ErrFromPlg_LeaveOnSubscribePresentityGroupMembersPresence_L(); + void T_ErrFromPlg_LeaveOnUnsubscribePresentityPresence_L(); + void T_ErrFromPlg_LeaveOnUnsubscribePresentityGroupMembersPresence_L(); + + void T_SubscribeGroupMembersPresence_Multiple_L(); + +private: // Test helpers + + void SetupListenerReqCompleteL( CXIMPTestContextWrapper* aWrapper, TXIMPTestStatusEventTemplate aEventType ); + void SetupListenerReqCompleteAllowEventsL( CXIMPTestContextWrapper* aWrapper, TXIMPTestStatusEventTemplate aEventTypes ); + +private: // Test data + + /** + * Eunit test case table declaration. + */ + EUNIT_DECLARE_TEST_TABLE; + + // owned + CXIMPTestContextWrapperMgr* iWrapperMgr; + + MPresenceCacheReader* iMPresenceCacheReader; + }; + + +#endif // T_PRESENCEWATCHING_H + + + +// end of file + + + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencewatching/t_presencewatching.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_presencewatching/t_presencewatching.mmp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,59 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "../../tsrcutils/eunitcommon/eunittstdllbase.hrh" +#include "../../tsrcutils/processmaster/pm.h" + +TARGET t_presencewatching.dll +CAPABILITY ALL -TCB -DRM +SOURCEPATH . +SOURCE t_presencewatching.cpp + + +USERINCLUDE ../../../../../ximpfw/core/srcdatamodel +USERINCLUDE ../../../../../ximpfw/presence/srcpresencedatamodel +USERINCLUDE ../../../../../ximpfw/presence/srcpresencedatamodel/presentitygroups +USERINCLUDE ../../../../../ximpfw/presence/srcpresencedatamodel/presencewatching +USERINCLUDE ../../../../../ximpfw/presence/srcpresencedatamodel/presenceauthorization +USERINCLUDE ../../../../../ximpfw/presence/srcpresencedatamodel/presencepublishing +USERINCLUDE ../../../../../ximpfw/presence/srcpresencedatamodel/presenceinfo +USERINCLUDE ../../../../../ximpfw/core/srcutils + +USERINCLUDE ../../tsrcprotocols + +// TODO remove unnecessary +SYSTEMINCLUDE ../../../../../ximpfw/inc/core/base +SYSTEMINCLUDE ../../../../../ximpfw/inc/core/datamodel +SYSTEMINCLUDE ../../../../../ximpfw/inc/core/protocolplugin +SYSTEMINCLUDE ../../../../../ximpfw/inc/core/protocolpluginhost +SYSTEMINCLUDE ../../../../../ximpfw/inc/presence/presencedatamodel +SYSTEMINCLUDE ../../../../../ximpfw/inc/presence/presencemanagement +SYSTEMINCLUDE ../../../../../ximpfw/inc/presence/presenceprotocolplugin +SYSTEMINCLUDE ../../../../../ximpfw/inc/presence/presenceprotocolpluginhost + + +LIBRARY ecom.lib +LIBRARY bafl.lib +LIBRARY ximpdatamodel.lib +LIBRARY estor.lib +LIBRARY presencedatamodel.lib +LIBRARY ximputils.lib +LIBRARY EUnit.lib + +// end of file + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_rootservices/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_rootservices/bld.inf Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,23 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Build information file for t_rootservices.dll +* +*/ + + +PRJ_PLATFORMS +DEFAULT + +PRJ_TESTMMPFILES +t_rootservices.mmp diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_rootservices/t_rootservices.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_rootservices/t_rootservices.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,221 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "t_rootservices.h" + +#include "eunittools.h" +#include +#include +#include + +//XIMP headers +#include +#include +#include +#include + +#include "prfwtestrobustnesstools.h" +#include "prfwtestprotocols.h" + + + +// ============================ MEMBER FUNCTIONS =============================== + +// CONSTRUCTION +T_RootServices* T_RootServices::NewL() + { + T_RootServices* self = new( ELeave ) T_RootServices; + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + + return self; + } + + +T_RootServices::~T_RootServices() + { + } + + +void T_RootServices::ConstructL() + { + CEUnitTestSuiteClass::ConstructL(); + } + + +T_RootServices::T_RootServices() + { + } + + + +// =========================================================================== +// TEST CASE SETUP & TEARDOWN METHODS +// =========================================================================== +// +void T_RootServices::Setup_L() + { + PrfwTestRobustness::DoPreCleaning(); + } + + + +void T_RootServices::Teardown() + { + REComSession::FinalClose(); + PrfwTestRobustness::DoPreCleaning(); + } + + + +// =========================================================================== +// USAGE SCENARIO: +// +// =========================================================================== +// +void T_RootServices::Test_ListProtocolsAndTheirCapabilities_L() + { + //Initialize XIMP client + MXIMPClient* presClient = MXIMPClient::NewClientL(); + CleanupDeletePushL( presClient ); + + RXIMPObjOwningPtrArray< MXIMPProtocolInfo > protocolList; + CleanupClosePushL( protocolList ); + + //List & dump all available protocols + presClient->GetProtocolsL( protocolList ); + __DumpProtocolListL( protocolList ); + + //Verify that atleast main test protocol exist in list + //And for it is reported corect properties + TBool mainTestProtocolFound( EFalse ); + for ( TInt index( 0 ); index < protocolList.Count(); index++ ) + { + MXIMPProtocolInfo& protocol = *protocolList[ index ]; + if (protocol.DisplayName() == K_PRFW_TST_PROTOCOL_1_DISPLAY_NAME ) + { + if ( protocol.ImplementationUid() == TUid::Uid( K_PRFW_TST_PROTOCOL_1_IMPLEMENTATION_UID ) ) + { + mainTestProtocolFound = ETrue; + break; + } + } + } + + EUNIT_ASSERT_DESC( mainTestProtocolFound, "Primary test protocol not found." ); + + CleanupStack::PopAndDestroy(); //protocolList + CleanupStack::PopAndDestroy(); //presClient + } + + + + +// =========================================================================== +// HELPERS +// =========================================================================== +// +void T_RootServices::__DumpProtocolListL( + RXIMPObjOwningPtrArray< MXIMPProtocolInfo >& aProtocolList ) + { + const TInt count = aProtocolList.Count(); + EUNIT_PRINT( _L( "Dumping %d protocols:"), count ); + + //Iterate through the list of protocols and dump details + for( TInt ix = 0; ix < count; ix++ ) + { + MXIMPProtocolInfo& protocol = *aProtocolList[ ix ]; + MXIMPFeatureInfo* feats = protocol.GetProtocolFeaturesLC(); + + { + TBuf< 1000 > buffer; + + //Print protocol details + buffer.AppendFormat( _L(" Protocol %d: [%08x] [%S]"), + ix, + protocol.ImplementationUid(), + &protocol.DisplayName() ); + EUNIT_PRINT( buffer ); + + + //Print feature details + const MDesC8Array& featureIds = feats->FeatureIds(); + + const TInt featCount = featureIds.MdcaCount(); + buffer.Zero(); + buffer.AppendFormat( _L(" Supported features %d: "), featCount ); + + for( TInt ix = 0; ix < featCount; ix++ ) + { + TBuf< 50 > tmpBuf; + tmpBuf.Copy( featureIds.MdcaPoint( ix ) ); + buffer.AppendFormat( _L("%S "), &tmpBuf ); + } + + EUNIT_PRINT( buffer ); + } + + CleanupStack::PopAndDestroy(); //feats + } + } + + + + +// =========================================================================== +// TEST CASE TABLE +// =========================================================================== +// +EUNIT_BEGIN_TEST_TABLE( + T_RootServices, + "XIMP root services", + "MODULE" ) + + PRFW_NOT_DECORATED_TEST( + "List available protocols and their capabilities", + "", + "", + "FUNCTIONALITY", + Setup_L, + Test_ListProtocolsAndTheirCapabilities_L, + Teardown ) + + +EUNIT_END_TEST_TABLE + + + + + +// =========================================================================== +// TEST SUITE CONSTRUCTION +// =========================================================================== +// +EXPORT_C MEUnitTest* CreateTestSuiteL() + { + return T_RootServices::NewL(); + } + + +// end of file + + + + + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_rootservices/t_rootservices.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_rootservices/t_rootservices.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,85 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef T_ROOTSERVICES_H__ +#define T_ROOTSERVICES_H__ + +#include +#include + +class MXIMPProtocolInfo; +class MXIMPClient; +class MXIMPContext; +class CUSContextObserver; + + +/** + * XIMP Framework Eunit tests. + * + * Tests for XIMP root services. + * + * @since S60 v3.2 + */ +class T_RootServices : public CEUnitTestSuiteClass + { +public: + static T_RootServices* NewL(); + virtual ~T_RootServices(); + + +private: + T_RootServices(); + void ConstructL(); + + + +private: // Test case functions + + void Setup_L(); + void Teardown(); + + void Test_ListProtocolsAndTheirCapabilities_L(); + + +private: // Test helpers + + void __DumpProtocolListL( + RXIMPObjOwningPtrArray< MXIMPProtocolInfo >& aProtocolList ); + + + +private: // Test data + + + /** + * Eunit test case table declaration. + */ + EUNIT_DECLARE_TEST_TABLE; + + + }; + + +#endif // T_ROOTSERVICES_H__ + + + +// end of file + + + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_rootservices/t_rootservices.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_rootservices/t_rootservices.mmp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,43 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "../../tsrcutils/eunitcommon/eunittstdllbase.hrh" +#include "../../tsrcutils/processmaster/pm.h" + +TARGET t_rootservices.dll +CAPABILITY ALL -TCB +SOURCEPATH . +SOURCE t_rootservices.cpp + +USERINCLUDE ../../../../../ximpfw/core/srcdatamodel +USERINCLUDE ../../../../../ximpfw/presence/srcpresencedatamodel +USERINCLUDE ../../../../../ximpfw/presence/srcpresencedatamodel/presentitygroups +USERINCLUDE ../../../../../ximpfw/presence/srcpresencedatamodel/presencewatching +USERINCLUDE ../../../../../ximpfw/presence/srcpresencedatamodel/presenceauthorization +USERINCLUDE ../../../../../ximpfw/presence/srcpresencedatamodel/presencepublishing +USERINCLUDE ../../../../../ximpfw/presence/srcpresencedatamodel/presenceinfo +USERINCLUDE ../../../../../ximpfw/core/srcutils + + +USERINCLUDE ../../tsrcprotocols + +LIBRARY ecom.lib +LIBRARY bafl.lib +LIBRARY EUnit.lib +// end of file + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_sessionmng/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_sessionmng/bld.inf Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,23 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Build information file for t_sessionmng.dll +* +*/ + + +PRJ_PLATFORMS +DEFAULT + +PRJ_TESTMMPFILES +t_sessionmng.mmp diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_sessionmng/t_sessionmng.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_sessionmng/t_sessionmng.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,872 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include +#include +#include +#include + +#include "t_sessionmng.h" +#include "prfwteststatuseventlistener.h" +#include "prfwtestmessaging.h" +#include "prfwtestmessenger.h" +#include "prfwtestcontextwrappermgr.h" +#include "prfwtestcontextwrapper.h" +#include "prfwtestfiletool.h" +#include "userafter.h" + +#include "eunittools.h" +#include "prfwtestrobustnesstools.h" +#include "prfwtestprotocols.h" + +#include +#include +#include +#include +#include +#include +#include + + + + + + + +// ============================ MEMBER FUNCTIONS =============================== + +// CONSTRUCTION +T_SessionMng* T_SessionMng::NewL() + { + T_SessionMng* self = new( ELeave ) T_SessionMng; + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + + return self; + } + + +T_SessionMng::~T_SessionMng() + { + delete iWrapperMgr; + + CXIMPTestFileTool::CleanAllL(); + } + + +void T_SessionMng::ConstructL() + { + CEUnitTestSuiteClass::ConstructL(); + CXIMPTestFileTool::CleanAllL(); + } + + +T_SessionMng::T_SessionMng() + { + } + + + +// =========================================================================== +// TEST CASE SETUP & TEARDOWN METHODS +// =========================================================================== +// + +void T_SessionMng::Setup_L() + { + PrfwTestRobustness::DoPreCleaning(); + + // now we're using only one connection + iWrapperMgr = CXIMPTestContextWrapperMgr::NewL(); + iWrapperMgr->CreateWrapperL(); + } + + +void T_SessionMng::Setup_2_L() + { + iWrapperMgr = CXIMPTestContextWrapperMgr::NewL(); + + // two wrappers + iWrapperMgr->CreateWrapperL(); + iWrapperMgr->CreateWrapperL(); + } + + +void T_SessionMng::Setup_3_L() + { + iWrapperMgr = CXIMPTestContextWrapperMgr::NewL(); + + // three wrappers for unbalanced bind/share unbind/unshare test + iWrapperMgr->CreateWrapperL(); + iWrapperMgr->CreateWrapperL(); + iWrapperMgr->CreateWrapperL(); + } + + +void T_SessionMng::Teardown() + { + delete iWrapperMgr; + iWrapperMgr = NULL; + + REComSession::FinalClose(); + + PrfwTestRobustness::DoPreCleaning(); + } + + + +// =========================================================================== +// TEST CASE +// =========================================================================== +void T_SessionMng::T_Simple_Bind_Wait_Unbind_L() + { + EUNIT_PRINT( _L("Simple context Bind/Unbind test.") ); + EUNIT_PRINT( _L("Client side waits bind completion before issuing unbind.") ); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestStatusEventListener* eventListener = wrapper->GetEventListener(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + //Do bind, wait and verify events + wrapper->SetupListenerL( EXIMPTestStatusEvents_BindingOk ); + + messenger->SetPluginIndex( 0 ); + messenger->SetNoError(); + + TXIMPRequestId reqId; + reqId = BindContextToDefaultL( context ); + EUNIT_ASSERT( reqId != TXIMPRequestId::Null() ); + + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Binding single context: ") ); + + messenger->AssertOpenSessionCalled( ETrue ); + + //Verify features availability + MXIMPFeatureInfo* ctxFeats = context->GetContextFeaturesLC(); + EUNIT_ASSERT_DESC( ctxFeats->FeatureIds().MdcaCount() > 0, "No features from context" ); + CleanupStack::PopAndDestroy(); //ctxFeats + + //Do unbind, wait and verify events + wrapper->SetupListenerL( EXIMPTestStatusEvents_UnbindingOk ); + messenger->SetNoError(); + reqId = context->UnbindL(); + EUNIT_ASSERT( reqId != TXIMPRequestId::Null() ); + + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Unbinding single context: ") ); + + messenger->AssertCloseSessionCalled( ETrue ); + messenger->AssertPluginDied( ETrue ); + } + +// =========================================================================== +// TEST CASE +// =========================================================================== +void T_SessionMng::T_Settings_Bind_Wait_Unbind_L() + { + EUNIT_PRINT( _L("Context Bind with Settings id/Unbind test.") ); + EUNIT_PRINT( _L("Client side waits bind completion before issuing unbind.") ); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestStatusEventListener* eventListener = wrapper->GetEventListener(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + //Do bind, wait and verify events + wrapper->SetupListenerL( EXIMPTestStatusEvents_BindingOk ); + + messenger->SetPluginIndex( 0 ); + messenger->SetNoError(); + + TXIMPRequestId reqId; + TUid protocol = { K_PRFW_TST_PROTOCOL_1_IMPLEMENTATION_UID }; + reqId = context->BindToL( protocol, 0 ); + + EUNIT_ASSERT( reqId != TXIMPRequestId::Null() ); + + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Binding single context: ") ); + + messenger->AssertOpenSessionCalled( ETrue ); + + //Verify features availability + MXIMPFeatureInfo* ctxFeats = context->GetContextFeaturesLC(); + EUNIT_ASSERT_DESC( ctxFeats->FeatureIds().MdcaCount() > 0, "No features from context" ); + CleanupStack::PopAndDestroy(); //ctxFeats + + //Do unbind, wait and verify events + wrapper->SetupListenerL( EXIMPTestStatusEvents_UnbindingOk ); + messenger->SetNoError(); + reqId = context->UnbindL(); + EUNIT_ASSERT( reqId != TXIMPRequestId::Null() ); + + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Unbinding single context: ") ); + + messenger->AssertCloseSessionCalled( ETrue ); + messenger->AssertPluginDied( ETrue ); + } + + +// =========================================================================== +// TEST CASE +// =========================================================================== +void T_SessionMng::T_Simple_Bind_Wait_OOM_L() + { + EUNIT_PRINT( _L("Simple context Bind OOM test.") ); + EUNIT_PRINT( _L("Client side waits bind completion in alloc heaven.") ); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + //Do bind, wait and verify events + wrapper->SetupListenerReqCompleteL( EXIMPTestStatusEvents_RequestOk ); + + messenger->SetPluginIndex( 0 ); + messenger->SetNoError(); + + TXIMPRequestId reqId; + reqId = BindContextToDefaultL( context ); + EUNIT_ASSERT( reqId != TXIMPRequestId::Null() ); + + wrapper->WaitRequestAndStackEvents( reqId ); + + CXIMPTestStatusEventListener* eventListener = wrapper->GetEventListener(); + TInt reqCompleteErr = eventListener->GetReqCompletionErrL( reqId ); + User::LeaveIfError( reqCompleteErr ); + + wrapper->VerifyEventStackL( _L8("Binding single context in OOM: ") ); + } + + +// =========================================================================== +// TEST CASE +// =========================================================================== +void T_SessionMng::T_Simple_Bind_Wait_Unbind_WithReqCompleteEventFilter_L() + { + EUNIT_PRINT( _L("Simple context Bind/Unbind test.") ); + EUNIT_PRINT( _L("Client side waits bind completion before issuing unbind.") ); + EUNIT_PRINT( _L("Client event filter accepts only request completion events") ); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestStatusEventListener* eventListener = wrapper->GetEventListener(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + //Accept only ReqComplete events + wrapper->SetupListenerReqCompleteL( EXIMPTestStatusEvents_RequestOk ); + + messenger->SetPluginIndex( 0 ); + messenger->SetNoError(); + + + //Do bind, wait and verify events + TXIMPRequestId reqId = BindContextToDefaultL( context ); + + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Binding single context, accepting only reqComplete events: ") ); + messenger->AssertOpenSessionCalled( ETrue ); + + + //Accept only ReqComplete events + wrapper->SetupListenerReqCompleteL( EXIMPTestStatusEvents_RequestOk ); + messenger->SetNoError(); + + //Do unbind, wait and verify events + reqId = context->UnbindL(); + + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Unbinding single context, accepting only reqComplete events: ") ); + + messenger->AssertCloseSessionCalled( ETrue ); + } + + + +// =========================================================================== +// TEST CASE +// =========================================================================== +// +void T_SessionMng::T_Simple_Bind_Wait_CloseHandle_L() + { + EUNIT_PRINT( _L("Simple context Bind/CloseHandle test.") ); + EUNIT_PRINT( _L("Client side waits bind completion before closing the handle.") ); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestStatusEventListener* eventListener = wrapper->GetEventListener(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + //Do bind, wait and verify events + wrapper->SetupListenerL( EXIMPTestStatusEvents_BindingOk ); + + messenger->SetPluginIndex( 0 ); + messenger->SetNoError(); + + TXIMPRequestId reqId = BindContextToDefaultL( context ); + + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Binding single context: ") ); + + messenger->AssertOpenSessionCalled( ETrue ); + + + //Close handle and verify events + wrapper->ClearListener(); + messenger->SetNoError(); + wrapper->DeletePresenceContext(); + + + // we give 10 sec to plugin to die + CUserAfter::AfterSecondsL( 10 ); + + + messenger->AssertCloseSessionCalled( ETrue ); + messenger->AssertPluginDied( ETrue ); + + wrapper->VerifyEventStackL( _L8("Closing single context handle: ") ); + } + + + +// =========================================================================== +// TEST CASE +// =========================================================================== +// +void T_SessionMng::T_Simple_Bind_Direct_Unbind_L() + { + EUNIT_PRINT( _L("Simple context Bind/Unbind test.") ); + EUNIT_PRINT( _L("Client side deletes context while the binding is still active.") ); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestStatusEventListener* eventListener = wrapper->GetEventListener(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + wrapper->SetupListenerL( EXIMPTestStatusEvents_BindingOk ); + wrapper->AppendToTraitsL( EXIMPTestStatusEvents_UnbindingOk ); + + + messenger->SetPluginIndex( 0 ); + messenger->SetNoError(); //For binding + + + TXIMPRequestId bindReqId = BindContextToDefaultL( context ); + + + messenger->AssertOpenSessionCalled( ETrue ); + + messenger->SetNoError(); // for unbinding + TXIMPRequestId unbindReqId = context->UnbindL(); + + wrapper->WaitRequestAndStackEvents( bindReqId ); + wrapper->WaitRequestAndStackEvents( unbindReqId ); + + wrapper->VerifyEventStackL( _L8("Direct Bind/Unbind single context: ") ); + + messenger->AssertCloseSessionCalled( ETrue ); + messenger->AssertPluginDied( ETrue ); + } + + + + +// =========================================================================== +// TEST CASE +// =========================================================================== +// +void T_SessionMng::T_Simple_Bind_Direct_CloseHandle_L() + { + EUNIT_PRINT( _L("Simple context Bind/Unbind test.") ); + EUNIT_PRINT( _L("Client side closes context handle while the binding is still active.") ); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestStatusEventListener* eventListener = wrapper->GetEventListener(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + + messenger->SetPluginIndex( 0 ); + messenger->SetNoError(); + + + TXIMPRequestId reqId = BindContextToDefaultL( context ); + + messenger->AssertOpenSessionCalled( ETrue ); + wrapper->DeletePresenceContext(); + + // wait for plugin to die properly here + CUserAfter::AfterSecondsL( 10 ); + + messenger->AssertCloseSessionCalled( ETrue ); + messenger->AssertPluginDied( ETrue ); + } + + + + +// =========================================================================== +// TEST CASE +// =========================================================================== +// +void T_SessionMng::T_ErrFromPlg_LeaveOnOpenSession_L() + { + EUNIT_PRINT( _L("Error from plug-in in bind/unbind." ) ); + EUNIT_PRINT( _L("Plug-in leaves from OpenSessionL()." ) ); + + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestStatusEventListener* eventListener = wrapper->GetEventListener(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + { + wrapper->SetupListenerL( EXIMPTestStatusEvents_BindingFailKErrAbort ); + messenger->SetLeave( KErrAbort ); + messenger->SetPluginIndex( 0 ); + + TXIMPRequestId reqId = BindContextToDefaultL( context ); + + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Binding single context: ") ); + + //Verify that features are not available + TRAPD( featLoadErr, + MXIMPFeatureInfo* ctxFeats = context->GetContextFeaturesLC(); + CleanupStack::PopAndDestroy(); //ctxFeats + ); + EUNIT_ASSERT_NOT_EQUALS( featLoadErr, KErrNone ); + + // plugin should've been unloaded without calling CloseSession + EUNIT_ASSERT_DESC( ! messenger->GetBoolean( EXIMPPlgTestCloseSessionCalled ), "CloseSession was called" ); + + messenger->AssertPluginDied( ETrue ); + } + } + + +// =========================================================================== +// TEST CASE: +// =========================================================================== +// +void T_SessionMng::T_ErrFromPlg_ErrorResultOnOpenSession_L() + { + EUNIT_PRINT( _L("Error from plug-in in bind/unbind") ); + EUNIT_PRINT( _L("Plug-in completes OpenSessionL() with error") ); + EUNIT_PRINT( _L("Clint ctx can be reused for second bind.") ); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestStatusEventListener* eventListener = wrapper->GetEventListener(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + { + wrapper->SetupListenerL( EXIMPTestStatusEvents_BindingFailKErrAbort ); + + messenger->SetError( KErrAbort ); + + messenger->SetPluginIndex( 0 ); + + TXIMPRequestId reqId = BindContextToDefaultL( context ); + + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Binding single context: ") ); + + + // plugin should've been unloaded without calling CloseSession + EUNIT_ASSERT_DESC( ! messenger->GetBoolean( EXIMPPlgTestCloseSessionCalled ), "CloseSession was called" ); + messenger->AssertPluginDied( ETrue ); + } + + + //It should be possible to reuse client ctx for second bind + { + //Do bind, wait and verify events + wrapper->SetupListenerL( EXIMPTestStatusEvents_BindingOk ); + + messenger->SetPluginIndex( 0 ); + messenger->SetNoError(); + + TXIMPRequestId reqId; + reqId = BindContextToDefaultL( context ); + EUNIT_ASSERT( reqId != TXIMPRequestId::Null() ); + + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Binding single context: ") ); + + messenger->AssertOpenSessionCalled( ETrue ); + + //Verify features availability + MXIMPFeatureInfo* ctxFeats = context->GetContextFeaturesLC(); + EUNIT_ASSERT_DESC( ctxFeats->FeatureIds().MdcaCount() > 0, "No features from context" ); + CleanupStack::PopAndDestroy(); //ctxFeats + + //Do unbind, wait and verify events + wrapper->SetupListenerL( EXIMPTestStatusEvents_UnbindingOk ); + messenger->SetNoError(); + reqId = context->UnbindL(); + EUNIT_ASSERT( reqId != TXIMPRequestId::Null() ); + + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Unbinding single context: ") ); + + messenger->AssertCloseSessionCalled( ETrue ); + messenger->AssertPluginDied( ETrue ); + } + } + + +// =========================================================================== +// TEST CASE: +// Simple bind, bind error +// =========================================================================== +// +void T_SessionMng::T_ErrFromPlg_InvalidReqIdOnOpenSession_L() + { + EUNIT_PRINT( _L("Error from plug-in in bind/unbind") ); + EUNIT_PRINT( _L("Plug-in completes OpenSessionL() with faulty ReqId") ); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestStatusEventListener* eventListener = wrapper->GetEventListener(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + { + wrapper->SetupListenerL( EXIMPTestStatusEvents_BindingFailInvalidReqId ); + messenger->SetBoolean( EXIMPTestPlgBehaveInvalidReqId ); + messenger->SetPluginIndex( 0 ); + + TXIMPRequestId reqId = BindContextToDefaultL( context ); + + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Binding single context: ") ); + } + + } + + + +// =========================================================================== +// TEST CASE: +// =========================================================================== +// +void T_SessionMng::T_ErrFromPlg_ErrorResultOnCloseSession_L() + { + EUNIT_PRINT( _L("Error from plug-in in bind/unbind") ); + EUNIT_PRINT( _L("Plug-in completes CloseSession() with error") ); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestStatusEventListener* eventListener = wrapper->GetEventListener(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + //Do bind, wait and verify events + wrapper->SetupListenerL( EXIMPTestStatusEvents_BindingOk ); + + messenger->SetNoError(); + + messenger->SetPluginIndex( 0 ); + + TXIMPRequestId reqId = BindContextToDefaultL( context ); + + + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Binding single context: ") ); + + messenger->AssertOpenSessionCalled( ETrue ); + + //Do unbind, wait and verify events + wrapper->SetupListenerL( EXIMPTestStatusEvents_UnbindingOk ); + + messenger->SetError( KErrCouldNotDisconnect ); + reqId = context->UnbindL(); + + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Unbinding single context: ") ); + + messenger->AssertPluginDied( ETrue ); + } + + + + + +// =========================================================================== +// TEST CASE +// =========================================================================== +// +void T_SessionMng::T_Multi_Bind_Unbind_WithWaits_L() + { + EUNIT_PRINT( _L("Multiple context Bind/Unbind test.") ); + EUNIT_PRINT( _L("Client performs multiple bind & unbinds for a separated context sharing a connection.") ); + + TInt ix; + + // bind contexts + for ( ix = 0; ix < 3; ix++ ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( ix ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestStatusEventListener* eventListener = wrapper->GetEventListener(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + if ( ix == 1 ) + { + // fail the middle one + wrapper->SetupListenerL( EXIMPTestStatusEvents_BindingFailKErrAbort ); + messenger->SetError( KErrAbort ); // for binding + } + else + { + wrapper->SetupListenerL( EXIMPTestStatusEvents_BindingOk ); + messenger->SetNoError(); // for binding + } + + messenger->SetPluginIndex( ix ); + + TUid protocol = { K_PRFW_TST_PROTOCOL_1_IMPLEMENTATION_UID }; + const TDesC16& instanceId = wrapper->InstanceId(); + TXIMPRequestId reqId = context->BindToL( protocol, + _L("www.imps.no/wv"), + _L("user"), + _L("password"), + instanceId, + ix ); + + wrapper->WaitRequestAndStackEvents( reqId ); + + TBuf8<100> title; + title.AppendFormat( _L8("Bind [%d]: "), ix ); + wrapper->VerifyEventStackL( title ); + + switch ( ix ) + { + case 0 : + case 1 : + case 2 : + { + messenger->AssertOpenSessionCalled( ETrue ); + break; + } + default : + { + break; + } + } + } + + + // now context has been bound. + // one has failed, but two are okay. do 3 unbinds. + for( ix = 0; ix < 3; ix++ ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( ix ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestStatusEventListener* eventListener = wrapper->GetEventListener(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + if ( ix == 1 ) + { + // the middle one has failed + TRAPD( err, context->UnbindL() ); + EUNIT_ASSERT_EQUALS( err, KErrNotReady ); + } + + else + { + // we expect all unbinds to be okay from client point of view + wrapper->SetupListenerL( EXIMPTestStatusEvents_UnbindingOk ); + messenger->SetNoError(); // For unbinding + + TXIMPRequestId reqId = context->UnbindL(); + wrapper->WaitRequestAndStackEvents( reqId ); + + TBuf8<100> title; + title.AppendFormat( _L8("Unbind [%d]: "), ix ); + wrapper->VerifyEventStackL( title ); + messenger->AssertCloseSessionCalled( ETrue ); + } + } + } + + +TXIMPRequestId T_SessionMng::BindContextToDefaultL( MXIMPContext* aContext ) + { + TUid protocol = { K_PRFW_TST_PROTOCOL_1_IMPLEMENTATION_UID }; + return aContext->BindToL( protocol, + _L("www.imps.no/wv"), + _L("user"), + _L("password"), + 0 ); + } + + + +// =========================================================================== +// TEST CASE TABLE +// =========================================================================== +// +EUNIT_BEGIN_TEST_TABLE( + T_SessionMng, + "XIMP session management tests", + "MODULE" ) + + +PRFW_NOT_DECORATED_TEST( + "Simple bind wait unbind", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_Simple_Bind_Wait_Unbind_L, + Teardown ) + + PRFW_NOT_DECORATED_TEST( + "Settings bind wait unbind", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_Settings_Bind_Wait_Unbind_L, + Teardown ) + +EUNIT_ALLOC_TEST( + "Simple bind in OOM", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_Simple_Bind_Wait_OOM_L, + Teardown ) + + +PRFW_NOT_DECORATED_TEST( + "Simple bind wait unbind with reqComplete event filter", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_Simple_Bind_Wait_Unbind_WithReqCompleteEventFilter_L, + Teardown ) + +PRFW_NOT_DECORATED_TEST( + "Simple bind wait close handle", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_Simple_Bind_Wait_CloseHandle_L, + Teardown ) + + +PRFW_NOT_DECORATED_TEST( + "Simple bind direct unbind", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_Simple_Bind_Direct_Unbind_L, + Teardown ) + + +PRFW_NOT_DECORATED_TEST( + "Simple bind direct close handle", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_Simple_Bind_Direct_CloseHandle_L, + Teardown ) + + +// opensession errors +PRFW_NOT_DECORATED_TEST( + "ErrFromPlg leave OpenSession", + "", + "", + "ERROHANDLING", + Setup_L, + T_ErrFromPlg_LeaveOnOpenSession_L, + Teardown ) + +PRFW_NOT_DECORATED_TEST( + "ErrFromPlg OpenSession", + "", + "", + "ERROHANDLING", + Setup_L, + T_ErrFromPlg_ErrorResultOnOpenSession_L, + Teardown ) + + + +PRFW_NOT_DECORATED_TEST( + "ErrFromPlg Invalid ReqId", + "", + "", + "ERROHANDLING", + Setup_L, + T_ErrFromPlg_InvalidReqIdOnOpenSession_L, + Teardown ) + + +// closesession errors +PRFW_NOT_DECORATED_TEST( + "ErrFromPlg CloseSession", + "", + "", + "ERROHANDLING", + Setup_L, + T_ErrFromPlg_ErrorResultOnCloseSession_L, + Teardown ) + + +// multiple bind + unbind tests +PRFW_NOT_DECORATED_TEST( + "Multiple context Bind/Unbind test.", + "", + "", + "ERROHANDLING", + Setup_3_L, + T_Multi_Bind_Unbind_WithWaits_L, + Teardown ) + + +EUNIT_END_TEST_TABLE + + +// =========================================================================== +// TEST SUITE CONSTRUCTION +// =========================================================================== +// +EXPORT_C MEUnitTest* CreateTestSuiteL() + { + return T_SessionMng::NewL(); + } + + +// end of file + + + + + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_sessionmng/t_sessionmng.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_sessionmng/t_sessionmng.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,110 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef T_SESSIONMNG_H__ +#define T_SESSIONMNG_H__ + +#include +#include + +#include "prfwteststatuseventlistener.h" + + +class CXIMPTestContextWrapperMgr; +class MXIMPContext; + +/** + * XIMP Framework Eunit tests. + * + * Tests for XIMP session management services. + * + * @since S60 v4.0 + */ +class T_SessionMng : public CEUnitTestSuiteClass + { + +public: + static T_SessionMng* NewL(); + virtual ~T_SessionMng(); + + +private: + T_SessionMng(); + void ConstructL(); + + + +private: // Test case functions + + void Teardown(); + + void Setup_L(); + void Setup_2_L(); + void Setup_3_L(); + + + void T_Simple_Bind_Wait_Unbind_L(); + void T_Settings_Bind_Wait_Unbind_L(); + void T_Simple_Bind_Wait_OOM_L(); + + void T_Simple_Bind_Wait_Unbind_WithReqCompleteEventFilter_L(); + void T_Simple_Bind_Wait_CloseHandle_L(); + void T_Simple_Bind_Direct_Unbind_L(); + void T_Simple_Bind_Direct_CloseHandle_L(); + + + + void T_ErrFromPlg_LeaveOnOpenSession_L(); + void T_ErrFromPlg_ErrorResultOnOpenSession_L(); + void T_ErrFromPlg_ErrorResultOnCloseSession_L(); + + void T_ErrFromPlg_InvalidReqIdOnOpenSession_L(); + void T_Multi_Bind_Unbind_WithWaits_L(); + + + +private: // Test helpers + + TXIMPRequestId BindContextToDefaultL( MXIMPContext* aContext ); + + + + + +private: // Test data + + /** + * Eunit test case table declaration. + */ + EUNIT_DECLARE_TEST_TABLE; + + /** + * Context Wrapper Manager + */ + CXIMPTestContextWrapperMgr* iWrapperMgr; + + }; + +#endif // T_SESSIONMNG_H__ + + + +// end of file + + + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_sessionmng/t_sessionmng.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_sessionmng/t_sessionmng.mmp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,44 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "../../tsrcutils/eunitcommon/eunittstdllbase.hrh" +#include "../../tsrcutils/processmaster/pm.h" + +TARGET t_sessionmng.dll +CAPABILITY ALL -TCB +SOURCEPATH . +SOURCE t_sessionmng.cpp + +USERINCLUDE ../../../../../ximpfw/core/srcdatamodel +USERINCLUDE ../../../../../ximpfw/presence/srcpresencedatamodel +USERINCLUDE ../../../../../ximpfw/presence/srcpresencedatamodel/presentitygroups +USERINCLUDE ../../../../../ximpfw/presence/srcpresencedatamodel/presencewatching +USERINCLUDE ../../../../../ximpfw/presence/srcpresencedatamodel/presenceauthorization +USERINCLUDE ../../../../../ximpfw/presence/srcpresencedatamodel/presencepublishing +USERINCLUDE ../../../../../ximpfw/presence/srcpresencedatamodel/presenceinfo +USERINCLUDE ../../../../../ximpfw/core/srcutils +USERINCLUDE ../../tsrcprotocols + + +LIBRARY ecom.lib +LIBRARY bafl.lib +LIBRARY ximpdatamodel.lib +LIBRARY presencedatamodel.lib +LIBRARY EUnit.lib +// end of file + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_utils/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_utils/bld.inf Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,23 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Build information file for t_utils.dll + * +*/ + + +PRJ_PLATFORMS +DEFAULT + +PRJ_TESTMMPFILES +t_utils.mmp diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_utils/t_utils.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_utils/t_utils.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,641 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +#include +#include +#include +#include +#include +#include + +#include "t_utils.h" + +#include "eunittools.h" + +#include +#include + +#include "ximpeventcodec.h" +#include "ownpresenceeventimp.h" +#include "prfwtestfiletool.h" +#include "ximppanics.h" + +#include "prfwtestrobustnesstools.h" + +#include "ximpobjectfactoryimp.h" +#include "ximpobjectcollection.h" +#include "ximprestrictedobjectcollection.h" +#include "ximpidentityimp.h" +#include "ximpstatusimp.h" +#include "ximprequestidbuilder.h" + + + +// ============================ MEMBER FUNCTIONS =============================== + +// CONSTRUCTION +T_Utils* T_Utils::NewL() + { + T_Utils* self = new( ELeave ) T_Utils; + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + + return self; + } + + +T_Utils::~T_Utils() + { + } + + +void T_Utils::ConstructL() + { + CEUnitTestSuiteClass::ConstructL(); + } + + +T_Utils::T_Utils() + { + } + +// =========================================================================== +// TEST CASE SETUP & TEARDOWN METHODS +// =========================================================================== +// + +void T_Utils::Setup_L() + { + } + +void T_Utils::Teardown() + { + } + +// =========================================================================== +// TEST CASE +// =========================================================================== +void T_Utils::T_FileToolTest_L() + { + // TODO add more brains to the test + EUNIT_PRINT( _L("FileTool test.") ); + + /* + CXIMPTestFileTool* tool = CXIMPTestFileTool::NewL(); + CleanupStack::PushL( tool ); + tool->CleanL( 0 ); + tool->PrepareL( 0 ); + TInt files = tool->NumObjectsL( 0 ); + + EUNIT_ASSERT_DESC( files == 0, "Non-zero count of files, Clean or Prepare did not work" ); + + // make a proper object and store it. + MPresenceInfo::TPresenceInfoStatus status; + status = MPresenceInfo::EDataSubscriptionPending; + COwnPresenceEventImp* event = COwnPresenceEventImp::NewLC( status ); + + CBufFlat* buf = CBufFlat::NewL( 50 ); + CleanupStack::PushL( buf ); + TInt32 eventType = 0; + XIMPEventCodec::PackL( *event, eventType, buf ); + HBufC8* extObj = buf->Ptr( 0 ).AllocLC(); + + // create more objects + tool->StoreL( 0, *extObj ); + tool->StoreL( 0, *extObj ); + tool->StoreL( 0, *extObj ); + tool->StoreL( 0, *extObj ); + tool->StoreL( 0, *extObj ); + + files = tool->NumObjectsL( 0 ); + EUNIT_ASSERT_DESC( files == 5, "Bad count of files" ); + + COwnPresenceEventImp* object = static_cast( tool->RestoreLC( 0, 2 ) ); + EUNIT_ASSERT_DESC( status == object->Status(), "Wrong status from restored object." ); + + CleanupStack::PopAndDestroy( 4, event ); // object, extObj, buf, event + + CleanupStack::PopAndDestroy( tool ); + */ + } + +// =========================================================================== +// TEST CASE +// =========================================================================== +void T_Utils::T_KillServers_L() + { + EUNIT_PRINT( _L("Utility to kill the servers. Always succeeds.") ); + + PrfwTestRobustness::DoPreCleaning(); + } + +_LIT8( KTestObjectName, "John Doe" ); // regular +_LIT8( KTestObjectName2, "Jane Doe" ); // regular +_LIT8( KTestObjectNameWC, "Jo* Doe" ); // wildcards +_LIT8( KTestObjectNameWC2, "Ja* Doe" ); // wildcards + +_LIT( KIdentity1, "Identity 1" ); +_LIT( KIdentity2, "Identity 2" ); + +// =========================================================================== +// TEST CASE +// =========================================================================== +void T_Utils::T_ObjectCollection_Unnamed_L() + { + EUNIT_PRINT( _L("Object collection unnamed tests.") ); + + CXIMPObjectFactoryImp* factory = CXIMPObjectFactoryImp::NewL(); + CleanupStack::PushL( factory ); + + MXIMPObjectCollection* collection = factory->NewObjectCollectionLC(); + + // LookupByType should not find anything + const MXIMPBase* obj = NULL; + collection->LookupByType( obj, MXIMPIdentity::KInterfaceId ); + EUNIT_ASSERT_DESC( obj == NULL, "LookupByType found an object" ); + + // LookupByTypeAndName should not find anything + collection->LookupByTypeAndName( obj, MXIMPIdentity::KInterfaceId, KTestObjectName ); + EUNIT_ASSERT_DESC( obj == NULL, "LookupByTypeAndName found an object" ); + + collection->LookupByTypeAndName( obj, MXIMPIdentity::KInterfaceId, KTestObjectNameWC ); + EUNIT_ASSERT_DESC( obj == NULL, "LookupByTypeAndName with wildcard found an object" ); + + // add some + MXIMPIdentity* identity2 = factory->NewIdentityLC(); + identity2->SetIdentityL( KIdentity2 ); + + MXIMPStatus* status = factory->NewStatusLC(); + status->SetResultCode( KErrArgument ); + + MXIMPIdentity* identity1 = factory->NewIdentityLC(); + identity1->SetIdentityL( KIdentity1 ); + + collection->AddObjectL( identity1 ); + CleanupStack::Pop(); // identity1 + + collection->AddObjectL( status ); + CleanupStack::Pop(); // status + + collection->AddObjectL( identity2 ); + CleanupStack::Pop(); // identity2 + + // get and verify the status + MXIMPBase* getObj = NULL; + collection->GetByType( getObj, MXIMPStatus::KInterfaceId ); + EUNIT_ASSERT_DESC( getObj != NULL, "LookupByType did not find an object" ); + + MXIMPStatus* gotStatus = ( MXIMPStatus* ) getObj->GetInterface( MXIMPStatus::KInterfaceId, MXIMPBase::EPanicIfUnknown ); + CleanupDeletePushL( gotStatus ); + EUNIT_ASSERT_DESC( gotStatus->ResultCode() == KErrArgument, "Status got corrupted" ); + CleanupStack::PopAndDestroy(); // gotStatus + + // check that status can't be found anymore + obj = NULL; + collection->LookupByType( obj, MXIMPStatus::KInterfaceId ); + EUNIT_ASSERT_DESC( obj == NULL, "LookupByType found an object" ); + + collection->LookupByTypeAndName( obj, MXIMPStatus::KInterfaceId, KTestObjectName ); + EUNIT_ASSERT_DESC( obj == NULL, "LookupByTypeAndName found an object" ); + + collection->LookupByTypeAndName( obj, MXIMPStatus::KInterfaceId, KTestObjectNameWC ); + EUNIT_ASSERT_DESC( obj == NULL, "LookupByTypeAndName with wildcard found an object" ); + + // get and verify the two identities + // first identity + getObj = NULL; + collection->GetByType( getObj, MXIMPIdentity::KInterfaceId ); + EUNIT_ASSERT_DESC( getObj != NULL, "LookupByType did not find an object" ); + + MXIMPIdentity* gotIdentity = ( MXIMPIdentity* ) getObj->GetInterface( MXIMPIdentity::KInterfaceId, MXIMPBase::EPanicIfUnknown ); + CleanupDeletePushL( gotIdentity ); + EUNIT_ASSERT_DESC( 0 == gotIdentity->Identity().Compare( KIdentity1 ), "Wrong identity object found" ); + CleanupStack::PopAndDestroy(); // gotIdentity + + // second identity + getObj = NULL; + collection->GetByType( getObj, MXIMPIdentity::KInterfaceId ); + EUNIT_ASSERT_DESC( getObj != NULL, "LookupByType did not find an object" ); + + gotIdentity = ( MXIMPIdentity* ) getObj->GetInterface( MXIMPIdentity::KInterfaceId, MXIMPBase::EPanicIfUnknown ); + CleanupDeletePushL( gotIdentity ); + EUNIT_ASSERT_DESC( 0 == gotIdentity->Identity().Compare( KIdentity2 ), "Wrong identity object found" ); + CleanupStack::PopAndDestroy(); // gotIdentity + + // now there should not be anything anymore + obj = NULL; + collection->LookupByType( obj, MXIMPIdentity::KInterfaceId ); + EUNIT_ASSERT_DESC( obj == NULL, "LookupByType found an object" ); + + CleanupStack::PopAndDestroy(); // collection + CleanupStack::PopAndDestroy( factory ); + } + +// =========================================================================== +// TEST CASE +// =========================================================================== +void T_Utils::T_ObjectCollection_Named_L() + { + EUNIT_PRINT( _L("Object collection named tests.") ); + + CXIMPObjectFactoryImp* factory = CXIMPObjectFactoryImp::NewL(); + CleanupStack::PushL( factory ); + + MXIMPObjectCollection* collection = factory->NewObjectCollectionLC(); + + // LookupByType should not find anything + const MXIMPBase* obj = NULL; + collection->LookupByType( obj, MXIMPIdentity::KInterfaceId ); + EUNIT_ASSERT_DESC( obj == NULL, "LookupByType found an object" ); + + // LookupByTypeAndName should not find anything + collection->LookupByTypeAndName( obj, MXIMPIdentity::KInterfaceId, KTestObjectName ); + EUNIT_ASSERT_DESC( obj == NULL, "LookupByTypeAndName found an object" ); + + collection->LookupByTypeAndName( obj, MXIMPIdentity::KInterfaceId, KTestObjectNameWC ); + EUNIT_ASSERT_DESC( obj == NULL, "LookupByTypeAndName with wildcard found an object" ); + + // add some + MXIMPIdentity* identity2 = factory->NewIdentityLC(); + identity2->SetIdentityL( KIdentity2 ); + + MXIMPStatus* status = factory->NewStatusLC(); + status->SetResultCode( KErrArgument ); + + MXIMPIdentity* identity1 = factory->NewIdentityLC(); + identity1->SetIdentityL( KIdentity1 ); + + collection->AddObjectWithNameL( identity1, KTestObjectName ); + CleanupStack::Pop(); // identity1 + + TRAPD( err, collection->AddObjectWithNameL( status, KTestObjectNameWC ) ); + EUNIT_ASSERT_DESC( err == KErrBadName, "Did not leave when given wildcards" ); + CleanupStack::PopAndDestroy(); // status + + collection->AddObjectWithNameL( identity2, KTestObjectName2 ); + CleanupStack::Pop(); // identity2 + + // should not find the status object + MXIMPBase* getObj = NULL; + collection->GetByType( getObj, MXIMPStatus::KInterfaceId ); + EUNIT_ASSERT_DESC( getObj == NULL, "LookupByType found wrong object" ); + + // get and verify the two identities + // first identity + getObj = NULL; + collection->GetByTypeAndName( getObj, MXIMPIdentity::KInterfaceId, KTestObjectName ); + EUNIT_ASSERT_DESC( getObj != NULL, "LookupByType did not find an object" ); + + MXIMPIdentity* gotIdentity = ( MXIMPIdentity* ) getObj->GetInterface( MXIMPIdentity::KInterfaceId, MXIMPBase::EPanicIfUnknown ); + CleanupDeletePushL( gotIdentity ); + EUNIT_ASSERT_DESC( 0 == gotIdentity->Identity().Compare( KIdentity1 ), "Wrong identity object found" ); + CleanupStack::PopAndDestroy(); // gotIdentity + + // second identity + getObj = NULL; + collection->GetByTypeAndName( getObj, MXIMPIdentity::KInterfaceId, KTestObjectNameWC2 ); + EUNIT_ASSERT_DESC( getObj != NULL, "LookupByType did not find an object" ); + + gotIdentity = ( MXIMPIdentity* ) getObj->GetInterface( MXIMPIdentity::KInterfaceId, MXIMPBase::EPanicIfUnknown ); + CleanupDeletePushL( gotIdentity ); + EUNIT_ASSERT_DESC( 0 == gotIdentity->Identity().Compare( KIdentity2 ), "Wrong identity object found" ); + CleanupStack::PopAndDestroy(); // gotIdentity + + // now there should not be anything anymore + obj = NULL; + collection->LookupByType( obj, MXIMPIdentity::KInterfaceId ); + EUNIT_ASSERT_DESC( obj == NULL, "LookupByType found an object" ); + + CleanupStack::PopAndDestroy(); // collection + CleanupStack::PopAndDestroy( factory ); + } + +// =========================================================================== +// TEST CASE +// =========================================================================== +void T_Utils::T_RestrictedObjectCollection_L() + { + EUNIT_PRINT( _L("Restricted object collection tests.") ); + + CXIMPObjectFactoryImp* factory = CXIMPObjectFactoryImp::NewL(); + CleanupStack::PushL( factory ); + + MXIMPRestrictedObjectCollection* resColl = factory->NewRestrictedObjectCollectionLC(); + + // LookupByType should not find anything, empty collection + const MXIMPBase* obj = NULL; + resColl->LookupByType( obj, MXIMPIdentity::KInterfaceId ); + EUNIT_ASSERT_DESC( obj == NULL, "LookupByType found an object" ); + + // add some + MXIMPIdentity* identity2 = factory->NewIdentityLC(); + identity2->SetIdentityL( KIdentity2 ); + + MXIMPStatus* status = factory->NewStatusLC(); + status->SetResultCode( KErrArgument ); + + MXIMPIdentity* identity1 = factory->NewIdentityLC(); + identity1->SetIdentityL( KIdentity1 ); + + resColl->AddOrReplaceTypeL( identity1 ); + CleanupStack::Pop(); // identity1 + + resColl->AddOrReplaceTypeL( status ); + CleanupStack::Pop(); // identity1 + + resColl->AddOrReplaceTypeL( identity2 ); + CleanupStack::Pop(); // identity2 + + // there should only be {identity2, status} in the collection + obj = NULL; + resColl->LookupByType( obj, MXIMPIdentity::KInterfaceId ); + EUNIT_ASSERT_DESC( obj != NULL, "LookupByType did not find an object" ); + + obj = NULL; + resColl->LookupByType( obj, MXIMPStatus::KInterfaceId ); + EUNIT_ASSERT_DESC( obj != NULL, "LookupByType did not find an object" ); + + // get the objects and verify their contents + + // 1. identity + MXIMPBase* getObj = NULL; + resColl->GetByType( getObj, MXIMPIdentity::KInterfaceId ); + EUNIT_ASSERT_DESC( getObj != NULL, "LookupByType did not find an object" ); + + MXIMPIdentity* gotIdentity = ( MXIMPIdentity* ) getObj->GetInterface( MXIMPIdentity::KInterfaceId, MXIMPBase::EPanicIfUnknown ); + CleanupDeletePushL( gotIdentity ); + EUNIT_ASSERT_DESC( 0 == gotIdentity->Identity().Compare( KIdentity2 ), "Second identity object did not replace the first one" ); + CleanupStack::PopAndDestroy(); // gotIdentity + + // 2. status + getObj = NULL; + resColl->GetByType( getObj, MXIMPStatus::KInterfaceId ); + EUNIT_ASSERT_DESC( getObj != NULL, "LookupByType did not find an object" ); + + MXIMPStatus* gotStatus = ( MXIMPStatus* ) getObj->GetInterface( MXIMPStatus::KInterfaceId, MXIMPBase::EPanicIfUnknown ); + CleanupDeletePushL( gotStatus ); + EUNIT_ASSERT_DESC( KErrArgument == gotStatus->ResultCode(), "Status object was corrupted" ); + CleanupStack::PopAndDestroy(); // gotStatus + + // now there should not be anything anymore + obj = NULL; + resColl->LookupByType( obj, MXIMPIdentity::KInterfaceId ); + EUNIT_ASSERT_DESC( obj == NULL, "LookupByType found an identity object although it was removed" ); + + obj = NULL; + resColl->LookupByType( obj, MXIMPStatus::KInterfaceId ); + EUNIT_ASSERT_DESC( obj == NULL, "LookupByType found a status object although it was removed" ); + + CleanupStack::PopAndDestroy(); // collection + CleanupStack::PopAndDestroy( factory ); + } + +void T_Utils::T_DataSubscriptionState_L() + { + EUNIT_PRINT( _L("Data subscription state tests.") ); + + CXIMPObjectFactoryImp* factory = CXIMPObjectFactoryImp::NewL(); + CleanupStack::PushL( factory ); + + MXIMPDataSubscriptionState* dataState = factory->NewDataSubscriptionStateLC(); + + EUNIT_ASSERT_DESC( dataState->DataState() == MXIMPDataSubscriptionState::EDataUnavailable, + "Data was available." ); + EUNIT_ASSERT_DESC( dataState->SubscriptionState() == MXIMPDataSubscriptionState::ESubscriptionInactive, + "Subscription was active." ); + + dataState->SetDataStateL( MXIMPDataSubscriptionState::EDataAvailable ); + dataState->SetSubscriptionStateL( MXIMPDataSubscriptionState::ESubscriptionActive ); + + EUNIT_ASSERT_DESC( dataState->DataState() == MXIMPDataSubscriptionState::EDataAvailable, + "Data was unavailable." ); + EUNIT_ASSERT_DESC( dataState->SubscriptionState() == MXIMPDataSubscriptionState::ESubscriptionActive, + "Subscription was inactive." ); + + CleanupStack::PopAndDestroy(); // collection + CleanupStack::PopAndDestroy( factory ); + } + + + +void T_Utils::T_TXIMPRequestIdBuilder_Test_L() + { + EUNIT_PRINT( _L("TXIMPRequestIdbuilder test.") ); + + TXIMPRequestIdBuilder builder; + builder.SetProtocolId( 1 ); + builder.SetSessionId( 1 ); + builder.SetRequestId( 1 ); + + TXIMPRequestId id1 = builder.BuildRequestId(); + EUNIT_ASSERT( id1 == id1 ); + EUNIT_ASSERT( id1 != TXIMPRequestId::Null() ); + + + { + builder.SetProtocolId( 2 ); + TXIMPRequestId id2 = builder.BuildRequestId(); + EUNIT_ASSERT( id2 == id2 ); + EUNIT_ASSERT( id1 != id2 ); + EUNIT_ASSERT( id2 != id1 ); + EUNIT_ASSERT( id2 != TXIMPRequestId::Null() ); + } + + { + builder.SetSessionId( 2 ); + TXIMPRequestId id3 = builder.BuildRequestId(); + EUNIT_ASSERT( id3 == id3 ); + EUNIT_ASSERT( id1 != id3 ); + EUNIT_ASSERT( id3 != id1 ); + EUNIT_ASSERT( id3 != TXIMPRequestId::Null() ); + } + + + { + builder.SetRequestId( 2 ); + TXIMPRequestId id4 = builder.BuildRequestId(); + EUNIT_ASSERT( id4 == id4 ); + EUNIT_ASSERT( id1 != id4 ); + EUNIT_ASSERT( id4 != id1 ); + EUNIT_ASSERT( id4 != TXIMPRequestId::Null() ); + } + + + { + builder.SetProtocolId( 33333333 ); + builder.SetSessionId( 44444444 ); + builder.SetRequestId( 55555555 ); + + TXIMPRequestId id5 = builder.BuildRequestId(); + EUNIT_ASSERT( id5 == id5 ); + EUNIT_ASSERT( id1 != id5 ); + EUNIT_ASSERT( id5 != id1 ); + EUNIT_ASSERT( id5 != TXIMPRequestId::Null() ); + } + } + + +void T_Utils::T_TXIMPRequestId_Test_L() + { + EUNIT_PRINT( _L("TXIMPRequestIdbuilder test.") ); + + TXIMPRequestId id0 = TXIMPRequestId::Null(); + EUNIT_ASSERT( id0 == TXIMPRequestId::Null() ); + + { + TXIMPRequestId id1 = TXIMPRequestId::Init( 1 ); + EUNIT_ASSERT( id1 != TXIMPRequestId::Null() ); + } + + + { + TXIMPRequestId id2 = TXIMPRequestId::Init( 2); + EUNIT_ASSERT( id0 != id2 ); + } + + + { + TXIMPRequestId id3 = TXIMPRequestId::Init( KMaxTInt ); + EUNIT_ASSERT( id0 != id3 ); + } + + + { + TXIMPRequestId id4 = TXIMPRequestId::Init( 33333333 ); + EUNIT_ASSERT( id0 != id4 ); + } + + { + TXIMPRequestId id5 = TXIMPRequestId::Init( KMaxTInt ); + TXIMPRequestId id6 = TXIMPRequestId::Init( KMinTInt ); + EUNIT_ASSERT( id0 != id5 ); + EUNIT_ASSERT( id0 != id6 ); + EUNIT_ASSERT( id5 != id6 ); + } + + } + + + + +// =========================================================================== +// TEST CASE TABLE +// =========================================================================== +// +EUNIT_BEGIN_TEST_TABLE( + T_Utils, + "XIMP test utils tests", + "MODULE" ) + + PRFW_NOT_DECORATED_TEST( + "Kill servers", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_KillServers_L, + Teardown ) + +PRFW_NOT_DECORATED_TEST( + "Object collection without names", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_ObjectCollection_Unnamed_L, + Teardown ) + +PRFW_NOT_DECORATED_TEST( + "Object collection using names", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_ObjectCollection_Named_L, + Teardown ) + +PRFW_NOT_DECORATED_TEST( + "Restricted object collection", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_RestrictedObjectCollection_L, + Teardown ) + +PRFW_NOT_DECORATED_TEST( + "Data subscription state", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_DataSubscriptionState_L, + Teardown ) + + +PRFW_NOT_DECORATED_TEST( + "TXIMPRequestIdBuilder test", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_TXIMPRequestIdBuilder_Test_L, + Teardown ) + + +PRFW_NOT_DECORATED_TEST( + "TXIMPRequestId test", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_TXIMPRequestId_Test_L, + Teardown ) + + +/* PRFW_NOT_DECORATED_TEST( + "FileTool test", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_FileToolTest_L, + Teardown ) */ + + +EUNIT_END_TEST_TABLE + + +// =========================================================================== +// TEST SUITE CONSTRUCTION +// =========================================================================== +// +EXPORT_C MEUnitTest* CreateTestSuiteL() + { + return T_Utils::NewL(); + } + + +// end of file + + + + + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_utils/t_utils.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_utils/t_utils.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,80 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef T_UTILS_H__ +#define T_UTILS_H__ + +#include +#include + +#include "prfwteststatuseventlistener.h" +#include "prfwwaitobserver.h" + +class CXIMPTestContextWrapperMgr; + +/** + * XIMP Framework Eunit tests. + * + * Tests for XIMP session management services. + * + * @since S60 v4.0 + */ +class T_Utils : public CEUnitTestSuiteClass + { + +public: + static T_Utils* NewL(); + virtual ~T_Utils(); + +private: + T_Utils(); + void ConstructL(); + +private: // Test case functions + + void Setup_L(); + void Teardown(); + + void T_FileToolTest_L(); + + void T_KillServers_L(); + + void T_ObjectCollection_Unnamed_L(); + void T_ObjectCollection_Named_L(); + void T_RestrictedObjectCollection_L(); + void T_DataSubscriptionState_L(); + + void T_TXIMPRequestIdBuilder_Test_L(); + void T_TXIMPRequestId_Test_L(); + +private: // Test helpers + +private: // Test data + + /** + * Eunit test case table declaration. + */ + EUNIT_DECLARE_TEST_TABLE; + }; + +#endif // T_UTILS_H__ + +// end of file + + + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_utils/t_utils.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/src/t_utils/t_utils.mmp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,54 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "../../tsrcutils/eunitcommon/eunittstdllbase.hrh" + +TARGET t_utils.dll +CAPABILITY ALL -TCB +SOURCEPATH . +SOURCE t_utils.cpp + +#include "../../tsrcutils/processmaster/pm.h" + +USERINCLUDE ../../../../../ximpfw/core/srcdatamodel +USERINCLUDE ../../../../../ximpfw/presence/srcpresencedatamodel +USERINCLUDE ../../../../../ximpfw/presence/srcpresencedatamodel/presentitygroups +USERINCLUDE ../../../../../ximpfw/presence/srcpresencedatamodel/presencewatching +USERINCLUDE ../../../../../ximpfw/presence/srcpresencedatamodel/presenceauthorization +USERINCLUDE ../../../../../ximpfw/presence/srcpresencedatamodel/presencepublishing +USERINCLUDE ../../../../../ximpfw/presence/srcpresencedatamodel/presenceinfo +USERINCLUDE ../../../../../ximpfw/core/srcutils + +// TODO remove unnecessary +SYSTEMINCLUDE ../../../../../ximpfw/inc/core/base +SYSTEMINCLUDE ../../../../../ximpfw/inc/core/datamodel +SYSTEMINCLUDE ../../../../../ximpfw/inc/core/protocolplugin +SYSTEMINCLUDE ../../../../../ximpfw/inc/core/protocolpluginhost +SYSTEMINCLUDE ../../../../../ximpfw/inc/presence/presencedatamodel +SYSTEMINCLUDE ../../../../../ximpfw/inc/presence/presencemanagement +SYSTEMINCLUDE ../../../../../ximpfw/inc/presence/presenceprotocolplugin +SYSTEMINCLUDE ../../../../../ximpfw/inc/presence/presenceprotocolpluginhost + + +LIBRARY ecom.lib +LIBRARY bafl.lib +LIBRARY ximpdatamodel.lib +LIBRARY ximputils.lib +LIBRARY EUnit.lib +// end of file + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcprotocols/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcprotocols/bld.inf Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,26 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Build information file for PrFw test protocols + * +*/ + +PRJ_PLATFORMS +DEFAULT + +PRJ_TESTMMPFILES + +pr_prfwtestprotocol/pr_prfwtestprotocol.mmp + + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcprotocols/pr_prfwtestprotocol/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcprotocols/pr_prfwtestprotocol/bld.inf Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,29 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Build information file for project Presence Framework +* +*/ + + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +PRJ_TESTMMPFILES +pr_prfwtestprotocol.mmp + + + +PRJ_TESTEXPORTS diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcprotocols/pr_prfwtestprotocol/pr_prfwtestprotocol.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcprotocols/pr_prfwtestprotocol/pr_prfwtestprotocol.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,1519 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Test Protocol implementation for XIMP Framework + * +*/ + + +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +#include "pr_prfwtestprotocol.h" +#include "prfwgeneralwaiter.h" +#include "prfwtestmessaging.h" +#include "prfwtestmessenger.h" +#include "prfwtestfilelogichelper.h" +#include "prfwtestfiletool.h" +#include "ximprequestidbuilder.h" +#include "prfwtestprotocols.h" + + + +const TInt KWaitTime = 1; + +T_XIMPTestConnection::ClientWrapper* T_XIMPTestConnection::ClientWrapper::NewLC( const TDesC& aClientId ) + { + ClientWrapper* self = new ( ELeave ) ClientWrapper; + CleanupStack::PushL( self ); + self->ConstructL( aClientId ); + return self; + } + +void T_XIMPTestConnection::ClientWrapper::ConstructL( const TDesC& aClientId ) + { + iId.CreateL( aClientId ); + } + +void T_XIMPTestConnection::ClientWrapper::InitializeL( MXIMPProtocolConnectionHost& aConnectionHost ) + { + if( !iMessenger ) + { + TLex lex( iId ); + TInt index = 0; + User::LeaveIfError( lex.Val( index ) ); + // TEST CODE + __ASSERT_ALWAYS( index != -1, User::Panic(_L("Protocol"), 666)); + iMessenger = CXIMPTestMessenger::NewForAdaptationSideL( index ); + iPluginIndex = index; + } + + if( !iFileLogicHelper ) + { + iFileLogicHelper = CXIMPTestFileLogicHelper::NewL( aConnectionHost, *iMessenger ); + } + + if( !iFileTool ) + { + // TODO FIX FILETOOL CREATION + iFileTool = CXIMPTestFileTool::NewL( K_PRFW_TST_PROTOCOL_1_IMPLEMENTATION_UID, iId ); + iFileTool->RegisterObserverL( iFileLogicHelper ); + } + } + +T_XIMPTestConnection::ClientWrapper::~ClientWrapper() + { + if( iFileTool && iFileLogicHelper ) + { + iFileTool->UnregisterObserver( iFileLogicHelper ); + } + delete iFileTool; + delete iFileLogicHelper; + delete iMessenger; + + iId.Close(); + } + +// --------------------------------------------------------------------------- +// OrderOfClients() +// --------------------------------------------------------------------------- +// +TInt T_XIMPTestConnection::OrderOfClients( const T_XIMPTestConnection::ClientWrapper& aFirst, + const T_XIMPTestConnection::ClientWrapper& aSecond ) + { + return aFirst.iId.Compare( aSecond.iId ); + } + +// ======== MEMBER FUNCTIONS ======== + + +// --------------------------------------------------------------------------- +// OrderOfConnections() +// --------------------------------------------------------------------------- +// +TInt T_XIMPTestConnection::OrderOfConnections( const T_XIMPTestConnection& aFirst, + const T_XIMPTestConnection& aSecond ) + { + TInt retVal = aFirst.iServerAddress->Compare( *aSecond.iServerAddress ); + if( retVal != 0 ) + { + return retVal; + } + retVal = aFirst.iUserName->Compare( *aSecond.iUserName ); + if( retVal != 0 ) + { + return retVal; + } + + return aFirst.iPassword->Compare( *aSecond.iPassword ); + } + + +// --------------------------------------------------------------------------- +// T_XIMPTestConnection::T_XIMPTestConnection() +// --------------------------------------------------------------------------- +// +T_XIMPTestConnection::T_XIMPTestConnection() + { + } + + +// --------------------------------------------------------------------------- +// T_XIMPTestConnection::ConstructL() +// --------------------------------------------------------------------------- +// +void T_XIMPTestConnection::ConstructL( const MXIMPServiceInfo& aServiceInfo, + const MXIMPContextClientInfo& aClientCtxInfo ) + { + iWaitter = CXIMPTestGeneralWaiter::NewL( this ); + + iAuxTimer = CPeriodic::NewL( CActive::EPriorityIdle ); + + iServerAddress = aServiceInfo.ServiceAddress().AllocL(); + iUserName = aServiceInfo.UserId().AllocL(); + iPassword = aServiceInfo.Password().AllocL(); + iClientId = aClientCtxInfo.ClientId().Identity().AllocL(); + } + + +// --------------------------------------------------------------------------- +// T_XIMPTestConnection::NewLC() +// --------------------------------------------------------------------------- +// +T_XIMPTestConnection* T_XIMPTestConnection::NewLC( const MXIMPServiceInfo& aServiceInfo, + const MXIMPContextClientInfo& aClientCtxInfo ) + { + T_XIMPTestConnection* self = new( ELeave ) T_XIMPTestConnection( ); + CleanupStack::PushL( self ); + self->ConstructL( aServiceInfo, aClientCtxInfo ); + return self; + } + + +// --------------------------------------------------------------------------- +// T_XIMPTestConnection::NewL() +// --------------------------------------------------------------------------- +// +T_XIMPTestConnection* T_XIMPTestConnection::NewL( const MXIMPServiceInfo& aServiceInfo, + const MXIMPContextClientInfo& aClientCtxInfo ) + { + T_XIMPTestConnection* self = T_XIMPTestConnection::NewLC( aServiceInfo, aClientCtxInfo ); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// T_XIMPTestConnection::~T_XIMPTestConnection() +// --------------------------------------------------------------------------- +// +T_XIMPTestConnection::~T_XIMPTestConnection() + { + SetBoolean( EXIMPPlgTestDeath ); + + if ( iAuxTimer ) + { + iAuxTimer->Deque(); + } + delete iAuxTimer; + + delete iWaitter; + + iClients.ResetAndDestroy(); + + delete iServerAddress; + delete iUserName; + delete iPassword; + delete iClientId; + + delete iClientToBeDeleted; + } + + +// --------------------------------------------------------------------------- +// T_XIMPTestConnection::PrimeHost() +// --------------------------------------------------------------------------- +// +void T_XIMPTestConnection::PrimeHost( MXIMPProtocolConnectionHost& aHost ) + { + iConnectionHost = &aHost; + } + +// --------------------------------------------------------------------------- +// T_XIMPTestConnection::PresenceFeatures() +// --------------------------------------------------------------------------- +// +MProtocolPresenceFeatures& T_XIMPTestConnection::ProtocolPresenceFeatures() + { + return *this; + } + + +// --------------------------------------------------------------------------- +// T_XIMPTestConnection::PresenceFeatures() +// --------------------------------------------------------------------------- +// MProtocolImFeatures* ProtocolImFeatures(); +//MProtocolImFeatures* T_XIMPTestConnection::ProtocolImFeatures() +// { +// return NULL; +// } +// --------------------------------------------------------------------------- +// T_XIMPTestConnection::GetProtocolInterface() +// --------------------------------------------------------------------------- +TAny* T_XIMPTestConnection::GetProtocolInterface(TInt aInterfaceId) + { + return NULL ; + } + + + +// --------------------------------------------------------------------------- +// T_XIMPTestConnection::PresenceWatching() +// --------------------------------------------------------------------------- +// +MProtocolPresenceWatching& T_XIMPTestConnection::PresenceWatching() + { + return *this; + } +// --------------------------------------------------------------------------- +// T_XIMPTestConnection::PresencePublishing() +// --------------------------------------------------------------------------- +// +MProtocolPresencePublishing& T_XIMPTestConnection::PresencePublishing() + { + return *this; + } +// --------------------------------------------------------------------------- +// T_XIMPTestConnection::PresentityGroups() +// --------------------------------------------------------------------------- +// +MProtocolPresentityGroups& T_XIMPTestConnection::PresentityGroups() + { + return *this; + } +// --------------------------------------------------------------------------- +// T_XIMPTestConnection::PresenceAuthorization() +// --------------------------------------------------------------------------- +// +MProtocolPresenceAuthorization& T_XIMPTestConnection::PresenceAuthorization() + { + return *this; + } + +// --------------------------------------------------------------------------- +// T_XIMPTestConnection::HandleProtocolConnectionHostEvent() +// --------------------------------------------------------------------------- +// +void T_XIMPTestConnection::HandleProtocolConnectionHostEvent( + const MXIMPProtocolConnectionHost& aHost, + const MXIMPBase& aEvent ) + { + if( &aHost != iConnectionHost ) + { + User::Panic(_L("Protocol"), -42 ); + } + + + if( aEvent.GetInterfaceId() == MXIMPProtocolRequestCompleteEvent::KInterfaceId ) + { + const MXIMPProtocolRequestCompleteEvent* eventIf = + TXIMPGetInterface< const MXIMPProtocolRequestCompleteEvent >::From( aEvent, + MXIMPBase::EPanicIfUnknown ); + RDebug::Print( _L(" T_XIMPTestConnection: received ProtocolRequestCompleteEvent with result [%d]"), + eventIf->ResultCode() ); + } + } + + + +// --------------------------------------------------------------------------- +// T_XIMPTestConnection::OpenSessionL() +// --------------------------------------------------------------------------- +// +void T_XIMPTestConnection::OpenSessionL( const MXIMPContextClientInfo& aClientCtxInfo, + TXIMPRequestId aReqId ) + { + iConnectionHost->RegisterObserverL( *this ); + + ClientWrapper* client = ClientWrapper::NewLC( aClientCtxInfo.ClientId().Identity() ); + + TLinearOrder< T_XIMPTestConnection::ClientWrapper > order( T_XIMPTestConnection::OrderOfClients ); + TInt indexOfClient = iClients.FindInOrder( client, order ); + + if( indexOfClient != KErrNotFound ) + { + User::LeaveIfError( indexOfClient ); + CleanupStack::PopAndDestroy(); //id + client = iClients[ indexOfClient ]; + } + else + { + client->InitializeL( *iConnectionHost ); + iCurrentMessenger = client->iMessenger; + } + + PluginAPIMethodCommonL( aReqId ); + + if( indexOfClient == KErrNotFound ) + { + iClients.InsertInOrderL( client, order ); + CleanupStack::Pop(); //id + } + + + SetBooleanToCurrent( EXIMPPlgTestOpenSessionCalled ); + iWaitter->WaitForL( KWaitTime ); + } + +// --------------------------------------------------------------------------- +// T_XIMPTestConnection::OpenSessionL() +// --------------------------------------------------------------------------- +// +void T_XIMPTestConnection::OpenSessionL( + const TInt& aSettingsId, + TXIMPRequestId aReqId ) + + { + iConnectionHost->RegisterObserverL( *this ); + + ClientWrapper* client = ClientWrapper::NewLC( _L("0") ); + + TLinearOrder< T_XIMPTestConnection::ClientWrapper > order( T_XIMPTestConnection::OrderOfClients ); + TInt indexOfClient = iClients.FindInOrder( client, order ); + + if( indexOfClient != KErrNotFound ) + { + User::LeaveIfError( indexOfClient ); + CleanupStack::PopAndDestroy(); //id + client = iClients[ indexOfClient ]; + } + else + { + client->InitializeL( *iConnectionHost ); + iCurrentMessenger = client->iMessenger; + } + + PluginAPIMethodCommonL( aReqId ); + + if( indexOfClient == KErrNotFound ) + { + iClients.InsertInOrderL( client, order ); + CleanupStack::Pop(); //id + } + + + SetBooleanToCurrent( EXIMPPlgTestOpenSessionCalled ); + iWaitter->WaitForL( KWaitTime ); + } + + + +// --------------------------------------------------------------------------- +// T_XIMPTestConnection::CloseSession() +// --------------------------------------------------------------------------- +// +void T_XIMPTestConnection::CloseSession( const MXIMPContextClientInfo& aClientCtxInfo, + TXIMPRequestId aReqId ) + { + PluginAPIMethodCommonL( aReqId ); + + iClientToBeDeleted = NULL; + TInt count = iClients.Count(); + TBool found(EFalse); + for( TInt a = 0; a < count && !iClientToBeDeleted; ++a ) + { + if( aClientCtxInfo.ClientId().Identity().Compare( iClients[ a ]->iId ) == 0 ) + { + iClientToBeDeleted = iClients[ a ]; + iClients.Remove( a ); + found = ETrue; + } + } + + SetBooleanToCurrent( EXIMPPlgTestCloseSessionCalled ); + + if(found) + iWaitter->WaitForL( KWaitTime ); + else + { + MXIMPStatus* status = iConnectionHost->ObjectFactory().NewStatusLC(); + CleanupStack::Pop(); // status. + status->SetResultCode(KErrNone); + iConnectionHost->HandleRequestCompleted( aReqId, status); + } + + + + } + + +// --------------------------------------------------------------------------- +// T_XIMPTestConnection::GetSupportedFeaturesL() +// --------------------------------------------------------------------------- +// +void T_XIMPTestConnection::GetSupportedFeaturesL( CDesC8Array& aFeatures ) const + { + if ( ! iClients.Count() ) + { + User::LeaveIfError( KErrNotReady ); + } + + // first empty the whole array + aFeatures.Reset(); + + // then add two features there: 1 supported by XIMP, 1 not + aFeatures.AppendL( _L8("feat/pres/pub") ); + aFeatures.AppendL( _L8("feat/worlddomination") ); + } + +// --------------------------------------------------------------------------- +// T_XIMPTestConnection::DoSubscribeOwnPresenceL +// --------------------------------------------------------------------------- +// +void T_XIMPTestConnection::DoSubscribeOwnPresenceL( const MPresenceInfoFilter& aPif, + TXIMPRequestId aReqId ) + { + PluginAPIMethodCommonL( aReqId ); + + SetBooleanToCurrent( EXIMPPlgTestSubscribeOwnPresenceCalled ); + + // TODO do something, like in PublishPresence + + iWaitter->WaitForL( KWaitTime ); + } + +// --------------------------------------------------------------------------- +// T_XIMPTestConnection::DoUpdateOwnPresenceSubscriptionL +// --------------------------------------------------------------------------- +// +void T_XIMPTestConnection::DoUpdateOwnPresenceSubscriptionPifL( const MPresenceInfoFilter& aPif, + TXIMPRequestId aReqId ) + { + PluginAPIMethodCommonL( aReqId ); + + SetBooleanToCurrent( EXIMPPlgTestUpdateOwnSubscriptionCalled ); + + // TODO do something, like in PublishPresence + + iWaitter->WaitForL( KWaitTime ); + } + + +// --------------------------------------------------------------------------- +// From MPscPlugin class. +// T_XIMPTestConnection::DoSubscribePresenceWatcherListL() +// --------------------------------------------------------------------------- +// +void T_XIMPTestConnection::DoSubscribePresenceWatcherListL( TXIMPRequestId aReqId ) + { + PluginAPIMethodCommonL( aReqId ); + + SetBooleanToCurrent( EXIMPPlgTestSubscribePresenceWatcherListCalled ); + + // TODO do something, like in PublishPresence + + iWaitter->WaitForL( KWaitTime ); + } + +// --------------------------------------------------------------------------- +// From MPscPlugin class. +// T_XIMPTestConnection::DoUnsubscribePresenceWatcherListL() +// --------------------------------------------------------------------------- +// +void T_XIMPTestConnection::DoUnsubscribePresenceWatcherListL( TXIMPRequestId aReqId ) + { + PluginAPIMethodCommonL( aReqId ); + + SetBooleanToCurrent( EXIMPPlgTestUnsubscribePresenceWatcherListCalled ); + + // TODO do something, like in PublishPresence + + iWaitter->WaitForL( KWaitTime ); + } + +// --------------------------------------------------------------------------- +// T_XIMPTestConnection::DoSubscribePresentityGroupListL +// --------------------------------------------------------------------------- +// +void T_XIMPTestConnection::DoSubscribePresentityGroupListL( TXIMPRequestId aReqId ) + { + PluginAPIMethodCommonL( aReqId ); + + SetBooleanToCurrent( EXIMPPlgTestSubscribeGroupListCalled ); + + // TODO do something, like in PublishPresence + + iWaitter->WaitForL( KWaitTime ); + } + +// --------------------------------------------------------------------------- +// T_XIMPTestConnection::DoUnsubscribePresentityGroupListL +// --------------------------------------------------------------------------- +// +void T_XIMPTestConnection::DoUnsubscribePresentityGroupListL( TXIMPRequestId aReqId ) + { + PluginAPIMethodCommonL( aReqId ); + + SetBooleanToCurrent( EXIMPPlgTestUnsubscribeGroupListCalled ); + + // TODO do something, like in PublishPresence + + iWaitter->WaitForL( KWaitTime ); + } + + +// --------------------------------------------------------------------------- +// T_XIMPTestConnection::PublishPresenceL() +// --------------------------------------------------------------------------- +// +void T_XIMPTestConnection::DoPublishOwnPresenceL( + const MPresenceInfo& aPresence, + TXIMPRequestId aReqId ) + { + // With SetupLeave we leave here + PluginAPIMethodCommonL( aReqId ); + + SetBooleanToCurrent( EXIMPPlgTestPublishPresenceCalled ); + + MProtocolPresenceDataHost& presHost = iConnectionHost->ProtocolPresenceDataHost(); + // Set own presence data in data cache + MPresenceInfo* presence = presHost.PresenceObjectFactory().NewPresenceInfoLC(); + TXIMPRequestId reqid = presHost.PublishingDataHost().HandleSubscribedOwnPresenceL( presence ); + CleanupStack::Pop(); //presence + + + if(iCurrentMessenger->GetError()==KErrTimedOut) + { + MXIMPStatus* status1 = iConnectionHost->ObjectFactory().NewStatusLC(); + iConnectionHost->HandleConnectionTerminated(status1); + + CleanupStack::PopAndDestroy(1); + } + + iWaitter->WaitForL( KWaitTime ); + + // TODO when implemented, write the data received for test case verification + } + +// --------------------------------------------------------------------------- +// T_XIMPTestConnection::DoUnsubscribeOwnPresenceL() +// --------------------------------------------------------------------------- +// +void T_XIMPTestConnection::DoUnsubscribeOwnPresenceL( TXIMPRequestId aReqId ) + { + PluginAPIMethodCommonL( aReqId ); + + // prepare the message for test code + SetBooleanToCurrent( EXIMPPlgTestUnsubscribeOwnPresenceCalled ); + // TODO when implemented, read the data given by test case and + // generate the required events + iWaitter->WaitForL( KWaitTime ); + } + +// --------------------------------------------------------------------------- +// T_XIMPTestConnection::DoCreatePresentityGroupL +// --------------------------------------------------------------------------- +// +void T_XIMPTestConnection::DoCreatePresentityGroupL( const MXIMPIdentity& aIdentity, + const TDesC16& aDisplayName, + TXIMPRequestId aReqId ) + { + PluginAPIMethodCommonL( aReqId ); + + // prepare the message for test code + SetBooleanToCurrent( EXIMPPlgTestCreatePresentityGroupCalled ); + // TODO when implemented, read the data given by test case and + // generate the required events + iWaitter->WaitForL( KWaitTime ); + } + +// --------------------------------------------------------------------------- +// T_XIMPTestConnection::DoCreatePresentityGroupL +// --------------------------------------------------------------------------- +// +void T_XIMPTestConnection::DoDeletePresentityGroupL( const MXIMPIdentity& aIdentity, + TXIMPRequestId aReqId ) + { + PluginAPIMethodCommonL( aReqId ); + + // prepare the message for test code + SetBooleanToCurrent( EXIMPPlgTestDeletePresentityGroupCalled ); + // TODO when implemented, read the data given by test case and + // generate the required events + iWaitter->WaitForL( KWaitTime ); + } + +// --------------------------------------------------------------------------- +// T_XIMPTestConnection::DoCreatePresentityGroupL +// --------------------------------------------------------------------------- +// +void T_XIMPTestConnection::DoUpdatePresentityGroupDisplayNameL( const MXIMPIdentity& aIdentity, + const TDesC16& aDisplayName, + TXIMPRequestId aReqId ) + { + PluginAPIMethodCommonL( aReqId ); + + // prepare the message for test code + SetBooleanToCurrent( EXIMPPlgTestUpdatePresentityGroupDisplayNameCalled ); + // TODO when implemented, read the data given by test case and + // generate the required events + iWaitter->WaitForL( KWaitTime ); + } + +// --------------------------------------------------------------------------- +// T_XIMPTestConnection::DoSubscribePresentityPresenceL +// --------------------------------------------------------------------------- +// +void T_XIMPTestConnection::DoSubscribePresentityPresenceL( + const MXIMPIdentity& aIdentity, + const MPresenceInfoFilter& aPif, + TXIMPRequestId aReqId ) + { + PluginAPIMethodCommonL( aReqId ); + + // prepare the message for test code + SetBooleanToCurrent( EXIMPPlgTestSubscribePresentityPresesenceCalled ); + // TODO when implemented, read the data given by test case and + // generate the required events + iWaitter->WaitForL( KWaitTime ); + } + +// --------------------------------------------------------------------------- +// T_XIMPTestConnection::DoUpdatePresentityPresenceSubscriptionL +// --------------------------------------------------------------------------- +// +void T_XIMPTestConnection::DoUpdatePresentityPresenceSubscriptionPifL( + const MXIMPIdentity& aIdentity, + const MPresenceInfoFilter& aPif, + TXIMPRequestId aReqId ) + { + PluginAPIMethodCommonL( aReqId ); + + // prepare the message for test code + SetBooleanToCurrent( EXIMPPlgTestUpdatePresentityPresesenceCalled ); + // TODO when implemented, read the data given by test case and + // generate the required events + iWaitter->WaitForL( KWaitTime ); + } + +// --------------------------------------------------------------------------- +// T_XIMPTestConnection::DoUnsubscribePresentityPresenceL +// --------------------------------------------------------------------------- +// +void T_XIMPTestConnection::DoUnsubscribePresentityPresenceL( + const MXIMPIdentity& aIdentity, + TXIMPRequestId aReqId ) + { + PluginAPIMethodCommonL( aReqId ); + + // prepare the message for test code + SetBooleanToCurrent( EXIMPPlgTestUnsubscribePresentityPresesenceCalled ); + // TODO when implemented, read the data given by test case and + // generate the required events + iWaitter->WaitForL( KWaitTime ); + } + + +// --------------------------------------------------------------------------- +// T_XIMPTestConnection::DoSubscribePresentityGroupMembersPresenceL +// --------------------------------------------------------------------------- +// +void T_XIMPTestConnection::DoSubscribePresentityGroupMembersPresenceL( + const MXIMPIdentity& aIdentity, + const MPresenceInfoFilter& aPif, + TXIMPRequestId aReqId ) + { + PluginAPIMethodCommonL( aReqId ); + + // prepare the message for test code + SetBooleanToCurrent( EXIMPPlgTestSubscribePresentityGroupMembersPresesenceCalled ); + // TODO when implemented, read the data given by test case and + // generate the required events + iWaitter->WaitForL( KWaitTime ); + } + +// --------------------------------------------------------------------------- +// T_XIMPTestConnection::DoUpdatePresentityPresenceSubscriptionL +// --------------------------------------------------------------------------- +// +void T_XIMPTestConnection::DoUpdatePresentityGroupMembersPresenceSubscriptionPifL( + const MXIMPIdentity& aIdentity, + const MPresenceInfoFilter& aPif, + TXIMPRequestId aReqId ) + { + PluginAPIMethodCommonL( aReqId ); + + // prepare the message for test code + SetBooleanToCurrent( EXIMPPlgTestUpdatePresentityGroupMembersPresesenceCalled ); + // TODO when implemented, read the data given by test case and + // generate the required events + iWaitter->WaitForL( KWaitTime ); + } + +// --------------------------------------------------------------------------- +// T_XIMPTestConnection::DoUnsubscribePresentityPresenceL +// --------------------------------------------------------------------------- +// +void T_XIMPTestConnection::DoUnsubscribePresentityGroupMembersPresenceL( + const MXIMPIdentity& aIdentity, + TXIMPRequestId aReqId ) + { + PluginAPIMethodCommonL( aReqId ); + + // prepare the message for test code + SetBooleanToCurrent( EXIMPPlgTestUnsubscribePresentityGroupMembersPresesenceCalled ); + // TODO when implemented, read the data given by test case and + // generate the required events + iWaitter->WaitForL( KWaitTime ); + } + + + +// --------------------------------------------------------------------------- +// From MPscPlugin class. +// T_XIMPTestConnection::DoSubscribePresentityGroupContentL +// --------------------------------------------------------------------------- +// +void T_XIMPTestConnection::DoSubscribePresentityGroupContentL( + const MXIMPIdentity& aGroupId, + TXIMPRequestId aReqId ) + { + PluginAPIMethodCommonL( aReqId ); + + // prepare the message for test code + SetBooleanToCurrent( EXIMPPlgTestSubscribePresentityGroupContentCalled ); + // TODO when implemented, read the data given by test case and + // generate the required events + iWaitter->WaitForL( KWaitTime ); + } + +// --------------------------------------------------------------------------- +// From MPscPlugin class. +// T_XIMPTestConnection::DoUnsubscribePresentityGroupContentL +// --------------------------------------------------------------------------- +// +void T_XIMPTestConnection::DoUnsubscribePresentityGroupContentL( + const MXIMPIdentity& aGroupId, + TXIMPRequestId aReqId ) + { + PluginAPIMethodCommonL( aReqId ); + // prepare the message for test code + SetBooleanToCurrent( EXIMPPlgTestUnsubscribePresentityGroupContentCalled ); + // TODO when implemented, read the data given by test case and + // generate the required events + iWaitter->WaitForL( KWaitTime ); + + } + +// --------------------------------------------------------------------------- +// From MPscPlugin class. +// T_XIMPTestConnection::DoAddPresentityGroupMemberL +// --------------------------------------------------------------------------- +// +void T_XIMPTestConnection::DoAddPresentityGroupMemberL( + const MXIMPIdentity& aGroupId, + const MXIMPIdentity& aMemberId, + const TDesC16& aMemberDisplayName, + TXIMPRequestId aReqId ) + { + /* + //Req complete parameter template + { + MXIMPRestrictedObjectCollection* collection = + iConnectionHost->ObjectFactory().NewRestrictedObjectCollectionLC(); + + MXIMPIdentity* identityClone = iConnectionHost->ObjectFactory().NewIdentityLC(); + identityClone->SetIdentityL( aMemberId.Identity() ); + + MPresentityGroupMemberInfo* grpMember = + iConnectionHost->ObjectFactory().NewPresentityGroupMemberInfoLC( *identityClone, + _L("AlteredDisplayname") ); + CleanupStack::Pop(); //grpMember + CleanupStack::PopAndDestroy(); //identityClone + + CleanupDeletePushL( grpMember ); + collection->AddOrReplaceTypeL( grpMember ); + CleanupStack::Pop(); //grpMember + + delete iReqCompleteParams; + iReqCompleteParams = NULL; + iReqCompleteParams = collection; + + CleanupStack::Pop(); //collection + } + */ + + PluginAPIMethodCommonL( aReqId ); + + // prepare the message for test code + SetBooleanToCurrent( EXIMPPlgTestAddPresentityGroupMemberCalled ); + // TODO when implemented, read the data given by test case and + // generate the required events + iWaitter->WaitForL( KWaitTime ); + } + +// --------------------------------------------------------------------------- +// From MPscPlugin class. +// T_XIMPTestConnection::DoRemovePresentityGroupMemberL +// --------------------------------------------------------------------------- +// +void T_XIMPTestConnection::DoRemovePresentityGroupMemberL( + const MXIMPIdentity& aGroupId, + const MXIMPIdentity& aMemberId, + TXIMPRequestId aReqId ) + { + PluginAPIMethodCommonL( aReqId ); + + // prepare the message for test code + SetBooleanToCurrent( EXIMPPlgTestRemovePresentityGroupMemberCalled ); + // TODO when implemented, read the data given by test case and + // generate the required events + iWaitter->WaitForL( KWaitTime ); + } + +// --------------------------------------------------------------------------- +// From MPscPlugin class. +// T_XIMPTestConnection::DoUpdatePresentityGroupMemberDisplayNameL +// --------------------------------------------------------------------------- +// +void T_XIMPTestConnection::DoUpdatePresentityGroupMemberDisplayNameL( + const MXIMPIdentity& aGroupId, + const MXIMPIdentity& aMemberId, + const TDesC16& aMemberDisplayName, + TXIMPRequestId aReqId ) + { + PluginAPIMethodCommonL( aReqId ); + + // prepare the message for test code + SetBooleanToCurrent( EXIMPPlgTestUpdatePresentityGroupMemberDisplayNameCalled ); + // TODO when implemented, read the data given by test case and + // generate the required events + iWaitter->WaitForL( KWaitTime ); + } + + +// --------------------------------------------------------------------------- +// From MPscPlugin class. +// T_XIMPTestConnection::DoSubscribePresenceGrantRequestListL +// --------------------------------------------------------------------------- +// +void T_XIMPTestConnection::DoSubscribePresenceGrantRequestListL( TXIMPRequestId aReqId ) + { + PluginAPIMethodCommonL( aReqId ); + + SetBooleanToCurrent( EXIMPPlgTestSubscribePresenceGrantRequestListCalled ); + + // TODO do something, like in PublishPresence + + iWaitter->WaitForL( KWaitTime ); + } + +// --------------------------------------------------------------------------- +// From MPscPlugin class. +// T_XIMPTestConnection::DoUnsubscribePresenceGrantRequestListL +// --------------------------------------------------------------------------- +// +void T_XIMPTestConnection::DoUnsubscribePresenceGrantRequestListL( TXIMPRequestId aReqId ) + { + PluginAPIMethodCommonL( aReqId ); + + SetBooleanToCurrent( EXIMPPlgTestUnsubscribePresenceGrantRequestListCalled ); + + // TODO do something, like in PublishPresence + + iWaitter->WaitForL( KWaitTime ); + } + + +void T_XIMPTestConnection::DoGrantPresenceForPresentityL( const MXIMPIdentity& aIdentity, + const MPresenceInfoFilter& aPif, + TXIMPRequestId aReqId ) + { + PluginAPIMethodCommonL( aReqId ); + + SetBooleanToCurrent( EXIMPPlgTestGrantPresenceForPresentityCalled ); + + // TODO do something, like in PublishPresence + + iWaitter->WaitForL( KWaitTime ); + + } +void T_XIMPTestConnection::DoGrantPresenceForPresentityGroupMembersL( const MXIMPIdentity& aGroupId, + const MPresenceInfoFilter& aPif, + TXIMPRequestId aReqId ) + { + PluginAPIMethodCommonL( aReqId ); + + SetBooleanToCurrent( EXIMPPlgTestGrantPresenceForPresentityGroupMembersCalled ); + + // TODO do something, like in PublishPresence + + iWaitter->WaitForL( KWaitTime ); + + } + +void T_XIMPTestConnection::DoGrantPresenceForEveryoneL( const MPresenceInfoFilter& aPif, + TXIMPRequestId aReqId ) + { + PluginAPIMethodCommonL( aReqId ); + + SetBooleanToCurrent( EXIMPPlgTestGrantPresenceForEveryoneCalled ); + + // TODO do something, like in PublishPresence + + iWaitter->WaitForL( KWaitTime ); + + } + + +void T_XIMPTestConnection::DoUpdatePresenceGrantPifForPresentityL( const MXIMPIdentity& aIdentity, + const MPresenceInfoFilter& aPif, + TXIMPRequestId aReqId ) + { + PluginAPIMethodCommonL( aReqId ); + + SetBooleanToCurrent( EXIMPPlgTestUpdateGrantPresenceForPresentityCalled ); + + // TODO do something, like in PublishPresence + + iWaitter->WaitForL( KWaitTime ); + + } + +void T_XIMPTestConnection::DoUpdatePresenceGrantPifForPresentityGroupMembersL( const MXIMPIdentity& aGroupId, + const MPresenceInfoFilter& aPif, + TXIMPRequestId aReqId ) + { + PluginAPIMethodCommonL( aReqId ); + + SetBooleanToCurrent( EXIMPPlgTestUpdateGrantPresenceForPresentityGroupMembersCalled ); + + // TODO do something, like in PublishPresence + + iWaitter->WaitForL( KWaitTime ); + + } + +void T_XIMPTestConnection::DoUpdatePresenceGrantPifForEveryoneL( const MPresenceInfoFilter& aPif, + TXIMPRequestId aReqId ) + { + PluginAPIMethodCommonL( aReqId ); + + SetBooleanToCurrent( EXIMPPlgTestUpdateGrantPresenceForEveryoneCalled ); + + // TODO do something, like in PublishPresence + + iWaitter->WaitForL( KWaitTime ); + + } + + +void T_XIMPTestConnection::DoWithdrawPresenceGrantFromPresentityL( const MXIMPIdentity& aIdentity, TXIMPRequestId aReqId ) + { + PluginAPIMethodCommonL( aReqId ); + + SetBooleanToCurrent( EXIMPPlgTestWithdrawPresenceFromPresentityCalled ); + + // TODO do something, like in PublishPresence + + iWaitter->WaitForL( KWaitTime ); + + } + +void T_XIMPTestConnection::DoWithdrawPresenceGrantFromEveryoneL( TXIMPRequestId aReqId ) + { + PluginAPIMethodCommonL( aReqId ); + + SetBooleanToCurrent( EXIMPPlgTestWithdrawPresenceFromEveryoneCalled ); + + // TODO do something, like in PublishPresence + + iWaitter->WaitForL( KWaitTime ); + + } + +void T_XIMPTestConnection::DoWithdrawPresenceGrantFromPresentityGroupMembersL( const MXIMPIdentity& aGroupId, + TXIMPRequestId aReqId ) + { + PluginAPIMethodCommonL( aReqId ); + + SetBooleanToCurrent( EXIMPPlgTestWithdrawPresenceFromPresentityGroupMembersCalled ); + + // TODO do something, like in PublishPresence + + iWaitter->WaitForL( KWaitTime ); + + } + +void T_XIMPTestConnection::DoSubscribePresenceBlockListL( TXIMPRequestId aReqId ) + { + PluginAPIMethodCommonL( aReqId ); + + SetBooleanToCurrent( EXIMPPlgTestSubscribePresenceBlockListCalled ); + + // TODO do something, like in PublishPresence + + iWaitter->WaitForL( KWaitTime ); + + } + +void T_XIMPTestConnection::DoUnsubscribePresenceBlockListL( TXIMPRequestId aReqId ) + { + PluginAPIMethodCommonL( aReqId ); + + SetBooleanToCurrent( EXIMPPlgTestUnsubscribePresenceBlockListCalled ); + + // TODO do something, like in PublishPresence + + iWaitter->WaitForL( KWaitTime ); + + } +void T_XIMPTestConnection::DoBlockPresenceForPresentityL( const MXIMPIdentity& aPresentityId, + TXIMPRequestId aReqId ) + { + PluginAPIMethodCommonL( aReqId ); + + SetBooleanToCurrent( EXIMPPlgTestBlockPresenceForPresentityCalled ); + + // TODO do something, like in PublishPresence + + iWaitter->WaitForL( KWaitTime ); + + } +void T_XIMPTestConnection::DoCancelPresenceBlockFromPresentityL( const MXIMPIdentity& aPresentityId, + TXIMPRequestId aReqId ) + { + PluginAPIMethodCommonL( aReqId ); + + SetBooleanToCurrent( EXIMPPlgTestCancelPresenceBlockFromPresentityCalled ); + + // TODO do something, like in PublishPresence + + iWaitter->WaitForL( KWaitTime ); + + } + + + +// --------------------------------------------------------------------------- +// T_XIMPTestConnection::PluginAPIMethodCommonL +// --------------------------------------------------------------------------- +// +void T_XIMPTestConnection::PluginAPIMethodCommonL( TXIMPRequestId& aOpId ) + { + iReqId = aOpId; + + TInt index = CXIMPTestMessenger::GetPluginIndex(); + TInt count = iClients.Count(); + for( TInt a = 0; a < count; ++a ) + { + if( iClients[ a ]->iPluginIndex == index ) + { + iCurrentMessenger = iClients[ a ]->iMessenger; + } + } + iCurrentMessenger->HandleLeaveL(); + // handle other errors here + if ( iCurrentMessenger->GetBoolean( EXIMPTestPlgBehaveInvalidReqId ) ) + { + // arbitrarily mangle the given request id + TXIMPRequestIdBuilder idBuilder; + idBuilder.SetProtocolId( 123 ); + idBuilder.SetSessionId( 456 ); + idBuilder.SetRequestId( 789 ); + //iReqId = TXIMPRequestId( 123, 456, 789 ); + iReqId = idBuilder.BuildRequestId(); + } + } + +// --------------------------------------------------------------------------- +// T_XIMPTestConnection::WaitCompleted() +// --------------------------------------------------------------------------- +// +void T_XIMPTestConnection::WaitCompleted( TInt /* aRetVal */ ) + { + TInt errorCode = iCurrentMessenger->GetError(); + +/* + if ( iSessionLostFailReconnects ) + { + // fail all reconnects + errorCode = KErrTimedOut; + iConnectedClients = 0; + } +*/ + MXIMPStatus* status = iConnectionHost->ObjectFactory().NewStatusLC(); + CleanupStack::Pop(); // status. + status->SetResultCode( errorCode ); + + MXIMPRestrictedObjectCollection* reqCompleteParams = iCurrentMessenger->GetReqCompleteParams(); + + if( reqCompleteParams ) + { + iConnectionHost->HandleRequestCompleted( iReqId, status, reqCompleteParams ); + reqCompleteParams = NULL; + } + else + { + iConnectionHost->HandleRequestCompleted( iReqId, status ); + } + + if ( iSessionLostFailReconnects ) + { + // doing a sequence of failing reconnects + return; + } + + // check if test code wants us to fake session lost + TInt val = iCurrentMessenger->GetValueFor( EXIMPTestPlgSessionLostStrategy ); + + if ( val != EXIMPPrtValSessionLostEmpty ) + { + // yep, fake session lost + + // reset the old value! otherwise timer will restart upon next operation. + iCurrentMessenger->SetValueFor( EXIMPTestPlgSessionLostStrategy, EXIMPPrtValSessionLostEmpty ); + + iSessionLostReconnect = val == EXIMPPrtValSessionLostReconnect; + iSessionLostFailReconnects = val == EXIMPPrtValSessionLostReconnectExhaustAttempts; + + // start another wait (5 sec) with callback. + TInt time = 1000000 * 5; + TCallBack callback( ReconnectSimulator, this ); + iAuxTimer->Start( time, time, callback ); + } + + delete iClientToBeDeleted; + iClientToBeDeleted = NULL; + + } + +// --------------------------------------------------------------------------- +// RECONNECTION SIMULATOR ROUTINES +// --------------------------------------------------------------------------- +// +TInt T_XIMPTestConnection::ReconnectSimulator( TAny* aMyself ) + { +// (static_cast(aMyself))->DoReconnectSimulator(); + return 0; // ignored by CPeriodic + } + +void T_XIMPTestConnection::DoReconnectSimulator() + { +/* TRAPD( err, DoReconnectSimulatorL() ); + if ( err != KErrNone ) + { + // TODO what to do? is this enough to fail testcode + User::Panic( _L("XIMPTestPrt"), 424242 ); + } + */ + } + +void T_XIMPTestConnection::DoReconnectSimulatorL() + { + iAuxTimer->Cancel(); // must stop it from running again +/* + // connection dies. + iConnectedClients = 0; + + if ( iSessionLostReconnect || iSessionLostFailReconnects ) + { + // tell host to try to reconnect + iConnectionHost->HandleConnectionLost( iStatus ); + } + else + { + // tell host to kill connection + iConnectionHost->HandleConnectionTerminated( iStatus ); + } +*/ + } + +void T_XIMPTestConnection::SetBooleanToCurrent( TXIMPTestPropertyKeys aKey ) + { + if( iCurrentMessenger ) + { + iCurrentMessenger->SetBoolean( aKey ); + } + } + +void T_XIMPTestConnection::SetBoolean( TXIMPTestPropertyKeys aKey ) + { + TInt count = iClients.Count(); + for( TInt a = 0; a < count ; ++a ) + { + iClients[ a ]->iMessenger->SetBoolean( aKey ); + } + } + +// --------------------------------------------------------------------------- +// T_XIMPTestConnection::GetInterface() +// --------------------------------------------------------------------------- +// +TAny* T_XIMPTestConnection::GetInterface( + TInt32 aInterfaceId, + TIfGetOps /* aOptions */ ) + { + if ( aInterfaceId == MXIMPProtocolConnection::KInterfaceId ) + { + // caller wants this interface + MXIMPProtocolConnection* myIf = this; + return myIf; + } + else if( aInterfaceId == MProtocolPresencePublishing::KInterfaceId ) + { + // caller wants this interface + MProtocolPresencePublishing* myIf = this; + return myIf; + } + else if( aInterfaceId == MProtocolPresenceWatching::KInterfaceId ) + { + // caller wants this interface + MProtocolPresenceWatching* myIf = this; + return myIf; + } + else if( aInterfaceId == MProtocolPresenceAuthorization::KInterfaceId ) + { + // caller wants this interface + MProtocolPresenceAuthorization* myIf = this; + return myIf; + } + else if( aInterfaceId == MProtocolPresentityGroups::KInterfaceId ) + { + // caller wants this interface + MProtocolPresentityGroups* myIf = this; + return myIf; + } + else if( aInterfaceId == T_XIMPTestConnection::KClassId ) + { + return this; + } + else + { + return NULL; + } + } + +// --------------------------------------------------------------------------- +// T_XIMPTestConnection::GetInterface() +// --------------------------------------------------------------------------- +// +const TAny* T_XIMPTestConnection::GetInterface( + TInt32 aInterfaceId, + TIfGetOps /* aOptions */ ) const + { + if ( aInterfaceId == MXIMPProtocolConnection::KInterfaceId ) + { + // caller wants this interface + const MXIMPProtocolConnection* myIf = this; + return myIf; + } + else if( aInterfaceId == MProtocolPresencePublishing::KInterfaceId ) + { + // caller wants this interface + const MProtocolPresencePublishing* myIf = this; + return myIf; + } + else if( aInterfaceId == MProtocolPresenceWatching::KInterfaceId ) + { + // caller wants this interface + const MProtocolPresenceWatching* myIf = this; + return myIf; + } + else if( aInterfaceId == MProtocolPresenceAuthorization::KInterfaceId ) + { + // caller wants this interface + const MProtocolPresenceAuthorization* myIf = this; + return myIf; + } + else if( aInterfaceId == MProtocolPresentityGroups::KInterfaceId ) + { + // caller wants this interface + const MProtocolPresentityGroups* myIf = this; + return myIf; + } + else if( aInterfaceId == T_XIMPTestConnection::KClassId ) + { + return this; + } + else + { + return NULL; + } + } + +// --------------------------------------------------------------------------- +// T_XIMPTestConnection::GetInterfaceId() +// --------------------------------------------------------------------------- +// +TInt32 T_XIMPTestConnection::GetInterfaceId() const + { + return MXIMPProtocolConnection::KInterfaceId; + } + + +// --------------------------------------------------------------------------- +// Key value pair table to identify correct constructor +// function for the requested interface. +// --------------------------------------------------------------------------- +// +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY( K_PRFW_TST_PROTOCOL_1_IMPLEMENTATION_UID, + T_XIMPTestProtocol::NewL ) + }; + + +// --------------------------------------------------------------------------- +// Exported function to return the implementation proxy table +// --------------------------------------------------------------------------- +// +EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount ) + { + aTableCount = sizeof( ImplementationTable ) / sizeof( TImplementationProxy ); + return ImplementationTable; + } + +// --------------------------------------------------------------------------- +// T_XIMPTestProtocol::T_XIMPTestProtocol() +// --------------------------------------------------------------------------- +// +T_XIMPTestProtocol::T_XIMPTestProtocol() + { + } + + +// --------------------------------------------------------------------------- +// T_XIMPTestProtocol::ConstructL() +// --------------------------------------------------------------------------- +// +void T_XIMPTestProtocol::ConstructL() + { + } + + +// --------------------------------------------------------------------------- +// T_XIMPTestProtocol::NewLC() +// --------------------------------------------------------------------------- +// +T_XIMPTestProtocol* T_XIMPTestProtocol::NewLC() + { + T_XIMPTestProtocol* self = new( ELeave ) T_XIMPTestProtocol(); + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + + +// --------------------------------------------------------------------------- +// T_XIMPTestProtocol::NewL() +// --------------------------------------------------------------------------- +// +T_XIMPTestProtocol* T_XIMPTestProtocol::NewL() + { + T_XIMPTestProtocol* self = T_XIMPTestProtocol::NewLC(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// T_XIMPTestProtocol::~T_XIMPTestProtocol() +// --------------------------------------------------------------------------- +// +T_XIMPTestProtocol::~T_XIMPTestProtocol() + { + iConnections.Close(); + } + +// --------------------------------------------------------------------------- +// T_XIMPTestProtocol::PrimeHost() +// --------------------------------------------------------------------------- +// +void T_XIMPTestProtocol::PrimeHost( MXIMPProtocolPluginHost& aHost ) + { + iHost = &aHost; + } + +// --------------------------------------------------------------------------- +// T_XIMPTestProtocol::AcquireConnectionL() +// --------------------------------------------------------------------------- +// +MXIMPProtocolConnection& T_XIMPTestProtocol::AcquireConnectionL( + const MXIMPServiceInfo& aServiceInfo, + const MXIMPContextClientInfo& aClientCtxInfo ) + { + T_XIMPTestConnection* newConnection = T_XIMPTestConnection::NewLC( aServiceInfo, aClientCtxInfo ); + TLinearOrder< T_XIMPTestConnection > order( T_XIMPTestConnection::OrderOfConnections ); + TInt index = iConnections.FindInOrder( newConnection, order ); + if( index != KErrNotFound ) + { + User::LeaveIfError( index ); + CleanupStack::PopAndDestroy(); // newConnection + newConnection = iConnections[ index ]; + } + else + { + iConnections.InsertInOrderL( newConnection, order ); + CleanupStack::Pop(); //newConnection + } + return *newConnection; + } + +// --------------------------------------------------------------------------- +// T_XIMPTestProtocol::ReleaseConnection() +// --------------------------------------------------------------------------- +// +void T_XIMPTestProtocol::ReleaseConnection( MXIMPProtocolConnection& aConnection ) + { + TLinearOrder< T_XIMPTestConnection > order( T_XIMPTestConnection::OrderOfConnections ); + T_XIMPTestConnection* connection = ( T_XIMPTestConnection* )( aConnection.GetInterface( + T_XIMPTestConnection::KClassId, + MXIMPBase::EPanicIfUnknown ) ); + TInt index = iConnections.FindInOrder( connection, order ); + if( index >= 0 ) + { + iConnections.Remove( index ); + } + delete connection; + } + +// --------------------------------------------------------------------------- +// T_XIMPTestProtocol::GetInterface() +// --------------------------------------------------------------------------- +// +TAny* T_XIMPTestProtocol::GetInterface( + TInt32 aInterfaceId, + TIfGetOps /* aOptions */ ) + { + if ( aInterfaceId == MXIMPProtocolPlugin::KInterfaceId ) + { + // caller wants this interface + MXIMPProtocolPlugin* myIf = this; + return myIf; + } + else + { + return NULL; + } + } + +// --------------------------------------------------------------------------- +// T_XIMPTestProtocol::GetInterface() +// --------------------------------------------------------------------------- +// +const TAny* T_XIMPTestProtocol::GetInterface( + TInt32 aInterfaceId, + TIfGetOps /* aOptions */ ) const + { + if ( aInterfaceId == MXIMPProtocolPlugin::KInterfaceId ) + { + // caller wants this interface + const MXIMPProtocolPlugin* myIf = this; + return myIf; + } + else + { + return NULL; + } + } + +// --------------------------------------------------------------------------- +// T_XIMPTestProtocol::GetInterfaceId() +// --------------------------------------------------------------------------- +// +TInt32 T_XIMPTestProtocol::GetInterfaceId() const + { + return MXIMPProtocolPlugin::KInterfaceId; + } + + + +// End of file + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcprotocols/pr_prfwtestprotocol/pr_prfwtestprotocol.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcprotocols/pr_prfwtestprotocol/pr_prfwtestprotocol.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,403 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Test Protocol implementation for XIMP Framework + * +*/ + + +#ifndef T_PRFWTESTPROTOCOL_H +#define T_PRFWTESTPROTOCOL_H + + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "prfwwaitobserver.h" + +#include "prfwtestmessaging.h" + +class CXIMPTestGeneralWaiter; +class CXIMPTestMessenger; +class CPeriodic; +class CXIMPTestFileLogicHelper; +class CXIMPTestFileTool; +class MXIMPRestrictedObjectCollection; +class MProtocolImFeatures; +#define PRIMP_CLSID_CPRESENTITYGROUPINFOIMP 15000 + +class T_XIMPTestConnection :public CBase, + public MXIMPProtocolConnection, + public MProtocolPresenceFeatures, + public MProtocolPresencePublishing, + public MProtocolPresenceWatching, + public MProtocolPresenceAuthorization, + public MProtocolPresentityGroups, + public MXIMPProtocolConnectionHostObserver, + public T_MWaitObserver + + { + public: + /** The class ID. */ + enum { KClassId = PRIMP_CLSID_CPRESENTITYGROUPINFOIMP }; + + + class ClientWrapper : public CBase + { + private: + + void ConstructL( const TDesC& aClientId ); + + public: + + static ClientWrapper* NewLC( const TDesC& aClientId ); + void InitializeL( MXIMPProtocolConnectionHost& aConnectionHost ); + ~ClientWrapper(); + + public: + + RBuf iId; + CXIMPTestFileTool* iFileTool; + CXIMPTestMessenger* iMessenger; + CXIMPTestFileLogicHelper* iFileLogicHelper; + TInt iPluginIndex; + }; + + public: + + static T_XIMPTestConnection* NewL( const MXIMPServiceInfo& aServiceInfo, + const MXIMPContextClientInfo& aClientCtxInfo ); + static T_XIMPTestConnection* NewLC( const MXIMPServiceInfo& aServiceInfo, + const MXIMPContextClientInfo& aClientCtxInfo ); + + ~T_XIMPTestConnection(); + + + private: + + T_XIMPTestConnection(); + void ConstructL( const MXIMPServiceInfo& aServiceInfo, + const MXIMPContextClientInfo& aClientCtxInfo ); + + public: // From MXIMPProtocolConnection + + /** + * host for connection + */ + void PrimeHost( MXIMPProtocolConnectionHost& aHost ); + + void OpenSessionL( const MXIMPContextClientInfo& aClientCtxInfo, + TXIMPRequestId aReqId ); + + + void OpenSessionL( + const TInt& aSettingsId, + TXIMPRequestId aReqId ); + + void CloseSession( const MXIMPContextClientInfo& aClientCtxInfo, + TXIMPRequestId aReqId ); + + MProtocolPresenceFeatures& ProtocolPresenceFeatures(); + + //MProtocolImFeatures* ProtocolImFeatures(); + + TAny* GetProtocolInterface(TInt aInterfaceId); + + public: // MProtocolPresenceFeatures + MProtocolPresenceWatching& PresenceWatching(); + MProtocolPresencePublishing& PresencePublishing(); + MProtocolPresentityGroups& PresentityGroups(); + MProtocolPresenceAuthorization& PresenceAuthorization(); + + + public: // From MXIMPProtocolConnectionHostObserver + + void HandleProtocolConnectionHostEvent( + const MXIMPProtocolConnectionHost& aHost, + const MXIMPBase& aEvent ); + + + public: // from MPscPlugin + + + void GetSupportedFeaturesL( + CDesC8Array& aFeatures ) const; + + void DoPublishOwnPresenceL( + const MPresenceInfo& aPresence, + TXIMPRequestId aReqId ); + + void DoSubscribeOwnPresenceL( const MPresenceInfoFilter& aPif, + TXIMPRequestId aReqId ); + + void DoUnsubscribeOwnPresenceL( TXIMPRequestId aReqId ); + + void DoUpdateOwnPresenceSubscriptionPifL( const MPresenceInfoFilter& aPif, + TXIMPRequestId aReqId ); + + + void DoSubscribePresenceWatcherListL( TXIMPRequestId aReqId ); + void DoUnsubscribePresenceWatcherListL( TXIMPRequestId aReqId ); + + void DoSubscribePresentityGroupListL( TXIMPRequestId aReqId ); + void DoUnsubscribePresentityGroupListL( TXIMPRequestId aReqId ); + + void DoCreatePresentityGroupL( const MXIMPIdentity& aIdentity, + const TDesC16& aDisplayName, + TXIMPRequestId aReqId ); + void DoDeletePresentityGroupL( const MXIMPIdentity& aIdentity, + TXIMPRequestId aReqId ); + void DoUpdatePresentityGroupDisplayNameL( const MXIMPIdentity& aIdentity, + const TDesC16& aDisplayName, + TXIMPRequestId aReqId ); + void DoSubscribePresentityPresenceL( + const MXIMPIdentity& aIdentity, + const MPresenceInfoFilter& aPif, + TXIMPRequestId aReqId ); + void DoUpdatePresentityPresenceSubscriptionPifL( + const MXIMPIdentity& aIdentity, + const MPresenceInfoFilter& aPif, + TXIMPRequestId aReqId ); + void DoUnsubscribePresentityPresenceL( const MXIMPIdentity& aIdentity, + TXIMPRequestId aReqId ); + + void DoSubscribePresentityGroupContentL( const MXIMPIdentity& aGroupId, + TXIMPRequestId aReqId ); + + void DoUnsubscribePresentityGroupContentL( const MXIMPIdentity& aGroupId, + TXIMPRequestId aReqId ); + + void DoAddPresentityGroupMemberL( const MXIMPIdentity& aGroupId, + const MXIMPIdentity& aMemberId, + const TDesC16& aMemberDisplayName, + TXIMPRequestId aReqId ); + + void DoRemovePresentityGroupMemberL( const MXIMPIdentity& aGroupId, + const MXIMPIdentity& aMemberId, + TXIMPRequestId aReqId ); + + void DoUpdatePresentityGroupMemberDisplayNameL( const MXIMPIdentity& aGroupId, + const MXIMPIdentity& aMemberId, + const TDesC16& aMemberDisplayName, + TXIMPRequestId aReqId ); + void DoSubscribePresentityGroupMembersPresenceL( + const MXIMPIdentity& aIdentity, + const MPresenceInfoFilter& aPif, + TXIMPRequestId aReqId ); + + void DoUpdatePresentityGroupMembersPresenceSubscriptionPifL( + const MXIMPIdentity& aIdentity, + const MPresenceInfoFilter& aPif, + TXIMPRequestId aReqId ); + + void DoUnsubscribePresentityGroupMembersPresenceL( const MXIMPIdentity& aIdentity, + TXIMPRequestId aReqId ); + + void DoSubscribePresenceGrantRequestListL( TXIMPRequestId aReqId ); + + void DoUnsubscribePresenceGrantRequestListL( TXIMPRequestId aReqId ); + + void DoGrantPresenceForPresentityL( const MXIMPIdentity& aIdentity, + const MPresenceInfoFilter& aPif, + TXIMPRequestId aReqId ); + void DoGrantPresenceForPresentityGroupMembersL( const MXIMPIdentity& aGroupId, + const MPresenceInfoFilter& aPif, + TXIMPRequestId aReqId ); + + void DoGrantPresenceForEveryoneL( const MPresenceInfoFilter& aPif, + TXIMPRequestId aReqId ); + + void DoUpdatePresenceGrantPifForPresentityL( const MXIMPIdentity& aIdentity, + const MPresenceInfoFilter& aPif, + TXIMPRequestId aReqId ); + + void DoUpdatePresenceGrantPifForPresentityGroupMembersL( const MXIMPIdentity& aGroupId, + const MPresenceInfoFilter& aPif, + TXIMPRequestId aReqId ); + + void DoUpdatePresenceGrantPifForEveryoneL( const MPresenceInfoFilter& aPif, + TXIMPRequestId aReqId ); + + void DoWithdrawPresenceGrantFromPresentityL( const MXIMPIdentity& aIdentity, TXIMPRequestId aReqId ); + + void DoWithdrawPresenceGrantFromPresentityGroupMembersL( const MXIMPIdentity& aGroupId, + TXIMPRequestId aReqId ); + + void DoWithdrawPresenceGrantFromEveryoneL( TXIMPRequestId aReqId ); + + void DoSubscribePresenceBlockListL( TXIMPRequestId aReqId ); + void DoUnsubscribePresenceBlockListL( TXIMPRequestId aReqId ); + void DoBlockPresenceForPresentityL( const MXIMPIdentity& aPresentityId, + TXIMPRequestId aReqId ); + void DoCancelPresenceBlockFromPresentityL( const MXIMPIdentity& aPresentityId, + TXIMPRequestId aReqId ); + + public: // from T_MWaitObserver + + void WaitCompleted( TInt aRetVal ); + + + public: // from MXIMPBase + + TAny* GetInterface( + TInt32 aInterfaceId, + TIfGetOps aOptions ); + + const TAny* GetInterface( + TInt32 aInterfaceId, + TIfGetOps aOptions ) const; + + TInt32 GetInterfaceId() const; + + private: + /** + * All plugin API methods should call this method + * to handle test code to plugin communication + * properly. + * Add more common stuff here (such as new special messages + * which behave in a common way to all plugin API calls, etc.) + * @param aOpId The request id + */ + void PluginAPIMethodCommonL( TXIMPRequestId& aOpId ); + + /** + * Callback for aux timer + * @see TCallBack + */ + static TInt ReconnectSimulator( TAny* aMyself ); + + /** + * Actual callback called from ReconnectSimulator + */ + void DoReconnectSimulator(); + + /** + * Leaving version of aux timer callback. + */ + void DoReconnectSimulatorL(); + + void SetBooleanToCurrent( TXIMPTestPropertyKeys aKey ); + void SetBoolean( TXIMPTestPropertyKeys aKey ); + + public: + static TInt OrderOfConnections( const T_XIMPTestConnection& aFirst, + const T_XIMPTestConnection& aSecond ); + + private: + + static TInt OrderOfClients( const ClientWrapper& aFirst, + const ClientWrapper& aSecond ); + private: + + HBufC* iServerAddress; + HBufC* iUserName; + HBufC* iPassword; + HBufC* iClientId; + + //TInt iConnectedClients; + + RPointerArray< ClientWrapper > iClients; + ClientWrapper* iClientToBeDeleted; + + TXIMPRequestId iReqId; + CXIMPTestGeneralWaiter* iWaitter; + + MXIMPStatus* iStatus; + + // last received message + TXIMPTestMsg iLastMsg; + + // ETrue if reconnect is to be faked for session lost. + TBool iSessionLostReconnect; + + // ETrue if all reconnects are to be failed. + TBool iSessionLostFailReconnects; + + // auxiliary timer (session lost simulation) + CPeriodic* iAuxTimer; + + + /** + * File tool for monitoring events. + */ + //CXIMPTestFileTool* iFileTool; + + /** + * Host for connection + */ + MXIMPProtocolConnectionHost* iConnectionHost; + + CXIMPTestMessenger* iCurrentMessenger; + }; + +/** + * Example protocol plugin + * + * + * @lib ?library + * @since S60 v4.0 + */ +class T_XIMPTestProtocol : public CXIMPProtocolPluginBase + { + public: + + static T_XIMPTestProtocol* NewL(); + static T_XIMPTestProtocol* NewLC(); + + ~T_XIMPTestProtocol(); + + private: + + T_XIMPTestProtocol(); + void ConstructL(); + + public: // From MXIMPProtocolPlugin + + void PrimeHost( MXIMPProtocolPluginHost& aHost ); + + MXIMPProtocolConnection& AcquireConnectionL( + const MXIMPServiceInfo& aServiceInfo, + const MXIMPContextClientInfo& aClientCtxInfo ); + void ReleaseConnection( + MXIMPProtocolConnection& aConnection ); + + public: // from MXIMPBase + + TAny* GetInterface( + TInt32 aInterfaceId, + TIfGetOps aOptions ); + + const TAny* GetInterface( + TInt32 aInterfaceId, + TIfGetOps aOptions ) const; + + TInt32 GetInterfaceId() const; + + + private: // Data + + // Prime host + MXIMPProtocolPluginHost* iHost; + RXIMPObjOwningPtrArray< T_XIMPTestConnection > iConnections; + }; + +#endif // T_PRFWTESTPROTOCOL_H diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcprotocols/pr_prfwtestprotocol/pr_prfwtestprotocol.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcprotocols/pr_prfwtestprotocol/pr_prfwtestprotocol.mmp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,80 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project definition file for Presence Framework Test Protocol +* +*/ + +#include +#include "../prfwtestprotocols_resource.hrh" + +TARGET pr_prfwtestprotocol.dll +TARGETTYPE PLUGIN +UID XIMP_DLL_UID_ECOM_PLUGIN PRFW_DLL_UID_PR_PRFWTESTPROTOCOL +VENDORID VID_DEFAULT +CAPABILITY ALL -TCB -DRM + + +//ECOM RESOURCE +START RESOURCE pr_prfwtestprotocol.rss +TARGET pr_prfwtestprotocol.rsc +END // RESOURCE + +SOURCEPATH . +SOURCE pr_prfwtestprotocol.cpp + +SOURCEPATH ../../tsrcutils/testcaseutils +SOURCE prfwtestfilelogichelper.cpp +SOURCE prfwtestfiletool.cpp + +USERINCLUDE ../../../../../ximpfw/core/srcdatamodel +USERINCLUDE ../../../../../ximpfw/presence/srcpresencedatamodel +USERINCLUDE ../../../../../ximpfw/presence/srcpresencedatamodel/presentitygroups +USERINCLUDE ../../../../../ximpfw/presence/srcpresencedatamodel/presencewatching +USERINCLUDE ../../../../../ximpfw/presence/srcpresencedatamodel/presenceauthorization +USERINCLUDE ../../../../../ximpfw/presence/srcpresencedatamodel/presencepublishing +USERINCLUDE ../../../../../ximpfw/presence/srcpresencedatamodel/presenceinfo +USERINCLUDE ../../../../../ximpfw/core/srcutils +USERINCLUDE ../../tsrcprotocols +USERINCLUDE ../../tsrcutils/testcaseutils + +// TODO remove unnecessary +SYSTEMINCLUDE ../../../../../ximpfw/inc/core/base +SYSTEMINCLUDE ../../../../../ximpfw/inc/core/datamodel +SYSTEMINCLUDE ../../../../../ximpfw/inc/core/protocolplugin +SYSTEMINCLUDE ../../../../../ximpfw/inc/core/protocolpluginhost +SYSTEMINCLUDE ../../../../../ximpfw/inc/presence/presencedatamodel +SYSTEMINCLUDE ../../../../../ximpfw/inc/presence/presencemanagement +SYSTEMINCLUDE ../../../../../ximpfw/inc/presence/presenceprotocolplugin +SYSTEMINCLUDE ../../../../../ximpfw/inc/presence/presenceprotocolpluginhost + + + +MW_LAYER_SYSTEMINCLUDE +SYSTEMINCLUDE /epoc32/include/ecom + + +LIBRARY euser.lib +LIBRARY ecom.lib +LIBRARY bafl.lib +LIBRARY estor.lib +LIBRARY efsrv.lib +LIBRARY flogger.lib + +LIBRARY ximpdatamodel.lib +LIBRARY presencedatamodel.lib +LIBRARY ximputils.lib +LIBRARY prfwtestcaseutils.lib + + +// End of file diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcprotocols/pr_prfwtestprotocol/pr_prfwtestprotocol.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcprotocols/pr_prfwtestprotocol/pr_prfwtestprotocol.rss Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,53 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ECOM registery info for Presence Framework Test Protocol +* +*/ + +#include +#include + +#include "prfwtestprotocols_resource.hrh" + + + +// --------------------------------------------------------------------------- +// ECOM registery info for Presence Framework ECOM hook +// --------------------------------------------------------------------------- +// +RESOURCE REGISTRY_INFO theInfo + { + resource_format_version = RESOURCE_FORMAT_VERSION_2; + dll_uid = PRFW_DLL_UID_PR_PRFWTESTPROTOCOL; + + interfaces = + { + INTERFACE_INFO + { + interface_uid = XIMP_ECOM_IF_UID_PROTOCOL_PLUGIN_BASE_INTERFACE; + + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = PRFW_TST_PROTOCOL_1_IMPLEMENTATION_UID; + version_no = PRFW_TST_PROTOCOL_1_VERSION_NO; + display_name = PRFW_TST_PROTOCOL_1_DISPLAY_NAME; + default_data = PRFW_TST_PROTOCOL_1_DEFAULT_DATA; + opaque_data = PRFW_TST_PROTOCOL_1_OPAQUE_DATA; + } + }; + } + }; + } diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcprotocols/prfwtestprotocols.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcprotocols/prfwtestprotocols.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,49 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef PRFWTESTPROTOCOLS_H +#define PRFWTESTPROTOCOLS_H + +#include + + +/** + * C++ compatible definitions for XIMP test protocols. + * + * This must be kept in-sync with definitions in + * "prfwtestprotocols_resource.hrh" + */ + +//XIMP primary test protocol +const TInt K_PRFW_TST_PROTOCOL_1_IMPLEMENTATION_UID = 0x10282DDF; +const TInt K_PRFW_TST_PROTOCOL_1_VERSION_NO = 1; +_LIT( K_PRFW_TST_PROTOCOL_1_DISPLAY_NAME, "XIMP primary test protocol" ); +_LIT( K_PRFW_TST_PROTOCOL_1_DEFAULT_DATA, "" ); +_LIT( K_PRFW_TST_PROTOCOL_1_OPAQUE_DATA, "

Nokiafeat/pres/pubfeat/pres/fetchfeat/pres/subssip" ); + + + +//XIMP secondary test protocols +const TInt K_PRFW_TST_PROTOCOL_2_IMPLEMENTATION_UID = 0x10282DE0; +const TInt K_PRFW_TST_PROTOCOL_3_IMPLEMENTATION_UID = 0x10282DE1; +const TInt K_PRFW_TST_PROTOCOL_4_IMPLEMENTATION_UID = 0x10282DE2; +const TInt K_PRFW_TST_PROTOCOL_5_IMPLEMENTATION_UID = 0x10282DE3; + + + +#endif // PRFWTESTPROTOCOLS_H + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcprotocols/prfwtestprotocols_resource.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcprotocols/prfwtestprotocols_resource.hrh Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,62 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef PRFWTESTPROTOCOLS_RESOURCE_HRH +#define PRFWTESTPROTOCOLS_RESOURCE_HRH + + + +/** + * System wide UID 2:s for ECom plugin dlls. + */ +#define XIMP_DLL_UID_ECOM_PLUGIN 0x10009D8D + + +/** + * Officially reserved UID 3 for the Presence Framework + * test protocol dll. + */ +#define PRFW_DLL_UID_PR_PRFWTESTPROTOCOL 0x10282DDD + + + +/** + * Resource file compatible defintions for PrFw test protocols. + * + * This must be kept in-sync with definitions in + * "prfwtestprotocols.h" + */ + +//PrFw primary test protocol +#define PRFW_TST_PROTOCOL_1_IMPLEMENTATION_UID 0x10282DDF +#define PRFW_TST_PROTOCOL_1_VERSION_NO 1 +#define PRFW_TST_PROTOCOL_1_DISPLAY_NAME "PrFw primary test protocol" +#define PRFW_TST_PROTOCOL_1_DEFAULT_DATA "" +#define PRFW_TST_PROTOCOL_1_OPAQUE_DATA "

Nokiafeat/pres/pubfeat/pres/fetchfeat/pres/subssip" + + + +//PrFw secondary test protocols +#define PRFW_TST_PROTOCOL_2_IMPLEMENTATION_UID 0x10282DE0 +#define PRFW_TST_PROTOCOL_3_IMPLEMENTATION_UID 0x10282DE1 +#define PRFW_TST_PROTOCOL_4_IMPLEMENTATION_UID 0x10282DE2 +#define PRFW_TST_PROTOCOL_5_IMPLEMENTATION_UID 0x10282DE3 + + + +#endif // PRFWTESTPROTOCOLS_RESOURCE_HRH + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/bld.inf Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,22 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Build information file for prfwtestcaseutils.dll +* +*/ + + +#include "testcaseutils/bld.inf" +#include "processmaster/bld.inf" + +//#include "eunitcommon/move_tests_to_eunit.inf" diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/bwins/prfwtestcaseutilsu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/bwins/prfwtestcaseutilsu.def Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,113 @@ +EXPORTS + ??0TXIMPTestStatusEventSnapshot@@QAE@HHH@Z @ 1 NONAME ; TXIMPTestStatusEventSnapshot::TXIMPTestStatusEventSnapshot(int, int, int) + ??0TXIMPTestStatusEventSnapshot@@QAE@XZ @ 2 NONAME ; TXIMPTestStatusEventSnapshot::TXIMPTestStatusEventSnapshot(void) + ?AcceptedEventTypes@CXIMPTestStatusEventListener@@QAEAAV?$RArray@J@@XZ @ 3 NONAME ; class RArray & CXIMPTestStatusEventListener::AcceptedEventTypes(void) + ?AppendToTraitsL@CXIMPTestContextWrapper@@QAEXW4TXIMPTestStatusEventTemplate@@@Z @ 4 NONAME ; void CXIMPTestContextWrapper::AppendToTraitsL(enum TXIMPTestStatusEventTemplate) + ?AssertAddPresentityGroupMemberCalled@CXIMPTestMessenger@@QAEXH@Z @ 5 NONAME ; void CXIMPTestMessenger::AssertAddPresentityGroupMemberCalled(int) + ?AssertCloseSessionCalled@CXIMPTestMessenger@@QAEXH@Z @ 6 NONAME ; void CXIMPTestMessenger::AssertCloseSessionCalled(int) + ?AssertCreatePresentityGroupCalled@CXIMPTestMessenger@@QAEXH@Z @ 7 NONAME ; void CXIMPTestMessenger::AssertCreatePresentityGroupCalled(int) + ?AssertEquality@XIMPTestPresenceDataUtils@@SAXAAVMPresenceInfo@@0@Z @ 8 NONAME ; void XIMPTestPresenceDataUtils::AssertEquality(class MPresenceInfo &, class MPresenceInfo &) + ?AssertOpenSessionCalled@CXIMPTestMessenger@@QAEXH@Z @ 9 NONAME ; void CXIMPTestMessenger::AssertOpenSessionCalled(int) + ?AssertPluginDied@CXIMPTestMessenger@@QAEXH@Z @ 10 NONAME ; void CXIMPTestMessenger::AssertPluginDied(int) + ?AssertRemovePresentityGroupMemberCalled@CXIMPTestMessenger@@QAEXH@Z @ 11 NONAME ; void CXIMPTestMessenger::AssertRemovePresentityGroupMemberCalled(int) + ?AssertShareSessionCalled@CXIMPTestMessenger@@QAEXH@Z @ 12 NONAME ; void CXIMPTestMessenger::AssertShareSessionCalled(int) + ?AssertSubscribePresentityGroupContentCalled@CXIMPTestMessenger@@QAEXH@Z @ 13 NONAME ; void CXIMPTestMessenger::AssertSubscribePresentityGroupContentCalled(int) + ?AssertSubscribePresentityGroupListCalled@CXIMPTestMessenger@@QAEXH@Z @ 14 NONAME ; void CXIMPTestMessenger::AssertSubscribePresentityGroupListCalled(int) + ?AssertUnshareSessionCalled@CXIMPTestMessenger@@QAEXH@Z @ 15 NONAME ; void CXIMPTestMessenger::AssertUnshareSessionCalled(int) + ?AssertUnsubscribePresentityGroupContentCalled@CXIMPTestMessenger@@QAEXH@Z @ 16 NONAME ; void CXIMPTestMessenger::AssertUnsubscribePresentityGroupContentCalled(int) + ?AssertUnsubscribePresentityGroupListCalled@CXIMPTestMessenger@@QAEXH@Z @ 17 NONAME ; void CXIMPTestMessenger::AssertUnsubscribePresentityGroupListCalled(int) + ?AssertUpdatePresentityGroupDisplayNameCalled@CXIMPTestMessenger@@QAEXH@Z @ 18 NONAME ; void CXIMPTestMessenger::AssertUpdatePresentityGroupDisplayNameCalled(int) + ?AssertUpdatePresentityGroupMemberDisplayNameCalled@CXIMPTestMessenger@@QAEXH@Z @ 19 NONAME ; void CXIMPTestMessenger::AssertUpdatePresentityGroupMemberDisplayNameCalled(int) + ?BindL@CXIMPTestContextWrapper@@QAEXH@Z @ 20 NONAME ; void CXIMPTestContextWrapper::BindL(int) + ?BindL@CXIMPTestContextWrapper@@QAEXVTUid@@ABVTDesC16@@11@Z @ 21 NONAME ; void CXIMPTestContextWrapper::BindL(class TUid, class TDesC16 const &, class TDesC16 const &, class TDesC16 const &) + ?BindWithSettingsL@CXIMPTestContextWrapper@@QAEXH@Z @ 22 NONAME ; void CXIMPTestContextWrapper::BindWithSettingsL(int) + ?CleanAllL@CXIMPTestFileTool@@SAXXZ @ 23 NONAME ; void CXIMPTestFileTool::CleanAllL(void) + ?ClearListener@CXIMPTestContextWrapper@@QAEXXZ @ 24 NONAME ; void CXIMPTestContextWrapper::ClearListener(void) + ?CommonAssert@CXIMPTestMessenger@@ABEXW4TXIMPTestPropertyKeys@@HABVTDesC8@@1@Z @ 25 NONAME ; void CXIMPTestMessenger::CommonAssert(enum TXIMPTestPropertyKeys, int, class TDesC8 const &, class TDesC8 const &) const + ?Contains@XIMPTestPresenceDataUtils@@QBEHAAVMPresenceInfo@@0@Z @ 26 NONAME ; int XIMPTestPresenceDataUtils::Contains(class MPresenceInfo &, class MPresenceInfo &) const + ?CreateGroupContentEventLCX@XIMPTestEventFactory@@SAPAVCPresentityGroupContentEventImp@@ABVTDesC16@@00W4TTestPGLContentArraySpecifier@1@00W4TSubscriptionState@MXIMPDataSubscriptionState@@W4TDataState@6@@Z @ 27 NONAME ; class CPresentityGroupContentEventImp * XIMPTestEventFactory::CreateGroupContentEventLCX(class TDesC16 const &, class TDesC16 const &, class TDesC16 const &, enum XIMPTestEventFactory::TTestPGLContentArraySpecifier, class TDesC16 const &, class TDesC16 const &, enum MXIMPDataSubscriptionState::TSubscriptionState, enum MXIMPDataSubscriptionState::TDataState) + ?CreateGroupListEventLCX@XIMPTestEventFactory@@SAPAVCPresentityGroupListEventImp@@ABVTDesC16@@0W4TTestPGLArraySpecifier@1@00W4TSubscriptionState@MXIMPDataSubscriptionState@@W4TDataState@6@@Z @ 28 NONAME ; class CPresentityGroupListEventImp * XIMPTestEventFactory::CreateGroupListEventLCX(class TDesC16 const &, class TDesC16 const &, enum XIMPTestEventFactory::TTestPGLArraySpecifier, class TDesC16 const &, class TDesC16 const &, enum MXIMPDataSubscriptionState::TSubscriptionState, enum MXIMPDataSubscriptionState::TDataState) + ?CreateWrapperL@CXIMPTestContextWrapperMgr@@QAEXH@Z @ 29 NONAME ; void CXIMPTestContextWrapperMgr::CreateWrapperL(int) + ?DeletePresenceContext@CXIMPTestContextWrapper@@QAEXXZ @ 30 NONAME ; void CXIMPTestContextWrapper::DeletePresenceContext(void) + ?DeletePubSubKeys@CXIMPTestMessenger@@QAEXXZ @ 31 NONAME ; void CXIMPTestMessenger::DeletePubSubKeys(void) + ?Equals@TXIMPTestStatusEventSnapshot@@QBEHABV1@@Z @ 32 NONAME ; int TXIMPTestStatusEventSnapshot::Equals(class TXIMPTestStatusEventSnapshot const &) const + ?Equals@XIMPTestPresenceDataUtils@@QBEHAAVCPresenceInfoImp@@0@Z @ 33 NONAME ; int XIMPTestPresenceDataUtils::Equals(class CPresenceInfoImp &, class CPresenceInfoImp &) const + ?ExpectL@CXIMPTestListener@@QAEXPAVCXIMPApiObjBase@@@Z @ 34 NONAME ; void CXIMPTestListener::ExpectL(class CXIMPApiObjBase *) + ?ExternalizeL@CXIMPTestFileSrvMsg@@QBEXAAVRWriteStream@@@Z @ 35 NONAME ; void CXIMPTestFileSrvMsg::ExternalizeL(class RWriteStream &) const + ?FileTool@CXIMPTestContextWrapper@@QBEAAVCXIMPTestFileTool@@XZ @ 36 NONAME ; class CXIMPTestFileTool & CXIMPTestContextWrapper::FileTool(void) const + ?GenerateIdentityLC@XIMPTestPresenceDataUtils@@SAPAVCXIMPIdentityImp@@PBVTDesC8@@W4TPresenceDataGroup@1@@Z @ 37 NONAME ; class CXIMPIdentityImp * XIMPTestPresenceDataUtils::GenerateIdentityLC(class TDesC8 const *, enum XIMPTestPresenceDataUtils::TPresenceDataGroup) + ?GenerateInfoFilterLC@XIMPTestPresenceDataUtils@@SAPAVCPresenceInfoFilterImp@@PBVTDesC8@@W4TPresenceDataGroup@1@@Z @ 38 NONAME ; class CPresenceInfoFilterImp * XIMPTestPresenceDataUtils::GenerateInfoFilterLC(class TDesC8 const *, enum XIMPTestPresenceDataUtils::TPresenceDataGroup) + ?GenerateInfoLC@XIMPTestPresenceDataUtils@@SAPAVCPresenceInfoImp@@PBVTDesC8@@W4TPresenceDataGroup@1@@Z @ 39 NONAME ; class CPresenceInfoImp * XIMPTestPresenceDataUtils::GenerateInfoLC(class TDesC8 const *, enum XIMPTestPresenceDataUtils::TPresenceDataGroup) + ?GetBoolean@CXIMPTestMessenger@@QBEHW4TXIMPTestPropertyKeys@@@Z @ 40 NONAME ; int CXIMPTestMessenger::GetBoolean(enum TXIMPTestPropertyKeys) const + ?GetClient@CXIMPTestContextWrapper@@QAEPAVMXIMPClient@@XZ @ 41 NONAME ; class MXIMPClient * CXIMPTestContextWrapper::GetClient(void) + ?GetContext@CXIMPTestContextWrapper@@QAEPAVMXIMPContext@@XZ @ 42 NONAME ; class MXIMPContext * CXIMPTestContextWrapper::GetContext(void) + ?GetError@CXIMPTestMessenger@@QAEHXZ @ 43 NONAME ; int CXIMPTestMessenger::GetError(void) + ?GetEventListener@CXIMPTestContextWrapper@@QAEPAVCXIMPTestStatusEventListener@@XZ @ 44 NONAME ; class CXIMPTestStatusEventListener * CXIMPTestContextWrapper::GetEventListener(void) + ?GetEventTemplateL@CXIMPTestStatusEventListener@@QAEXAAV?$RArray@VTXIMPTestStatusEventSnapshot@@@@W4TXIMPTestStatusEventTemplate@@@Z @ 45 NONAME ; void CXIMPTestStatusEventListener::GetEventTemplateL(class RArray &, enum TXIMPTestStatusEventTemplate) + ?GetLeave@CXIMPTestMessenger@@QAEHXZ @ 46 NONAME ; int CXIMPTestMessenger::GetLeave(void) + ?GetMessenger@CXIMPTestContextWrapper@@QAEPAVCXIMPTestMessenger@@XZ @ 47 NONAME ; class CXIMPTestMessenger * CXIMPTestContextWrapper::GetMessenger(void) + ?GetPluginIndex@CXIMPTestMessenger@@SAHXZ @ 48 NONAME ; int CXIMPTestMessenger::GetPluginIndex(void) + ?GetPresenceFeatures@CXIMPTestContextWrapper@@QAEPAVMPresenceFeatures@@XZ @ 49 NONAME ; class MPresenceFeatures * CXIMPTestContextWrapper::GetPresenceFeatures(void) + ?GetReqCompleteParams@CXIMPTestMessenger@@QAEPAVMXIMPRestrictedObjectCollection@@XZ @ 50 NONAME ; class MXIMPRestrictedObjectCollection * CXIMPTestMessenger::GetReqCompleteParams(void) + ?GetReqCompletionErrL@CXIMPTestStatusEventListener@@QBEHABVTXIMPRequestId@@@Z @ 51 NONAME ; int CXIMPTestStatusEventListener::GetReqCompletionErrL(class TXIMPRequestId const &) const + ?GetStatusTraits@CXIMPTestContextWrapper@@QAEPAV?$RArray@VTXIMPTestStatusEventSnapshot@@@@XZ @ 52 NONAME ; class RArray * CXIMPTestContextWrapper::GetStatusTraits(void) + ?GetValueFor@CXIMPTestMessenger@@QBEHW4TXIMPTestPropertyKeys@@@Z @ 53 NONAME ; int CXIMPTestMessenger::GetValueFor(enum TXIMPTestPropertyKeys) const + ?GetWrapperL@CXIMPTestContextWrapperMgr@@QAEPAVCXIMPTestContextWrapper@@H@Z @ 54 NONAME ; class CXIMPTestContextWrapper * CXIMPTestContextWrapperMgr::GetWrapperL(int) + ?HandleLeaveL@CXIMPTestMessenger@@QAEXXZ @ 55 NONAME ; void CXIMPTestMessenger::HandleLeaveL(void) + ?InsertPrefixL@XIMPTestPresenceDataUtils@@SAXPBVTDesC8@@AAVRBuf8@@@Z @ 56 NONAME ; void XIMPTestPresenceDataUtils::InsertPrefixL(class TDesC8 const *, class RBuf8 &) + ?InstanceId@CXIMPTestContextWrapper@@QBEABVTDesC16@@XZ @ 57 NONAME ; class TDesC16 const & CXIMPTestContextWrapper::InstanceId(void) const + ?InstanceId@CXIMPTestFileTool@@QBEABVTDesC16@@XZ @ 58 NONAME ; class TDesC16 const & CXIMPTestFileTool::InstanceId(void) const + ?InternalizeL@CXIMPTestFileSrvMsg@@QAEXAAVRReadStream@@@Z @ 59 NONAME ; void CXIMPTestFileSrvMsg::InternalizeL(class RReadStream &) + ?NewForAdaptationSideL@CXIMPTestMessenger@@SAPAV1@H@Z @ 60 NONAME ; class CXIMPTestMessenger * CXIMPTestMessenger::NewForAdaptationSideL(int) + ?NewForClientSideL@CXIMPTestMessenger@@SAPAV1@H@Z @ 61 NONAME ; class CXIMPTestMessenger * CXIMPTestMessenger::NewForClientSideL(int) + ?NewL@CXIMPTestContextWrapper@@SAPAV1@HPAVMXIMPClient@@@Z @ 62 NONAME ; class CXIMPTestContextWrapper * CXIMPTestContextWrapper::NewL(int, class MXIMPClient *) + ?NewL@CXIMPTestContextWrapperMgr@@SAPAV1@XZ @ 63 NONAME ; class CXIMPTestContextWrapperMgr * CXIMPTestContextWrapperMgr::NewL(void) + ?NewL@CXIMPTestFileSrvMsg@@SAPAV1@HABVTDesC8@@@Z @ 64 NONAME ; class CXIMPTestFileSrvMsg * CXIMPTestFileSrvMsg::NewL(int, class TDesC8 const &) + ?NewL@CXIMPTestFileTool@@SAPAV1@KABVTDesC16@@@Z @ 65 NONAME ; class CXIMPTestFileTool * CXIMPTestFileTool::NewL(unsigned long, class TDesC16 const &) + ?NewL@CXIMPTestFileTool@@SAPAV1@KH@Z @ 66 NONAME ; class CXIMPTestFileTool * CXIMPTestFileTool::NewL(unsigned long, int) + ?NewL@CXIMPTestGeneralWaiter@@SAPAV1@PAVT_MWaitObserver@@@Z @ 67 NONAME ; class CXIMPTestGeneralWaiter * CXIMPTestGeneralWaiter::NewL(class T_MWaitObserver *) + ?NewL@CXIMPTestListener@@SAPAV1@PAVMXIMPContext@@@Z @ 68 NONAME ; class CXIMPTestListener * CXIMPTestListener::NewL(class MXIMPContext *) + ?NewL@CXIMPTestStatusEventListener@@SAPAV1@HPAVMXIMPContext@@@Z @ 69 NONAME ; class CXIMPTestStatusEventListener * CXIMPTestStatusEventListener::NewL(int, class MXIMPContext *) + ?NewL@CXIMPTestWaitHelper@@SAPAV1@XZ @ 70 NONAME ; class CXIMPTestWaitHelper * CXIMPTestWaitHelper::NewL(void) + ?NewLC@CXIMPTestFileSrvMsg@@SAPAV1@XZ @ 71 NONAME ; class CXIMPTestFileSrvMsg * CXIMPTestFileSrvMsg::NewLC(void) + ?NumObjectsL@CXIMPTestFileTool@@QAEHXZ @ 72 NONAME ; int CXIMPTestFileTool::NumObjectsL(void) + ?NumSrvMsgL@CXIMPTestFileTool@@QAEHXZ @ 73 NONAME ; int CXIMPTestFileTool::NumSrvMsgL(void) + ?PayloadL@CXIMPTestFileSrvMsg@@QAEAAVTDesC8@@XZ @ 74 NONAME ; class TDesC8 & CXIMPTestFileSrvMsg::PayloadL(void) + ?PluginRestoreLC@CXIMPTestFileTool@@QAEPAVCXIMPApiEventBase@@H@Z @ 75 NONAME ; class CXIMPApiEventBase * CXIMPTestFileTool::PluginRestoreLC(int) + ?PluginStoreL@CXIMPTestFileTool@@QAEXABVTDesC8@@@Z @ 76 NONAME ; void CXIMPTestFileTool::PluginStoreL(class TDesC8 const &) + ?PrepareL@CXIMPTestFileTool@@QAEXXZ @ 77 NONAME ; void CXIMPTestFileTool::PrepareL(void) + ?ReRegisterEventFilterL@CXIMPTestStatusEventListener@@QAEXXZ @ 78 NONAME ; void CXIMPTestStatusEventListener::ReRegisterEventFilterL(void) + ?Reset@CXIMPTestListener@@QAEXXZ @ 79 NONAME ; void CXIMPTestListener::Reset(void) + ?ResetEventStack@CXIMPTestStatusEventListener@@QAEXXZ @ 80 NONAME ; void CXIMPTestStatusEventListener::ResetEventStack(void) + ?ResetEventTypeStack@CXIMPTestStatusEventListener@@QAEXXZ @ 81 NONAME ; void CXIMPTestStatusEventListener::ResetEventTypeStack(void) + ?ResetListener@CXIMPTestContextWrapper@@QAEXXZ @ 82 NONAME ; void CXIMPTestContextWrapper::ResetListener(void) + ?ResetPubSub@CXIMPTestMessenger@@QAEXXZ @ 83 NONAME ; void CXIMPTestMessenger::ResetPubSub(void) + ?SetBoolean@CXIMPTestMessenger@@QAEXW4TXIMPTestPropertyKeys@@@Z @ 84 NONAME ; void CXIMPTestMessenger::SetBoolean(enum TXIMPTestPropertyKeys) + ?SetError@CXIMPTestMessenger@@QAEXH@Z @ 85 NONAME ; void CXIMPTestMessenger::SetError(int) + ?SetEventObserver@CXIMPTestListener@@QAEXPAVMXIMPContextObserver@@@Z @ 86 NONAME ; void CXIMPTestListener::SetEventObserver(class MXIMPContextObserver *) + ?SetEventObserver@CXIMPTestStatusEventListener@@QAEXPAVMXIMPContextObserver@@@Z @ 87 NONAME ; void CXIMPTestStatusEventListener::SetEventObserver(class MXIMPContextObserver *) + ?SetEventSourceL@CXIMPTestListener@@QAEXPAVMXIMPContext@@@Z @ 88 NONAME ; void CXIMPTestListener::SetEventSourceL(class MXIMPContext *) + ?SetEventSourceL@CXIMPTestStatusEventListener@@QAEXPAVMXIMPContext@@@Z @ 89 NONAME ; void CXIMPTestStatusEventListener::SetEventSourceL(class MXIMPContext *) + ?SetLeave@CXIMPTestMessenger@@QAEXH@Z @ 90 NONAME ; void CXIMPTestMessenger::SetLeave(int) + ?SetNoError@CXIMPTestMessenger@@QAEXXZ @ 91 NONAME ; void CXIMPTestMessenger::SetNoError(void) + ?SetPluginIndex@CXIMPTestMessenger@@QAEXH@Z @ 92 NONAME ; void CXIMPTestMessenger::SetPluginIndex(int) + ?SetReqCompleteParams@CXIMPTestMessenger@@QAEXPAVMXIMPRestrictedObjectCollection@@@Z @ 93 NONAME ; void CXIMPTestMessenger::SetReqCompleteParams(class MXIMPRestrictedObjectCollection *) + ?SetValueFor@CXIMPTestMessenger@@QAEXW4TXIMPTestPropertyKeys@@H@Z @ 94 NONAME ; void CXIMPTestMessenger::SetValueFor(enum TXIMPTestPropertyKeys, int) + ?SetupEmptyListener@CXIMPTestContextWrapper@@QAEXXZ @ 95 NONAME ; void CXIMPTestContextWrapper::SetupEmptyListener(void) + ?SetupListenerL@CXIMPTestContextWrapper@@QAEXW4TXIMPTestStatusEventTemplate@@@Z @ 96 NONAME ; void CXIMPTestContextWrapper::SetupListenerL(enum TXIMPTestStatusEventTemplate) + ?SetupListenerReqCompleteL@CXIMPTestContextWrapper@@QAEXW4TXIMPTestStatusEventTemplate@@PAV?$RArray@J@@@Z @ 97 NONAME ; void CXIMPTestContextWrapper::SetupListenerReqCompleteL(enum TXIMPTestStatusEventTemplate, class RArray *) + ?SrvMsgId@CXIMPTestFileSrvMsg@@QAEHXZ @ 98 NONAME ; int CXIMPTestFileSrvMsg::SrvMsgId(void) + ?SrvMsgRestoreLC@CXIMPTestFileTool@@QAEPAVCXIMPTestFileSrvMsg@@H@Z @ 99 NONAME ; class CXIMPTestFileSrvMsg * CXIMPTestFileTool::SrvMsgRestoreLC(int) + ?SrvMsgStoreL@CXIMPTestFileTool@@QAEXPAVCXIMPTestFileSrvMsg@@@Z @ 100 NONAME ; void CXIMPTestFileTool::SrvMsgStoreL(class CXIMPTestFileSrvMsg *) + ?UnbindL@CXIMPTestContextWrapper@@QAEXXZ @ 101 NONAME ; void CXIMPTestContextWrapper::UnbindL(void) + ?VerifyEventStackL@CXIMPTestContextWrapper@@QAEXABVTPtrC8@@@Z @ 102 NONAME ; void CXIMPTestContextWrapper::VerifyEventStackL(class TPtrC8 const &) + ?VerifyEventStackL@CXIMPTestStatusEventListener@@QBEXABV?$TArray@VTXIMPTestStatusEventSnapshot@@@@ABVTDesC8@@@Z @ 103 NONAME ; void CXIMPTestStatusEventListener::VerifyEventStackL(class TArray const &, class TDesC8 const &) const + ?WaitAndAssertL@CXIMPTestListener@@QAEHXZ @ 104 NONAME ; int CXIMPTestListener::WaitAndAssertL(void) + ?WaitAnyEvent@CXIMPTestContextWrapper@@QAEXXZ @ 105 NONAME ; void CXIMPTestContextWrapper::WaitAnyEvent(void) + ?WaitAnyEvent@CXIMPTestStatusEventListener@@QAEXXZ @ 106 NONAME ; void CXIMPTestStatusEventListener::WaitAnyEvent(void) + ?WaitForL@CXIMPTestGeneralWaiter@@QAEXH@Z @ 107 NONAME ; void CXIMPTestGeneralWaiter::WaitForL(int) + ?WaitForL@CXIMPTestWaitHelper@@QAEXH@Z @ 108 NONAME ; void CXIMPTestWaitHelper::WaitForL(int) + ?WaitRequestAndStackEvents@CXIMPTestContextWrapper@@QAEXVTXIMPRequestId@@@Z @ 109 NONAME ; void CXIMPTestContextWrapper::WaitRequestAndStackEvents(class TXIMPRequestId) + ?WaitRequestAndStackEvents@CXIMPTestStatusEventListener@@QAEXABVTXIMPRequestId@@H@Z @ 110 NONAME ; void CXIMPTestStatusEventListener::WaitRequestAndStackEvents(class TXIMPRequestId const &, int) + ?WrapperCount@CXIMPTestContextWrapperMgr@@QBEHXZ @ 111 NONAME ; int CXIMPTestContextWrapperMgr::WrapperCount(void) const + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/eabi/prfwtestcaseutilsu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/eabi/prfwtestcaseutilsu.def Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,132 @@ +EXPORTS + _ZN17CXIMPTestFileTool10NumSrvMsgLEv @ 1 NONAME + _ZN17CXIMPTestFileTool11NumObjectsLEv @ 2 NONAME + _ZN17CXIMPTestFileTool12PluginStoreLERK6TDesC8 @ 3 NONAME + _ZN17CXIMPTestFileTool12SrvMsgStoreLEP19CXIMPTestFileSrvMsg @ 4 NONAME + _ZN17CXIMPTestFileTool15PluginRestoreLCEi @ 5 NONAME + _ZN17CXIMPTestFileTool15SrvMsgRestoreLCEi @ 6 NONAME + _ZN17CXIMPTestFileTool4NewLEmRK7TDesC16 @ 7 NONAME + _ZN17CXIMPTestFileTool4NewLEmi @ 8 NONAME + _ZN17CXIMPTestFileTool8PrepareLEv @ 9 NONAME + _ZN17CXIMPTestFileTool9CleanAllLEv @ 10 NONAME + _ZN17CXIMPTestListener14WaitAndAssertLEv @ 11 NONAME + _ZN17CXIMPTestListener15SetEventSourceLEP12MXIMPContext @ 12 NONAME + _ZN17CXIMPTestListener16SetEventObserverEP20MXIMPContextObserver @ 13 NONAME + _ZN17CXIMPTestListener4NewLEP12MXIMPContext @ 14 NONAME + _ZN17CXIMPTestListener5ResetEv @ 15 NONAME + _ZN17CXIMPTestListener7ExpectLEP15CXIMPApiObjBase @ 16 NONAME + _ZN18CXIMPTestMessenger10SetBooleanE21TXIMPTestPropertyKeys @ 17 NONAME + _ZN18CXIMPTestMessenger10SetNoErrorEv @ 18 NONAME + _ZN18CXIMPTestMessenger11ResetPubSubEv @ 19 NONAME + _ZN18CXIMPTestMessenger11SetValueForE21TXIMPTestPropertyKeysi @ 20 NONAME + _ZN18CXIMPTestMessenger12HandleLeaveLEv @ 21 NONAME + _ZN18CXIMPTestMessenger14GetPluginIndexEv @ 22 NONAME + _ZN18CXIMPTestMessenger14SetPluginIndexEi @ 23 NONAME + _ZN18CXIMPTestMessenger16AssertPluginDiedEi @ 24 NONAME + _ZN18CXIMPTestMessenger16DeletePubSubKeysEv @ 25 NONAME + _ZN18CXIMPTestMessenger17NewForClientSideLEi @ 26 NONAME + _ZN18CXIMPTestMessenger20GetReqCompleteParamsEv @ 27 NONAME + _ZN18CXIMPTestMessenger20SetReqCompleteParamsEP31MXIMPRestrictedObjectCollection @ 28 NONAME + _ZN18CXIMPTestMessenger21NewForAdaptationSideLEi @ 29 NONAME + _ZN18CXIMPTestMessenger23AssertOpenSessionCalledEi @ 30 NONAME + _ZN18CXIMPTestMessenger24AssertCloseSessionCalledEi @ 31 NONAME + _ZN18CXIMPTestMessenger24AssertShareSessionCalledEi @ 32 NONAME + _ZN18CXIMPTestMessenger26AssertUnshareSessionCalledEi @ 33 NONAME + _ZN18CXIMPTestMessenger33AssertCreatePresentityGroupCalledEi @ 34 NONAME + _ZN18CXIMPTestMessenger36AssertAddPresentityGroupMemberCalledEi @ 35 NONAME + _ZN18CXIMPTestMessenger39AssertRemovePresentityGroupMemberCalledEi @ 36 NONAME + _ZN18CXIMPTestMessenger40AssertSubscribePresentityGroupListCalledEi @ 37 NONAME + _ZN18CXIMPTestMessenger42AssertUnsubscribePresentityGroupListCalledEi @ 38 NONAME + _ZN18CXIMPTestMessenger43AssertSubscribePresentityGroupContentCalledEi @ 39 NONAME + _ZN18CXIMPTestMessenger44AssertUpdatePresentityGroupDisplayNameCalledEi @ 40 NONAME + _ZN18CXIMPTestMessenger45AssertUnsubscribePresentityGroupContentCalledEi @ 41 NONAME + _ZN18CXIMPTestMessenger50AssertUpdatePresentityGroupMemberDisplayNameCalledEi @ 42 NONAME + _ZN18CXIMPTestMessenger8GetErrorEv @ 43 NONAME + _ZN18CXIMPTestMessenger8GetLeaveEv @ 44 NONAME + _ZN18CXIMPTestMessenger8SetErrorEi @ 45 NONAME + _ZN18CXIMPTestMessenger8SetLeaveEi @ 46 NONAME + _ZN19CXIMPTestFileSrvMsg12InternalizeLER11RReadStream @ 47 NONAME + _ZN19CXIMPTestFileSrvMsg4NewLEiRK6TDesC8 @ 48 NONAME + _ZN19CXIMPTestFileSrvMsg5NewLCEv @ 49 NONAME + _ZN19CXIMPTestFileSrvMsg8PayloadLEv @ 50 NONAME + _ZN19CXIMPTestFileSrvMsg8SrvMsgIdEv @ 51 NONAME + _ZN19CXIMPTestWaitHelper4NewLEv @ 52 NONAME + _ZN19CXIMPTestWaitHelper8WaitForLEi @ 53 NONAME + _ZN20XIMPTestEventFactory23CreateGroupListEventLCXERK7TDesC16S2_NS_22TTestPGLArraySpecifierES2_S2_N26MXIMPDataSubscriptionState18TSubscriptionStateENS4_10TDataStateE @ 54 NONAME + _ZN20XIMPTestEventFactory26CreateGroupContentEventLCXERK7TDesC16S2_S2_NS_29TTestPGLContentArraySpecifierES2_S2_N26MXIMPDataSubscriptionState18TSubscriptionStateENS4_10TDataStateE @ 55 NONAME + _ZN22CXIMPTestGeneralWaiter4NewLEP15T_MWaitObserver @ 56 NONAME + _ZN22CXIMPTestGeneralWaiter8WaitForLEi @ 57 NONAME + _ZN23CXIMPTestContextWrapper10GetContextEv @ 58 NONAME + _ZN23CXIMPTestContextWrapper12GetMessengerEv @ 59 NONAME + _ZN23CXIMPTestContextWrapper12WaitAnyEventEv @ 60 NONAME + _ZN23CXIMPTestContextWrapper13ClearListenerEv @ 61 NONAME + _ZN23CXIMPTestContextWrapper13ResetListenerEv @ 62 NONAME + _ZN23CXIMPTestContextWrapper14SetupListenerLE28TXIMPTestStatusEventTemplate @ 63 NONAME + _ZN23CXIMPTestContextWrapper15AppendToTraitsLE28TXIMPTestStatusEventTemplate @ 64 NONAME + _ZN23CXIMPTestContextWrapper15GetStatusTraitsEv @ 65 NONAME + _ZN23CXIMPTestContextWrapper16GetEventListenerEv @ 66 NONAME + _ZN23CXIMPTestContextWrapper17BindWithSettingsLEi @ 67 NONAME + _ZN23CXIMPTestContextWrapper17VerifyEventStackLERK6TPtrC8 @ 68 NONAME + _ZN23CXIMPTestContextWrapper18SetupEmptyListenerEv @ 69 NONAME + _ZN23CXIMPTestContextWrapper19GetPresenceFeaturesEv @ 70 NONAME + _ZN23CXIMPTestContextWrapper21DeletePresenceContextEv @ 71 NONAME + _ZN23CXIMPTestContextWrapper25SetupListenerReqCompleteLE28TXIMPTestStatusEventTemplateP6RArrayIlE @ 72 NONAME + _ZN23CXIMPTestContextWrapper25WaitRequestAndStackEventsE14TXIMPRequestId @ 73 NONAME + _ZN23CXIMPTestContextWrapper4NewLEiP11MXIMPClient @ 74 NONAME + _ZN23CXIMPTestContextWrapper5BindLE4TUidRK7TDesC16S3_S3_ @ 75 NONAME + _ZN23CXIMPTestContextWrapper5BindLEi @ 76 NONAME + _ZN23CXIMPTestContextWrapper7UnbindLEv @ 77 NONAME + _ZN23CXIMPTestContextWrapper9GetClientEv @ 78 NONAME + _ZN25XIMPTestPresenceDataUtils13InsertPrefixLEPK6TDesC8R5RBuf8 @ 79 NONAME + _ZN25XIMPTestPresenceDataUtils14AssertEqualityER13MPresenceInfoS1_ @ 80 NONAME + _ZN25XIMPTestPresenceDataUtils14GenerateInfoLCEPK6TDesC8NS_18TPresenceDataGroupE @ 81 NONAME + _ZN25XIMPTestPresenceDataUtils18GenerateIdentityLCEPK6TDesC8NS_18TPresenceDataGroupE @ 82 NONAME + _ZN25XIMPTestPresenceDataUtils20GenerateInfoFilterLCEPK6TDesC8NS_18TPresenceDataGroupE @ 83 NONAME + _ZN26CXIMPTestContextWrapperMgr11GetWrapperLEi @ 84 NONAME + _ZN26CXIMPTestContextWrapperMgr14CreateWrapperLEi @ 85 NONAME + _ZN26CXIMPTestContextWrapperMgr4NewLEv @ 86 NONAME + _ZN28CXIMPTestStatusEventListener12WaitAnyEventEv @ 87 NONAME + _ZN28CXIMPTestStatusEventListener15ResetEventStackEv @ 88 NONAME + _ZN28CXIMPTestStatusEventListener15SetEventSourceLEP12MXIMPContext @ 89 NONAME + _ZN28CXIMPTestStatusEventListener16SetEventObserverEP20MXIMPContextObserver @ 90 NONAME + _ZN28CXIMPTestStatusEventListener17GetEventTemplateLER6RArrayI28TXIMPTestStatusEventSnapshotE28TXIMPTestStatusEventTemplate @ 91 NONAME + _ZN28CXIMPTestStatusEventListener18AcceptedEventTypesEv @ 92 NONAME + _ZN28CXIMPTestStatusEventListener19ResetEventTypeStackEv @ 93 NONAME + _ZN28CXIMPTestStatusEventListener22ReRegisterEventFilterLEv @ 94 NONAME + _ZN28CXIMPTestStatusEventListener25WaitRequestAndStackEventsERK14TXIMPRequestIdi @ 95 NONAME + _ZN28CXIMPTestStatusEventListener4NewLEiP12MXIMPContext @ 96 NONAME + _ZN28TXIMPTestStatusEventSnapshotC1Eiii @ 97 NONAME + _ZN28TXIMPTestStatusEventSnapshotC1Ev @ 98 NONAME + _ZN28TXIMPTestStatusEventSnapshotC2Eiii @ 99 NONAME + _ZN28TXIMPTestStatusEventSnapshotC2Ev @ 100 NONAME + _ZNK17CXIMPTestFileTool10InstanceIdEv @ 101 NONAME + _ZNK18CXIMPTestMessenger10GetBooleanE21TXIMPTestPropertyKeys @ 102 NONAME + _ZNK18CXIMPTestMessenger11GetValueForE21TXIMPTestPropertyKeys @ 103 NONAME + _ZNK19CXIMPTestFileSrvMsg12ExternalizeLER12RWriteStream @ 104 NONAME + _ZNK23CXIMPTestContextWrapper10InstanceIdEv @ 105 NONAME + _ZNK23CXIMPTestContextWrapper8FileToolEv @ 106 NONAME + _ZNK25XIMPTestPresenceDataUtils6EqualsER16CPresenceInfoImpS1_ @ 107 NONAME + _ZNK25XIMPTestPresenceDataUtils8ContainsER13MPresenceInfoS1_ @ 108 NONAME + _ZNK26CXIMPTestContextWrapperMgr12WrapperCountEv @ 109 NONAME + _ZNK28CXIMPTestStatusEventListener17VerifyEventStackLERK6TArrayI28TXIMPTestStatusEventSnapshotERK6TDesC8 @ 110 NONAME + _ZNK28CXIMPTestStatusEventListener20GetReqCompletionErrLERK14TXIMPRequestId @ 111 NONAME + _ZNK28TXIMPTestStatusEventSnapshot6EqualsERKS_ @ 112 NONAME + _ZTI17CXIMPTestFileTool @ 113 NONAME ; ## + _ZTI17CXIMPTestListener @ 114 NONAME ; ## + _ZTI18CXIMPTestMessenger @ 115 NONAME ; ## + _ZTI19CXIMPTestFileSrvMsg @ 116 NONAME ; ## + _ZTI19CXIMPTestWaitHelper @ 117 NONAME ; ## + _ZTI22CXIMPTestGeneralWaiter @ 118 NONAME ; ## + _ZTI23CXIMPTestContextWrapper @ 119 NONAME ; ## + _ZTI26CXIMPTestContextWrapperMgr @ 120 NONAME ; ## + _ZTI28CXIMPTestStatusEventListener @ 121 NONAME ; ## + _ZTV17CXIMPTestFileTool @ 122 NONAME ; ## + _ZTV17CXIMPTestListener @ 123 NONAME ; ## + _ZTV18CXIMPTestMessenger @ 124 NONAME ; ## + _ZTV19CXIMPTestFileSrvMsg @ 125 NONAME ; ## + _ZTV19CXIMPTestWaitHelper @ 126 NONAME ; ## + _ZTV22CXIMPTestGeneralWaiter @ 127 NONAME ; ## + _ZTV23CXIMPTestContextWrapper @ 128 NONAME ; ## + _ZTV26CXIMPTestContextWrapperMgr @ 129 NONAME ; ## + _ZTV28CXIMPTestStatusEventListener @ 130 NONAME ; ## + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/eunitcommon/cglobalwaitingnote.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/eunitcommon/cglobalwaitingnote.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,205 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef CGLOBALWAITINGNOTE_H +#define CGLOBALWAITINGNOTE_H + +// INCLUDES +#include +#include +#include + + + +/** + * Global waiting message for XIMP Framework Eunit tests. + */ +class CGlobalWaitingNote : public CActive + { + public: + + /** + * Shows the waiting message with progress bar. + * + * @param aMessage The message text to show. + * @param aTotalShowTime The show time in milliseconds. + * @param aProgressSteps How many progress steps the progress bar should have. + */ + inline static void ShowMsgL( const TDesC& aMessage, + TInt aTotalShowTime, + TInt aProgressSteps ); + + + private: + + inline CGlobalWaitingNote(); + inline ~CGlobalWaitingNote(); + inline void ConstructL(); + + inline void DoShowMsgL( const TDesC& aMessage, + TInt aTotalShowTime, + TInt aProgressSteps ); + + inline static TInt ProgressTickCb( TAny* aSelf ); + inline TInt HandleProgressTick(); + + inline void RunL(); + inline TInt RunError( TInt aError ); + inline void DoCancel(); + + + + private: //data + + //OWN: Active Scheduler wait + CActiveSchedulerWait iWait; + + //OWN: Progress ticker + CPeriodic* iProgressTicker; + + //OWN: The global note. + CAknGlobalProgressDialog* iGlobalNote; + + //OWN: Total show time + TInt iTotalShowTime; + + //OWN: Progress interval + TInt iProgressInterval; + + //OWN: Current progress value + TInt iCurrentProgress; + }; + + + + + +// ----------------------------------------------------------------------------- +// CGlobalWaitingNote public functions +// ----------------------------------------------------------------------------- +// +void CGlobalWaitingNote::ShowMsgL( const TDesC& aMessage, + TInt aTotalShowTime, + TInt aProgressSteps ) + { + CGlobalWaitingNote* self = new (ELeave) CGlobalWaitingNote; + CleanupStack::PushL( self ); + self->ConstructL(); + self->DoShowMsgL( aMessage, + aTotalShowTime, + aProgressSteps ); + + CleanupStack::PopAndDestroy(); + } + + + +// ----------------------------------------------------------------------------- +// CGlobalWaitingNote private functions +// ----------------------------------------------------------------------------- +// +CGlobalWaitingNote::CGlobalWaitingNote() + : CActive( CActive::EPriorityStandard ) + { + } + + +CGlobalWaitingNote::~CGlobalWaitingNote() + { + delete iProgressTicker; + delete iGlobalNote; + } + + +void CGlobalWaitingNote::ConstructL() + { + CActiveScheduler::Add( this ); + iGlobalNote = CAknGlobalProgressDialog::NewL(); + + iProgressTicker = CPeriodic::NewL( CActive::EPriorityStandard ); + } + + + +void CGlobalWaitingNote::DoShowMsgL( const TDesC& aMessage, + TInt aTotalShowTime, + TInt aProgressSteps ) + { + iGlobalNote->ShowProgressDialogL( iStatus, + aMessage, + R_AVKON_SOFTKEYS_OK_EMPTY, + aTotalShowTime ); + SetActive(); + + iProgressInterval = aTotalShowTime / aProgressSteps; + iTotalShowTime = aTotalShowTime; + iCurrentProgress = 0; + + TCallBack progressCb( CGlobalWaitingNote::ProgressTickCb, this ); + iProgressTicker->Start( iProgressInterval, iProgressInterval, progressCb ); + + iWait.Start(); + } + + +TInt CGlobalWaitingNote::ProgressTickCb( TAny* aSelf ) + { + return ( (CGlobalWaitingNote*) aSelf )->HandleProgressTick(); + } + + +TInt CGlobalWaitingNote::HandleProgressTick() + { + if( iCurrentProgress < iTotalShowTime ) + { + iCurrentProgress += iProgressInterval; + iGlobalNote->UpdateProgressDialog( iCurrentProgress, iTotalShowTime ); + } + + else + { + iGlobalNote->ProcessFinished(); + } + + return KErrNone; + } + + + +void CGlobalWaitingNote::RunL() + { + iWait.AsyncStop(); + } + + +TInt CGlobalWaitingNote::RunError( TInt /*aError*/ ) + { + return KErrNone; + } + + +void CGlobalWaitingNote::DoCancel() + { + iGlobalNote->ProcessFinished(); + } + +#endif // CGLOBALWAITINGNOTE_H + +// end of file + + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/eunitcommon/eunit_test_mover.pl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/eunitcommon/eunit_test_mover.pl Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,80 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# +#!perl +# +use strict; +use File::Path; + +$|=1; # ensures that any progress information sent to the screen is displayed immediately and not buffered + +# When this script is used with build tools, move is done only for WINSCW platform +if ( exists($ENV{'PLATFORM'}) && + ($ENV{'PLATFORM'} ne 'WINSCW' ) ) + { + print "\nEUnit Test DLL Mover: nothing to do for platform.\n"; + exit 0; + } + + +# destination folder where EUnit test dlls are placed +my $destFolder = "\\epoc32\\release\\winscw\\udeb\\z\\sys\\bin"; + +# ABLD command +# If this script is used with build chain, then "TO_BLDINF" env. variable points to the ABLD folder +# else use ABLD from current folder +my $abldCommand = ""; +if (exists($ENV{'TO_BLDINF'})) + { + $abldCommand = $ENV{'TO_BLDINF'} . "\\abld build winscw udeb -what"; + } +else + { + $abldCommand = "abld build winscw udeb -what"; + } + +# get option +my $option = $ARGV[0]; + +# get all the files produced by the ABLD +my @allProducedFiles = `$abldCommand`; + +# we're interested only from dlls +my @dllList = grep{ $_=~m#^.+\.dll$#i }@allProducedFiles; + +print "\n"; +foreach my $dll (@dllList) + { + chomp($dll); + + # skip those which are not mt_, ut_, t_, dec_ + my @paths = split(/\\/, $dll); + next unless (grep { $paths[-1] =~ m#^$_.+$#i; } (qw(mt_ ut_ t_ dec_))); + + if( $option eq "-wipe" ) + { + my($dllPath, $dllName) = $dll =~ m/(.*\\)(.*)$/; + $dll = $destFolder . "\\" . $dllName; + print "EUnit Test DLL Mover: CLEANING $dll\n"; + rmtree $dll; + } + else + { + print "EUnit Test DLL Mover: COPYING $dll to $destFolder\n"; + system "copy $dll ${destFolder}"; + } + } + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/eunitcommon/eunittools.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/eunitcommon/eunittools.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,164 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef EUNITTOOLS_H +#define EUNITTOOLS_H + +#include +#include +#include +#include +#include +//#include "cglobalwaitingnote.h" + + + +// ----------------------------------------------------------------------------- +// ASSERTION HELPER +// Leaves if the provided error code is decorator error. +// ----------------------------------------------------------------------------- +// +#define LEAVE_IF_DECORATOR_ERROR( aErr ) \ + { \ + if( aErr == KErrNoMemory ) \ + { \ + User::Leave( KErrNoMemory ); \ + } \ + } + + + +// ----------------------------------------------------------------------------- +// ASSERTION HELPER +// Returns from current function if the provided error code is decorator error. +// ----------------------------------------------------------------------------- +// +#define RETURN_IF_DECORATOR_ERROR( aErr ) \ + { \ + if( aErr == KErrNoMemory ) \ + { \ + return KErrNoMemory; \ + } \ + } + + + +// ----------------------------------------------------------------------------- +// MEMORY LEAK TRACKING HELPER +// Performs __UHEAP_MARK and shows visual notify. +// (Visual notify gives time to reset HookLogger heap checks.) +// ----------------------------------------------------------------------------- +// +#define __UHEAP_MARK_WITH_VISUAL_NOTIFY \ + { \ + __UHEAP_MARK; \ + EUnitTools::NotifyFromTestEnterL(); \ + } + + +// ----------------------------------------------------------------------------- +// MEMORY LEAK TRACKING HELPER +// Performs __UHEAP_MARKEND with JIT debugger on. +// ----------------------------------------------------------------------------- +// +#define __UHEAP_MARKEND_WITH_DEBUGGER \ + { \ + TBool __justInTime = User::JustInTime(); \ + User::SetJustInTime( ETrue ); \ + __UHEAP_MARKEND; \ + User::SetJustInTime( __justInTime ); \ + } + + + + + +// ----------------------------------------------------------------------------- +// TEST CASE DECLARATION +// Defines not decorated test case. +// ----------------------------------------------------------------------------- +// +#define PRFW_NOT_DECORATED_TEST( aDescription, aClass, aMethods, aCategory, aSetupMethod, aTestMethod, aTeardownMethod )\ +EUNIT_NOT_DECORATED_TEST( aDescription, aClass, aMethods, aCategory, aSetupMethod, aTestMethod, aTeardownMethod ) + +// ----------------------------------------------------------------------------- +// TEST CASE DECLARATION +// Defines decorated test case. +// ----------------------------------------------------------------------------- +// +#define PRFW_DECORATED_TEST( aDescription, aClass, aMethods, aCategory, aSetupMethod, aTestMethod, aTeardownMethod )\ +EUNIT_TEST( aDescription, aClass, aMethods, aCategory, aSetupMethod, aTestMethod, aTeardownMethod ) + +#define PRFW_ASSERT_DESC( aCondition, aDescription ) \ + if ( aCondition ) { } else { \ + TEUnitAssertionInfo __eunit_assert_info = { \ + __EUNIT_INTERNAL_ASSERT_BASE( aCondition, aDescription ), \ + NULL }; \ + EUnit::AssertionFailedL( __eunit_assert_info ); } + + +/** + * Collection of EUnit Tools + */ +class EUnitTools + { + public: + static inline void NotifyFromTestEnterL(); + + }; + + + +inline void EUnitTools::NotifyFromTestEnterL() + { + __UHEAP_MARK; + + TInt decoratorfailCount = -1; + CEUnitTestCaseDecorator* decorator = CEUnitTestCaseDecorator::ActiveTestCaseDecorator( KNullDesC ); //Any decorator + if( decorator ) + { + decorator->GetParameter( _L("ErrorCount"), //Run loop counter value + decoratorfailCount ); + } + + if( !decorator || + ( decoratorfailCount == 1 ) ) + { + EUNIT_DISABLE_ANY_DECORATOR; + + TFileName processImage = RProcess().FileName(); + TBuf<350> msg; + msg.Append( _L("Entering to test case. Test process:") ); + msg.Append( processImage ); + + // CGlobalWaitingNote::ShowMsgL( msg, 15000000, 15 ); //15 seconds, 1 second steps + + EUNIT_ENABLE_ANY_DECORATOR; + } + } + + + +#endif // EUNITTOOLS_H + + + +// end of file + + + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/eunitcommon/eunittstdll_armv5u.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/eunitcommon/eunittstdll_armv5u.def Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + _Z16CreateTestSuiteLv @ 1 NONAME + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/eunitcommon/eunittstdll_winsu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/eunitcommon/eunittstdll_winsu.def Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + ?CreateTestSuiteL@@YAPAVMEUnitTest@@XZ @ 1 NONAME ; class MEUnitTest * CreateTestSuiteL(void) + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/eunitcommon/eunittstdllbase.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/eunitcommon/eunittstdllbase.hrh Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,53 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +// To get the MW_LAYER_SYSTEMINCLUDE-definition +#include + +// DEFINES +#define KEUnitUid3 0x1000af59 +#define KEUnitTestDllUid2 0x1000af5a + + +// COMMON TEST DLL TARGET DEFINITIONS +#if defined(ARMCC) +deffile ./eunittstdll_armv5.def +#elif defined(MARM) +deffile ./eunittstdll_marm.def +#elif defined(WINS) +deffile ./eunittstdll_wins.def +#endif + +UID KEUnitTestDllUid2 KEUnitUid3 +TARGETTYPE dll +CAPABILITY ALL -TCB +VENDORID VID_DEFAULT +NOEXPORTLIBRARY + + +// COMMON TEST DLL INCLUDE PATHS +// Default system include paths for middleware layer modules. +MW_LAYER_SYSTEMINCLUDE +SYSTEMINCLUDE /epoc32/include/digia/eunit +USERINCLUDE . + + +// COMMON TEST DLL DEPENDENCIES TO SYSTEM COMPONENTS +LIBRARY euser.lib +LIBRARY eunit.lib +LIBRARY eunitutil.lib +LIBRARY aknnotify.lib \ No newline at end of file diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/eunitcommon/move_tests_to_eunit.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/eunitcommon/move_tests_to_eunit.inf Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,26 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +//////////////////////////////////////////////////////////// +// bld.inf extension +// Part of Presence Engine EUnit tests + +PRJ_EXPORTS +eunit_test_mover.pl /epoc32/tools/eunit_test_mover.pl + + +PRJ_TESTMMPFILES +gnumakefile move_tests_to_eunit.mk \ No newline at end of file diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/eunitcommon/move_tests_to_eunit.mk --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/eunitcommon/move_tests_to_eunit.mk Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,40 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# + +do_nothing : + @rem do_nothing + +MAKMAKE : do_nothing + +BLD : do_nothing + +CLEAN : + @\epoc32\tools\eunit_test_mover.pl -wipe + +LIB : do_nothing + +CLEANLIB : do_nothing + +RESOURCE : do_nothing + +FREEZE : do_nothing + +SAVESPACE : do_nothing + +RELEASABLES : do_nothing + +FINAL : + @\epoc32\tools\eunit_test_mover.pl diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/processmaster/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/processmaster/bld.inf Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,23 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +// Platforms +PRJ_PLATFORMS +DEFAULT + +// Server components +PRJ_TESTMMPFILES +prfwtestprocessmaster.mmp diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/processmaster/pm.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/processmaster/pm.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,27 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +// assume tests in /internal/tsrc/t_blah + +USERINCLUDE ../../tsrcutils/processmaster +USERINCLUDE ../../tsrcutils/testcaseutils +USERINCLUDE ../../../../../ximpfw/core/srcpscserver +USERINCLUDE ../../../../../ximpfw/core/srcrootserver + +LIBRARY efsrv.lib +LIBRARY prfwtestcaseutils.lib diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/processmaster/prfwtestprocessmaster.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/processmaster/prfwtestprocessmaster.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,99 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: + * +*/ + +#include +#include "prfwtestprocessmaster.h" + + +// ============================================================== +// ============ DoKillProcessL() ============= +// ============================================================== +void DoKillProcessL( const TDesC& aProcessName ) + { + TFullName psName; + psName.Append( _L("*") ); + psName.Append( aProcessName ); + psName.Append( _L("*") ); + + TFindProcess psFinder; + psFinder.Find( psName ); + + TInt killCount( 0 ); + while( psFinder.Next( psName ) != KErrNotFound ) + { + RProcess ps; + User::LeaveIfError( ps.Open( psFinder ) ); + ps.Kill( -666 ); + ps.Close(); + killCount++; + } + + User::Leave( killCount ); + } + + +// ============================================================== +// ============ E32MainL() ============= +// ============================================================== +void E32MainL() + { + TInt theCommand; + User::LeaveIfError( User::GetTIntParameter( PrfwTestProcessMaster::EMsgSlot_Command, theCommand ) ); + + TBuf< PrfwTestProcessMaster::EMaxMsgDataLength > theDesC16; + User::LeaveIfError( User::GetDesParameter( PrfwTestProcessMaster::EMsgSlot_Desc16Data, theDesC16 ) ); + + switch( theCommand ) + { + case PrfwTestProcessMaster::EKillProcess: + { + DoKillProcessL( theDesC16 ); + break; + } + + default: + { + User::Leave( KErrNotSupported ); + break; + } + } + } + + +// ============================================================== +// ============ E32Main() ============= +// ============================================================== +GLDEF_C TInt E32Main() + { + CTrapCleanup* tc = CTrapCleanup::New(); + if( !tc ) + { + return KErrNoMemory; + } + + __UHEAP_MARK; + TRAPD( err, E32MainL() ); + __UHEAP_MARKEND; + + delete tc; + + RProcess::Rendezvous( err ); + return err; + } + + +//End of file diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/processmaster/prfwtestprocessmaster.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/processmaster/prfwtestprocessmaster.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,148 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: + * +*/ + +#ifndef PRFWTESTPROCESSMASTER_H__ +#define PRFWTESTPROCESSMASTER_H__ + + +// INCLUDES +#include +#include +#include +#include + +#include "ximpserverdefs.h" +#include "ximprootserverdefs.h" + +// CLASS DESCRIPTION + +/** + * Test utility for managing Presence Engine processies + */ +class PrfwTestProcessMaster + { + public: //enumerations + enum TPEngProcessMasterEnums + { + EMsgSlot_Command = 1, + EMsgSlot_Desc16Data = 2, + + EKillProcess = 100, + EMaxMsgDataLength = 256 + }; + + public: //Public functions + + /** + * + * + * + * + * + */ + static inline TInt KillPscServers(); + static inline TInt KillRootServer(); + + private: //Helper functions + static inline TInt DoKillServer( const TDesC& aServer ); + + }; + + + + +// ----------------------------------------------------------------------------- +// PrfwTestProcessMaster public functions +// ----------------------------------------------------------------------------- +// +inline TInt PrfwTestProcessMaster::KillPscServers() + { + return PrfwTestProcessMaster::DoKillServer( NXIMPSrv::NName::KServerPattern ); + } + +inline TInt PrfwTestProcessMaster::KillRootServer() + { + return PrfwTestProcessMaster::DoKillServer( NRootSrv::NName::KServerPattern ); + } + +// ----------------------------------------------------------------------------- +// PrfwTestProcessMaster private functions +// ----------------------------------------------------------------------------- +// +inline TInt PrfwTestProcessMaster::DoKillServer( const TDesC& aServer ) + { + //Compose full executable name + TFileName processMasterExe; + + // TODO this code shouldn't leave? does it? it was TRAP+L elsewhere. + TFileName dllPath; + Dll::FileName( dllPath ); + TParsePtrC dllPathParser( dllPath ); + processMasterExe.Insert( 0, dllPathParser.Drive() ); + + processMasterExe.Append( KDC_PROGRAMS_DIR ); + processMasterExe.Append( _L("prfwtestprocessmaster.exe") ); + + //Initialize ProcessMaster process + RProcess processMaster; + TInt err = processMaster.Create( processMasterExe, KNullDesC ); + if( err != KErrNone ) + { + processMaster.Close(); + return err; + } + + err = processMaster.SetParameter( PrfwTestProcessMaster::EMsgSlot_Command, + PrfwTestProcessMaster::EKillProcess ); + if( err != KErrNone ) + { + processMaster.Close(); + return err; + } + + + err = processMaster.SetParameter( PrfwTestProcessMaster::EMsgSlot_Desc16Data, + aServer ); + if( err != KErrNone ) + { + processMaster.Close(); + return err; + } + + //Execute ProcessMaster + TRequestStatus rendezvousStatus; + processMaster.Rendezvous( rendezvousStatus ); + processMaster.Resume(); + User::WaitForRequest( rendezvousStatus ); + err = rendezvousStatus.Int(); + + + //Get exit statuses for debuging purposes + TExitType exitType = processMaster.ExitType(); + TExitCategoryName exitCategory = processMaster.ExitCategory(); + TInt exitReason = processMaster.ExitReason(); + + processMaster.Close(); + + return err; + } + + +#endif // PRFWTESTPROCESSMASTER_H__ + +// End of File + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/processmaster/prfwtestprocessmaster.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/processmaster/prfwtestprocessmaster.mmp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,41 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +// To get the MW_LAYER_SYSTEMINCLUDE-definition +#include + +TARGET prfwtestprocessmaster.exe +TARGETTYPE exe +UID 0x0 0x10282DDE +VENDORID VID_DEFAULT +CAPABILITY CAP_SERVER ProtServ PowerMgmt AllFiles ReadDeviceData + +TARGETPATH /system/libs +SOURCEPATH . +SOURCE prfwtestprocessmaster.cpp + + +MW_LAYER_SYSTEMINCLUDE +USERINCLUDE ../testcaseutils +USERINCLUDE ../../../../../ximpfw/core/srcrootserver +USERINCLUDE ../../../../../ximpfw/core/srcpscserver + + +LIBRARY euser.lib + +// End of File + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/bld.inf Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,23 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Build information file for prfwtestcaseutils.dll +* +*/ + + +PRJ_PLATFORMS +DEFAULT + +PRJ_TESTMMPFILES +prfwtestcaseutils.mmp diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwgeneralwaiter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwgeneralwaiter.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,110 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ?Description +* +*/ + + + +#include + +#include "prfwgeneralwaiter.h" +#include "prfwwaitobserver.h" + + + +// ======== LOCAL FUNCTIONS ======== + + +// ======== MEMBER FUNCTIONS ======== + + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +CXIMPTestGeneralWaiter::CXIMPTestGeneralWaiter( T_MWaitObserver* aObserver ) : + CActive( EPriorityNormal ), + iObserver( aObserver ) + { + CActiveScheduler::Add( this ); + } + + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +void CXIMPTestGeneralWaiter::ConstructL() + { + iTimer.CreateLocal(); + } + + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +EXPORT_C CXIMPTestGeneralWaiter* CXIMPTestGeneralWaiter::NewL( T_MWaitObserver* aObserver ) + { + CXIMPTestGeneralWaiter* self = new( ELeave ) CXIMPTestGeneralWaiter( aObserver ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +CXIMPTestGeneralWaiter::~CXIMPTestGeneralWaiter() + { + iTimer.Close(); + } + + +// --------------------------------------------------------------------------- +// ?implementation_description +// --------------------------------------------------------------------------- +// +EXPORT_C void CXIMPTestGeneralWaiter::WaitForL( TInt aSeconds ) + { + TTimeIntervalMicroSeconds32 timeToWait( aSeconds * 1000000 ); + iTimer.After( iStatus, timeToWait ); + SetActive(); + } + + +void CXIMPTestGeneralWaiter::RunL() + { + iObserver->WaitCompleted( KErrNone ); + } + + +void CXIMPTestGeneralWaiter::DoCancel() + { + + } + + +TInt CXIMPTestGeneralWaiter::RunErrorL( TInt /* aError */ ) + { + iObserver->WaitCompleted( KErrGeneral ); + return 0; + } + + +// End of file diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwgeneralwaiter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwgeneralwaiter.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,87 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ?Description +* +*/ + + + +#ifndef CPRFWTESTGENERALWAITER_H +#define CPRFWTESTGENERALWAITER_H + + +#include + + +class T_MWaitObserver; + + +/** + * ?one_line_short_description + * + * ?more_complete_description + * + * @lib ?library + * @since S60 v4.0 + */ +class CXIMPTestGeneralWaiter : public CActive + { +public: + + IMPORT_C static CXIMPTestGeneralWaiter* NewL( T_MWaitObserver* aObserver ); + + + virtual ~CXIMPTestGeneralWaiter(); + + +private: + + CXIMPTestGeneralWaiter( T_MWaitObserver* aObserver ); + void ConstructL(); + + +public: + + /** + * ?description + * + * @since S60 ?S60_version + * @param ?arg1 ?description + * @param ?arg2 ?description + * @return ?description + */ + IMPORT_C void WaitForL( TInt aSeconds ); + + +private: + + void RunL(); + + + void DoCancel(); + + + TInt RunErrorL( TInt aError ); + + +private: // data + + + T_MWaitObserver* iObserver; + + RTimer iTimer; + + }; + +#endif // CPRFWTESTGENERALWAITER_H diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwsrvtestclient.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwsrvtestclient.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,184 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework server test client implementation +* +*/ + + +// INCLUDE FILES +#include "ximpbase.h" +#include "ximpsrvtestclient.h" +#include "ximpprocessstarter.h" +#include "ximprootserverdefs.h" +#include "ximpserverdefs.h" +#include "prfwtestserverdefs.h" + +#include +#include + + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// RXIMPSrvRootClient::RXIMPSrvRootClient() +// --------------------------------------------------------------------------- +// +RXIMPSrvTestClient::RXIMPSrvTestClient() + { + } + + +// --------------------------------------------------------------------------- +// RXIMPSrvRootClient::Connect() +// --------------------------------------------------------------------------- +// +TInt RXIMPSrvTestClient::Connect() + { + TFileName fullExePath; + XIMPProcessStarter::FullExePathForClienLocation( NRootSrv::NName::KExecutable, + fullExePath ); + + TInt ret = XIMPProcessStarter::ConnectToServer( fullExePath, + KNullDesC, + NULL, + *this, + NRootSrv::NName::KSymbianServer, + TVersion( NRootSrv::NVersion::KMajor, + NRootSrv::NVersion::KMinor, + NRootSrv::NVersion::KBuild ), + NRootSrv::NRequest::KMsgSlotCount ); + + if ( ret == KErrNone ) + { + TIpcArgs msgArgs; + ret = SendReceive( NTestSrv::NRequest::EInstantiateTestSession, msgArgs ); + } + + return ret; + } + +// --------------------------------------------------------------------------- +// RXIMPSrvContextClient::Connect() +// --------------------------------------------------------------------------- +// +void RXIMPSrvTestClient::ConnectL( TUid aProtocolImpUid ) + { + // create the server name: "!XIMPCtxSrv9bde667a" + HBufC* serverName = HBufC::NewLC( NXIMPSrv::NName::KSymbianServer().Length() + + NXIMPSrv::NStartupParam::KProtocolUidMaxLen + + 1 ); + + serverName->Des().Copy( NXIMPSrv::NName::KSymbianServer ); + serverName->Des().AppendNumFixedWidth( aProtocolImpUid.iUid, + EHex, + NXIMPSrv::NStartupParam::KProtocolUidMaxLen ); + + // Pass the UID to server side. + // For security reasons it was not allowed to pass the complete + // server name descriptor but just the UID part + RArray< TXIMPProcessStartupParam > params; + CleanupClosePushL( params ); + + TXIMPProcessStartupParam paramUid; + paramUid.Set( NXIMPSrv::NStartupParam::KProtocolUidIndex, + aProtocolImpUid.iUid ); + + User::LeaveIfError( params.Append( paramUid ) ); + TArray< TXIMPProcessStartupParam > array = params.Array(); + + + //Get path to correct exe to launch + TFileName fullExePath; + XIMPProcessStarter::FullExePathForClienLocation( NXIMPSrv::NName::KExecutable, + fullExePath ); + + //Create a connection + TInt ret = XIMPProcessStarter::ConnectToServer( fullExePath, + KNullDesC, + &array, + *this, + *serverName, + TVersion( NXIMPSrv::NVersion::KMajor, + NXIMPSrv::NVersion::KMinor, + NXIMPSrv::NVersion::KBuild ), + NXIMPSrv::NRequest::KMsgSlotCount ); + User::LeaveIfError( ret ); + CleanupStack::PopAndDestroy( 2, serverName ); // params, serverName + + //Mutate the server side session to correct type + ret = SendReceive( NTestSrv::NRequest::EInstantiateTestSession ); + User::LeaveIfError( ret ); + } + +// --------------------------------------------------------------------------- +// RXIMPSrvRootClient::Close() +// --------------------------------------------------------------------------- +// +void RXIMPSrvTestClient::Close() + { + RSessionBase::Close(); + } + + +// --------------------------------------------------------------------------- +// RXIMPSrvTestClient::SetAllocFailureL() +// --------------------------------------------------------------------------- +// +void RXIMPSrvTestClient::SetAllocFailure( TInt aRate ) + { + TPckgBuf< TInt > rateBuf( aRate ); + TIpcArgs msgArgs; + msgArgs.Set( 0, &rateBuf ); + + SendReceive( NTestSrv::NRequest::ESetAllocFail, msgArgs ); + } + +// --------------------------------------------------------------------------- +// RXIMPSrvRootClient::GetLastError() +// --------------------------------------------------------------------------- +// +NTestSrv::SErrorData RXIMPSrvTestClient::FetchErrorData() + { + NTestSrv::SErrorData errorData; + TPckgBuf< NTestSrv::SErrorData > errorBuf( errorData ); + TIpcArgs msgArgs; + msgArgs.Set( 0, &errorBuf ); + TInt retVal = SendReceive( NTestSrv::NRequest::EPrepareErrorData, msgArgs ); + __ASSERT_ALWAYS( retVal >= 0, User::Panic( _L( "SendReceive failed" ), retVal ) ); + errorData = errorBuf(); + return errorData; +// return GetData( NTestSrv::NRequest::EPrepareErrorData ); + } + +// --------------------------------------------------------------------------- +// RXIMPSrvRootClient::GetDataL() +// --------------------------------------------------------------------------- +// +NTestSrv::SErrorData RXIMPSrvTestClient::GetData( TInt aMsg ) + { +/* TInt bufSize = SendReceive( aMsg ); + __ASSERT_ALWAYS( bufSize == NTestSrv::KErrorDataSize, User::Panic( _L( "Wrong bufsize" ), KErrArgument ) ); + + NTestSrv::SErrorData errorData; + TPckgBuf< NTestSrv::SErrorData > errorBuf( errorData ); + TIpcArgs msgArgs; + msgArgs.Set( 0, &errorBuf ); + __ASSERT_ALWAYS( SendReceive( NTestSrv::NRequest::EFetchData, msgArgs ) >= 0, + User::Panic( _L( "SendReceive failed" ) ) ); + return errorData;*/ + } + + +// End of file + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwsrvtestclient.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwsrvtestclient.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,72 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework server test session. +* +*/ + +#ifndef PRFWSRVTESTCLIENT_H__ +#define PRFWSRVTESTCLIENT_H__ + +#include +#include +#include "prfwtestserverdefs.h" + + +/** + * XIMP Framework server test session. + * + * @lib ximpsrvclient.dll + * @since S60 v3.2 + */ +class RXIMPSrvTestClient : public RSessionBase + { +public: + + /** + * Default constructor. + */ + RXIMPSrvTestClient(); + + /** + * Session connection method. + * + * @return Error code from creating server connection. + */ + TInt Connect(); + void ConnectL( TUid aProtocolImpUid ); + + /** + * Closes server connection. + */ + void Close(); + + /** + * Set alloc failure + */ + void SetAllocFailure( TInt aRate ); + NTestSrv::SErrorData RXIMPSrvTestClient::FetchErrorData(); + +private: + + /** + * Helper to get data from server side. + * @return Externalized object to be passed onward + */ + NTestSrv::SErrorData GetData( TInt aMsg ); + }; + + +#endif // PRFWSRVTESTCLIENT_H__ + +// END OF FILE diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwtestcaseutils.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwtestcaseutils.mmp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,92 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include +#include "prfwtestdlluids.hrh" + +TARGET prfwtestcaseutils.dll +TARGETTYPE dll +UID PRFWTEST_DLL_UID_STATIC_INTERFACE PRFWTEST_DLL_UID_COMMON + +CAPABILITY ALL -TCB +VENDORID VID_DEFAULT + + +SOURCEPATH . +SOURCE prfwteststatuseventlistener.cpp +SOURCE prfwtestmessenger.cpp +SOURCE prfwtestfilesrvmsg.cpp +SOURCE prfwtestfiletool.cpp +SOURCE prfwtestcontextwrapper.cpp +SOURCE prfwtestcontextwrappermgr.cpp +SOURCE prfwgeneralwaiter.cpp +SOURCE prfwtestpresencedatautils.cpp +SOURCE prfwtestlistener.cpp +SOURCE prfwtestwaithelper.cpp +SOURCE prfwtesteventfactory.cpp + +USERINCLUDE ../../../../../ximpfw/core/srcdatamodel +USERINCLUDE ../../../../../ximpfw/presence/srcpresencedatamodel +USERINCLUDE ../../../../../ximpfw/presence/srcpresencedatamodel/presentitygroups +USERINCLUDE ../../../../../ximpfw/presence/srcpresencedatamodel/presencewatching +USERINCLUDE ../../../../../ximpfw/presence/srcpresencedatamodel/presenceauthorization +USERINCLUDE ../../../../../ximpfw/presence/srcpresencedatamodel/presencepublishing +USERINCLUDE ../../../../../ximpfw/presence/srcpresencedatamodel/presenceinfo +USERINCLUDE ../../../../../ximpfw/core/srcutils + + +USERINCLUDE ../../../../../ximpfw/core/srcclient +USERINCLUDE ../../../../../ximpfw/core/srcpscserver +USERINCLUDE ../../../../../ximpfw/core/srcrootserver + +USERINCLUDE . +USERINCLUDE ../../tsrcutils/eunitcommon +USERINCLUDE ../../tsrcutils/processmaster +USERINCLUDE ../../tsrcprotocols + + +// TODO remove unnecessary +SYSTEMINCLUDE ../../../../../ximpfw/inc/core/base +SYSTEMINCLUDE ../../../../../ximpfw/inc/core/datamodel +SYSTEMINCLUDE ../../../../../ximpfw/inc/core/protocolplugin +SYSTEMINCLUDE ../../../../../ximpfw/inc/core/protocolpluginhost +SYSTEMINCLUDE ../../../../../ximpfw/inc/presence/presencedatamodel +SYSTEMINCLUDE ../../../../../ximpfw/inc/presence/presencemanagement +SYSTEMINCLUDE ../../../../../ximpfw/inc/presence/presenceprotocolplugin +SYSTEMINCLUDE ../../../../../ximpfw/inc/presence/presenceprotocolpluginhost + +SYSTEMINCLUDE /epoc32/include/digia/eunit +MW_LAYER_SYSTEMINCLUDE + + +LIBRARY ecom.lib +LIBRARY bafl.lib +LIBRARY euser.lib +LIBRARY estor.lib +LIBRARY efsrv.lib +LIBRARY eunit.lib +LIBRARY eunitutil.lib +LIBRARY ximpsrvclient.lib +LIBRARY ximpdatamodel.lib +LIBRARY presencedatamodel.lib +LIBRARY ximputils.lib + +EXPORTUNFROZEN + +// end of file + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwtestcaseutilspanics.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwtestcaseutilspanics.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,57 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework panic defines. + * +*/ + +#ifndef PRFWTESTCASEUTILSPANICS_H +#define PRFWTESTCASEUTILSPANICS_H + +#include + +/** + * Panic category and reason codes for XIMP Framework + * test case utils failures. + */ +namespace NXIMPTestCaseUtilsPanic + { + _LIT( KCategory, "XIMPTestUtils" ); + + enum TReason + { + EStatusEventListenerBadMaxCount, + EStatusEventListenerAlreadyWaiting, + EStatusEventListenerUnknownEventTemplate, + EAddSnapshotOverflow, + ESnapshotIndexOutOfBounds, + EReceivingEventFromWrongContext, + EReceivedNotAcceptedEventType, + EUnsupportedEventTypeInVerification + }; + + + inline void Panic( NXIMPTestCaseUtilsPanic::TReason aReason ) + { + User::Panic( KCategory, aReason ); + + } + } + + +#endif //PRFWTESTCASEUTILSPANICS_H + + + + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwtestcontextwrapper.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwtestcontextwrapper.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,453 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Testing context wrapper + * +*/ + + + +#include + +#include + +#include "prfwtestcontextwrapper.h" +#include +#include +#include +#include +#include +#include + + +#include "prfwteststatuseventlistener.h" +#include "prfwtestmessenger.h" +#include "prfwtestmessaging.h" +#include "prfwtestfiletool.h" +#include "prfwtestprotocols.h" + +_LIT( KInstanceAsNumber, "%d" ); +// ======== LOCAL FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// Length of number in characters (e.g. 501 --> 3) +// --------------------------------------------------------------------------- +// +TInt NumLenInChars( TInt aNum ) + { + TInt len = 0; + TInt tmp = aNum; + do + { + tmp /= 10; // number is base-10 + len++; + } + while ( tmp > 0 ); + return len; + } + + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// Instance id +// --------------------------------------------------------------------------- +// +EXPORT_C const TDesC16& CXIMPTestContextWrapper::InstanceId() const + { + return *iInstance; + } + + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +CXIMPTestContextWrapper::CXIMPTestContextWrapper( TInt aIndex, + MXIMPClient* aClient ) : + iIndex( aIndex ), + iClient( aClient ) + { + } + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +void CXIMPTestContextWrapper::ConstructL() + { + iContext = iClient->NewPresenceContextLC(); + CleanupStack::Pop(); // iContext + iListener = CXIMPTestStatusEventListener::NewL( 20, iContext ); + iMessenger = CXIMPTestMessenger::NewForClientSideL( iIndex ); + iPresFeatures = MPresenceFeatures::NewL(iContext); + TInt instanceLength = NumLenInChars( iIndex ); + iInstance = HBufC::NewL( instanceLength ); + iInstance->Des().AppendFormat( KInstanceAsNumber, iIndex ); + } + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +EXPORT_C CXIMPTestContextWrapper* CXIMPTestContextWrapper::NewL( + TInt aIndex, MXIMPClient* aClient ) + { + CXIMPTestContextWrapper* self = new( ELeave ) CXIMPTestContextWrapper( aIndex, aClient ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +CXIMPTestContextWrapper::~CXIMPTestContextWrapper() + { + iStatusEventTraits.Close(); + + delete iMessenger; + delete iListener; + delete iContext; + delete iFileTool; + delete iInstance; + delete iPresFeatures; + } + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +EXPORT_C MXIMPContext* CXIMPTestContextWrapper::GetContext() + { + return iContext; + } + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +EXPORT_C MPresenceFeatures* CXIMPTestContextWrapper::GetPresenceFeatures() + { + return iPresFeatures; + } +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +EXPORT_C CXIMPTestStatusEventListener* CXIMPTestContextWrapper::GetEventListener() + { + return iListener; + } + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +EXPORT_C CXIMPTestMessenger* CXIMPTestContextWrapper::GetMessenger() + { + return iMessenger; + } + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +EXPORT_C MXIMPClient* CXIMPTestContextWrapper::GetClient() + { + return iClient; + } + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +EXPORT_C void CXIMPTestContextWrapper::DeletePresenceContext() + { + // used to test abrupt handle closings + iListener->SetEventSourceL( NULL ); + delete iContext; + iContext = NULL; + } + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +EXPORT_C void CXIMPTestContextWrapper::SetupEmptyListener() + { + iListener->ResetEventStack(); + iStatusEventTraits.Reset(); + } + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +EXPORT_C RArray* CXIMPTestContextWrapper::GetStatusTraits() + { + return &iStatusEventTraits; + } + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +EXPORT_C void CXIMPTestContextWrapper::SetupListenerL( TXIMPTestStatusEventTemplate aEventType ) + { + ResetListener(); + iListener->GetEventTemplateL( iStatusEventTraits, aEventType ); + iMessenger->SetPluginIndex( iIndex ); + } + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +EXPORT_C void CXIMPTestContextWrapper::AppendToTraitsL( TXIMPTestStatusEventTemplate aEventType ) + { + iListener->GetEventTemplateL( iStatusEventTraits, aEventType ); + } + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +EXPORT_C void CXIMPTestContextWrapper::SetupListenerReqCompleteL( + TXIMPTestStatusEventTemplate aEventType, + RArray< TInt32 >* aAdditionalEvents ) + { + iListener->ResetEventStack(); + iListener->AcceptedEventTypes().Reset(); + iListener->AcceptedEventTypes().AppendL( MXIMPRequestCompleteEvent::KInterfaceId ); + + if ( aAdditionalEvents ) + { + for ( TInt i = 0; i < aAdditionalEvents->Count(); i++ ) + { + iListener->AcceptedEventTypes().AppendL( (*aAdditionalEvents)[ i ] ); + } + } + + iListener->ReRegisterEventFilterL(); + iStatusEventTraits.Reset(); + iListener->GetEventTemplateL( iStatusEventTraits, aEventType ); + + iMessenger->SetPluginIndex( iIndex ); + } + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +EXPORT_C void CXIMPTestContextWrapper::ClearListener() + { + iListener->ResetEventStack(); + iListener->SetEventSourceL( NULL ); + + iStatusEventTraits.Reset(); + } + + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +EXPORT_C void CXIMPTestContextWrapper::ResetListener() + { + iListener->ResetEventStack(); + iListener->ResetEventTypeStack(); + iStatusEventTraits.Reset(); + iListener->ReRegisterEventFilterL(); + } + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +EXPORT_C void CXIMPTestContextWrapper::WaitRequestAndStackEvents( TXIMPRequestId aReqId ) + { + iListener->WaitRequestAndStackEvents( aReqId ); + } + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +EXPORT_C void CXIMPTestContextWrapper::VerifyEventStackL( const TPtrC8& aDesc ) + { + iListener->VerifyEventStackL( iStatusEventTraits.Array(), aDesc ); + } + +// --------------------------------------------------------------------------- +// CXIMPTestContextWrapper::WaitAnyEvent +// --------------------------------------------------------------------------- +// +EXPORT_C void CXIMPTestContextWrapper::WaitAnyEvent() + { + iListener->WaitAnyEvent(); + } + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +EXPORT_C void CXIMPTestContextWrapper::BindL( + TUid aUid, + const TDesC& aServer, + const TDesC& aUser, + const TDesC& aPassword ) + { + SetupListenerL( EXIMPTestStatusEvents_BindingOk ); + iMessenger->SetNoError(); + iMessenger->SetPluginIndex( iIndex ); + + delete iFileTool; + iFileTool = NULL; + iFileTool = CXIMPTestFileTool::NewL( aUid.iUid, iIndex ); + + TXIMPRequestId reqId = iContext->BindToL( + aUid, + aServer, + aUser, + aPassword, + *iInstance, + iIndex ); + + WaitRequestAndStackEvents( reqId ); + VerifyEventStackL( _L8("Binding (wrapper BindL): ") ); + + EUNIT_ASSERT_DESC( iMessenger->GetBoolean( EXIMPPlgTestOpenSessionCalled ) || + iMessenger->GetBoolean( EXIMPPlgTestShareSessionCalled ), "OpenSessionL was not called" ); + } + +// --------------------------------------------------------------------------- +// Bind alternative +// --------------------------------------------------------------------------- +// +const TUid KTestProtocolUid = { K_PRFW_TST_PROTOCOL_1_IMPLEMENTATION_UID }; // hardcoded... + +_LIT( KTestFakeServer, "www.imps%d.no/wv" ); +_LIT( KTestFakeUser, "user%d" ); +_LIT( KTestFakePassword, "password%d" ); + +EXPORT_C void CXIMPTestContextWrapper::BindL( TInt aId ) + { + SetupListenerL( EXIMPTestStatusEvents_BindingOk ); + iMessenger->SetNoError(); + iMessenger->SetPluginIndex( aId ); + + // create fake info + TInt extraLength = 8; // bad style... but length is enough + + HBufC* fakeSrv = HBufC::NewLC( KTestFakeServer().Length() + extraLength ); + fakeSrv->Des().AppendFormat( KTestFakeServer, aId ); + + HBufC* fakeUser = HBufC::NewLC( KTestFakeUser().Length() + extraLength ); + fakeUser->Des().AppendFormat( KTestFakeUser, aId ); + + HBufC* fakePass = HBufC::NewLC( KTestFakePassword().Length() + extraLength ); + fakePass->Des().AppendFormat( KTestFakePassword, aId ); + + delete iFileTool; + iFileTool = NULL; + iFileTool = CXIMPTestFileTool::NewL( KTestProtocolUid.iUid, iIndex ); + + TXIMPRequestId reqId = iContext->BindToL( + KTestProtocolUid, + *fakeSrv, + *fakeUser, + *fakePass, + *iInstance, + aId ); + + CleanupStack::PopAndDestroy( 3, fakeSrv ); + + WaitRequestAndStackEvents( reqId ); + VerifyEventStackL( _L8("Binding (wrapper BindL): ") ); + + EUNIT_ASSERT_DESC( iMessenger->GetBoolean( EXIMPPlgTestOpenSessionCalled ) || + iMessenger->GetBoolean( EXIMPPlgTestShareSessionCalled ), "OpenSessionL was not called" ); + } + + + + ///NEW BIND + EXPORT_C void CXIMPTestContextWrapper::BindWithSettingsL( TInt aId ) + { + SetupListenerL( EXIMPTestStatusEvents_BindingOk ); + iMessenger->SetNoError(); + iMessenger->SetPluginIndex( 0/*aId*/ ); + + // create fake info + TInt extraLength = 8; // bad style... but length is enough + + HBufC* fakeSrv = HBufC::NewLC( KTestFakeServer().Length() + extraLength ); + fakeSrv->Des().AppendFormat( KTestFakeServer, aId ); + + HBufC* fakeUser = HBufC::NewLC( KTestFakeUser().Length() + extraLength ); + fakeUser->Des().AppendFormat( KTestFakeUser, aId ); + + HBufC* fakePass = HBufC::NewLC( KTestFakePassword().Length() + extraLength ); + fakePass->Des().AppendFormat( KTestFakePassword, aId ); + + delete iFileTool; + iFileTool = NULL; + iFileTool = CXIMPTestFileTool::NewL( KTestProtocolUid.iUid, iIndex ); + + TXIMPRequestId reqId = iContext->BindToL( + KTestProtocolUid, aId ); + + CleanupStack::PopAndDestroy( 3, fakeSrv ); + + WaitRequestAndStackEvents( reqId ); + VerifyEventStackL( _L8("Binding (wrapper BindWithSettingsL): ") ); + + EUNIT_ASSERT_DESC( iMessenger->GetBoolean( EXIMPPlgTestOpenSessionCalled ) || + iMessenger->GetBoolean( EXIMPPlgTestShareSessionCalled ), "OpenSessionL was not called" ); + } + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +EXPORT_C void CXIMPTestContextWrapper::UnbindL() + { + SetupListenerL( EXIMPTestStatusEvents_UnbindingOk ); + iMessenger->SetNoError(); + TXIMPRequestId reqId = iContext->UnbindL(); + + WaitRequestAndStackEvents( reqId ); + VerifyEventStackL( _L8("Unbinding (wrapper UnbindL): ") ); + + EUNIT_ASSERT_DESC( iMessenger->GetBoolean( EXIMPPlgTestCloseSessionCalled ) || + iMessenger->GetBoolean( EXIMPPlgTestUnshareSessionCalled ) , "CloseSession was not called" ); + if( iMessenger->GetBoolean( EXIMPPlgTestCloseSessionCalled ) ) + { + DeletePresenceContext(); + //EUNIT_ASSERT_DESC( iMessenger->GetBoolean( EXIMPPlgTestDeath ), "Plugin did not die, destructor not called."); + } + } + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +EXPORT_C CXIMPTestFileTool& CXIMPTestContextWrapper::FileTool() const + { + return *iFileTool; + } + +// End of file diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwtestcontextwrapper.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwtestcontextwrapper.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,197 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Testing context wrapper + * +*/ + + +#ifndef CPRFWTESTCONTEXTWRAPPER_H +#define CPRFWTESTCONTEXTWRAPPER_H + +#include + +#include "prfwteststatuseventlistener.h" + +class MXIMPClient; +class MXIMPContext; +class CXIMPTestStatusEventListener; +class CXIMPTestMessenger; +class CXIMPTestFileTool; +class MPresenceFeatures; + +/** + * Wrapper for testing. + * Owns the things needed to test one host-plugin connection. + * + * @since S60 v4.0 + */ +class CXIMPTestContextWrapper : public CBase + { + public: + + /** + * @param aIndex Index of wrapper (used for pubsub-messaging + * between test plugin and test code). + */ + IMPORT_C static CXIMPTestContextWrapper* NewL( TInt aIndex, MXIMPClient* aClient ); + virtual ~CXIMPTestContextWrapper(); + + private: + + CXIMPTestContextWrapper( TInt aIndex, MXIMPClient* aClient ); + void ConstructL(); + + public: + + // accessors + IMPORT_C MXIMPContext* GetContext(); + IMPORT_C CXIMPTestStatusEventListener* GetEventListener(); + IMPORT_C CXIMPTestMessenger* GetMessenger(); + IMPORT_C MXIMPClient* GetClient(); + IMPORT_C RArray* GetStatusTraits(); + IMPORT_C MPresenceFeatures* GetPresenceFeatures(); + + // low-level test support - see e.g. t_sessionmng test for usage + // + /** + * Delete the presence context and set it to NULL. + */ + IMPORT_C void DeletePresenceContext(); + + /** + * Like SetupListenerL but sets no event template. Use AppendToTraitsL to set + * the desired templates. Useful for certain test cases. + */ + IMPORT_C void SetupEmptyListener(); + + /** + * Setup a listener using the given event template for the traits. + * @param aEventType The event template to listen to. + */ + IMPORT_C void SetupListenerL( TXIMPTestStatusEventTemplate aEventType ); + + /** + * Append the given template to the internal traits. + * @param aEventType The event template to add. + */ + IMPORT_C void AppendToTraitsL( TXIMPTestStatusEventTemplate aEventType ); + + /** + * Setup a listener for a request complete event. All other events from the + * given template are ignored (except those given by aAdditionalEvents). + * @param aEventType The event template. + * @param aAdditionalEvents Additional events to listen to. + */ + IMPORT_C void SetupListenerReqCompleteL( + TXIMPTestStatusEventTemplate aEventType, + RArray< TInt32 >* aAdditionalEvents = NULL ); + + /** + * Clear the listener. + */ + IMPORT_C void ClearListener(); + + /** + * Back to begin state of listener. + */ + IMPORT_C void ResetListener(); + + /** + * Wait for the events and a request complete event for the given request id. + * @param aReqId The request id for which a req. complete ends the wait + */ + IMPORT_C void WaitRequestAndStackEvents( TXIMPRequestId aReqId ); + + /** + * Wait for any event to occur. Event ends the wait. + */ + IMPORT_C void WaitAnyEvent(); + + /** + * Verify the event stack against the previously set template(s). + * The description is printed to the EUnit log. + * @param aDesc The description + */ + IMPORT_C void VerifyEventStackL( const TPtrC8& aDesc ); + + // high-level test support + /** + * Happy-path binding. + */ + IMPORT_C void BindL( + TUid aUid, + const TDesC& aServer, + const TDesC& aUser, + const TDesC& aPassword ); + + /** + * Happy-path binding alternative method. + * The server, userid and password are automatically modified + * based on the given id: + * Server: www.imps%d.no/wv + * User: user%d + * Password: password%d. + * @param aId An id used to modify server login data. + */ + IMPORT_C void BindL( TInt aId ); + + IMPORT_C void BindWithSettingsL( TInt aId ); + /** + * Happy-path unbinding + */ + IMPORT_C void UnbindL(); + + /** + * Access to filetool of wrapper. + */ + IMPORT_C CXIMPTestFileTool& FileTool() const; + + /** + * @return Instance id + */ + IMPORT_C const TDesC16& InstanceId() const; + + private: // data + + // not owned + MXIMPClient* iClient; + + // owned + MXIMPContext* iContext; + + // owned + MPresenceFeatures* iPresFeatures; + + + // owned + CXIMPTestStatusEventListener* iListener; + + // owned + CXIMPTestMessenger* iMessenger; + + // owned + RArray< TXIMPTestStatusEventSnapshot > iStatusEventTraits; + + TInt iIndex; + + /** + * Filetool + */ + CXIMPTestFileTool* iFileTool; + + HBufC16* iInstance; // the global instance id + + }; + +#endif // CPRFWTESTCONTEXTWRAPPER_H diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwtestcontextwrappermgr.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwtestcontextwrappermgr.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,124 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Testing context wrapper + * +*/ + + + +#include + +#include +#include +#include "prfwtestcontextwrappermgr.h" +#include "prfwtestcontextwrapper.h" +#include +#include "prfwteststatuseventlistener.h" +#include "prfwtestmessenger.h" +#include "prfwtestmessaging.h" + +// ======== LOCAL FUNCTIONS ======== + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +CXIMPTestContextWrapperMgr::CXIMPTestContextWrapperMgr() + { + } + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +void CXIMPTestContextWrapperMgr::ConstructL() + { + // TODO + } + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +EXPORT_C CXIMPTestContextWrapperMgr* CXIMPTestContextWrapperMgr::NewL() + { + CXIMPTestContextWrapperMgr* self = new( ELeave ) CXIMPTestContextWrapperMgr(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +CXIMPTestContextWrapperMgr::~CXIMPTestContextWrapperMgr() + { + iWrappers.Close(); + iPrClients.Close(); + } + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +EXPORT_C void CXIMPTestContextWrapperMgr::CreateWrapperL( TInt aClientIndex /* = KErrNotFound */ ) + { + // make sure we've the client + MXIMPClient* client = NULL; + + if ( aClientIndex == KErrNotFound ) + { + if( iPrClients.Count() == 0 ) + { + // make a new one + client = MXIMPClient::NewClientL(); + iPrClients.AppendL( client ); + } + else + { + client = iPrClients[ 0 ]; + } + } + else + { + // if the index was bad, everything will blow. it's up to the client to instruct + // us correctly + client = iWrappers[ aClientIndex ]->GetClient(); + } + + CXIMPTestContextWrapper* tmp = CXIMPTestContextWrapper::NewL( iIndex, client ); + iWrappers.AppendL( tmp ); + + iIndex++; + } + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +EXPORT_C CXIMPTestContextWrapper* CXIMPTestContextWrapperMgr::GetWrapperL( TInt aIndex ) + { + return iWrappers[ aIndex ]; + } + +EXPORT_C TInt CXIMPTestContextWrapperMgr::WrapperCount() const + { + return iWrappers.Count(); + } + +// End of file diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwtestcontextwrappermgr.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwtestcontextwrappermgr.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,81 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Testing context wrapper + * +*/ + + +#ifndef CPRFWTESTCONTEXTWRAPPERMGR_H +#define CPRFWTESTCONTEXTWRAPPERMGR_H + +#include +#include + +#include "prfwteststatuseventlistener.h" + +class MXIMPClient; +class CXIMPTestContextWrapper; +class MXIMPContext; +class CXIMPTestStatusEventListener; +class CXIMPTestMessenger; + +/** + * Manager for wrappers. + * Owns the wrappers and provides convenience methods for + * test code. + * + * @since S60 v4.0 + */ +class CXIMPTestContextWrapperMgr : public CBase + { + public: + + IMPORT_C static CXIMPTestContextWrapperMgr* NewL(); + virtual ~CXIMPTestContextWrapperMgr(); + + private: + + CXIMPTestContextWrapperMgr(); + void ConstructL(); + + public: + + /** + * Creates a wrapper. The presence client can be given for wrappers + * which share a presence client. + * @param aClientIndex Use the client from this wrapper + * If aClientIndex is KErrNotFound, creates a new client. + */ + IMPORT_C void CreateWrapperL( TInt aClientIndex = KErrNotFound ); + + /** + * Direct access to a wrapper. Ownership NOT transferred. + * @param aIndex The index of desired wrapper + */ + IMPORT_C CXIMPTestContextWrapper* GetWrapperL( TInt aIndex ); + + /** + * Count of wrappers + */ + IMPORT_C TInt WrapperCount() const; + + private: // data + + RXIMPObjOwningPtrArray iWrappers; + RXIMPObjOwningPtrArray iPrClients; + + TInt iIndex; + }; + +#endif // CPRFWTESTCONTEXTWRAPPERMGR_H diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwtestdlluids.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwtestdlluids.hrh Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,40 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Presence Framework Eunit tests. +* +*/ + +#ifndef PRFWTESTDLLUIDS_HRH +#define PRFWTESTDLLUIDS_HRH + + +// ----------------------------------------------------------------------------- +// These are system wide UID 2:s for the various dll types. +// +// ----------------------------------------------------------------------------- +// +#define PRFWTEST_DLL_UID_STATIC_INTERFACE 0x1000008d +#define PRFWTEST_DLL_UID_ECOM_PLUGIN 0x10009D8D + +// ----------------------------------------------------------------------------- +// These are the UID 3:s for the Presence Framework test dlls. +// +// ----------------------------------------------------------------------------- +// +#define PRFWTEST_DLL_UID_COMMON 0x1110ff50 // TODO + + +#endif // PRFWDLLUIDS_HRH + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwtesteventfactory.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwtesteventfactory.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,426 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +#include "prfwtestcaseutilspanics.h" +#include "prfwtesteventfactory.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "ximpidentityimp.h" +#include "presencetypehelpers.h" +#include "presentitygroupinfoimp.h" +#include "presentitygroupmemberinfoimp.h" +#include "presentitygroupcontenteventimp.h" +#include "presentitygrouplisteventimp.h" + + + +using namespace NXIMPTestCaseUtilsPanic; + + + +// ============================ MEMBER FUNCTIONS =============================== + +// --------------------------------------------------------------------------- +// create a group content event with given arrays +// --------------------------------------------------------------------------- +// +EXPORT_C CPresentityGroupContentEventImp* +XIMPTestEventFactory::CreateGroupContentEventLCX( + const TDesC& aGroupId, + const TDesC& aIdentityForDelta, + const TDesC& aDispNameForDelta, + TTestPGLContentArraySpecifier aArraySpec, + const TDesC& aIdentityCurrent, + const TDesC& aDispNameCurrent, + MXIMPDataSubscriptionState::TSubscriptionState aSubscriptionState, + MXIMPDataSubscriptionState::TDataState aDataState + ) + { + // id for group + CXIMPIdentityImp* idForGroup = CXIMPIdentityImp::NewLC( aGroupId ); + + // create the arrays + RPrGrpMemInfoImpArray* addedList = new ( ELeave ) RPrGrpMemInfoImpArray; + CleanupDeletePushL( addedList ); + + RPrGrpMemInfoImpArray* updatedList = new ( ELeave ) RPrGrpMemInfoImpArray; + CleanupDeletePushL( updatedList ); + + RPrGrpMemInfoImpArray* removedList = new ( ELeave ) RPrGrpMemInfoImpArray; + CleanupDeletePushL( removedList ); + + RPrGrpMemInfoImpArray* currentList = new ( ELeave ) RPrGrpMemInfoImpArray; + CleanupDeletePushL( currentList ); + + // populate the current list + if ( aIdentityCurrent.Length() > 0 ) + { + // but don't put "KNullDesC" there if it's really empty + CXIMPIdentityImp* idForCurrent = CXIMPIdentityImp::NewLC( aIdentityCurrent ); + CPresentityGroupMemberInfoImp* grpInfoForCurrent = + CPresentityGroupMemberInfoImp::NewLC( *idForCurrent, aDispNameCurrent ); + currentList->AppendL( grpInfoForCurrent ); + CleanupStack::Pop( grpInfoForCurrent ); + CleanupStack::PopAndDestroy( idForCurrent ); + } + + // create the delta list + CXIMPIdentityImp* idForEvent = CXIMPIdentityImp::NewLC( aIdentityForDelta ); + CPresentityGroupMemberInfoImp* grpInfoForEvent = + CPresentityGroupMemberInfoImp::NewLC( *idForEvent, aDispNameForDelta ); + + // notice the cleanup stack usage. AppendL takes ownership, but + // it might not be done always. + TBool didAppend = EFalse; + + // put the given group info into the specified array. + switch ( aArraySpec ) + { + case ETestPGLCntAdded : + { + if ( aIdentityForDelta.Length() > 0 ) + { + addedList->AppendL( grpInfoForEvent ); + didAppend = ETrue; + } + break; + } + + case ETestPGLCntUpdated : + { + if ( aIdentityForDelta.Length() > 0 ) + { + updatedList->AppendL( grpInfoForEvent ); + didAppend = ETrue; + } + break; + } + + case ETestPGLCntRemoved : + { + if ( aIdentityForDelta.Length() > 0 ) + { + removedList->AppendL( grpInfoForEvent ); + didAppend = ETrue; + } + break; + } + + case ETestPGLCntEmpty : + { + // don't add, thus creating an empty array. + break; + } + + default: + { + User::Leave( KErrArgument ); + break; + } + }; + + // remove the event and id from cleanupstack. removal + // method depends on whether we did append or not + if ( didAppend ) + { + CleanupStack::Pop( grpInfoForEvent ); + CleanupStack::PopAndDestroy( idForEvent ); + } + else + { + CleanupStack::PopAndDestroy( 2, idForEvent ); + } + + CXIMPDataSubscriptionStateImp* stateImp = CXIMPDataSubscriptionStateImp::NewLC(); + stateImp->SetSubscriptionStateL( aSubscriptionState ); + stateImp->SetDataStateL( aDataState ); + + // create the actual event + CPresentityGroupContentEventImp* tmp = + CPresentityGroupContentEventImp::NewLC( + *idForGroup, + addedList, + updatedList, + removedList, + currentList, + stateImp + ); + CleanupStack::Pop( 2, stateImp ); + CleanupStack::PushL( tmp ); + + // test the accessors + if ( aIdentityForDelta.Length() > 0 ) + { + switch ( aArraySpec ) + { + case ETestPGLCntAdded : + { + EUNIT_ASSERT_DESC( tmp->NewMembersCount() == 1, "Added group member count mismatch" ); + TBool same = 0 == tmp->NewMember( 0 ).GroupMemberId().Identity().Compare( aIdentityForDelta ); + EUNIT_ASSERT_DESC( same, "Added group member id mismatch" ); + break; + } + + case ETestPGLCntUpdated : + { + EUNIT_ASSERT_DESC( tmp->UpdatedMembersCount() == 1, "Updated group member count mismatch" ); + TBool same = 0 == tmp->UpdatedMember( 0 ).GroupMemberId().Identity().Compare( aIdentityForDelta ); + EUNIT_ASSERT_DESC( same, "Updated group member id mismatch" ); + break; + } + + case ETestPGLCntRemoved : + { + EUNIT_ASSERT_DESC( tmp->DisappearedMembersCount() == 1, "Removed group member count mismatch" ); + TBool same = 0 == tmp->DisappearedMember( 0 ).GroupMemberId().Identity().Compare( aIdentityForDelta ); + EUNIT_ASSERT_DESC( same, "Removed group member id mismatch" ); + break; + } + + case ETestPGLCntEmpty : + { + // don't add, thus creating an empty array. + break; + } + + default : + { + break; + } + } + } + + if ( aIdentityCurrent.Length() > 0 ) + { + EUNIT_ASSERT_DESC( tmp->CurrentMembersCount() == 1, "Current group member count mismatch" ); + + TBool same = 0 == tmp->CurrentMember( 0 ).GroupMemberId().Identity().Compare( aIdentityCurrent ); + EUNIT_ASSERT_DESC( same, "Current group member id mismatch" ); + + same = 0 == tmp->CurrentMember( 0 ).GroupMemberDisplayName().Compare( aDispNameCurrent ); + EUNIT_ASSERT_DESC( same, "Current group member display name mismatch" ); + } + else + { + EUNIT_ASSERT_DESC( tmp->CurrentMembersCount() == 0, "Current group member count mismatch" ); + } + + /* + * In cleanupstack there are 6 items, FIFO: + * - identity object + * - added list + * - updated list + * - removed list + * - current member list + * - event imp + */ + + return tmp; + } + + +// --------------------------------------------------------------------------- +// create a group list event with given arrays +// --------------------------------------------------------------------------- +// +EXPORT_C CPresentityGroupListEventImp* XIMPTestEventFactory::CreateGroupListEventLCX( + const TDesC& aUri, + const TDesC& aDispName, + TTestPGLArraySpecifier aArraySpec, + const TDesC& aUriCurrent, + const TDesC& aDispNameCurrent, + MXIMPDataSubscriptionState::TSubscriptionState aSubscriptionState, + MXIMPDataSubscriptionState::TDataState aDataState + ) + { + // create the arrays + RPrGrpInfoImpArray* createdList = new ( ELeave ) RPrGrpInfoImpArray; + CleanupDeletePushL( createdList ); + + RPrGrpInfoImpArray* updatedList = new ( ELeave ) RPrGrpInfoImpArray; + CleanupDeletePushL( updatedList ); + + RPrGrpInfoImpArray* deletedList = new ( ELeave ) RPrGrpInfoImpArray; + CleanupDeletePushL( deletedList ); + + RPrGrpInfoImpArray* currentList = new ( ELeave ) RPrGrpInfoImpArray; + CleanupDeletePushL( currentList ); + + // create the group info + CXIMPIdentityImp* idForEvent = CXIMPIdentityImp::NewLC( aUri ); + CPresentityGroupInfoImp* grpInfoForEvent = + CPresentityGroupInfoImp::NewLC( *idForEvent, aDispName ); + + // populate the current list + if ( aUriCurrent.Length() > 0 ) + { + // but don't put "KNullDesC" there if it's really empty + CXIMPIdentityImp* idForCurrent = CXIMPIdentityImp::NewLC( aUriCurrent ); + CPresentityGroupInfoImp* grpInfoForCurrent = + CPresentityGroupInfoImp::NewLC( *idForCurrent, aDispNameCurrent ); + currentList->AppendL( grpInfoForCurrent ); + CleanupStack::Pop( grpInfoForCurrent ); + CleanupStack::PopAndDestroy( idForCurrent ); + } + + // notice the cleanup stack usage. AppendL takes ownership, but + // it might not be done always. + TBool didAppend = EFalse; + + // put the given group info into the specified array + switch ( aArraySpec ) + { + case ETestPGLCreated : + { + if ( aUri.Length() > 0 ) + { + createdList->AppendL( grpInfoForEvent ); + didAppend = ETrue; + } + break; + } + + case ETestPGLUpdated : + { + if ( aUri.Length() > 0 ) + { + updatedList->AppendL( grpInfoForEvent ); + didAppend = ETrue; + } + break; + } + + case ETestPGLDeleted : + { + if ( aUri.Length() > 0 ) + { + deletedList->AppendL( grpInfoForEvent ); + didAppend = ETrue; + } + break; + } + + case ETestPGLEmpty : + { + // don't add, thus creating an empty array + break; + } + + default: + { + User::Leave( KErrArgument ); + break; + } + }; + + // remove the event and id from cleanupstack. removal + // method depends on whether we did append or not + if ( didAppend ) + { + CleanupStack::Pop( grpInfoForEvent ); + CleanupStack::PopAndDestroy( idForEvent ); + } + else + { + CleanupStack::PopAndDestroy( 2, idForEvent ); + } + + CXIMPDataSubscriptionStateImp* stateImp = CXIMPDataSubscriptionStateImp::NewLC(); + stateImp->SetSubscriptionStateL( aSubscriptionState ); + stateImp->SetDataStateL( aDataState ); + + // create the actual event + CPresentityGroupListEventImp* tmp = + CPresentityGroupListEventImp::NewLC( + createdList, + updatedList, + deletedList, + currentList, + stateImp + ); + CleanupStack::Pop( 2, stateImp ); + CleanupStack::PushL( tmp ); + + // verify that the event contains correct information + if ( aUri.Length() > 0 ) + { + switch ( aArraySpec ) + { + case ETestPGLCreated : + { + EUNIT_ASSERT_DESC( tmp->NewGroupsCount() == 1, "Created group count mismatch" ); + TBool same = 0 == tmp->NewGroup( 0 ).GroupId().Identity().Compare( aUri ); + EUNIT_ASSERT_DESC( same, "Created group id mismatch" ); + break; + } + + case ETestPGLUpdated : + { + EUNIT_ASSERT_DESC( tmp->UpdatedGroupsCount() == 1, "Updated group count mismatch" ); + TBool same = 0 == tmp->UpdatedGroup( 0 ).GroupId().Identity().Compare( aUri ); + EUNIT_ASSERT_DESC( same, "Updated group id mismatch" ); + break; + } + + case ETestPGLDeleted : + { + EUNIT_ASSERT_DESC( tmp->DisappearedGroupsCount() == 1, "Deleted group count mismatch" ); + TBool same = 0 == tmp->DisappearedGroup( 0 ).GroupId().Identity().Compare( aUri ); + EUNIT_ASSERT_DESC( same, "Deleted group id mismatch" ); + break; + } + } + } + + if ( aUriCurrent.Length() > 0 ) + { + EUNIT_ASSERT_DESC( tmp->CurrentGroupsCount() == 1, "Current group count mismatch" ); + + TBool same = 0 == tmp->CurrentGroup( 0 ).GroupId().Identity().Compare( aUriCurrent ); + EUNIT_ASSERT_DESC( same, "Current group id mismatch" ); + + same = 0 == tmp->CurrentGroup( 0 ).GroupDisplayName().Compare( aDispNameCurrent ); + EUNIT_ASSERT_DESC( same, "Current group display name mismatch" ); + } + else + { + EUNIT_ASSERT_DESC( tmp->CurrentGroupsCount() == 0, "Current group count mismatch, expected 0" ); + } + + /* + * In cleanupstack there are 5 items, FIFO: + * - created list + * - updated list + * - deleted list + * - current list + * - event imp + */ + + return tmp; + } + +// end of file + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwtesteventfactory.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwtesteventfactory.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,140 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +#ifndef PRFWTESTEVENTFACTORY_H__ +#define PRFWTESTEVENTFACTORY_H__ + +#include +#include + +// CLASS DESCRIPTION + +class CPresentityGroupListEventImp; +class CPresentityGroupContentEventImp; +class CXIMPDataSubscriptionStateImp; + +/** + * Presence event factory for use in tests. + */ +class XIMPTestEventFactory + { + public: + + // @see below + enum TTestPGLArraySpecifier + { + ETestPGLCreated = 0, // group info is created + ETestPGLUpdated, // group info is updated + ETestPGLDeleted, // group info is deleted + ETestPGLEmpty, // make an empty array for empty event + }; + + /** + * Places an identity (uri-displayname pair) inside a group info into the + * array defined by aArraySpec, and returns the created event. + * + * In cleanupstack there are 5 items, FIFO: + * - created list + * - updated list + * - deleted list + * - current list + * - event imp + * + * This is because this event won't take ownership to the arrays + * when created this way. + * + * @param aUri URI of group + * @param aDispName Displayname + * @param aArraySpec Defines into which array to put the group info + * @param aUriCurrent The URI of group in "current"-list + * @param aDispNameCurrent The display name of the group in + * "current"-list + * @param aStatus The subscription status + * @return The suitably filled event. + */ + IMPORT_C static CPresentityGroupListEventImp* CreateGroupListEventLCX( + const TDesC& aUri, + const TDesC& aDispName, + + TTestPGLArraySpecifier aArraySpec, + + const TDesC& aUriCurrent, + const TDesC& aDispNameCurrent, + + MXIMPDataSubscriptionState::TSubscriptionState aSubscriptionState, + MXIMPDataSubscriptionState::TDataState aDataState + ); + + // @see below + enum TTestPGLContentArraySpecifier + { + ETestPGLCntAdded = 0, // group content is added + ETestPGLCntUpdated, // group content is updated + ETestPGLCntRemoved, // group content is deleted + ETestPGLCntEmpty, // make an empty array for empty event + }; + + /** + * Places an group member (identity-displayname pair) inside + * a group content info into the delta array defined by aArraySpec, + * and returns the created event. + * + * The current member list will contain only the group member + * specified by parameters aIdentityCurrent and aDispNameCurrent. + * To support more members than 1 this method needs to be changed, + * but for now, it suffices for our testing. + * + * In cleanupstack there are 5 items, FIFO: + * - added list + * - updated list + * - removed list + * - current member list + * - event imp + * + * This is because this event won't take ownership to the arrays + * when created this way. + * + * @param aGroupId The group id + * @param aUri Uri + * @param aDispName Displayname + * @param aArraySpec Defines into which delta array to put the member + * @param aIdentityCurrent Identity part of current member + * @param aDispNameCurrent Display name part of current member + * @param aStatus The subscription status + * @return The suitably filled event. + */ + IMPORT_C static CPresentityGroupContentEventImp* + CreateGroupContentEventLCX( + const TDesC& aGroupId, + + const TDesC& aIdentityForDelta, + const TDesC& aDispNameForDelta, + + TTestPGLContentArraySpecifier aArraySpec, + + const TDesC& aIdentityCurrent, + const TDesC& aDispNameCurrent, + + MXIMPDataSubscriptionState::TSubscriptionState aSubscriptionState, + MXIMPDataSubscriptionState::TDataState aDataState + ); + }; + +#endif //PRFWTESTEVENTFACTORY_H__ + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwtestfilelogichelper.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwtestfilelogichelper.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,317 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Test support file tool + * +*/ + + +#include +#include +#include +#include +#include +#include +#include +#include "prfwtestfilelogichelper.h" +#include "prfwtestfilesrvmsg.h" +#include "presentitygroupinfoimp.h" +#include "presentitygroupmemberinfoimp.h" +#include "presencewatcherinfoimp.h" +#include "presencegrantrequestinfoimp.h" +#include "presenceblockinfoimp.h" +#include "ximpidentityimp.h" +#include "ximpobjecthelpers.h" +#include "prfwtestmessenger.h" +#include "ximprestrictedobjectcollectionimp.h" +#include "ximpobjectcollectionimp.h" +#include "presenceinfoimp.h" + +// ======== LOCAL FUNCTIONS ======== + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +CXIMPTestFileLogicHelper::CXIMPTestFileLogicHelper( MXIMPProtocolConnectionHost& aHost, CXIMPTestMessenger& aMessenger ) +: iHost( aHost ), iMessenger( aMessenger ) + { + } + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +void CXIMPTestFileLogicHelper::ConstructL() + { + } + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +EXPORT_C CXIMPTestFileLogicHelper* CXIMPTestFileLogicHelper::NewL( MXIMPProtocolConnectionHost& aHost, CXIMPTestMessenger& aMessenger ) + { + CXIMPTestFileLogicHelper* self = new( ELeave ) CXIMPTestFileLogicHelper( aHost, aMessenger ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +CXIMPTestFileLogicHelper::~CXIMPTestFileLogicHelper() + { + } + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +void CXIMPTestFileLogicHelper::HandleL( TInt aCommandType, TDesC8& aCommand ) + { + switch( aCommandType ) + { + case CXIMPTestFileSrvMsg::ETestSrvMsgPresenceGrantRequestList: + { + RXIMPObjOwningPtrArray< CPresenceGrantRequestInfoImp > array; + CleanupClosePushL( array ); + TXIMPObjectPacker::UnPackArrayL( array, aCommand ); + CXIMPObjectCollectionImp* objCollection = CXIMPObjectCollectionImp::NewLC(); + for( TInt a = 0; a < array.Count(); ++a ) + { + objCollection->AddObjectL( array[ a ] ); + array[ a ] = NULL; + } + + iHost.ProtocolPresenceDataHost().AuthorizationDataHost().HandlePresenceGrantRequestListL( objCollection ); + CleanupStack::Pop( objCollection ); + CleanupStack::PopAndDestroy(); //array + break; + } + case CXIMPTestFileSrvMsg::ETestSrvMsgPresenceGrantRequestReceived: + { + CPresenceGrantRequestInfoImp* infoFromServer = + CPresenceGrantRequestInfoImp::NewLC(); + TXIMPObjectPacker::UnPackL( + *infoFromServer, aCommand ); + + iHost.ProtocolPresenceDataHost().AuthorizationDataHost().HandlePresenceGrantRequestReceivedL( infoFromServer ); + CleanupStack::Pop( infoFromServer ); + break; + } + case CXIMPTestFileSrvMsg::ETestSrvMsgPresenceGrantRequestObsoleted: + { + CXIMPIdentityImp* idFromServer = CXIMPIdentityImp::NewLC(); + TXIMPObjectPacker::UnPackL( *idFromServer, + aCommand ); + + iHost.ProtocolPresenceDataHost().AuthorizationDataHost().HandlePresenceGrantRequestObsoletedL( idFromServer ); + CleanupStack::Pop( idFromServer ); + break; + } + case CXIMPTestFileSrvMsg::ETestSrvMsgPresentityGroupList: + { + RXIMPObjOwningPtrArray< CPresentityGroupInfoImp > array; + CleanupClosePushL( array ); + TXIMPObjectPacker::UnPackArrayL( array, aCommand ); + CXIMPObjectCollectionImp* objCollection = CXIMPObjectCollectionImp::NewLC(); + for( TInt a = 0; a < array.Count(); ++a ) + { + objCollection->AddObjectL( array[ a ] ); + array[ a ] = NULL; + } + iHost.ProtocolPresenceDataHost().GroupsDataHost().HandlePresentityGroupListL( objCollection ); + CleanupStack::Pop( objCollection ); + CleanupStack::PopAndDestroy(); //array + break; + } + case CXIMPTestFileSrvMsg::ETestSrvMsgPresentityGroupCreate: + case CXIMPTestFileSrvMsg::ETestSrvMsgPresentityGroupUpdate: + { + CPresentityGroupInfoImp* infoFromServer = + CPresentityGroupInfoImp::NewLC(); + TXIMPObjectPacker::UnPackL( + *infoFromServer, aCommand ); + + if( aCommandType == CXIMPTestFileSrvMsg::ETestSrvMsgPresentityGroupCreate ) + { + iHost.ProtocolPresenceDataHost().GroupsDataHost().HandlePresentityGroupCreatedL( infoFromServer ); + } + else + { + iHost.ProtocolPresenceDataHost().GroupsDataHost().HandlePresentityGroupDisplayNameUpdatedL( infoFromServer ); + } + CleanupStack::Pop( infoFromServer ); + break; + } + case CXIMPTestFileSrvMsg::ETestSrvMsgPresentityGroupDelete: + { + CXIMPIdentityImp* idFromServer = CXIMPIdentityImp::NewLC(); + TXIMPObjectPacker::UnPackL( *idFromServer, + aCommand ); + iHost.ProtocolPresenceDataHost().GroupsDataHost().HandlePresentityGroupDeletedL( idFromServer ); + CleanupStack::Pop( idFromServer ); + break; + } + case CXIMPTestFileSrvMsg::ETestSrvMsgPresentityGroupMemberList: + { + RPointerArray< HBufC8 > bufferArray; + CleanupClosePushL( bufferArray ); + TXIMPHBuf8Packer::UnPackArrayL( bufferArray, aCommand ); + HBufC8* groupIdBuf = bufferArray[ 0 ]; + HBufC8* array = bufferArray[ 1 ]; + CleanupStack::PopAndDestroy(); // BufferArray + CleanupStack::PushL( groupIdBuf ); + CleanupStack::PushL( array ); + + CXIMPIdentityImp* groupId = CXIMPIdentityImp::NewLC(); + TXIMPObjectPacker< CXIMPIdentityImp >::UnPackL( *groupId, *groupIdBuf ); + + RXIMPObjOwningPtrArray< CPresentityGroupMemberInfoImp > memberArray; + CleanupClosePushL( memberArray ); + TXIMPObjectPacker::UnPackArrayL( memberArray, *array ); + CXIMPObjectCollectionImp* objCollection = CXIMPObjectCollectionImp::NewLC(); + for( TInt a = 0; a < memberArray.Count(); ++a ) + { + objCollection->AddObjectL( memberArray[ a ] ); + memberArray[ a ] = NULL; + } + iHost.ProtocolPresenceDataHost().GroupsDataHost().HandlePresentityGroupContentL( groupId, objCollection ); + CleanupStack::Pop( objCollection ); + CleanupStack::PopAndDestroy(); //memberArray + CleanupStack::Pop( groupId ); + CleanupStack::PopAndDestroy( 2, groupIdBuf ); + break; + } + case CXIMPTestFileSrvMsg::ETestCheckIfGroupMemberExists: + { + CXIMPIdentityImp* groupId = CXIMPIdentityImp::NewLC(); + TXIMPObjectPacker< CXIMPIdentityImp >::UnPackL( *groupId, aCommand ); + // Write to pubsub + const MXIMPDataSubscriptionState& state = + iHost.ProtocolPresenceDataHost().GroupsDataHost().PresentityGroupContentDataSubscriptionState( *groupId ); + if( state.DataState() == MXIMPDataSubscriptionState::EDataAvailable ) + { + iMessenger.SetValueFor( EXIMPPlgTestExistsGroupContentInCache, 1 ); + } + else + { + iMessenger.SetValueFor( EXIMPPlgTestExistsGroupContentInCache, KErrNotFound ); + } + CleanupStack::PopAndDestroy( groupId ); + break; + } + case CXIMPTestFileSrvMsg::ETestSrvMsgPresenceWatcherList: + { + RXIMPObjOwningPtrArray< CPresenceWatcherInfoImp > array; + CleanupClosePushL( array ); + TXIMPObjectPacker< CPresenceWatcherInfoImp >::UnPackArrayL( array, aCommand ); + CXIMPObjectCollectionImp* objCollection = CXIMPObjectCollectionImp::NewLC(); + for( TInt a = 0; a < array.Count(); ++a ) + { + objCollection->AddObjectL( array[ a ] ); + array[ a ] = NULL; + } + + iHost.ProtocolPresenceDataHost().PublishingDataHost().HandlePresenceWatcherListL( objCollection ); + CleanupStack::Pop( objCollection ); + CleanupStack::PopAndDestroy(); //, array + break; + } + case CXIMPTestFileSrvMsg::ETestSrvMsgPresentityPresence: + { + RPointerArray< HBufC8 > bufferArray; + CleanupClosePushL( bufferArray ); + TXIMPHBuf8Packer::UnPackArrayL( bufferArray, aCommand ); + HBufC8* presenceIdBuf = bufferArray[ 0 ]; + HBufC8* presenceInfoBuf = bufferArray[ 1 ]; + CleanupStack::PopAndDestroy(); // BufferArray + CleanupStack::PushL( presenceIdBuf ); + CleanupStack::PushL( presenceInfoBuf ); + + CXIMPIdentityImp* presenceId = CXIMPIdentityImp::NewLC(); + TXIMPObjectPacker< CXIMPIdentityImp >::UnPackL( *presenceId, *presenceIdBuf ); + + CPresenceInfoImp* presenceInfo = CPresenceInfoImp::NewLC(); + TXIMPObjectPacker< CPresenceInfoImp >::UnPackL( *presenceInfo, *presenceInfoBuf ); + + iHost.ProtocolPresenceDataHost().WatchingDataHost().HandleSubscribedPresentityPresenceL( presenceId, presenceInfo ); + + CleanupStack::Pop( 2, presenceId ); + CleanupStack::PopAndDestroy( 2, presenceIdBuf ); + break; + } + case CXIMPTestFileSrvMsg::ETestSrvMsgPresenceBlockList: + { + RXIMPObjOwningPtrArray< CPresenceBlockInfoImp > array; + CleanupClosePushL( array ); + TXIMPObjectPacker< CPresenceBlockInfoImp >::UnPackArrayL( array, aCommand ); + CXIMPObjectCollectionImp* objCollection = CXIMPObjectCollectionImp::NewLC(); + for( TInt a = 0; a < array.Count(); ++a ) + { + objCollection->AddObjectL( array[ a ] ); + array[ a ] = NULL; + } + + iHost.ProtocolPresenceDataHost().AuthorizationDataHost().HandlePresenceBlockListL( objCollection ); + CleanupStack::Pop( objCollection ); + CleanupStack::PopAndDestroy(); // array + break; + } + case CXIMPTestFileSrvMsg::ETestSrvMsgPresenceBlocked: + { + CPresenceBlockInfoImp* infoFromServer = + CPresenceBlockInfoImp::NewLC(); + TXIMPObjectPacker::UnPackL( + *infoFromServer, aCommand ); + iHost.ProtocolPresenceDataHost().AuthorizationDataHost().HandlePresenceBlockedL( infoFromServer ); + CleanupStack::Pop( infoFromServer ); + break; + } + case CXIMPTestFileSrvMsg::ETestSrvMsgPresenceBlockCanceled: + { + CXIMPIdentityImp* idFromServer = CXIMPIdentityImp::NewLC(); + TXIMPObjectPacker::UnPackL( *idFromServer, + aCommand ); + + iHost.ProtocolPresenceDataHost().AuthorizationDataHost().HandlePresenceBlockCanceledL( idFromServer ); + + CleanupStack::Pop( idFromServer ); + break; + } + + case CXIMPTestFileSrvMsg::ETestSrvMsgReqParamIdentity: + { + CXIMPIdentityImp* groupId = CXIMPIdentityImp::NewLC(); + TXIMPObjectPacker< CXIMPIdentityImp >::UnPackL( *groupId, aCommand ); + CXIMPRestrictedObjectCollectionImp* paramCollection = CXIMPRestrictedObjectCollectionImp::NewLC(); + paramCollection->AddOrReplaceTypeL( groupId ); + iMessenger.SetReqCompleteParams( paramCollection ); + CleanupStack::Pop( 2, groupId ); + break; + } + default: + { + User::Panic( _L( "Not valid commandtype" ), 59 ); + break; + } + } + } + +// End of file diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwtestfilelogichelper.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwtestfilelogichelper.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,66 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Test support file tool + * +*/ + + +#ifndef CPRFWTESTFILELOGICHELPER_H +#define CPRFWTESTFILELOGICHELPER_H + +#include +#include "prfwtestfileobserver.h" + +class MXIMPProtocolConnectionHost; +class CXIMPTestMessenger; + +/** + * @since S60 v4.0 + */ +class CXIMPTestFileLogicHelper : public CBase, public MXIMPTestFileObserver + { + public: + + IMPORT_C static CXIMPTestFileLogicHelper* NewL( MXIMPProtocolConnectionHost& aHost, CXIMPTestMessenger& aMessenger ); + virtual ~CXIMPTestFileLogicHelper(); + + private: + + CXIMPTestFileLogicHelper( MXIMPProtocolConnectionHost& aHost, CXIMPTestMessenger& aMessenger ); + void ConstructL(); + + public: + + + private: // From MXIMPTestFileObserver + + /** + * @see MXIMPTestFileObserver + */ + virtual void HandleL( TInt aCommandType, TDesC8& aCommand ); + + private: // data + + /** + * Access to host for server messages. + */ + MXIMPProtocolConnectionHost& iHost; + + /** + * Does not own. Messenger for signaling. + */ + CXIMPTestMessenger& iMessenger; + }; + +#endif // CPRFWTESTFILELOGICHELPER_H diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwtestfileobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwtestfileobserver.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,40 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Test support file tool + * +*/ + + +#ifndef MPRFWTESTFILEOBSERVER_H +#define MPRFWTESTFILEOBSERVER_H + +/** + * @since S60 v4.0 + */ +class MXIMPTestFileObserver + { + protected: + + /** + * Cannot be deleted through this interface + */ + virtual ~MXIMPTestFileObserver(){} + + public: // Interface + + virtual void HandleL( TInt aCommandType, TDesC8& aCommand ) = 0; + + }; + +#endif // CPRFWTESTFILELOGICHELPER_H \ No newline at end of file diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwtestfilesrvmsg.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwtestfilesrvmsg.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,149 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Test support file tool server message + * +*/ + + + +#include +#include +#include + +#include "prfwtestfilesrvmsg.h" + +// ======== LOCAL FUNCTIONS ======== + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +CXIMPTestFileSrvMsg::CXIMPTestFileSrvMsg() + { + } + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +void CXIMPTestFileSrvMsg::ConstructL() + { + iPayload = HBufC8::NewL(0); + } + + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +EXPORT_C CXIMPTestFileSrvMsg* CXIMPTestFileSrvMsg::NewLC() + { + CXIMPTestFileSrvMsg* self = new( ELeave ) CXIMPTestFileSrvMsg(); + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +void CXIMPTestFileSrvMsg::ConstructL( const TDesC8& aPayload ) + { + iPayload = aPayload.AllocL(); + } + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +CXIMPTestFileSrvMsg::CXIMPTestFileSrvMsg( TInt aSrvMsgId ) : + iSrvMsgId( aSrvMsgId ) + { + } + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +EXPORT_C CXIMPTestFileSrvMsg* CXIMPTestFileSrvMsg::NewL( + TInt aSrvMsgId, + const TDesC8& aPayload ) + { + CXIMPTestFileSrvMsg* self = new( ELeave ) CXIMPTestFileSrvMsg( aSrvMsgId ); + CleanupStack::PushL( self ); + self->ConstructL( aPayload ); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +CXIMPTestFileSrvMsg::~CXIMPTestFileSrvMsg() + { + delete iPayload; + } + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +EXPORT_C void CXIMPTestFileSrvMsg::ExternalizeL( RWriteStream& aStream ) const + { + aStream.WriteUint32L( iSrvMsgId ); + aStream.WriteUint32L( iPayload->Length() ); + aStream.WriteL( *iPayload ); + } + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +EXPORT_C void CXIMPTestFileSrvMsg::InternalizeL( RReadStream& aStream ) + { + iSrvMsgId = aStream.ReadUint32L(); + TInt len = aStream.ReadUint32L(); + + HBufC8* buffer = HBufC8::NewLC( len ); + TPtr8 ptr = buffer->Des(); + aStream.ReadL( ptr, len ); + + delete iPayload; + CleanupStack::Pop( buffer ); + iPayload = buffer; + } + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +EXPORT_C TDesC8& CXIMPTestFileSrvMsg::PayloadL() + { + return *iPayload; + } + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +EXPORT_C TInt CXIMPTestFileSrvMsg::SrvMsgId() + { + return iSrvMsgId; + } + +// End of file diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwtestfilesrvmsg.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwtestfilesrvmsg.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,106 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Test support file tool server message + * +*/ + + +#ifndef CPRFWTESTFILESRVMSG_H +#define CPRFWTESTFILESRVMSG_H + +#include +#include + +/** + * Support for servermessage files. + * + * @since S60 v4.0 + */ +class CXIMPTestFileSrvMsg : public CBase + { + public: + + enum TTestSrvMsgType + { + ETestSrvMsgPresenceBlockList, + ETestSrvMsgPresenceBlocked, + ETestSrvMsgPresenceBlockCanceled, + ETestSrvMsgPresenceGrantRequestList, + ETestSrvMsgPresenceGrantRequestReceived, + ETestSrvMsgPresenceGrantRequestObsoleted, + ETestSrvMsgPresentityGroupList, + ETestSrvMsgPresentityGroupCreate, + ETestSrvMsgPresentityGroupDelete, + ETestSrvMsgPresentityGroupUpdate, + ETestSrvMsgPresentityGroupMemberList, + ETestCheckIfGroupMemberExists, + ETestSrvMsgPresenceWatcherList, + ETestSrvMsgPresentityPresence, + ETestSrvMsgReqParamIdentity, + }; + + public: + + IMPORT_C static CXIMPTestFileSrvMsg* NewLC(); + + IMPORT_C static CXIMPTestFileSrvMsg* NewL( + TInt aSrvMsgId, + const TDesC8& aPayload ); + + virtual ~CXIMPTestFileSrvMsg(); + + private: + + CXIMPTestFileSrvMsg(); + + void ConstructL(); + + CXIMPTestFileSrvMsg( TInt aSrvMsgId ); + + void ConstructL( const TDesC8& aPayload ); + + public: + + /** + * Extenalizes object data to given stream. + * @param aStream Stream to write. + */ + IMPORT_C void ExternalizeL( RWriteStream& aStream ) const; + + /** + * Internalizes object data from given stream. + * @param aStream Stream to read. + */ + IMPORT_C void InternalizeL( RReadStream& aStream ); + + /** + * Getter for the data stored inside this class. + * @return Reference to the data + */ + IMPORT_C TDesC8& PayloadL(); + + /** + * Server message identifier specifies what kind of + * server-originated message this is. + * @return Server message identifier + */ + IMPORT_C TInt SrvMsgId(); + + private: // data + + TInt iSrvMsgId; + HBufC8* iPayload; + }; + +#endif // CPRFWTESTFILESRVMSG_H diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwtestfiletool.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwtestfiletool.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,502 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Test support file tool + * +*/ + + + +#include +#include +#include + +#include "prfwtestfiletool.h" +#include "prfwtestfilesrvmsg.h" +#include "ximpeventcodec.h" +#include "prfwtestfileobserver.h" + +/* Hierarchy under C:/temp/prfw/: + * /protocoluid/instancenumber/Plugin\ + * /protocoluid/instancenumber/SrvMsg\ + */ + +_LIT( KFileToolMainDirFull, "c:\\temp\\prfw" ); + +_LIT( KFileToolBackslash, "\\" ); +_LIT( KFileToolDirUid, "%d" ); +_LIT( KInstanceAsNumber, "%d" ); + +_LIT( KFileToolPluginDirBase, "Plugin" ); +_LIT( KFileToolSrvDirBase, "SrvMsg" ); + +_LIT( KFileToolWildcard, "file*.prfw" ); +_LIT( KFileToolFileBase, "file%d.prfw" ); + +// ======== LOCAL FUNCTIONS ======== + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +CXIMPTestFileTool::CXIMPTestFileTool( TUint32 aUid ) : + iUid( aUid ) + { + iFs.Connect(); + } + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +void CXIMPTestFileTool::ConstructL( const TDesC16& aInstanceId ) + { + iTimer = CPeriodic::NewL( CActive::EPriorityStandard ); + iInstance = aInstanceId.AllocL(); + } + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +void CXIMPTestFileTool::ConstructL( TInt aInstanceIdAsNum ) + { + TInt instanceLength = NumLenInChars( aInstanceIdAsNum ); + HBufC* instance = HBufC::NewLC( instanceLength ); + instance->Des().AppendFormat( KInstanceAsNumber, aInstanceIdAsNum ); + ConstructL( *instance ); + CleanupStack::PopAndDestroy( instance ); + } + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +EXPORT_C CXIMPTestFileTool* CXIMPTestFileTool::NewL( TUint32 aUid, const TDesC16& aInstanceId ) + { + CXIMPTestFileTool* self = new( ELeave ) CXIMPTestFileTool( aUid ); + CleanupStack::PushL( self ); + self->ConstructL( aInstanceId ); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +EXPORT_C CXIMPTestFileTool* CXIMPTestFileTool::NewL( TUint32 aUid, TInt aInstanceIdAsNum ) + { + CXIMPTestFileTool* self = new( ELeave ) CXIMPTestFileTool( aUid ); + CleanupStack::PushL( self ); + self->ConstructL( aInstanceIdAsNum ); + CleanupStack::Pop( self ); + return self; + } + + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +CXIMPTestFileTool::~CXIMPTestFileTool() + { + iFs.Close(); + if ( iTimer ) + { + iTimer->Deque(); + } + delete iTimer; + iObservers.Close(); + delete iInstance; + } + +// --------------------------------------------------------------------------- +// Remove the entire prfw directory +// --------------------------------------------------------------------------- +// +EXPORT_C void CXIMPTestFileTool::CleanAllL() + { + RFs fs; + fs.Connect(); + CleanupClosePushL( fs ); + + CFileMan* fileMan = CFileMan::NewL( fs ); + CleanupStack::PushL( fileMan ); + + // remove the files and the directory + fileMan->RmDir( KFileToolMainDirFull ); + + CleanupStack::PopAndDestroy( 2 ); // fileman, fs + } + +// --------------------------------------------------------------------------- +// Prepare everything, after this objects can be externalized and +// internalized +// --------------------------------------------------------------------------- +// +EXPORT_C void CXIMPTestFileTool::PrepareL() + { + // create the directory structure + HBufC* dirName = GetDirNameAndBackslashLC( KFileToolPluginDirBase ); + iFs.MkDirAll( *dirName ); + CleanupStack::PopAndDestroy( dirName ); + + dirName = GetDirNameAndBackslashLC( KFileToolSrvDirBase ); + iFs.MkDirAll( *dirName ); + CleanupStack::PopAndDestroy( dirName ); + } + +// --------------------------------------------------------------------------- +// Write the file to correct directory. +// --------------------------------------------------------------------------- +// +EXPORT_C void CXIMPTestFileTool::PluginStoreL( const TDesC8& aExternalizedObject ) + { + HBufC* fileName = GetFileNameLC( + KFileToolPluginDirBase, + iObjIndex ); + + RFileWriteStream out; + CleanupClosePushL( out ); + out.Create( iFs, *fileName, EFileWrite|EFileStream|EFileShareAny ); + + // write the file + TUint32 len = aExternalizedObject.Length(); + out.WriteUint32L( len ); + out.WriteL( aExternalizedObject ); + CleanupStack::PopAndDestroy(); // out + + CleanupStack::PopAndDestroy( fileName ); // fileName + + // next file will have a new index + iObjIndex++; + } + +// --------------------------------------------------------------------------- +// Restore the file from given directory and given index +// --------------------------------------------------------------------------- +// +EXPORT_C CXIMPApiEventBase* CXIMPTestFileTool::PluginRestoreLC( + TInt aObjIndex ) + { + HBufC* fileName = GetFileNameLC( + KFileToolPluginDirBase, + aObjIndex ); + + // try to instantiate it + RFileReadStream in; + CleanupClosePushL( in ); + + in.Open( iFs, *fileName, EFileStream ); + TInt len = in.ReadUint32L(); + HBufC8* buffer = HBufC8::NewLC( len ); + TPtr8 ptr = buffer->Des(); + in.ReadL( ptr ); + + // instantiate the object + TInt32 dummy = 0; + CXIMPApiEventBase* object = XIMPEventCodec::UnPackL( *buffer, dummy ); + + CleanupStack::PopAndDestroy( 2 ); // buffer, in + + // delete the just read object + iFs.Delete( *fileName ); + + CleanupStack::PopAndDestroy( fileName ); + + CleanupStack::PushL( object ); + return object; + } + +// --------------------------------------------------------------------------- +// Write the server message object to correct directory. +// --------------------------------------------------------------------------- +// +EXPORT_C void CXIMPTestFileTool::SrvMsgStoreL( + CXIMPTestFileSrvMsg* aSrvMsg ) + { + TInt nextObjIndex = NumSrvMsgL(); + HBufC* fileName = GetFileNameLC( + KFileToolSrvDirBase, + nextObjIndex); + + RFileWriteStream out; + CleanupClosePushL( out ); + TInt retVal = out.Create( iFs, *fileName, EFileWrite|EFileStream|EFileShareAny ); + User::LeaveIfError( retVal ); + + aSrvMsg->ExternalizeL( out ); + + CleanupStack::PopAndDestroy( 2, fileName ); // out, fileName + + // next file will have a new index + //iSrvObjIndex++; + } + +// --------------------------------------------------------------------------- +// Restore the file from given directory and given index +// --------------------------------------------------------------------------- +// +EXPORT_C CXIMPTestFileSrvMsg* CXIMPTestFileTool::SrvMsgRestoreLC( + TInt aObjIndex ) + { + CXIMPTestFileSrvMsg* msg = CXIMPTestFileSrvMsg::NewLC(); + + HBufC* fileName = GetFileNameLC( + KFileToolSrvDirBase, + aObjIndex ); + + // try to instantiate it + RFileReadStream in; + CleanupClosePushL( in ); + + in.Open( iFs, *fileName, EFileStream ); + + msg->InternalizeL( in ); + + CleanupStack::PopAndDestroy(); // in + + // delete the just read object + iFs.Delete( *fileName ); + + CleanupStack::PopAndDestroy( fileName ); // fileName + return msg; + } + +// --------------------------------------------------------------------------- +// Common file counting helper +// --------------------------------------------------------------------------- +// +TInt CXIMPTestFileTool::DoNumObjectsL( const TDesC& aTemplate ) + { + CDir* dir = GetDirListL( aTemplate ); + TInt count = dir->Count(); + delete dir; + return count; + } + +// --------------------------------------------------------------------------- +// Number of objects (files) in a given directory +// --------------------------------------------------------------------------- +// +EXPORT_C TInt CXIMPTestFileTool::NumObjectsL() + { + return DoNumObjectsL( KFileToolPluginDirBase ); + } + +// --------------------------------------------------------------------------- +// Number of server-originated objects (files) in a given directory +// --------------------------------------------------------------------------- +// +EXPORT_C TInt CXIMPTestFileTool::NumSrvMsgL() + { + // returns the number of objects in the directory + // get file listing and derive the count from that + return DoNumObjectsL( KFileToolSrvDirBase ); + } + +// --------------------------------------------------------------------------- +// Instace id +// --------------------------------------------------------------------------- +// +EXPORT_C const TDesC16& CXIMPTestFileTool::InstanceId() const + { + return *iInstance; + } + +// --------------------------------------------------------------------------- +// Length of number in characters (e.g. 501 --> 3) +// --------------------------------------------------------------------------- +// +TInt CXIMPTestFileTool::NumLenInChars( TInt aNum ) + { + TInt len = 0; + TInt tmp = aNum; + do + { + tmp /= 10; // number is base-10 + len++; + } + while ( tmp > 0 ); + return len; + } + +// --------------------------------------------------------------------------- +// Gets properly expanded directory name with backslash appended +// --------------------------------------------------------------------------- +// +HBufC* CXIMPTestFileTool::GetDirNameAndBackslashLC( + const TDesC& aTemplate ) + { + TInt uidLength = NumLenInChars( iUid ); + TInt instanceLength = iInstance->Length(); + + HBufC* dirName = HBufC::NewLC( + KFileToolMainDirFull().Length() + + KFileToolBackslash().Length() + + KFileToolDirUid().Length() + -2 // "%d" gets modified to be the number + + KFileToolBackslash().Length() + + uidLength + instanceLength + + KFileToolBackslash().Length() + + aTemplate.Length() + + KFileToolBackslash().Length() // added for later use by GetDirNameAndBackslashLC. + ); + + dirName->Des().Append( KFileToolMainDirFull ); + dirName->Des().Append( KFileToolBackslash ); + dirName->Des().AppendFormat( KFileToolDirUid, iUid ); + dirName->Des().Append( KFileToolBackslash ); + dirName->Des().Append( *iInstance ); + dirName->Des().Append( KFileToolBackslash ); + dirName->Des().Append( aTemplate ); + + dirName->Des().Append( KFileToolBackslash ); + iFs.MkDirAll( *dirName ); + return dirName; + } + +// --------------------------------------------------------------------------- +// Get full path wildcard for files residing in a directory +// with given index +// --------------------------------------------------------------------------- +// +HBufC* CXIMPTestFileTool::GetWildcardLC( + const TDesC& aDirTemplate ) + { + HBufC* dirName = GetDirNameAndBackslashLC( aDirTemplate ); + HBufC* wildcard = HBufC::NewLC( + dirName->Length() + KFileToolWildcard().Length() ); + wildcard->Des().Append( *dirName ); + wildcard->Des().Append( KFileToolWildcard ); + + CleanupStack::Pop( 2 ); // wildcard, dirName + delete dirName; + + CleanupStack::PushL( wildcard ); + return wildcard; + } + +// --------------------------------------------------------------------------- +// Get a list of files in a given directory +// --------------------------------------------------------------------------- +// +CDir* CXIMPTestFileTool::GetDirListL( const TDesC& aTemplate ) + { + HBufC* wildcard = GetWildcardLC( aTemplate ); + + CDir* dirList = NULL; + iFs.GetDir( *wildcard, KEntryAttNormal, ESortByName, dirList ); + CleanupStack::PopAndDestroy( wildcard ); + + return dirList; + } + +// --------------------------------------------------------------------------- +// Get fully qualified file name +// --------------------------------------------------------------------------- +// +HBufC* CXIMPTestFileTool::GetFileNameLC( + const TDesC& aDirTemplate, + TInt aObjIndex ) + { + // create file name + HBufC* dirName = GetDirNameAndBackslashLC( aDirTemplate ); + + TInt numLen = NumLenInChars( aObjIndex ); + HBufC* fileName = HBufC::NewLC( + dirName->Length() + + KFileToolFileBase().Length() + + numLen + - 2 // "%d" gets modified to be the number + ); + fileName->Des().Append( *dirName ); + fileName->Des().AppendFormat( KFileToolFileBase, aObjIndex ); + + CleanupStack::Pop( fileName ); + CleanupStack::PopAndDestroy( dirName ); + CleanupStack::PushL( fileName ); + + // now we have the filename + return fileName; + } + +const TInt KSecond = 1000000; + +// --------------------------------------------------------------------------- +// CXIMPTestFileTool::RegisterObserverL +// --------------------------------------------------------------------------- +// +void CXIMPTestFileTool::RegisterObserverL( MXIMPTestFileObserver* aObserver ) + { + iObservers.AppendL( aObserver ); + if( !iTimer->IsActive() ) + { + TCallBack callback( Process, this ); + iTimer->Start( KSecond, KSecond, callback ); + } + } + +// --------------------------------------------------------------------------- +// CXIMPTestFileTool::UnregisterObserver +// --------------------------------------------------------------------------- +// +void CXIMPTestFileTool::UnregisterObserver( MXIMPTestFileObserver* aObserver ) + { + TInt index = iObservers.Find( aObserver ); + if( index != KErrNotFound ) + { + iObservers.Remove( index ); + } + if( iObservers.Count() == 0 ) + { + iTimer->Cancel(); + } + } + + +// --------------------------------------------------------------------------- +// CXIMPTestFileTool::RunL +// --------------------------------------------------------------------------- +// +TInt CXIMPTestFileTool::Process( TAny* aMyself ) + { + TRAPD( ignore, ( static_cast< CXIMPTestFileTool* >( aMyself ) )->DoProcessL() ); + return 0; // ignored by CPeriodic + } + +// --------------------------------------------------------------------------- +// CXIMPTestFileTool::RunL +// --------------------------------------------------------------------------- +// +void CXIMPTestFileTool::DoProcessL() + { + TInt countOfSrvMsg = NumSrvMsgL(); + TInt countOfObservers = iObservers.Count(); + + for( TInt a = 0; a < countOfSrvMsg; ++a ) + { + CXIMPTestFileSrvMsg* newMsg = SrvMsgRestoreLC( a ); + for( TInt b = 0;b < countOfObservers; ++b ) + { + iObservers[ b ]->HandleL( newMsg->SrvMsgId(), newMsg->PayloadL() ); + } + CleanupStack::PopAndDestroy( newMsg ); + } + } + + +// End of file diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwtestfiletool.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwtestfiletool.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,199 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Test support file tool + * +*/ + + +#ifndef CPRFWTESTFILETOOL_H +#define CPRFWTESTFILETOOL_H + +#include +#include + +class CXIMPApiEventBase; +class CXIMPTestFileSrvMsg; +class MXIMPTestFileObserver; + +/** + * File support for tests. + * Support functions for externalizing a class to a known directory and + * retrieving the classes. + * + * This is a sort of "pseudo-IPC" from the test protocol (ecom plugin) + * to EUnit test code. A server could also be used, but this is faster + * to do and simpler. + * + * @since S60 v4.0 + */ +class CXIMPTestFileTool : public CBase + { + public: + + IMPORT_C static CXIMPTestFileTool* NewL( TUint32 aUid, const TDesC16& aInstanceId ); + IMPORT_C static CXIMPTestFileTool* NewL( TUint32 aUid, TInt aInstanceIdAsNum ); + virtual ~CXIMPTestFileTool(); + + private: + + CXIMPTestFileTool( TUint32 aUid ); + void ConstructL( const TDesC16& aInstanceId ); + void ConstructL( TInt aInstanceIdAsNum ); + + public: + + /** + * Clean all files from the filetool directory. + * Remove also the directory itself. + * Removes EVERYTHING from ALL DIRECTORIES used + * by filetool!!! So don't call it everytime, only once + * upon test case startup. + */ + IMPORT_C static void CleanAllL(); + + /** + * Prepares for writing only the directory used by this + * filetool instance + */ + IMPORT_C void PrepareL(); + + /** + * Store the object to file. + * The given descriptor is externalized as given, + * with the length of the descriptor written first, + * as a 32-bit TUint: + * + * @param aExternalizedObject The externalized object + */ + IMPORT_C void PluginStoreL( const TDesC8& aExternalizedObject ); + + /** + * Restore a stored object from file. + * Ownership is transferred! + * @param aObjIndex The index for the object + */ + IMPORT_C CXIMPApiEventBase* PluginRestoreLC( TInt aObjIndex ); + + /** + * Store the object to file. (SERVER MESSAGE) + * The given descriptor is externalized as given, + * with the length of the descriptor written first, + * as a 32-bit TUint: + * + * @param aExternalizedObject The externalized object + */ + IMPORT_C void SrvMsgStoreL( CXIMPTestFileSrvMsg* aSrvMsg ); + + /** + * Restore a stored object from file. (SERVER MESSAGE) + * Ownership is transferred! + * @param aIndex The index for the object + */ + IMPORT_C CXIMPTestFileSrvMsg* SrvMsgRestoreLC( TInt aIndex ); + + /** + * Return the number of objects currently stored in the directory. + */ + IMPORT_C TInt NumObjectsL(); + + /** + * Return the number of objects depicting server-originated + * message currently stored in the directory. + */ + IMPORT_C TInt NumSrvMsgL(); + + /** + * @return Instance id + */ + IMPORT_C const TDesC16& InstanceId() const; + + private: + + /** + * @return The directory name (with backslash) + * (E.g. "C:/temp/prfw/1234/0/SrvMsg/") + */ + HBufC* GetDirNameAndBackslashLC( + const TDesC& aTemplate ); + + /** + * @return Wildcard for file deletion + * (E.g. "C:/temp/prfw/1234/0/SrvMsg/file*.prfw") + * @param aDirTemplate The directory template for the wildcard + */ + HBufC* GetWildcardLC( + const TDesC& aDirTemplate ); + + /** + * Get the full file name, properly expanded. + * @param aDirTemplate The template for the dirs + * @param aObjIndex The object index + */ + HBufC* GetFileNameLC( + const TDesC& aDirTemplate, + TInt aObjIndex ); + + /** + * @return Length of the given number as if it were a string. + * @param aNum The number + */ + TInt NumLenInChars( TInt aNum ); + + /** + * @return Listing of the directory + * @param aTemplate The wildcard template for the files + */ + CDir* GetDirListL( const TDesC& aTemplate ); + + /** + * Common helper for NumObjects methods. + */ + TInt DoNumObjectsL( const TDesC& aTemplate ); + + /** + * + */ + static TInt Process( TAny* aMyself ); + void DoProcessL(); + + public: + + /** + * Observer registration + */ + void RegisterObserverL( MXIMPTestFileObserver* aObserver ); + void UnregisterObserver( MXIMPTestFileObserver* aObserver ); + + + private: // data + + TUint32 iUid; // protocoluid + HBufC16* iInstance; // the global instance id + + TInt iObjIndex; // object index for created objects + TInt iSrvObjIndex; // object index for created srvmsg objects + RFs iFs; + + + /** + * Monitor on when there is observers. + * Call HandleL for observers for every new file. + */ + RPointerArray< MXIMPTestFileObserver > iObservers; + + // timer + CPeriodic* iTimer; + }; + +#endif // CPRFWTESTFILETOOL_H diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwtestlistener.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwtestlistener.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,280 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "prfwtestlistener.h" +#include "prfwtestcaseutilspanics.h" +#include "prfwgeneralwaiter.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include "ximpapiobjbase.h" +#include "ximpapieventbase.h" + + +using namespace NXIMPTestCaseUtilsPanic; + +const TInt KWaitAfterEvents = 2; + +// ============================ MEMBER FUNCTIONS =============================== +EXPORT_C CXIMPTestListener* CXIMPTestListener::NewL( + MXIMPContext* aEventSource ) + { + CXIMPTestListener* self = new (ELeave) CXIMPTestListener( aEventSource ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + + +CXIMPTestListener::~CXIMPTestListener() + { + if( iEventSource ) + { + iEventSource->UnregisterObserver( *this ); + } + + iDescription.Close(); + + if ( iWait.IsStarted() ) + { + iWait.AsyncStop(); + } + } + + +CXIMPTestListener::CXIMPTestListener( MXIMPContext* aEventSource ) : + iEventSource( aEventSource ) + { + } + + +void CXIMPTestListener::ConstructL() + { + if( iEventSource ) + { + iEventSource->RegisterObserverL( *this, NULL ); + } + + iDescription.CreateL( 512 ); + } + + +// =========================================================================== +// PUBLIC FUNCTIONS +// =========================================================================== +// +EXPORT_C void CXIMPTestListener::SetEventSourceL( + MXIMPContext* aEventSource ) + { + if( iEventSource ) + { + iEventSource->UnregisterObserver( *this ); + } + + if( aEventSource ) + { + aEventSource->RegisterObserverL( *this, NULL ); + } + + iEventSource = aEventSource; + } + +// clear the stack +EXPORT_C void CXIMPTestListener::Reset() + { + iEventStack.ResetAndDestroy(); + } + +// expect the given event +EXPORT_C void CXIMPTestListener::ExpectL( CXIMPApiObjBase* aEvent ) + { + iEventStack.AppendL( aEvent ); + + iDescription.Zero(); + iDescription.AppendFormat( _L8("Eventstack has [%d] items."), iEventStack.Count() ); + EUNIT_PRINT( iDescription ); + } + +// wait for req complete and events (must come in the given order!) +EXPORT_C TInt CXIMPTestListener::WaitAndAssertL() + { + __ASSERT_ALWAYS( !iWait.IsStarted(), + Panic( EStatusEventListenerAlreadyWaiting ) ); + + iCoolDownActive = EFalse; + iError = KErrNone; + iReceivedEventCount = 0; + iWait.Start(); + + // start a timer to catch excess events, 2 seconds should + // be enough. such events are caught by DoHandleEventL and printed. + // if any events arrived, iError will be set. + + iCoolDownActive = ETrue; + CXIMPTestGeneralWaiter* waiter = CXIMPTestGeneralWaiter::NewL( this ); + CleanupStack::PushL( waiter ); + waiter->WaitForL( KWaitAfterEvents ); + iWait.Start(); + + // waiter callback will have ended the wait + CleanupStack::PopAndDestroy( waiter ); + + return iError; + } + +// the event observer where to pass the events +EXPORT_C void CXIMPTestListener::SetEventObserver( MXIMPContextObserver* aObserver ) + { + iObserver = aObserver; + } + +// =========================================================================== +// FROM MPRFWPRESENCECONTEXTOBSERVER +// =========================================================================== +// +void CXIMPTestListener::DoHandlePresenceContextEventL( + const MXIMPContext& aContext, + const MXIMPBase& aEvent ) + { + const TInt32 eventType = aEvent.GetInterfaceId(); + + __ASSERT_ALWAYS( iEventSource == &aContext, + Panic( EReceivingEventFromWrongContext ) ); + + if( iObserver ) + { + // give the event to the observer, if any, at the earliest possible + // phase + iObserver->HandlePresenceContextEvent( aContext, aEvent ); + + // XXX should this be done when cool-down is active? + } + + if ( iCoolDownActive ) + { + iDescription.Zero(); + iDescription.AppendFormat( _L8("Excess event with interface id [%d]"), aEvent.GetInterfaceId() ); + EUNIT_PRINT( iDescription ); + + iError = KErrGeneral; + + // just ignore it + return; + } + + iDescription.Zero(); + iDescription.AppendFormat( _L8("Expecting event to stack pos [%d]"), iReceivedEventCount ); + EUNIT_PRINT( iDescription ); + + // try to find the received event from the stack - the given stack must + // be in order + TBool found = EFalse; + TInt stackId = iEventStack[ 0 ]->Base().GetInterfaceId(); + found = stackId == aEvent.GetInterfaceId(); + + if ( ! found ) + { + // unexpected event + iDescription.Zero(); + iDescription.AppendFormat( _L8("Expected interface id [%d], got [%d]"), stackId, aEvent.GetInterfaceId() ); + EUNIT_PRINT( iDescription ); + + iDescription.Zero(); + iDescription.AppendFormat( _L8("Received unexpected event at pos [%d]"), iReceivedEventCount ); + EUNIT_PRINT( iDescription ); + + // get out + User::Leave( KErrGeneral ); + } + + // found the received event from the stack of expected events. + // remove the event from the stack of expected events, then handle it. + CXIMPApiEventBase* expected = ( CXIMPApiEventBase* ) iEventStack[ 0 ]; + CleanupStack::PushL( expected ); + iEventStack.Remove( 0 ); + + CXIMPApiEventBase* received = ( CXIMPApiEventBase* ) ( aEvent.GetInterface( XIMPIMP_CLSID_CXIMPAPIEVENTBASE, MXIMPBase::EPanicIfUnknown ) ); + + if ( ! expected->EqualsContent( *received ) ) + { + // expected event mismatches with the received event + iDescription.Zero(); + iDescription.AppendFormat( _L8("Received event with mismatching content at pos [%d]"), iReceivedEventCount ); + EUNIT_PRINT( iDescription ); + + // get out + User::Leave( KErrGeneral ); + } + + CleanupStack::PopAndDestroy( expected ); + + iDescription.Zero(); + iDescription.AppendFormat( _L8("Got correct event to stack pos [%d]"), iReceivedEventCount ); + EUNIT_PRINT( iDescription ); + + // we've processed a received event successfully + iReceivedEventCount++; + + if ( iEventStack.Count() <= 0 ) + { + // no more events to expect + if( iWait.IsStarted() ) + { + iWait.AsyncStop(); + } + } + } + + +void CXIMPTestListener::HandlePresenceContextEvent( + const MXIMPContext& aContext, + const MXIMPBase& aEvent ) + { + TRAPD( err, DoHandlePresenceContextEventL( aContext, aEvent ) ); + + if ( err != KErrNone ) + { + // something evil happened, stop async wait + + iError = err; + + if( iWait.IsStarted() ) + { + iWait.AsyncStop(); + } + } + } + +void CXIMPTestListener::WaitCompleted( TInt aRetVal ) + { + if( iWait.IsStarted() ) + { + iWait.AsyncStop(); + } + } + +// end of file + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwtestlistener.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwtestlistener.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,152 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +#ifndef CPRFWTESTLISTENER_H__ +#define CPRFWTESTLISTENER_H__ + + +#include +#include +#include + +#include "prfwwaitobserver.h" + +// CLASS DESCRIPTION +class CXIMPApiObjBase; + +/** + * Presence test listener to record events + * and to wait request completion. + */ +class CXIMPTestListener : public CBase, + public MXIMPContextObserver, + public T_MWaitObserver + { + public: + + /** + * Instantiates new listener object. + * + * If valid event source is given, reqisters this object as + * event observer to it. + */ + IMPORT_C static CXIMPTestListener* CXIMPTestListener::NewL( + MXIMPContext* aEventSource ); + + ~CXIMPTestListener(); + + private: + + CXIMPTestListener( MXIMPContext* aEventSource ); + + void ConstructL(); + + public: + + /** + * Sets new event source from where to listen events. + * Unregisters from previous one. + * Can be NULL, in which case just performs the + * unregistration. + */ + IMPORT_C void SetEventSourceL( MXIMPContext* aEventSource ); + + /** + * Clears the event trait template. After this call, + * you must call ExpectL to tell listener what events to expect. + */ + IMPORT_C void Reset(); + + /** + * Add the given event to the list of expected events. + * The order of ExpectL calls is significant. + * Ownership of given event is transferred to this class. + * @param aEvent The event to expect + */ + IMPORT_C void ExpectL( CXIMPApiObjBase* aEvent ); + + /** + * Method to wait with CActiveSchedulerWait + * a request complete, then any events which are expected. + * When all events are received, the method returns. If not all events + * come, the test case will timeout. If a wrong event or event with wrong + * data is received, the method will barf in EUNIT_ASSERT. + * + * @return Error code, if any + */ + IMPORT_C TInt WaitAndAssertL(); + + /** + * Forward the received events to the given event observer, if set. + * Set to NULL to disable forwarding. + * @param aObserver The observer + */ + IMPORT_C void SetEventObserver( MXIMPContextObserver* aObserver ); + + public: // from T_MWaitObserver + + void WaitCompleted( TInt aRetVal ); + + private: //From MXIMPContextObserver + + void HandlePresenceContextEvent( + const MXIMPContext& aContext, + const MXIMPBase& aEvent ); + + void DoHandlePresenceContextEventL( + const MXIMPContext& aContext, + const MXIMPBase& aEvent ); + + + private: //Helpers + + private: //Data + + //OWN: Active scheduler wait for waiting the completion + CActiveSchedulerWait iWait; + + //REF: Context from where receiving events + MXIMPContext* iEventSource; + + //OWN: Description buffer to hold the failure description + mutable RBuf8 iDescription; + + // To handle event by observer. + MXIMPContextObserver* iObserver; + + // OWN: the event stack (and the objects) + RXIMPObjOwningPtrArray< CXIMPApiObjBase > iEventStack; + + // current error state. WaitAndAssertL + // always clears the error + TInt iError; + + // number of received events + TInt iReceivedEventCount; + + // ETrue if we're doing a "cool-down" period, that is, + // we are waiting for any events which might come after + // we've successfully exhausted our stack of expected events. + // This is so that we can spot any excess events + // during testing. + TBool iCoolDownActive; + }; + +#endif //CPRFWTESTLISTENER_H__ + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwtestmessaging.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwtestmessaging.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,163 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +#ifndef T_PRFWTESTMESSAGING_H_ +#define T_PRFWTESTMESSAGING_H_ + +#include +#include + +// FIXME change this? +// base UID for pubsub keys +const TUid KXIMPTestPropertyCatBase = { 0x10012345 }; + +enum TXIMPTestPropertyValues + { + // values for EXIMPPlgTestDeath + EXIMPPrtValPluginDeathEmpty = 0, + EXIMPPrtValPluginDeathDied = 1, + + // values for EXIMPTestPlgSessionLostStrategy + EXIMPPrtValSessionLostEmpty = 0, + EXIMPPrtValSessionLostReconnect, + EXIMPPrtValSessionLostTeardown, + EXIMPPrtValSessionLostReconnectExhaustAttempts, + + // values for EXIMPTestPlgBehaveGeneric + EXIMPPrtValBehaveNothing = 0, // do nothing + }; + +// pubsub keys +enum TXIMPTestPropertyKeys + { + // meta things (message queue internal) + EXIMPTestMetaPubSubDefined, // pubsub stuff has been defined (1) + EXIMPTestMetaPluginIndex, // protocol plugin reads its index from this (-1=undefined) + + // p = plugin, h = host, t = test code. + // direction also encoded into the property name + + // Instructions for plugin behaviour (t->p). + // next call to plugin API method will cause the requested behavior (e.g. leave) + EXIMPTestPlgBehaveLeave, // leave with given code + EXIMPTestPlgBehaveError, // cause error with given code + + // boolean valued + EXIMPTestPlgBehaveCloseHandle, // abrupt close handle (1) + EXIMPTestPlgBehaveInvalidReqId, // complete next call with invalid req. id (1) + + // API method called -messages (p->t) + // value is boolean (set or unset, 1 or 0) + EXIMPPlgTestOpenSessionCalled, // OpenSessionL + EXIMPPlgTestShareSessionCalled, // ShareSessionL + EXIMPPlgTestUnshareSessionCalled, // ShareSessionL + EXIMPPlgTestCloseSessionCalled, // CloseSessionL + EXIMPPlgTestPublishPresenceCalled, // PublishPresenceL + EXIMPPlgTestUpdateInterestCalled, // UpdatePresenceInterestL + EXIMPPlgTestSubscribeOwnPresenceCalled, // DoSubscribeOwnPresenceL + EXIMPPlgTestUnsubscribeOwnPresenceCalled, // DoUnsubscribeOwnPresenceL + EXIMPPlgTestUpdateOwnSubscriptionCalled, // DoUpdateOwnPresenceSubscriptionL + EXIMPPlgTestSubscribeGroupListCalled, // DoSubscribePresentityGroupListL + EXIMPPlgTestUnsubscribeGroupListCalled, // DoUnsubscribePresentityGroupListL + EXIMPPlgTestCreatePresentityGroupCalled, // DoCreatePresentityGroupL + EXIMPPlgTestDeletePresentityGroupCalled, // DoDeletePresentityGroupL + EXIMPPlgTestUpdatePresentityGroupDisplayNameCalled, // DoUpdatePresentityGroupDisplayNameL + EXIMPPlgTestSubscribePresentityPresesenceCalled, // DoSubscribePresentityPresenceL + EXIMPPlgTestUpdatePresentityPresesenceCalled, // DoUpdatePresentityPresenceSubscriptionL + EXIMPPlgTestUnsubscribePresentityPresesenceCalled, // DoUnsubscribePresentityPresenceL + EXIMPPlgTestSubscribePresentityGroupMembersPresesenceCalled, // DoSubscribePresentityGroupMembersPresenceL + EXIMPPlgTestUpdatePresentityGroupMembersPresesenceCalled, // DoUpdatePresentityGroupMembersPresenceSubscriptionL + EXIMPPlgTestUnsubscribePresentityGroupMembersPresesenceCalled, // DoUnsubscribePresentityGroupMembersPresenceL + + EXIMPPlgTestSubscribePresentityGroupContentCalled, // DoSubscribePresentityGroupContentL + EXIMPPlgTestUnsubscribePresentityGroupContentCalled, // DoUnsubscribePresentityGroupContentL + EXIMPPlgTestAddPresentityGroupMemberCalled, // DoAddPresentityGroupMemberL + EXIMPPlgTestRemovePresentityGroupMemberCalled, // DoRemovePresentityGroupMemberL + EXIMPPlgTestUpdatePresentityGroupMemberDisplayNameCalled, // DoUpdatePresentityGroupMemberDisplayNameL + EXIMPPlgTestSubscribePresenceWatcherListCalled, // DoSubscribePresenceWatcherListL + EXIMPPlgTestUnsubscribePresenceWatcherListCalled, // DoUnsubscribePresenceWatcherListL + + EXIMPPlgTestSubscribePresenceGrantRequestListCalled, // DoSubscribePresenceGrantRequestListL + EXIMPPlgTestUnsubscribePresenceGrantRequestListCalled, // DoUnsubscribePresenceGrantRequestListL + + EXIMPPlgTestGrantPresenceForPresentityCalled, // EXIMPPlgTestGrantPresenceForPresentityCalled + EXIMPPlgTestGrantPresenceForPresentityGroupMembersCalled, // EXIMPPlgTestGrantPresenceForPresentityGroupMembersCalled + EXIMPPlgTestGrantPresenceForEveryoneCalled, // EXIMPPlgTestGrantPresenceForEveryoneCalled + EXIMPPlgTestUpdateGrantPresenceForPresentityCalled, // EXIMPPlgTestUpdateGrantPresenceForPresentityCalled + EXIMPPlgTestUpdateGrantPresenceForEveryoneCalled, // EXIMPPlgTestUpdateGrantPresenceForEveryoneCalled + EXIMPPlgTestUpdateGrantPresenceForPresentityGroupMembersCalled, // EXIMPPlgTestUpdateGrantPresenceForPresentityGroupMembersCalled + EXIMPPlgTestWithdrawPresenceFromPresentityCalled, // EXIMPPlgTestWithdrawPresenceFromPresentityCalled + EXIMPPlgTestWithdrawPresenceFromPresentityGroupMembersCalled, // EXIMPPlgTestWithdrawPresenceFromPresentityGroupMembersCalled + EXIMPPlgTestWithdrawPresenceFromEveryoneCalled, // EXIMPPlgTestWithdrawPresenceFromEveryoneCalled + EXIMPPlgTestSubscribePresenceBlockListCalled, // EXIMPPlgTestSubscribePresenceBlockListCalled + EXIMPPlgTestUnsubscribePresenceBlockListCalled, // EXIMPPlgTestUnubscribePresenceBlockListCalled + EXIMPPlgTestBlockPresenceForPresentityCalled, // EXIMPPlgTestBlockPresenceForPresentityCalled + EXIMPPlgTestCancelPresenceBlockFromPresentityCalled, // EXIMPPlgTestCancelPresenceBlockFromPresentityCalled + + EXIMPPlgTestSubscribePresentityGroupListCalled, // DoSubscribePresentityGroupListL + EXIMPPlgTestUnsubscribePresentityGroupListCalled, // DoUnsubscribePresentityGroupListL + EXIMPPlgTestHandlePresentityGroupListCalled, //EXIMPPlgTestHandlePresentityGroupListCalled + EXIMPPlgTestHandlePresentityPresenceCalled, + + + + // For signaling some situations checked by adaptation + EXIMPPlgTestExistsGroupContentInCache, // Check if group content exists in cache. + + // signal Plg destruction (p->t) + EXIMPPlgTestDeath, + + // simulate session lost with given strategy (t->p) + EXIMPTestPlgSessionLostStrategy, + }; + +// T-class for internal use +class TXIMPTestMsg + { +public: + TXIMPTestPropertyKeys iKey; // pubsub key + TInt iVal; // pubsub value + }; + + /** + * @param aIndex The index for the testing context + * @param aDescription Description for failed test. + * @param aModifier If EFalse, negate the test, thus checking for + * publish presence NOT being called. + * @param aDescription2 Description for negate failed test. + */ +#define COMMONASSERT( aMsg, aKey, aDescription, aModifier, aDescription2 ) \ + { \ + TBool value = aMsg->GetBoolean( aKey ); \ + if( aModifier ) \ + { \ + EUNIT_ASSERT_DESC( value, aDescription ); \ + } \ + else if( !aDescription2 ) \ + { \ + EUNIT_ASSERT_DESC( value, "Description 2 not set." ); \ + } \ + else \ + { \ + EUNIT_ASSERT_DESC( !value, aDescription2 ); \ + } \ + } + +#endif // T_PRFWTESTMESSAGING_H_ + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwtestmessenger.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwtestmessenger.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,584 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +#include "eunittools.h" +#include +#include +#include + +#include "prfwtestmessaging.h" +#include "prfwtestmessenger.h" + +// ============================ MEMBER FUNCTIONS =============================== + +// CONSTRUCTION +EXPORT_C CXIMPTestMessenger* CXIMPTestMessenger::NewForClientSideL( TInt aId ) + { + CXIMPTestMessenger* self = new (ELeave) CXIMPTestMessenger( aId ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); + self->DeletePubSubKeys(); + self->ResetPubSub(); + return self; + } + + +EXPORT_C CXIMPTestMessenger* CXIMPTestMessenger::NewForAdaptationSideL( TInt aId ) + { + CXIMPTestMessenger* self = new (ELeave) CXIMPTestMessenger( aId ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); + return self; + } + + + +void CXIMPTestMessenger::ConstructL() + { + iDescription.CreateL( 512 ); + } + +// reset the given pubsub keys +// and any helper variables + +_LIT_SECURITY_POLICY_PASS( KAllowReadToAll ); +_LIT_SECURITY_POLICY_PASS( KAllowWriteToAll ); + +EXPORT_C void CXIMPTestMessenger::ResetPubSub() + { + // check if we've already defined the keys. if we redefine and set + // defaults, the test logic breaks. + TInt pubSubDefined = GetValueFor( EXIMPTestMetaPubSubDefined ); + if ( pubSubDefined ) + { + // all done + return; + } + + TInt r = 0; + + // special behavioral keys + r = RProperty::Define( iMyUid, EXIMPTestMetaPubSubDefined, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll ); + + r = RProperty::Define( iMyUid, EXIMPPlgTestDeath, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll ); + r = RProperty::Define( iMyUid, EXIMPTestPlgSessionLostStrategy, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll ); + + // behavioral keys + r = RProperty::Define( iMyUid, EXIMPTestPlgBehaveLeave, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll ); + r = RProperty::Define( iMyUid, EXIMPTestPlgBehaveError, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll ); + r = RProperty::Define( iMyUid, EXIMPTestPlgBehaveCloseHandle, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll ); + r = RProperty::Define( iMyUid, EXIMPTestPlgBehaveInvalidReqId, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll ); + // TODO add more here + + // "method called" keys + r = RProperty::Define( iMyUid, EXIMPPlgTestOpenSessionCalled, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll ); + r = RProperty::Define( iMyUid, EXIMPPlgTestShareSessionCalled, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll ); + r = RProperty::Define( iMyUid, EXIMPPlgTestUnshareSessionCalled, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll ); + r = RProperty::Define( iMyUid, EXIMPPlgTestCloseSessionCalled, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll ); + r = RProperty::Define( iMyUid, EXIMPPlgTestPublishPresenceCalled, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll ); + r = RProperty::Define( iMyUid, EXIMPPlgTestUpdateInterestCalled, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll ); + r = RProperty::Define( iMyUid, EXIMPPlgTestSubscribeOwnPresenceCalled, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll ); + r = RProperty::Define( iMyUid, EXIMPPlgTestUnsubscribeOwnPresenceCalled, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll ); + r = RProperty::Define( iMyUid, EXIMPPlgTestUpdateOwnSubscriptionCalled, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll ); + r = RProperty::Define( iMyUid, EXIMPPlgTestSubscribeGroupListCalled, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll ); + r = RProperty::Define( iMyUid, EXIMPPlgTestUnsubscribeGroupListCalled, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll ); + r = RProperty::Define( iMyUid, EXIMPPlgTestCreatePresentityGroupCalled, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll ); + r = RProperty::Define( iMyUid, EXIMPPlgTestDeletePresentityGroupCalled, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll ); + r = RProperty::Define( iMyUid, EXIMPPlgTestUpdatePresentityGroupDisplayNameCalled, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll ); + r = RProperty::Define( iMyUid, EXIMPPlgTestSubscribePresentityPresesenceCalled, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll ); + r = RProperty::Define( iMyUid, EXIMPPlgTestUnsubscribePresentityPresesenceCalled, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll ); + r = RProperty::Define( iMyUid, EXIMPPlgTestUpdatePresentityPresesenceCalled, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll ); + r = RProperty::Define( iMyUid, EXIMPPlgTestSubscribePresentityGroupContentCalled, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll ); + r = RProperty::Define( iMyUid, EXIMPPlgTestUnsubscribePresentityGroupContentCalled, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll ); + r = RProperty::Define( iMyUid, EXIMPPlgTestAddPresentityGroupMemberCalled, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll ); + r = RProperty::Define( iMyUid, EXIMPPlgTestRemovePresentityGroupMemberCalled, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll ); + r = RProperty::Define( iMyUid, EXIMPPlgTestUpdatePresentityGroupMemberDisplayNameCalled, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll ); + r = RProperty::Define( iMyUid, EXIMPPlgTestSubscribePresenceWatcherListCalled, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll ); + r = RProperty::Define( iMyUid, EXIMPPlgTestUnsubscribePresenceWatcherListCalled, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll ); + r = RProperty::Define( iMyUid, EXIMPPlgTestSubscribePresentityGroupMembersPresesenceCalled, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll ); + r = RProperty::Define( iMyUid, EXIMPPlgTestUnsubscribePresentityGroupMembersPresesenceCalled, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll ); + r = RProperty::Define( iMyUid, EXIMPPlgTestUpdatePresentityGroupMembersPresesenceCalled, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll ); + r = RProperty::Define( iMyUid, EXIMPPlgTestSubscribePresenceGrantRequestListCalled, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll ); + r = RProperty::Define( iMyUid, EXIMPPlgTestUnsubscribePresenceGrantRequestListCalled, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll ); + + r = RProperty::Define( iMyUid, EXIMPPlgTestGrantPresenceForPresentityCalled, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll ); + r = RProperty::Define( iMyUid, EXIMPPlgTestGrantPresenceForPresentityGroupMembersCalled, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll ); + r = RProperty::Define( iMyUid, EXIMPPlgTestGrantPresenceForEveryoneCalled, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll ); + r = RProperty::Define( iMyUid, EXIMPPlgTestUpdateGrantPresenceForPresentityCalled, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll ); + r = RProperty::Define( iMyUid, EXIMPPlgTestUpdateGrantPresenceForPresentityGroupMembersCalled, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll ); + r = RProperty::Define( iMyUid, EXIMPPlgTestUpdateGrantPresenceForEveryoneCalled, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll ); + r = RProperty::Define( iMyUid, EXIMPPlgTestWithdrawPresenceFromPresentityCalled, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll ); + r = RProperty::Define( iMyUid, EXIMPPlgTestWithdrawPresenceFromPresentityGroupMembersCalled, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll ); + r = RProperty::Define( iMyUid, EXIMPPlgTestWithdrawPresenceFromEveryoneCalled, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll ); + + r = RProperty::Define( iMyUid, EXIMPPlgTestSubscribePresenceBlockListCalled, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll ); + r = RProperty::Define( iMyUid, EXIMPPlgTestUnsubscribePresenceBlockListCalled, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll ); + r = RProperty::Define( iMyUid, EXIMPPlgTestBlockPresenceForPresentityCalled, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll ); + r = RProperty::Define( iMyUid, EXIMPPlgTestCancelPresenceBlockFromPresentityCalled, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll ); + +//Pia + r = RProperty::Define( iMyUid, EXIMPPlgTestSubscribePresentityGroupListCalled, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll ); + r = RProperty::Define( iMyUid, EXIMPPlgTestUnsubscribePresentityGroupListCalled, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll ); + r = RProperty::Define( iMyUid, EXIMPPlgTestHandlePresentityGroupListCalled, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll ); + r = RProperty::Define( iMyUid, EXIMPPlgTestHandlePresentityPresenceCalled, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll ); + + r = RProperty::Define( iMyUid, EXIMPPlgTestExistsGroupContentInCache, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll ); + + // TODO add more here + + // reset keys which have special meaning to defaults which will cause + // no actions - a happy path scenario + SetValueFor( EXIMPPlgTestDeath, EXIMPPrtValPluginDeathEmpty ); + SetValueFor( EXIMPTestPlgSessionLostStrategy, EXIMPPrtValSessionLostEmpty ); + + // set other behavioral things to "happy path" by default + SetValueFor( EXIMPTestPlgBehaveLeave, KErrNone ); + SetValueFor( EXIMPTestPlgBehaveError, KErrNone ); + SetValueFor( EXIMPTestPlgBehaveCloseHandle, 0 ); + SetValueFor( EXIMPTestPlgBehaveInvalidReqId, 0 ); + + // reset method called messages + SetValueFor( EXIMPPlgTestOpenSessionCalled, 0 ); + SetValueFor( EXIMPPlgTestShareSessionCalled, 0 ); + SetValueFor( EXIMPPlgTestUnshareSessionCalled, 0 ); + SetValueFor( EXIMPPlgTestCloseSessionCalled, 0 ); + SetValueFor( EXIMPPlgTestPublishPresenceCalled, 0 ); + SetValueFor( EXIMPPlgTestUpdateInterestCalled, 0 ); + SetValueFor( EXIMPPlgTestSubscribeOwnPresenceCalled, 0 ); + SetValueFor( EXIMPPlgTestUnsubscribeOwnPresenceCalled, 0 ); + SetValueFor( EXIMPPlgTestUpdateOwnSubscriptionCalled, 0 ); + SetValueFor( EXIMPPlgTestSubscribeGroupListCalled, 0 ); + SetValueFor( EXIMPPlgTestUnsubscribeGroupListCalled, 0 ); + SetValueFor( EXIMPPlgTestCreatePresentityGroupCalled, 0 ); + SetValueFor( EXIMPPlgTestDeletePresentityGroupCalled, 0 ); + SetValueFor( EXIMPPlgTestUpdatePresentityGroupDisplayNameCalled, 0 ); + SetValueFor( EXIMPPlgTestSubscribePresentityPresesenceCalled, 0 ); + SetValueFor( EXIMPPlgTestUnsubscribePresentityPresesenceCalled, 0 ); + SetValueFor( EXIMPPlgTestUpdatePresentityPresesenceCalled, 0 ); + SetValueFor( EXIMPPlgTestSubscribePresentityGroupContentCalled, 0 ); + SetValueFor( EXIMPPlgTestUnsubscribePresentityGroupContentCalled, 0 ); + SetValueFor( EXIMPPlgTestAddPresentityGroupMemberCalled, 0 ); + SetValueFor( EXIMPPlgTestRemovePresentityGroupMemberCalled, 0 ); + SetValueFor( EXIMPPlgTestUpdatePresentityGroupMemberDisplayNameCalled, 0 ); + SetValueFor( EXIMPPlgTestSubscribePresenceWatcherListCalled, 0 ); + SetValueFor( EXIMPPlgTestUnsubscribePresenceWatcherListCalled, 0 ); + SetValueFor( EXIMPPlgTestSubscribePresentityGroupMembersPresesenceCalled, 0 ); + SetValueFor( EXIMPPlgTestUnsubscribePresentityGroupMembersPresesenceCalled, 0 ); + SetValueFor( EXIMPPlgTestUpdatePresentityGroupMembersPresesenceCalled, 0 ); + SetValueFor( EXIMPPlgTestSubscribePresenceGrantRequestListCalled, 0 ); + SetValueFor( EXIMPPlgTestUnsubscribePresenceGrantRequestListCalled, 0 ); + + SetValueFor( EXIMPPlgTestGrantPresenceForPresentityCalled, 0 ); + SetValueFor( EXIMPPlgTestGrantPresenceForPresentityGroupMembersCalled, 0 ); + SetValueFor( EXIMPPlgTestGrantPresenceForEveryoneCalled, 0 ); + SetValueFor( EXIMPPlgTestUpdateGrantPresenceForPresentityCalled, 0 ); + SetValueFor( EXIMPPlgTestUpdateGrantPresenceForPresentityGroupMembersCalled, 0 ); + SetValueFor( EXIMPPlgTestUpdateGrantPresenceForEveryoneCalled, 0 ); + SetValueFor( EXIMPPlgTestWithdrawPresenceFromPresentityCalled, 0 ); + SetValueFor( EXIMPPlgTestWithdrawPresenceFromPresentityGroupMembersCalled, 0 ); + SetValueFor( EXIMPPlgTestWithdrawPresenceFromEveryoneCalled, 0 ); + + SetValueFor( EXIMPPlgTestSubscribePresenceBlockListCalled, 0 ); + SetValueFor( EXIMPPlgTestUnsubscribePresenceBlockListCalled, 0 ); + SetValueFor( EXIMPPlgTestBlockPresenceForPresentityCalled, 0 ); + SetValueFor( EXIMPPlgTestCancelPresenceBlockFromPresentityCalled, 0 ); + //Pia + SetValueFor( EXIMPPlgTestSubscribePresentityGroupListCalled, 0 ); // DoSubscribePresentityGroupListL + SetValueFor( EXIMPPlgTestUnsubscribePresentityGroupListCalled, 0 ); // DoUnsubscribePresentityGroupListL + SetValueFor( EXIMPPlgTestHandlePresentityGroupListCalled, 0 ); //EXIMPPlgTestHandlePresentityGroupListCalled + SetValueFor( EXIMPPlgTestHandlePresentityPresenceCalled, 0 ); + + SetValueFor( EXIMPPlgTestExistsGroupContentInCache, 0 ); + + // TODO add any new keys also to DeletePubSubKeys!!! + + + // TODO add more here + + // TODO make the integer-valued keys and values into an array with + // default values, then loop over the array + + // pubsub things have been defined. keep this as last line! + SetValueFor( EXIMPTestMetaPubSubDefined, 1 ); + } + + +EXPORT_C void CXIMPTestMessenger::SetPluginIndex( TInt aIndex /* = KErrNotFound */ ) + { + // NOTE! Plugin index is ALWAYS set to base UID! + TInt val = 0; + TInt r = RProperty::Get( KXIMPTestPropertyCatBase,EXIMPTestMetaPluginIndex, val ); + if ( r == KErrNotFound ) + { + // value was not defined + TInt r = RProperty::Define( KXIMPTestPropertyCatBase, EXIMPTestMetaPluginIndex, RProperty::EInt ); + } + + r = RProperty::Set( KXIMPTestPropertyCatBase, EXIMPTestMetaPluginIndex, aIndex ); + + iMyUid = TUid::Uid( KXIMPTestPropertyCatBase.iUid + aIndex ); + } + + +EXPORT_C TInt CXIMPTestMessenger::GetPluginIndex() + { + TInt val = 0; + TInt r = RProperty::Get( KXIMPTestPropertyCatBase,EXIMPTestMetaPluginIndex, val ); + if ( r == KErrNotFound ) + { + val = KErrNotFound; + } + + return val; + } + + +CXIMPTestMessenger::~CXIMPTestMessenger() + { + DeletePubSubKeys(); + iDescription.Close(); + delete iReqCompleteParams; + } + + +CXIMPTestMessenger::CXIMPTestMessenger( TInt aId ) + { + iId = aId; + iMyUid = TUid::Uid( KXIMPTestPropertyCatBase.iUid + iId ); + } + + +// =========================================================================== +// PUBLIC FUNCTIONS +// =========================================================================== +// + +// +// Setters and getters for error code +// +EXPORT_C void CXIMPTestMessenger::SetNoError() + { + SetValueFor( EXIMPTestPlgBehaveError, KErrNone ); + } + +EXPORT_C void CXIMPTestMessenger::SetError( TInt aErrorCode ) + { + SetValueFor( EXIMPTestPlgBehaveError, aErrorCode ); + } + +EXPORT_C TInt CXIMPTestMessenger::GetError() + { + return GetValueFor( EXIMPTestPlgBehaveError ); + } + +// +// Setters and getters for boolean flags +// +EXPORT_C void CXIMPTestMessenger::SetBoolean( TXIMPTestPropertyKeys aKey ) + { + // aKey takes boolean value, e.g. "*BehaveInvalidReqId" + SetValueFor( aKey, 1 ); + } + +EXPORT_C TBool CXIMPTestMessenger::GetBoolean( TXIMPTestPropertyKeys aKey ) const + { + // aKey takes boolean value, e.g. "*BehaveInvalidReqId" + return GetValueFor( aKey ) == 1; + } + +// +// Setters, getters and utility methods for leave codes +// +EXPORT_C void CXIMPTestMessenger::SetLeave( TInt aLeaveCode ) + { + SetValueFor( EXIMPTestPlgBehaveLeave, aLeaveCode ); + } + +EXPORT_C TInt CXIMPTestMessenger::GetLeave() + { + return GetValueFor( EXIMPTestPlgBehaveLeave ); + } + +// call this method to automatically handle leaves +EXPORT_C void CXIMPTestMessenger::HandleLeaveL() + { + User::LeaveIfError( GetLeave() ); + } + + +// +// +// General messaging support for direct access, +// also used internally as setters and getters. +// +EXPORT_C void CXIMPTestMessenger::SetValueFor( TXIMPTestPropertyKeys aKey, TInt aValue ) + { + TXIMPTestMsg testMsg; + testMsg.iKey = aKey; + testMsg.iVal = aValue; + Send( testMsg ); + } + +EXPORT_C TInt CXIMPTestMessenger::GetValueFor( TXIMPTestPropertyKeys aKey ) const + { + TXIMPTestMsg testMsg; + testMsg.iKey = aKey; + Receive( testMsg ); + return testMsg.iVal; + } + +// +// Actual pubsub setters and getters +// +void CXIMPTestMessenger::Send( TXIMPTestMsg& aMsg ) + { + TInt r = RProperty::Set( iMyUid, aMsg.iKey, aMsg.iVal ); + // TODO handle error in r + } + +void CXIMPTestMessenger::Receive( TXIMPTestMsg& aMsg ) const + { + TInt val = 0; + TInt r = RProperty::Get( iMyUid, + aMsg.iKey, val ); + aMsg.iVal = val; + // TODO handle error in r, set val appropriately (0)? + } + +// ---------------------------------------------------------------- +// +// assert helpers +// +void CXIMPTestMessenger::CommonAssert( TXIMPTestPropertyKeys aKey, + TBool aCompareState, + const TDesC8& aTrueDesc, + const TDesC8& aFalseDesc ) const + { + iDescription.Zero(); + TBool value = GetBoolean( aKey ); + + if ( aCompareState ) + { + // the true case means success here + iDescription = aFalseDesc; + PRFW_ASSERT_DESC( value, iDescription.PtrZ() ); + } + else + { + // the false case means success here + iDescription = aTrueDesc; + PRFW_ASSERT_DESC( ! value, iDescription.PtrZ() ); + } + } + +// +// One Assert-method for each boolean-value (see prfwtestmessaging.h) +// +EXPORT_C void CXIMPTestMessenger::AssertPluginDied( TBool aState ) + { + // ETrue == Yes, plugin died. +/* CommonAssert( EXIMPPlgTestDeath, aState, + _L8( "Plugin was destroyed" ), + _L8( "Plugin was not destroyed" ) );*/ + } + +EXPORT_C void CXIMPTestMessenger::AssertOpenSessionCalled( TBool aState ) + { + CommonAssert( EXIMPPlgTestOpenSessionCalled, aState, + _L8( "OpenSession called" ), + _L8( "OpenSession not called" ) ); + } + +EXPORT_C void CXIMPTestMessenger::AssertShareSessionCalled( TBool aState ) + { + CommonAssert( EXIMPPlgTestShareSessionCalled, aState, + _L8( "ShareSession called" ), + _L8( "ShareSession not called" ) ); + } + +EXPORT_C void CXIMPTestMessenger::AssertCloseSessionCalled( TBool aState ) + { + CommonAssert( EXIMPPlgTestCloseSessionCalled, aState, + _L8( "CloseSession called" ), + _L8( "CloseSession not called" ) ); + } + +EXPORT_C void CXIMPTestMessenger::AssertUnshareSessionCalled( TBool aState ) + { + CommonAssert( EXIMPPlgTestUnshareSessionCalled, aState, + _L8( "UnshareSession called" ), + _L8( "UnshareSession not called" ) ); + } + +EXPORT_C void CXIMPTestMessenger::AssertSubscribePresentityGroupContentCalled( TBool aState ) + { + CommonAssert( EXIMPPlgTestSubscribePresentityGroupContentCalled, aState, + _L8( "DoSubscribePresentityGroupContentL called" ), + _L8( "DoSubscribePresentityGroupContentL not called" ) ); + } + +EXPORT_C void CXIMPTestMessenger::AssertSubscribePresentityGroupListCalled( TBool aState ) + { + CommonAssert( EXIMPPlgTestSubscribeGroupListCalled, aState, + _L8( "DoSubscribePresentityGroupListL called" ), + _L8( "DoSubscribePresentityGroupListL not called" ) ); + } + +EXPORT_C void CXIMPTestMessenger::AssertUnsubscribePresentityGroupContentCalled( TBool aState ) + { + CommonAssert( EXIMPPlgTestUnsubscribePresentityGroupContentCalled, aState, + _L8( "DoUnsubscribePresentityGroupContentL called" ), + _L8( "DoUnsubscribePresentityGroupContentL not called" ) ); + } + +EXPORT_C void CXIMPTestMessenger::AssertUnsubscribePresentityGroupListCalled( TBool aState ) + { + CommonAssert( EXIMPPlgTestUnsubscribeGroupListCalled, aState, + _L8( "DoUnsubscribePresentityGroupListL called" ), + _L8( "DoUnsubscribePresentityGroupListL not called" ) ); + } + +EXPORT_C void CXIMPTestMessenger::AssertAddPresentityGroupMemberCalled( TBool aState ) + { + CommonAssert( EXIMPPlgTestAddPresentityGroupMemberCalled, aState, + _L8( "DoAddPresentityGroupMemberL called" ), + _L8( "DoAddPresentityGroupMemberL not called" ) ); + } + +EXPORT_C void CXIMPTestMessenger::AssertRemovePresentityGroupMemberCalled( TBool aState ) + { + CommonAssert( EXIMPPlgTestRemovePresentityGroupMemberCalled, aState, + _L8( "DoRemovePresentityGroupMemberL called" ), + _L8( "DoRemovePresentityGroupMemberL not called" ) ); + } + +EXPORT_C void CXIMPTestMessenger::AssertUpdatePresentityGroupMemberDisplayNameCalled( TBool aState ) + { + CommonAssert( EXIMPPlgTestUpdatePresentityGroupMemberDisplayNameCalled, aState, + _L8( "DoUpdatePresentityGroupMemberDisplayNameL called" ), + _L8( "DoUpdatePresentityGroupMemberDisplayNameL not called" ) ); + } + +EXPORT_C void CXIMPTestMessenger::AssertUpdatePresentityGroupDisplayNameCalled( TBool aState ) + { + CommonAssert( EXIMPPlgTestUpdatePresentityGroupDisplayNameCalled, aState, + _L8( "DoUpdatePresentityGroupDisplayNameL called" ), + _L8( "DoUpdatePresentityGroupDisplayNameL not called" ) ); + } + +EXPORT_C void CXIMPTestMessenger::AssertCreatePresentityGroupCalled( TBool aState ) + { + CommonAssert( EXIMPPlgTestCreatePresentityGroupCalled, aState, + _L8( "DoCreatePresentityGroupL called" ), + _L8( "DoCreatePresentityGroupL not called" ) ); + } + +EXPORT_C void CXIMPTestMessenger::SetReqCompleteParams( MXIMPRestrictedObjectCollection* aParams ) + { + delete iReqCompleteParams; + iReqCompleteParams = aParams; + } +EXPORT_C MXIMPRestrictedObjectCollection* CXIMPTestMessenger::GetReqCompleteParams() + { + MXIMPRestrictedObjectCollection* retParam = iReqCompleteParams; + iReqCompleteParams = NULL; + return retParam; + } + +// TODO add more + +EXPORT_C void CXIMPTestMessenger::DeletePubSubKeys() + { + TInt r = RProperty::Delete( iMyUid, EXIMPPlgTestDeath ); + r = RProperty::Delete( iMyUid, EXIMPTestPlgSessionLostStrategy ); + + // behavioral keys + r = RProperty::Delete( iMyUid, EXIMPTestPlgBehaveLeave ); + r = RProperty::Delete( iMyUid, EXIMPTestPlgBehaveError ); + r = RProperty::Delete( iMyUid, EXIMPTestPlgBehaveCloseHandle ); + r = RProperty::Delete( iMyUid, EXIMPTestPlgBehaveInvalidReqId ); + // TODO add more here + + // "method called" keys + r = RProperty::Delete( iMyUid, EXIMPPlgTestOpenSessionCalled ); + r = RProperty::Delete( iMyUid, EXIMPPlgTestShareSessionCalled ); + r = RProperty::Delete( iMyUid, EXIMPPlgTestUnshareSessionCalled ); + r = RProperty::Delete( iMyUid, EXIMPPlgTestCloseSessionCalled ); + r = RProperty::Delete( iMyUid, EXIMPPlgTestPublishPresenceCalled ); + r = RProperty::Delete( iMyUid, EXIMPPlgTestUpdateInterestCalled ); + r = RProperty::Delete( iMyUid, EXIMPPlgTestSubscribeOwnPresenceCalled ); + r = RProperty::Delete( iMyUid, EXIMPPlgTestUnsubscribeOwnPresenceCalled ); + r = RProperty::Delete( iMyUid, EXIMPPlgTestUpdateOwnSubscriptionCalled ); + r = RProperty::Delete( iMyUid, EXIMPPlgTestSubscribeGroupListCalled ); + r = RProperty::Delete( iMyUid, EXIMPPlgTestUnsubscribeGroupListCalled ); + r = RProperty::Delete( iMyUid, EXIMPPlgTestCreatePresentityGroupCalled ); + r = RProperty::Delete( iMyUid, EXIMPPlgTestDeletePresentityGroupCalled ); + r = RProperty::Delete( iMyUid, EXIMPPlgTestUpdatePresentityGroupDisplayNameCalled ); + r = RProperty::Delete( iMyUid, EXIMPPlgTestSubscribePresentityPresesenceCalled ); + r = RProperty::Delete( iMyUid, EXIMPPlgTestUnsubscribePresentityPresesenceCalled ); + r = RProperty::Delete( iMyUid, EXIMPPlgTestUpdatePresentityPresesenceCalled ); + r = RProperty::Delete( iMyUid, EXIMPPlgTestSubscribePresentityGroupMembersPresesenceCalled ); + r = RProperty::Delete( iMyUid, EXIMPPlgTestUnsubscribePresentityGroupMembersPresesenceCalled ); + r = RProperty::Delete( iMyUid, EXIMPPlgTestUpdatePresentityGroupMembersPresesenceCalled ); + + r = RProperty::Delete( iMyUid, EXIMPPlgTestSubscribePresentityGroupContentCalled ); + r = RProperty::Delete( iMyUid, EXIMPPlgTestUnsubscribePresentityGroupContentCalled ); + r = RProperty::Delete( iMyUid, EXIMPPlgTestAddPresentityGroupMemberCalled ); + r = RProperty::Delete( iMyUid, EXIMPPlgTestRemovePresentityGroupMemberCalled ); + r = RProperty::Delete( iMyUid, EXIMPPlgTestUpdatePresentityGroupMemberDisplayNameCalled ); + + r = RProperty::Delete( iMyUid, EXIMPPlgTestSubscribePresenceWatcherListCalled ); + r = RProperty::Delete( iMyUid, EXIMPPlgTestUnsubscribePresenceWatcherListCalled ); + + r = RProperty::Delete( iMyUid, EXIMPPlgTestSubscribePresenceGrantRequestListCalled ); + r = RProperty::Delete( iMyUid, EXIMPPlgTestUnsubscribePresenceGrantRequestListCalled ); + + r = RProperty::Delete( iMyUid, EXIMPPlgTestGrantPresenceForPresentityCalled ); + r = RProperty::Delete( iMyUid, EXIMPPlgTestGrantPresenceForPresentityGroupMembersCalled ); + r = RProperty::Delete( iMyUid, EXIMPPlgTestGrantPresenceForEveryoneCalled ); + r = RProperty::Delete( iMyUid, EXIMPPlgTestUpdateGrantPresenceForPresentityCalled ); + r = RProperty::Delete( iMyUid, EXIMPPlgTestUpdateGrantPresenceForPresentityGroupMembersCalled ); + r = RProperty::Delete( iMyUid, EXIMPPlgTestUpdateGrantPresenceForEveryoneCalled ); + r = RProperty::Delete( iMyUid, EXIMPPlgTestWithdrawPresenceFromPresentityCalled ); + r = RProperty::Delete( iMyUid, EXIMPPlgTestWithdrawPresenceFromPresentityGroupMembersCalled ); + r = RProperty::Delete( iMyUid, EXIMPPlgTestWithdrawPresenceFromEveryoneCalled ); + + r = RProperty::Delete( iMyUid, EXIMPPlgTestSubscribePresenceBlockListCalled ); + r = RProperty::Delete( iMyUid, EXIMPPlgTestUnsubscribePresenceBlockListCalled ); + r = RProperty::Delete( iMyUid, EXIMPPlgTestBlockPresenceForPresentityCalled ); + r = RProperty::Delete( iMyUid, EXIMPPlgTestCancelPresenceBlockFromPresentityCalled ); + + + //Pia + r = RProperty::Delete( iMyUid, EXIMPPlgTestSubscribePresentityGroupListCalled ); // DoSubscribePresentityGroupListL + r = RProperty::Delete( iMyUid, EXIMPPlgTestUnsubscribePresentityGroupListCalled ); // DoUnsubscribePresentityGroupListL + r = RProperty::Delete( iMyUid, EXIMPPlgTestHandlePresentityGroupListCalled); //EXIMPPlgTestHandle + r = RProperty::Delete( iMyUid, EXIMPPlgTestHandlePresentityPresenceCalled); // + + + r = RProperty::Delete( iMyUid, EXIMPTestMetaPubSubDefined ); + + r = RProperty::Delete( iMyUid, EXIMPPlgTestExistsGroupContentInCache ); + } + + +// end of file + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwtestmessenger.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwtestmessenger.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,221 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +#ifndef CPRFWTESTMESSENGER_H +#define CPRFWTESTMESSENGER_H + +// INCLUDES +#include +#include +#include +#include "prfwtestmessaging.h" + +// CLASS DESCRIPTION + +class TXIMPTestMsg; +class MXIMPRestrictedObjectCollection; + +/** + * Asynchronous protocol for PRFW testing. + * Implementation class and helper routines. + * Done using Publish and Subscribe, although it's used as a collection of + * "flags". + * + * RMsgQueue is not good, because we do not know the length of the array in + * advance: there is often 1 in the array, but there could be 2 or 3 or more. + * Each time someone writes, the array should be read. This becomes a bit + * problematic, an easier and more robust way is to use pubsub. + * + * The descriptions of API methods rely on the protocol implementation, thus + * the descriptions are meant to document what kind of effects the clients and + * users of this class expect this class to cause. + */ +class CXIMPTestMessenger : public CBase + { + public: + + /** + * @param aMsgQName The name for the queue + */ + IMPORT_C static CXIMPTestMessenger* NewForClientSideL( TInt aId ); + IMPORT_C static CXIMPTestMessenger* NewForAdaptationSideL( TInt aId ); + ~CXIMPTestMessenger(); + + private: + + CXIMPTestMessenger( TInt aId ); + + void ConstructL(); + + public: + + /** + * Define and reset pubsub keys. + */ + IMPORT_C void ResetPubSub(); + + /** + * Delete all pubsub keys. + */ + IMPORT_C void DeletePubSubKeys(); + + /** + * Set index for plugin. Call before Bind-operation. + * Default of KErrNotFound (-1) will set the key to + * unused. + */ + IMPORT_C void SetPluginIndex( TInt aIndex = KErrNotFound ); + + /** + * Get index for plugin. + * @return Plugin index, or KErrNotFound if not found. + */ + IMPORT_C static TInt GetPluginIndex(); + + /** + * Clears the error behavior. + */ + IMPORT_C void SetNoError(); + + /** + * Setup for general error. Next operation will fail with this error + * code. + * @param aErrorCode The error code e.g. KErrNotFound + */ + IMPORT_C void SetError( TInt aErrorCode ); + + /** + * @return The currently set error code. + */ + IMPORT_C TInt GetError(); + + /** + * Setup a specialized error which has a boolean value. + * Next operation will do the given specialized error, e.g. complete request + * with invalid request id (EXIMPTestPlgBehaveInvalidReqId) + * @param aKey The type defining the error, e.g. EXIMPTestPlgBehaveInvalidReqId + */ + IMPORT_C void SetBoolean( TXIMPTestPropertyKeys aKey ); + + /** + * @param aKey The type defining the error, e.g. EXIMPTestPlgBehaveInvalidReqId + * @return The value of the boolean-valued specialized error + */ + IMPORT_C TBool GetBoolean( TXIMPTestPropertyKeys aKey ) const; + + /** + * Setup for leave. Next operation will leave with given leave code. + * @param aLeaveCode Code with which to leave + */ + IMPORT_C void SetLeave( TInt aLeaveCode ); + + /** + * @return The currently set leave code + */ + IMPORT_C TInt GetLeave(); + + /** + * Leaves if leave has been requested. Uses value obtained from pubsub. + */ + IMPORT_C void HandleLeaveL(); + + /** + * General messaging support for direct access. + * @param aKey The key to set + * @param aValue The value to set to given key + */ + IMPORT_C void SetValueFor( TXIMPTestPropertyKeys aKey, TInt aValue ); + + /** + * General messaging support for direct access. + * @param aKey The key to set + * @return The value in the given key + */ + IMPORT_C TInt GetValueFor( TXIMPTestPropertyKeys aKey ) const; + + /** + * Assert-methods. + * @param aState ETrue, if successful case is expected. + * + * E.g. in the case of AssertPluginDied, + * ETrue means: + * "I expect the plugin to have died, check that it did" + * and EFalse means: + * "I expect the plugin to NOT have died, check that it didn't". + */ + IMPORT_C void AssertPluginDied( TBool aState ); + IMPORT_C void AssertOpenSessionCalled( TBool aState ); + IMPORT_C void AssertCloseSessionCalled( TBool aState ); + IMPORT_C void AssertShareSessionCalled( TBool aState ); + IMPORT_C void AssertUnshareSessionCalled( TBool aState ); + IMPORT_C void AssertSubscribePresentityGroupContentCalled( TBool aState ); + IMPORT_C void AssertSubscribePresentityGroupListCalled( TBool aState ); + IMPORT_C void AssertUnsubscribePresentityGroupContentCalled( TBool aState ); + IMPORT_C void AssertUnsubscribePresentityGroupListCalled( TBool aState ); + IMPORT_C void AssertAddPresentityGroupMemberCalled( TBool aState ); + IMPORT_C void AssertCreatePresentityGroupCalled( TBool aState ); + IMPORT_C void AssertRemovePresentityGroupMemberCalled( TBool aState ); + IMPORT_C void AssertUpdatePresentityGroupMemberDisplayNameCalled( TBool aState ); + IMPORT_C void AssertUpdatePresentityGroupDisplayNameCalled( TBool aState ); + + IMPORT_C void SetReqCompleteParams( MXIMPRestrictedObjectCollection* aParams ); + IMPORT_C MXIMPRestrictedObjectCollection* GetReqCompleteParams(); + + private: + + /** + * Send the given message. + * @param aMessage The message to send with the key and value fields set + */ + void Send( TXIMPTestMsg& aMsg ); + + /** + * Receive message. + * Returns the message with the value field set, using the same + * message parameter which was given as input. + * @param aMsg [inout] The message with the key field set + */ + void Receive( TXIMPTestMsg& aMsg ) const; + + /** + * Common internal assert method for all Assert* methods. + * @param aKey The key to assert + * @param aCompareState The expected state (ETrue for success) + * @param aTrueDesc Description for success case failing + * @param aFalseDesc Description for failure case failing + */ + IMPORT_C void CommonAssert( TXIMPTestPropertyKeys aKey, + TBool aCompareState, + const TDesC8& aTrueDesc, + const TDesC8& aFalseDesc ) const; + private: + + // id number for this message queue + TInt iId; + TUid iMyUid; + + //OWN: Description buffer to hold the failure description + mutable RBuf8 iDescription; + + // Params for next reqcomplete + MXIMPRestrictedObjectCollection* iReqCompleteParams; + }; + +#endif // CPRFWTESTMESSENGER_H + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwtestpresencedatautils.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwtestpresencedatautils.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,129 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "prfwtestpresencedatautils.h" +#include "prfwtestcaseutilspanics.h" +#include + +#include "ximprbufhelpers.h" + +// ============================ MEMBER FUNCTIONS =============================== + + +// Generation +// ----------------------------------------------------------------------------- +// XIMPTestPresenceDataUtils::GenerateIdentityLC() +// ----------------------------------------------------------------------------- +// +EXPORT_C CXIMPIdentityImp* + XIMPTestPresenceDataUtils::GenerateIdentityLC( + const TDesC8* aPrefix, + TPresenceDataGroup aGroup ) + { + // According to Group: + // Generate uri + _LIT16( KUri, "http://google.com" ); + + // Generate protocolAddr + _LIT16( KProtocolAddress, "protocollll" ); + + CXIMPIdentityImp* pres = CXIMPIdentityImp::NewLC( KUri ); + return pres; + } + + + +// ----------------------------------------------------------------------------- +// XIMPTestPresenceDataUtils::GenerateInfoLC() +// ----------------------------------------------------------------------------- +// +EXPORT_C CPresenceInfoImp* + XIMPTestPresenceDataUtils::GenerateInfoLC( + const TDesC8* aPrefix, + TPresenceDataGroup aGroup ) + { + CPresenceInfoImp* doc = CPresenceInfoImp::NewLC(); + return doc; + } + +// ----------------------------------------------------------------------------- +// XIMPTestPresenceDataUtils::GenerateInfoFilterLC() +// ----------------------------------------------------------------------------- +// +EXPORT_C CPresenceInfoFilterImp* + XIMPTestPresenceDataUtils::GenerateInfoFilterLC( const TDesC8* aPrefix, + TPresenceDataGroup aGroup ) + { + CPresenceInfoFilterImp* pif = CPresenceInfoFilterImp::NewLC(); + return pif; + } + + + + +// ----------------------------------------------------------------------------- +// XIMPTestPresenceDataUtils::InsertPrefixL +// ----------------------------------------------------------------------------- +// +EXPORT_C void XIMPTestPresenceDataUtils::InsertPrefixL( const TDesC8* aPrefix, RBuf8& buf ) + { + if ( aPrefix ) + { + XIMPRBuf8Helper::GrowIfNeededL( buf, aPrefix->Length() + buf.Length() ); + buf.Insert( 0, *aPrefix ); + } + } + +// ----------------------------------------------------------------------------- +// XIMPTestPresenceDataUtils::Contains() +// ----------------------------------------------------------------------------- +// +EXPORT_C TBool XIMPTestPresenceDataUtils::Contains( MPresenceInfo& a1, + MPresenceInfo& a2 ) const + { + return ETrue; + } + + + +// ----------------------------------------------------------------------------- +// XIMPTestPresenceDataUtils::Equals() +// ----------------------------------------------------------------------------- +// +EXPORT_C TBool XIMPTestPresenceDataUtils::Equals( CPresenceInfoImp& a1, + CPresenceInfoImp& a2 ) const + { + return ETrue; + } + + + +// ----------------------------------------------------------------------------- +// XIMPTestPresenceDataUtils::AssertEquality() +// ----------------------------------------------------------------------------- +// +EXPORT_C void XIMPTestPresenceDataUtils::AssertEquality( + MPresenceInfo& a1, + MPresenceInfo& a2 ) + { + } + + + + +// end of file + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwtestpresencedatautils.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwtestpresencedatautils.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,81 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef PRFWTESTPRESENCEDATAUTILS_H +#define PRFWTESTPRESENCEDATAUTILS_H + + +#include +#include "presenceinfoimp.h" +#include "presenceinfofilterimp.h" +#include "ximpidentityimp.h" + + +// CLASS DESCRIPTION +/** + * Helper class presence data comparison and generation. + */ +class XIMPTestPresenceDataUtils + { + +public: +/** + * Enumeration defining the supported + * test data groups. + * A, B and C have unique values. + * The combinations are unions of those. + */ +enum TPresenceDataGroup + { + Group_None, + Group_A, + Group_B, + Group_C, + Group_AB, + Group_AC, + Group_BC, + Group_ABC, + }; + +// TODO Add the defined names here (if needed for verification). + +public: //Generator functions + IMPORT_C static CXIMPIdentityImp* GenerateIdentityLC( const TDesC8* aPrefix, TPresenceDataGroup aGroup = Group_None ); + IMPORT_C static CPresenceInfoImp* GenerateInfoLC( const TDesC8* aPrefix, TPresenceDataGroup aGroup = Group_None ); + IMPORT_C static CPresenceInfoFilterImp* GenerateInfoFilterLC( const TDesC8* aPrefix, TPresenceDataGroup aGroup = Group_None ); + +public: //Comparator functions + + // Contains. All a1 info are in a2 + IMPORT_C TBool Contains( MPresenceInfo& a1, MPresenceInfo& a2 ) const; + + + // Equality comparison + IMPORT_C TBool Equals( CPresenceInfoImp& a1, CPresenceInfoImp& a2 ) const; + + // Equality assertion + // TODO these are containment currently. Used by t_dmattrobjs. Modify... + IMPORT_C static void AssertEquality( MPresenceInfo& a1, + MPresenceInfo& a2 ); + +//private: // Helpers + IMPORT_C static void InsertPrefixL( const TDesC8* aPrefix, RBuf8& buf ); + }; + +#endif //PRFWTESTPRESENCEDATAUTILS_H + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwtestrobustnesstools.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwtestrobustnesstools.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,93 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Tools to increase Presence Engine tests robustness. + * +*/ + +#ifndef PENGTSTROBUSTNESSTOOLS_H__ +#define PENGTSTROBUSTNESSTOOLS_H__ + + +// INCLUDES +#include +#include +#include "prfwtestprocessmaster.h" +#include "userafter.h" +#include "prfwtestfiletool.h" + +//MACROS + + +// CLASS DESCRIPTION + +/** + * PE test robustness handler. + */ +class PrfwTestRobustness + { + public: //Robustness handling + static inline void DoPreCleaning(); + + private: //Helpers + static inline void HandleKill( TInt aErr, + TInt aWaitTime, + const TDesC& aDescription ); + + private: //Prohibited constructor / destructor + PrfwTestRobustness() {} + ~PrfwTestRobustness() {} + }; + + + +// ----------------------------------------------------------------------------- +// PrfwTestRobustness public functions +// ----------------------------------------------------------------------------- +// +inline void PrfwTestRobustness::DoPreCleaning() + { + TInt err = PrfwTestProcessMaster::KillPscServers(); + HandleKill( err, 0, _L("PSC srv processes - Pre") ); + + err = PrfwTestProcessMaster::KillRootServer(); + HandleKill( err, 0, _L("ROOT srv processes - pre") ); + + TRAPD( ignore, CXIMPTestFileTool::CleanAllL() ); + } + + +// ----------------------------------------------------------------------------- +// PrfwTestRobustness functions +// ----------------------------------------------------------------------------- +// +inline void PrfwTestRobustness::HandleKill( TInt aErr, + TInt aWaitTime, + const TDesC& aDescription ) + { + if( aErr > 0 ) + { + if( aWaitTime > 0 ) + { + TRAPD( ignore, CUserAfter::AfterL( aWaitTime ) ); + } + + EUNIT_PRINT( _L("ProcessKill: %S, %d instance(s)"), &aDescription, aErr ); + } + } + + +#endif // PRWFWTESTROBUSTNESSTOOLS_H__ + +// End of File + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwteststatuseventlistener.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwteststatuseventlistener.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,1049 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "prfwteststatuseventlistener.h" +#include "prfwtestcaseutilspanics.h" +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +using namespace NXIMPTestCaseUtilsPanic; +EUNIT_DECLARE_PRINTABLE_AS_TINT( MXIMPContextState::TState ) + + + // ============================ MEMBER FUNCTIONS =============================== +EXPORT_C TXIMPTestStatusEventSnapshot::TXIMPTestStatusEventSnapshot() + { + iEventType = TXIMPTestStatusEventSnapshot::EStateValueNotPresent; + iCtxState = (MXIMPContextState::TState) TXIMPTestStatusEventSnapshot::EStateValueNotPresent; + iReqId = TXIMPRequestId(); + iResultCode = TXIMPTestStatusEventSnapshot::EStateValueNotPresent; + } + + +EXPORT_C TXIMPTestStatusEventSnapshot::TXIMPTestStatusEventSnapshot( + TInt aEventType, + TInt aCtxState, + TInt aResultCode ) + { + iEventType = aEventType; + iCtxState = (MXIMPContextState::TState) aCtxState; + iResultCode = aResultCode; + } + +EXPORT_C TBool TXIMPTestStatusEventSnapshot::Equals( + const TXIMPTestStatusEventSnapshot& aOther ) const + { + TBool equals = ETrue; + + if( iEventType != aOther.iEventType ) + { + equals = EFalse; + } + + if( iCtxState != aOther.iCtxState ) + { + equals = EFalse; + } + + if( iResultCode != aOther.iResultCode ) + { + equals = EFalse; + } + + return equals; + } + + + + + +// ============================ MEMBER FUNCTIONS =============================== +EXPORT_C CXIMPTestStatusEventListener* CXIMPTestStatusEventListener::NewL( + TInt aStackSize, + MXIMPContext* aEventSource ) + { + CXIMPTestStatusEventListener* self = + new (ELeave) CXIMPTestStatusEventListener( aStackSize, aEventSource ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + + +CXIMPTestStatusEventListener::~CXIMPTestStatusEventListener() + { + User::Free( iSnapshots ); + if( iEventSource ) + { + iEventSource->UnregisterObserver( *this ); + } + + iAcceptedEventTypes.Reset(); + iDescription.Close(); + } + + +CXIMPTestStatusEventListener::CXIMPTestStatusEventListener( + TInt aStackSize, + MXIMPContext* aEventSource ) +: iSnapshotMaxCount( aStackSize ), + iEventSource( aEventSource ) + { + } + + +void CXIMPTestStatusEventListener::ConstructL() + { + __ASSERT_ALWAYS( iSnapshotMaxCount > 0, + Panic( EStatusEventListenerBadMaxCount ) ); + + TInt allocSize = iSnapshotMaxCount * sizeof( TXIMPTestStatusEventSnapshot ); + iSnapshots = (TXIMPTestStatusEventSnapshot*) User::AllocL( allocSize ); + ResetEventStack(); + ResetEventTypeStack(); + + if( iEventSource ) + { + TArray< TInt32 > eventFilterArray = iAcceptedEventTypes.Array(); + iEventSource->RegisterObserverL( *this, &eventFilterArray ); + } + + iDescription.CreateL( 512 ); + } + + + + +// =========================================================================== +// PUBLIC FUNCTIONS +// =========================================================================== +// +EXPORT_C void CXIMPTestStatusEventListener::SetEventSourceL( + MXIMPContext* aEventSource ) + { + if( iEventSource ) + { + iEventSource->UnregisterObserver( *this ); + } + + if( aEventSource ) + { + TArray< TInt32 > eventFilterArray = iAcceptedEventTypes.Array(); + aEventSource->RegisterObserverL( *this, &eventFilterArray ); + } + + iEventSource = aEventSource; + } + + + +EXPORT_C void CXIMPTestStatusEventListener::ReRegisterEventFilterL() + { + if( iEventSource ) + { + TArray< TInt32 > eventFilterArray = iAcceptedEventTypes.Array(); + iEventSource->RegisterObserverL( *this, &eventFilterArray ); + } + } + + + +EXPORT_C RArray< TInt32 >& CXIMPTestStatusEventListener::AcceptedEventTypes() + { + return iAcceptedEventTypes; + } + + + +EXPORT_C void CXIMPTestStatusEventListener::GetEventTemplateL( + RArray< TXIMPTestStatusEventSnapshot >& aArray, + TXIMPTestStatusEventTemplate aTemplate ) + { + switch( aTemplate ) + { + // session handling + case EXIMPTestStatusEvents_BindingOk: + { + TXIMPTestStatusEventSnapshot event; + event.iEventType = MXIMPContextStateEvent::KInterfaceId; + event.iCtxState = MXIMPContextState::EBinding; + event.iResultCode = TXIMPTestStatusEventSnapshot::EStatusObjNotPresent; + aArray.AppendL( event ); + + event.iEventType = MXIMPContextStateEvent::KInterfaceId; + event.iCtxState = MXIMPContextState::EActive; + event.iResultCode = TXIMPTestStatusEventSnapshot::EStatusObjNotPresent; + aArray.AppendL( event ); + + event.iEventType = MXIMPRequestCompleteEvent::KInterfaceId; + event.iCtxState = (MXIMPContextState::TState) TXIMPTestStatusEventSnapshot::EStateValueNotPresent; + event.iResultCode = KErrNone; + aArray.AppendL( event ); + + break; + } + + case EXIMPTestStatusEvents_BindingFailKErrAbort: + { + TXIMPTestStatusEventSnapshot event; + event.iEventType = MXIMPContextStateEvent::KInterfaceId; + event.iCtxState = MXIMPContextState::EBinding; + event.iResultCode = TXIMPTestStatusEventSnapshot::EStatusObjNotPresent; + aArray.AppendL( event ); + + event.iEventType = MXIMPContextStateEvent::KInterfaceId; + event.iCtxState = MXIMPContextState::EInactive; + event.iResultCode = TXIMPTestStatusEventSnapshot::EStatusObjNotPresent; + aArray.AppendL( event ); + + event.iEventType = MXIMPRequestCompleteEvent::KInterfaceId; + event.iCtxState = (MXIMPContextState::TState) TXIMPTestStatusEventSnapshot::EStateValueNotPresent; + event.iResultCode = KErrAbort; + aArray.AppendL( event ); + break; + } + + case EXIMPTestStatusEvents_BindingFailInvalidReqId: + { + TXIMPTestStatusEventSnapshot event; + event.iEventType = MXIMPContextStateEvent::KInterfaceId; + event.iCtxState = MXIMPContextState::EBinding; + event.iResultCode = TXIMPTestStatusEventSnapshot::EStatusObjNotPresent; + aArray.AppendL( event ); + + event.iEventType = MXIMPRequestCompleteEvent::KInterfaceId; + event.iCtxState = (MXIMPContextState::TState) TXIMPTestStatusEventSnapshot::EStateValueNotPresent, + event.iResultCode = KErrServerTerminated; + aArray.AppendL( event ); + + event.iEventType = MXIMPContextStateEvent::KInterfaceId; + event.iCtxState = MXIMPContextState::EInactive; + event.iResultCode = KErrServerTerminated; + + aArray.AppendL( event ); + break; + } + + + case EXIMPTestStatusEvents_BindingFailServerTermination: + { + TXIMPTestStatusEventSnapshot event; + event.iEventType = MXIMPContextStateEvent::KInterfaceId; + event.iCtxState = MXIMPContextState::EUnbinding; + event.iResultCode = KErrServerTerminated; + aArray.AppendL( event ); + + event.iEventType = MXIMPContextStateEvent::KInterfaceId; + event.iCtxState = MXIMPContextState::EInactive; + event.iResultCode = KErrServerTerminated; + aArray.AppendL( event ); + + event.iEventType = MXIMPRequestCompleteEvent::KInterfaceId; + event.iCtxState = (MXIMPContextState::TState) TXIMPTestStatusEventSnapshot::EStateValueNotPresent; + event.iResultCode = KErrServerTerminated; + aArray.AppendL( event ); + + break; + } + + case EXIMPTestStatusEvents_UnbindingOk: + { + TXIMPTestStatusEventSnapshot event; + event.iEventType = MXIMPContextStateEvent::KInterfaceId; + event.iCtxState = MXIMPContextState::EUnbinding; + event.iResultCode = TXIMPTestStatusEventSnapshot::EStatusObjNotPresent; + aArray.AppendL( event ); + + event.iEventType = MXIMPContextStateEvent::KInterfaceId; + event.iCtxState = MXIMPContextState::EInactive; + event.iResultCode = TXIMPTestStatusEventSnapshot::EStatusObjNotPresent; + aArray.AppendL( event ); + + event.iEventType = MXIMPRequestCompleteEvent::KInterfaceId; + event.iCtxState = (MXIMPContextState::TState) TXIMPTestStatusEventSnapshot::EStateValueNotPresent; + event.iResultCode = KErrNone; + aArray.AppendL( event ); + break; + } + + + case EXIMPTestStatusEvents_RequestOk: + { + TXIMPTestStatusEventSnapshot event; + event.iEventType = MXIMPRequestCompleteEvent::KInterfaceId; + event.iCtxState = (MXIMPContextState::TState) TXIMPTestStatusEventSnapshot::EStateValueNotPresent; + event.iResultCode = KErrNone; + aArray.AppendL( event ); + break; + } + + + case EXIMPTestStatusEvents_RequestOOM: + { + TXIMPTestStatusEventSnapshot event; + event.iEventType = MXIMPRequestCompleteEvent::KInterfaceId; + event.iCtxState = (MXIMPContextState::TState) TXIMPTestStatusEventSnapshot::EStateValueNotPresent; + event.iResultCode = KErrNoMemory; + aArray.AppendL( event ); + break; + } + + + + // own presence + case EXIMPTestStatusEvents_SubscribeOwnPresenceSingleCtx: + { + TXIMPTestStatusEventSnapshot event; + event.iEventType = MOwnPresenceEvent::KInterfaceId; + event.iCtxState = (MXIMPContextState::TState) ( MXIMPDataSubscriptionState::EDataUnavailable + MXIMPDataSubscriptionState::ESubscriptionActive ); + event.iResultCode = TXIMPTestStatusEventSnapshot::EStateValueNotPresent; + aArray.AppendL( event ); + break; + } + + case EXIMPTestStatusEvents_UnsubscribeOwnPresenceSingleCtx: + { + TXIMPTestStatusEventSnapshot event; + event.iEventType = MOwnPresenceEvent::KInterfaceId; + event.iCtxState = (MXIMPContextState::TState) ( MXIMPDataSubscriptionState::EDataUnavailable + MXIMPDataSubscriptionState::ESubscriptionInactive ); + event.iResultCode = TXIMPTestStatusEventSnapshot::EStateValueNotPresent; + aArray.AppendL( event ); + break; + } + + // presentity presence + case EXIMPTestStatusEvents_SubscribePresentityPresenceSingleCtx: + { + TXIMPTestStatusEventSnapshot event; + event.iEventType = MPresentityPresenceEvent::KInterfaceId; + event.iCtxState = (MXIMPContextState::TState) ( MXIMPDataSubscriptionState::EDataUnavailable + MXIMPDataSubscriptionState::ESubscriptionActive ); + event.iResultCode = TXIMPTestStatusEventSnapshot::EStateValueNotPresent; + aArray.AppendL( event ); + break; + } + + case EXIMPTestStatusEvents_UnsubscribePresentityPresenceSingleCtx: + { + TXIMPTestStatusEventSnapshot event; + event.iEventType = MPresentityPresenceEvent::KInterfaceId; + event.iCtxState = (MXIMPContextState::TState) ( MXIMPDataSubscriptionState::EDataUnavailable + MXIMPDataSubscriptionState::ESubscriptionInactive ); + event.iResultCode = TXIMPTestStatusEventSnapshot::EStateValueNotPresent; + aArray.AppendL( event ); + break; + } + + // group lists + case EXIMPTestStatusEvents_SubscribePresentityGroupListCtx: + { + // TODO check this + TXIMPTestStatusEventSnapshot event; + event.iEventType = MPresentityGroupListEvent::KInterfaceId; + event.iCtxState = (MXIMPContextState::TState) TXIMPTestStatusEventSnapshot::EStateValueNotPresent; + event.iResultCode = KErrNone; + aArray.AppendL( event ); + + event.iEventType = MXIMPRequestCompleteEvent::KInterfaceId; + event.iCtxState = (MXIMPContextState::TState) TXIMPTestStatusEventSnapshot::EStateValueNotPresent; + event.iResultCode = KErrNone; + aArray.AppendL( event ); + break; + } + + case EXIMPTestStatusEvents_UnsubscribePresentityGroupListCtx: + { + TXIMPTestStatusEventSnapshot event; + event.iEventType = MPresentityGroupListEvent::KInterfaceId; + // TODO check this + event.iCtxState = (MXIMPContextState::TState) TXIMPTestStatusEventSnapshot::EStateValueNotPresent; + event.iResultCode = TXIMPTestStatusEventSnapshot::EStateValueNotPresent; + aArray.AppendL( event ); + break; + } + + case EXIMPTestStatusEvents_CreatePresentityGroup: + { + TXIMPTestStatusEventSnapshot event; + event.iEventType = MPresentityGroupListEvent::KInterfaceId; + // TODO check this + event.iCtxState = (MXIMPContextState::TState) TXIMPTestStatusEventSnapshot::EStateValueNotPresent; + event.iResultCode = TXIMPTestStatusEventSnapshot::EStateValueNotPresent; + aArray.AppendL( event ); + + event.iEventType = MXIMPRequestCompleteEvent::KInterfaceId; + event.iCtxState = (MXIMPContextState::TState) TXIMPTestStatusEventSnapshot::EStateValueNotPresent; + event.iResultCode = KErrNone; + aArray.AppendL( event ); + + break; + } + + case EXIMPTestStatusEvents_HandlePresentityGroupList: + { + TXIMPTestStatusEventSnapshot event; + event.iEventType = MPresentityGroupListEvent::KInterfaceId; + // TODO check this + event.iCtxState = (MXIMPContextState::TState) TXIMPTestStatusEventSnapshot::EStateValueNotPresent; + event.iResultCode = TXIMPTestStatusEventSnapshot::EStateValueNotPresent; + aArray.AppendL( event ); + break; + } + + // group content + case EXIMPTestStatusEvents_SubscribePresentityGroupContentSingleCtx: + { + // TODO check this + TXIMPTestStatusEventSnapshot event; + event.iEventType = MPresentityGroupContentEvent::KInterfaceId; + event.iCtxState = (MXIMPContextState::TState) TXIMPTestStatusEventSnapshot::EStateValueNotPresent; + event.iResultCode = KErrNone; + aArray.AppendL( event ); + + event.iEventType = MXIMPRequestCompleteEvent::KInterfaceId; + event.iCtxState = (MXIMPContextState::TState) TXIMPTestStatusEventSnapshot::EStateValueNotPresent; + event.iResultCode = KErrNone; + aArray.AppendL( event ); + break; + } + + case EXIMPTestStatusEvents_UnsubscribePresentityGroupContentSingleCtx: + { + TXIMPTestStatusEventSnapshot event; + event.iEventType = MPresentityGroupContentEvent::KInterfaceId; + event.iCtxState = (MXIMPContextState::TState) TXIMPTestStatusEventSnapshot::EStateValueNotPresent; + event.iResultCode = TXIMPTestStatusEventSnapshot::EStateValueNotPresent; + aArray.AppendL( event ); + + event.iEventType = MXIMPRequestCompleteEvent::KInterfaceId; + event.iCtxState = (MXIMPContextState::TState) TXIMPTestStatusEventSnapshot::EStateValueNotPresent; + event.iResultCode = KErrNone; + aArray.AppendL( event ); + break; + } + + // watcher list + case EXIMPTestStatusEvents_SubscribePresenceWatcherListCtx: + { + TXIMPTestStatusEventSnapshot event; + event.iEventType = MPresenceWatcherListEvent::KInterfaceId; + event.iCtxState = (MXIMPContextState::TState) TXIMPTestStatusEventSnapshot::EStateValueNotPresent; + event.iResultCode = KErrNone; + aArray.AppendL( event ); + + event.iEventType = MXIMPRequestCompleteEvent::KInterfaceId; + event.iCtxState = (MXIMPContextState::TState) TXIMPTestStatusEventSnapshot::EStateValueNotPresent; + event.iResultCode = KErrNone; + aArray.AppendL( event ); + break; + } + + case EXIMPTestStatusEvents_UnsubscribePresenceWatcherListCtx: + { + TXIMPTestStatusEventSnapshot event; + event.iEventType = MPresenceWatcherListEvent::KInterfaceId; + event.iCtxState = (MXIMPContextState::TState) TXIMPTestStatusEventSnapshot::EStateValueNotPresent; + event.iResultCode = TXIMPTestStatusEventSnapshot::EStateValueNotPresent; + aArray.AppendL( event ); + break; + } + + case EXIMPTestStatusEvents_HandlePresenceWatcherList: + { + TXIMPTestStatusEventSnapshot event; + event.iEventType = MPresenceWatcherListEvent::KInterfaceId; + event.iCtxState = (MXIMPContextState::TState) TXIMPTestStatusEventSnapshot::EStateValueNotPresent; + event.iResultCode = TXIMPTestStatusEventSnapshot::EStateValueNotPresent; + aArray.AppendL( event ); + break; + } + + case EXIMPTestStatusEvents_HandlePresentityPresence: + { + TXIMPTestStatusEventSnapshot event; + event.iEventType = MPresentityPresenceEvent::KInterfaceId; + event.iCtxState = (MXIMPContextState::TState) ( MXIMPDataSubscriptionState::EDataAvailable + MXIMPDataSubscriptionState::ESubscriptionActive ); + event.iResultCode = TXIMPTestStatusEventSnapshot::EStateValueNotPresent; + aArray.AppendL( event ); + break; + } + + + case EXIMPTestStatusEvents_HandlePresentityPresencePending: + { + TXIMPTestStatusEventSnapshot event; + event.iEventType = MPresentityPresenceEvent::KInterfaceId; + event.iCtxState = (MXIMPContextState::TState) ( MXIMPDataSubscriptionState::EDataUnavailable + MXIMPDataSubscriptionState::ESubscriptionActive ); + event.iResultCode = TXIMPTestStatusEventSnapshot::EStateValueNotPresent; + aArray.AppendL( event ); + break; + } + + case EXIMPTestStatusEvents_PresentitySubscribeFailKErrAbort: + { + TXIMPTestStatusEventSnapshot event; + event.iEventType = MXIMPRequestCompleteEvent::KInterfaceId; + event.iCtxState = (MXIMPContextState::TState) TXIMPTestStatusEventSnapshot::EStateValueNotPresent; + event.iResultCode = KErrAbort; + aArray.AppendL( event ); + break; + } + + // misc + case EXIMPTestStatusEvents_PublishOk: + { + TXIMPTestStatusEventSnapshot event; + + // request complete with KErrNone + event.iEventType = MXIMPRequestCompleteEvent::KInterfaceId; + event.iCtxState = (MXIMPContextState::TState) TXIMPTestStatusEventSnapshot::EStateValueNotPresent; + event.iResultCode = KErrNone; + aArray.AppendL( event ); + + // OwnPresenceEvent + event.iEventType = MOwnPresenceEvent::KInterfaceId; + event.iCtxState = (MXIMPContextState::TState) TXIMPTestStatusEventSnapshot::EStateValueNotPresent; + event.iResultCode = TXIMPTestStatusEventSnapshot::EStatusObjNotPresent; + aArray.AppendL( event ); + + break; + } + + case EXIMPTestStatusEvents_PublishFailKErrAbort: + { + TXIMPTestStatusEventSnapshot event; + + // Request completed with KErrAbort + event.iEventType = MXIMPRequestCompleteEvent::KInterfaceId; + event.iCtxState = (MXIMPContextState::TState) TXIMPTestStatusEventSnapshot::EStateValueNotPresent; + event.iResultCode = KErrAbort; + aArray.AppendL( event ); + + break; + } + + default: + { + Panic( EStatusEventListenerUnknownEventTemplate ); + } + } + } + + + +EXPORT_C void CXIMPTestStatusEventListener::WaitRequestAndStackEvents( + const TXIMPRequestId& aReqToWait, TBool aAnyReq /* = EFalse */ ) + { + __ASSERT_ALWAYS( !iWait.IsStarted(), + Panic( EStatusEventListenerAlreadyWaiting ) ); + + iWaitForAnyReq = aAnyReq; + iReqToWait = aReqToWait; + iWaitForAnyEvent = EFalse; + + iWait.Start(); + } + +EXPORT_C void CXIMPTestStatusEventListener::WaitAnyEvent() + { + iWaitForAnyEvent = ETrue; + iWait.Start(); + } + + +EXPORT_C void CXIMPTestStatusEventListener::VerifyEventStackL( + const TArray< TXIMPTestStatusEventSnapshot >& aEventTraits, + const TDesC8& aErrorTitle ) const + { + iDescription.Zero(); + TInt ix = 0; + + //Dumb event lists if there is some mismatches + if( !HasSameEvents( aEventTraits ) ) + { + iDescription = aErrorTitle; + iDescription += _L8("Mismatches in event stack"); + EUNIT_PRINT( iDescription ); + + iDescription = _L8("Received: "); + for( ix = 0; ix < iSnapshotCount; ix++ ) + { + GetNameForEvent( iDescription, SnapshotFromStack( ix ).iEventType ); + } + EUNIT_PRINT( iDescription ); + + + iDescription = _L8("Expected: "); + const TInt traitCount = aEventTraits.Count(); + for( ix = 0; ix < traitCount; ix++ ) + { + GetNameForEvent( iDescription, aEventTraits[ ix ].iEventType ); + } + EUNIT_PRINT( iDescription ); + } + + + //Now do the actual verification + iDescription = aErrorTitle; + iDescription += _L8("Event count mismatch"); + EUNIT_ASSERT_EQUALS_DESC( iSnapshotCount, aEventTraits.Count(), iDescription.PtrZ() ); + + + for( TInt ix = 0; ix < iSnapshotCount; ix++ ) + { + const TXIMPTestStatusEventSnapshot& expected = aEventTraits[ ix ]; + const TXIMPTestStatusEventSnapshot& received = SnapshotFromStack( ix ); + + { + iDescription = aErrorTitle; + iDescription.AppendFormat( _L8("Event type mismatch on event [%d]"), ix ); + EUNIT_ASSERT_EQUALS_DESC( expected.iEventType, expected.iEventType, iDescription.PtrZ() ); + } + + { + const TInt type = received.iEventType; + + iDescription = aErrorTitle; + iDescription += _L8("Content mismatch on "); + GetNameForEvent( iDescription, type ); + iDescription.AppendFormat( _L8("event on position [%d]"), ix ); + switch( type ) + { + case MXIMPRequestCompleteEvent::KInterfaceId: + { + EUNIT_ASSERT_EQUALS_DESC( expected.iResultCode, received.iResultCode, iDescription.PtrZ() ); + break; + } + + + case MXIMPContextStateEvent::KInterfaceId: + { + EUNIT_ASSERT_EQUALS_DESC( expected.iCtxState, received.iCtxState, iDescription.PtrZ() ); + EUNIT_ASSERT_EQUALS_DESC( expected.iResultCode, received.iResultCode, iDescription.PtrZ() ); + break; + } + + case MOwnPresenceEvent::KInterfaceId: + case MPresentityPresenceEvent::KInterfaceId: + { + EUNIT_ASSERT_EQUALS_DESC( expected.iCtxState, received.iCtxState, iDescription.PtrZ() ); + break; + } + + case MPresentityGroupListEvent::KInterfaceId: + { + EUNIT_ASSERT_EQUALS_DESC( expected.iCtxState, received.iCtxState, iDescription.PtrZ() ); + EUNIT_ASSERT_EQUALS_DESC( expected.iResultCode, received.iResultCode, iDescription.PtrZ() ); + break; + } + + case MPresentityGroupContentEvent::KInterfaceId: + { + EUNIT_ASSERT_EQUALS_DESC( expected.iCtxState, received.iCtxState, iDescription.PtrZ() ); + EUNIT_ASSERT_EQUALS_DESC( expected.iResultCode, received.iResultCode, iDescription.PtrZ() ); + break; + } + + case MPresenceWatcherListEvent::KInterfaceId: + { + EUNIT_ASSERT_EQUALS_DESC( expected.iCtxState, received.iCtxState, iDescription.PtrZ() ); + EUNIT_ASSERT_EQUALS_DESC( expected.iResultCode, received.iResultCode, iDescription.PtrZ() ); + break; + } + + + default: + { + Panic( EUnsupportedEventTypeInVerification ); + break; + } + } + } + } + } + + + + +EXPORT_C TInt CXIMPTestStatusEventListener::GetReqCompletionErrL( + const TXIMPRequestId& aReqId ) const + { + for( TInt ix = 0; ix < iSnapshotCount; ix++ ) + { + const TXIMPTestStatusEventSnapshot& received = SnapshotFromStack( ix ); + const TInt type = received.iEventType; + + if( type == MXIMPRequestCompleteEvent::KInterfaceId ) + { + if( received.iReqId == aReqId ) + { + return received.iResultCode; + } + } + } + + User::Leave( KErrNotFound ); + return KErrNotFound; + } + + +EXPORT_C void CXIMPTestStatusEventListener::ResetEventStack() + { + for( TInt ix = 0; ix < iSnapshotMaxCount; ix++ ) + { + new( &iSnapshots[ ix ] ) TXIMPTestStatusEventSnapshot(); + } + + iSnapshotCount = 0; + } + +EXPORT_C void CXIMPTestStatusEventListener::ResetEventTypeStack() + { + iAcceptedEventTypes.Reset(); + iAcceptedEventTypes.AppendL( MXIMPRequestCompleteEvent::KInterfaceId ); + iAcceptedEventTypes.AppendL( MXIMPContextStateEvent::KInterfaceId ); + iAcceptedEventTypes.AppendL( MOwnPresenceEvent::KInterfaceId ); + iAcceptedEventTypes.AppendL( MPresentityPresenceEvent::KInterfaceId ); + } + +EXPORT_C void CXIMPTestStatusEventListener::SetEventObserver( MXIMPContextObserver* aObserver ) + { + iObserver = aObserver; + } + + + + + + + + +// =========================================================================== +// FROM MPRFWPRESENCECONTEXTOBSERVER +// =========================================================================== +// +void CXIMPTestStatusEventListener::HandlePresenceContextEvent( + const MXIMPContext& aContext, + const MXIMPBase& aEvent ) + { + const TInt32 eventType = aEvent.GetInterfaceId(); + + __ASSERT_ALWAYS( iEventSource == &aContext, + Panic( EReceivingEventFromWrongContext ) ); + + __ASSERT_ALWAYS( IsAcceptedEventType( eventType ), + Panic( EReceivedNotAcceptedEventType ) ); + + TXIMPTestStatusEventSnapshot snapShot; + switch( eventType ) + { + case MXIMPRequestCompleteEvent::KInterfaceId: + { + const MXIMPRequestCompleteEvent* event = + TXIMPGetInterface< const MXIMPRequestCompleteEvent >::From( aEvent, MXIMPBase::EPanicIfUnknown ); + { + snapShot.iEventType = event->GetInterfaceId(); + snapShot.iCtxState = (MXIMPContextState::TState) TXIMPTestStatusEventSnapshot::EStateValueNotPresent; + snapShot.iReqId = event->RequestId(); + snapShot.iResultCode = event->CompletionResult().ResultCode(); + + AddSnapshotToStack( snapShot ); + } + + if( iWaitForAnyReq || event->RequestId() == iReqToWait ) + { + HandleRequestCompleteReceived(); + } + + break; + } + + case MXIMPContextStateEvent::KInterfaceId: + { + const MXIMPContextStateEvent& event = + *TXIMPGetInterface< const MXIMPContextStateEvent >::From( aEvent, + MXIMPBase::EPanicIfUnknown ); + { + TXIMPTestStatusEventSnapshot snapShot; + snapShot.iEventType = event.GetInterfaceId(); + snapShot.iCtxState = event.ContextState().ContextState(); + if( event.StateChangeReason() ) + { + snapShot.iResultCode = event.StateChangeReason()->ResultCode(); + } + else + { + snapShot.iResultCode = TXIMPTestStatusEventSnapshot::EStatusObjNotPresent; + } + + AddSnapshotToStack( snapShot ); + } + break; + } + + case MOwnPresenceEvent::KInterfaceId: + { + const MOwnPresenceEvent& event = + *TXIMPGetInterface< const MOwnPresenceEvent >::From( aEvent, + MXIMPBase::EPanicIfUnknown ); + { + TXIMPTestStatusEventSnapshot snapShot; + snapShot.iEventType = event.GetInterfaceId(); + snapShot.iCtxState = ( MXIMPContextState::TState ) ( event.DataSubscriptionState().DataState() + event.DataSubscriptionState().SubscriptionState() ); + AddSnapshotToStack( snapShot ); + } + break; + } + + case MPresentityPresenceEvent::KInterfaceId: + { + const MPresentityPresenceEvent& event = + *TXIMPGetInterface< const MPresentityPresenceEvent >::From( aEvent, + MXIMPBase::EPanicIfUnknown ); + { + TXIMPTestStatusEventSnapshot snapShot; + snapShot.iEventType = event.GetInterfaceId(); + snapShot.iCtxState = ( MXIMPContextState::TState ) ( event.DataSubscriptionState().DataState() + event.DataSubscriptionState().SubscriptionState() ); + AddSnapshotToStack( snapShot ); + } + break; + } + + case MPresentityGroupListEvent::KInterfaceId: + { + const MPresentityGroupListEvent& event = + *TXIMPGetInterface< const MPresentityGroupListEvent >::From( aEvent, + MXIMPBase::EPanicIfUnknown ); + { + TXIMPTestStatusEventSnapshot snapShot; + snapShot.iEventType = event.GetInterfaceId(); + AddSnapshotToStack( snapShot ); + } + break; + } + + case MPresentityGroupContentEvent::KInterfaceId: + { + const MPresentityGroupContentEvent& event = + *TXIMPGetInterface< const MPresentityGroupContentEvent >::From( aEvent, + MXIMPBase::EPanicIfUnknown ); + { + TXIMPTestStatusEventSnapshot snapShot; + snapShot.iEventType = event.GetInterfaceId(); + AddSnapshotToStack( snapShot ); + } + break; + } + + + case MPresenceWatcherListEvent::KInterfaceId: + { + const MPresenceWatcherListEvent& event = + *TXIMPGetInterface< const MPresenceWatcherListEvent >::From( aEvent, + MXIMPBase::EPanicIfUnknown ); + { + TXIMPTestStatusEventSnapshot snapShot; + snapShot.iEventType = event.GetInterfaceId(); + AddSnapshotToStack( snapShot ); + } + break; + } + + + default: + { + break; + } + } + + if( iObserver ) + { + iObserver->HandlePresenceContextEvent( aContext, aEvent ); + } + + if( iWaitForAnyEvent ) + { + HandleRequestCompleteReceived(); + } + } + + + +// =========================================================================== +// HELPERS +// =========================================================================== +// +void CXIMPTestStatusEventListener::HandleRequestCompleteReceived() + { + if( iWait.IsStarted() ) + { + iWait.AsyncStop(); + } + } + + + +TBool CXIMPTestStatusEventListener::IsAcceptedEventType( TInt32 aEventType ) const + { + TInt index = iAcceptedEventTypes.Find( aEventType ); + if( index == KErrNotFound ) + { + return EFalse; + } + return ETrue; + } + + + +void CXIMPTestStatusEventListener::AddSnapshotToStack( + TXIMPTestStatusEventSnapshot aSnapshot ) + { + __ASSERT_ALWAYS( iSnapshotCount < iSnapshotMaxCount, + Panic( EAddSnapshotOverflow ) ); + + iSnapshots[ iSnapshotCount ] = aSnapshot; + iSnapshotCount++; + } + + + +const TXIMPTestStatusEventSnapshot& CXIMPTestStatusEventListener::SnapshotFromStack( TInt aIndex ) const + { + __ASSERT_ALWAYS( aIndex < iSnapshotCount, + Panic( ESnapshotIndexOutOfBounds ) ); + + return iSnapshots[ aIndex ]; + } + + + +TBool CXIMPTestStatusEventListener::HasSameEvents( + const TArray< TXIMPTestStatusEventSnapshot >& aEventTraits ) const + { + TBool hasSameEvents = ETrue; + + if( iSnapshotCount != aEventTraits.Count() ) + { + hasSameEvents = EFalse; + } + else + { + for( TInt ix = 0; ix < iSnapshotCount; ix++ ) + { + const TXIMPTestStatusEventSnapshot& eventTrait = aEventTraits[ ix ]; + const TXIMPTestStatusEventSnapshot& receivedEvent = SnapshotFromStack( ix ); + + if( !receivedEvent.Equals( eventTrait ) ) + { + hasSameEvents = EFalse; + } + } + } + + return hasSameEvents; + } + + + +void CXIMPTestStatusEventListener::GetNameForEvent( + TDes8& aTarget, + TInt aEventType ) const + { + switch( aEventType ) + { + case MXIMPRequestCompleteEvent::KInterfaceId: + { + SafeAppendEventName( aTarget, _L8("[ReqComplete] ") ); + break; + } + + case MXIMPContextStateEvent::KInterfaceId: + { + SafeAppendEventName( aTarget, _L8("[PresCtx] ") ); + break; + } + + case MOwnPresenceEvent::KInterfaceId: + { + SafeAppendEventName( aTarget, _L8("[OwnPres] ") ); + break; + } + + case MPresentityGroupListEvent::KInterfaceId: + { + SafeAppendEventName( aTarget, _L8("[GroupList] ") ); + break; + } + + case MPresentityGroupContentEvent::KInterfaceId: + { + SafeAppendEventName( aTarget, _L8("[GroupContent] ") ); + break; + } + + case MPresentityPresenceEvent::KInterfaceId: + { + SafeAppendEventName( aTarget, _L8("[Presentity] ") ); + break; + } + + default: + { + SafeAppendEventName( aTarget, _L8("[Unknown] ") ); + break; + } + } + } + + + +void CXIMPTestStatusEventListener::SafeAppendEventName( + TDes8& aTarget, + const TDesC8& aName ) const + { + const TInt sizeAvailable = aTarget.MaxLength() - aTarget.Length(); + + if( sizeAvailable > aName.Size() ) + { + aTarget += aName; + } + else + { + _LIT8( KEllipsis, "..." ); + if( sizeAvailable > KEllipsis().Size() ) + { + aTarget += KEllipsis; + } + } + } + + + + +// end of file + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwteststatuseventlistener.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwteststatuseventlistener.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,284 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef CPRFWTESTSTATUSEVENTLISTENER_H__ +#define CPRFWTESTSTATUSEVENTLISTENER_H__ + + +#include +#include +#include + + + +// CLASS DESCRIPTION +/** + * Helper class to store snapshot from + * received status events: + * - MXIMPRequestCompleteEvent + * - MXIMPContextStateEvent + */ +class TXIMPTestStatusEventSnapshot + { +public: //Value enums + enum + { + EStatusObjNotPresent = 100, + EStateValueNotPresent = 101 + }; + +public: //Constructors + + //Default c++ constructor + IMPORT_C TXIMPTestStatusEventSnapshot(); + + //Constructor accepting integer fields + IMPORT_C TXIMPTestStatusEventSnapshot( TInt aEventType, + TInt aCtxState, + TInt aResultCode ); + +public: //Comparator functions + + IMPORT_C TBool Equals( const TXIMPTestStatusEventSnapshot& aOther ) const; + + +public: //Data + TInt iEventType; + MXIMPContextState::TState iCtxState; + TXIMPRequestId iReqId; + TInt iResultCode; + TBuf< 24 > iPrtResultDescription; + }; + + +/** + * Enumeration defining supported + * status event templates. + */ +enum TXIMPTestStatusEventTemplate + { + EXIMPTestStatusEvents_BindingOk, + EXIMPTestStatusEvents_BindingFailKErrAbort, + EXIMPTestStatusEvents_BindingFailInvalidReqId, + EXIMPTestStatusEvents_BindingFailServerTermination, + + EXIMPTestStatusEvents_UnbindingOk, + + EXIMPTestStatusEvents_RequestOk, + EXIMPTestStatusEvents_RequestOOM, + + EXIMPTestStatusEvents_PublishOk, + EXIMPTestStatusEvents_PublishFailKErrAbort, + + EXIMPTestStatusEvents_SubscribeOwnPresenceSingleCtx, + EXIMPTestStatusEvents_UnsubscribeOwnPresenceSingleCtx, + + EXIMPTestStatusEvents_SubscribePresentityPresenceSingleCtx, + EXIMPTestStatusEvents_UnsubscribePresentityPresenceSingleCtx, + + EXIMPTestStatusEvents_SubscribePresentityGroupListCtx, + EXIMPTestStatusEvents_UnsubscribePresentityGroupListCtx, + + EXIMPTestStatusEvents_SubscribePresentityGroupContentSingleCtx, + EXIMPTestStatusEvents_UnsubscribePresentityGroupContentSingleCtx, + + EXIMPTestStatusEvents_HandlePresentityGroupList, + + EXIMPTestStatusEvents_CreatePresentityGroup, + + EXIMPTestStatusEvents_SubscribePresenceWatcherListCtx, + EXIMPTestStatusEvents_UnsubscribePresenceWatcherListCtx, + EXIMPTestStatusEvents_HandlePresenceWatcherList, + + EXIMPTestStatusEvents_HandlePresentityPresence, + EXIMPTestStatusEvents_HandlePresentityPresencePending, + EXIMPTestStatusEvents_PresentitySubscribeFailKErrAbort, + }; + + +/** + * Presence context listener to record status events + * and to wait request completion + * Handles following event types: + * - MXIMPRequestCompleteEvent + * - MXIMPContextStateEvent + * + * For other XIMP event types, see other + * test listeners. + */ +class CXIMPTestStatusEventListener : public CBase, + public MXIMPContextObserver + { +public: + + /** + * Instantiates new listener object. + * + * If valid event source is given, reqisters this object as + * event observer to it. + */ + IMPORT_C static CXIMPTestStatusEventListener* CXIMPTestStatusEventListener::NewL( + TInt aStackSize, + MXIMPContext* aEventSource ); + + ~CXIMPTestStatusEventListener(); + +private: + CXIMPTestStatusEventListener( TInt aStackSize, + MXIMPContext* aEventSource ); + void ConstructL(); + + +public: + + /** + * Sets new event source from where to listen events. + * Unregisters from previous one. + * Can be NULL, in wich case just performs the + * unregistration. + */ + IMPORT_C void SetEventSourceL( MXIMPContext* aEventSource ); + + /** + * Access to accepted event types list. + * Client can alter the list. + * + * By default list has: + * - MXIMPRequestCompleteEvent + * - MXIMPContextStateEvent + * + * NOTE: remember to push edited list to event source with + * ReRegisterEventFilterL() + */ + IMPORT_C RArray< TInt32 >& AcceptedEventTypes(); + + + /** + * ReRegisters this listener to event source. + * In practice, takes new event filter in use. + */ + IMPORT_C void ReRegisterEventFilterL(); + + + /** + * Fills the given array with event templates. + * + * Given enumeration defines which template to retrieve. + */ + IMPORT_C void GetEventTemplateL( RArray< TXIMPTestStatusEventSnapshot >& aArray, + TXIMPTestStatusEventTemplate aTemplate ); + + /** + * Method to wait with CActiveSchedulerWait + * the given request completion. + * NOTE: Only one request can be waited at time. + * Stacks received MXIMPRequestCompleteEvent and + * MXIMPContextStateEvent details to + * event stack. + * + * @param aReqToWait The request to wait. + */ + IMPORT_C void WaitRequestAndStackEvents( const TXIMPRequestId& aReqToWait, TBool aAnyReq = EFalse ); + IMPORT_C void WaitAnyEvent(); + + + /** + * Verifies event stack contents against the given traits. + * + * NOTE: You can use GetEventTemplateL() to retrieve a + * common event traits. + * + * Error title is printed in the error assertion description. + */ + IMPORT_C void VerifyEventStackL( const TArray< TXIMPTestStatusEventSnapshot >& aEventTraits, + const TDesC8& aErrorTitle ) const; + + + + IMPORT_C TInt GetReqCompletionErrL( const TXIMPRequestId& aReqId ) const; + + + + /** + * Resets the event stack contents. + */ + IMPORT_C void ResetEventStack(); + IMPORT_C void ResetEventTypeStack(); + + /** + * Set event observer when needed. + */ + IMPORT_C void SetEventObserver( MXIMPContextObserver* aObserver ); + + +private: //From MXIMPContextObserver + + void HandlePresenceContextEvent( + const MXIMPContext& aContext, + const MXIMPBase& aEvent ); + + +private: //Helpers + void HandleRequestCompleteReceived(); + TBool IsAcceptedEventType( TInt32 aEventType ) const; + void AddSnapshotToStack( TXIMPTestStatusEventSnapshot aSnapshot ); + const TXIMPTestStatusEventSnapshot& SnapshotFromStack( TInt aIndex ) const; + + TBool HasSameEvents( const TArray< TXIMPTestStatusEventSnapshot >& aEventTraits ) const; + void GetNameForEvent( TDes8& aTarget, TInt aEventType ) const; + void SafeAppendEventName( TDes8& aTarget, const TDesC8& aName ) const; + + + + +private: //Data + + //OWN: Active scheduler wait for waiting the completion + CActiveSchedulerWait iWait; + + + //OWN: Request ID identifying request which completion event to wait + TXIMPRequestId iReqToWait; + + + //REF: Context from where receiving events + MXIMPContext* iEventSource; + + + //OWN: Accepted event types + RArray< TInt32 > iAcceptedEventTypes; + + + //OWN: Variables to maintain event snapshot stack + const TInt iSnapshotMaxCount; + TInt iSnapshotCount; + TXIMPTestStatusEventSnapshot* iSnapshots; + + //OWN: Description buffer to hold the failure description + mutable RBuf8 iDescription; + + TBool iWaitForAnyReq; + + TBool iWaitForAnyEvent; + + // To handle event by observer. + MXIMPContextObserver* iObserver; + }; + +#endif //CPRFWTESTSTATUSEVENTLISTENER_H__ + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwtestwaithelper.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwtestwaithelper.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,56 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ?Description +* +*/ + + + +#include + +#include "prfwtestwaithelper.h" + +// ======== LOCAL FUNCTIONS ======== + + +// ======== MEMBER FUNCTIONS ======== + + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +EXPORT_C CXIMPTestWaitHelper* CXIMPTestWaitHelper::NewL() + { + CXIMPTestWaitHelper* self = new ( ELeave ) CXIMPTestWaitHelper; + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +void CXIMPTestWaitHelper::ConstructL() + { + } + +CXIMPTestWaitHelper::~CXIMPTestWaitHelper() + { + } + +EXPORT_C void CXIMPTestWaitHelper::WaitForL( TInt aSeconds ) + { + User::After( aSeconds * 1000000 ); + } + +// End of file diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwtestwaithelper.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwtestwaithelper.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,48 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ?Description +* +*/ + + + +#ifndef CPRFWTESTWAITHELPER_H +#define CPRFWTESTWAITHELPER_H + + +#include + +class CXIMPTestGeneralWaiter; + +class CXIMPTestWaitHelper : public CBase + { + public: + + IMPORT_C static CXIMPTestWaitHelper* NewL(); + + IMPORT_C void WaitForL( TInt aSeconds ); + + ~CXIMPTestWaitHelper(); + + private: + + /** + * + */ + void ConstructL(); + + private: // data + }; + +#endif // CPRFWTESTWAITHELPER_H diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwwaitobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwwaitobserver.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,62 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ?Description +* +*/ + + + +#ifndef T_PRFWWAITOBSERVER +#define T_PRFWWAITOBSERVER + + +/** + * ?one_line_short_description + * + * ?more_complete_description + * + * @lib ?library + * @since S60 v4.0 + */ +class T_MWaitObserver + { + +public: + + /** + * ?description + * + * @since S60 ?S60_version + * @param ?arg1 ?description + * @param ?arg2 ?description + * @return ?description + */ + virtual void WaitCompleted( TInt aRetVal ) = 0; + + +protected: + + /** + * Protected destructor. + * Instancies can't be destroyed via this interface. + */ + virtual ~T_MWaitObserver() {}; + + }; + + + +#endif // T_PRFWWAITOBSERVER + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/userafter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/userafter.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,151 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Active object based wait. +* +*/ + +#ifndef CUSERAFTER_H__ +#define CUSERAFTER_H__ + +// INCLUDES +#include + + +// CLASS DESCRIPTION + +/** + * Active object based wait. + * + * Similar like User::After() but doesn't block + * whole thread, but current RunL() with + * CActiveSchedulerWait. + */ +class CUserAfter : public CTimer + { + public: //Construction + static inline CUserAfter* NewL(); + static inline CUserAfter* NewLC(); + ~CUserAfter(); + + + public: //Wait support + + /** + * Static "one shot" wait method. + */ + static inline void AfterL( TInt aWaitTimeMicroSeconds ); + static inline void AfterSecondsL( TInt aWaitTimeSeconds ); + + /** + * Member wait method. + */ + inline void After( TInt aWaitTimeMicroSeconds ); + + + private: + CUserAfter(); + + void RunL(); + void RunError(); + void DoCancel(); + + + private: //data + CActiveSchedulerWait iWait; + + }; + + + + +// ----------------------------------------------------------------------------- +// CUserAfter public functions +// ----------------------------------------------------------------------------- +// +inline CUserAfter* CUserAfter::NewL() + { + CUserAfter* self = CUserAfter::NewLC(); + CleanupStack::Pop( self ); + return self; + } + +inline CUserAfter* CUserAfter::NewLC() + { + CUserAfter* self = new (ELeave) CUserAfter(); + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + + +inline CUserAfter::~CUserAfter() + { + CTimer::Cancel(); + } + +inline void CUserAfter::After( TInt aWaitTimeMicroSeconds ) + { + CTimer::After( aWaitTimeMicroSeconds ); + iWait.Start(); + } + + +inline void CUserAfter::AfterL( TInt aWaitTimeMicroSeconds ) + { + CUserAfter* after = CUserAfter::NewL(); + after->After( aWaitTimeMicroSeconds ); + delete after; + } + + +inline void CUserAfter::AfterSecondsL( TInt aWaitTimeSeconds ) + { + CUserAfter* after = CUserAfter::NewL(); + after->After( aWaitTimeSeconds * 1000000 ); + delete after; + } + + +// ----------------------------------------------------------------------------- +// CUserAfter private functions +// ----------------------------------------------------------------------------- +// +inline CUserAfter::CUserAfter() + : CTimer( CActive::EPriorityStandard ) + { + CActiveScheduler::Add( this ); + } + + +inline void CUserAfter::RunL() + { + iWait.AsyncStop(); + Cancel(); + } + +inline void CUserAfter::RunError() + { + } + +inline void CUserAfter::DoCancel() + { + iWait.AsyncStop(); + CTimer::DoCancel(); + } + + +#endif // CUSERAFTER_H__ + +// End of File + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_feature_plugin_api/ximp_core_feature_plugin_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_feature_plugin_api/ximp_core_feature_plugin_api.metaxml Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,21 @@ + + +ximp_core_feature_plugin_api +Contains interfaces for managing and accessing the XIMP Feature Plugins . + +c++ +ximpfw + + + + + + + + + + +yes +no + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_management_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_management_api/group/bld.inf Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,33 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: File that exports the files belonging to +: XIMP Core Management API +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +../inc/ximpcontextstateevent.h MW_LAYER_PLATFORM_EXPORT_PATH(ximpcontextstateevent.h) +../inc/ximpclient.inl MW_LAYER_PLATFORM_EXPORT_PATH(ximpclient.inl) +../inc/ximpclient.h MW_LAYER_PLATFORM_EXPORT_PATH(ximpclient.h) +../inc/ximpcontextobserver.h MW_LAYER_PLATFORM_EXPORT_PATH(ximpcontextobserver.h) +../inc/ximpcontext.h MW_LAYER_PLATFORM_EXPORT_PATH(ximpcontext.h) +../inc/ximprequestcompleteevent.h MW_LAYER_PLATFORM_EXPORT_PATH(ximprequestcompleteevent.h) +../inc/ximpmanagementifids.hrh MW_LAYER_PLATFORM_EXPORT_PATH(ximpmanagementifids.hrh) diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_management_api/inc/ximpclient.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_management_api/inc/ximpclient.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,151 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Root interface for clients for XIMP Framework usage. +* +*/ + +#ifndef MXIMPFWCLIENT_H +#define MXIMPFWCLIENT_H + +#include +#include +#include + + +class MXIMPProtocolInfo; +class MXIMPFeatureInfo; +class MXIMPContext; + + +/** + * Root interface for clients for XIMP Framework usage. + * + * MXIMPClient is main interface for XIMP Framework + * clients, to access XIMP Framework services. + * Interface is implemented by the XIMP Framework. + * MXIMPClient instance is created with the + * MXIMPClient::NewClientL() method. + * + * MXIMPClient provides methods to query available + * presence protocols and their capabilities. + * + * MXIMPClient is also factory for instantiating + * presence context objects. + * + * @ingroup ximpfwmanagementapi + * @since S60 v3.2 + */ +class MXIMPClient : public MXIMPBase + { +public: + + /** + * ECom interface UID for the MXIMPClient. + * + * This interface ID is used: + * 1) In XIMPFw ECom registration file, to declare + * implemented interface. It is used also by + * the MXIMPClient::NewClientL() instantiation + * method, when creating MXIMPClient instance + * through the ECom. + * + * 2) By clients when resolving MXIMPClient interface + * through MXIMPBase::GetInterface(). + */ + enum { KInterfaceId = XIMP_ECOM_IF_UID_CLIENT_INTERFACE }; + + +public: + + /** + * Factory method to instantiate MXIMPClient. + * + * Factory method to instantiate platform default + * MXIMPClient implementation through the ECom. + * If the default presence framework isn't supported + * in the platform, leaves with errorcode signalled + * from ECom. + * + * @return The new presence client object. Object + * ownership is returned to caller. + */ + static inline MXIMPClient* NewClientL(); + + + /** + * Public destructor. + * Object can be deleted through this interface. + */ + virtual inline ~MXIMPClient(); + + + +protected: + + /** + * Default constructor to zero initialize + * the iEcomDtorID member. + */ + inline MXIMPClient(); + + +public: + + /** + * Retrieves a list of presence protocols. + * + * @param [in, out] aProtocols + * The list of presence protocols, each protocol is + * presented with MXimpFwPresenceProtocolInfo object. + * Existing protocol info items are deleted from array + * before adding new entries. Ownership of created objects + * is returned to caller. + */ + virtual void GetProtocolsL( + RXIMPObjOwningPtrArray< MXIMPProtocolInfo >& aProtocols ) = 0; + + /** + * Retrieves features supported by current + * XIMP Framework implementation. + * + * @return Features supported by the XIMP Framework. + * Exact feature IDs are defined in NXIMPFeature + * namespace. Object ownership is returned to + * caller. + */ + virtual MXIMPFeatureInfo* GetFrameworkFeaturesLC() = 0; + + + /** + * Instantiates new presence context object. + * + * @return New presence context instance. + * Object ownership is returned to caller. + */ + virtual MXIMPContext* NewPresenceContextLC() = 0; + + + +private: // Data + + //OWN: ECom destructor ID + TUid iEcomDtorID; + }; + +#include + +#endif // MXIMPFWCLIENT_H + + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_management_api/inc/ximpclient.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_management_api/inc/ximpclient.inl Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,64 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Root interface used by Presence Framework clients. +* +*/ + +#include + + +// ----------------------------------------------------------------------------- +// MXIMPClient::NewClientL() implementation +// Factory method to instantiate the platform default +// MXIMPClient implementation through the ECom framework. +// ----------------------------------------------------------------------------- +// +inline MXIMPClient* MXIMPClient::NewClientL() + { + _LIT8( KXimpFwDefaultData, XIMP_ECOM_DEFAULT_DATA_CLIENT_INTERFACE ); + + TEComResolverParams resolvingParams; + resolvingParams.SetDataType( KXimpFwDefaultData ); + resolvingParams.SetWildcardMatch( ETrue ); + + TAny* imp = REComSession::CreateImplementationL( TUid::Uid( MXIMPClient::KInterfaceId ), + _FOFF( MXIMPClient, iEcomDtorID ), + resolvingParams ); + + return reinterpret_cast< MXIMPClient* >( imp ); + } + + +// ----------------------------------------------------------------------------- +// MXIMPClient::MXIMPClient() implementation +// Zero initializes the iEcomDtorID member. +// ----------------------------------------------------------------------------- +// +inline MXIMPClient::MXIMPClient() + { + iEcomDtorID = TUid::Null(); + } + + +// ----------------------------------------------------------------------------- +// MXIMPClient::~MXIMPClient() +// Destructor notifies the ECom from implementation destruction. +// ----------------------------------------------------------------------------- +// +inline MXIMPClient::~MXIMPClient() + { + REComSession::DestroyedImplementation( iEcomDtorID ); + } + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_management_api/inc/ximpcontext.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_management_api/inc/ximpcontext.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,271 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interface for XIMP context. +* +*/ + +#ifndef MXIMPFWPRESENCECONTEXT_H +#define MXIMPFWPRESENCECONTEXT_H + +#include +#include +#include + + +class MXIMPClient; +class MXIMPContextObserver; +class MXIMPFeatureInfo; +class MXIMPObjectFactory; + + + +/** + * Interface for XIMP context. + * This interface is implemented by the XIMP Framework. + * + * MXIMPContext is root interface for accessing + * and updating XIMP data to remote XIMP service. + * MXIMPContext client binds MXIMPContext + * interface to desired remote XIMP service and uses + * other MXIMPContext sub interfaces to publish + * and access XIMP data. + * + * Following sub interfaces can be accessed from + * from MXIMPContext: + * - MXIMPObjectFactory + * + * All Presence events (context state, XIMP data, + * request completion etc. ones) are delivered through + * MXIMPContextObserver interface. + * + * @ingroup ximpfwmanagementapi + * @since S60 v3.2 + */ +class MXIMPContext : public MXIMPBase + { +public: + + /** Interface ID for the MXIMPContext. */ + enum { KInterfaceId = XIMP_IF_ID_CONTEXT }; + + +public: + + /** + * Public destructor. + * Objects can be deleted through this interface. + */ + virtual ~MXIMPContext() {} + + + +public: + + /** + * Reqisters XIMP context event observer. + * + * Reqisters observer is notified from XIMP context events. + * XIMP Framework client side events are listed in + * MXIMPContextObserver header. + * + * Event delivery uses client side active object to callback + * the reqistered observer. If client thread is blocked with + * User::WaitFor...() or other high priority active objects, + * event notification is delayed until XIMP Framework + * client side active objects get their execution turn. + * When client is blocked, XIMP Framework queues events, + * and delivers those later in FIFO order to observer. However, + * the XIMP Framework limits the que size and thus + * events might get dropped if the the client is blocked + * too long. + * + * Even though client shouldn't perform any heavy + * processing in the event callback, XIMP Framework + * allows the client client to issue following kind of + * requests to XIMP Framework, from event callback: + * - Data management relatred asynchronous & synchronous requests + * - Observer registeration and unregisteration + * - Presence context undbind + * - Presence contex destroy + * + * @param [in] aObserver + * The observer to be notified from context events. + * If the observer is already registered, event filter + * associated to it is updated. + * + * @param [in] aEventFilter + * List of event types that the observer accepts. + * Event types are identified with their event interface IDs. + * If NULL, all event types are delivered to observer. + */ + virtual void RegisterObserverL( + MXIMPContextObserver& aObserver, + const TArray* aEventFilter = NULL ) = 0; + + + /** + * Unregisters context event observer. + * + * @param [in] aObserver + * The observer to unregister. + */ + virtual void UnregisterObserver( + MXIMPContextObserver& aObserver ) = 0; + + + + /** + * Binds the XIMP context to remote XIMP service. + * + * Binds the XIMP context to given XIMP service, + * with given credentials and by using defined protocol plug-in. + * Binding is asynchronous operation and evolves network interaction. + * Used protocol plug-in is identified explicitly with its + * implementation UID. + * + * @param [in] aProtocolImpUid + * Protocol implementation UID identifying which + * PSC protocol implementation to use. + * + * @param [in] aServiceAddress + * Service address string identifying the remote + * XIMP service. + * + * @param [in] aIapId + * Internet Accesspoint for accessing the remote + * XIMP service connection. + * + * @param [in] aUsername + * Username (credential) for accessing the remote + * XIMP service. + * + * @param [in] aPassword + * Password (credential) for accessing the remote + * XIMP service. + * + * @return The request ID identifying the started binding request. + * Client can use request ID to find out correct + * completion event from the MXIMPContextObserver + * event stream. + */ + virtual TXIMPRequestId BindToL( + TUid aProtocolImpUid, + const TDesC16& aServiceAddress, + const TDesC16& aUsername, + const TDesC16& aPassword, + TInt32 aIapId ) = 0; + + + virtual TXIMPRequestId BindToL( + TUid aProtocolImpUid, + const TDesC16& aServiceAddress, + const TDesC16& aUsername, + const TDesC16& aPassword, + const TDesC16& aClientId, + TInt32 aIapId ) = 0; + + /** + * Binds the XIMP context to remote XIMP service. + * + * Binds the XIMP context to given XIMP service, + * with given credentials and by using defined protocol plug-in. + * Binding is asynchronous operation and evolves network interaction. + * Used protocol plug-in is identified explicitly with its + * implementation UID. + * + * @param [in] aProtocolImpUid + * Protocol implementation UID identifying which + * PSC protocol implementation to use. + * + * @param [in] aServiceAddress + * Service address string identifying the remote + * XIMP service. + * + * @param [in] aUsername + * Username (credential) for accessing the remote + * XIMP service. + * + * @param [in] aPassword + * Password (credential) for accessing the remote + * XIMP service. + * @param [in] aServiceId - Service Id + * + * @return The request ID identifying the started binding request. + * Client can use request ID to find out correct + * completion event from the MXIMPContextObserver + * event stream. + */ + virtual TXIMPRequestId BindToL( TUid aProtocolImpUid, + TInt aServiceId ) = 0; + + virtual TXIMPRequestId BindToL( + TUid aProtocolImpUid, + const TDesC16& aUsername, + const TDesC16& aPassword, + TInt aServiceId ) = 0; + /** + * Unbinds the XIMP context from the to currently binded + * XIMP service. Unbinding is asynchronous operation and + * might evolve network operations. Unbinding or waiting + * unbinding completion isn't mandatory for the client. + * XIMPFw performs unbinding implicitly when the bound + * MXIMPContext object is destroyed. + * + * @return The request ID identifying the started unbinding + * request. Client can use request ID to find out correct + * completion event from the MXIMPContextObserver + * event stream. + */ + virtual TXIMPRequestId UnbindL() = 0; + + + + /** + * Retrieves Presence Contex features. + * + * Retrieves features supported by the Presence Contex. + * Features returned here may be "less" than what the + * protocol indicated, since connected remote service + * may limit available features. + * + * @return Features supported in Presence Contex. + * Exact feature IDs are defined in NXIMPFeature + * namespace. Object ownership is returned + * to caller. + */ + virtual MXIMPFeatureInfo* GetContextFeaturesLC() const = 0; + + + +public: //Sub interfaces for XIMP context + + + /** + * Gets reference to object factory interface. + * + * Returned object factory interface is used + * to instantiate XIMP objects. + * + * @return Object factory interface. + * No ownership is returned caller. + */ + virtual MXIMPObjectFactory& ObjectFactory() const = 0; + + }; + + +#endif // MXIMPFWPRESENCECONTEXT_H + + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_management_api/inc/ximpcontextobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_management_api/inc/ximpcontextobserver.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,160 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interface for XIMP context event observer. +* +*/ + +#ifndef XIMPFWPRESENCECONTEXTOBSERVER_H +#define XIMPFWPRESENCECONTEXTOBSERVER_H + +#include +#include + + +class MXIMPContext; +class MXimpFwEventBase; + + + +/** + * Interface for XIMP context event observer. + * This interface must be implemented by the client which + * is using the XIMP Framework services, to receive status + * and data notification callbacks from XIMP Framework. + * + * All callbacks from XIMP Framework XIMP context + * to client direction happen through this interface + * HandlePresenceContextEvent() method. Data content in callbacks + * is presented to client with following event specific + * interfaces: + * - MXIMPRequestCompleteEvent + * - MXIMPContextStateEvent + * - MOwnPresenceEvent + * - MPresentityPresenceEvent + * - MPresentityGroupListEvent + * - MPresentityGroupContentEvent + * - MPresenceWatcherListEvent + * - MPresenceGrantRequestListEvent + * - MPresenceBlockListEvent + * + * See event interface type specific documentation + * for further information about different event types. + * + * Client can dispatch and cast event types on its own + * event callback implementation in following way: + * @code + * void CMyObserverClass::HandlePresenceContextEvent( + * const MXIMPContext& aContext, + * const MXIMPBase& aEvent ) + * { + * switch( aEvent.GetInterfaceId() ) + * { + * case MXIMPRequestCompleteEvent::KInterfaceId: + * { + * const MXIMPRequestCompleteEvent* complEvent = + * TXIMPGetInterface< const MXIMPRequestCompleteEvent >::From( aEvent, + * MXIMPBase::EPanicIfUnknown ); + * + * // Do here request complete event specific handling + * complEvent->RequestId(); + * + * break; + * } + * + * + * case MXIMPContextStateEvent::KInterfaceId: + * { + * const MXIMPContextStateEvent* ctxtStateEvent = + * TXIMPGetInterface< const MXIMPContextStateEvent >::From( aEvent, + * MXIMPBase::EPanicIfUnknown ); + * // Do here context state event specific handling + * ctxtStateEvent->ContextState(); + * + * break; + * } + * + * + * default: + * { + * // New event types may be introduced in newer XIMP Framework + * // versions, so handle unknown event types gracefully. + * break; + * } + * } + * } + * + * @endcode + * + * + * @ingroup ximpfwmanagementapi + * @since S60 v3.2 + */ +class MXIMPContextObserver + { +protected: + + /** + * Protected destructor. Observer instancies + * can't be destroyed via this interface. + */ + virtual ~MXIMPContextObserver() {} + + +public: + + /** + * Event callback. + * + * Events are delivered as MXIMPBase typed objects to client. + * Client can use MXIMPBase::GetInterfaceId() to determine + * the real event interface type. + * + * @param [in] aContext + * Presence context object from where this event is coming. + * Provided as reference for client, so client can + * distinguish events from different contexts. + * + * @param [in] aEvent + * The event object. Client can use MXIMPBase::GetInterfaceId() + * to determine real event type and TXIMPGetInterface helper + * to cast base typed object to real event interface. + * Object ownership isn't transfered to client. + */ + virtual void HandlePresenceContextEvent( + const MXIMPContext& aContext, + const MXIMPBase& aEvent ) = 0; + + + /** + * Extension point for this observer interface. + * + * Returns an pointer to MXIMPContextObserver + * extension interface or NULL if the concrete observer + * implementation doesn't support requested extension. + * + * @param [in] aInterfaceId + * Interface ID identifying the requested extension + * interface. + * + * @return Pointer to requested extension interface or NULL. + */ + virtual TAny* PresenceContextObserverExtensionOrNull( + TInt32 aInterfaceId ) { ( void ) aInterfaceId; return NULL; } + + }; + +#endif // XIMPFWPRESENCECONTEXTOBSERVER_H + + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_management_api/inc/ximpcontextstateevent.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_management_api/inc/ximpcontextstateevent.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,104 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Event interface for XIMP context state notification. +* +*/ + +#ifndef MXIMPFWPRESENCECONTEXTSTATEEVENT_H +#define MXIMPFWPRESENCECONTEXTSTATEEVENT_H + + +#include +#include +#include + + +class MXIMPStatus; +class MXIMPContextState; + + + +/** + * Event interface for XIMP context state notification. + * + * This interface is implemented by the XIMP Framework, + * and it is used to notify clients about XIMP context + * state changes. + * + * XIMP Framework signalls this event it to registered + * client observers through MXIMPContextObserver + * observer interface. Clients do need to perform any specific + * subscribe request for this event type, just register a valid + * observer with MXIMPPscContext::RegisterObserverL(), + * with such event type filter, that this + * MXIMPContextStateEvent interface is accepted. + * + * @ingroup ximpfwmanagementapievents + * @since S60 v3.2 + */ +class MXIMPContextStateEvent : public MXIMPBase + { +public: + + /** Interface ID for the MXIMPContextStateEvent. */ + enum { KInterfaceId = XIMP_IF_ID_CONTEXT_STATE_EVENT }; + + + +protected: + + /** + * Protected destructor. + * Event objects can't be deleted via this interface. + */ + virtual ~MXIMPContextStateEvent() {} + + + +public: + + + /** + * Gets the XIMP context current state. + * + * @return The XIMP context current state. + */ + virtual const MXIMPContextState& ContextState() const = 0; + + + + /** + * Gets status object describing the XIMP contexts + * state change reason. + * + * Status object is optional and it is present only in + * those state change events which are originated from + * underlying protocol. Protocol can fill in into status + * object the details about the state reason. + * + * @return The MXIMPStatus object describing + * the XIMP context state change reason. + * NULL if no status object is present. + * Object ownersip is not returned. + */ + virtual const MXIMPStatus* StateChangeReason() const = 0; + + }; + + + +#endif // MXIMPFWPRESENCECONTEXTSTATEEVENT_H + + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_management_api/inc/ximpmanagementifids.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_management_api/inc/ximpmanagementifids.hrh Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,73 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework Presence Management API interface IDs. +* +*/ + +#ifndef XIMPPRESENCEMANAGEMENTIFUIDS_HRH +#define XIMPPRESENCEMANAGEMENTIFUIDS_HRH + + + +/** + * @defgroup ximpfwmanagementapi XIMP Core Management API + * @ingroup ximpcoreapi + * + * XIMP Core Management API contains + * abstract core management interfaces, which are implemented by + * XIMP Framework. XIMP Framework clients call these + * interfaces to request XIMP Framework execute + * certain XIMP services. + * @since S60 v3.2 + */ + + +/** + * @defgroup ximpfwmanagementapievents XIMP Core Management API events + * + * XIMP Core Management API contains also + * abstract event interfaces, which are used to deliver data + * and state information to XIMP Framework clients through + * MXIMPContextObserver::HandlePresenceContextEvent() + * event callback. + * + * @ingroup ximpfwmanagementapi + * @since S60 v3.2 + */ + + +// Management IF id's +// 20xx - ximp related +// 21xx - presence related +// 22xx - instant messaging related + +// Interface UID for XIMP Protocol Plugin Base ECom interface +#define XIMP_ECOM_IF_UID_CLIENT_INTERFACE 0x10282DD6 + + +// Default implementation resulution data +// for XIMPFw Protocol Plugin Base ECom interface +#define XIMP_ECOM_DEFAULT_DATA_CLIENT_INTERFACE "default" + + +// Interface IDs for XIMP Management API interfaces +#define XIMP_IF_ID_CONTEXT 2001 +#define XIMP_IF_ID_REQUEST_COMPLETE_EVENT 2002 +#define XIMP_IF_ID_CONTEXT_STATE_EVENT 2203 +#define XIMP_IF_ID_CONTEXT_INTERNAL 2204 + + + +#endif // XIMPPRESENCEMANAGEMENTIFUIDS_HRH + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_management_api/inc/ximprequestcompleteevent.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_management_api/inc/ximprequestcompleteevent.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,114 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Event interface for request completion notification. +* +*/ + +#ifndef MXIMPFWREQUESTCOMPLETEEVENT_H +#define MXIMPFWREQUESTCOMPLETEEVENT_H + +#include +#include +#include + + +class MXIMPStatus; + + +/** + * Event interface for request completion notification. + * + * This interface is implemented by the XIMP Framework, + * and it is used to notify clients that XIMP Framework + * has completed processing of certain client request. + * + * XIMP Framework signalls this event it to registered + * client observers through MXIMPContextObserver + * observer interface. Clients do need to perform any specific + * subscribe request for this event type, just register a valid + * observer with MXIMPPscContext::RegisterObserverL(), + * with such event type filter, that this MXIMPRequestCompleteEvent + * interface is accepted. + * + * @ingroup ximpfwmanagementapievents + * @since S60 v3.2 + */ +class MXIMPRequestCompleteEvent : public MXIMPBase + { +public: + + /** Interface ID for the MXIMPRequestCompleteEvent. */ + enum { KInterfaceId = XIMP_IF_ID_REQUEST_COMPLETE_EVENT }; + + +protected: + + /** + * Protected destructor. + * Event objects can't be deleted via this interface. + */ + virtual ~MXIMPRequestCompleteEvent() {} + + +public: + + + /** + * Returns request id of the completed request. + * + * @return The request id. + */ + virtual const TXIMPRequestId& RequestId() const = 0; + + + /** + * Returns request completion result. + * + * @return The request completion result object. + * Object ownership is not returned to caller. + */ + virtual const MXIMPStatus& CompletionResult() const = 0; + + + /** + * Looks up the extension data object having given + * interface type. + * + * Protocol adaptation or XIMP Framework itself + * may signal request specific extra data to client + * through request complete event. Client can use + * this method to retrieve a pointer to extra data + * object and later cast returned base object + * to real object interface type with TXIMPGetInterface. + * + * @param [in] aInterfaceId + * The interface type of the extra data object + * to be looked up. + * + * @return Pointer to object of given interface type + * or NULL if no object having given interface + * was found from this request complete events + * extra data collection. Object ownership + * is not returned to caller. + */ + virtual const MXIMPBase* LookupCompletionDataByType( + TInt32 aInterfaceId ) const = 0; + + }; + + +#endif // MXIMPFWREQUESTCOMPLETEEVENT_H + + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_management_api/ximp_core_management_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_management_api/ximp_core_management_api.metaxml Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,26 @@ + + + XIMP Core Management API + Contains interfaces for managing and accessing the XIMP core features. API provides interfaces for: +- creating ne instances of the framework +- requesting the framework features +- creating new contexts + c++ + ximpfw + + + + + + + + + + + + + + yes + no + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_protocol_plugin_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_protocol_plugin_api/group/bld.inf Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,31 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: File that exports the files belonging to +: XIMP Core Protocol Plug-in API +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +../inc/ximpprotocolpluginifids.hrh MW_LAYER_PLATFORM_EXPORT_PATH(ximpprotocolpluginifids.hrh) +../inc/ximpprotocolplugin.h MW_LAYER_PLATFORM_EXPORT_PATH(ximpprotocolplugin.h) +../inc/ximpprotocolconnection.h MW_LAYER_PLATFORM_EXPORT_PATH(ximpprotocolconnection.h) +../inc/ximpprotocolpluginbase.h MW_LAYER_PLATFORM_EXPORT_PATH(ximpprotocolpluginbase.h) +../inc/ximpprotocolpluginbase.inl MW_LAYER_PLATFORM_EXPORT_PATH(ximpprotocolpluginbase.inl) diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_protocol_plugin_api/inc/ximpprotocolconnection.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_protocol_plugin_api/inc/ximpprotocolconnection.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,299 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interface for presence protocol connection object. +* +*/ + +#ifndef MXIMPFWPROTOCOLCONNECTION_H +#define MXIMPFWPROTOCOLCONNECTION_H + + +#include +#include +#include +#include + + +class MXIMPContextClientInfo; +class MXIMPProtocolConnectionHost; +class MProtocolPresenceFeatures; +class MProtocolImFeatures; + + + +/** + * Interface for presence protocol connection object. + * Interface must be implemented by a XIMP Framework protocol + * plug-ins. + * + * This interface models a connection from XIMP Framework to + * single remote presence service, over certain presence protocol + * implementation. XIMP Framework calls methods on this interface + * based on XIMP Framework client requests. + * + * XIMP Framework retrieves MXIMPProtocolConnection + * instances through MXIMPProtocolPlugin::AcquireConnectionL(). + * Same MXIMPProtocolConnection instance may be returned by multiple + * MXIMPProtocolPlugin::AcquireConnectionL() calls. In this case + * XIMP Framework shares MXIMPProtocolConnection instance + * by multiple clients, and MXIMPProtocolConnection lifetime is + * extended over utilizing client sessions. When last utilizing + * client session is succesfully closed with + * MXIMPProtocolConnection::CloseSession(), XIMP Framework + * disposes the MXIMPProtocolConnection instance with + * MXIMPProtocolPlugin::ReleaseConnection(). + * + * + * MXIMPProtocolConnection implementation must provide + * access following feature specific sub-interfaces: + * - MProtocolPresenceWatching + * - MProtocolPresencePublishing + * - MProtocolPresentityGroups + * - MProtocolPresenceAuthorization + * + * Each provided sub-interface defines a set of its own + * presence managements requests, relating to presence watching + * and subscribing, presence publication, presentity groups and + * presentity group member management and to presence authorizations. + * XIMP Framework calls these sub-interfaces to request on + * spesific presence requests from protocol connection. + * + * @see MXIMPProtocolConnectionHost + * @ingroup ximpprotocolpluginapi + * @since S60 v3.2 + */ +class MXIMPProtocolConnection : public MXIMPBase + { +public: + + /** Interface ID for the MXIMPProtocolConnection. */ + enum { KInterfaceId = XIMP_IF_ID_PROTOCOL_CONNECTION }; + + +protected: + + /** + * Protected destructor. MXIMPProtocolConnection + * objects can't be deleted through this interface. + * + * XIMP Framework disposes MXIMPProtocolConnection + * instances through MXIMPProtocolPlugin::ReleaseConnection(). + */ + virtual inline ~MXIMPProtocolConnection() {}; + + + +public: // Common + + + /** + * Primes protocol connection with its callback interface. + * + * Primes the presence protocol connection instance with + * its XIMP Framework side callback interface. + * Here given MXIMPProtocolConnectionHost interface is + * implemented and owned by the XIMP Framework, and + * presence protocol connection must use it to communicate back to + * XIMP Framework direction. + * + * Call and interface lifetime convention: + * - This method is called by XIMP Framework before + * requesting any other requests from protocol connection + * instance. + * + * - This method is called just once for each MXIMPProtocolConnection, + * even the same MXIMPProtocolConnection instance is returned + * multiple times from MXIMPProtocolPlugin::AcquireConnectionL(). + * + * - Each presence protocol connection instance must use here + * given specific host interface instance to communicate back + * to XIMP Framework direction + * + * - The presence protocol connection implementation must + * store the here given host reference internally, so + * protocol connection implementation can access the host + * when needed. + * + * - Here given MXIMPProtocolConnectionHost instance, is guaranteed + * to remain valid (usable), untill the presence protocol connection + * has completed the last MXIMPProtocolConnection::CloseSession() + * request. + * + * + * @param [in] aHost + * Reference to host interface, what this MXIMPProtocolConnection + * instance must use to communicate back to XIMP Framework + * direction. Object ownership is not trasfered. + */ + virtual void PrimeHost( + MXIMPProtocolConnectionHost& aHost ) = 0; + + + +public: // Connection handling + + + /** + * Opens a session for the identified client through + * the presence protocol connection. + * + * XIMP Framework calls this method to open a session to + * remote presence service, for here specified client. + * Remote presence service was identified when the + * MXIMPProtocolConnection instance was retrieved through + * MXIMPProtocolPlugin::AcquireConnectionL(). + * + * @param [in] aContextClient + * Object describing the presence connection client. + * + * @param [in] aReqId + * Request ID identifying the request. Presence protocol + * connection implementation must cache here given ID and + * use it when completing the request later through the + * MXIMPProtocolConnectionHost::HandleRequestCompleted(). + */ + virtual void OpenSessionL( + const MXIMPContextClientInfo& aContextClient, + TXIMPRequestId aReqId ) = 0; + + + /** + * Opens a session for the identified client through + * the presence protocol connection. + * + * XIMP Framework calls this method to open a session to + * remote presence service, for here specified client. + * Remote presence service was identified when the + * MXIMPProtocolConnection instance was retrieved through + * MXIMPProtocolPlugin::AcquireConnectionL(). + * + * @param [in] aSettingsId + * SettingsId for the presence connection client. + * + * @param [in] aReqId + * Request ID identifying the request. Presence protocol + * connection implementation must cache here given ID and + * use it when completing the request later through the + * MXIMPProtocolConnectionHost::HandleRequestCompleted(). + */ + virtual void OpenSessionL( + const TInt& aSettingsId, + TXIMPRequestId aReqId ) = 0; + + + /** + * Closes the identified client session from the + * presence connection. + * + * XIMP Framework calls this method to close + * the remote presence service session, for here specified + * client. When last using client session is closed, + * XIMP Framework consideres the remote presence connection + * as disconnect, and disposes MXIMPProtocolConnection instance + * with MXIMPProtocolPlugin::ReleaseConnection(). + * + * @param [in] aContextClient + * Client which session to close. + * + * @param [in] aReqId + * Request ID identifying the request. Presence protocol + * connection implementation must cache here given ID and + * use it when completing the request later through the + * MXIMPProtocolConnectionHost::HandleRequestCompleted(). + */ + virtual void CloseSession( + const MXIMPContextClientInfo& aContextClient, + TXIMPRequestId aReqId ) = 0; + + + /** + * Gets features that presence protocol connection supports. + * + * Presence protocol connection should negotiate + * available features during the connection establish + * and this method should return the supported features + * from presence protocol connection internal cache. + * + * @param [out] aFeatures + * Return parameter where to append supported + * presence protocol connection features. + * Feature IDs are defined in NXIMPFeature namespace. + */ + virtual void GetSupportedFeaturesL( + CDesC8Array& aFeatures ) const = 0; + + + +public: // Access to sub-interfaces + + + /** + * Gets reference to presence watching interface. + * + * XIMP Framework calls this method to retrieve a reference + * to protocols MProtocolPresenceWatching interface + * implementation. + * + * Call and interface lifetime convention: + * - This method isn't called before protocol has signalled + * MXIMPProtocolConnection::OpenSessionL() succesfully completed. + * + * - XIMP Framework may call this method multiple times for + * for one MXIMPProtocolConnection instance. + * + * - Each call per one MXIMPProtocolConnection instance, + * must return reference to same interface instance. + * + * - Returned interface instance must remain valid (usable) + * untill last client session, using originating presence protocol + * connection is successfully closed with + * MXIMPProtocolConnection::CloseSession(). + * + * @return Requested interface. + * interface ownership is not returned caller. + */ + virtual MProtocolPresenceFeatures& ProtocolPresenceFeatures() = 0; + + + /** + * Gets reference to protocol specific interface. + * + * XIMP Framework calls this method to retrieve a reference + * to protocol interface implementation. + * + * Call and interface lifetime convention: + * - This method isn't called before protocol has signalled + * MXIMPProtocolConnection::OpenSessionL() succesfully completed. + * + * - XIMP Framework may call this method multiple times for + * for one MXIMPProtocolConnection instance. + * + * - Each call per one MXIMPProtocolConnection instance, + * must return reference to same interface instance. + * + * - Returned interface instance must remain valid (usable) + * untill last client session, using originating presence protocol + * connection is successfully closed with + * MXIMPProtocolConnection::CloseSession(). + * + * @return Requested interface. + * interface ownership is not returned caller. + */ + virtual TAny* GetProtocolInterface(TInt aInterfaceId) = 0; + + }; + + + +#endif // MXIMPFWPROTOCOLCONNECTION_H diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_protocol_plugin_api/inc/ximpprotocolplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_protocol_plugin_api/inc/ximpprotocolplugin.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,192 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interface for presence protocol plug-in object. +* +*/ + +#ifndef MXIMPFWPROTOCOLPLUGIN_H +#define MXIMPFWPROTOCOLPLUGIN_H + + +#include +#include +#include +#include + +class MXIMPServiceInfo; +class MXIMPProtocolPluginHost; +class MXIMPProtocolConnection; +class MXIMPContextClientInfo; + + + +/** + * Interface for presence protocol plug-in object. + * Interface must be implemented by a concrete + * XIMP Framework protocol plug-ins. + * + * This interface models presence protocol plug-in. + * XIMP Framework loads a MXIMPProtocolPlugin + * instance for needed protocol, by instantiating + * protocol specific CXimpFwProtocolPluginBase + * object through ECom architecture. + * + * XIMP Framework calls methods defined in this + * interface to manage protocol connections based + * on clients requests. + * + * @ingroup ximpprotocolpluginapi + * @since S60 v3.2 + */ +class MXIMPProtocolPlugin : public MXIMPBase + { +public: + + /** Interface ID for the MXIMPProtocolPlugin. */ + enum { KInterfaceId = XIMP_IF_ID_PROTOCOL_PLUGIN }; + + +protected: + + /** + * Protected destructor. MXIMPProtocolPlugin + * objects can't be deleted through this interface. + */ + virtual inline ~MXIMPProtocolPlugin() {}; + + + +public: // Common + + + /** + * Primes presence protocol plug-in with its callback interface. + * + * Primes the presence protocol plug-in instance with + * its XIMP Framework side callback interface. + * Here given MXIMPProtocolPluginHost interface is + * implemented and owned by the XIMP Framework, and + * presence protocol plug-in must use it to communicate back to + * XIMP Framework direction. + * + * Call and interface lifetime convention: + * - This method is called by XIMP Framework before requesting + * any other requests from presence protocol plug-in instance. + * + * - This method is called just once for one MXIMPProtocolPlugin, + * just after loading MXIMPProtocolPlugin instance through ECom + * architecture. + * + * - Presence protocol plug-in instance must use here + * given specific host interface instance to communicate + * back to XIMP Framework direction from asynchronous + * requests. + * + * - The presence protocol plug-in implementation must + * store the here given host reference internally, so + * protocol plug-in implementation can access the host + * when needed. + * + * - Here given MXIMPProtocolPluginHost instance, is guaranteed + * to remain valid (usable), untill the protocol plug-in + * destroyed by deleting. However, protocol plug-in isn't + * allowed to call MXIMPProtocolPluginHost from its + * MXIMPProtocolPlugin::~MXIMPProtocolPlugin() destructor. + * + * + * @param [in] aHost + * Reference to host interface, what this MXIMPProtocolPlugin + * instance must use when communicating back to XIMP Framework + * direction. Object ownership is not trasfered. + */ + virtual void PrimeHost( + MXIMPProtocolPluginHost& aHost ) = 0; + + + +public: // Managing of protocol connections + + + /** + * Acquires a presence protocol connection. + * + * XIMP Framework calls this to acquire a presence protocol + * connection object for identified remote service and client. + * Protocol plug-in implementation can either: + * -# Always instantiate a new MXIMPProtocolConnection + * object to manage each client session as separated + * entity. + * + * -# Try to locate suitable existing connection from + * list of currently existing remote connections, + * and thus allow two or more client applications to share + * the remote presence connection. Protocol plug-in + * implementation can itself select in which circumstance + * to share the connection. Usually sharing should happen, + * when two remote connections are targeted to same remote + * service and to same user account. + * + * Presence Protocol plug-in must maintain internally list + * of existing presence service connection objects. + * Direct ownership of acquired presence service connection + * objects remain in the presence protocol plug-in. When + * XIMP Framework doesn't anymore need the certain + * acquired presence service connection, XIMP Framework + * disposes MXIMPProtocolConnection instance with + * MXIMPProtocolPlugin::ReleaseConnection(). If the same + * MXIMPProtocolConnection instance was returned multiple + * times from MXIMPProtocolPlugin::AcquireConnectionL(), + * it is still disposed only once with ReleaseConnection(), + * after closing the last utilizing client session. + * + * @param [in] aService + * Target address, credentials etc. + * info for remote presence connection. + * + * @param [in] aContextClient + * Object describing the client requesting the + * remote presence connection. + * + * @return New or existing presence protocol connection. + * Object ownership not transfered. However, + * returned object must remain valid (usable) + * untill XIMP Framework calls + * MXIMPProtocolPlugin::ReleaseConnection() to dispose + * the MXIMPProtocolConnection. + */ + virtual MXIMPProtocolConnection& AcquireConnectionL( + const MXIMPServiceInfo& aService, + const MXIMPContextClientInfo& aContextClient ) = 0; + + + /** + * Releases presence service connection. + * + * XIMP Framework calls this to releases previously acquired + * MXIMPProtocolConnection instance. XIMP Framework calls this + * method just once for each MXIMPProtocolConnection instance, event + * same MXIMPProtocolConnection instance were returned in several + * AcquireConnectionL() calls. + * + * @param [in] aConnection + * Connection object to release. + */ + virtual void ReleaseConnection( + MXIMPProtocolConnection& aConnection ) = 0; + + }; + + + +#endif // MXIMPFWPROTOCOLPLUGIN_H diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_protocol_plugin_api/inc/ximpprotocolpluginbase.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_protocol_plugin_api/inc/ximpprotocolpluginbase.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,132 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Base class for XIMP Framework protocol plug-ins. +* +*/ + +#ifndef CXIMPFWPROTOCOLPLUGINBASE_H +#define CXIMPFWPROTOCOLPLUGINBASE_H + +#include +#include +#include +#include +#include + + + +/** + * Base class for XIMP Framework protocol plug-ins. + * + * Base class for XIMP Framework protocol plug-ins. + * This class must be implemented by a XIMP Framework + * protocol plug-ins so that XIMP Framework is able to + * load a instance of it through ECom architecture and + * can call into it. XIMP Framework manages loaded + * CXIMPProtocolPluginBase object as thread singleton. + * + * Protocol plug-in must also implement MXIMPProtocolPlugin + * interface, so XIMP Framework can call and issue + * protocol and connection management requests to protocol + * plug-in. + * + * @see MXIMPProtocolPlugin + * @see MXIMPProtocolPluginHost + * @ingroup ximpprotocolpluginapi + * @since S60 v3.2 + */ +class CXIMPProtocolPluginBase : public CBase, + public MXIMPProtocolPlugin + { +public: + + /** + * ECom interface UID for the CXIMPProtocolPluginBase. + * + * This ECom interface UID is used: + * -# In protocol adaptation ECom registration resource file, + * to identify the implemented interface. Interface UID symbol + * @c XIMP_ECOM_IF_UID_PROTOCOL_PLUGIN_BASE_INTERFACE from + * ximpprotocolpluginifids.hrh can be directly included + * to protocol plug-in ECom registration resource file. + * + * -# Interface UID is used internally in XIMP Framework when + * resolving and instantiating available protocol implementations. + */ + enum { KInterfaceId = XIMP_ECOM_IF_UID_PROTOCOL_PLUGIN_BASE_INTERFACE }; + + +public: + + + /** + * Public destructor. + * Plugin can be deleted through this interface. + */ + inline ~CXIMPProtocolPluginBase(); + + + +public: + + /** + * Sets the plug-in destructor id. + * + * @param [in] aId + * Destructor id for the plug-in instance. + */ + inline void SetDestructorId( TUid aId ); + + + +protected: + + /** + * C++ default constructor. + */ + inline CXIMPProtocolPluginBase(); + + + +private: //Data + + /** + * OWN: ECom destructor ID for Presence Protocol plug-in. + * XIMPFw assignes the destructor ID during plug-in + * object construction. + */ + TUid iEcomDtorID; + + + /** + * OWN: Reserved member for future extension. + */ + TAny* iReserved1; + + + /** + * OWN: Reserved member for future extension. + */ + TAny* iReserved2; + + + /** + * OWN: Reserved member for future extension. + */ + TAny* iReserved3; + }; + +#include "ximpprotocolpluginbase.inl" + +#endif // CXIMPFWPROTOCOLPLUGINBASE_H diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_protocol_plugin_api/inc/ximpprotocolpluginbase.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_protocol_plugin_api/inc/ximpprotocolpluginbase.inl Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,48 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Base class for Presence Framework protocol plug-ins. +* +*/ + +#include + +// ----------------------------------------------------------------------------- +// CXIMPProtocolPluginBase::CXIMPProtocolPluginBase() +// C++ default constructor. +// ----------------------------------------------------------------------------- +// +inline CXIMPProtocolPluginBase::CXIMPProtocolPluginBase() + { + } + + +// ----------------------------------------------------------------------------- +// CXIMPProtocolPluginBase::~CXIMPProtocolPluginBase() +// Destructor notifies the ECom from plug-in implementation destruction. +// ----------------------------------------------------------------------------- +// +inline CXIMPProtocolPluginBase::~CXIMPProtocolPluginBase() + { + REComSession::DestroyedImplementation( iEcomDtorID ); + } + + +// ----------------------------------------------------------------------------- +// CXIMPProtocolPluginBase::SetDestructorId() +// ----------------------------------------------------------------------------- +// +inline void CXIMPProtocolPluginBase::SetDestructorId( TUid aId ) + { + iEcomDtorID = aId; + } diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_protocol_plugin_api/inc/ximpprotocolpluginifids.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_protocol_plugin_api/inc/ximpprotocolpluginifids.hrh Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,58 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework Protocol Plugin API interface IDs. +* +*/ + +#ifndef XIMPPROTOCOLPLUGINIFIDS_HRH +#define XIMPPROTOCOLPLUGINIFIDS_HRH + + +/** + * @defgroup ximpprotocolpluginapi XIMP Protocol Plugin API + * @ingroup ximpcoreapi + * + * XIMP Framework Protocol Plugin API contains abstract + * interfaces what protocol adaptation plug-ins must implement. + * XIMP Framework will instantiate protocol plug-ins through + * ECom framework and call methods declared in these interfces. + * + * XIMP Framework will instantiate and execute protocol + * implementations on dedicated Symbian OS server process. + * Protocol implementations are loaded on need basis, based + * on XIMP Framework clients requests. Protocol adaptation + * must derive from CXIMPProtocolPluginBase and make + * concrete protocol implementation available through ECom + * framework. + * + * @since S60 v3.2 + */ + +// ECom interface UID for XIMPFw Protocol Plugin Base +#define XIMP_ECOM_IF_UID_PROTOCOL_PLUGIN_BASE_INTERFACE 0x10282DD7 + + +// Protocol plugin IF id's +// 30xx - ximp related +// 31xx - presence related +// 32xx - instant messaging related + +// Interface IDs for XIMPFw Protocol Plugin API interfaces +#define XIMP_IF_ID_PROTOCOL_PLUGIN 3001 +#define XIMP_IF_ID_PROTOCOL_CONNECTION 3002 + + +#endif // XIMPPROTOCOLPLUGINIFIDS_HRH + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_protocol_plugin_api/ximp_core_protocol_plugin_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_protocol_plugin_api/ximp_core_protocol_plugin_api.metaxml Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,25 @@ + + + XIMP Core Protocol Plug-in API + XIMP Framework Protocol Plugin API contains abstract interfaces what protocol adaptation plug-ins must implement. XIMP Framework will instantiate protocol plug-ins through ECom framework and call methods declared in these interfces. This interface includes methods to: +- get the features of the protocol plug-in +- manage the service connections + c++ + ximpfw + + + + + + + + + + + + + + yes + no + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_protocol_plugin_host_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_protocol_plugin_host_api/group/bld.inf Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,31 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: File that exports the files belonging to +: XIMP Core Protocol Plug-in Host API +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +../inc/ximpprotocolrequestcompleteevent.h MW_LAYER_PLATFORM_EXPORT_PATH(ximpprotocolrequestcompleteevent.h) +../inc/ximpprotocolpluginhost.h MW_LAYER_PLATFORM_EXPORT_PATH(ximpprotocolpluginhost.h) +../inc/ximpprotocolpluginhostifids.hrh MW_LAYER_PLATFORM_EXPORT_PATH(ximpprotocolpluginhostifids.hrh) +../inc/ximpprotocolconnectionhostobserver.h MW_LAYER_PLATFORM_EXPORT_PATH(ximpprotocolconnectionhostobserver.h) +../inc/ximpprotocolconnectionhost.h MW_LAYER_PLATFORM_EXPORT_PATH(ximpprotocolconnectionhost.h) diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_protocol_plugin_host_api/inc/ximpprotocolconnectionhost.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_protocol_plugin_host_api/inc/ximpprotocolconnectionhost.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,242 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interface for XIMP protocol connection host. +* +*/ + +#ifndef MXIMPFWPROTOCOLCONNECTIONHOST_H +#define MXIMPFWPROTOCOLCONNECTIONHOST_H + + +#include +#include +#include + + +class MXIMPStatus; +class MXIMPObjectFactory; +class MXIMPProtocolConnectionHostObserver; +class MProtocolPresenceDataHost; +class MProtocolImDataHost; + + +// CLASS DECLARATION + +/** + * Interface for XIMP protocol connection host. + * This interface is implemented by XIMP Framework. + * + * XIMP protocol connection host interface defines + * requests that a XIMP protocol implementation + * can request (callback) from XIMP Framework. + * + * @see MXIMPProtocolConnection + * @ingroup ximpprotocolpluginhostapi + * @since S60 v3.2 + */ +class MXIMPProtocolConnectionHost : public MXIMPBase + { +public: + + /** Interface ID for the MXIMPProtocolConnectionHost. */ + enum { KInterfaceId = XIMP_IF_ID_PROTOCOL_CONNECTION_HOST }; + + +protected: + + /** + * Protected destructor. MXIMPProtocolConnectionHost instancies + * can't be destroyed via this interface. + */ + virtual inline ~MXIMPProtocolConnectionHost() {}; + + + +public: // Request completion handling + + + /** + * Notifies XIMP Framework that protocol connection has + * completed (successfully or otherwise) the request handling. + * + * @param [in] aReqId + * Request ID identifying the request which handling + * is completed. This must equal to value given in + * the processing initiation. If no pending XIMP + * protocol connection request is found with this + * request ID, protocol connection is paniced. + * + * @param [in] aResultCode + * Result code from request handling. + */ + virtual void HandleRequestCompleted( + TXIMPRequestId aReqId, + TInt aResultCode ) = 0; + + + + /** + * Notifies XIMP Framework that protocol connection has + * completed (successfully or otherwise) the request handling. + * + * @param [in] aReqId + * Request ID identifying the request which handling + * is completed. This must equal to value given in + * the processing initiation. If no pending XIMP + * protocol connection request is found with this + * request ID, protocol connection is paniced. + * + * @param [in] aResult + * Status object describing result from request handling. + * Object ownership is transfered always to XIMPFw. + * NULL value not allowed. + */ + virtual void HandleRequestCompleted( + TXIMPRequestId aReqId, + MXIMPStatus* aResult ) = 0; + + + + /** + * Notifies XIMP Framework that protocol connection has + * completed (successfully or otherwise) the request handling. + * + * @param [in] aReqId + * Request ID identifying the request which handling + * is completed. This must equal to value given in + * the processing initiation. If no pending XIMP + * protocol connection request is found with this + * request ID, protocol connection is paniced. + * + * @param [in] aResult + * Status object describing result from request handling. + * Object ownership is transfered always to XIMPFw. + * NULL value not allowed. + * + * @param [in] aParameter + * Additional request complete parameters. + * NULL if no additional parameters to transfer XIMPFw. + * Parameter may be single MXIMPBase derived + * object or MXIMPRestrictedObjectCollection object + * containing multiple objects. Ownership of given + * parameter (also the container and contained objects) + * is transfered always to XIMPFw. + */ + virtual void HandleRequestCompleted( + TXIMPRequestId aReqId, + MXIMPStatus* aResult, + MXIMPBase* aParameter ) = 0; + + + +public: // Connection status handling + + + /** + * Notifies XIMP Framework that protocol connection to + * remote XIMP service is terminated due certain reason. + * + * In this case, XIMP Framework doesn't try to re-open + * the client sessions. + * + * @param [in] aReason + * Status object describing more closely + * the protocol connection termination reason. + * Object ownership is transfered always to + * XIMP Framework. NULL value is allowed. + * + * @return The request id for the handle operation. + */ + virtual TXIMPRequestId HandleConnectionTerminated( + MXIMPStatus* aReason ) = 0; + + + +public: // Access to sub-interfaces + + + /** + * Gets reference to object factory interface. + * + * XIMP protocol connection implementation + * uses factory interface to instantiate XIMP + * objects. + * + * @return Object factory interface. + * No ownership is returned caller. + */ + virtual MXIMPObjectFactory& ObjectFactory() = 0; + + + + /** + * Gets reference to + * MProtocolPresenceDataHost interface. + * + * Presence protocol connection implementation uses returned + * data host interface to manage the Presence connection's + * presence auhtorization data. + * + * @return MProtocolPresenceAuthorizationDataHost interface. + * Interface ownership is not returned caller. + * Returned interface is guaranteed to remain valid (usable) + * as long as this source interface. + */ + virtual MProtocolPresenceDataHost& ProtocolPresenceDataHost() = 0; + + +public: // Observer registration + + + /** + * Reqisters XIMP connection host event observer. + * + * Reqisters observer to be notified from XIMP connection + * host events. + * + * @param [in] aObserver + * The observer to be notified from XIMP + * connection host events. If the observer is already + * registered, event filter associated to observer + * is updated. + * + * @param [in] aEventFilter + * List of event types that the observer accepts. + * Event types are identified with their interface IDs. + * If NULL, all event types are delivered to observer. + * In this case, observer must be prepared to handle + * gracefully unknown event types, which are added + * in future when extending XIMP Framework + * functionality. + */ + virtual void RegisterObserverL( + MXIMPProtocolConnectionHostObserver& aObserver, + const TArray* aEventFilter = NULL ) = 0; + + + /** + * Unregisters XIMP connection host observer. + * + * @param [in] aObserver + * The observer to unregister. + */ + virtual void UnregisterConnectionHostObserver( + MXIMPProtocolConnectionHostObserver& aObserver ) = 0; + + + }; + + + +#endif // MXIMPFWPROTOCOLCONNECTIONHOST_H diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_protocol_plugin_host_api/inc/ximpprotocolconnectionhostobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_protocol_plugin_host_api/inc/ximpprotocolconnectionhostobserver.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,100 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Protocol Connection Host interface. +* +*/ + +#ifndef MXIMPFWPROTOCOLCONNECTIONHOSTOBSERVER_H +#define MXIMPFWPROTOCOLCONNECTIONHOSTOBSERVER_H + +#include + + +class MXIMPBase; +class MXIMPProtocolConnectionHost; + + +// CLASS DECLARATION + +/** + * XIMP connection host observer interface. + * All XIMP connection host events are delivered + * through this interface back to protocol adaptation + * implementation. + * + * @ingroup ximpprotocolpluginhostapi + * @since S60 v3.2 + */ +class MXIMPProtocolConnectionHostObserver + { +protected: + + /** + * Protected destructor. Observer instancies + * can't be destroyed via this interface. + */ + virtual ~MXIMPProtocolConnectionHostObserver() {} + + +public: + + + /** + * Event callback. + * + * Events are delivered as MXIMPBase typed objects. + * Protocol adaptation can use MXIMPBase::InterfaceId() + * to identify the real event interface type. Observer + * can use cast methods provided in MXimpFw...Event + * interfaces to cast to real event interface. + * + * @param [in] aHost + * XIMP host object from where this event is coming. + * Provided as reference for protocol adaptation, so + * observer can distinguish events coming from different + * hosts if listened in single observer. + * + * @param [in] aEvent + * The event object. Client can use MXIMPBase::InterfaceId() + * to determine correct event type and interface cast + * methods from MXimpFw...Event interfaces to cast object + * to real event interface. + */ + virtual void HandleProtocolConnectionHostEvent( + const MXIMPProtocolConnectionHost& aHost, + const MXIMPBase& aEvent ) = 0; + + + + /** + * Extension point for this observer interface. + * + * Returns an pointer to MXIMPProtocolConnectionHostObserver + * extension interface or NULL if the concrete observer + * implementation doesn't support requested extension. + * + * @param [in] aInterfaceId + * Interface ID identifying the requested extension + * interface. + * + * @return Pointer to requested extension interface or NULL. + */ + virtual TAny* ProtocolConnectionHostObserverExtensionOrNull( + TInt32 aInterfaceId ) { ( void ) aInterfaceId; return NULL; } + + }; + + + +#endif // MXIMPFWPROTOCOLCONNECTIONHOSTOBSERVER_H diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_protocol_plugin_host_api/inc/ximpprotocolpluginhost.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_protocol_plugin_host_api/inc/ximpprotocolpluginhost.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,165 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Protocol Plugin host interface. +* +*/ + +#ifndef MXIMPFWPROTOCOLPLUGINHOST_H +#define MXIMPFWPROTOCOLPLUGINHOST_H + +#include +#include +#include + + +class MXIMPObjectFactory; +class MXIMPStatus; + + + +// CLASS DECLARATION + +/** + * Interface for XIMP Protocol Plugin host. + * This interface is implemented by XIMP Framework. + * + * XIMP Protocol Plugin host interface defines + * actions that a XIMP protocol plug-in can + * request (callback) from XIMP Framework. + * + * @see MXIMPProtocolPlugin + * @see CXIMPProtocolPluginBase + * @ingroup ximpprotocolpluginhostapi + * @since S60 v3.2 + */ +class MXIMPProtocolPluginHost : public MXIMPBase + { +public: + + /** Interface ID for the MXIMPProtocolPluginHost. */ + enum { KInterfaceId = XIMP_IF_ID_PROTOCOL_PLUGIN_HOST }; + + +protected: + + /** + * Protected destructor. XIMP Protocol Plugin host + * instancies can't be destroyed via this interface. + */ + virtual inline ~MXIMPProtocolPluginHost() {}; + + +public: + + + /** + * Gets reference to object factory interface. + * + * Returned object factory interface is used + * to instantiate XIMP data objects. + * + * @return Object factory interface. + * No ownership is returned caller. + */ + virtual MXIMPObjectFactory& ObjectFactory() = 0; + + + + /** + * Notifies XIMP Framework that XIMP protocol + * plug-in has completed (successfully or otherwise) + * the request handling. + * + * NOTE: This method isn't yet supported by XIMP Framework, + * since all MXIMPProtocolPlugin methods are currently + * synchronous. + * + * + * @param [in] aReqId + * Request ID identifying the request which handling + * is completed. This must equal to value given in + * the processing initiation. If no pending XIMP + * protocol plug-in request is found with this ID, + * plug-in is paniced. + * + * @param [in] aResultCode + * Result code from request handling. + */ + virtual void HandleRequestCompleted( TXIMPRequestId aReqId, + TInt aResultCode ) = 0; + + + /** + * Notifies XIMP Framework that XIMP protocol + * plug-in has completed (successfully or otherwise) + * the request handling. + * + * NOTE: This method isn't yet supported by XIMP Framework, + * since all MXIMPProtocolPlugin methods are currently + * synchronous. + * + * @param [in] aReqId + * Request ID identifying the request which handling + * is completed. This must equal to value given in + * the processing initiation. If no pending XIMP + * protocol plug-in request is found with this ID, + * plug-in is paniced. + * + * @param [in] aResult + * Status object describing result from request handling. + * Object ownership is transfered always to XIMPFw. + * NULL value not allowed. + */ + virtual void HandleRequestCompleted( TXIMPRequestId aReqId, + MXIMPStatus* aResult ) = 0; + + + /** + * Notifies XIMP Framework that XIMP protocol + * plug-in has completed (successfully or otherwise) + * the request handling. + * + * NOTE: This method isn't yet supported by XIMP Framework, + * since all MXIMPProtocolPlugin methods are currently + * synchronous. + * + * @param [in] aReqId + * Request ID identifying the request which handling + * is completed. This must equal to value given in + * the processing initiation. If no pending XIMP + * protocol plug-in request is found with this ID, + * plug-in is paniced. + * + * @param [in] aResult + * Status object describing result from request handling. + * Object ownership is transfered always to XIMPFw. + * NULL value not allowed. + * + * @param [in] aParameter + * Additional request complete parameters. + * NULL if no additional parameters to transfer XIMPFw. + * Parameter may be single MXIMPBase derived + * object or MXIMPRestrictedObjectCollection object + * containing multiple objects. Ownership of given + * parameter (also the container and contained objects) + * is transfered always to XIMPFw. + */ + virtual void HandleRequestCompleted( TXIMPRequestId aReqId, + MXIMPStatus* aResult, + MXIMPBase* aParameter ) = 0; + + }; + + +#endif // MXIMPFWPROTOCOLPLUGINHOST_H diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_protocol_plugin_host_api/inc/ximpprotocolpluginhostifids.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_protocol_plugin_host_api/inc/ximpprotocolpluginhostifids.hrh Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,55 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Protocol Plugin Host API interface IDs. +* +*/ + +#ifndef XIMPPROTOCOLPLUGINHOSTIFIDS_HRH +#define XIMPPROTOCOLPLUGINHOSTIFIDS_HRH + + +/** + * @defgroup ximpprotocolpluginhostapi XIMP Protocol Plugin Host API + * @ingroup ximpcoreapi + * + * Protocol Plugin Host API contains abstract interfaces what + * XIMP Framework implements, and what protocol adaptation + * plug-ins must use to communicate back to XIMP Framework + * direction. XIMP Framework registeres these callback interfaces + * to protocol adaptation plug-ins, after instantiating plug-in + * objects, but before using them any other way. + * + * MXIMPProtocolPluginHost interface is the callback interface for + * the MXIMPProtocolPlugin. + * + * MXIMPProtocolConnectionHost interface is the callback interface for + * the MXIMPProtocolConnection. + * + * @since S60 v3.2 + */ + +// Protocol plugin host IF id's +// 40xx - ximp related +// 41xx - presence related +// 42xx - instant messaging related + +// Interface IDs for XIMPFw Protocol Plugin Host interfaces +#define XIMP_IF_ID_PROTOCOL_PLUGIN_HOST 4001 +#define XIMP_IF_ID_PROTOCOL_CONNECTION_HOST 4002 +#define XIMP_IF_ID_PROTOCOL_REQUEST_COMPLETE_EVENT 4003 + + +#endif // XIMPPROTOCOLPLUGINHOSTIFIDS_HRH + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_protocol_plugin_host_api/inc/ximpprotocolrequestcompleteevent.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_protocol_plugin_host_api/inc/ximpprotocolrequestcompleteevent.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,85 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interface for protocol request completion event. +* +*/ + +#ifndef MXIMPFWPROTOCOLREQUESTCOMPLETEEVENT_H +#define MXIMPFWPROTOCOLREQUESTCOMPLETEEVENT_H + +#include +#include +#include + + + +/** + * Interface for protocol request completion event. + * This interface is implemented by XIMP Framework. + * + * This event is signalled from XIMP Framework to + * protocol adaptation to inform protocol implementation + * about its request completion (succesfully or otherwise). + * + * @ingroup ximpprotocolpluginhostapi + * @since S60 v3.2 + */ +class MXIMPProtocolRequestCompleteEvent : public MXIMPBase + { +public: + + /** Interface ID for the MXIMPProtocolRequestCompleteEvent. */ + enum { KInterfaceId = XIMP_IF_ID_PROTOCOL_REQUEST_COMPLETE_EVENT }; + + +protected: + + /** + * Protected destructor. + * Event objects can't be deleted via this interface. + */ + virtual ~MXIMPProtocolRequestCompleteEvent() {} + + +public: + + + /** + * Gets request id of the completed request. + * + * @return The request id. + */ + virtual const TXIMPRequestId& RequestId() const = 0; + + + /** + * Gets request completion code. + * + * Result code can be: + * - one of the system wide errors + * - one of the XIMP specific errors defined in ximperrors.hrh and + * in presenceerrors.hrh + * + * @return The result code. + */ + virtual TInt ResultCode() const = 0; + + + }; + + +#endif // MXIMPFWPROTOCOLREQUESTCOMPLETEEVENT_H + + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_core_protocol_plugin_host_api/ximp_core_protocol_plugin_host_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_core_protocol_plugin_host_api/ximp_core_protocol_plugin_host_api.metaxml Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,23 @@ + + + XIMP Core Protocol Plug-in Host API + API contains interfaces which protocol plug-ins use for communicating back to XIMP Framework direction. This API contains methods to indicate the connection status and the basic request complete methods. + c++ + ximpfw + + + + + + + + + + + + + + yes + no + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_im_base_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_im_base_api/group/bld.inf Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,29 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: File that exports the files belonging to +: XIMP IM Base API +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +../inc/imerrors.hrh MW_LAYER_PLATFORM_EXPORT_PATH(imerrors.hrh) +../inc/imoperationdefs.h MW_LAYER_PLATFORM_EXPORT_PATH(imoperationdefs.h) +../inc/imdlluids.hrh MW_LAYER_PLATFORM_EXPORT_PATH(imdlluids.hrh) \ No newline at end of file diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_im_base_api/inc/imdlluids.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_im_base_api/inc/imdlluids.hrh Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,73 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework IM DLL uids +* +*/ + +#ifndef IMDLLUIDS_HRH +#define IMDLLUIDS_HRH + + +// ----------------------------------------------------------------------------- +// Common dll uids +// ----------------------------------------------------------------------------- +// +#define XIMP_IM_DLL_UID_STATIC_INTERFACE 0x1000008d +#define XIMP_IM_DLL_UID_ECOM_PLUGIN 0x10009D8D + +// ----------------------------------------------------------------------------- +// Common UID 3 for the XIMP Framework dlls. +// ----------------------------------------------------------------------------- +// +#define XIMP_IM_DLL_UID_COMMON 0x10282DD8 +// ----------------------------------------------------------------------------- +// ECOM implementation UID +// ----------------------------------------------------------------------------- +// +#define XIMP_ECOM_IMPLEMENTATION_UID_IM_INTERFACE 0x2000B5ED + +//#define XIMP_ECOM_IMPL_UID_IM_CACHE_INTERFACE 0x2000B5EE + +// Factory interface for internal data structures +#define XIMP_ECOM_IMPL_UID_IM_DATAMODEL_INTERFACE 0x2000B5EF + +#define XIMP_ECOM_IMPL_UID_IM_PROCESSOR_INTERFACE 0x20015A10 +#define XIMP_ECOM_IMPL_UID_IM_OPERATION_INTERFACE 0x20015A0F + +// ----------------------------------------------------------------------------- +// Other dll uids +// ----------------------------------------------------------------------------- +// +#define XIMP_DLL_UID_IM_HOOK 0x2000B5F0 +#define XIMP_DLL_UID_IM_MANAGER 0x2000B5F1 +#define XIMP_DLL_UID_IM_DATAMODEL_HOOK 0x2000B5F2 +//#define XIMP_DLL_UID_IM_CACHE_HOOK 0x2000B5F3 +#define XIMP_DLL_UID_IM_PROCESSOR 0x2000B5F4 +#define XIMP_DLL_UID_IM_PROCESSOR_HOOK 0x20015A12 +#define XIMP_DLL_UID_IM_OPERATIONS_HOOK 0x20015A13 + + +#define XIMP_DLL_UID_IM_OPERATION 0x20015A11 + + +//#define XIMP_ECOM_IMPLEMENTATION_UID_IM_INTERFACE 0x2000B5EA +//#define XIMP_DLL_UID_IM_HOOK 0x2000B5EB +//#define XIMP_DLL_UID_IM_MANAGER 0x2000B5EC + + + + +#endif // IMDLLUIDS_HRH + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_im_base_api/inc/imerrors.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_im_base_api/inc/imerrors.hrh Thu Dec 17 08:54:49 2009 +0200 @@ -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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Protocol agnostic error codes for IM Feature Plugin. +* +*/ + +#ifndef IMERRORS_H +#define IMERRORS_H + + + +/** + * IM Feature Plugin error codes. + * + * Error codes returned from IM are either: + * -# System wide Symbian OS error codes (KErrNone, KErrNoMemory, etc.) + * -# Protocol agnostic IM Feature related error codes defined here. + * These error codes have range: KImErrBase ... KImErrLow. + * + * @ingroup Imbaseapi + * @since S60 + */ +enum + { + KImErrBase = -30131, + + /** + * Generic error code to indicate that request processing + * has failed on IM protocol level to some error, + * which isn't mapped to any other more detailed + * error code. + */ + KImErrServiceGeneralError = KImErrBase, + + /** + * Error not registered + */ + KImApiErrNotRegistered = KImErrBase - 2, + + /** + * Error already registered + */ + KImApiErrAlreadyRegistered = KImErrBase - 3, + + /** + * Error not logged + */ + KImApiErrNotLogged = KImErrBase - 4, + + /** + * The contact ID provided in send message API is invalid + */ + KImApiErrInvalidContactId = KImErrBase - 6, + + /** + * The user ID provided in send message API is invalid + */ + KImApiErrInvalidUserId = KImErrBase - 7, + + /** + * Not all the users have a valid User ID when sending message + */ + KImApiErrPartialSuccess = KImErrBase - 8, + + /** + * Missing mandatory elements + */ + KImApiErrMissingMandatoryElement = KImErrBase - 9, + + /** + * Special IM error code: the sender is blocked by the recipient + */ + KImApiErrSenderBlocked = KImErrBase - 10, + + /** + * Special IM error code: the recipient is not logged in + */ + KImApiErrRecipientNotLogged = KImErrBase - 11, + + /** + * Error code to indicate that IM service + * doesn't support the request issued by the client. + */ + KImErrServiceRequestTypeNotSupported = KImErrBase - 12, + + /** + * Error code to indicate that request handling has + * failed because the IM service is + * shutting down. + */ + KImErrServiceShutdown = KImErrBase - 13, + + /** + * Error code to indicate that IM service + * has terminated the IM session. + */ + KImErrServiceForceClosedSession = KImErrBase - 14, + + /** + * Error code to indicate that request handling has + * failed on IM protocol level to insufficient + * user authentication. + */ + KImErrServiceAuthenticationFailed = KImErrBase - 15, + + /** + * Error code to indicate that request handling has + * timeouted on IM protocol level. + */ + KImErrServicRequestTimeouted = KImErrBase - 16, + + /** + * Error code to indicate that IM protocol or + * protocol adaptation does not support given IM + * information field type. + */ + KImErrFieldTypeNotSupported = KImErrBase - 17, + + /** + * Error code to indicate that IM protocol or + * protocol adaptation does not support given IM + * information field value. + */ + KImErrFieldValueNotSupported = KImErrBase - 18, + + /** + * Error code to indicate that IM protocol or + * protocol adaptation does not support given + * IM group property. + */ + KImErrGroupPropertyNotSupported = KImErrBase - 19, + + /** + * Error code to indicate that request processing has failed + * on IM service, because the IM group amount + * exceeds the service specific limit. + */ + KImErrTooManyIMGroups = KImErrBase - 20, + + /** + * Error code to indicate that request processing has failed + * on IM service, because the IM amount + * exceeds the service specific limit. + */ + KImErrTooManyIM = KImErrBase - 21, + + /** + * Error code to indicate that IM service doesn't know + * the IM group, which was identified in the request. + */ + KImErrUnknownIMGroup = KImErrBase - 22, + + /** + * Error code to indicate that the IM service + * has refused from request handling, because user + * doesn't have enough credits for the operation. + */ + KImErrNotEnoughCredits = KImErrBase - 23, + + /** + * Out of range value + */ + KImErrOutOfRangeValue = KImErrBase - 24, + + /** + * Unsupported Context + */ + KImErrUnsupportedContext = KImErrBase - 25, + + /** + * Error code to indicate that request processing has failed + * on IM service, because the number of users + * exceeds the service specific limit. + */ + KImErrTooManyUsers = KImErrBase - 26, + + + /** + * Error code to indicate that specified + * group does't not exits + * + */ + KImErrGroupDoesNotExists = KImErrBase - 27, + + /** + * Error code to indicate that group + * already exists + * + */ + KImErrGroupAlreadyExists = KImErrBase - 28, + + /** + * Error code to indicate that group + * already joined + * + */ + KImErrGroupAlreadyJoined = KImErrBase - 29, + + /** + * Error code to indicate that + * no joined in the specified group. + * + */ + KImErrGroupNotJoined = KImErrBase - 30, + /** + * Error code to indicate that not having + * permission/access rights. + * + */ + KImErrNotHavingPermission = KImErrBase - 31, + + /** + * Error code to indicate that not having + * permission/access rights. + * + */ + KImErrJoiningNotAllowed = KImErrBase - 32, + + + KImErrLow = -30150 + }; + + +#endif // IMERRORS_H + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_im_base_api/inc/imoperationdefs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_im_base_api/inc/imoperationdefs.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,50 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP framework im operation definitions. + * +*/ + +#ifndef IMOPERATIONDEFS_H +#define IMOPERATIONDEFS_H + +#include + +// TODO: use ranges for operations types, that will make sure that +// the core, Presence and IM operations won't overlap + +/** + * PSC operations. + */ +namespace NImOps + { + enum TImOpTypes + { + // ----------------------------------------------- + // From client + // + ESendImMessage = 200, // 200 + ESendImMessageToGroup, // 201 + EHandleSentMessage, + EHandleReceiveMessage, + ESynthesiseImSubscription = 280, + EIMCleaner = 290 + }; + } + +#endif //IMOPERATIONDEFS_H + + + + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_im_base_api/ximp_im_base_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_im_base_api/ximp_im_base_api.metaxml Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,13 @@ + + +ximp_im_base_api +This is a API that provides the common error codes, plugin UIDs and operation types of instant messaging base. +c++ +ximp_im_base_api + + + +yes +no + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_im_data_model_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_im_data_model_api/group/bld.inf Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,33 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: File that exports the files belonging to +: XIMP IM Data Model API +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +../inc/imdatamodelifids.hrh MW_LAYER_PLATFORM_EXPORT_PATH(imdatamodelifids.hrh) +../inc/imconversationinfo.h MW_LAYER_PLATFORM_EXPORT_PATH(imconversationinfo.h) +../inc/imgroupinfo.h MW_LAYER_PLATFORM_EXPORT_PATH(imgroupinfo.h) +../inc/imobjectfactory.h MW_LAYER_PLATFORM_EXPORT_PATH(imobjectfactory.h) +../inc/imsearchinfo.h MW_LAYER_PLATFORM_EXPORT_PATH(imsearchinfo.h) +../inc/iminvitationinfo.h MW_LAYER_PLATFORM_EXPORT_PATH(iminvitationinfo.h) + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_im_data_model_api/inc/imconversationinfo.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_im_data_model_api/inc/imconversationinfo.h Thu Dec 17 08:54:49 2009 +0200 @@ -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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interface for IM info object. +* +*/ + +#ifndef MIMCONVERSATIONINFO_H +#define MIMCONVERSATIONINFO_H + +#include +#include +#include +#include + + +class MXIMPIdentity; + + /** + * Common enumerated message type values for "messages" + * message type field. + * + * @ingroup imdatamodelapi + * + */ + enum TMessageTypes + { + + /** + * Message type is private. + */ + EPrivateMessage = 0, + + }; + +/** + * Interface for IM info object. + * + * IM info object presents single IM conversation + * IM info object holds the identity, message content, delivery result, conversation ID + * block entity display name + * + * + * @ingroup Imdatamodelapi + * + */ +class MImConversationInfo : public MXIMPBase + { +public: + + /** Interface ID for the MImConversationInfo. */ + enum { KInterfaceId = IM_IF_ID_CONVERSATION_INFO }; + + +public: + + /** + * Public destructor. + * Objects can be deleted through this interface. + */ + virtual ~MImConversationInfo() {} + + +public: + + /** + * Returns identity of the message. + * + * @return The identity of the message. + */ + virtual const MXIMPIdentity& MessageId() const = 0; + + virtual const TDesC16& TextMessage() const = 0; + + virtual const MDesCArray& RecipientL() const = 0; + /** + * Sets identity of the message. + * + * @param [in] aIdentity + * Identity of the message. + * Ownership of the argument is transfered to + * callee, if method succeeds without a leave. + * + * @leave KErrNoMemory if failed to allocate memory. + * @leave KErrArgument if NULL argument were provided. + */ + virtual void SetMessageIdL( + MXIMPIdentity* aIdentity ) = 0; + + + virtual void SetTextMessageL( + const TDesC16& aMessage ) = 0; + + virtual void SetRecipientL(const MDesCArray* aRecipients) = 0; + + + }; + + +#endif // MIMCONVERSATIONINFO_H + + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_im_data_model_api/inc/imdatamodelifids.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_im_data_model_api/inc/imdatamodelifids.hrh Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,35 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: IM Feature Plugin Data Model API interface IDs. +* +*/ + +#ifndef IMDATAMODELIFIDS_HRH +#define IMDATAMODELIFIDS_HRH + +// Data model IF id's +// 20xx - ximp related +// 21xx - presence related +// 22xx - instant messaging related + +#define IM_IF_ID_IDENTITY 2201 +#define IM_IF_ID_IM_OBJECT_FACTORY 2204 +#define IM_IF_ID_CONVERSATION_INFO 2202 + + + +#endif // IMDATAMODELIFIDS_HRH + + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_im_data_model_api/inc/imgroupinfo.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_im_data_model_api/inc/imgroupinfo.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,156 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interface for group info object. +* +*/ + +#ifndef MIMGROUPINFO_H +#define MIMGROUPINFO_H + +#include +#include +#include + + +class MXIMPIdentity; + + +/** + * Interface for group info object. + * + * Group info object presents single group and the group members + * in the group list. + * Group info object holds the identity, + * display name and members for the group. + * + * @ingroup Imdatamodelapi + * + */ +class MImGroupInfo : public MXIMPBase + { +public: + + /** Interface ID for the MImGroupInfo. */ + enum { KInterfaceId = IM_IF_ID_GROUP_INFO }; + + +public: + + + /** + * Public destructor. + * Objects can be deleted through this interface. + */ + virtual ~MImGroupInfo() {} + + + +public: + + /** + * Returns group identity value. + * + * @return The group identity value. + */ + virtual const MXIMPIdentity& GroupId() const = 0; + + + + /** + * Returns group display name value. + * + * @return The group display name value. + */ + virtual const TDesC16& GroupDisplayName() const = 0; + + + /** + * Returns group member identity value. + * + * @return The group member identity value. + */ + virtual const MXIMPIdentity& GroupMemberId() const = 0; + + + /** + * Returns group member display name value. + * + * @return The group member display name value. + */ + virtual const TDesC16& GroupMemberDisplayName() const = 0; + + + /** + * Sets group identity value. + * + * @param [in] aIdentity + * New group identity value. + * Ownership of the argument is transfered to + * callee, if method succeeds without a leave. + * + * @leave KErrNoMemory if failed to allocate memory. + * @leave KErrArgument if NULL argument were provided. + */ + virtual void SetGroupIdL( + MXIMPIdentity* aIdentity ) = 0; + + + + /** + * Sets group display name value. + * + * @param [in] aDisplayName + * New display name value. + * + * @leave KErrNoMemory if failed to allocate memory. + */ + virtual void SetGroupDisplayNameL( + const TDesC16& aDisplayName ) = 0; + + + /** + * Sets group member identity value. + * + * @param [in] aIdentity + * New group member identity value. + * Ownership of the argument is transfered to + * callee, if method succeeds without a leave. + * + * @leave KErrNoMemory if failed to allocate memory. + * @leave KErrArgument if NULL argument were provided. + */ + virtual void SetGroupMemberIdL( + MXIMPIdentity* aIdentity ) = 0; + + + /** + * Sets group member display name value. + * + * @param [in] aDisplayName + * New display name value. + * + * @leave KErrNoMemory if failed to allocate memory. + */ + virtual void SetGroupMemberDisplayNameL( + const TDesC16& aDisplayName ) = 0; + + + + }; + + +#endif // MIMGROUPINFO_H + + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_im_data_model_api/inc/iminvitationinfo.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_im_data_model_api/inc/iminvitationinfo.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,194 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interface for invitation info object. +* +*/ + +#ifndef MIMINVITATIONINFO_H +#define MIMINVITATIONINFO_H + +#include +#include +#include + + +class MXIMPIdentity; + + +/** + * Interface for invitation info object. + * + * Invitation info object presents single invitation and the member + * in the invitation list. Invitation info object holds the identity, + * display name, response and the member. + * + * @ingroup Imdatamodelapi + * + */ +class MImInvitationInfo : public MXIMPBase + { +public: + + /** Interface ID for the MImInvitationInfo. */ + enum { KInterfaceId = IM_IF_ID_INVITATION_INFO }; + + +public: + + + /** + * Public destructor. + * Objects can be deleted through this interface. + */ + virtual ~MImInvitationInfo() {} + + + +public: + + /** + * Returns invitation identity value. + * + * @return The invitation identity value. + */ + virtual const MXIMPIdentity& InvitationID() const = 0; + + + /** + * Returns inviting user ID value. + * + * @return The inviting user ID value. + */ + virtual const TDesC16& UserID() const = 0; + + + /** + * Returns group name value. + * + * @return The group name value. + */ + virtual const TDesC16& GroupName() const = 0; + + + /** + * Returns screen name value. + * + * @return The screen name value. + */ + virtual const TDesC16& ScreenName() const = 0; + + + /** + * Returns acceptance of the invitation. + * + * @return The acceptance of the invitation. + */ + virtual const TBool Accept() const = 0; + + + /** + * Returns response/description of acceptance. + * + * @return The response/description of acceptance. + */ + virtual const TDesC16& Response() const = 0; + + + + /** + * Sets invitation identity value. + * + * @param [in] aIdentity + * New invitation identity value. + * Ownership of the argument is transfered to + * callee, if method succeeds without a leave. + * + * @leave KErrNoMemory if failed to allocate memory. + * @leave KErrArgument if NULL argument were provided. + */ + virtual void SetInvitationIdL( + MXIMPIdentity* aIdentity ) = 0; + + + + /** + * Sets inviting user ID value. + * + * @param [in] aUser + * New User ID value. + * + * @leave KErrNoMemory if failed to allocate memory. + */ + virtual void SetUserIDL( + const TDesC16& aUser ) = 0; + + + /** + * Sets Group name value. + * + * @param [in] aGroup + * Group name value. + * Ownership of the argument is transfered to + * callee, if method succeeds without a leave. + * + * @leave KErrNoMemory if failed to allocate memory. + * @leave KErrArgument if NULL argument were provided. + */ + virtual void SetGroupNameL( + const TDesC16& aGroup ) = 0; + + + /** + * Sets screen name value. + * + * @param [in] aScreen + * screen name value. + * + * @leave KErrNoMemory if failed to allocate memory. + */ + virtual void SetScreenNameL( + const TDesC16& aScreen ) = 0; + + + /** + * Sets acceptance value. + * + * @param [in] aAccept + * Acceptance value. + * + * @leave KErrNoMemory if failed to allocate memory. + */ + virtual void SetAcceptL( + const TBool aAccept ) = 0; + + + /** + * Sets response value. + * + * @param [in] aResponse + * response value. + * + * @leave KErrNoMemory if failed to allocate memory. + */ + virtual void SetResponseL( + const TDesC16& aResponse ) = 0; + + + }; + + +#endif // MImINVITATIONINFO_H + + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_im_data_model_api/inc/imobjectfactory.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_im_data_model_api/inc/imobjectfactory.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,116 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interface for IM Feature Plugin object factory. +* +*/ + +#ifndef MIMOBJECTFACTORY_H +#define MIMOBJECTFACTORY_H + +#include +#include +#include +#include + +class MImGroupInfo; +class MImConversationInfo; +class MImInvitationInfo; +class MImSearchInfo; + +/** + * Interface for IM Feature Plugin IM object factory. + * + * IM object factory is used to instantiate + * data objects declared in data model API. + * + * MImObjectFactory interface can be obtained from + * MXIMPContext or MXIMPProtocolConnectionHost + * interfaces. + * + * @ingroup imdatamodelapi + * @since S60 + */ +class MImObjectFactory : public MXIMPBase + { +public: + + /** Interface ID for the MImObjectFactory. */ + enum { KInterfaceId = IM_IF_ID_IM_OBJECT_FACTORY }; + + +protected: + + /** + * Protected destructor. + * Object instancies can't be deleted via this interface. + */ + virtual ~MImObjectFactory() {} + + + + +public: // Group and similar info object types + + + /** + * Instantiates new IM group info object. + * + * @return New IM group info object instance. + * Object ownership is returned to caller. + * + * @leave KErrNoMemory if failed to allocate memory. + */ + //virtual MImGroupInfo* NewImGroupInfoLC() = 0; + + + /** + * Instantiates new im conversation info object. + * + * @return new im conversation info object instance. + * Object ownership is returned to caller. + * + * @leave KErrNoMemory if failed to allocate memory. + */ + virtual MImConversationInfo* NewImConversationInfoLC() = 0; + + + /** + * Instantiates new im invitation info object. + * + * @return new im invitation info object instance. + * Object ownership is returned to caller. + * + * @leave KErrNoMemory if failed to allocate memory. + */ + //virtual MImInvitationInfo* NewImInvitationInfoLC() = 0; + + + /** + * Instantiates new im search info object. + * + * @return im search info info object instance. + * Object ownership is returned to caller. + * + * @leave KErrNoMemory if failed to allocate memory. + */ + //virtual MImSearchInfo* NewImSearchInfoLC() = 0; + + }; + + + +#endif // MIMOBJECTFACTORY_H + + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_im_data_model_api/inc/imsearchinfo.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_im_data_model_api/inc/imsearchinfo.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,148 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interface for Search info object. +* +*/ + +#ifndef MIMSEARCHINFO_H +#define MIMSEARCHINFO_H + +#include +#include +#include +#include + + + +class MXIMPIdentity; + + +/** + * Interface for Search info object. + * + * Search info object presents single search. + * Search info object holds the identity,search limit and search results. + * + * + * @ingroup Imdatamodelapi + * + */ +class MImSearchInfo : public MXIMPBase + { +public: + + /** Interface ID for the MImSearchInfo. */ + enum { KInterfaceId = IM_IF_ID_SEARCH_INFO }; + + +public: + + /** + * Public destructor. + * Objects can be deleted through this interface. + */ + virtual ~MImSearchInfo() {} + + +public: + + /** + * Returns identity of the Search. + * + * @return The identity of the Search. + */ + virtual const MXIMPIdentity& SearchId() const = 0; + + + /** + * Returns the search index. + * + * @return The search index. + */ + virtual const TInt Index() const = 0; + + + /** + * Returns the number of search results. + * + * @return The number of search results. + */ + virtual const TInt Results() const = 0; + + + /** + * Returns the search result. + * + * @return The search result. + */ + virtual const CPtrC16Array& ResultArray() const = 0; + + + /** + * Sets identity of the search. + * + * @param [in] aIdentity + * Identity of the search. + * Ownership of the argument is transfered to + * callee, if method succeeds without a leave. + * + * @leave KErrNoMemory if failed to allocate memory. + * @leave KErrArgument if NULL argument were provided. + */ + virtual void SetSearchIdL( + MXIMPIdentity* aIdentity ) = 0; + + + /** + * Sets index of the search. + * + * @param [in] aIndex + * New search index value. + * + * @leave KErrNoMemory if failed to allocate memory. + */ + virtual void SetIndex( + const TInt aIndex ) = 0; + + + /** + * Sets number of results. + * + * @param [in] aResult + * New search result value. + * + * @leave KErrNoMemory if failed to allocate memory. + */ + virtual void SetResults( + const TInt aResult ) = 0; + + + /** + * Sets the searched result. + * + * @param [in] aResultArray + * New searched result value. + * + * @leave KErrNoMemory if failed to allocate memory. + */ + virtual void SetResultArray( + CPtrC16Array& aResultArray ) = 0; + + }; + + +#endif // MIMSEARCHINFO_H + + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_im_data_model_api/ximp_im_data_model_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_im_data_model_api/ximp_im_data_model_api.metaxml Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,15 @@ + + +ximp_im_data_model_api +This is a API that provides data model for instant messaging related operations like conversations. +c++ +imdatamodel + + + + + +yes +no + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_im_management_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_im_management_api/group/bld.inf Thu Dec 17 08:54:49 2009 +0200 @@ -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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: File that exports the files belonging to +: XIMP IM Management API +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +../inc/immanagementifids.hrh MW_LAYER_PLATFORM_EXPORT_PATH(immanagementifids.hrh) +../inc/imfeatures.inl MW_LAYER_PLATFORM_EXPORT_PATH(imfeatures.inl) +../inc/imconversation.h MW_LAYER_PLATFORM_EXPORT_PATH(imconversation.h) +../inc/imconversationevent.h MW_LAYER_PLATFORM_EXPORT_PATH(imconversationevent.h) +../inc/imfeatures.h MW_LAYER_PLATFORM_EXPORT_PATH(imfeatures.h) +../inc/imgroup.h MW_LAYER_PLATFORM_EXPORT_PATH(imgroup.h) +../inc/imgroupevent.h MW_LAYER_PLATFORM_EXPORT_PATH(imgroupevent.h) +../inc/iminvitation.h MW_LAYER_PLATFORM_EXPORT_PATH(iminvitation.h) +../inc/iminvitationevent.h MW_LAYER_PLATFORM_EXPORT_PATH(iminvitationevent.h) +../inc/imsearch.h MW_LAYER_PLATFORM_EXPORT_PATH(imsearch.h) +../inc/imsearchelement.h MW_LAYER_PLATFORM_EXPORT_PATH(imsearchelement.h) +../inc/imsearchevent.h MW_LAYER_PLATFORM_EXPORT_PATH(imsearchevent.h) +../inc/imaccesscontrollist.h MW_LAYER_PLATFORM_EXPORT_PATH(imaccesscontrollist.h) diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_im_management_api/inc/imaccesscontrollist.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_im_management_api/inc/imaccesscontrollist.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,86 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interface for IM context. +* +*/ + +#ifndef MIMACCESSCONTROLLIST_H +#define MIMACCESSCONTROLLIST_H + +#include +#include +#include +//#include + + +class MImObjectFactory; +class MImGroups; +class MImConversation; +class MImInvitation; +class MImSearch; + +/** + * Access control list interface for clients use. + * Defines the access rules to a resource as an access control list (ACL). + * The resource itself is identified at the time the ACL is assigned to the resource. + * Access control is support for the following resource types: IMGroup..... + + + * + * @ingroup immanagementapi + */ +class MImAccessControlList : public MXIMPBase + { +public: + + /** Interface ID for the MImAccessControlList. */ + enum { KInterfaceId = IM_IF_ID_ACCESSCONTROL_LIST }; + + +public: + + /** + * Stores moderators of the IM group + * @return The Array of moderators of the Im group + */ + virtual RPointerArray ImGroupModerateList() = 0; + /** + * Stores admins of the IM group + * @return The Array of admins of the Im group + */ + virtual RPointerArray ImGroupAdminList() = 0; + /** + * Stores ordinaries of the IM group + * @return The Array of ordinaries of the Im group + */ + virtual RPointerArray ImGroupOrdinaryList() = 0; + + +protected: + + /** + * Protected destructor. + * Instancies can't be destroyed via this interface. + */ + virtual ~MImAccessControlList() {} + + }; + + + + +#endif // MIMACCESSCONTROLLIST_H + + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_im_management_api/inc/imconversation.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_im_management_api/inc/imconversation.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,168 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: IM interface for clients use. +* +*/ + +#ifndef MIMCONVERSATIONIMP_H +#define MIMCONVERSATIONIMP_H + +#include +#include +#include +#include +#include "immanagementifids.hrh" + +class MImConversationInfo; +class MXIMPIdentity; +/** + * Conversation interface for clients use. + * Interface is implemented by the IM. + * + * @ingroup Immanagementapi + * + */ +class MImConversation : public MXIMPBase + { +public: + + /** Interface ID for the MImConversation. */ + enum { KInterfaceId = IM_IF_ID_CONVERSATION }; + +protected: + + /** + * Protected destructor. + * Object instancies can't be deleted via this interface. + */ + virtual ~MImConversation() {} + +public: + /** + * Send message to user(s) + * + * @param [in] aImMessage - Identification and content of the message. + * MImConversationInfo contains messageid, contenttype - text/content, content,....... + * @param [in] aRecipients - Recipients userid. + * + * /b Note: Possible error conditions + * /n 1. Invalid userid/recipient, user does not exist [KImApiErrInvalidUserId]. + * /n 2. Recipient user blocked the sender [KImApiErrSenderBlocked]. + * /n 3. Unsupported message context [KImErrUnsupportedContext]. + * /n 4. Message queue full [KImErrTooManyIM]. + */ + virtual TXIMPRequestId SendMessageL( const MImConversationInfo& aImMessage) = 0; + /** + * Forward message to user(s) + * + * @param [in] aImMessage - Identification and content of the message. + * MImConversationInfo contains messageid, contenttype - text/content, content,....... + * @param [in] aRecipients - Recipients userid. + * + * /b Note: Possible error conditions + * /n 1. Invalid userid/recipient, user does not exist [KImApiErrInvalidUserId]. + * /n 2. Recipient user blocked the sender [KImApiErrSenderBlocked]. + * /n 3. Unsupported message context [KImErrUnsupportedContext]. + * /n 4. Message queue full [KImErrTooManyIM]. + */ + //virtual TXIMPRequestId ForwardMessageL( const MImConversationInfo& aImMessage) = 0; + /** + * Send message to group. + * + * @param [in] aImMessage - Identification and content of the message. + * MImConversationInfo contains messageid, contenttype - text/content, content,....... + * @param [in] aUserIds - Recipients userid. + * + * /b Note: Possible error conditions + * /n 1. Invalid userid/recipient, user does not exist [KImApiErrInvalidUserId]. + * /n 2. Recipient user blocked the sender [KImApiErrSenderBlocked]. + * /n 3. Unsupported message context [KImErrUnsupportedContext]. + * /n 4. Message queue full [KImErrTooManyIM]. + */ + + + //virtual TXIMPRequestId SendMessageToGroupL( const MImConversationInfo& aImMessage, + // const TDesC* aGroupId ) = 0; + + /** + * Block user(s). + * + * @param [in] aUserIds - User id's need to be blocked + * + * /b Note: Possible error conditions + * /n 1. Userid doesn't exist [KImErrServiceGeneralError]. + * /n 2. The maximum number of users reached for the user in the list [KImErrTooManyUsers]. + */ + //virtual TXIMPRequestId BlockUsersL(const MDesCArray* aUserIds ) = 0; + + /** + * UnBlock User(s). + * + * @param [in] aUserIds - User Id's need to be unblocked + * + * /b Note: Possible error conditions + * /n 1. Userid doesn't exist [KImErrServiceGeneralError]. + * /n 2. The maximum number of users reached for the user in the list [KImErrTooManyUsers]. + */ + //virtual TXIMPRequestId UnBlockUsersL(const MDesCArray* aUserIds ) = 0; + + /** + * Get Blocked usersid's list + * + * /b Note: Possible error conditions + * /n 1. No block list in use [KImErrServiceGeneralError]. + */ + //virtual TXIMPRequestId GetBlockedUsersListL(void ) = 0; + + /** + * Retrieve the Message-Info structures of the undelivered instant messages. + * May use the retrieved message-info structures to inform the user about the new messages, or it may + * retrieve/reject/forward the instant messages automatically. + * + * @param [in] aImMessageId Identification for IM. + * @param [in] aGroupId Identifies the group to retrieve history. + * @param [in] aMessageCount The maximum number of message-info structures to be returned. + * @param [in] aDeliveryReportWanted If the user wants to order delivery report. + * + * /b Note: Possible error conditions. + * /n 1. Invalid group id [KImErrUnknownIMGroup]. + */ + //virtual TXIMPRequestId GetMessageListL( const MXIMPIdentity& aImMessageId, + // const TDesC* aGroupId, + // const TInt aMessageCount, + // TBool aDeliveryReportWanted) = 0; + + /** + * Reject the accumulated messages in the server. + * + * @param [in] aImMessageId Identifies the messages to be removed + * + * /b Note: Possible error conditions + * /n 1. Invalid message-id [KImErrFieldValueNotSupported]. + */ + //virtual TXIMPRequestId RejectMessageL( const MXIMPIdentity& aImMessageId)= 0; + + + private: + // Message Info: + // Identity Messageid; + // Message content text + // Screenname + // Deliver Report required + }; + + +#endif // MIMCONVERSATIONIMP_H + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_im_management_api/inc/imconversationevent.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_im_management_api/inc/imconversationevent.h Thu Dec 17 08:54:49 2009 +0200 @@ -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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Event interface for IM. +* +*/ + +#ifndef MIMCONVERSATIONEVENT_H +#define MIMCONVERSATIONEVENT_H + +#include +#include +#include + +class MImConversationInfo; +/** + * Event interface for message content. + * + * This interface is implemented by the IM and + * event object is signalled to registered client observers + * through MPrFwIMContextObserver observer interface. + * This event notifies clients about changes in + * message content. + * + * IM signals this event when: + * - New message is received from protocol. + * - Delivery report is received from the protocol + * + * @ingroup Immanagementapievents + * + */ +class MImConversationEvent : public MXIMPBase + { +public: + /** Interface ID for the MImConversationEvent. */ + enum { KInterfaceId = IM_IF_ID_CONVERSATION_EVENT }; + + +protected: + + /** + * Protected destructor. + * Object instancies can't be deleted via this interface. + */ + virtual ~MImConversationEvent() {} + + +public: // Access to "delta information" + + + /** + * Gets the count of newly received text messages. + * + * @return The count of newly received text messages. + */ + virtual TInt NewTextMessageCount() const = 0; + + + /** + * Gets received text message by index. + * + * @param [in] aIndex + * The index of the text message to get. + * + * @return The received text message entry from given index. + */ + virtual const MImConversationInfo& NewTextMessage( TInt aIndex ) const = 0; + + + /** + * Gets the count of newly received binary messages. + * + * @return The count of newly received binary messages. + */ + //virtual TInt NewContentMessageCount() const = 0; + + + /** + * Gets received binary message by index. + * + * @param [in] aIndex + * The index of the binary message to get. + * + * @return The received binary message entry from given index. + */ + //virtual const MImConversationInfo& NewContentMessage( TInt aIndex ) const = 0; + + + /** + * Gets the count of message delivery report. + * + * @return The count of message delivery report. + */ + //virtual TInt DeliveryReportCount() const = 0; + + + /** + * Gets message delivery report by index. + * + * @param [in] aIndex + * The index of the message delivery report to get. + * + * @return The message delivery report entry from given index. + */ + //virtual const MImConversationInfo& DeliveryReport( TInt aIndex ) const = 0; + + + /** + * Gets the count of blocked entity. + * + * @return The count of blocked entity. + */ + //virtual TInt BlockedEntityCount( TInt aIndex ) const = 0; + + + /** + * Gets blocked entity by index. + * + * @param [in] aIndex + * The index of the blocked entity to get. + * + * @return The blocked entity entry from given index. + */ + //virtual const MImConversationInfo& BlockedEntity( TInt aIndex ) const = 0; + + + /** + * Gets the count of undelivered messages. + * + * @return The count of undelivered messages. + */ + //virtual TInt UndeliveredMessageCount() const = 0; + + + /** + * Gets undelivered message by index. + * + * @param [in] aIndex + * The index of the undelivered message to get. + * + * @return The undelivered message entry from given index. + */ + //virtual const MImConversationInfo& UndeliveredMessage( TInt aIndex ) const = 0; + + + /** + * Gets the count of rejected messages. + * + * @return The count of rejected messages. + */ + //virtual TInt RejectedMessageCount() const = 0; + + + /** + * Gets rejected message by index. + * + * @param [in] aIndex + * The index of the rejected message to get. + * + * @return The rejected message entry from given index. + */ + //virtual const MImConversationInfo& RejectedMessage( TInt aIndex ) const = 0; + + + /** + * Gets the count of on going conversations. + * + * @return The count of on going conversations. + */ + //virtual TInt ConversationCount() const = 0; + + + /** + * Gets on going conversation by index. + * + * @param [in] aIndex + * The index of the on going conversation to get. + * + * @return The on going conversation entry from given index. + */ + //virtual const MImConversationInfo& Conversation( TInt aIndex ) const = 0; + + + }; + + +#endif // MIMCONVERSATIONEVENT_H + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_im_management_api/inc/imfeatures.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_im_management_api/inc/imfeatures.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,174 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interface for IM context. +* +*/ + +#ifndef MIMFEATURES_H +#define MIMFEATURES_H + +#include +#include +#include +#include + + +class MImObjectFactory; +class MImGroups; +class MImConversation; +class MImInvitation; +class MImSearch; + +/** + * Interface for IM features. + * This interface is implemented by the IM. + * + * MImFeatures is root interface for accessing + * and updating im data to remote im service. + * IM client binds MXIMPContext interface + * to desired remote im service and creates + * MImFeatures interface to access the Im feature plugin related + * methods to publish and access IM data. + * + * Following sub interfaces can be accessed from + * from MImFeatures: + * - MImObjectFactory + * - MImGroupInfo + * - MImConversation + * - MImInvitation + * - MImSearch + * + * All IM events (context state, im data, + * request completion etc. ones) are delivered through + * MImContextObserver interface. + * + * @ingroup immanagementapi + * @since S60 + */ +class MImFeatures : public MXIMPBase + { +public: + + /** Interface ID for the MImFeatures. */ + enum { KInterfaceId = XIMP_ECOM_IF_UID_IM_INTERFACE }; + + +public: + + /** + * Factory method to instantiate MImFeatures. + * + * Factory method to instantiate platform default + * MXIMPClient implementation through the ECom. + * If the default IM Feature isn't supported + * in the platform, leaves with errorcode signalled + * from ECom. + * + * @return The new Im client object. Object + * ownership is returned to caller. + */ + static inline MImFeatures* NewL( MXIMPContext* aContext ); + + /** + * Public destructor. + * Objects can be deleted through this interface. + */ + virtual inline ~MImFeatures(); + +protected: + + /** + * Default constructor to zero initialize + * the iEcomDtorID member. + */ + inline MImFeatures(); + + +public: //Sub interfaces for im context + + + /** + * Gets reference to im object factory interface. + * + * Returned object factory interface is used + * to instantiate im objects. + * + * @return Object factory interface. + * No ownership is returned caller. + */ + virtual MImObjectFactory& ImObjectFactory() const = 0; + + + /** + * Gets reference to im object factory interface. + * + * Returned object factory interface is used + * to instantiate im objects. + * + * @return Object factory interface. + * No ownership is returned caller. + */ + //virtual MImDataCache& ImDataAccess() const = 0; + + + /** + * Gets reference to im groups interface. + * + * @return Requested interface. + * No ownership is returned caller. + */ + //virtual MImGroups& ImGroups() const = 0; + + + + /** + * Gets reference to im conversation interface. + * + * @return Requested interface. + * No ownership is returned caller. + */ + virtual MImConversation& ImConversation() const = 0; + + + + /** + * Gets reference to Im invitation interface. + * + * @return Requested interface. + * No ownership is returned caller. + */ + //virtual MImInvitation& ImInvtation() const = 0; + + + /** + * Gets reference to im search interface. + * + * @return Requested interface. + * No ownership is returned caller. + */ + //virtual MImSearch& ImSearch() const = 0; + +private: // Data + + //OWN: ECom destructor ID + TUid iEcomDtorID; + }; + +#include + + +#endif // MIMFEATURES_H + + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_im_management_api/inc/imfeatures.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_im_management_api/inc/imfeatures.inl Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,64 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: IM Features interface used by XIMP IM clients. +* +*/ + +#include + + +// ----------------------------------------------------------------------------- +// MImFeatures::NewL( MXIMPContext* aContext) implementation +// Factory method to instantiate the platform default +// MImFeatures implementation through the ECom framework. +// ----------------------------------------------------------------------------- +// +inline MImFeatures* MImFeatures::NewL(MXIMPContext* aContext ) + { + _LIT8( KXIMPIMDefaultData, XIMP_ECOM_DEFAULT_DATA_IM_INTERFACE ); + + TEComResolverParams resolvingParams; + resolvingParams.SetDataType( KXIMPIMDefaultData ); + resolvingParams.SetWildcardMatch( ETrue ); + //TInt auid = 0x2000B5F4; ///MImFeatures::KInterfaceId + TAny* imp = REComSession::CreateImplementationL( TUid::Uid( MImFeatures::KInterfaceId), + _FOFF( MImFeatures, iEcomDtorID ), + aContext, resolvingParams ); + + return reinterpret_cast< MImFeatures* >( imp ); + } + + +// ----------------------------------------------------------------------------- +// MImFeatures::MImFeatures() implementation +// Zero initializes the iEcomDtorID member. +// ----------------------------------------------------------------------------- +// +inline MImFeatures::MImFeatures() + { + iEcomDtorID = TUid::Null(); + } + + +// ----------------------------------------------------------------------------- +// MImFeatures::~MImFeatures() +// Destructor notifies the ECom from implementation destruction. +// ----------------------------------------------------------------------------- +// +inline MImFeatures::~MImFeatures() + { + REComSession::DestroyedImplementation( iEcomDtorID ); + } + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_im_management_api/inc/imgroup.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_im_management_api/inc/imgroup.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,347 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: IM group handling interface for clients use. +* +*/ + +#ifndef MIMGROUPS_H +#define MIMGROUPS_H + + +#include +#include +#include "imaccesscontrollist.h" +#include "imaccesscontrollistimp.h" +#include + +class MImGroupInfo; +class MImAccessControlList; +/** + * IM group handling interface for clients use. + * Interface is implemented by the IM. + * + * MImGroups provides services for + * Im clients to manage groups + * and group members. It provides also services to + * subscribe notifications from IM group list changes + * and from individual IM group changes. + * + * Client can retrieve MImGroups interface from + * MImContext interface. + * + * @ingroup Immanagementapi + * + */ +class MImGroups : public MXIMPBase + { +public: + + /** Interface ID for the MImGroups. */ + enum { KInterfaceId = IM_IF_ID_GROUPS }; + + +protected: + + /** + * Protected destructor. + * Object instancies can't be deleted via this interface. + */ + virtual ~MImGroups() {} + + +public: //IM Group management requests + + /** + * Subscribe to the specified group change notification + * + * @return The request ID identifying the issued request. + * + * /b Note: Possible error conditions + * /n 1. Group does't exists - KImErrGroupDoesNotExists + * /n 2. Not joined in this group - KImErrGroupNotJoined + * + * If the request is success whenever there is a change in the group + * user will be notified. + * + */ + virtual TXIMPRequestId SubscribeImGroupChangeL(const MXIMPIdentity& aGroupId)= 0; + + /** + * UnSubscribe to the specified group change notification + * + * @param [in] aGroupId + * Identification for IM group. + * + * @return The request ID identifying the issued request. + * + * /b Note: Possible error conditions + * /n 1. Group does't exists - KImErrGroupDoesNotExists + * /n 2. Not joined in this group - KImErrGroupNotJoined + * + * If the request is success whenever there is a change in the group + * user will not be notified. + * + */ + virtual TXIMPRequestId UnsubscribeImGroupChangeL(const MXIMPIdentity& aGroupId)= 0; + /** + * Creates IM group + * (By default private group) + * @param [in] aProperties + * To be created IM group Properties. + * + * @return The request ID identifying the issued request. + * + * /b Note: Possible error conditions + * /n 1. Group already exists - KImErrGroupAlreadyExists + * /n 2. Incorrect group properties is not - KImErrGroupPropertyNotSupported + * /n 3. Not allowed to create a group - KImErrNotHavingPermission + * + * If the request is success it will create a group + * + */ + virtual TXIMPRequestId CreateImGroupL(const MImGroupInfo& aProperties) = 0; + /** + * Join IM group + * + * @param [in] aGroupId + * Identification for IM group. + * + * @return The request ID identifying the issued request. + * + * /b Note: Possible error conditions + * /n 1. Group does't exists - KImErrGroupDoesNotExists + * /n 2. Group already joined - KImErrGroupAlreadyJoined + * /n 3. Joining this group is rejected - KImErrJoiningNotAllowed + * /n 4. Reached the maximum limit to users can be joined - KImErrTooManyIMGroups + * If the request is success user will be joined in the + * specified group with the mentioned screenname + */ + virtual TXIMPRequestId JoinImGroupL(const MXIMPIdentity& aGroupId) = 0; + /** + * Delete IM group + * + * @param [in] aGroupId + * Identification for IM group. + * + * @return The request ID identifying the issued request. + * + * /b Note: Possible error conditions + * /n 1. Group does't exists - KImErrGroupDoesNotExists + * /n 2. Not having access rigts to delete the group -KImErrNotHavingPermission + * If the request is success specified group will be deleted + */ + virtual TXIMPRequestId DeleteImGroupL(const MXIMPIdentity& aGroupId) = 0; + + + /** + * Leave IM group + * + * @param [in] aGroupId + * Identification for IM group. + * + * @return The request ID identifying the issued request. + * + * /b Note: Possible error conditions + * /n 1. Group does't exists - KImErrGroupDoesNotExists + * /n 2. Not joined in this group - KImErrGroupNotJoined + * If the request is success user will leave the group. + */ + virtual TXIMPRequestId LeaveImGroupL(const MXIMPIdentity& aGroupId) = 0; + + /** + * Get the specified group properties + * + * @param [in] aGroupId + * Identification for IM group. + * + * @return The request ID identifying the issued request. + * + * /b Note: Possible error conditions + * /n 1. Group does't exists - KImErrGroupDoesNotExists + * /n 2. Not joined in this group - KImErrGroupNotJoined + * + * If the request is success response will have the specified group properties + * + */ + virtual TXIMPRequestId GetImGroupPropertiesL( MXIMPIdentity* aGroupId )= 0; + + + /** + * Set/Modify the specified group properties + * + * @param [in] aGroupId + * Identification for IM group. + * @param [in] aGroupProps + * Group properties need to be set for the specified group + * + * @return The request ID identifying the issued request. + * + * /b Note: Possible error conditions + * /n 1. Group does't exists - KImErrGroupDoesNotExists + * /n 2. Incorrect group properties - KImErrGroupPropertyNotSupported + * /n 3. Not allowed(having permission) to change the group properties - KImErrNotHavingPermission + * + * If the request is success specified group properties will be updated + * + */ + virtual TXIMPRequestId SetImGroupPropertiesL( MXIMPIdentity* aGroupId, + MImGroupInfo* aGroupProps)= 0; + + /** + * Get access control list of users of the specified group + * + * @param [in] aGroupId + * Identification for IM group. + * + * @return The request ID identifying the issued request. + * + * /b Note: Possible error conditions + * /n 1. Group does't exists + * /n 2. User does't exists + * If the request is success responce will have access control list for the specified group + * + */ + virtual TXIMPRequestId GetImGroupAccessControlListL( const MXIMPIdentity& aGroupId )=0; + /** + * Set access control list of users for the specified group + * + * @param [in] aGroupId + * Identification for IM group. + * @param [in] acl + * access control list. + + * @return The request ID identifying the issued request. + * + * /b Note: Possible error conditions + * /n 1. Group does't exists + * /n 2. User does't exists + * /n 3. User don't have access control + * If the request is success responce will have access control for the specified group + * + */ + + virtual TXIMPRequestId SetImGroupAccessControLlistL( const MXIMPIdentity& aGroupId, + MImAccessControlList* aCl ) = 0; + + /** + * Set rejected list of users of the specified group + * + * @param [in] aGroupId + * Identification for IM group. + * @param [in] aRejectedList + * List of users need to be rejected from the group + * @param [in] aEnabledList + * List of users need to be added to the group + * + * @return The request ID identifying the issued request. + * + * /b Note: Possible error conditions + * /n 1. Group does't exists + * /n 2. User does't exists + * /n 3. Not allowed(having permission) to chage/update users list of the group + * If the request is success user permissions will be + * granted as per the request in the specified group + * + */ + virtual TXIMPRequestId SetImGroupRejectListL( const TDesC& aGroupId, + const MDesCArray* aRejectedList, + const MDesCArray* aEnabledList )= 0; + + + + public: //Prototypes for IM group member management requests + + /** + * Get list of members of the indicated group + * + * @param [in] aGroupId + * Identification for IM group. + * + * @return The request ID identifying the issued request. + * + * /b Note: Possible error conditions + * /n 1. Group does't exists - KImErrGroupDoesNotExists + * /n 2. Not Joined in this group - KImErrGroupNotJoined + * + * If the request is success,response will have list of members of the specified group + * + */ + virtual TXIMPRequestId GetImGroupMembersL( MXIMPIdentity* aGroupId )= 0; + /** + * Get lest of joined users for the specified group + * + * @param [in] aGroupId + * Identification for IM group. + * + * @return The request ID identifying the issued request. + * + * /b Note: Possible error conditions + * /n 1. Group does't exists + * /n 2. User does't exists + * If the Request is success client will get list of joined users for the specified group + * + */ + virtual TXIMPRequestId GetImGroupJoinedUsersListL( const MXIMPIdentity& aGroupId )=0; + + /** + * Add members to IM group + * + * @param [in] aGroupId + * Identification for IM group. + * @param [in] aUserList + * List of users need to be added to the group + * + * @return The request ID identifying the issued request. + * + * /b Note: Possible error conditions + * /n 1. Group does't exists + * /n 2. Not allowed(having permission) to change the group properties + * + * If the request is success user list will be added to the Group + * + */ + + virtual TXIMPRequestId AddImGroupMembersL( const MXIMPIdentity& aGroupId,const MDesCArray& aUserList )= 0; + + + /** + * Remove members from IM group + * + * @param [in] aGroupId + * Identification for IM group. + * @param [in] aUserList + * List of users need to be removed from the group + * + * @return The request ID identifying the issued request. + * + * /b Note: Possible error conditions + * /n 1. Group does't exists + * /n 2. Not allowed(having permission) to change the group properties + * + * If the request is success user list will be removed to the Group + * + */ + virtual TXIMPRequestId RemoveImGroupMembersL( const MXIMPIdentity& aGroupId, + const MDesCArray& aUserList )= 0; + + + + + + + }; + + + +#endif // MIMGROUPS_H \ No newline at end of file diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_im_management_api/inc/imgroupevent.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_im_management_api/inc/imgroupevent.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,186 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Event interface for group content. +* +*/ + +#ifndef MIMGROUPEVENT_H +#define MIMGROUPEVENT_H + +#include +#include +#include + + +class MXIMPIdentity; +class MImGroupInfo; +class MImDataSubscriptionState; + + +/** + * Event interface for group content. + * + * This interface is implemented by the Im and + * event object is signalled to registered client observers + * through MImContextObserver observer interface. + * This event notifies clients about changes in + * group content. + * + * Clients subscribe for this event with + * MImGroups::SubscribeImGroupChangeL(). + * + * Im signals this event when: + * - New subscribed data is received from protocol. + * - Data item data subscription status is updated by + * protocol adaptation. + * - When client unsubscribes the data item. + * - Im generates initial data notification + * to client automatically after clients subscription, + * when the initial data comes available from protocol. + * + * @ingroup imftmanagementapievents + * + */ +class MImGroupEvent : public MXIMPBase + { +public: + /** Interface ID for the MImGroupEvent. */ + enum { KInterfaceId = IM_IF_ID_GROUP_EVENT }; + + + +protected: + + /** + * Protected destructor. + * Object instancies can't be deleted via this interface. + */ + virtual ~MImGroupEvent() {} + + +public: // Access to "delta information" + + + /** + * Gets count of new groups. + * + * @return The count of new groups. + */ + virtual TInt NewGroupsCount() const = 0; + + + /** + * Gets group entry by index. + * + * @param [in] aIndex + * The index of the group entry to get. + * + * @return The group entry from given index. + */ + virtual const MImGroupInfo& NewGroup( + TInt aIndex ) const = 0; + + + /** + * Gets count of updated groups. + * + * @return The count of updated groups. + */ + virtual TInt UpdatedGroupsCount() const = 0; + + + /** + * Gets group entry by index. + * + * @param [in] aIndex + * The index of the group entry to get. + * + * @return The group entry from given index. + */ + virtual const MImGroupInfo& UpdatedGroup( + TInt aIndex ) const = 0; + + + /** + * Gets count of disappeared groups. + * + * @return The count of disappeared groups. + */ + virtual TInt DisappearedGroupsCount() const = 0; + + + /** + * Gets group entry by index. + * + * @param [in] aIndex + * The index of the group entry to get. + * + * @return The group entry from given index. + */ + virtual const MImGroupInfo& DisappearedGroup( + TInt aIndex ) const = 0; + + + +public: // Access to "current information" + + /** + * Gets count of current groups. + * + * Note that, current information is signalled only when + * the client refreshes the event data from Im cache, + * by re-issuing the data subscription. + * + * @return The count of current groups. + */ + virtual TInt CurrentGroupsCount() const = 0; + + + /** + * Gets group entry by index. + * + * Note that, current information is signalled only when + * the client refreshes the event data from Im cache, + * by re-issuing the data subscription. + * + * @param [in] aIndex + * The index of the group entry to get. + * + * @return The group entry from given index. + */ + virtual const MImGroupInfo& CurrentGroup( + TInt aIndex ) const = 0; + + + +public: // Access to subscription state + + + /** + * Returns subscription state object holding + * information about data items data subscription state. + * + * @return The data items data subscription state. + * Object ownership is not returned. + */ + virtual const MImDataSubscriptionState& DataSubscriptionState() const = 0; + + + }; + + +#endif // MIMGROUPEVENT_H + + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_im_management_api/inc/iminvitation.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_im_management_api/inc/iminvitation.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,156 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: IM Invitation handling interface for clients use. +* +*/ + +#ifndef MIMININVITATION_H +#define MIMININVITATION_H + + +#include +#include +#include +#include "immanagementifids.hrh" + +class MImInvitationInfo; +class MXIMPIdentity; + +/** + * IM Invitation handling interface for clients use. + * Interface is implemented by the IM. + * + * MImInvitation provides services for + * IM clients to manage Invitationitaion + * It provides also services to ??? + * + * Client can retrieve MImInvitation interface from + * MImContext interface. + * + * @ingroup Immanagementapi + * + */ +class MImInvitation : public MXIMPBase + { +public: + + /** Interface ID for the MImInvitation. */ + enum { KInterfaceId = IM_IF_ID_INVITATION}; + + +protected: + + /** + * Protected destructor. + * Object instancies can't be deleted via this interface. + */ + virtual ~MImInvitation() {} + + +public: //Invitation Requests + + /** Inviting group of users to join in the mentioned group + * + * @param [in] aUserID = IDs of the users to invite + * @param [in] InviteGroup = ID of the group to which the users + * are invited to join + * @param [in] aInviteInfo = Identification and content of the invitation. + * MImInvitationInfo contains InviteId, contenttype - text/content, invitereason,validityperiod....... + * + * @return The request id identifying the issued request. + * + * /b Note: Possible error conditions + * /n 1. Invalid invite ID + * /n 2. Invalid userId/screenname + * /n 3. Group does't exists + * If the request is success it will send a group invitation to the mentioned users + * + */ + virtual TXIMPRequestId ImGroupInviteL( const MDesCArray* aUserID, + const MXIMPIdentity& InviteGroup, + const MImInvitationInfo& aInviteInfo )= 0; + + /** Invite user to IM conversation + * + * @param [in] aUserID = ID of the user to invite + * @param [in] aInviteInfo = Identification and content of the invitation. + * MImInvitationInfo contains InviteId, contenttype - text/content, invitereason,validityperiod....... + * + * @return The request ID identifying the issued request. + * + * /b Note: Possible error conditions + * /n 1. Invalid Invite ID + * /n 2. Invalid userId + * If the request is success it will send a group invitation to the mentioned users + * + */ + virtual TXIMPRequestId ImInviteL( const TDesC& aUserID, + const MImInvitationInfo& aInviteInfo ) = 0; + + /** Cancel an im group invite + * + * @param [in] aUserID = IDs of the users to cancel invititation + * @param [in] InviteGroup = ID of the group to which the users + * are invited to join + * @param [in] aInviteInfo = Identification and content of the invitation. + * MImInvitationInfo contains InviteId, contenttype - text/content, invitereason,validityperiod....... + * @return The request ID identifying the issued request. + * + * /b Note: Possible error conditions + * /n 1. Invalid Invite ID + * /n 2. Invalid userId/Screenname + * /n 3. Group does't exists + * If the request is success it will send a group invitation to the mentioned users + * + */ + virtual TXIMPRequestId CancelImgroupInviteL( const MDesCArray* aUserID, + const MXIMPIdentity& InviteGroup, + const MImInvitationInfo& aInviteInfo )= 0; + + /** Cancel an IM conversation Invite + * + * @param [in] aUserID = ID of the user to cancel invitataion + * @param [in] aInviteInfo = Identification and content of the invitation. + * MImInvitationInfo contains InviteId, contenttype - text/content, invitereason,validityperiod....... + * @return The request ID identifying the issued request. + * + * /b Note: Possible error conditions + * /n 1. Invalid Invite ID + * /n 2. Invalid userId + * If the request is success it will send a group invitation to the mentioned users + * + */ + virtual TXIMPRequestId CancelImInviteL( const TDesC& aUserID, + const MImInvitationInfo& aInviteInfo ) = 0; + + /** Send response to invite + * + * @param [in] aRecipientUserId = UserID of the invitee + * @param [in] aInviteInfo = Identification and content of the invitation. + * MImInvitationInfo contains InviteId, contenttype - text/content, inviteresponse,acceptance....... + * @return The request ID identifying the issued request. + * + * /b Note: Possible error conditions + * /n 1. Invalid invite id + * /n 2. Invalid userId/screenname/groupName + * If the request is success it will send a group invitation to the mentioned users + * + */ + virtual TXIMPRequestId InviteResponseL( const TDesC& aRecipientUserId, + const MImInvitationInfo& aInviteInfo ) = 0; + }; +#endif // MIMININVITATION_H + + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_im_management_api/inc/iminvitationevent.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_im_management_api/inc/iminvitationevent.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,110 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Event interface for invitation content. +* +*/ + +#ifndef MIMINVITATIONEVENT_H +#define MIMINVITATIONEVENT_H + +#include +#include +#include + + +class MXIMPIdentity; +class MImInvitationInfo; +class MImDataSubscriptionState; + + +/** + * Event interface for invitation content. + * + * This interface is implemented by the IM and + * event object is signalled to registered client observers + * through MImContextObserver observer interface. + * This event notifies clients about changes in + * invitation content. + * + * IM signals this event when: + * - New invitation for group is received from protocol. + * - New invitation for conversation is received from protocol. + * - Invitation response for group is received + * - Invitation response for conversation is received + * @ininvitation immanagementapievents + * + */ +class MImInvitationEvent : public MXIMPBase + { +public: + /** Interface ID for the MImInvitationEvent. */ + enum { KInterfaceId = IM_IF_ID_INVITATION_EVENT }; + + + +protected: + + /** + * Protected destructor. + * Object instancies can't be deleted via this interface. + */ + virtual ~MImInvitationEvent() {} + + +public: // Access to "current information" + + + /** + * Gets count of invitations. + * + * @return The count of invitations. + */ + virtual TInt InvitationCount() const = 0; + + + /** + * Gets invitation response by index. + * + * @param [in] aIndex + * The index of the invitation entry to get. + * + * @return The invitation response from given index. + */ + virtual const MImInvitationInfo& InvitationResponse( + TInt aIndex ) const = 0; + + + + + +public: // Access to subscription state + + + /** + * Returns subscription state object holding + * information about data items data subscription state. + * + * @return The data items data subscription state. + * Object ownership is not returned. + */ + virtual const MImDataSubscriptionState& DataSubscriptionState() const = 0; + + + }; + + +#endif // MIMINVITATIONEVENT_H + + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_im_management_api/inc/immanagementifids.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_im_management_api/inc/immanagementifids.hrh Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,57 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Im Feature Plugin Management API interface IDs. +* +*/ + +#ifndef IMMANAGEMENTIFUIDS_HRH +#define IMMANAGEMENTIFUIDS_HRH + + + + + +// Management IF id's +// 20xx - ximp related +// 21xx - presence related +// 22xx - instant messaging related + + + +// Interface IDs for Im Feature Plugin Management API interfaces +#define IM_IF_ID_SEARCH 2211 +#define IM_IF_ID_GROUPS 2212 +#define IM_IF_ID_CONVERSATION 2213 +#define IM_IF_ID_INVITATION 2214 +#define IM_IF_ID_GROUP_EVENT 2215 +#define IM_IF_ID_CONVERSATION_EVENT 2216 +#define IM_IF_ID_INVITATION_EVENT 2217 +#define IM_IF_ID_SEARCH_EVENT 2218 +#define IM_IF_ID_PROTOCOL_IM_FEATURES 2219 +#define IM_IF_ID_ACCESSCONTROL_LIST 2220 +#define IM_CLSID_CIMFEATURESIMP 2221 +#define IM_IF_ID_SEARCHREQUEST 2222 + + +// Interface UID for IMfeatures interface +#define XIMP_ECOM_IF_UID_IM_INTERFACE 0x2000B5F4 + +// Default implementation resulution data +// for XIMP imfeature interterface Base ECom interface +#define XIMP_ECOM_DEFAULT_DATA_IM_INTERFACE "default" + + + +#endif // IMMANAGEMENTIFUIDS_HRH + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_im_management_api/inc/imsearch.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_im_management_api/inc/imsearch.h Thu Dec 17 08:54:49 2009 +0200 @@ -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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Search interface for clients use. +* +*/ + +#ifndef CIMSEARCH_H +#define CIMSEARCH_H + +#include +#include +#include "imsearchelementimp.h" +#include "immanagementifids.hrh" + +/** + * Search interface for clients use. + * Interface is implemented by the IM. + * + * @ingroup immanagementapi + * + */ +class MImSearch : public MXIMPBase + { +public: + + /** Interface ID for the MImSearch. */ + enum { KInterfaceId = IM_IF_ID_SEARCH }; + + +protected: + + /** + * Protected destructor. + * Object instancies can't be deleted via this interface. + */ + virtual ~MImSearch() {} + + + +public: + + /** + * Start search. + * + * @param [in] aImSearchId + * Identification for IM search. + * @param [in] aPairs + * Defines what is to be searched. + * @param [in] aSearchLimit + * How many results you want. + * + * @return The request ID identifying the issued request. + * + * /b Note: Possible error conditions + * /n 1. Invalid/Unsupported search-element [KImErrFieldTypeNotSupported]. + */ + virtual TXIMPRequestId ImSearchL( const MXIMPIdentity& aImSearchId, + const CSearchRequest& aPairs, + TInt aSearchLimit ) = 0; + + /** + * Continue search. + * + * @param [in] aImSearchId + * Identification for IM search. + * @param [in] aSearchID + * Which search is to be continued. + * @param [in] aIndex + * From which index the search is continued. + * + * @return The request ID identifying the issued request. + * + * /b Note: Possible error conditions + * /n 1. Initial search request was not sent / Invalid searchid [KImErrFieldValueNotSupported]. + * /n 2. Invalid Search-index / out of range [KImErrOutOfRangeValue]. + * /n 3. Search timeout (in case of continued search the subsequent request primitive is late) [KImErrServicRequestTimeouted]. + */ + virtual TXIMPRequestId ContinueImSearchL( const MXIMPIdentity& aImSearchId, + TInt aSearchID ) = 0; + + /** + * Stop search. + * + * @param [in] aImSearchId + * Identification for IM search. + * @param [in] aSearchID + * Which search is to be stopped. + * + * @return The request ID identifying the issued request. + * + * /b Note: Possible error conditions + * /n 1. Initial search request was not sent (invalid searchid) [KImErrFieldValueNotSupported]. + */ + virtual TXIMPRequestId StopImSearchL( const MXIMPIdentity& aImSearchId, + TInt aSearchID ) = 0; + + }; + + +#endif // CIMSEARCH_H + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_im_management_api/inc/imsearchelement.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_im_management_api/inc/imsearchelement.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,122 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of MImSearchRequest +* +*/ + + +#ifndef MIMSEARCHELEMENT_H +#define MIMSEARCHELEMENT_H +#include +#include +#include "imsearchelementimp.h" +#include "imapiobjbase.h" +#include "ximpidentity.h" +#include + +/* +* Supported search elements +*/ +enum TSearchElement + { + EUserAlias, + EUserOnlineStatus, + EUserEmailAddress, + EUserFirstName, + EUserID, + EUserLastName, + EUserMobileNumber, + EUserAgeMin, + EUserAgeMax, + EUserCountry, + EUserFriendlyName, + EUserCity, + EUserGender, + EUserIntention, + EUserInterestHobbies, + EUserMaritialStatus, + EGroupID, + EGroupName, + EGroupTopic, + EGroupUserIDJoined, + EGroupUserIDOwner + }; + +/* +* Search result element +*/ +enum TSearchResultType + { + EUserResult, + EGroupResult + }; + +/** + * Interface for IM search request object. + * + * + * + * @ingroup Imdatamodelapi + * + */ +class MImSearchRequest : public MXIMPBase +{ + public: + + /** Interface ID for the MImSearchRequest. */ + enum { KInterfaceId = IM_IF_ID_SEARCHREQUEST }; + + public: + + /** + * Public destructor. + * Objects instancies can be deleted through this interface. + */ + virtual ~MImSearchRequest() {} + + public: + /** + * Set search values. + * @param [in] aSearchId + * Identification for IM search. + * @param [in] aElement + * search key + * @param [in] aValue + * search value + * @return The request ID identifying the issued request. + * + * Note: Possible error conditions + * 1. Invalid/Unsupported Search-Element [KImErrFieldTypeNotSupported]. + * 2. Invalid/Unsupported Search-Value [KImErrFieldValueNotSupported]. + */ + virtual TXIMPRequestId SetRequestL( MXIMPIdentity* aSearchId, + TSearchElement aElement, + const TDesC& aValue ) = 0; + + /** + * Reset the object + * @param [in] aSearchId + * Identification for IM search. + * @return The request ID identifying the issued request. + */ + virtual TXIMPRequestId ResetL( MXIMPIdentity* aSearchId ) = 0; + + + +}; + + +#endif //MIMSEARCHELEMENT_H + +// End of File diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_im_management_api/inc/imsearchevent.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_im_management_api/inc/imsearchevent.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,86 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Event interface for ImSearch. +* +*/ + +#ifndef MIMSEARCHEVENT_H +#define MIMSEARCHEVENT_H + +#include +#include +#include "immanagementifids.hrh" +class MImSearchInfo; + + +/** + * Event interface for message content. + * + * This interface is implemented by the IM Feature Plugin and + * event object is signalled to registered client observers + * through MImSearchContextObserver observer interface. + * This event notifies clients about changes in + * search result. + * + * IM signals this event when: + * - Search result is received from protocol. + * @ingroup Immanagementapievents + * + */ +class MImSearchEvent : public MXIMPBase + { +public: + /** Interface ID for the MImSearchEvent. */ + enum { KInterfaceId = IM_IF_ID_SEARCH_EVENT }; + + +protected: + + /** + * Protected destructor. + * Object instancies can't be deleted via this interface. + */ + virtual ~MImSearchEvent() {} + + +public: + + + /** + * Gets the count of the searched results. + * + * @return The count of count of the searched results. + */ + virtual TInt SearchResultCount() const = 0; + + + /** + * Gets the searched result by index. + * + * @param [in] aIndex + * The index of the search. + * + * @return The searched result from given index. + */ + virtual const MImSearchInfo& SearchResult( TInt aIndex ) const = 0; + + + + + }; + + +#endif // MIMSEARCHEVENT_H + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_im_management_api/ximp_im_management_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_im_management_api/ximp_im_management_api.metaxml Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,14 @@ + + +ximp_im_management_api +This is a API that provides instant messaging related APIs like sending and receiving messages to the client. +c++ +immanager + + + + +yes +no + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_im_protocol_plugin_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_im_protocol_plugin_api/group/bld.inf Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,37 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: File that exports the files belonging to +: XIMP Im Protocol Plug-in API +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +../inc/protocolimconversation.h MW_LAYER_PLATFORM_EXPORT_PATH(protocolimconversation.h) +../inc/protocolimgroup.h MW_LAYER_PLATFORM_EXPORT_PATH(protocolimgroup.h) +../inc/protocoliminvitation.h MW_LAYER_PLATFORM_EXPORT_PATH(protocoliminvitation.h) +../inc/protocolimfeatures.h MW_LAYER_PLATFORM_EXPORT_PATH(protocolimfeatures.h) +../inc/protocolimfeatures.inl MW_LAYER_PLATFORM_EXPORT_PATH(protocolimfeatures.inl) +../inc/improtocolpluginifids.hrh MW_LAYER_PLATFORM_EXPORT_PATH(improtocolpluginifids.hrh) +../inc/protocolimsearch.h MW_LAYER_PLATFORM_EXPORT_PATH(protocolimsearch.h) +../inc/cprotocolimfeatures.h MW_LAYER_PLATFORM_EXPORT_PATH(cprotocolimfeatures.h) +../inc/cprotocolimfeatures.inl MW_LAYER_PLATFORM_EXPORT_PATH(cprotocolimfeatures.inl) + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_im_protocol_plugin_api/inc/cprotocolimfeatures.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_im_protocol_plugin_api/inc/cprotocolimfeatures.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,288 @@ +/* +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interface for IM Protocol connection object. +* +*/ + +#ifndef CPROTOCOLIMFEATURES_H +#define CPROTOCOLIMFEATURES_H + + +#include +#include +#include +#include + +class MProtocolImGroup; +class MProtocolImConversation; +class MProtocolImInvitation; +class MProtocolImSearch; +class MProtocolImDataHost; + + + +/** + * Interface for IM protocol connection object. + * Interface must be implemented by a XIMP Framework + * plug-ins. + * + * This interface models a connection from XIMP Framework to + * single remote IM service, over certain IM protocol + * implementation. XIMP Framework calls methods on this interface + * based on XIMP Framework client requests. + * + * XIMP Framework retrieves MXIMPProtocolConnection + * instances through MXIMPProtocolPlugin::AcquireConnectionL(). + * Same MXIMPProtocolConnection instance may be returned by multiple + * MXIMPProtocolPlugin::AcquireConnectionL() calls. In this case + * XIMP Framework shares MXIMPProtocolConnection instance + * by multiple clients, and MXIMPProtocolConnection lifetime is + * extended over utilizing client sessions. When last utilizing + * client session is succesfully closed with + * MXIMPProtocolConnection::CloseSession(), XIMP Framework + * disposes the MXIMPProtocolConnection instance with + * MXIMPProtocolPlugin::ReleaseConnection(). + * + * + * CProtocolImFeatures implementation must provide + * access following feature specific sub-interfaces: + * - MProtocolImGroup + * - MProtocolImConversation + * - MProtocolImInvitation + * - MProtocolImSearch + * + * Each provided sub-interface defines a set of its own + * im managements requests, relating to im groups,search,im and + * im invitation. + * IM calls these sub-interfaces to request on + * spesific im requests from protocol connection. + * + * @see MXIMPProtocolConnectionHost + * @ingroup protocolimpluginapi + * @since S60 + */ +class CProtocolImFeatures : public CBase, public MXIMPBase + { + +public: + + /** Interface ID for the CProtocolImFeatures. */ + enum { KInterfaceId = IM_IF_ID_PROTOCOL_IM_FEATURES }; + + /** All possible subinterfaces plugin may support. */ + enum KImFeatureSubInterfaces + { + EProtocolImGroup = 1, + EProtocolImConversation = 2, + EProtocolImInvitation = 4, + EProtocolImSearch = 8 + }; + + /** + * Factory method to instantiate CProtocolImFeatures. + * + * Factory method to instantiate platform default + * MXIMPClient implementation through the ECom. + * If the default IM Feature isn't supported + * in the platform, leaves with errorcode signalled + * from ECom. + * + * @return The new Im client object. Object + * ownership is returned to caller. + */ + static inline CProtocolImFeatures* NewL(); + + /** + * Factory method to instantiate CProtocolImFeatures with + * initial parameters and specified implementation UID. + * + * If the specified IM Feature isn't supported + * in the platform, leaves with errorcode signalled + * from ECom. + * + * @since S60 v5.0 + * @param aImplementationUid Implementation UID of the plugin to be loaded + * @param aInitParams Initialization parameters + * @return The new Im client object. + */ + static inline CProtocolImFeatures* NewL( TUid aImplementationUid, + TAny* aInitParams ); + + /** + * Protected destructor. MXIMPProtocolConnection + * objects can't be deleted through this interface. + * + * XIMP Framework disposes MXIMPProtocolConnection + * instances through MXIMPProtocolPlugin::ReleaseConnection(). + */ + virtual inline ~CProtocolImFeatures(); + + /** + * Returns bitfield representing supported sub-interfaces. Sub-interfaces + * are defined with KImFeatureSubInterfaces. If client tries to access + * non-supported sub-interface, panic will occur. + * + * @return Supported sub-interfaces as a bitwield. + */ + virtual TInt SupportedSubInterfaces() const = 0; + +protected: + + /** + * Default constructor to zero initialize + * the iEcomDtorID member. + */ + inline CProtocolImFeatures(); + + +public: // Access to sub-interfaces + + + /** + * Gets reference to im group interface. + * + * IM calls this method to retrieve a reference + * to protocols MProtocolImGroup interface + * implementation. + * + * Call and interface lifetime convention: + * - This method isn't called before protocol has signalled + * MXIMPProtocolConnection::OpenSessionL() succesfully completed. + * + * - XIMP Framework may call this method multiple times for + * for one MXIMPProtocolConnection instance. + * + * - Each call per one MXIMPProtocolConnection instance, + * must return reference to same interface instance. + * + * - Returned interface instance must remain valid (usable) + * untill last client session, using originating im protocol + * connection is successfully closed with + * MXIMPProtocolConnection::CloseSession(). + * + * @return Requested interface. + * interface ownership is not returned caller. + */ + virtual MProtocolImGroup& ImGroup() = 0; + + + + /** + * Gets reference to Im Conversation interface. + * + * IM calls this method to retrieve a reference + * to protocols MProtocolImConversation interface + * implementation. + * + * Call and interface lifetime convention: + * - This method isn't called before protocol has signalled + * MXIMPProtocolConnection::OpenSessionL() succesfully completed. + * + * - XIMP Framework may call this method multiple times for + * for one MXIMPProtocolConnection instance. + * + * - Each call per one MXIMPProtocolConnection instance, + * must return reference to same interface instance. + * + * - Returned interface instance must remain valid (usable) + * untill last client session, using originating im protocol + * connection is successfully closed with + * MXIMPProtocolConnection::CloseSession(). + * + * @return Requested interface. + * interface ownership is not returned caller. + */ + virtual MProtocolImConversation& ImConversation() = 0; + + + + /** + * Gets reference to im groups interface. + * + * IM calls this method to retrieve a reference + * to protocols MProtocolImInvitation interface + * implementation. + * + * Call and interface lifetime convention: + * - This method isn't called before protocol has signalled + * MXIMPProtocolConnection::OpenSessionL() succesfully completed. + * + * - XIMP Framework may call this method multiple times for + * for one MXIMPProtocolConnection instance. + * + * - Each call per one MXIMPProtocolConnection instance, + * must return reference to same interface instance. + * + * - Returned interface instance must remain valid (usable) + * untill last client session, using originating im protocol + * connection is successfully closed with + * MXIMPProtocolConnection::CloseSession(). + * + * @return Requested interface. + * interface ownership is not returned caller. + */ + virtual MProtocolImInvitation& ImInvitation() = 0; + + + + /** + * Gets reference to im search interface. + * + * IM calls this method to retrieve a reference + * to protocols MProtocolImSearch interface + * implementation. + * + * Call and interface lifetime convention: + * - This method isn't called before protocol has signalled + * MXIMPProtocolConnection::OpenSessionL() succesfully completed. + * + * - XIMP Framework may call this method multiple times for + * for one MXIMPProtocolConnection instance. + * + * - Each call per one MXIMPProtocolConnection instance, + * must return reference to same interface instance. + * + * - Returned interface instance must remain valid (usable) + * untill last client session, using originating im protocol + * connection is successfully closed with + * MXIMPProtocolConnection::CloseSession(). + * + * @return Requested interface. + * interface ownership is not returned caller. + */ + virtual MProtocolImSearch& ImSearch() = 0; + + + /** + * Sets data host. + * + * IM calls this method to specify datahost. + * + * @since S60 v5.0 + * @param aHost data host + * @return void + */ + virtual void SetHost(MProtocolImDataHost& aHost) = 0; + +private: // Data + + /** + * Unique instance identifier key + */ + TUid iEcomDtorID; + }; + +#include + +#endif // CPROTOCOLIMFEATURES_H diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_im_protocol_plugin_api/inc/cprotocolimfeatures.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_im_protocol_plugin_api/inc/cprotocolimfeatures.inl Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,80 @@ +/* +* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: IM Features interface used by XIMP IM clients. +* +*/ + +#include + + +// ----------------------------------------------------------------------------- +// CProtocolImFeatures::NewL() implementation +// Factory method to instantiate the platform default +// CProtocolImFeatures implementation through the ECom framework. +// ----------------------------------------------------------------------------- +// +inline CProtocolImFeatures* CProtocolImFeatures::NewL() + { + _LIT8( KXIMPIMDefaultData, "2219" ); + + TEComResolverParams resolvingParams; + resolvingParams.SetDataType( KXIMPIMDefaultData ); + resolvingParams.SetWildcardMatch( ETrue ); + TAny* imp = REComSession::CreateImplementationL( + TUid::Uid( CProtocolImFeatures::KInterfaceId), + _FOFF( CProtocolImFeatures, iEcomDtorID ), resolvingParams ); + + return reinterpret_cast< CProtocolImFeatures* >( imp ); + } + + +// ----------------------------------------------------------------------------- +// CProtocolImFeatures::NewL() implementation +// Factory method to instantiate the user specific implementation for +// CProtocolImFeatures API through the ECom framework. +// ----------------------------------------------------------------------------- +// +inline CProtocolImFeatures* CProtocolImFeatures::NewL( TUid aImplementationUid, + TAny* aInitParams ) + { + CProtocolImFeatures* ptr = reinterpret_cast( + REComSession::CreateImplementationL( + aImplementationUid, + _FOFF( CProtocolImFeatures, iEcomDtorID ), + aInitParams ) ); + + return ptr; + } + + +// ----------------------------------------------------------------------------- +// CProtocolImFeatures::CProtocolImFeatures() implementation +// Zero initializes the iEcomDtorID member. +// ----------------------------------------------------------------------------- +// +inline CProtocolImFeatures::CProtocolImFeatures() + { + iEcomDtorID = TUid::Null(); + } + + +// ----------------------------------------------------------------------------- +// CProtocolImFeatures::~CProtocolImFeatures() +// Destructor notifies the ECom from implementation destruction. +// ----------------------------------------------------------------------------- +// +inline CProtocolImFeatures::~CProtocolImFeatures() + { + REComSession::DestroyedImplementation( iEcomDtorID ); + } diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_im_protocol_plugin_api/inc/improtocolpluginifids.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_im_protocol_plugin_api/inc/improtocolpluginifids.hrh Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,37 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Protocol Plugin API interface IDs. +* +*/ + +#ifndef IMPROTOCOLPLUGINIFIDS_HRH +#define IMPROTOCOLPLUGINIFIDS_HRH + + + +// Protocol plugin IF id's +// 30xx - ximp related +// 31xx - presence related +// 32xx - instant messaging related + +// Interface IDs for XIMPFw Protocol Plugin API interfaces +#define IM_IF_ID_PROTOCOL_GROUPS 3201 +#define IM_IF_ID_PROTOCOL_CONVERSATION 3202 +#define IM_IF_ID_PROTOCOL_INVITATION 3203 +#define IM_IF_ID_PROTOCOL_SEARCH 3204 +//#define IM_IF_ID_PROTOCOL_IM_FEATURES 3205 + +#endif // IMPROTOCOLPLUGINIFIDS_HRH + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_im_protocol_plugin_api/inc/protocolimconversation.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_im_protocol_plugin_api/inc/protocolimconversation.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,201 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interface for IM protocol messaging object. +* +*/ + +#ifndef MPROTOCOLIMCONVERSATION_H +#define MPROTOCOLIMCONVERSATION_H + + +#include +#include +#include +#include + + +class MXIMPIdentity; +class MImConversationInfo; +/** + * Interface for IM protocol message handling object. + * Interface must be implemented by a IM protocol + * plug-ins. + * + * This interface defines actions that IM + * requests from a IM protocol connection to + * execute conversation related tasks. + * + * Protocol implementation must route requests received through + * this interface, to same remote IM service destination, + * as where the parent MXIMPProtocolConnection is connected. + * (Here the parent MXIMPProtocolConnection means the protocol + * connection instance from where this interface instance + * was retrieved.) + * + * @see MXIMPProtocolConnection + * @ingroup Improtocolpluginapi + * + */ +class MProtocolImConversation : public MXIMPBase + { +public: + + /** Interface ID for the MProtocolImConversation. */ + enum { KInterfaceId = IM_IF_ID_PROTOCOL_CONVERSATION }; + + +protected: + + /** + * Protected destructor. MProtocolImConversation + * instancies can't be destroyed via this interface. + */ + virtual inline ~MProtocolImConversation() {}; + +public: + /** + * Request the protocol to send a message. + * + * @param [in] aImMessage - Identification and content of the message. + * MImConversationInfo contains messageid, contenttype - text/content, content,....... + * @param [in] aRecipients - Recipients userid. + * @param [in] aReqId + * Request id identifying the issued request. + * + * /b Note: Possible error conditions + * /n 1. Invalid User-ID/Recipient user does not exist [KImApiErrInvalidUserId]. + * /n 2. Recipient user blocked the sender [KImApiErrSenderBlocked]. + * /n 3. Unsupported message context [KImErrUnsupportedContext]. + * /n 4. Message queue full [KImErrTooManyIM]. + */ + virtual void DoSendMessageL( const MImConversationInfo& aImMessage,TXIMPRequestId aReqId )= 0; + + /** + * Request the protocol to forward a message with binary content. + * Forward message to user(s) + * + * @param [in] aImMessage - Identification and content of the message. + * MImConversationInfo contains messageid, contenttype - text/content, content,....... + * @param [in] aRecipients - Recipients userid. + * @param [in] aReqId + * Request id identifying the issued request. + * + * /b Note: Possible error conditions + * /n 1. Invalid user-id/recipient user does not exist [KImApiErrInvalidUserId]. + * /n 2. Recipient user blocked the sender [KImApiErrSenderBlocked]. + * /n 3. Unsupported message context [KImErrUnsupportedContext]. + * /n 4. Message queue full [KImErrTooManyIM]. + */ + virtual void DoForwardMessageL( const MImConversationInfo& aImMessage,TXIMPRequestId aReqId) = 0; + + + /** + * Request the protocol to send message to group. + * + * @param [in] aImMessage - Identification and content of the message. + * MImConversationInfo contains messageid, contenttype - text/content, content,....... + * @param [in] aUserIds - Recipients userid. + * @param [in] aReqId + * Request id identifying the issued request. + * + * /b Note: Possible error conditions + * /n 1. Invalid user-id/recipient user does not exist [KImApiErrInvalidUserId]. + * /n 2. Recipient user blocked the sender [KImApiErrSenderBlocked]. + * /n 3. Unsupported message context [KImErrUnsupportedContext]. + * /n 4. Message queue full [KImErrTooManyIM]. + */ + virtual void DoSendMessageToGroupL( const MImConversationInfo& aImMessage, + const TDesC* aGroupId,TXIMPRequestId aReqId ) = 0; + +/** + * Request the protocol to block user(s). + * + * @param [in] aUserIds - User id's need to be blocked + * @param [in] aReqId + * Request ID identifying the issued request. + * + * /b Note: Possible error conditions + * /n 1. UserId doesn't exist [KImErrServiceGeneralError]. + * /n 2. The maximum number of users reached for the user in the list [KImErrTooManyUsers]. + */ + virtual TXIMPRequestId DoBlockUsersL(const MDesCArray* aUserIds ,TXIMPRequestId aReqId) = 0; +/** + * Request the protocol to UnBlock User(s). + * + * @param [in] aUserIds - User id's need to be unblocked + * @param [in] aReqId + * Request id identifying the issued request. + * + * /b Note: Possible error conditions + * /n 1. UserId doesn't exist [KImErrServiceGeneralError]. + * /n 2. The maximum number of users reached for the user in the list [KImErrTooManyUsers]. + */ + virtual TXIMPRequestId DoUnBlockUsersL(const MDesCArray* aUserIds,TXIMPRequestId aReqId ) = 0; + + /** + * Request the protocol to get blocked users list from server + * + * @param [in] aImMessageId Identification for IM. + * @param [in] aReqId + * Request id identifying the issued request. + * + * /b Note: Possible error conditions + * /n 1. No block list in use [KImErrServiceGeneralError]. + */ + virtual void DoGetBlockedListRequestL( const MXIMPIdentity& aImMessageId, + TXIMPRequestId aReqId ) = 0; + + + /** + * Request the protocol to retrieve the message-info structures of the undelivered instant messages. + * May use the retrieved Message-Info structures to inform the user about the new messages, or it May + * retrieve/reject/forward the instant messages automatically. + * + * @param [in] aImMessageId Identification for IM. + * @param [in] aGroupId Identifies the group to retrieve history. + * @param [in] aMessageCount The maximum number of message-info structures to be returned. + * @param [in] aDeliveryReportWanted If the user wats to order delivery report. + * @param [in] aReqId + * Request id identifying the issued request. + + * /b Note: Possible error conditions + * /n 1. Invalid group id [KImErrUnknownIMGroup]. + */ + virtual void DoGetMessageListL( const MXIMPIdentity& aImMessageId, + const TDesC* aGroupId, + const TInt aMessageCount, + TBool aDeliveryReportWanted, + TXIMPRequestId aReqId) = 0; + + /** + * Request the protocol to reject the accumulated messages in the server. + * + * @param [in] aImMessageId Identification for IM. + * @param [in] aMessageID Identifies the messages to be removed + * @param [in] aReqId + * Request id identifying the issued request. + * + * /b Note: Possible error conditions + * /n 1. Invalid message-id [KImErrFieldValueNotSupported]. + */ + virtual void DoRejectMessageL( const MXIMPIdentity& aImMessageId, + const TDesC& aMessageID, + TXIMPRequestId aReqId ) = 0; + + + }; + + + +#endif // MPROTOCOLIMCONVERSATION_H diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_im_protocol_plugin_api/inc/protocolimfeatures.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_im_protocol_plugin_api/inc/protocolimfeatures.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,274 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interface for IM Protocol connection object. +* +*/ + +#ifndef MPROTOCOLIMFEATURES_H +#define MPROTOCOLIMFEATURES_H + + +#include +#include +#include +#include + +class MProtocolImGroup; +class MProtocolImConversation; +class MProtocolImInvitation; +class MProtocolImSearch; +class MProtocolImDataHost; + + + +/** + * Interface for IM protocol connection object. + * Interface must be implemented by a XIMP Framework + * plug-ins. + * + * This interface models a connection from XIMP Framework to + * single remote IM service, over certain IM protocol + * implementation. XIMP Framework calls methods on this interface + * based on XIMP Framework client requests. + * + * XIMP Framework retrieves MXIMPProtocolConnection + * instances through MXIMPProtocolPlugin::AcquireConnectionL(). + * Same MXIMPProtocolConnection instance may be returned by multiple + * MXIMPProtocolPlugin::AcquireConnectionL() calls. In this case + * XIMP Framework shares MXIMPProtocolConnection instance + * by multiple clients, and MXIMPProtocolConnection lifetime is + * extended over utilizing client sessions. When last utilizing + * client session is succesfully closed with + * MXIMPProtocolConnection::CloseSession(), XIMP Framework + * disposes the MXIMPProtocolConnection instance with + * MXIMPProtocolPlugin::ReleaseConnection(). + * + * + * MProtocolImFeatures implementation must provide + * access following feature specific sub-interfaces: + * - MProtocolImGroup + * - MProtocolImConversation + * - MProtocolImInvitation + * - MProtocolImSearch + * + * Each provided sub-interface defines a set of its own + * im managements requests, relating to im groups,search,im and + * im invitation. + * IM calls these sub-interfaces to request on + * spesific im requests from protocol connection. + * + * @see MXIMPProtocolConnectionHost + * @ingroup protocolimpluginapi + * @since S60 + */ +class MProtocolImFeatures : public MXIMPBase + { + +public: + + /** Interface ID for the MProtocolImFeatures. */ + enum { KInterfaceId = IM_IF_ID_PROTOCOL_IM_FEATURES }; + + /** + * Factory method to instantiate MProtocolImFeatures. + * + * Factory method to instantiate platform default + * MXIMPClient implementation through the ECom. + * If the default IM Feature isn't supported + * in the platform, leaves with errorcode signalled + * from ECom. + * + * @return The new Im client object. Object + * ownership is returned to caller. + */ + static inline MProtocolImFeatures* NewL(); + + /** + * Factory method to instantiate MProtocolImFeatures with + * initial parameters and specified implementation UID. + * + * If the specified IM Feature isn't supported + * in the platform, leaves with errorcode signalled + * from ECom. + * + * @since S60 v5.0 + * @param aImplementationUid Implementation UID of the plugin to be loaded + * @param aInitParams Initialization parameters + * @return The new Im client object. + */ + static inline MProtocolImFeatures* NewL( TUid aImplementationUid, + TAny* aInitParams ); + + /** + * Protected destructor. MXIMPProtocolConnection + * objects can't be deleted through this interface. + * + * XIMP Framework disposes MXIMPProtocolConnection + * instances through MXIMPProtocolPlugin::ReleaseConnection(). + */ + virtual inline ~MProtocolImFeatures(); + + +protected: + + /** + * Default constructor to zero initialize + * the iEcomDtorID member. + */ + inline MProtocolImFeatures(); + + +public: // Access to sub-interfaces + + + /** + * Gets reference to im group interface. + * + * IM calls this method to retrieve a reference + * to protocols MProtocolImGroup interface + * implementation. + * + * Call and interface lifetime convention: + * - This method isn't called before protocol has signalled + * MXIMPProtocolConnection::OpenSessionL() succesfully completed. + * + * - XIMP Framework may call this method multiple times for + * for one MXIMPProtocolConnection instance. + * + * - Each call per one MXIMPProtocolConnection instance, + * must return reference to same interface instance. + * + * - Returned interface instance must remain valid (usable) + * untill last client session, using originating im protocol + * connection is successfully closed with + * MXIMPProtocolConnection::CloseSession(). + * + * @return Requested interface. + * interface ownership is not returned caller. + */ + virtual MProtocolImGroup& ImGroup(); + + + + /** + * Gets reference to Im Conversation interface. + * + * IM calls this method to retrieve a reference + * to protocols MProtocolImConversation interface + * implementation. + * + * Call and interface lifetime convention: + * - This method isn't called before protocol has signalled + * MXIMPProtocolConnection::OpenSessionL() succesfully completed. + * + * - XIMP Framework may call this method multiple times for + * for one MXIMPProtocolConnection instance. + * + * - Each call per one MXIMPProtocolConnection instance, + * must return reference to same interface instance. + * + * - Returned interface instance must remain valid (usable) + * untill last client session, using originating im protocol + * connection is successfully closed with + * MXIMPProtocolConnection::CloseSession(). + * + * @return Requested interface. + * interface ownership is not returned caller. + */ + virtual MProtocolImConversation& ImConversation() = 0; + + + + /** + * Gets reference to im groups interface. + * + * IM calls this method to retrieve a reference + * to protocols MProtocolImInvitation interface + * implementation. + * + * Call and interface lifetime convention: + * - This method isn't called before protocol has signalled + * MXIMPProtocolConnection::OpenSessionL() succesfully completed. + * + * - XIMP Framework may call this method multiple times for + * for one MXIMPProtocolConnection instance. + * + * - Each call per one MXIMPProtocolConnection instance, + * must return reference to same interface instance. + * + * - Returned interface instance must remain valid (usable) + * untill last client session, using originating im protocol + * connection is successfully closed with + * MXIMPProtocolConnection::CloseSession(). + * + * @return Requested interface. + * interface ownership is not returned caller. + */ + virtual MProtocolImInvitation& ImInvitation(); + + + + /** + * Gets reference to im search interface. + * + * IM calls this method to retrieve a reference + * to protocols MProtocolImSearch interface + * implementation. + * + * Call and interface lifetime convention: + * - This method isn't called before protocol has signalled + * MXIMPProtocolConnection::OpenSessionL() succesfully completed. + * + * - XIMP Framework may call this method multiple times for + * for one MXIMPProtocolConnection instance. + * + * - Each call per one MXIMPProtocolConnection instance, + * must return reference to same interface instance. + * + * - Returned interface instance must remain valid (usable) + * untill last client session, using originating im protocol + * connection is successfully closed with + * MXIMPProtocolConnection::CloseSession(). + * + * @return Requested interface. + * interface ownership is not returned caller. + */ + virtual MProtocolImSearch& ImSearch(); + + + /** + * Sets data host. + * + * IM calls this method to specify datahost. + * + * @since S60 v5.0 + * @param aHost data host + * @return void + */ + virtual void SetHost(MProtocolImDataHost& aHost) = 0; + +private: // Data + + /** + * Unique instance identifier key + */ + TUid iEcomDtorID; + }; + +#include + + + + +#endif // MPROTOCOLIMFEATURES_H diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_im_protocol_plugin_api/inc/protocolimfeatures.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_im_protocol_plugin_api/inc/protocolimfeatures.inl Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,115 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: IM Features interface used by XIMP IM clients. +* +*/ + +#include + + +// ----------------------------------------------------------------------------- +// MProtocolImFeatures::NewL() implementation +// Factory method to instantiate the platform default +// MProtocolImFeatures implementation through the ECom framework. +// ----------------------------------------------------------------------------- +// +inline MProtocolImFeatures* MProtocolImFeatures::NewL() + { + _LIT8( KXIMPIMDefaultData, "2219" ); + + TEComResolverParams resolvingParams; + resolvingParams.SetDataType( KXIMPIMDefaultData ); + resolvingParams.SetWildcardMatch( ETrue ); + TAny* imp = REComSession::CreateImplementationL( + TUid::Uid( MProtocolImFeatures::KInterfaceId), + _FOFF( MProtocolImFeatures, iEcomDtorID ), resolvingParams ); + + return reinterpret_cast< MProtocolImFeatures* >( imp ); + } + + +// ----------------------------------------------------------------------------- +// MProtocolImFeatures::NewL() implementation +// Factory method to instantiate the user specific implementation for +// MProtocolImFeatures API through the ECom framework. +// ----------------------------------------------------------------------------- +// +inline MProtocolImFeatures* MProtocolImFeatures::NewL( TUid aImplementationUid, + TAny* aInitParams ) + { + MProtocolImFeatures* ptr = reinterpret_cast( + REComSession::CreateImplementationL( + aImplementationUid, + _FOFF( MProtocolImFeatures, iEcomDtorID ), + aInitParams ) ); + + return ptr; + } + + +// ----------------------------------------------------------------------------- +// MProtocolImFeatures::MProtocolImFeatures() implementation +// Zero initializes the iEcomDtorID member. +// ----------------------------------------------------------------------------- +// +inline MProtocolImFeatures::MProtocolImFeatures() + { + iEcomDtorID = TUid::Null(); + } + + +// ----------------------------------------------------------------------------- +// MProtocolImFeatures::~MProtocolImFeatures() +// Destructor notifies the ECom from implementation destruction. +// ----------------------------------------------------------------------------- +// +inline MProtocolImFeatures::~MProtocolImFeatures() + { + REComSession::DestroyedImplementation( iEcomDtorID ); + } + + +// ----------------------------------------------------------------------------- +// MProtocolImGroup& MProtocolImFeatures::ImGroup() +// Dummy Implementation +// ----------------------------------------------------------------------------- +// +inline MProtocolImGroup& MProtocolImFeatures::ImGroup() + { + MProtocolImGroup* dummyGroup = NULL; + return *dummyGroup; + } + +// ----------------------------------------------------------------------------- +// MProtocolImInvitation& MProtocolImFeatures::ImInvitation() +// Dummy Implementation +// ----------------------------------------------------------------------------- +// +inline MProtocolImInvitation& MProtocolImFeatures::ImInvitation() + { + MProtocolImInvitation* dummyInvitation = NULL; + return *dummyInvitation; + } + +// ----------------------------------------------------------------------------- +// MProtocolImSearch& MProtocolImFeatures::ImSearch() +// Dummy Implementation +// ----------------------------------------------------------------------------- +// +inline MProtocolImSearch& MProtocolImFeatures::ImSearch() + { + MProtocolImSearch* dummySearch = NULL; + return *dummySearch; + } + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_im_protocol_plugin_api/inc/protocolimgroup.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_im_protocol_plugin_api/inc/protocolimgroup.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,300 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interface for protocol IM groups object. +* +*/ + + + +#ifndef MPROTOCOLIMGROUP_H +#define MPROTOCOLIMGROUP_H +#include +#include +#include +#include "improtocolifids.hrh" +class MXIMPIdentity; +/** + * Interface for IM protocol groups object. + * Interface must be implemented by a XIMP Framework protocol + * plug-ins. + * + * This interface defines actions that XIMP Framework + * requests from a IM protocol connection to + * execute groups related tasks. + * + * Protocol implementation must route requests received through + * this interface, to same remote IM service destination, + * as where the parent MXIMPProtocolConnection is connected. + * (Here the parent MXIMPProtocolConnection means the protocol + * connection instance from where this interface instance + * was retrieved.) + * + * @see MXIMPProtocolConnection + * @ingroup protocolimpluginapi + * + */ +class MProtocolImGroup : public MXIMPBase + { +public: + + /** Interface ID for the MProtocolImGroups. */ + enum { KInterfaceId = IM_IF_ID_PROTOCOL_GROUPS }; + + +protected: + + /** + * Protected destructor. MProtocolImuginroups + * instancies can't be destroyed via this interface. + */ + virtual inline ~MProtocolImGroup() {}; + +public: // + /** + * Subscribe to the specified group change notification + * + * @param [in] aGroupId + * Identification for IM group. + * @param [in] aReqId + * Request id identifying the issued request. + */ + virtual void DoSubscribeImGroupChangeL( MXIMPIdentity* aGroupId, + TXIMPRequestId aReqId )= 0; + + + /** + * Unsubscribe to the specified group change notification + * + * @param [in] aGroupId + * Identification for IM group. + * @param [in] aReqId + * Request id identifying the issued request. + */ + virtual void DoUnsubscribeImGroupChangeL( MXIMPIdentity* aGroupId, + TXIMPRequestId aReqId )= 0; + + /** + * Requests the protocol to create group + * + * @param [in] aGroupId + * Identification for IM group. + * @param [in] aProperties + * To be created IM group properties. + * @param [in] aScreenName + * Screen Name for the group + * @param [in] aJoinGroup + * Whether joining this group is allowed + * @param [in] aSubscribeNotification + * When the group is changed whether the notification is required + * @param [in] aReqId + * Request id identifying the issued request. + */ + virtual void DoCreateGroupL(const MXIMPIdentity& aGroupId, + const MImGroupInfo& aProperties, + const TDesC& aScreenName, + TBool aJoinGroup, + TBool aSubscribeNotification, + TXIMPRequestId aReqId) = 0; + /** + * Requests the protocol to join IM Group + * + * @param [in] aGroupId + * Identification for IM group. + * @param [in] aScreenName + * Screen Name for the group + * @param [in] aUsers + * Boolean value - mentioning whether the already + * joined users list is required as a response to this request + * @param [in] aSubscribeNotification + * When the group is changed whether the notification is required + * @param [in] aReqId + * Request id identifying the issued request. + */ + virtual void DoJoinGroupL(const MXIMPIdentity& aGroupId, + const TDesC& aScreenName, + TBool aUsers, + TBool aSubscribeNotification, + TXIMPRequestId aReqId) = 0; + /** + * Requests the protocol to delete IM group + * + * @param [in] aGroupId + * Identification for IM group. + * @param [in] aReqId + * Request ID identifying the issued request. + */ + virtual void DoDeleteGroupL(const MXIMPIdentity& aGroupId, + TXIMPRequestId aReqId ) = 0; + + + /** + * Requests the protocol to leave IM group + * + * @param [in] aGroupId + * Identification for IM group. + * @param [in] aReqId + * Request ID identifying the issued request. + */ + virtual void DoLeaveGroupL(const MXIMPIdentity& aGroupId, + TXIMPRequestId aReqId ) = 0; + + /** + * Requests the protocol to get the specified group properties + * + * @param [in] aGroupId + * Identification for IM group. + * @param [in] aReqId + * Request id identifying the issued request. + */ + virtual void DoGetGroupPropertiesL( MXIMPIdentity* aGroupId, + TXIMPRequestId aReqId )= 0; + + + /** + * Requests the protocol to set/modify the specified group properties + * + * @param [in] aGroupId + * Identification for IM group. + * @param [in] aGroupProps + * Group properties need to be set for the specified group + * @param [in] aReqId + * Request id identifying the issued request. + */ + virtual void DoSetGroupPropertiesL( MXIMPIdentity* aGroupId, + const MImGroupInfo* aGroupProps, + TXIMPRequestId aReqId )= 0; + /** + * Requests the protocol to Get access control list of users of the specified group + * + * @param [in] aGroupId + * Identification for IM group. + * @param [in] aReqId + * Request ID identifying the issued request. + * @return The request ID identifying the issued request. + * + * /b Note: Possible error conditions + * /n 1. Group does't exists + * /n 2. User does't exists + * If the request is success responce will have access control list for the specified group + * + */ + virtual TXIMPRequestId DoGetImGroupAccessControlListL( const MXIMPIdentity& aGroupId, + TXIMPRequestId aReqId )=0; + /** + * Requests the protocol to Set access control list of users for the specified group + + * @param [in] aGroupId + * Identification for IM group. + * @param [in] acl + * access control list. + * @param [in] aReqId + * Request id identifying the issued request. + * @return The request id identifying the issued request. + * + * /b Note: Possible error conditions + * /n 1. Group does't exists + * /n 2. User does't exists + * /n 3. User don't have access control + * If the request is success responce will have access control for the specified group + * + */ + + virtual TXIMPRequestId DoSetImGroupAccessControLlistL( const MXIMPIdentity& aGroupId, + MImAccessControlList* aCl,TXIMPRequestId aReqId ) = 0; + + /** + * Requests the protocol to set rejected list of users of the specified group + * + * @param [in] aGroupId + * Identification for IM group. + * @param [in] aRejectedList + * List of users need to be rejected from the group + * @param [in] aEnabledList + * List of users need to be added to the group + * @param [in] aReqId + * Request id identifying the issued request. + */ + virtual void DoSetImGroupRejectListL( const TDesC& aGroupId, + const MDesCArray* aRejectedList, + const MDesCArray* aEnabledList, + TXIMPRequestId aReqId )=0; + /** + * Requests the protocol to get list of members of the indicated group + * + * @param [in] aGroupId + * Identification for IM group. + * @param [in] aReqId + * Request ID identifying the issued request. + * + * @return The request id identifying the issued request. + * + * /b Note: Possible error conditions + * /n 1. Group does't exists - KImErrGroupDoesNotExists + * /n 2. Not joined in this group - KImErrGroupNotJoined + * + * If the request is success,response will have list of members of the specified group + * + */ + virtual TXIMPRequestId DoGetImGroupMembersL( MXIMPIdentity* aGroupId,TXIMPRequestId aReqId )= 0; + /** + * Requests the protocol to Get lest of joined users for the specified group + * + * @param [in] aGroupId + * Identification for IM group. + * @param [in] aReqId + * Request ID identifying the issued request. + * @return The request ID identifying the issued request. + * + * /b Note: Possible error conditions + * /n 1. Group does't exists + * /n 2. User does't exists + * If the Request is success client will get list of joined users for the specified group + * + */ + virtual TXIMPRequestId DoGetImGroupJoinedUsersListL( const MXIMPIdentity& aGroupId,TXIMPRequestId aReqId )=0; + + /** + * Add members to IM Group + * + * @param [in] aGroupId + * Identification for IM group. + * @param [in] aUserList + * List of users need to be added to the group + * @param [in] aReqId + * Request id identifying the issued request. + */ + + virtual void DoAddImGroupMembersL( const MXIMPIdentity& aGroupId, + const MDesCArray& aUserList, + TXIMPRequestId aReqId )= 0; + + /** + * Remove members from IM group + * + * @param [in] aGroupId + * Identification for IM group. + * @param [in] aUserList + * List of users need to be removed from the group + * @param [in] aReqId + * Request id identifying the issued request. + */ + virtual void DoRemoveImGroupMembersL( const MXIMPIdentity& aGroupId, + const MDesCArray& aUserList, + TXIMPRequestId aReqId )= 0; + + }; + + + +#endif // MPROTOCOLIMGROUP_H diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_im_protocol_plugin_api/inc/protocoliminvitation.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_im_protocol_plugin_api/inc/protocoliminvitation.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,131 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interface for IM protocol Invitation object. +* +*/ + +#ifndef MPROTOCOLIMINVITATION_H +#define MPROTOCOLIMINVITATION_H + +#include +#include +#include +#include "improtocolifids.hrh" + + +class MXIMPIdentity; +class MImInvitationInfo; +/** + * Interface for IM protocol invitation object. + * Interface must be implemented by a XIMP Framework protocol + * plug-ins. + * + * This interface defines actions that XIMP Framework + * requests from a IM protocol connection to + * execute invitation related tasks. + * + * Protocol implementation must route requests received through + * this interface, to same remote IM service destination, + * as where the parent MXIMPProtocolConnection is connected. + * (Here the parent MXIMPProtocolConnection means the protocol + * connection instance from where this interface instance + * was retrieved.) + * + * @see MProtocolImConnection + * @ingroup ProtocolImpluginapi + * + */ +class MProtocolImInvitation : public MXIMPBase + { +public: + + /** Interface ID for the MProtocolImInvitation. */ + enum { KInterfaceId = IM_IF_ID_PROTOCOL_INVITATION }; + + +protected: + + /** + * Protected destructor. MProtocolImInvitation + * instancies can't be destroyed via this interface. + */ + virtual inline ~MProtocolImInvitation() {} + +public: + + /** Requests the protocol to invite group of users to join in the mentioned group + * + * @param [in] aUserID = IDs of the users to invite + * @param [in] InviteGroup = ID of the group to which the users + * are invited to join + * @param [in] aInviteInfo = Identification and content of the invitation. + * MImInvitationInfo contains inviteId, contenttype - text/content, invitereason,validityperiod....... + * + */ + + virtual void DoImGroupInviteL( const MDesCArray* aUserID, + const MXIMPIdentity& InviteGroup, + const MImInvitationInfo& aInviteInfo ) = 0; + /** Request the protocol to invite user to IM conversation + * + * @param [in] aUserID = IDs of the users to invite + * @param [in] aInviteInfo = Identification and content of the invitation. + * MImInvitationInfo contains inviteid, contenttype - text/content, invitereason,validityperiod....... + * + */ + virtual void DoImInviteL( const TDesC& aUserID, + const MImInvitationInfo& aInviteInfo ) = 0; + + /** Request the protocol to Cancel an im group invite + * + * @param [in] aUserID = IDs of the users to invite + * @param [in] InviteGroup = ID of the group to which the users + * are invited to join + * @param [in] aInviteInfo = Identification and content of the invitation. + * MImInvitationInfo contains inviteid, contenttype - text/content, invitereason,validityperiod....... + * + */ + + virtual void DoCancelImgroupInviteL( const MDesCArray* aUserID, + const MXIMPIdentity& InviteGroup, + const MImInvitationInfo& aInviteInfo )= 0; + /** Request the protocol to cancel invitation for user to IM conversation + + * @param [in] aUserID = IDs of the users to invite + * @param [in] aInviteInfo = Identification and content of the invitation. + * MImInvitationInfo contains inviteid, contenttype - text/content, invitereason,validityperiod....... + + * @return The request id identifying the issued request. + * + * /b Note: Possible error conditions + * /n 1. Invalid invite id + * /n 2. Invalid userid + * If the request is success it will send a group invitation to the mentioned users + * + */ + virtual TXIMPRequestId DoCancelImInviteL( const TDesC& aUserID, + const MImInvitationInfo& aInviteInfo ) = 0; + /** Request the protocol to Send response to invite + * @param [in] aRecipientUserId = Userid of the invitee + * @param [in] aInviteInfo = Identification and content of the invitation. + * MImInvitationInfo contains inviteId, contenttype - text/content, inviteresponse,acceptance....... + * + */ + virtual void DoInviteResponseL( const TDesC& aRecipientUserId, + const MImInvitationInfo& aInviteInfo ) = 0; + }; + + + +#endif // MPROTOCOLIMINVITATION_H diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_im_protocol_plugin_api/inc/protocolimsearch.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_im_protocol_plugin_api/inc/protocolimsearch.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,140 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interface for IM Feature Plugin protocol IM object. +* +*/ + + + +#ifndef MPROTOCOLIMSEARCH_H +#define MPROTOCOLIMSEARCH_H +#include +#include +#include +#include "improtocolifids.hrh" + +#include "imsearchelementimp.h" + + +class MXIMPIdentity; +//class CSearchRequest; +/** + * Interface for Search object. + * Interface must be implemented by a XIMP Framework protocol + * plug-ins. + * + * This interface defines actions that XIMP Framework + * requests from a IM protocol connection to + * execute search related tasks. + * + * Protocol implementation must route requests received through + * this interface, to same remote IM service destination, + * as where the parent MXIMPProtocolConnection is connected. + * (Here the parent MXIMPProtocolConnection means the protocol + * connection instance from where this interface instance + * was retrieved.) + * + * @see MXIMPProtocolConnection + * @ingroup ProtocolImpluginapi + * + */ +class MProtocolImSearch : public MXIMPBase + { +public: + + /** Interface ID for the MProtocolImSearch */ + enum { KInterfaceId = IM_IF_ID_PROTOCOL_SEARCH }; + + +protected: + + /** + * Protected destructor. MProtocolImSearch + * instancies can't be destroyed via this interface. + */ + virtual inline ~MProtocolImSearch() {}; + + +public: + + /** + * Requests the protocol to start search. + * + * @param [in] aImSearchId + * Identification for IM search. + * @param [in] aPairs + * Defines what is to be searched. + * @param [in] aSearchLimit + * How many results you want. + * @param [in] aReqId + * Request id identifying the issued request. + * @return The request id identifying the issued request. + * + * /b Note: Possible error conditions + * /n 1. Invalid/unsupported search-element [KImErrFieldTypeNotSupported]. + */ + virtual void DoImSearchL( const MXIMPIdentity& aImSearchId, + const CSearchRequest& aPairs, + TInt aSearchLimit, + TXIMPRequestId aReqId ) = 0; + + /** + * Continue search. + * + * @param [in] aImSearchId + * Identification for IM search. + * @param [in] aSearchID + * Which search is to be continued. + * @param [in] aIndex + * From which index the search is continued. + * @param [in] aReqId + * Request id identifying the issued request. + * + * @return The request id identifying the issued request. + * + * /b Note: Possible error conditions + * /n 1. Initial search request was not sent / invalid searchid [KImErrFieldValueNotSupported]. + * /n 2. Invalid Search-Index / out of range [KImErrOutOfRangeValue]. + * /n 3. Search timeout (in case of continued search the subsequent request primitive is late) [KImErrServicRequestTimeouted]. + */ + virtual void DoContinueImSearchL( const MXIMPIdentity& aImSearchId, + TInt aSearchID, + TXIMPRequestId aReqId ) = 0; + + /** + * Stop search. + * + * @param [in] aImSearchId + * Identification for IM search. + * @param [in] aSearchID + * Which search is to be stopped. + * @param [in] aReqId + * Request id identifying the issued request. + * + * @return The request id identifying the issued request. + * + * /b Note: Possible error conditions + * /n 1. Initial search request was not sent (invalid searchid) [KImErrFieldValueNotSupported]. + */ + virtual void DoStopImSearchL( const MXIMPIdentity& aImSearchId, + TInt aSearchID, + TXIMPRequestId aReqId ) = 0; + + + + }; + + + +#endif // MPROTOCOLIMSEARCH_H diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_im_protocol_plugin_api/ximp_im_protocol_plugin_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_im_protocol_plugin_api/ximp_im_protocol_plugin_api.metaxml Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,13 @@ + + +ximp_im_protocol_plugin_api +This is a API that provides instant messaging interfaces to the adaptation plugin which needs to be implemented by the adaptation. +c++ +ximp_im_protocol_plugin_api + + + +yes +no + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_im_protocol_plugin_host_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_im_protocol_plugin_host_api/group/bld.inf Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,35 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: File that exports the files belonging to +: XIMP IM Protocol Plug-in Host API +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +../inc/protocolimconversationdatahost.h MW_LAYER_PLATFORM_EXPORT_PATH(protocolimconversationdatahost.h) +../inc/protocolimgroupdatahost.h MW_LAYER_PLATFORM_EXPORT_PATH(protocolimgroupdatahost.h) +../inc/protocoliminvitationdatahost.h MW_LAYER_PLATFORM_EXPORT_PATH(protocoliminvitationdatahost.h) +../inc/protocolimdatahost.h MW_LAYER_PLATFORM_EXPORT_PATH(protocolimdatahost.h) +../inc/improtocolpluginhostifids.hrh MW_LAYER_PLATFORM_EXPORT_PATH(improtocolpluginhostifids.hrh) +../inc/protocolimdatahost.inl MW_LAYER_PLATFORM_EXPORT_PATH(protocolimdatahost.inl) +../inc/protocolimsearchdatahost.h MW_LAYER_PLATFORM_EXPORT_PATH(protocolimsearchdatahost.h) +../inc/protocolimpluginhost.h MW_LAYER_PLATFORM_EXPORT_PATH(protocolimpluginhost.h) + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_im_protocol_plugin_host_api/inc/improtocolpluginhostifids.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_im_protocol_plugin_host_api/inc/improtocolpluginhostifids.hrh Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,41 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Protocol Plugin Host API interface IDs. +* +*/ + +#ifndef PROTOCOLIMPLUGINHOSTIFIDS_HRH +#define PROTOCOLIMPLUGINHOSTIFIDS_HRH + + +// Protocol plugin host IF id's +// 40xx - ximp related +// 41xx - presence related +// 42xx - instant messaging related + +// Interface IDs for XIMPFw Protocol Plugin Host interfaces +#define IM_IF_ID_PROTOCOL_GROUP_DATAHOST 4201 +#define IM_IF_ID_PROTOCOL_CONVERSATION_DATAHOST 4202 +#define IM_IF_ID_PROTOCOL_INVITATION_DATAHOST 4203 +#define IM_IF_ID_PROTOCOL_PLUGIN_HOST 4204 +#define IM_IF_ID_PROTOCOL_SEARCH_DATAHOST 4205 +#define IM_IF_ID_PROTOCOL_DATA_HOST 4206 + +// Interface UID for IMfeatures interface +#define XIMP_ECOM_IF_UID_IM_PROCESSOR_INTERFACE 0xE0000003 + + +#endif // PROTOCOLIMPLUGINHOSTIFIDS_HRH + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_im_protocol_plugin_host_api/inc/protocolimconversationdatahost.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_im_protocol_plugin_host_api/inc/protocolimconversationdatahost.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,308 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interface for managing cached IM(Instant Message's) information. +* +*/ + +#ifndef MPROTOCOLCONVERSATIONDATAHOST_H +#define MPROTOCOLCONVERSATIONDATAHOST_H + +#include +#include +#include +#include + + +class MXIMPIdentity; +class MXIMPObjectCollection; +class MXIMPDataSubscriptionState; +class MXIMPStatus; +class MImConversationInfo; + + +/** + * Interface for managing cached conversation information. + * + * Interface is used by protocol adaptations to manage + * conversation information stored + * in IM internal data cache. + * + * This interface is implemented by IM. + * Protocol adaptation can obtain reference to this + * interface from MXIMPProtocolConnectionHost interface. + * + * For each separated protocol connection, protocol + * adaptation must use the specific + * MImProtocolConversationDataHost instance, + * what is received from the connection specific + * MXIMPProtocolConnectionHost instance. + * + * @ingroup Improtocolpluginhostapi + * @since S60 + */ +class MProtocolImConversationDataHost : public MXIMPBase + { +public: + + /** Interface ID for the MImProtocolConversationDataHost. */ + enum { KInterfaceId = IM_IF_ID_PROTOCOL_CONVERSATION_DATAHOST }; + +protected: + + /** + * Protected destructor. Object instancies + * can't be deleted via this interface. + */ + virtual ~MProtocolImConversationDataHost() {} + +public: // Handling IM information + + /** + * Notifies IM from + * message sent completion information. + * + * Protocol adaptation implementation can call this + * method to notify IM from message + * sent completion information. IM + * updates its cached information and + * notifies the subscribing clients from data changes. + * + * IM takes ownership of the argument(s), + * if method succeeds without a leave. + * + * @param [in] aMessageId + * MXIMPIdentity object identifying the + * Message sent information + * + * @return The request id identifying the issued request. + * Data cache request is processed asynchronously and + * its completion is signalled to adaptation direction + * through MXIMPProtocolConnectionHostObserver interface, + * with MXIMPProtocolRequestCompleteEvent event. + * + * @leave KErrNoMemory if failed to allocate memory. + * @leave KErrArgument if NULL argument(s) were provided. + */ + //virtual TXIMPRequestId HandleSentMessageL(MXIMPIdentity* aMessageId) = 0; + /** + * Notifies IM from + * new text message received information. + * + * Protocol adaptation implementation can call this + * method to notify IM from new + * text message received information. IM + * updates its cached new text message and + * notifies the subscribing clients from data changes. + * + * IM takes ownership of the argument(s), + * if method succeeds without a leave. + * + * @param [in] aMessageId + * MXIMPIdentity object identifying the new + * message information + * @param [in] aSender + * message sender userid/groupId if the sender is group + * @param [in] aScreenName + * ScreenName if the sender is groupid/NullDesc if the sender is userid + * @param [in] aRecipients + * List of userid's / list of groupId's if receipients are groups. + * @param [in] aScreenNames + * List of screennames if receipients are groups. + * @param [in] aText + * Message text. + * + * @return The request id identifying the issued request. + * Data cache request is processed asynchronously and + * its completion is signalled to adaptation direction + * through MXIMPProtocolConnectionHostObserver interface, + * with MXIMPProtocolRequestCompleteEvent event. + * + * @leave KErrNoMemory if failed to allocate memory. + * @leave KErrArgument if NULL argument(s) were provided. + */ + virtual TXIMPRequestId HandleNewTextMessageL( MImConversationInfo* aImMessage) = 0; + /** + * Notifies IM from + * new content message received information. + * + * Protocol adaptation implementation can call this + * method to notify IM from new + * text message received information. IM + * updates its cached new content message and + * notifies the subscribing clients from data changes. + * + * IM takes ownership of the argument(s), + * if method succeeds without a leave. + * + * @param [in] aMessageId + * MXIMPIdentity object identifying the new + * message information + * @param [in] aSender + * message sender userid/groupid if the sender is group + * @param [in] aScreenName + * ScreenName if the sender is groupid/NullDesc if the sender is userid + * @param [in] aRecipients + * List of userid's / List of groupid's if receipients are groups. + * @param [in] aScreenNames + * List of screennames if receipients are groups. + * @param [in] aContentType + * Type of the message content. + * @param [in] aContent + * Message content. + * + * @return The request id identifying the issued request. + * Data cache request is processed asynchronously and + * its completion is signalled to adaptation direction + * through MXIMPProtocolConnectionHostObserver interface, + * with MXIMPProtocolRequestCompleteEvent event. + * + * @leave KErrNoMemory if failed to allocate memory. + * @leave KErrArgument if NULL argument(s) were provided. + */ + //virtual TXIMPRequestId HandleNewContentMessageL( MXIMPIdentity* aMessageId, + // const TDesC& aSender, + // const TDesC& aScreenName, + // const MDesCArray& aRecipients, + // const MDesCArray& aScreenNames, + // const TDesC& aContentType, + // const TDesC8& aContent) = 0; + /** + * Notifies IM from + * blocked/granted List information. + * + * Protocol adaptation implementation can call this + * method to notify IM from blocked/granted + * list of information. IM + * updates its cached blocked / granted list and + * notifies the subscribing clients from data changes. + * + * IM takes ownership of the argument(s), + * if method succeeds without a leave. + * + * @param [in] aBlockedList + * list of blocked users identified by userid + * @param [in] aBlockedListInUse + * whether the blocked list is in use + * @param [in] aGrantedList + * list of granted users identified by userid + * @param [in] aGrantedListInUse + * whether the granted list is in use + * + * @return The request id identifying the issued request. + * Data cache request is processed asynchronously and + * its completion is signalled to adaptation direction + * through MXIMPProtocolConnectionHostObserver interface, + * with MXIMPProtocolRequestCompleteEvent event. + * + * @leave KErrNoMemory if failed to allocate memory. + * @leave KErrArgument if NULL argument(s) were provided. + */ + //virtual TXIMPRequestId HandleBlockedListResponseL( const MDesCArray* aBlockedList, + // TBool aBlockedListInUse, + // const MDesCArray* aGrantedList, + // TBool aGrantedListInUse) = 0; + /** + * Notifies IM from + * message forward completion information. + * + * Protocol adaptation implementation can call this + * method to notify IM from Message + * forward completion information. IM + * updates its cached information and + * notifies the subscribing clients from data changes. + * + * IM takes ownership of the argument(s), + * if method succeeds without a leave. + * + * @param [in] aMessageId + * MXIMPIdentity object identifying the + * message forward information + * + * @return The request ID identifying the issued request. + * Data cache request is processed asynchronously and + * its completion is signalled to adaptation direction + * through MXIMPProtocolConnectionHostObserver interface, + * with MXIMPProtocolRequestCompleteEvent event. + * + * @leave KErrNoMemory if failed to allocate memory. + * @leave KErrArgument if NULL argument(s) were provided. + */ + //virtual TXIMPRequestId HandleForwardMessageCompletionL(MXIMPIdentity* aMessageId) = 0; + + + + /** + * Notifies IM from + * received message list information. + * + * Protocol adaptation implementation can call this + * method to notify IM from message + * forward completion information. IM + * updates its cached information and + * notifies the subscribing clients from data changes. + * + * IM takes ownership of the argument(s), + * if method succeeds without a leave. + * + * @param [in] aMessageList + * MImFtpPluginObjectCollection object containing zero or + * more /Message info class/ objects. Each + * contained information about the message. + * + * @return The request ID identifying the issued request. + * Data cache request is processed asynchronously and + * its completion is signalled to adaptation direction + * through MXIMPProtocolConnectionHostObserver interface, + * with MXIMPProtocolRequestCompleteEvent event. + * + * @leave KErrNoMemory if failed to allocate memory. + * @leave KErrArgument if NULL argument(s) were provided. + */ + //virtual TXIMPRequestId HandleGetMessageListL( /*MImFtpPluginObjectCollection* aMessageList */) = 0; + /** + * Notifies IM from + * reject message information. + * + * Protocol adaptation implementation can call this + * reject message information. + * method to notify IM from + * reject message information. + * IM updates its cached new text message and + * notifies the subscribing clients from data changes. + * + * IM takes ownership of the argument(s), + * if method succeeds without a leave. + * + * @param [in] aMessageId + * MXIMPIdentity object identifying the reject + * message information + * + * @return The request id identifying the issued request. + * data cache request is processed asynchronously and + * its completion is signalled to adaptation direction + * through MXIMPProtocolConnectionHostObserver interface, + * with MXIMPProtocolRequestCompleteEvent event. + * + * @leave KErrNoMemory if failed to allocate memory. + * @leave KErrArgument if NULL argument(s) were provided. + */ + //virtual TXIMPRequestId HandleRejectMessageL( MXIMPIdentity* aMessageId) = 0; + + + + + }; + + +#endif // MPROTOCOLCONVERSATIONDATAHOST_H diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_im_protocol_plugin_host_api/inc/protocolimdatahost.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_im_protocol_plugin_host_api/inc/protocolimdatahost.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,166 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interface for Im protocol connection host + * +*/ + +#ifndef MPROTOCOLIMDATAHOST_H +#define MPROTOCOLIMDATAHOST_H + +#include +#include +#include + +class MXIMPStatus; +class MImObjectFactory; +class MXIMPProtocolConnectionHostObserver; +class MProtocolImConversationDataHost; +class MProtocolImGroupDataHost; +class MProtocolImInvitationDataHost; +class MProtocolImSearchDataHost; +class MXIMPHost; +class CImDataCache ; + +/** + * Im connection host. + * + * @lib ximpprocessor.lib + * @since S60 v3.2 + */ +class MProtocolImDataHost //: public MXIMPBase + + { +public: + + + /** Interface ID for the MProtocolImDataHost. */ + enum { KInterfaceId = XIMP_ECOM_IF_UID_IM_PROCESSOR_INTERFACE }; + + +public: + + /** + * Factory method to instantiate MImFeatures. + * + * Factory method to instantiate platform default + * MXIMPClient implementation through the ECom. + * If the default IM Feature isn't supported + * in the platform, leaves with errorcode signalled + * from ECom. + * + * @return The new Im client object. Object + * ownership is returned to caller. + */ + //static MProtocolImDataHost* NewL( MXIMPHost& aHost ); + + /** + * Public destructor. + * Objects can be deleted through this interface. + */ + //virtual ~MProtocolImDataHost(); + +//protected: + +// MProtocolImDataHost(); + +public: // Access to sub-interfaces + + + /** + * Gets reference to object factory interface. + * + * Im protocol connection implementation + * uses factory interface to instantiate Im + * objects. + * + * @return Object factory interface. + * No ownership is returned caller. + */ + virtual MImObjectFactory& ImObjectFactory() = 0; + + + + /** + * Gets reference to + * MProtocolImConversationDataHost interface. + * + * Im protocol connection implementation uses returned + * data host interface to manage the Im connections + * Im conversation data. + * + * @return MProtocolImConversationDataHost interface. + * Interface ownership is not returned caller. + * Returned interface is guaranteed to remain valid (usable) + * as long as this source interface. + */ + virtual MProtocolImConversationDataHost& ConversationDataHost() = 0; + + + + /** + * Gets reference to + * MProtocolImGroupDataHost interface. + * + * Im protocol connection implementation uses returned + * data host interface to manage the Im connections + * Im group data. + * + * @return MProtocolImGroupDataHost interface. + * Interface ownership is not returned caller. + * Returned interface is guaranteed to remain valid (usable) + * as long as this source interface. + */ + //virtual MProtocolImGroupDataHost& GroupDataHost() = 0; + + + + /** + * Gets reference to + * MImProtocolInvitationDataHost interface. + * + * Im protocol connection implementation uses returned + * data host interface to manage the im connections + * im invitation data. + * + * @return MImProtocolInvitationDataHost interface. + * Interface ownership is not returned caller. + * Returned interface is guaranteed to remain valid (usable) + * as long as this source interface. + */ + //virtual MProtocolImInvitationDataHost& InvitationDataHost() = 0; + + + + /** + * Gets reference to + * MProtocolImSearchDataHost interface. + * + * Im protocol connection implementation uses returned + * data host interface to manage the Im connections + * search data. + * + * @return MProtocolImSearchDataHost interface. + * Interface ownership is not returned caller. + * Returned interface is guaranteed to remain valid (usable) + * as long as this source interface. + */ + //virtual MProtocolImSearchDataHost& SearchDataHost() = 0; + + virtual CImDataCache& ImDataCache() = 0; + + }; + + +#endif // MPROTOCOLIMDATAHOST_H + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_im_protocol_plugin_host_api/inc/protocolimdatahost.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_im_protocol_plugin_host_api/inc/protocolimdatahost.inl Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,62 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: IM Features interface used by XIMP IM clients. +* +*/ + +#include + + +// ----------------------------------------------------------------------------- +// MProtocolImDataHost::NewL( MXIMPHost& aHost) implementation +// Factory method to instantiate the platform default +// MProtocolImDataHost implementation through the ECom framework. +// ----------------------------------------------------------------------------- +// +inline MProtocolImDataHost* MProtocolImDataHost::NewL(MXIMPHost& aHost ) + { + _LIT8( KIMDefaultData, "" ); + + TEComResolverParams resolvingParams; + resolvingParams.SetDataType( KIMDefaultData ); + resolvingParams.SetWildcardMatch( ETrue ); + TAny* imp = REComSession::CreateImplementationL( TUid::Uid( MProtocolImDataHost::KInterfaceId), + _FOFF( MProtocolImDataHost, iEcomDtorID ), + &aHost, resolvingParams ); + return reinterpret_cast< MProtocolImDataHost* >( imp ); + } + + +// ----------------------------------------------------------------------------- +// MProtocolImDataHost::MProtocolImDataHost() implementation +// Zero initializes the iEcomDtorID member. +// ----------------------------------------------------------------------------- +// +inline MProtocolImDataHost::MProtocolImDataHost() + { + iEcomDtorID = TUid::Null(); + } + + +// ----------------------------------------------------------------------------- +// MProtocolImDataHost::~MProtocolImDataHost() +// Destructor notifies the ECom from implementation destruction. +// ----------------------------------------------------------------------------- +// +inline MProtocolImDataHost::~MProtocolImDataHost() + { + REComSession::DestroyedImplementation( iEcomDtorID ); + } + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_im_protocol_plugin_host_api/inc/protocolimdatahostimp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_im_protocol_plugin_host_api/inc/protocolimdatahostimp.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,127 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Im connection host + * +*/ + +#ifndef CPROTOCOLIMDATAHOSTIMP_H +#define CPROTOCOLIMDATAHOSTIMP_H + +#include +#include +#include +#include +#include +#include "imapiobjbase.h" +#include "ximpapiobjbase.h" +//#include "ximpitemparent.h" +#include "ximphost.h" +//#include "ximpoperationdefs.h" +//#include "ximprequestidbuilder.h" + + +class MXIMPHost; +class MImObjectFactory; +class CImObjectFactoryImp; + +class CXIMPPscContext; +class MImDataCache; +class CImDataCache; +class CXIMPContextStateEventImp; +class CPeriodic; +class MXIMPProtocolConnection; +class CProtocolImConversationDataHostImp; +class MProtocolImConversationDataHost; +class CProtocolImGroupDataHostImp; +class CProtocolImInvitationDataHostImp; +class CProtocolImSearchDataHostImp; + + +/** + * Im connection host. + * + * @lib ximpprocessor.lib + * @since S60 v3.2 + */ +class CProtocolImDataHostImp : public CXIMPApiObjBase, + public MProtocolImDataHost + + { +public: + /** The class ID. */ + enum { KClassId = IMIMP_CLSID_CPROTOCOLIMDATAHOSTIMP }; + +public: + + IMPORT_C static CProtocolImDataHostImp* NewL( MXIMPHost& aHost ); + + IMPORT_C static CProtocolImDataHostImp* NewLC( MXIMPHost& aHost ); + + virtual ~CProtocolImDataHostImp(); + +private: + + CProtocolImDataHostImp( MXIMPHost& aHost ); + void ConstructL(); + +public: // From MXIMPBase + + /** + * Implementation of MXIMPBase interface methods + * @see MXIMPBase + */ + XIMPIMP_DECLARE_IF_BASE_METHODS + + +public: // MProtocolImDataHost + + MImObjectFactory& ImObjectFactory(); + + MProtocolImConversationDataHost& ConversationDataHost(); + + MProtocolImGroupDataHost& GroupDataHost(); + + MProtocolImInvitationDataHost& InvitationDataHost(); + + MProtocolImSearchDataHost& SearchDataHost(); + +public: + + IMPORT_C CImDataCache& ImDataCache(); + IMPORT_C CProtocolImConversationDataHostImp& ConversationDataAccess(); + +private: // data + + MXIMPHost& iHost; + /** + * Data cache + */ + CImDataCache* iImDataCache; + + CImObjectFactoryImp* iImObjFactory; + + /** + * Data hosts + */ + CProtocolImConversationDataHostImp* iConvDataHost; + CProtocolImGroupDataHostImp* iGroupDataHost; + CProtocolImInvitationDataHostImp* iInvitationDataHost; + CProtocolImSearchDataHostImp* iSearchDataHost; + + + }; + + +#endif // CPROTOCOLIMDATAHOSTIMP_H + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_im_protocol_plugin_host_api/inc/protocolimgroupdatahost.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_im_protocol_plugin_host_api/inc/protocolimgroupdatahost.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,462 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interface for managing cached group information. +* +*/ + +#ifndef MPROTOCOLIMGROUPDATAHOST_H +#define MPROTOCOLIMGROUPDATAHOST_H + +#include +#include +#include + +class MXIMPIdentity; +class MImGroupInfo; +class MImGroupMemberInfo; + +/** + * Interface for managing cached group information. + * + * Interface used by protocol adaptations to manage + * group information and group member information + * in IM internal data cache. + * + * This interface is implemented by IM. + * Protocol adaptation can obtain reference to this + * interface from MXIMPProtocolConnectionHost interface. + * + * For each separated protocol connection, protocol + * adaptation must use the specific + * MProtocolImuginroupDataHost instance, + * what is received from the connection specific + * MXIMPProtocolConnectionHost instance. + * + * @ingroup ProtocolImpluginhostapi + * @since S60 + */ +class MProtocolImGroupDataHost : public MXIMPBase + { +public: + + /** Interface ID for the MProtocolImuginroupDataHost. */ + enum { KInterfaceId = IM_IF_ID_PROTOCOL_GROUP_DATAHOST }; + +protected: + + /** + * Protected destructor. Object instancies + * can't be deleted via this interface. + */ + virtual ~MProtocolImGroupDataHost() {} + + + +public: // Handling group information + /** + * Notifies IM from + * IM group list contents. + * + * Protocol adaptation implementation can call this + * method to notify IM from + * complete Im group list content. + * IM calculates the changes + * (new and removed Im groups) compared to previous + * IM group list content, and notifies + * the subscribing clients from data changes. + * + * IM takes ownership of the object + * collection and all objects contained within, if + * the method succeeds without a leave. + * + * + * @param [in] aGroupList + * MImObjectCollection object containing zero or + * more MImGroupInfo objects. Each + * contained MImGroupInfo shall im + * single im group within the im + * group list. + * + * @return The request id identifying the issued request. + * Data cache request is processed asynchronously and + * its completion is signalled to adaptation direction + * through MXIMPProtocolConnectionHostObserver interface, + * with MXIMPProtocolRequestCompleteEvent event. + * + * @leave KErrNoMemory if failed to allocate memory. + * @leave KErrArgument if NULL argument(s) were provided. + */ + virtual TXIMPRequestId HandleImGroupListL( + MImObjectCollection* aGroupList ) = 0; + /** + * Notifies IM from new + * group created. + * + * Protocol adaptation implementation can call this + * method to notify IM from + * new group created. IM + * calculates notifies the subscribing + * clients from data changes. + * + * IM takes ownership of the argument(s), + * if method succeeds without a leave. + * + * @param [in] aGroupInfo + * MImGroupInfo object holding + * information about new group entry. + * + * @return The request id identifying the issued request. + * Data cache request is processed asynchronously and + * its completion is signalled to adaptation direction + * through MXIMPProtocolConnectionHostObserver interface, + * with MXIMPProtocolRequestCompleteEvent event. + * + * @leave KErrNoMemory if failed to allocate memory. + * @leave KErrArgument if NULL argument(s) were provided. + */ + virtual TXIMPRequestId HandleGroupCreatedL( + MImGroupInfo* aGroupInfo ) = 0; + + + /** + * Notifies IM from joined + * group members. + * + * Protocol adaptation implementation can call this + * method to notify IM from + * Joined group members. IM + * calculates notifies the subscribing + * clients from data changes. + * + * IM takes ownership of the argument(s), + * if method succeeds without a leave. + * + * @param [in] aGroupInfo + * MImGroupInfo object holding + * information about group members. + * + * @return The request id identifying the issued request. + * data cache request is processed asynchronously and + * its completion is signalled to adaptation direction + * through MXIMPProtocolConnectionHostObserver interface, + * with MXIMPProtocolRequestCompleteEvent event. + * + * @leave KErrNoMemory if failed to allocate memory. + * @leave KErrArgument if NULL argument(s) were provided. + */ + virtual TXIMPRequestId HandleJoinedGroupL( + MImGroupInfo* aGroupInfo ) = 0; + + /** + * Notifies IM from Left + * group members. + * + * Protocol adaptation implementation can call this + * method to notify IM from + * left group. IM + * calculates notifies the subscribing + * clients from data changes. + * + * IM takes ownership of the argument(s), + * if method succeeds without a leave. + * + * @param [in] aGroupId + * MXIMPIdentity object holding group id + * + * @return The request id identifying the issued request. + * data cache request is processed asynchronously and + * its completion is signalled to adaptation direction + * through MXIMPProtocolConnectionHostObserver interface, + * with MXIMPProtocolRequestCompleteEvent event. + * + * @leave KErrNoMemory if failed to allocate memory. + * @leave KErrArgument if NULL argument(s) were provided. + */ + virtual TXIMPRequestId HandleLeaveGroupL(MXIMPIdentity* aGroupId) = 0; + + /** + * Notifies IM from + * deleted Group . + * + * Protocol adaptation implementation can call this + * method to notify IM from + * deleted group. IM + * calculates notifies the subscribing + * clients from data changes. + * + * IM takes ownership of the argument(s), + * if method succeeds without a leave. + * + * @param [in] aGroupId + * MXIMPIdentity object holding group id + * + * @return The request id identifying the issued request. + * Data cache request is processed asynchronously and + * its completion is signalled to adaptation direction + * through MXIMPProtocolConnectionHostObserver interface, + * with MXIMPProtocolRequestCompleteEvent event. + * + * @leave KErrNoMemory if failed to allocate memory. + * @leave KErrArgument if NULL argument(s) were provided. + */ + virtual TXIMPRequestId HandleDeleteGroupL(MXIMPIdentity* aGroupId) = 0; + + /** + * Notifies IM from + * group properties. + * + * Protocol adaptation implementation can call this + * method to notify IM from + * group properties. IM + * calculates notifies the subscribing + * clients from data changes. + * + * IM takes ownership of the argument(s), + * if method succeeds without a leave. + * + * @param [in] aGroupInfo + * MImGroupInfo object holding + * information about group properties. + * + * @return The request id identifying the issued request. + * Data cache request is processed asynchronously and + * its completion is signalled to adaptation direction + * through MXIMPProtocolConnectionHostObserver interface, + * with MXIMPProtocolRequestCompleteEvent event. + * + * @leave KErrNoMemory if failed to allocate memory. + * @leave KErrArgument if NULL argument(s) were provided. + */ + virtual TXIMPRequestId HandleGroupPropertiesL( + MImGroupInfo* aGroupInfo ) = 0; + + + /** + * Notifies IM from + * group subscription information. + * + * Protocol adaptation implementation can call this + * method to notify IM from + * group subscription information. IM + * calculates notifies the subscribing + * clients from data changes. + * + * IM takes ownership of the argument(s), + * if method succeeds without a leave. + * + * @param [in] aSubscription + * Whether subscribed to group + * + * @return The request id identifying the issued request. + * Data cache request is processed asynchronously and + * its completion is signalled to adaptation direction + * through MXIMPProtocolConnectionHostObserver interface, + * with MXIMPProtocolRequestCompleteEvent event. + * + * @leave KErrNoMemory if failed to allocate memory. + * @leave KErrArgument if NULL argument(s) were provided. + */ + virtual TXIMPRequestId HandleGroupPropertiesL( + TBool aSubscription ) = 0; + /** + * Notifies IM from + * IM group access control list contents. + * + * Protocol adaptation implementation can call this + * method to notify IM from + * complete Im group access control list content. + * IM calculates the changes + * (new and removed Im groups) compared to previous + * Im group list content, and notifies + * the subscribing clients from data changes. + * + * IM takes ownership of the object + * collection and all objects contained within, if + * the method succeeds without a leave. + * + * + * @param [in] accesscontrollist + * MImObjectCollection object containing zero or + * more MImAccessControlList objects. Each + * contained MImAccessControlList shall present + * single access control list for a group within the im + * group list. + * + * @return The request id identifying the issued request. + * Data cache request is processed asynchronously and + * its completion is signalled to adaptation direction + * through MXIMPProtocolConnectionHostObserver interface, + * with MXIMPProtocolRequestCompleteEvent event. + * + * @leave KErrNoMemory if failed to allocate memory. + * @leave KErrArgument if NULL argument(s) were provided. + */ + virtual TXIMPRequestId HandleImAccessControlListL( + MImObjectCollection* accesscontrollist ) = 0; + /** + * Notifies IM from + * IM group members. + * + * Protocol adaptation implementation can call this + * method to notify IM from IM group + * members. IM calculates the changes + * (added and removed group members) compared to previous + * IM group content, and notifies the subscribing + * clients from data changes. + * + * IM takes ownership of the object + * collection and all objects contained within, if + * the method succeeds without a leave. + * + * @param [in] aGroupId + * MXIMPIdentity object identifying the im group + * of which content is notified here. + * + * @param [in] aGroupMembers + * MImObjectCollection object containing zero or + * more MImGroupInfo objects. Each + * contained MImGroupInfo shall + * present single im group member, within + * the im group. + * + * @return The request id identifying the issued request. + * Data cache request is processed asynchronously and + * its completion is signalled to adaptation direction + * through MXIMPProtocolConnectionHostObserver interface, + * with MXIMPProtocolRequestCompleteEvent event. + * + * @leave KErrNoMemory if failed to allocate memory. + * @leave KErrArgument if NULL argument(s) were provided. + */ + virtual TPrFwRequestId HandleImGroupMembersL( + MXIMPIdentity* aGroupId, + MImObjectCollection* aGroupMembers ) = 0; +/** + * Notifies IM from + * im group joined users. + * + * Protocol adaptation implementation can call this + * method to notify IM from im group + * joined users. IM calculates the changes + * (added and removed group members) compared to previous + * Im group content, and notifies the subscribing + * clients from data changes. + * + * IM takes ownership of the object + * collection and all objects contained within, if + * the method succeeds without a leave. + * + * @param [in] aGroupId + * MXIMPIdentity object identifying the im group + * of which content is notified here. + * @param [in] aGroupJoinedUsers + * MImObjectCollection object containing zero or + * more MImGroupInfo objects. Each + * contained MImGroupInfo shall + * present single im group joined user, within + * the im group. + * + * @return The request id identifying the issued request. + * Data cache request is processed asynchronously and + * its completion is signalled to adaptation direction + * through MXIMPProtocolConnectionHostObserver interface, + * with MXIMPProtocolRequestCompleteEvent event. + * + * @leave KErrNoMemory if failed to allocate memory. + * @leave KErrArgument if NULL argument(s) were provided. + */ + virtual TPrFwRequestId HandleImGroupJoinedUsersListL( + MXIMPIdentity* aGroupId, + MImObjectCollection* aGroupJoinedUsers ) = 0; + + + + /** + * Notifies IM from new + * im group member entry. + * + * Protocol adaptation implementation can call this + * method to notify IM from + * new im group member entry. IM + * calculates the change, from previous im + * group content, and notifies the subscribing + * clients from data changes. + * + * IM takes ownership of the argument(s), + * if method succeeds without a leave. + * + * @param [in] aGroupId + * MPrFwIdentity object identifying the im + * group to where the group member is added. + * @param [in] aGroupMember + * MImGroupInfo object holding + * information about new im group member + * entry. New im group member is added + * to the im group content. + * + * @return The request id identifying the issued request. + * Data cache request is processed asynchronously and + * its completion is signalled to adaptation direction + * through MXIMPProtocolConnectionHostObserver interface, + * with MXIMPProtocolRequestCompleteEvent event. + * + * @leave KErrNoMemory if failed to allocate memory. + * @leave KErrArgument if NULL argument(s) were provided. + */ + virtual TPrFwRequestId HandleImGroupMemberAddedL( + MPrFwIdentity* aGroupId, + MImGroupInfo* aGroupMember ) = 0; + + /** + * Notifies IM from new + * im group member entry. + * + * Protocol adaptation implementation can call this + * method to notify IM from + * remove of existing group member entry. IM + * calculates the change, from previous im + * group content, and notifies the subscribing + * clients from data changes. + * + * IM takes ownership of the argument(s), + * if method succeeds without a leave. + * + * @param [in] aGroupId + * MPrFwIdentity object identifying the im + * group to where the group member is added. + * + * @param [in] aGroupMember + * MPrFwIdentity object identifying the im + * group member which to remove from the im + * group. + * + * @return The request id identifying the issued request. + * Data cache request is processed asynchronously and + * its completion is signalled to adaptation direction + * through MXIMPProtocolConnectionHostObserver interface, + * with MXIMPProtocolRequestCompleteEvent event. + * + * @leave KErrNoMemory if failed to allocate memory. + * @leave KErrArgument if NULL argument(s) were provided. + */ + virtual TPrFwRequestId HandleImGroupMemberRemovedL( + MPrFwIdentity* aGroupId, + MImGroupInfo* aGroupMember ) = 0; + + + + }; + + +#endif // MPROTOCOLIMGROUPDATAHOST_H diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_im_protocol_plugin_host_api/inc/protocoliminvitationdatahost.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_im_protocol_plugin_host_api/inc/protocoliminvitationdatahost.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,236 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interface for managing cached Invite information. +* +*/ + +#ifndef MPROTOCOLIMINVITATIONDATAHOST_H +#define MPROTOCOLIMINVITATIONDATAHOST_H + +#include +#include +#include + +class MXIMPIdentity; +/** + * Interface for managing cached Invitation information. + * + * Interface is used by protocol adaptations to manage + * invitation related information in + * IM internal data cache. + * + * This interface is implemented by IM. + * Protocol adaptation can obtain reference to this + * interface from MXIMPProtocolConnectionHost interface. + * + * For each separated protocol connection, protocol + * adaptation must use the specific + * MImProtocolInvitationDataHost instance, + * what is received from the connection specific + * MXIMPProtocolConnectionHost instance. + * + * @ingroup Improtocolpluginhostapi + * @since S60 + */ +class MImProtocolInvitationDataHost : public MXIMPBase + { +public: + + /** Interface ID for the MImProtocolInvitationDataHost. */ + enum { KInterfaceId = IM_IF_ID_PROTOCOL_INVITATION_DATAHOST }; + + +protected: + + + /** + * Protected destructor. Object instancies + * can't be deleted via this interface. + */ + virtual ~MImProtocolInvitationDataHost() {} + + + +public: // Handling invitation requests + + + /** + * Notifies IM from + * im group invitation . + * + * Protocol adaptation implementation can call this + * method to notify IM from + * im group invitation . + * IM calculates the changes + * notifies the subscribing clients from data changes. + * + * IM takes ownership of the argument(s), + * if method succeeds without a leave. + * + * @param [in] aUserID = IDs of the users to invite + * @param [in] InviteGroup = ID of the group to which the users + * are invited to join + * @param [in] aInviteInfo = Identification and content of the invitation. + * MImInvitationInfo contains InviteId, contenttype - text/content, invitereason,validityperiod....... + * + * @return The request ID identifying the issued request. + * Data cache update request is processed + * asynchronously and operation completion result is + * signalled to adaptation direction through + * MXIMPProtocolConnectionHostObserver interface, + * with MXIMPProtocolRequestCompleteEvent event. + * + * @leave KErrNoMemory if failed to allocate memory. + * @leave KErrArgument if NULL argument(s) were provided. + */ + virtual TXIMPRequestId HandleImGroupInviteL( + const MDesCArray* aUserID, + const MXIMPIdentity& InviteGroup, + const MImInvitationInfo& aInviteInfo ) = 0; + /** + * Notifies IM from + * im Invitation . + * + * Protocol adaptation implementation can call this + * method to notify IM from + * IM invitation . + * IM calculates the changes + * notifies the subscribing clients from data changes. + * + * IM takes ownership of the argument(s), + * if method succeeds without a leave. + * + * @param [in] aUserID = ID of the user to invite + * @param [in] aInviteInfo = Identification and content of the invitation. + * MImInvitationInfo contains InviteId, contenttype - text/content, invitereason,validityperiod....... + * + * @return The request id identifying the issued request. + * Data cache update request is processed + * asynchronously and operation completion result is + * signalled to adaptation direction through + * MXIMPProtocolConnectionHostObserver interface, + * with MXIMPProtocolRequestCompleteEvent event. + * + * @leave KErrNoMemory if failed to allocate memory. + * @leave KErrArgument if NULL argument(s) were provided. + */ + virtual TXIMPRequestId HandleImInviteL( + const TDesC& aUserID, + const MImInvitationInfo& aInviteInfo ) = 0; + + + + /** + * Notifies IM from + * invitation response. + * + * Protocol adaptation implementation can call this + * method to notify IM from + * invitation response. + * IM calculates the changes + * notifies the subscribing clients from data changes. + * + * IM takes ownership of the argument(s), + * if method succeeds without a leave. + * + * @param [in] aRecipientUserId = UserID of the invitee + * @param [in] aInviteInfo = Identification and content of the invitation. + * MImInvitationInfo contains InviteId, contenttype - text/content, inviteresponse,acceptance....... + * + * @return The request id identifying the issued request. + * Data cache update request is processed + * asynchronously and operation completion result is + * signalled to adaptation direction through + * MXIMPProtocolConnectionHostObserver interface, + * with MXIMPProtocolRequestCompleteEvent event. + * + * @leave KErrNoMemory if failed to allocate memory. + * @leave KErrArgument if NULL argument(s) were provided. + */ + virtual TXIMPRequestId HandleInviteResponseL( + const TDesC& aRecipientUserId, + const MImInvitationInfo& aInviteInfo ) = 0; + + + /** + * Notifies IM from + * Cancelled im group Invitation. + * + * Protocol adaptation implementation can call this + * method to notify IM from + * cancelled im group invitation request. + * IM calculates the changes + * notifies the subscribing clients from data changes. + * + * IM takes ownership of the argument(s), + * if method succeeds without a leave. + * + * @param [in] aUserID = IDs of the users to cancel invititation + * @param [in] InviteGroup = ID of the group to which the users + * are invited to join + * @param [in] aInviteInfo = Identification and content of the invitation. + * MImInvitationInfo contains InviteId, contenttype - text/content, invitereason,validityperiod....... + * + * @return The request id identifying the issued request. + * Data cache update request is processed + * asynchronously and operation completion result is + * signalled to adaptation direction through + * MXIMPProtocolConnectionHostObserver interface, + * with MXIMPProtocolRequestCompleteEvent event. + * + * @leave KErrNoMemory if failed to allocate memory. + * @leave KErrArgument if NULL argument(s) were provided. + */ + + virtual TXIMPRequestId HandleCancelImgroupInviteL( const MDesCArray* aUserID, + const MXIMPIdentity& InviteGroup, + const MImInvitationInfo& aInviteInfo )= 0; + +/** + * Notifies IM from + * Cancelled Invitation. + * + * Protocol adaptation implementation can call this + * method to notify IM from + * cancelled invitation request. + * IM calculates the changes + * notifies the subscribing clients from data changes. + * + * IM takes ownership of the argument(s), + * if method succeeds without a leave. + * + * @param [in] aUserID = ID of the user to cancel invitataion + * @param [in] aInviteInfo = Identification and content of the invitation. + * MImInvitationInfo contains InviteId, contenttype - text/content, invitereason,validityperiod....... + * + * @return The request ID identifying the issued request. + * Data cache update request is processed + * asynchronously and operation completion result is + * signalled to adaptation direction through + * MXIMPProtocolConnectionHostObserver interface, + * with MXIMPProtocolRequestCompleteEvent event. + * + * @leave KErrNoMemory if failed to allocate memory. + * @leave KErrArgument if NULL argument(s) were provided. + */ + + virtual TXIMPRequestId HandleCancelImInviteL( const TDesC& aUserID, + const MImInvitationInfo& aInviteInfo ) = 0; + + + + }; + + +#endif // MPROTOCOLIMINVITATIONDATAHOST_H diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_im_protocol_plugin_host_api/inc/protocolimpluginhost.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_im_protocol_plugin_host_api/inc/protocolimpluginhost.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,161 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Protocol IM Plugin host interface. +* +*/ + +#ifndef MPROTOCOLIMPLUGINHOST_H +#define MPROTOCOLIMPLUGINHOST_H + +#include +#include +#include + + +//class MImObjectFactory; +//class MImStatus; + + + +// CLASS DECLARATION + +/** + * Interface for IM Protocol Plugin host. + * This interface is implemented by IM. + * + * IM Protocol Plugin host interface defines + * actions that a IM protocol plug-in can + * request (callback) from IM. + * + * @see MProtocolImPlugin + * @see CProtocolImPluginBase + * @ingroup ProtocolImpluginhostapi + * @since S60 + */ +class MProtocolImPluginHost : public MXIMPBase + { +public: + + /** Interface ID for the MProtocolImPluginHost. */ + enum { KInterfaceId = IM_IF_ID_PROTOCOL_PLUGIN_HOST }; + + +protected: + + /** + * Protected destructor. IM Protocol Plugin host + * instancies can't be destroyed via this interface. + */ + virtual inline ~MProtocolImPluginHost() {}; + + +public: + + + /** + * Gets reference to object factory interface. + * + * Returned object factory interface is used + * to instantiate IM data objects. + * + * @return Object factory interface. + * No ownership is returned caller. + */ + virtual MImObjectFactory& ObjectFactory() = 0; + + + + /** + * Notifies IM that IM protocol + * plug-in has completed (successfully or otherwise) + * the request handling. + * + * /b NOTE: This method isn't yet supported by IM, + * since all MProtocolImPlugin methods are currently + * synchronous. + * + * @param [in] aReqId + * Request ID identifying the request which handling + * is completed. This must equal to value given in + * the processing initiation. If no pending IM + * protocol plug-in request is found with this id, + * plug-in is paniced. + * + * @param [in] aResultCode + * Result code from request handling. + */ + virtual void HandleRequestCompleted( TXIMPRequestId aReqId, + TInt aResultCode ) = 0; + + + /** + * Notifies IM that IM protocol + * plug-in has completed (successfully or otherwise) + * the request handling. + * + * /b NOTE: This method isn't yet supported by IM, + * since all MProtocolImPlugin methods are currently + * synchronous. + * + * @param [in] aReqId + * Request ID identifying the request which handling + * is completed. This must equal to value given in + * the processing initiation. If no pending IM + * protocol plug-in request is found with this id, + * plug-in is paniced. + * @param [in] aResult + * Status object describing result from request handling. + * Object ownership is transfered always to IM. + * NULL value not allowed. + */ + virtual void HandleRequestCompleted( TXIMPRequestId aReqId, + MImStatus* aResult ) = 0; + + + /** + * Notifies IM that IM protocol + * plug-in has completed (successfully or otherwise) + * the request handling. + * + * /b NOTE: This method isn't yet supported by IM, + * since all MProtocolImPlugin methods are currently + * synchronous. + * + * @param [in] aReqId + * Request ID identifying the request which handling + * is completed. This must equal to value given in + * the processing initiation. If no pending IM + * protocol plug-in request is found with this id, + * plug-in is paniced. + * @param [in] aResult + * Status object describing result from request handling. + * Object ownership is transfered always to Im. + * NULL value not allowed. + * @param [in] aParameter + * Additional request complete parameters. + * NULL if no additional parameters to transfer Im. + * Parameter may be single MXIMPBase derived + * object or MImRestrictedObjectCollection object + * containing multiple objects. Ownership of given + * parameter (also the container and contained objects) + * is transfered always to Im. + */ + virtual void HandleRequestCompleted( TXIMPRequestId aReqId, + MImStatus* aResult, + MXIMPBase* aParameter ) = 0; + + }; + + +#endif // MPROTOCOLIMPLUGINHOST_H diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_im_protocol_plugin_host_api/inc/protocolimsearchdatahost.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_im_protocol_plugin_host_api/inc/protocolimsearchdatahost.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,138 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interface for managing cached Search information. +* +*/ + +#ifndef MPROTOCOLIMSEARCHDATAHOST_H +#define MPROTOCOLIMSEARCHDATAHOST_H + + +#include +#include +#include + + +/** + * Interface for managing cached search information. + * + * Interface is used by protocol adaptations to manage + * search related information in + * IM internal data cache + * + * This interface is implemented by IM. + * Protocol adaptation can obtain reference to this + * interface from MXIMPProtocolConnectionHost interface. + * + * For each separated protocol connection, protocol + * adaptation must use the specific + * MProtocolImSearchDataHost instance, + * what is received from the connection specific + * MXIMPProtocolConnectionHost instance. + * + * @ingroup protocolimpluginhostapi + * @since S60 + */ +class MProtocolImSearchDataHost : public MXIMPBase + { +public: + + /** Interface ID for the MProtocolImSearchDataHost. */ + enum { KInterfaceId = IM_IF_ID_PROTOCOL_SEARCH_DATAHOST }; + + +protected: + + + /** + * Protected destructor. Object instancies + * can't be deleted via this interface. + */ + virtual ~MProtocolImSearchDataHost() {} + + + +public: // Handling search information + + + /** + * Notifies IM from + * search result information. + * + * Protocol adaptation implementation can call this + * method to notify IM from search + * result information. IM + * updates its cached status, and + * notifies the subscribing clients from data changes. + * + * IM takes ownership of the argument(s), + * if method succeeds without a leave. + * + * @param [in] aSearchId + * search operation id, used when search is continued or stopped + * @param [in] aResultsFound - Indicates the number of the current findings. + * @param [in] aIndex - Indicates the particular index from which the + * next search can start. It is 0 in error case. + * @param [in] aCompleted - TRUE if server has completed the search, + * FALSE if there are more results available. + * @param [in] aUsrIdResults -List of results( UserId's), + * NULL if none. + * + * @return The request id identifying the issued request. + * Data cache request is processed asynchronously and + * its completion is signalled to adaptation direction + * through MXIMPProtocolConnectionHostObserver interface, + * with MXIMPProtocolRequestCompleteEvent event. + * + * @leave KErrNoMemory if failed to allocate memory. + * @leave KErrArgument if NULL argument(s) were provided. + */ + + virtual TXIMPRequestId HandleSearchL(MXIMPIdentity* aSearchId, + TInt aResultsFound, + TBool aCompleted, + TInt aIndex, + MDesCArray* aUsrIdResults) = 0; + + /** + * Notifies IM from + * search result information. + * + * Protocol adaptation implementation can call this + * method to notify IM from search + * result information. IM + * updates its cached status, and + * notifies the subscribing clients from data changes. + * + * IM takes ownership of the argument(s), + * if method succeeds without a leave. + * + * @param [in] aSearchId + * search operation id, used when search was stopped + * + * @return The request id identifying the issued request. + * Data cache request is processed asynchronously and + * its completion is signalled to adaptation direction + * through MXIMPProtocolConnectionHostObserver interface, + * with MXIMPProtocolRequestCompleteEvent event. + * + * @leave KErrNoMemory if failed to allocate memory. + * @leave KErrArgument if NULL argument(s) were provided. + */ + + virtual TXIMPRequestId HandleSearchStoppedL(MXIMPIdentity* aSearchId) = 0; + }; + + +#endif // MProtocolImSEARCHDATAHOST_H diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_im_protocol_plugin_host_api/ximp_im_protocol_plugin_host_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_im_protocol_plugin_host_api/ximp_im_protocol_plugin_host_api.metaxml Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,14 @@ + + +ximp_im_protocol_plugin_host_api +Protocol adaptation implementation can call this method to notify IM from message forward completion information. IM updates its cached information and notifies the subscribing clients from data changes. +c++ +improcessor + + + + +yes +no + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_presence_base_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_presence_base_api/group/bld.inf Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,27 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: File that exports the files belonging to +: XIMP Presence Base API +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +../inc/presenceerrors.hrh MW_LAYER_PLATFORM_EXPORT_PATH(presenceerrors.hrh) diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_presence_base_api/inc/presenceerrors.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_presence_base_api/inc/presenceerrors.hrh Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,104 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Protocol agnostic error codes for XIMP Framework Presence. +* +*/ + +#ifndef PRESENCEERRORS_HRH +#define PRESENCEERRORS_HRH + + +/** + * XIMP Framework Presence error codes. + * + * Error codes returned from XIMP Framework are either: + * -# System wide Symbian OS error codes (KErrNone, KErrNoMemory, etc.) + * -# Protocol agnostic presence related error codes defined here. + * These error codes have range: KXIMPErrBase ... KXIMPErrLow. (-30150 ) + * + * @ingroup ximppresenceapi + * @since S60 v3.2 + */ +enum + { + KPresenceErrBase = -30138, + + /** + * Error code to indicate that presence protocol or + * protocol adaptation does not support given presence + * information field type. + */ + KPresenceErrPresenceInfoFieldTypeNotSupported = KPresenceErrBase - 1, + + + /** + * Error code to indicate that presence protocol or + * protocol adaptation does not support given presence + * information field value. + */ + KPresenceErrPresenceInfoFieldValueNotSupported = KPresenceErrBase - 2, + + + /** + * Error code to indicate that presence protocol or + * protocol adaptation does not support given presentity + * group property (for example display name property). + */ + KPresenceErrPresentityGroupPropertyNotSupported = KPresenceErrBase - 3, + + + /** + * Error code to indicate that request processing has failed + * on presence service, because the presentity group amount + * exeeds the service specific limit. + */ + KPresenceErrTooManyPresentityGroups = KPresenceErrBase - 4, + + + /** + * Error code to indicate that request processing has failed + * on presence service, because the presentity amount + * exeeds the service specific limit. + */ + KPresenceErrTooManyPresentities = KPresenceErrBase - 5, + + + /** + * Error code to indicate that presence service doesn't know + * the presentity group, which was identified in the request. + */ + KPresenceErrUnknownPresentityGroup = KPresenceErrBase - 6, + + + /** + * Error code to indicate that presence service doesn't know + * the presentity, which was identified in the request. + */ + KPresenceErrUnknownPresentity = KPresenceErrBase - 7, + + + /** + * Error code to indicate that the presence service + * has refused from request handling, because user + * doesn't have enough credits for the operation. + */ + KPresenceErrNotEnoughCredits = KPresenceErrBase - 47 + + + }; + + +#endif // PRESENCEERRORS_HRH + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_presence_base_api/ximp_presence_base_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_presence_base_api/ximp_presence_base_api.metaxml Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,20 @@ + + +XIMP Presence Base API +Contains common base interface and definitions shared between all other XIMP Presence Feture Plug-in APIs. +c++ +ximpfw + + + + + + + + + + +yes +no + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_presence_cache_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_presence_cache_api/group/bld.inf Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: File that exports the files belonging to +: XIMP Presence Cache API +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +../inc/prescachereadhandler.h MW_LAYER_PLATFORM_EXPORT_PATH(prescachereadhandler.h) +../inc/prescachewritehandler.h MW_LAYER_PLATFORM_EXPORT_PATH(prescachewritehandler.h) +../inc/presencecachereader.h MW_LAYER_PLATFORM_EXPORT_PATH(presencecachereader.h) +../inc/presencecachereader.inl MW_LAYER_PLATFORM_EXPORT_PATH(presencecachereader.inl) +../inc/presencecachewriter.h MW_LAYER_PLATFORM_EXPORT_PATH(presencecachewriter.h) +../inc/presencecachewriter.inl MW_LAYER_PLATFORM_EXPORT_PATH(presencecachewriter.inl) diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_presence_cache_api/inc/prescachereadhandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_presence_cache_api/inc/prescachereadhandler.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,59 @@ +/* +* Copyright (c) 2007, 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interface for presence cache reader handler. +* +*/ + +#ifndef MPRESCACHEREADHANDLER_H +#define MPRESCACHEREADHANDLER_H + +/** + * Interface for presence cache reader API handler for asynchronous functions used in API. + * This interface is implemented by the clients as per their needs. + * + * @ingroup ximpprescacheapi + * @since S60 v3.2 + */ + +class MPresenceBuddyInfoList; +class MPresenceBuddyInfo; + +class MPresCacheReadHandler + { + public: + /** + * Handler for AllBuddiesPresenceInService method of MPresenceCacheReader. + * + * @param aErrorCode + * @param aPresenceBuddyInfoList presence infos for all buddies requested. + * Ownership to callee. Can be null if not found. + */ + virtual void HandlePresenceReadL(TInt aErrorCode, + MPresenceBuddyInfoList* aPresenceBuddyInfoList) = 0; + + /** + * Handler for Buddy presence change notifications. + * + * @param aErrorCode + * @param aPresenceBuddyInfo presence info for buddy. + * Ownership to callee. Can be NULL if aErrorCode exist. + */ + virtual void HandlePresenceNotificationL(TInt aErrorCode, + MPresenceBuddyInfo* aPresenceBuddyInfo) = 0; + }; + +#endif // MPRESCACHEREADHANDLER_H + + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_presence_cache_api/inc/prescachewritehandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_presence_cache_api/inc/prescachewritehandler.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,40 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interface for presence cache writer handler. +* +*/ + +#ifndef MPRESCACHEWRITEHANDLER_H +#define MPRESCACHEWRITEHANDLER_H + +/** + * Interface for presence cache writer API. Handler for asynchronous functions used in API. + * This interface is implemented by the clients as per their needs. + * + * @ingroup ximpprescacheapi + * @since S60 v3.2 + */ +class MPresCacheWriteHandler + { + public: + + /** + * Handler for Asynchronous methods of MPresenceCacheWriter. + * + * @param TInt error code comes here + */ + virtual void HandlePresenceWriteL(TInt aErrorCode) = 0; + }; + +#endif // MPRESCACHEWRITEHANDLER_H \ No newline at end of file diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_presence_cache_api/inc/presencecachereader.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_presence_cache_api/inc/presencecachereader.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,195 @@ +/* +* Copyright (c) 2007, 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interface for presence cache reader. +* +*/ + +#ifndef MPRESENCECACHEREADER_H +#define MPRESENCECACHEREADER_H + +#include +#include +#include + +class MPresenceInfo; +class MPresenceBuddyInfoList; +class MPersonPresenceInfo; +class MPresCacheReadHandler; +class MXIMPIdentity; + +/** + * Interface for presence cache reader API. This interface is implemented + * by the XIMP Framework Presence Cache client. Clients must call + * REComSession::FinalClose() from their destructors. Notice that an xsp id is + * in the form ovi:xyz@example.com + * + * @ingroup ximpprescacheapi + * @since S60 v3.2 + */ +class MPresenceCacheReader + { +public: + + /** Interface ID for the MPresenceCacheReader. */ + enum { KInterfaceId = XIMP_ECOM_IF_UID_PRESENCE_CACHE_READER }; + + +public: + + /** + * Factory method to instantiate MPresenceCacheReader through + * the ECom. + * + * @return The new MPresenceCacheReader object. Object + * ownership is returned to caller. + */ + static inline MPresenceCacheReader* NewL(); + + /** + * Public destructor. + * Objects can be deleted through this interface. + */ + virtual inline ~MPresenceCacheReader(); + +protected: + + /** + * Default constructor to zero initialize + * the iEcomDtorID member. + */ + inline MPresenceCacheReader(); + + +public: //Sub interfaces for presence cache reader, Synchonous methods + + /** + * Instantiates new identity object. + * + * @return New Identity instance. Object ownership is returned to caller. + * @leave KErrNoMemory if failed to allocate memory. + */ + virtual MXIMPIdentity* NewIdentityLC() = 0; + + /** + * Reads presence info from cache for a given identity, returns immediately. + * + * @param aIdentity buddy id, identity must be in xsp id format + * @return MPresenceInfo for the given buddy. Ownership to caller. + * Null if service or buddy not found, not on Cleanup in that case. + */ + virtual MPresenceInfo* PresenceInfoLC(const MXIMPIdentity& aIdentity) = 0; + + /** + * Returns total number of buddies stored in presence cache. + * It includes all services, probably useful while deciding performance + * overheads or informing to the user. + * + * @return TInt Total number of presence infos in presence cache. + */ + virtual TInt BuddyCountInAllServices() = 0; + + /** + * Returns total number of buddies (presence infos) stored in a specific + * service in presence cache. It includes only the given service. + * + * @param aServiceName as in device's service table + * @return TInt buddy count or error code. e.g. in case of service not + * found return value is KErrNotFound. + */ + virtual TInt BuddyCountInService(const TDesC& aServiceName) = 0; + + /** + * Returns total number services in presence cache. + * + * @return TInt total number of services in presence cache. + */ + virtual TInt ServicesCount() = 0; + + /** + * Returns all service names present in presence cache. + * + * @returned Service names are returned here, ownership to caller. + */ + //virtual CDesCArray* ServicesLC() = 0; + + /** + * Cancels any async. read operation going on. After calling this + * method no callback will be received from asycn read method. + * + * @return error code, KErrNone if successfully cancelled. + */ + virtual TInt CancelRead() = 0; + + +public: //Sub interfaces for presence cache reader, Asynchronous methods + + /** + * Reads all presence info from cache for a given service. Returns in + * MPresCacheReadHandler's HandlePresenceReadL. + * + * @param aServiceName Service name to search from + * @param aHandler to handle async. callback + * @return error code, in case of error callback wont be called. + */ + virtual TInt AllBuddiesPresenceInService(const TDesC& aServiceName, + MPresCacheReadHandler* aHandler) = 0; + +public: //Sub interfaces for presence cache reader, Asynchronous methods + + /** + * Sets the observer to receive Presence Buddy Change notifications. + * Observer must be set before using SubscribePresenceBuddyChangeL. + * If client changes the observer using this method, all the notifications + * related to existing and new subscriptions will be delivered to + * the new observer. + * + * @return Error code, if KErrNone observer is successfully set. + */ + virtual TInt SetObserverForSubscribedNotifications( + MPresCacheReadHandler* aHandler) = 0; + + /** + * Subscribe for given presence buddy's change in presence. An observer + * must be set before using this method by SetObserverForSubscribedNotifications. + * Notifcations are delivered through MPresCacheReadHandler's HandlePresenceNotificationL + * + * @param aIdentity buddy id, identity must be in xsp id format + * @return KErrNone if successful, KErrArgument if observer not set + * @leave Only in system error cases e.g. if failed to allocate memory. + */ + virtual TInt SubscribePresenceBuddyChangeL(const MXIMPIdentity& aIdentity) = 0; + + /** + * Unsubscribe for given presence buddy's change in presence. The request + * is ignored if invalid. + * + * @param aIdentity buddy id, identity must be in xsp id format + * @leave Only in system error cases e.g. if failed to allocate memory. + */ + virtual void UnSubscribePresenceBuddyChangeL(const MXIMPIdentity& aIdentity) = 0; + + +private: // Data + + //OWN: ECom destructor ID + TUid iEcomDtorID; + }; + +#include + + +#endif // MPRESENCECACHEREADER_H + + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_presence_cache_api/inc/presencecachereader.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_presence_cache_api/inc/presencecachereader.inl Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,63 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Presence Cache reader interface used by XIMP Presence clients. +* +*/ + +#include + +// ----------------------------------------------------------------------------- +// MPresenceCacheReader::NewL() implementation +// Factory method to instantiate the platform default +// MPresenceCacheReader implementation through the ECom framework. +// ----------------------------------------------------------------------------- +// +inline MPresenceCacheReader* MPresenceCacheReader::NewL() + { + _LIT8( KXIMPPresenceDefaultData, XIMP_ECOM_DEFAULT_DATA_PRESENCE_INTERFACE ); + + TEComResolverParams resolvingParams; + resolvingParams.SetDataType( KXIMPPresenceDefaultData ); + resolvingParams.SetWildcardMatch( ETrue ); + + TAny* imp = REComSession::CreateImplementationL( TUid::Uid( MPresenceCacheReader::KInterfaceId ), + _FOFF( MPresenceCacheReader, iEcomDtorID ), + resolvingParams ); + + return reinterpret_cast< MPresenceCacheReader* >( imp ); + } + + +// ----------------------------------------------------------------------------- +// MPresenceCacheReader::MPresenceCacheReader() implementation +// Zero initializes the iEcomDtorID member. +// ----------------------------------------------------------------------------- +// +inline MPresenceCacheReader::MPresenceCacheReader() + { + iEcomDtorID = TUid::Null(); + } + + +// ----------------------------------------------------------------------------- +// MPresenceCacheReader::~MPresenceCacheReader() +// Destructor notifies the ECom from implementation destruction. +// ----------------------------------------------------------------------------- +// +inline MPresenceCacheReader::~MPresenceCacheReader() + { + REComSession::DestroyedImplementation( iEcomDtorID ); + } + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_presence_cache_api/inc/presencecachewriter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_presence_cache_api/inc/presencecachewriter.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,193 @@ +/* +* Copyright (c) 2007, 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interface for presence cache writer. +* +*/ + +#ifndef MPRESENCECACHEWRITER_H +#define MPRESENCECACHEWRITER_H + +#include +#include +#include + + +class MPresenceInfo; +class MPersonPresenceInfo; +class MPresenceInfoField; +class MPresenceBuddyInfo; +class MPersonPresenceInfo; +class MPresCacheWriteHandler; +class MPresenceBuddyInfoList; +class MXIMPIdentity; +class MPresenceObjectFactory; + + +/** + * Interface for presence cache writer API. This interface is implemented + * by the XIMP Framework Presence Cache client. Clients must call + * REComSession::FinalClose() from their destructors. Notice that an xsp id is + * in the form ovi:xyz@example.com + * + * @ingroup ximpprescacheapi + * @since S60 v3.2 + */ +class MPresenceCacheWriter //: public MXIMPBase + { +public: + + /** Interface ID for the MPresenceCacheWriter. */ + enum { KInterfaceId = XIMP_ECOM_IF_UID_PRESENCE_CACHE_WRITER }; + + +public: + + /** + * Factory method to instantiate MPresenceCacheWriter through + * the ECom. + * + * @return The new MPresenceCacheWriter object. Object + * ownership is returned to caller. + */ + static inline MPresenceCacheWriter* NewL(); + + /** + * Public destructor. + * Objects can be deleted through this interface. + */ + virtual inline ~MPresenceCacheWriter(); + +protected: + + /** + * Default constructor to zero initialize + * the iEcomDtorID member. + */ + inline MPresenceCacheWriter(); + + +public: //Sub interfaces for presence cache writer, Synchonous methods + + /** + * Writes presence info to cache for a given buddy. Leaves only in system + * errors. + * + * @param aPresenceBuddyInfo contains xsp identity and presence + * @return Error code + */ + virtual TInt WritePresenceL(const MPresenceBuddyInfo* aPresenceBuddyInfo) = 0; + + + /** + * Instantiates new Presence object Factory object. With this factory presence + * related ximp structures can be created. + * + * @return reference to MPresenceObjectFactory. No ownership to caller. + */ + virtual MPresenceObjectFactory& PresenceObjectFactory() const = 0; + + + /** + * Instantiates new identity object. + * + * @return New Identity instance. Object ownership is returned to caller. + * @leave KErrNoMemory if failed to allocate memory. + */ + virtual MXIMPIdentity* NewIdentityLC() = 0; + + + /** + * Instantiates new presence info object. + * + * @return New presence info instance. Object ownership + * is returned to caller. + * @leave KErrNoMemory if failed to allocate memory. + */ + virtual MPresenceInfo* NewPresenceInfoLC() = 0; + + + /** + * Instantiates new buddy presence info object. + * + * @return New buddy presence info instance. Object ownership + * is returned to caller. + * @leave KErrNoMemory if failed to allocate memory. + */ + virtual MPresenceBuddyInfo* NewBuddyPresenceInfoLC() = 0; + + /** + * Instantiates new buddy presence info list object. + * + * @param aServiceName service name for this list, if set to KNullDesC + * the list can be appended with identities from different services + * @return New buddy presence info list instance. Object ownership + * is returned to caller. + * @leave KErrNoMemory if failed to allocate memory. + */ + virtual MPresenceBuddyInfoList* NewPresenceBuddyInfoListLC(const TDesC& aServiceName) = 0; + + + /** + * Delete all buddies presence associated with given service. + * + * @param aServiceName service name as in sp table + * @return error code + */ + virtual TInt DeleteService(const TDesC& aServiceName) = 0; + + /** + * Deletes all presence related to given xsp identity. + * Leaves only in system errors. + * + * @param MXIMPIdentity identity for buddy to be removed, in xsp format + * @return error code + */ + virtual TInt DeletePresenceL(const MXIMPIdentity& aIdentity) = 0; + + /** + * Cancels any async. write operation going on. After calling this + * method no callback will be received from asycn write method. + * + * @return error code, KErrNone if successfully cancelled. + */ + virtual TInt CancelWrite() = 0; + + +public: //Sub interfaces for presence cache writer, Asynchronous methods + + /** + * Writes buddy presence info objects to cache. Returns in + * MPresCacheWriteHandler's HandlePresenceWriteL. Provide a null pointer + * to receive no call back. Leaves only in system errors. + * + * @param aBuddyPresenceInfos presence infos for all buddies. + * Ownership remains to caller. + * @param MPresCacheWriterHandler to handle async calls. A 'NULL' pointer + * can be provided to receive no call back. + * @return TInt error code. + */ + virtual TInt WritePresenceL(const MPresenceBuddyInfoList* aBuddyPresenceInfos, + MPresCacheWriteHandler* aHandler) = 0; + + +private: // Data + + //OWN: ECom destructor ID + TUid iEcomDtorID; + }; + +#include + + +#endif // MPRESENCECACHEWRITER_H \ No newline at end of file diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_presence_cache_api/inc/presencecachewriter.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_presence_cache_api/inc/presencecachewriter.inl Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,63 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Presence Cache writer interface used by XIMP Presence clients. +* +*/ + +#include + +// ----------------------------------------------------------------------------- +// MPresenceCacheWriter::NewL() implementation +// Factory method to instantiate the platform default +// MPresenceCacheWriter implementation through the ECom framework. +// ----------------------------------------------------------------------------- +// +inline MPresenceCacheWriter* MPresenceCacheWriter::NewL() + { + _LIT8( KXIMPPresenceDefaultData, XIMP_ECOM_DEFAULT_DATA_PRESENCE_INTERFACE ); + + TEComResolverParams resolvingParams; + resolvingParams.SetDataType( KXIMPPresenceDefaultData ); + resolvingParams.SetWildcardMatch( ETrue ); + + TAny* imp = REComSession::CreateImplementationL( TUid::Uid( MPresenceCacheWriter::KInterfaceId ), + _FOFF( MPresenceCacheWriter, iEcomDtorID ), + resolvingParams); + + return reinterpret_cast< MPresenceCacheWriter* >( imp ); + } + + +// ----------------------------------------------------------------------------- +// MPresenceCacheWriter::MPresenceCacheWriter() implementation +// Zero initializes the iEcomDtorID member. +// ----------------------------------------------------------------------------- +// +inline MPresenceCacheWriter::MPresenceCacheWriter() + { + iEcomDtorID = TUid::Null(); + } + + +// ----------------------------------------------------------------------------- +// MPresenceCacheWriter::~MPresenceCacheWriter() +// Destructor notifies the ECom from implementation destruction. +// ----------------------------------------------------------------------------- +// +inline MPresenceCacheWriter::~MPresenceCacheWriter() + { + REComSession::DestroyedImplementation( iEcomDtorID ); + } + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_presence_cache_api/ximp_presence_cache_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_presence_cache_api/ximp_presence_cache_api.metaxml Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,20 @@ + + +ximp_presence_cache_api +This is a API that provides read and write to the presence cache. +c++ +ximpfw + + + + + + + + + + +yes +no + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_presence_data_model_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_presence_data_model_api/group/bld.inf Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,45 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: File that exports the files belonging to +: XIMP Presence Data Model API +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +../inc/presencedatamodelifids.hrh MW_LAYER_PLATFORM_EXPORT_PATH(presencedatamodelifids.hrh) +../inc/presenceinfofieldcollection.h MW_LAYER_PLATFORM_EXPORT_PATH(presenceinfofieldcollection.h) +../inc/presenceinfo.h MW_LAYER_PLATFORM_EXPORT_PATH(presenceinfo.h) +../inc/devicepresenceinfo.h MW_LAYER_PLATFORM_EXPORT_PATH(devicepresenceinfo.h) +../inc/presenceobjectfactory.h MW_LAYER_PLATFORM_EXPORT_PATH(presenceobjectfactory.h) +../inc/presenceinfofieldvaluebinary.h MW_LAYER_PLATFORM_EXPORT_PATH(presenceinfofieldvaluebinary.h) +../inc/presenceinfofilter.h MW_LAYER_PLATFORM_EXPORT_PATH(presenceinfofilter.h) +../inc/presenceinfofield.h MW_LAYER_PLATFORM_EXPORT_PATH(presenceinfofield.h) +../inc/presencegrantrequestinfo.h MW_LAYER_PLATFORM_EXPORT_PATH(presencegrantrequestinfo.h) +../inc/presenceblockinfo.h MW_LAYER_PLATFORM_EXPORT_PATH(presenceblockinfo.h) +../inc/personpresenceinfo.h MW_LAYER_PLATFORM_EXPORT_PATH(personpresenceinfo.h) +../inc/presenceinfofieldvalueenum.h MW_LAYER_PLATFORM_EXPORT_PATH(presenceinfofieldvalueenum.h) +../inc/presencewatcherinfo.h MW_LAYER_PLATFORM_EXPORT_PATH(presencewatcherinfo.h) +../inc/presentitygroupinfo.h MW_LAYER_PLATFORM_EXPORT_PATH(presentitygroupinfo.h) +../inc/presenceinfofieldvaluetext.h MW_LAYER_PLATFORM_EXPORT_PATH(presenceinfofieldvaluetext.h) +../inc/servicepresenceinfo.h MW_LAYER_PLATFORM_EXPORT_PATH(servicepresenceinfo.h) +../inc/presentitygroupmemberinfo.h MW_LAYER_PLATFORM_EXPORT_PATH(presentitygroupmemberinfo.h) +../inc/presencebuddyinfo.h MW_LAYER_PLATFORM_EXPORT_PATH(presencebuddyinfo.h) +../inc/presencebuddyinfolist.h MW_LAYER_PLATFORM_EXPORT_PATH(presencebuddyinfolist.h) diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_presence_data_model_api/inc/devicepresenceinfo.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_presence_data_model_api/inc/devicepresenceinfo.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,98 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interface for device presence info object. +* +*/ + +#ifndef MXIMPFWDEVICEPRESENCEINFO_H +#define MXIMPFWDEVICEPRESENCEINFO_H + +#include +#include +#include + + +class MPresenceInfoFieldCollection; + + +/** + * Interface for device presence info object. + * + * + * + * @todo Interface might be extended with new methods. + * + * @ingroup presencedatamodelapi + * @since S60 v3.2 + */ +class MDevicePresenceInfo : public MXIMPBase + { +public: + + /** Interface ID for the MDevicePresenceInfo. */ + enum { KInterfaceId = PRES_IF_ID_DEVICE_PRESENCE_INFO }; + + +public: + + /** + * Public destructor. MDevicePresenceInfo object + * can be deleted through this interface. + */ + virtual ~MDevicePresenceInfo() {} + + +public: + + /** + * Returns device name value. + * + * Returns string identifying type of device. + * + * @return Device name. + */ + virtual const TPtrC8 DeviceName() const = 0; + + /** + * Set service name. + * + * @leave KErrNoMemory if failed to allocate memory + */ + virtual void SetDeviceNameL( const TDesC8& aDeviceName ) = 0; + + /** + * Returns read-only reference to presence information + * field collection. + * + * @return Presence information field collection. + */ + virtual const MPresenceInfoFieldCollection& Fields() const = 0; + + + /** + * Returns modifiable reference to presence + * information field collection. + * + * @return Presence information field collection. + */ + virtual MPresenceInfoFieldCollection& Fields() = 0; + + }; + + + +#endif //MXIMPFWDEVICEPRESENCEINFO_H + + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_presence_data_model_api/inc/personpresenceinfo.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_presence_data_model_api/inc/personpresenceinfo.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,81 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interface for person presence info object. +* +*/ + +#ifndef MXIMPFWPERSONPRESENCEINFO_H +#define MXIMPFWPERSONPRESENCEINFO_H + +#include +#include +#include + + +class MPresenceInfoFieldCollection; + + +/** + * Interface for person presence info object. + * + * + * @todo Interface might be extended with new methods. + * + * @ingroup presencedatamodelapi + * @since S60 v3.2 + */ +class MPersonPresenceInfo : public MXIMPBase + { +public: + + /** Interface ID for the MPersonPresenceInfo. */ + enum { KInterfaceId = PRES_IF_ID_PERSON_PRESENCE_INFO }; + + +public: + + /** + * Public destructor. MPersonPresenceInfo object + * can be deleted through this interface. + */ + virtual ~MPersonPresenceInfo() {} + + +public: + + /** + * Returns read-only reference to presence information + * field collection. + * + * @return Presence information field collection. + */ + virtual const MPresenceInfoFieldCollection& Fields() const = 0; + + + /** + * Returns modifiable reference to presence + * information field collection. + * + * @return Presence information field collection. + */ + virtual MPresenceInfoFieldCollection& Fields() = 0; + + }; + + + +#endif //MXIMPFWPERSONPRESENCEINFO_H + + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_presence_data_model_api/inc/presenceblockinfo.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_presence_data_model_api/inc/presenceblockinfo.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,111 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interface for presence block info object. +* +*/ + +#ifndef MXIMPFWPRESENCEBLOCKINFO_H +#define MXIMPFWPRESENCEBLOCKINFO_H + +#include +#include +#include + + +class MXIMPIdentity; + + +/** + * Interface for presence block info object. + * + * Presence block info object presents single + * presence block entry in the presence block list. + * Presence block info object holds the identity + * and display name information for the presence + * block entry. + * + * @ingroup presencedatamodelapi + * @since S60 v3.2 + */ +class MPresenceBlockInfo : public MXIMPBase + { +public: + + /** Interface ID for the MPresenceBlockInfo. */ + enum { KInterfaceId = PRES_IF_ID_PRESENCE_BLOCK_INFO }; + + +public: + + + /** + * Public destructor. + * Objects can be deleted through this interface. + */ + virtual ~MPresenceBlockInfo() {} + + +public: + + /** + * Returns identity of the blocked entity. + * + * @return The identity of the blocked entity. + */ + virtual const MXIMPIdentity& BlockedEntityId() const = 0; + + + + /** + * Returns displayname of the blocked entity. + * + * @return The displayname of the blocked entity. + */ + virtual const TDesC16& BlockedEntityDisplayName() const = 0; + + + + /** + * Sets identity of the blocked entity. + * + * @param [in] aIdentity + * Identity of the blocked entity. + * Ownership of the argument is transfered to + * callee, if method succeeds without a leave. + * + * @leave KErrNoMemory if failed to allocate memory. + * @leave KErrArgument if NULL argument were provided. + */ + virtual void SetBlockedEntityIdL( + MXIMPIdentity* aIdentity ) = 0; + + + /** + * Sets displayname of the blocked entity. + * + * @param [in] aDisplayName + * New display name value. + * + * @leave KErrNoMemory if failed to allocate memory. + */ + virtual void SetBlockedEntityDisplayNameL( + const TDesC16& aDisplayName ) = 0; + + }; + + +#endif // MXIMPFWPRESENCEBLOCKINFO_H + + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_presence_data_model_api/inc/presencebuddyinfo.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_presence_data_model_api/inc/presencebuddyinfo.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,121 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interface for presence buddy presence info. +* +*/ + +#ifndef MPRESENCEBUDDYINFO_H +#define MPRESENCEBUDDYINFO_H + +#include +#include +#include + +class MPresenceInfo; +class MPersonPresenceInfo; +class MXIMPIdentity; + +/** + * Interface buddy presence info. This object has MPresenceInfo and MXIMPIdentity + * with and service Uid. This interface is implemented by the XIMP Framework + * Presence Data model. + * Users of XIMP can not create this object themselves, instead it's created from + * MPresenceCacheWriter interface. + * + * @ingroup presencedatamodelapi + * @since S60 v3.2 + */ +class MPresenceBuddyInfo : public MXIMPBase + { +public: + + /** Interface ID for the MPresenceBuddyInfo. */ + enum { KInterfaceId = PRES_IF_ID_PRESENCE_BUDDY_INFO }; + + +public: + + /** + * Public destructor. + * Objects can be deleted through this interface. + */ + virtual ~MPresenceBuddyInfo() {} + +public: + + /** + * Sets the buddy identity, service and presence info. Takes ownerships. + * + * @param aService Service UID of the buddy + * @param aPresenceInfo for the buddy. Takes ownership. + * @return Error code + */ + virtual TInt Set( MXIMPIdentity* aIdentity, + MPresenceInfo* aPresenceInfo) = 0; + + /** + * Sets the presence info. + * + * @param aPresenceInfo for the buddy. Takes ownership. + * @return Error code + */ + virtual TInt SetPresenceInfo(MPresenceInfo* aPresenceInfo) = 0; + + + /** + * Sets the Buddy Identity. + * + * @param aIdentity identity of the buddy. Takes ownership. + * @return Error code + */ + virtual TInt SetBuddyId(MXIMPIdentity* aIdentity) = 0; + + /** + * Sets the buddy's person presence info. Leaves in system errors only. + * + * @param aPersonPresenceInfo for the buddy. Takes ownership. + * @return Error code + */ + virtual TInt SetPersonPresenceL(MPersonPresenceInfo* aPersonPresenceInfo) = 0; + + /** + * Reads presence info. + * + * @return MPresenceInfo for the given buddy. Ownership remains to this object. + */ + virtual const MPresenceInfo* PresenceInfo() const = 0; + + /** + * Reads buddy Id. + * + * @return MXIMPIdentity id. + */ + virtual const MXIMPIdentity* BuddyId() const = 0; + + + /** + * Return true if identity is same with other instance. + * + * @param aOtherInstance other instance of this object. + * @return ETrue if same. + */ + virtual TBool EqualsIdentity( + const MPresenceBuddyInfo* aOtherInstance ) const = 0; + + }; + +#endif // MPRESENCEBUDDYINFO_H + + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_presence_data_model_api/inc/presencebuddyinfolist.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_presence_data_model_api/inc/presencebuddyinfolist.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,106 @@ +/* +* Copyright (c) 2007, 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interface for presence buddy info list. +* +*/ + +#ifndef MPRESENCEBUDDYINFOLIST_H +#define MPRESENCEBUDDYINFOLIST_H + +#include +#include +#include + +class MPresenceBuddyInfo; +class MXIMPIdentity; + +/** + * Interface for buddy presence info list. This object has a pointer array of + * MPresenceBuddyInfo(s). + * This interface is implemented by the XIMP Framework Presence Data model. + * Users of XIMP can not create this object themselves, instead it's created from + * MPresenceCacheWriter interface. + * + * @ingroup presencedatamodelapi + * @since S60 v3.2 + */ +class MPresenceBuddyInfoList : public MXIMPBase + { +public: + + /** Interface ID for the MPresenceBuddyInfoList. */ + enum { KInterfaceId = PRES_IF_ID_PRESENCE_BUDDY_INFO_LIST }; + + +public: + + /** + * Public destructor. + * Objects can be deleted through this interface. + */ + virtual ~MPresenceBuddyInfoList() {} + + /** + * Gets reference to object collection. + * + * @return MXIMPObjectCollection. Ownership remains to this object. + */ + virtual RPointerArray& GetObjectCollection() = 0; + + + /** + * Service name accessor. + * + * @return Service name. + */ + virtual TPtrC ServiceName() const = 0; + + /** + * Number of MPresenceBuddyInfo. + * + * @return TInt count. + */ + virtual TInt Count() const = 0; + + /** + * Add or replace the buddy presence info object in this collection. + * The object will be replaced if found same used id and service. + * Takes Ownership. + * @param aBuddyPresenceInfo object to add or replace. + * @return error code + */ + virtual TInt AddOrReplace(MPresenceBuddyInfo* aBuddyPresenceInfo) = 0; + + /** + * Find and remove the buddy presence info object matching given identity. + * The first found object will be removed with same identity. + * @param aIdentity to be matched for. + * @return error code + */ + virtual TInt FindAndRemove(const MXIMPIdentity& aIdentity) = 0; + + /** + * Find and get the first found buddy presence info object matching given identity. + * A Null pointer will be returned if object with same identity not found. + * ownership remains to callee. + * @param aIdentity to be matched for. + */ + virtual MPresenceBuddyInfo* FindAndGet(const MXIMPIdentity& aIdentity) const = 0; + + }; + +#endif // MPRESENCEBUDDYINFOLIST_H + + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_presence_data_model_api/inc/presencedatamodelifids.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_presence_data_model_api/inc/presencedatamodelifids.hrh Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,70 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework Presence Data Model API interface IDs. +* +*/ + +#ifndef PRESENCEDATAMODELIFIDS_HRH +#define PRESENCEDATAMODELIFIDS_HRH + + +/** + * @defgroup ximppresenceapi XIMP Framework Presence API + * @defgroup presencedatamodelapi XIMP Presence Data Model API + * @ingroup ximppresenceapi + * + * XIMP Framework Presence Data Model API contains + * abstract interfaces for presentity groups, + * presence authorization and presence information, + * related data items. API provides also abstract object + * factory interface to instantiate other related objects. + * + * @TODO Is it ok?: Object types declared in XIMP Framework Data Model API + * are used both in XIMP Framework - client communication + * and in XIMP Framework - protocol adaptation cummunication. + * + * @since S60 v3.2 + */ + +// Data model IF id's +// 10xx - ximp related +// 11xx - presence related +// 12xx - instant messaging related + +// Interface IDs for Presence Data Model API interfaces +#define PRES_IF_ID_PRESENTITY_GROUP_INFO 1101 +#define PRES_IF_ID_PRESENTITY_GROUP_MEMBER_INFO 1102 +#define PRES_IF_ID_PRESENCE_WATCHER_INFO 1103 +#define PRES_IF_ID_PRESENCE_GRANT_REQUEST_INFO 1104 +#define PRES_IF_ID_PRESENCE_BLOCK_INFO 1105 +#define PRES_IF_ID_PRESENCE_INFO 1106 +#define PRES_IF_ID_PRESENCE_INFO_FILTER 1107 +#define PRES_IF_ID_DEVICE_PRESENCE_INFO 1108 +#define PRES_IF_ID_PERSON_PRESENCE_INFO 1109 +#define PRES_IF_ID_SERVICE_PRESENCE_INFO 1110 +#define PRES_IF_ID_PRESENCE_INFO_FIELD_COLLECTION 1111 +#define PRES_IF_ID_PRESENCE_FIELD 1112 +#define PRES_IF_ID_PRESENCE_INFO_FIELD_VALUE_BINARY 1113 +#define PRES_IF_ID_PRESENCE_INFO_FIELD_VALUE_TEXT 1114 +#define PRES_IF_ID_PRESENCE_INFO_FIELD_VALUE_ENUM 1115 +#define PRES_IF_ID_PRESENCE_BUDDY_INFO 1116 +#define PRES_IF_ID_PRESENCE_BUDDY_INFO_LIST 1117 + +#define PRES_IF_ID_PRESENCE_OBJECT_FACTORY 1027 + + +#endif // PRESENCEDATAMODELIFIDS_HRH + + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_presence_data_model_api/inc/presencegrantrequestinfo.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_presence_data_model_api/inc/presencegrantrequestinfo.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,114 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interface for presence grant request info object. +* +*/ + +#ifndef MXIMPFWPRESENCEGRANTREQUESTINFO_H +#define MXIMPFWPRESENCEGRANTREQUESTINFO_H + +#include +#include +#include + + +class MXIMPIdentity; + + +/** + * Interface for presence grant request info object. + * + * Presence grant request info object presents single + * presence grant request entry in the presence + * grant request list. Presence grant request info + * object holds the identity and display name information + * for the presence grant request. + * + * @ingroup presencedatamodelapi + * @since S60 v3.2 + */ +class MPresenceGrantRequestInfo : public MXIMPBase + { +public: + + /** Interface ID for the MPresenceGrantRequestInfo. */ + enum { KInterfaceId = PRES_IF_ID_PRESENCE_GRANT_REQUEST_INFO }; + + +public: + + /** + * Public destructor. + * Objects can be deleted through this interface. + */ + virtual ~MPresenceGrantRequestInfo() {} + + + +public: + + + /** + * Returns presence requestor identity value. + * + * @return The presence requestor identity value. + */ + virtual const MXIMPIdentity& RequestorId() const = 0; + + + + /** + * Returns presence requestor displayname value. + * + * @return The presence requestor displayname value. + */ + virtual const TDesC16& RequestorDisplayName() const = 0; + + + + /** + * Sets presence requestor identity value. + * + * @param [in] aIdentity + * New presence requestor identity value. + * Ownership of the argument is transfered to + * callee, if method succeeds without a leave. + * + * @leave KErrNoMemory if failed to allocate memory. + * @leave KErrArgument if NULL argument were provided. + */ + virtual void SetRequestorIdL( + MXIMPIdentity* aIdentity ) = 0; + + + + /** + * Sets presence requestor display name value. + * + * @param [in] aDisplayName + * New display name value. + * + * @leave KErrNoMemory if failed to allocate memory. + */ + virtual void SetRequestorDisplayNameL( + const TDesC16& aDisplayName ) = 0; + + + }; + + +#endif // MXIMPFWPRESENCEGRANTREQUESTINFO_H + + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_presence_data_model_api/inc/presenceinfo.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_presence_data_model_api/inc/presenceinfo.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,416 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interface for presence info object. +* +*/ + +#ifndef MXIMPFWPRESENCEINFO_H +#define MXIMPFWPRESENCEINFO_H + +#include +#include +#include + + + +/** + * Name constants and similar definitions + * for presence information components and + * presence information fields. + * + * @ingroup presencedatamodelapi + * @since S60 v3.2 + */ +namespace NPresenceInfo + { + + /** + * Common type constants for MServicePresenceInfo + * objects. + * + * @ingroup presencedatamodelapi + * @since S60 v3.2 + */ + namespace NServiceType + { + _LIT8( KInstantMessaging, "instant-messaging"); + _LIT8( KPushToTalk, "push-to-talk"); + _LIT8( KVoip, "voip"); + _LIT8( KCall, "call"); + _LIT8( KSms, "sms"); + _LIT8( KMms, "mms"); + _LIT8( KEMail, "e-mail"); + _LIT8( KGame, "game"); + } + + + /** + * Common name constants MPresenceInfoField + * objects. + * + * @ingroup presencedatamodelapi + * @since S60 v3.2 + */ + namespace NFieldType + { + + /** + * Field type for "status message" field. + * + * Status message field contains user written + * free text, describing for example his/hers current + * presence status. Status message is in unicode format. + * + * Field storage format: MPresenceInfoFieldValueText + */ + _LIT8( KStatusMessage, "status-msg"); + + + + /** + * Field type for "avatar" field. + * + * Avatar field contains user selected image. Image may be + * an avatar describing the user or it may be image showing + * user current presence status. + * + * Image is in JPEG or similar format, for what there exists + * image codes in the platform. Field contains image binary + * content and MIME string describing the content format. + * + * Field storage format: MPresenceInfoFieldValueBinary + */ + _LIT8( KAvatar, "avatar"); + + + + /** + * Field type for "availability-text" field. + * + * Availability text field describes presentity's communication + * availability as text. This is useful in case of branded + * presence availability, since any text value is possible. + * + * Field storage format: MPresenceInfoFieldValueText + */ + _LIT8( KAvailability, "availability"); + + + + /** + * Field type for "availability" field enumeration value. + * + * Availability field describes presentitys communication + * availability. Possible availability values are + * listed in TAvailabilityValues enumeration. + * + * Field storage format: MPresenceInfoFieldValueEnum + */ + _LIT8( KAvailabilityEnum, "availability-enum"); + + + + /** + * This means that all field types are accepted. + * Field types are status message, avatar and + * availability. + * + */ + _LIT8( KAcceptAll, "*"); + } + + + + /** + * Common enumerated availability values for "availability" + * presence information field. + * + * @ingroup presencedatamodelapi + * @since S60 v3.2 + */ + enum TAvailabilityValues + { + + /** + * Presentity is not available for communication. + */ + ENotAvailable = 0, + + + /** + * Presentity is currently busy. + * Presentity may or may not be available + * for for communication. + */ + EBusy = 1, + + + /** + * Presentity is available for communication. + */ + EAvailable = 2, + + /** + * Presentity appears Offline for communication. + */ + EHidden = 3, + + /** + * Presentity is away. + */ + EAway = 4, + + /** + * Presentity is extended away + */ + EExtAway = 5, + + /** + * Presentity is on the Phone Call + */ + EOnPhone = 6, + + /** + * Presentity is in Do Not disturb status + */ + EDoNotDisturb = 7, + + /** + * Presentity of received contact request + */ + EPendingRequest = 8, + + /** + * Presentity of received contact request when offline + */ + EPendingRequestOffline = 9, + + /** + * Presentity is Empty / Not matched + */ + EEmptyStatus = 10, + + /** + * Presentity is offline + */ + EOffline = 11, + + /** + * Presentity is Local Pending + */ + ELocalPending = 12, + + /** + * Presentity is offline + */ + ERemotePending = 13 + + + }; + + + const TInt KValueLengthUnlimited = -1; + } + + + +class MPersonPresenceInfo; +class MServicePresenceInfo; +class MDevicePresenceInfo; + + +/** + * Interface for presence info object. + * + * + * @todo Interface might be extended with new methods. + * + * @ingroup presencedatamodelapi + * @since S60 v3.2 + */ +class MPresenceInfo : public MXIMPBase + { +public: + + /** Interface ID for the MPresenceInfo. */ + enum { KInterfaceId = PRES_IF_ID_PRESENCE_INFO }; + + + +public: + + /** + * Public destructor. MPresenceInfo object + * can be deleted through this interface. + */ + virtual ~MPresenceInfo() {} + + +public: // Access to person presence + + + /** + * Returns read-only person presence information object. + * + * Returns the read-only person presence information + * object or NULL if person presence information + * not available. + * + * @return Person presence information object or NULL. + */ + virtual const MPersonPresenceInfo* PersonPresence() const = 0; + + /** + * Returns person presence information object. + * + * Returns the person presence information + * object or NULL if person presence information + * not available. + * + * @return Person presence information object or NULL. + */ + virtual MPersonPresenceInfo* PersonPresence() = 0; + + + /** + * Sets person presence information object. + * + * @param [in] aPersonPresence + * New person presence value. + * Ownership of the argument is transfered to + * callee, if method succeeds without a leave. + * + * @leave KErrNoMemory if failed to allocate memory. + * @leave KErrArgument if NULL argument were provided. + */ + virtual void SetPersonPresenceL( + MPersonPresenceInfo* aPersonPresence ) = 0; + + + +public: // Access to service presence + + + /** + * Returns count of service presence information objects. + * + * @return Count of service presence information objects. + */ + virtual TInt ServicePresenceCount() const = 0; + + + /** + * Returns a read-only service presence information object. + * + * @param [in] aIndex + * Zero-based index of the service presence + * information object to return. + * + * @return Reference to a service presence information + * object at aIndex. + */ + virtual const MServicePresenceInfo& ServicePresenceAt( + TInt aIndex ) const = 0; + + + /** + * Looks up a read-only service presence information object, + * having matching service type. + * + * @param [in,out] aServicePresence + * On entry, contains the object from where to start + * the lookup or NULL if lookup should be started from + * the beginning of the set. + * If object given in entry is not found from set, + * lookup is started from the beginning of the set. + * On return, if an matching object is found, this is + * set to point to the found object, else NULL. + * Found object ownership is not returned to caller. + * + * @param [in] aMatch + * The service type match pattern. + * Match pattern may contain question mark and + * asterisk characters ("?", "*") resepectively to + * match single or multiple characters. Service type + * are handled as folded in pattern matching. + */ + virtual void LookupServicePresenceByServiceType( + MServicePresenceInfo*& aServicePresence, + const TDesC8& aMatch ) const = 0; + + + /** + * Adds service presence information object. + * + * @param [in] aServicePresence + * New service presence value. + * Ownership of the argument is transfered to + * callee, if method succeeds without a leave. + * + * @leave KErrNoMemory if failed to allocate memory. + * @leave KErrArgument if NULL argument were provided. + */ + virtual void AddServicePresenceL( + MServicePresenceInfo* aServicePresence ) = 0; + + + + +public: // Access to device presence + + + /** + * Returns count of device presence information objects. + * + * @return Count of device presence information objects. + */ + virtual TInt DevicePresenceCount() const = 0; + + + /** + * Returns a read-only device presence information object. + * + * @param [in] aIndex + * Zero-based index of the device presence + * information object to return. + * + * @return Reference to a device presence information + * object at aIndex. + */ + virtual const MDevicePresenceInfo& DevicePresenceAt( + TInt aIndex ) const = 0; + + + /** + * Adds device presence information object. + * + * @param [in] aDevicePresence + * New device presence value. + * Ownership of the argument is transfered to + * callee, if method succeeds without a leave. + * + * @leave KErrNoMemory if failed to allocate memory. + * @leave KErrArgument if NULL argument were provided. + */ + virtual void AddDevicePresenceL( + MDevicePresenceInfo* aDevicePresence ) = 0; + + }; + + + +#endif //MXIMPFWPRESENCEINFO_H + + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_presence_data_model_api/inc/presenceinfofield.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_presence_data_model_api/inc/presenceinfofield.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,99 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interface for presence info field object. +* +*/ + +#ifndef MXIMPFWPRESENCEINFOFIELD_H +#define MXIMPFWPRESENCEINFOFIELD_H + +#include +#include +#include + + +/** + * Interface for presence info field object. + * + * + * @todo Interface might be extended with new methods. + * + * @ingroup presencedatamodelapi + * @since S60 v3.2 + */ +class MPresenceInfoField : public MXIMPBase + { +public: + + /** Interface ID for the MPresenceInfoField. */ + enum { KInterfaceId = PRES_IF_ID_PRESENCE_FIELD }; + + +public: + + /** + * Public destructor. MPresenceInfoField object + * can be deleted through this interface. + */ + virtual ~MPresenceInfoField() {} + + +public: + + + /** + * Returns this presence information field's name. + * + * @return Presence information field's name. + */ + virtual const TDesC8& FieldType() const =0; + + /** + * Set this presence information field's name. + * @param aFieldType The new field type + */ + virtual void SetFieldTypeL( const TDesC8& aFieldType ) =0; + + /** + * Returns read-only reference to this presence + * information field's value storage. + * + * @return Presence information field's value storage. + */ + virtual const MXIMPBase& FieldValue() const =0; + + + /** + * Returns modifiable reference to this presence + * information field's value storage. + * + * @return Presence information field's value storage. + */ + virtual MXIMPBase& FieldValue() =0; + + /** + * Set the field value object for this field's value storage. + * Ownership transferred. + * @param aFieldValue The field value object + */ + virtual void SetFieldValue( MXIMPBase* aFieldValue ) = 0; + + }; + + + +#endif //MXIMPFWPRESENCEINFOFIELD_H + + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_presence_data_model_api/inc/presenceinfofieldcollection.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_presence_data_model_api/inc/presenceinfofieldcollection.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,144 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interface for presence field collection object. +* +*/ + +#ifndef MXIMPFWPRESENCEINFOFIELDCOLLECTION_H +#define MXIMPFWPRESENCEINFOFIELDCOLLECTION_H + +#include +#include +#include + + +class MPresenceInfoField; + +/** + * Interface for presence field collection object. + * + * + * @todo Interface might be extended with new methods. + * + * @ingroup presencedatamodelapi + * @since S60 v3.2 + */ +class MPresenceInfoFieldCollection : public MXIMPBase + { +public: + + /** Interface ID for the MPresenceInfoFieldCollection. */ + enum { KInterfaceId = PRES_IF_ID_PRESENCE_INFO_FIELD_COLLECTION }; + + +public: + + /** + * Public destructor. MPresenceInfoFieldCollection object + * can be deleted through this interface. + */ + virtual ~MPresenceInfoFieldCollection() {} + + +public: + + + /** + * Returns the count of presence information + * fields in this collection. + * + * @return Count of presence information fields + * in this collection. + */ + virtual TInt FieldCount() const = 0; + + + /** + * Returns a read-only presence information + * field from this collection. + * + * @param [in] aIndex + * Zero-based index of the field to return. + * + * @return Reference to a field at aIndex. + * Returned reference is guaranteed to remain valid + * only until next field is retrieved. + */ + virtual const MPresenceInfoField& FieldAt( + TInt aIndex ) const = 0; + + + /** + * Looks up the field having given name. + * + * @param [in,out] aPresenceInfoField + * On entry, contains the field object from where to start + * the lookup or NULL if lookup should be started from + * beginning of the collection. If field object given in + * entry is not a member of collection, lookup is started + * from beginning. + * On return, if an matching field object is found, this is + * set to point to the found field, else NULL. + * Found field object ownership is not returned to caller. + * + * @param [in] aMatch + * Presence information field type match pattern. + * Match pattern may contain question mark and asterisk + * characters ("?", "*") resepectively to match single + * or multiple characters. Field type values are + * folded in pattern matching. + */ + virtual void LookupFieldByFieldType( + MPresenceInfoField*& aPresenceInfoField, + const TDesC8& aMatch ) const = 0; + + + /** + * Looks up and delete the field having given name. + * + * @param [in] aMatch + * Presence information field type match pattern. + * Match pattern may contain question mark and asterisk + * characters ("?", "*") resepectively to match single + * or multiple characters. Field type values are + * folded in pattern matching. + * @return KErrNone if deletion successful otherwise KErrNotFound + */ + virtual TInt DeleteFieldByFieldType(const TDesC8& aMatch ) = 0; + + + /** + * Adds new presence information field to the set. + * If there exists already a presence information field + * object in the set with equal field type, existing + * object is deleted and replaced with given one. + * + * @param [in] aPresenceInfoField + * New new presence information field object + * to add to set. Takes object ownership in success. + * + * @leave KErrNoMemory if failed to allocate memory. + * @leave KErrArgument if NULL argument were provided. + */ + virtual void AddOrReplaceFieldL( + MPresenceInfoField* aPresenceInfoField ) = 0; + + }; + + + +#endif //MXIMPFWPRESENCEINFOFIELDCOLLECTION_H + + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_presence_data_model_api/inc/presenceinfofieldvaluebinary.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_presence_data_model_api/inc/presenceinfofieldvaluebinary.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,114 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interface for binary presence info field value object. +* +*/ + +#ifndef MXIMPFWPRESENCEINFOFIELDVALUEBINARY_H +#define MXIMPFWPRESENCEINFOFIELDVALUEBINARY_H + +#include +#include +#include + + + +/** + * Interface for binary presence info field value object. + * + * Interface for presence information field value having + * binary format. Contained binary value might be + * image or similar data object. + * + * @ingroup presencedatamodelapi + * @since S60 v3.2 + */ +class MPresenceInfoFieldValueBinary : public MXIMPBase + { +public: + + /** Interface ID for the MPresenceInfoFieldValueBinary. */ + enum { KInterfaceId = PRES_IF_ID_PRESENCE_INFO_FIELD_VALUE_BINARY }; + + + +public: + + /** + * Public destructor. MPresenceInfoFieldValueBinary object + * can be deleted through this interface. + */ + virtual ~MPresenceInfoFieldValueBinary() {} + + +public: + + + /** + * Returns maximum length of the field value. + * + * @return Maximum length of the field value or + * KXIMPFieldValueLengthUnlimited if the value + * length is limited only by the available resources. + */ + virtual TInt MaxLength() const = 0; + + + /** + * Returns the binary value. + * + * @return The binary value. + */ + virtual TPtrC8 BinaryValue() const = 0; + + + /** + * Returns the mime type of the contained value. + * + * @return The mime type. + */ + virtual const TPtrC8 MimeType() const = 0; + + + /** + * Sets the binary value. + * + * @param [in] aValue + * New binary value to set. + * + * @leave KErrOverflow if value length exceeds field specific maxlength. + * @leave KErrNoMemory if failed to allocate memory. + */ + virtual void SetBinaryValueL( + const TDesC8& aValue ) = 0; + + + /** + * Sets the mime type of the contained object. + * + * @param [in] aMimeType + * New mime type value. + * + * @leave KErrNoMemory if failed to allocate memory. + */ + virtual void SetMimeTypeL( + const TDesC8& aMimeType ) = 0; + + + }; + +#endif //MXIMPFWPRESENCEINFOFIELDVALUEBINARY_H + + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_presence_data_model_api/inc/presenceinfofieldvalueenum.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_presence_data_model_api/inc/presenceinfofieldvalueenum.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,99 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interface for enum presence info field value object. +* +*/ + +#ifndef MXIMPFWPRESENCEINFOFIELDVALUEENUM_H +#define MXIMPFWPRESENCEINFOFIELDVALUEENUM_H + +#include +#include +#include + + +/** + * Interface for presence information field value having + * an enumerated integer value. + * + * @ingroup presencedatamodelapi + * @since S60 v3.2 + */ +class MPresenceInfoFieldValueEnum : public MXIMPBase + { +public: + + /** Interface ID for the MPresenceInfoFieldValueEnum. */ + enum { KInterfaceId = PRES_IF_ID_PRESENCE_INFO_FIELD_VALUE_ENUM }; + +public: + + /** + * Public destructor. MPresenceInfoFieldValueEnum object + * can be deleted through this interface. + */ + virtual ~MPresenceInfoFieldValueEnum() {} + + +public: + + /** + * Returns minimum value of enumeration. + * + * @return Minimum allowed value for enumeration + */ + virtual TInt MinValue() const = 0; + + + /** + * Returns maximum value of enumeration. + * + * @return Maximum allowed value for enumeration + */ + virtual TInt MaxValue() const = 0; + + + /** + * Returns Value of enumeration. + * + * @return Value of enumeration + */ + virtual TInt Value() const = 0; + + + /** + * Set the value of the enumeration. + * + * @param [in] aValue + * New enum value to set + * + * @leave KErrUnderFlow If the enum value is less than the allowed minimum + * @leave KErrOverFlow If the enum value is more than the allowed maximum + */ + virtual void SetValueL( TInt aValue ) = 0; + + /** + * Set the minimum and maximum allowed by the enumeration. + * The value range set is inclusive, that is [aMin..aMax]. + * @param aMin The minimum + * @param aMax The maximum + */ + virtual void SetLimits( TInt aMin, TInt aMax ) = 0; + + }; + +#endif //MXIMPFWPRESENCEINFOFIELDVALUEENUM_H + + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_presence_data_model_api/inc/presenceinfofieldvaluetext.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_presence_data_model_api/inc/presenceinfofieldvaluetext.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,92 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interface for textual presence info field value object. +* +*/ + +#ifndef MXIMPFWPRESENCEINFOFIELDVALUETEXT_H +#define MXIMPFWPRESENCEINFOFIELDVALUETEXT_H + +#include +#include +#include + + + +/** + * Interface for textual presence info field value object.. + * + * Interface for presence information field value having + * textual format. Contained text can be rendered to + * end user as is. + * + * @ingroup presencedatamodelapi + * @since S60 v3.2 + */ +class MPresenceInfoFieldValueText : public MXIMPBase + { +public: + + /** Interface ID for the MPresenceInfoFieldValueText. */ + enum { KInterfaceId = PRES_IF_ID_PRESENCE_INFO_FIELD_VALUE_TEXT }; + + +public: + + /** + * Public destructor. MPresenceInfoFieldValueText object + * can be deleted through this interface. + */ + virtual ~MPresenceInfoFieldValueText() {} + + +public: + + /** + * Returns maximum length of the field value. + * + * @return Maximum length of the field value or + * KXIMPFieldValueLengthUnlimited if the value + * length is limited only by the available resources. + */ + virtual TInt MaxLength() const = 0; + + + /** + * Returns the textual value. + * + * @return The textual value. + */ + virtual TPtrC TextValue() const =0; + + + /** + * Sets the textual data. + * + * @param [in] aValue + * New textual value to set. + * + * @leave KErrOverflow if value length exceeds field specific maxlength. + * @leave KErrNoMemory if failed to allocate memory. + */ + virtual void SetTextValueL( + const TDesC& aValue ) =0; + + }; + + +#endif //MXIMPFWPRESENCEINFOFIELDVALUETEXT_H + + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_presence_data_model_api/inc/presenceinfofilter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_presence_data_model_api/inc/presenceinfofilter.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,122 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interface for presence info filter object. +* +*/ + +#ifndef XIMPFWPRESENCEINFOFILTER_H +#define XIMPFWPRESENCEINFOFILTER_H + +#include +#include +#include + + +/** + * Interface for presence info filter object. + * + * Presence information filter is used to define requested + * presence information in presence subscriptions and + * granted presence information in presence grants. + * + * Filtering is "inclusive": data is passed through if it matches the given + * filtering criteria. Data with keys not matching to the filtering + * criteria will be skipped by the filter. + * + * The Accept*FilterL methods can be called many times, to accept multiple + * distinct fields. Wildcards "*" and "?" are allowed within the strings. + * + * @todo Interface will be extended. + * + * @ingroup presencedatamodelapi + * @since S60 v3.2 + */ +class MPresenceInfoFilter : public MXIMPBase + { +public: + + /** Interface ID for the MPresenceInfoFilter. */ + enum { KInterfaceId = PRES_IF_ID_PRESENCE_INFO_FILTER }; + +public: + + /** + * Public destructor. MPresenceInfoFilter object + * can be deleted through this interface. + */ + virtual ~MPresenceInfoFilter() {} + +public: + + /** + * Set filter for a field in the person presence component. + * Wildcards "*" and "?" are allowed. + * @param aFieldName The field name within the person info + */ + virtual void AcceptPersonFilterL( const TDesC8& aFieldName ) = 0; + + /** + * Set filter for the service presence component. + * Wildcards "*" and "?" are allowed. + * @param aServiceName The service type + * @param aFieldName The field name within the given service info + */ + virtual void AcceptServiceFilterL( + const TDesC8& aServiceName, + const TDesC8& aFieldName ) = 0; + + /** + * Set filter for the device presence component. + * Wildcards "*" and "?" are allowed. + * @param aDeviceName The device name + * @param aFieldName The field name within the given device info + */ + virtual void AcceptDeviceFilterL( + const TDesC8& aDeviceName, + const TDesC8& aFieldName ) = 0; + + /** + * Try to match given field type against the filters + * for the person presence component. + * @param aFieldName The field to check + * @return ETrue if the given field is accepted + */ + virtual TBool MatchPersonFilter( const TDesC8& aFieldName ) const = 0; + + /** + * Find out if the filter accepts the field in a given service info. + * @param aServiceName The name of the service info to check + * @param aFieldName The field name to check + * @return ETrue if the given field within the named info is accepted + */ + virtual TBool MatchServiceFilterL( + const TDesC8& aServiceName, + const TDesC8& aFieldName ) const = 0; + + /** + * Find out if the filter accepts the field in a given device info. + * @param aDeviceName The name of the device info to check + * @param aFieldName The field to check + * @return ETrue if the given field within the named info is accepted + */ + virtual TBool MatchDeviceFilterL( + const TDesC8& aDeviceName, + const TDesC8& aFieldName ) const = 0; + + }; + +#endif //XIMPFWPRESENCEINFOFILTER_H + + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_presence_data_model_api/inc/presenceobjectfactory.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_presence_data_model_api/inc/presenceobjectfactory.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,221 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interface for XIMP Framework object factory. +* +*/ + +#ifndef MPRESENCEOBJECTFACTORY_H +#define MPRESENCEOBJECTFACTORY_H + +#include +#include +#include + +class MPresenceInfo; +class MPresenceInfoFilter; +class MPresentityGroupInfo; +class MPresenceWatcherInfo; +class MPresenceGrantRequestInfo; +class MPresentityGroupMemberInfo; +class MServicePresenceInfo; +class MPersonPresenceInfo; +class MDevicePresenceInfo; +class MPresenceInfoField; +class MPresenceInfoFieldValueEnum; +class MPresenceInfoFieldValueText; +class MPresenceInfoFieldValueBinary; +class MPresenceBlockInfo; + +/** + * Interface for XIMP Framework presence object factory. + * + * Presence object factory is used to instantiate + * data objects declared in Data Model API. + * + * MPresenceObjectFactory interface can be obtained from + * MPresenceContext or MXIMPProtocolConnectionHost + * interfaces. + * + * @ingroup presencedatamodelapi + * @since S60 v3.2 + */ +class MPresenceObjectFactory : public MXIMPBase + { +public: + + /** Interface ID for the MPresenceObjectFactory. */ + enum { KInterfaceId = PRES_IF_ID_PRESENCE_OBJECT_FACTORY }; + + +protected: + + /** + * Protected destructor. + * Object instancies can't be deleted via this interface. + */ + virtual ~MPresenceObjectFactory() {} + + + + +public: // Group and similar info object types + + + /** + * Instantiates new presentity group info object. + * + * @return New group info object instance. + * Object ownership is returned to caller. + * + * @leave KErrNoMemory if failed to allocate memory. + */ + virtual MPresentityGroupInfo* NewPresentityGroupInfoLC() = 0; + + + /** + * Instantiates new presentity group member info object. + * + * @return New group member info object instance. + * Object ownership is returned to caller. + * + * @leave KErrNoMemory if failed to allocate memory. + */ + virtual MPresentityGroupMemberInfo* NewPresentityGroupMemberInfoLC() = 0; + + + /** + * Instantiates new presence watcher info object. + * + * @return New watcher info object instance. + * Object ownership is returned to caller. + * + * @leave KErrNoMemory if failed to allocate memory. + */ + virtual MPresenceWatcherInfo* NewPresenceWatcherInfoLC() = 0; + + + /** + * Instantiates new presence grant request info object. + * + * @return New grant request info object instance. + * Object ownership is returned to caller. + * + * @leave KErrNoMemory if failed to allocate memory. + */ + virtual MPresenceGrantRequestInfo* NewPresenceGrantRequestInfoLC() = 0; + + + +public: // Presence information object types + + + /** + * Instantiates new presence info object. + * + * @return New presence info instance. Object ownership + * is returned to caller. + * + * @leave KErrNoMemory if failed to allocate memory. + */ + virtual MPresenceInfo* NewPresenceInfoLC() = 0; + + + /** + * Instantiates new presence info filter object. + * + * @return New presence info filter instance. Object ownership + * is returned to caller. + * + * @leave KErrNoMemory if failed to allocate memory. + */ + virtual MPresenceInfoFilter* NewPresenceInfoFilterLC() = 0; + + /** + * Instantiates new presence person info object. + * + * @return New presence person info instance. Object ownership + * is returned to caller. + * + * @leave KErrNoMemory if failed to allocate memory. + */ + virtual MPersonPresenceInfo* NewPersonPresenceInfoLC() = 0; + + /** + * Instantiates new presence service info object. + * + * @return New presence service info instance. Object ownership + * is returned to caller. + * + * @leave KErrNoMemory if failed to allocate memory. + */ + virtual MServicePresenceInfo* NewServicePresenceInfoLC() = 0; + + /** + * Instantiates new presence device info object. + * + * @return New presence device info instance. Object ownership + * is returned to caller. + * + * @leave KErrNoMemory if failed to allocate memory. + */ + virtual MDevicePresenceInfo* NewDevicePresenceInfoLC() = 0; + + /** + * Instantiates new info field object. + * + * @return New info field instance. Object ownership + * is returned to caller. + * + * @leave KErrNoMemory if failed to allocate memory. + */ + virtual MPresenceInfoField* NewInfoFieldLC() = 0; + + /** + * Instantiates new enumerated info field value object. + * + * @return New info field value instance. Object ownership + * is returned to caller. + * + * @leave KErrNoMemory if failed to allocate memory. + */ + virtual MPresenceInfoFieldValueEnum* NewEnumInfoFieldLC() = 0; + + /** + * Instantiates new textual info field value object. + * + * @return New info field value instance. Object ownership + * is returned to caller. + * + * @leave KErrNoMemory if failed to allocate memory. + */ + virtual MPresenceInfoFieldValueText* NewTextInfoFieldLC() = 0; + + /** + * Instantiates new binary info field value object. + * + * @return New info field value instance. Object ownership + * is returned to caller. + * + * @leave KErrNoMemory if failed to allocate memory. + */ + virtual MPresenceInfoFieldValueBinary* NewBinaryInfoFieldLC() = 0; + virtual MPresenceBlockInfo* NewPresenceBlockInfoLC() = 0; + }; + + + +#endif // MPRESENCEOBJECTFACTORY_H + + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_presence_data_model_api/inc/presencewatcherinfo.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_presence_data_model_api/inc/presencewatcherinfo.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,143 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interface for presence watcher info object. +* +*/ + +#ifndef MXIMPFWPRESENCEWATCHERINFO_H +#define MXIMPFWPRESENCEWATCHERINFO_H + +#include +#include +#include + + +class MXIMPIdentity; + + +/** + * Interface for presence watcher info object. + * + * Presence watcher info object presents single presence watcher + * entry in the presence watcher list. Presence watcher info + * object holds the identity, display name and watcher type + * information for the presence watcher. + * + * @ingroup presencedatamodelapi + * @since S60 v3.2 + */ +class MPresenceWatcherInfo : public MXIMPBase + { +public: + + /** Interface ID for the MPresenceWatcherInfo. */ + enum { KInterfaceId = PRES_IF_ID_PRESENCE_WATCHER_INFO }; + + + /** Presence watcher types. */ + enum TWatcherType + { + /** Presence watcher type unknown. */ + EUnknown, + + /** Presence watcher is currently subscribing user presence. */ + EPresenceSubscriber + }; + + +public: + + /** + * Public destructor. + * Objects can be deleted through this interface. + */ + virtual ~MPresenceWatcherInfo() {} + + + +public: + + + /** + * Returns presence watcher identity value. + * + * @return The presence watcher identity value. + */ + virtual const MXIMPIdentity& WatcherId() const = 0; + + + + /** + * Returns presence watcher displayname value. + * + * @return The presence watcher displayname value. + */ + virtual const TDesC16& WatcherDisplayName() const = 0; + + + + /** + * Returns presence watcher type value. + * + * @return The presence watcher type value. + */ + virtual TWatcherType WatcherType() const = 0; + + + + /** + * Sets watcher identity value. + * + * @param [in] aIdentity + * New watcher identity value. + * Ownership of the argument is transfered to + * callee, if method succeeds without a leave. + * + * @leave KErrNoMemory if failed to allocate memory. + * @leave KErrArgument if NULL argument were provided. + */ + virtual void SetWatcherIdL( + MXIMPIdentity* aIdentity ) = 0; + + + /** + * Sets presence watcher displayname value. + * + * @param [in] aDisplayName + * New display name value. + * + * @leave KErrNoMemory if failed to allocate memory. + */ + virtual void SetWatcherDisplayNameL( + const TDesC16& aDisplayName ) = 0; + + + /** + * Sets presence watcher type value. + * + * @param [in] aType + * New presence watcher type value. + * + * @leave KErrNoMemory if failed to allocate memory. + */ + virtual void SetWatcherTypeL( + TWatcherType aType ) = 0; + + }; + + +#endif // MXIMPFWPRESENCEWATCHERINFO_H + + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_presence_data_model_api/inc/presentitygroupinfo.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_presence_data_model_api/inc/presentitygroupinfo.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,111 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interface for presentity group info object. +* +*/ + +#ifndef MXIMPFWPRESENTITYGROUPINFO_H +#define MXIMPFWPRESENTITYGROUPINFO_H + +#include +#include +#include + + +class MXIMPIdentity; + + +/** + * Interface for presentity group info object. + * + * Presentity group info object presents single presentity group + * in the presentity group list. Presentity group info object + * holds the identity and display name for the presentity group. + * + * @ingroup presencedatamodelapi + * @since S60 v3.2 + */ +class MPresentityGroupInfo : public MXIMPBase + { +public: + + /** Interface ID for the MPresentityGroupInfo. */ + enum { KInterfaceId = PRES_IF_ID_PRESENTITY_GROUP_INFO }; + + +public: + + + /** + * Public destructor. + * Objects can be deleted through this interface. + */ + virtual ~MPresentityGroupInfo() {} + + + +public: + + /** + * Returns group identity value. + * + * @return The group identity value. + */ + virtual const MXIMPIdentity& GroupId() const = 0; + + + + /** + * Returns group display name value. + * + * @return The group display name value. + */ + virtual const TDesC16& GroupDisplayName() const = 0; + + + + /** + * Sets group identity value. + * + * @param [in] aIdentity + * New group identity value. + * Ownership of the argument is transfered to + * callee, if method succeeds without a leave. + * + * @leave KErrNoMemory if failed to allocate memory. + * @leave KErrArgument if NULL argument were provided. + */ + virtual void SetGroupIdL( + MXIMPIdentity* aIdentity ) = 0; + + + + /** + * Sets group display name value. + * + * @param [in] aDisplayName + * New display name value. + * + * @leave KErrNoMemory if failed to allocate memory. + */ + virtual void SetGroupDisplayNameL( + const TDesC16& aDisplayName ) = 0; + + }; + + +#endif // MXIMPFWPRESENTITYGROUPINFO_H + + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_presence_data_model_api/inc/presentitygroupmemberinfo.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_presence_data_model_api/inc/presentitygroupmemberinfo.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,111 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interface for presentity group member info object. +* +*/ + +#ifndef MXIMPFWPRESENTITYGROUPMEMBERINFO_H +#define MXIMPFWPRESENTITYGROUPMEMBERINFO_H + +#include +#include +#include + + +class MXIMPIdentity; + + +/** + * Interface for presentity group member info object. + * + * PresentityGroupMemberInfo presents single + * presentity group member. Object holds the identity + * and display name for the presentity group member. + * + * @ingroup presencedatamodelapi + * @since S60 v3.2 + */ +class MPresentityGroupMemberInfo : public MXIMPBase + { +public: + + /** Interface ID for the MPresentityGroupMemberInfo. */ + enum { KInterfaceId = PRES_IF_ID_PRESENTITY_GROUP_MEMBER_INFO }; + + +public: + + + /** + * Public destructor. + * Objects can be deleted through this interface. + */ + virtual ~MPresentityGroupMemberInfo() {} + + + +public: + + + /** + * Returns group member identity value. + * + * @return The group member identity value. + */ + virtual const MXIMPIdentity& GroupMemberId() const = 0; + + + + /** + * Returns group member display name value. + * + * @return The group member display name value. + */ + virtual const TDesC16& GroupMemberDisplayName() const = 0; + + + + /** + * Sets group member identity value. + * + * @param [in] aIdentity + * New group member identity value. + * Ownership of the argument is transfered to + * callee, if method succeeds without a leave. + * + * @leave KErrNoMemory if failed to allocate memory. + * @leave KErrArgument if NULL argument were provided. + */ + virtual void SetGroupMemberIdL( + MXIMPIdentity* aIdentity ) = 0; + + + /** + * Sets group member display name value. + * + * @param [in] aDisplayName + * New display name value. + * + * @leave KErrNoMemory if failed to allocate memory. + */ + virtual void SetGroupMemberDisplayNameL( + const TDesC16& aDisplayName ) = 0; + + }; + + +#endif // MXIMPFWPRESENTITYGROUPMEMBERINFO_H + + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_presence_data_model_api/inc/servicepresenceinfo.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_presence_data_model_api/inc/servicepresenceinfo.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,110 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interface for service presence info object. +* +*/ + +#ifndef MXIMPFWSERVICEPRESENCEINFO_H +#define MXIMPFWSERVICEPRESENCEINFO_H + +#include +#include +#include + +class MXIMPIdentity; +class MPresenceInfoFieldCollection; + + +/** + * Interface for service presence info object. + * + * + * @todo Interface might be extended with new methods. + * + * @ingroup presencedatamodelapi + * @since S60 v3.2 + */ +class MServicePresenceInfo : public MXIMPBase + { +public: + + /** Interface ID for the MServicePresenceInfo. */ + enum { KInterfaceId = PRES_IF_ID_SERVICE_PRESENCE_INFO }; + + +public: + + /** + * Public destructor. MServicePresenceInfo object + * can be deleted through this interface. + */ + virtual ~MServicePresenceInfo() {} + + +public: + + + /** + * Returns service type value. + * + * Returns string identifying type of service + * for which this object is containing + * presence information. + * + * Service type is on of the well known strings + * listed in NPresenceInfo::NServiceType + * namespace. + * + * @return Service type value. + */ + virtual const TPtrC8 ServiceType() const = 0; + + /** + * Set service type value. + * + * Service type is on of the well known strings + * listed in NPresenceInfo::NServiceType + * namespace. + * + * @return Service type value. + * @leave KErrArgument if the given string is not in NPresenceInfo::NServiceType + * @leave KErrNoMemory if failed to allocate memory + */ + virtual void SetServiceTypeL( const TDesC8& aServiceType ) = 0; + + /** + * Returns read-only reference to presence information + * field collection. + * + * @return Presence information field collection. + */ + virtual const MPresenceInfoFieldCollection& Fields() const = 0; + + + /** + * Returns modifiable reference to presence + * information field collection. + * + * @return Presence information field collection. + */ + virtual MPresenceInfoFieldCollection& Fields() = 0; + + + }; + + +#endif //MXIMPFWSERVICEPRESENCEINFO_H + + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_presence_data_model_api/ximp_presence_data_model_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_presence_data_model_api/ximp_presence_data_model_api.metaxml Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,23 @@ + + + XIMP Presence Data Model API + Contains protocol agnostic interfaces for presence, presence contact groups and presence authorization related data items. API provides also a set of generic presence attributes. + c++ + ximpfw + + + + + + + + + + + + + + yes + no + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_presence_management_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_presence_management_api/group/bld.inf Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,40 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: File that exports the files belonging to +: XIMP Presence Management API +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +../inc/presenceblocklistevent.h MW_LAYER_PLATFORM_EXPORT_PATH(presenceblocklistevent.h) +../inc/presencemanagementifids.hrh MW_LAYER_PLATFORM_EXPORT_PATH(presencemanagementifids.hrh) +../inc/presencefeatures.inl MW_LAYER_PLATFORM_EXPORT_PATH(presencefeatures.inl) +../inc/presencewatching.h MW_LAYER_PLATFORM_EXPORT_PATH(presencewatching.h) +../inc/presencepublishing.h MW_LAYER_PLATFORM_EXPORT_PATH(presencepublishing.h) +../inc/presenceauthorization.h MW_LAYER_PLATFORM_EXPORT_PATH(presenceauthorization.h) +../inc/presencewatcherlistevent.h MW_LAYER_PLATFORM_EXPORT_PATH(presencewatcherlistevent.h) +../inc/presentitygrouplistevent.h MW_LAYER_PLATFORM_EXPORT_PATH(presentitygrouplistevent.h) +../inc/presentitygroups.h MW_LAYER_PLATFORM_EXPORT_PATH(presentitygroups.h) +../inc/presencefeatures.h MW_LAYER_PLATFORM_EXPORT_PATH(presencefeatures.h) +../inc/presentitypresenceevent.h MW_LAYER_PLATFORM_EXPORT_PATH(presentitypresenceevent.h) +../inc/ownpresenceevent.h MW_LAYER_PLATFORM_EXPORT_PATH(ownpresenceevent.h) +../inc/presencegrantrequestlistevent.h MW_LAYER_PLATFORM_EXPORT_PATH(presencegrantrequestlistevent.h) +../inc/presentitygroupcontentevent.h MW_LAYER_PLATFORM_EXPORT_PATH(presentitygroupcontentevent.h) diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_presence_management_api/inc/ownpresenceevent.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_presence_management_api/inc/ownpresenceevent.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,101 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Event interface for subscribed own presence information. +* +*/ + +#ifndef MXIMPFWOWNPRESENCEEVENT_H +#define MXIMPFWOWNPRESENCEEVENT_H + +#include +#include +#include + + +class MXIMPIdentity; +class MPresenceInfo; +class MXIMPDataSubscriptionState; + + + +/** + * Event interface for subscribed own presence information. + * + * This interface is implemented by the XIMP Framework and + * event object is signalled to registered client observers + * through MXIMPContextObserver observer interface. + * This event notifies clients about changes in subscribed + * own presence information. + * + * Clients subscribe for this event with + * MPresencePublishing::SubscribeOwnPresenceL(). + * + * XIMP Framework signals this event when: + * - New subscribed data is received from protocol. + * - Data item data subscription status is updated by + * protocol adaptation. + * - When client unsubscribes the data item. + * - XIMP Framework generates initial data notification + * to client automatically after clients subscription, + * when the initial data comes available from protocol. + * + * @ingroup ximppresmanagementapievents + * @since S60 v3.2 + */ +class MOwnPresenceEvent : public MXIMPBase + { +public: + /** Interface ID for the MOwnPresenceEvent. */ + enum { KInterfaceId = PRES_IF_ID_OWN_PRESENCE_EVENT }; + + +protected: + + /** + * Protected destructor. + * Object instancies can't be deleted via this interface. + */ + virtual ~MOwnPresenceEvent() {} + + +public: + + + /** + * Returns presence info object holding + * the subscribed user own presence information. + * + * @return The subscribed user own presence info. + * Object ownership is not returned. + */ + virtual const MPresenceInfo& SubscribedPresence() const = 0; + + + /** + * Returns subscription state object holding + * information data items data subscription state. + * + * @return The data items data subscription state. + * Object ownership is not returned. + */ + virtual const MXIMPDataSubscriptionState& DataSubscriptionState() const = 0; + + + }; + + +#endif // MXIMPFWOWNPRESENCEEVENT_H + + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_presence_management_api/inc/presenceauthorization.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_presence_management_api/inc/presenceauthorization.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,244 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Presence authorization control interface for XIMPFw clients use. +* +*/ + +#ifndef MXIMPFWPRESENCEAUTHORIZATION_H +#define MXIMPFWPRESENCEAUTHORIZATION_H + +#include +#include +#include + + +class MPresenceInfoFilter; +class MXIMPIdentity; + + + +/** + * Presence authorization control interface for XIMPFw clients use. + * Interface is implemented by the XIMP Framework. + * + * This interface defines actions that client can request from + * XIMP Framework execute presence authorization related tasks. + * + * @ingroup ximppresmanagementapi + * @since S60 v3.2 + */ +class MPresenceAuthorization : public MXIMPBase + { +public: + + /** Interface ID for the MPresenceAuthorization. */ + enum { KInterfaceId = PRES_IF_ID_PRESENCE_AUTHORIZATION }; + + +protected: + + /** + * Protected destructor. + * Object instancies can't be deleted via this interface. + */ + virtual ~MPresenceAuthorization() {} + + + + + +public: // Presence grant request list access + + /** + * Requests the XIMPFw to subscribe presence + * grant request list from remote service. + * + * @return The request ID identifying the issued request. + */ + virtual TXIMPRequestId SubscribePresenceGrantRequestListL() = 0; + + + /** + * Requests the XIMPFw to terminate presence + * grant request list subscription. + * + * @return The request ID identifying the issued request. + */ + virtual TXIMPRequestId UnsubscribePresenceGrantRequestListL() = 0; + + + + + +public: // Granting presence information access to single presentities + + + /** + * Requests the XIMPFw to allow the identified presentity + * to see specified presence information. + * + * @param [in] aPresentityId + * Identification of the presentity to which + * to allow presence information access. + * + * @param [in] aPif + * Presence information filter indicating the + * allowed presence information. + * + * @return The request ID identifying the issued request. + */ + virtual TXIMPRequestId GrantPresenceForPresentityL( + const MXIMPIdentity& aPresentityId, + const MPresenceInfoFilter& aPif ) = 0; + + + /** + * Requests the XIMPFw to withdraw existing + * presence information grant. + * + * @param [in] aPresentityId + * Identification of the presentity which presence + * grant to withdraw. + * + * @return The request ID identifying the issued request. + */ + virtual TXIMPRequestId WithdrawPresenceGrantFromPresentityL( + const MXIMPIdentity& aPresentityId ) = 0; + + + + +public: // Granting presence information access to presentity group members + + + /** + * Requests the XIMPFw to allow the identified presentity + * group members to see specified presence information. + * + * @param [in] aGroupId + * Identification of the presentity group for which + * members to allow presence information. + * + * @param [in] aPif + * Presence information filter indicating the + * allowed presence information. + * + * @return The request ID identifying the issued request. + */ + virtual TXIMPRequestId GrantPresenceForPresentityGroupMembersL( + const MXIMPIdentity& aGroupId, + const MPresenceInfoFilter& aPif ) = 0; + + + /** + * Requests the XIMPFw to withdraw existing + * presentity group members presence information grant. + * + * @param [in] aGroupId + * Identification of the presentity group + * which members presence grant to terminate. + * + * @return The request ID identifying the issued request. + */ + virtual TXIMPRequestId WithdrawPresenceGrantFromPresentityGroupMembersL( + const MXIMPIdentity& aGroupId ) = 0; + + + +public: // Granting presence information access to everyone + + + /** + * Requests the XIMPFw to allow everyone + * to see specified presence information. + * + * @param [in] aPif + * Presence information filter indicating the + * allowed presence information. + * + * @return The request ID identifying the issued request. + */ + virtual TXIMPRequestId GrantPresenceForEveryoneL( + const MPresenceInfoFilter& aPif ) = 0; + + + /** + * Requests the XIMPFw to withdraw existing + * information grant for everyone. + * + * @return The request ID identifying the issued request. + */ + virtual TXIMPRequestId WithdrawPresenceGrantFromEveryoneL() = 0; + + +public: // Presence block list access + + /** + * Subscribe presence block information. + * + * @return The request ID identifying the issued request. + */ + virtual TXIMPRequestId SubscribePresenceBlockListL() = 0; + + + /** + * Unsubscribe presence block information. + * + * @return The request ID identifying the issued request. + */ + virtual TXIMPRequestId UnsubscribePresenceBlockListL() = 0; + + + + +public: // Blocking presence information access from single presentities + + + /** + * Requests the XIMPFw to block the identified presentity + * from seeing presence information produced by this + * presence context. + * + * After blocking, identified presentity can't anymore + * access the user own presence information. + * + * @param [in] aPresentityId + * Identification of the presentity for which + * presence information access to block. + * + * @return The request ID identifying the issued request. + */ + virtual TXIMPRequestId BlockPresenceForPresentityL( + const MXIMPIdentity& aPresentityId ) = 0; + + + /** + * Requests the protocol to cancel existing presence + * information block from the identified presentity. + * + * @param [in] aPresentityId + * Identification of the presentity of which + * presence information block to cancel. + * + * @return The request ID identifying the issued request. + */ + virtual TXIMPRequestId CancelPresenceBlockFromPresentityL( + const MXIMPIdentity& aPresentityId ) = 0; + + + }; + +#endif // MXIMPFWPRESENCEAUTHORIZATION_H + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_presence_management_api/inc/presenceblocklistevent.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_presence_management_api/inc/presenceblocklistevent.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,190 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Event interface for presence block list content. +* +*/ + +#ifndef MXIMPFWPRESENCEBLOCKLISTEVENT_H +#define MXIMPFWPRESENCEBLOCKLISTEVENT_H + +#include +#include +#include + + +class MXIMPIdentity; +class MPresenceBlockInfo; +class MXIMPDataSubscriptionState; + + + +/** + * Event interface for presence block list content. + * + * This interface is implemented by the XIMP Framework and + * event object is signalled to registered client observers + * through MXIMPContextObserver observer interface. + * This event notifies clients about changes in + * presence block list content. + * + * Clients subscribe for this event with + * MPresenceAuthorization::SubscribePresenceBlockListL. + * + * XIMP Framework signals this event when: + * - New subscribed data is received from protocol. + * - Data item data subscription status is updated by + * protocol adaptation. + * - When client unsubscribes the data item. + * - XIMP Framework generates initial data notification + * to client automatically after clients subscription, + * when the initial data comes available from protocol. + * + * @ingroup ximppresmanagementapievents + * @since S60 v3.2 + */ +class MPresenceBlockListEvent : public MXIMPBase + { +public: + /** Interface ID for the MPresenceBlockListEvent. */ + enum { KInterfaceId = PRES_IF_ID_PRESENCE_BLOCK_LIST_EVENT }; + + +protected: + + /** + * Protected destructor. + * Object instancies can't be deleted via this interface. + */ + virtual ~MPresenceBlockListEvent() {} + + + +public: // Access to "delta information" + + + /** + * Gets count of new presence block entries. + * + * @return The count of new presence block entries. + */ + virtual TInt NewBlocksCount() const = 0; + + + /** + * Gets presence block entry by index. + * + * @param [in] aIndex + * The index of the presence block entry to get. + * + * @return The presence block entry from given index. + */ + virtual const MPresenceBlockInfo& NewBlock( + TInt aIndex ) const = 0; + + + /** + * Gets count of updated presence block entries. + * + * @return The count of updated presence block entries. + */ + virtual TInt UpdatedBlocksCount() const = 0; + + + /** + * Gets presence block entry by index. + * + * @param [in] aIndex + * The index of the presence block entry to get. + * + * @return The presence block entry from given index. + */ + virtual const MPresenceBlockInfo& UpdatedBlock( + TInt aIndex ) const = 0; + + + /** + * Gets count of disappeared presence block entries. + * + * @return The count of disappeared presence block entries. + */ + virtual TInt DisappearedBlocksCount() const = 0; + + + /** + * Gets presence block entry by index. + * + * @param [in] aIndex + * The index of the presence block entry to get. + * + * @return The presence block entry from given index. + */ + virtual const MPresenceBlockInfo& DisappearedBlock( + TInt aIndex ) const = 0; + + + +public: // Access to "current information" + + + /** + * Gets count of current presence block entries. + * + * Note that, valid "current information" is signalled only when + * the client refreshes the event data from XIMP Framework cache, + * by re-issuing the data subscription. In other cases, just plain + * "delta information" is signalled to client. + * + * @return The count of current presence block entries. + */ + virtual TInt CurrentBlocksCount() const = 0; + + + /** + * Gets presence block entry by index. + * + * Note that, valid "current information" is signalled only when + * the client refreshes the event data from XIMP Framework cache, + * by re-issuing the data subscription. In other cases, just plain + * "delta information" is signalled to client. + * + * @param [in] aIndex + * The index of the presence block entry to get. + * + * @return The presence block entry from given index. + */ + virtual const MPresenceBlockInfo& CurrentBlock( + TInt aIndex ) const = 0; + + + +public: // Access to subscription state + + + /** + * Returns subscription state object holding + * information data items data subscription state. + * + * @return The data items data subscription state. + * Object ownership is not returned. + */ + virtual const MXIMPDataSubscriptionState& DataSubscriptionState() const = 0; + + }; + + + +#endif // MXIMPFWPRESENCEBLOCKLISTEVENT_H + + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_presence_management_api/inc/presencefeatures.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_presence_management_api/inc/presencefeatures.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,175 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interface for presence context. +* +*/ + +#ifndef MPRESENCEFEATURES_H +#define MPRESENCEFEATURES_H + +#include +#include +#include +#include + + +class MPresenceObjectFactory; +class MPresenceDataCache; +class MPresenceWatching; +class MPresencePublishing; +class MPresentityGroups; +class MPresenceAuthorization; + +/** + * Interface for presence features. + * This interface is implemented by the XIMP Framework Presence Feature plug-in. + * + * MPresenceFeatures is root interface for accessing + * and updating presence data to remote presence service. + * XIMP FW client binds MXIMPContext interface + * to desired remote presence service and creates + * MPresenceFeatures interface to access the XIMP FW presence related + * methods to publish and access presence data. + * + * Following sub interfaces can be accessed from + * from MPresenceFeatures: + * - MPresenceObjectFactory + * - MPresenceWatching + * - MPresencePublishing + * - MPresentityGroups + * - MPresenceAuthorization + * + * All Presence events (context state, presence data, + * request completion etc. ones) are delivered through + * MPresenceContextObserver interface. + * + * @ingroup ximppresmanagementapi + * @since S60 v3.2 + */ +class MPresenceFeatures : public MXIMPBase + { +public: + + /** Interface ID for the MPresenceContext. */ + enum { KInterfaceId = XIMP_ECOM_IF_UID_PRESENCE_INTERFACE }; + + +public: + + /** + * Factory method to instantiate MPresenceFeatures. + * + * Factory method to instantiate platform default + * MXIMPClient implementation through the ECom. + * If the default presence framework isn't supported + * in the platform, leaves with errorcode signalled + * from ECom. + * + * @return The new presence client object. Object + * ownership is returned to caller. + */ + static inline MPresenceFeatures* NewL( MXIMPContext* aContext ); + + /** + * Public destructor. + * Objects can be deleted through this interface. + */ + virtual inline ~MPresenceFeatures(); + +protected: + + /** + * Default constructor to zero initialize + * the iEcomDtorID member. + */ + inline MPresenceFeatures(); + + +public: //Sub interfaces for presence context + + + /** + * Gets reference to object factory interface. + * + * Returned object factory interface is used + * to instantiate presence objects. + * + * @return Object factory interface. + * No ownership is returned caller. + */ + virtual MPresenceObjectFactory& PresenceObjectFactory() const = 0; + + + /** + * Gets reference to object factory interface. + * + * Returned object factory interface is used + * to instantiate presence objects. + * + * @return Object factory interface. + * No ownership is returned caller. + */ + //virtual MPresenceDataCache& PresenceDataAccess() const = 0; + + + /** + * Gets reference to presence watching interface. + * + * @return Requested interface. + * No ownership is returned caller. + */ + virtual MPresenceWatching& PresenceWatching() const = 0; + + + + /** + * Gets reference to presence publishing interface. + * + * @return Requested interface. + * No ownership is returned caller. + */ + virtual MPresencePublishing& PresencePublishing() const = 0; + + + + /** + * Gets reference to presentity groups interface. + * + * @return Requested interface. + * No ownership is returned caller. + */ + virtual MPresentityGroups& PresentityGroups() const = 0; + + + /** + * Gets reference to presence authorization interface. + * + * @return Requested interface. + * No ownership is returned caller. + */ + virtual MPresenceAuthorization& PresenceAuthorization() const = 0; + +private: // Data + + //OWN: ECom destructor ID + TUid iEcomDtorID; + }; + +#include + + +#endif // MPRESENCEFEATURES_H + + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_presence_management_api/inc/presencefeatures.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_presence_management_api/inc/presencefeatures.inl Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,64 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Presence Features interface used by XIMP Presence clients. +* +*/ + +#include + + +// ----------------------------------------------------------------------------- +// MPresenceFeatures::NewL( MXIMPContext* aContext) implementation +// Factory method to instantiate the platform default +// MPresenceFeatures implementation through the ECom framework. +// ----------------------------------------------------------------------------- +// +inline MPresenceFeatures* MPresenceFeatures::NewL(MXIMPContext* aContext ) + { + _LIT8( KXIMPPresenceDefaultData, XIMP_ECOM_DEFAULT_DATA_PRESENCE_INTERFACE ); + + TEComResolverParams resolvingParams; + resolvingParams.SetDataType( KXIMPPresenceDefaultData ); + resolvingParams.SetWildcardMatch( ETrue ); + + TAny* imp = REComSession::CreateImplementationL( TUid::Uid( MPresenceFeatures::KInterfaceId ), + _FOFF( MPresenceFeatures, iEcomDtorID ), + aContext, resolvingParams ); + + return reinterpret_cast< MPresenceFeatures* >( imp ); + } + + +// ----------------------------------------------------------------------------- +// MPresenceFeatures::MPresenceFeatures() implementation +// Zero initializes the iEcomDtorID member. +// ----------------------------------------------------------------------------- +// +inline MPresenceFeatures::MPresenceFeatures() + { + iEcomDtorID = TUid::Null(); + } + + +// ----------------------------------------------------------------------------- +// MPresenceFeatures::~MPresenceFeatures() +// Destructor notifies the ECom from implementation destruction. +// ----------------------------------------------------------------------------- +// +inline MPresenceFeatures::~MPresenceFeatures() + { + REComSession::DestroyedImplementation( iEcomDtorID ); + } + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_presence_management_api/inc/presencegrantrequestlistevent.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_presence_management_api/inc/presencegrantrequestlistevent.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,169 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Event interface for presence grant request list content. +* +*/ + +#ifndef MXIMPFWPRESENCEGRANTREQUESTLISTEVENT_H +#define MXIMPFWPRESENCEGRANTREQUESTLISTEVENT_H + +#include +#include +#include + + +class MXIMPIdentity; +class MPresenceGrantRequestInfo; +class MXIMPDataSubscriptionState; + + +/** + * Event interface for presence grant request list content. + * + * This interface is implemented by the XIMP Framework and + * event object is signalled to registered client observers + * through MXIMPContextObserver observer interface. + * This event notifies clients about changes in + * presence grant request list content. + * + * Clients subscribe for this event with + * MPresenceAuthorization::SubscribePresenceGrantRequestListL(). + * + * XIMP Framework signals this event when: + * - New subscribed data is received from protocol. + * - Data item data subscription status is updated by + * protocol adaptation. + * - When client unsubscribes the data item. + * - XIMP Framework generates initial data notification + * to client automatically after clients subscription, + * when the initial data comes available from protocol. + * + * @ingroup ximppresmanagementapievents + * @since S60 v3.2 + */ +class MPresenceGrantRequestListEvent : public MXIMPBase + { +public: + /** Interface ID for the MPresenceGrantRequestListEvent. */ + enum { KInterfaceId = PRES_IF_ID_PRESENCE_GRANT_REQUEST_LIST_EVENT }; + + +protected: + + /** + * Protected destructor. + * Object instancies can't be deleted via this interface. + */ + virtual ~MPresenceGrantRequestListEvent() {} + + + +public: // Access to "delta information" + + + /** + * Gets count of new presence grant request entries. + * + * @return The count of new presence grant request entries. + */ + virtual TInt NewRequestsCount() const = 0; + + + /** + * Gets presence grant request entry by index. + * + * @param [in] aIndex + * The index of the presence grant request entry to get. + * + * @return The presence grant request entry from given index. + */ + virtual const MPresenceGrantRequestInfo& NewRequest( + TInt aIndex ) const = 0; + + + /** + * Gets count of disappeared presence grant request entries. + * + * @return The count of disappeared presence grant request entries. + */ + virtual TInt DisappearedRequestsCount() const = 0; + + + /** + * Gets presence grant request entry by index. + * + * @param [in] aIndex + * The index of the presence grant request entry to get. + * + * @return The presence grant request entry from given index. + */ + virtual const MPresenceGrantRequestInfo& DisappearedRequest( + TInt aIndex ) const = 0; + + + +public: // Access to "current information" + + + /** + * Gets count of current presence grant request entries. + * + * Note that, valid "current information" is signalled only when + * the client refreshes the event data from XIMP Framework cache, + * by re-issuing the data subscription. In other cases, just plain + * "delta information" is signalled to client. + * + * @return The count of current presence grant request entries. + */ + virtual TInt CurrentRequestsCount() const = 0; + + + /** + * Gets presence grant request entry by index. + * + * Note that, valid "current information" is signalled only when + * the client refreshes the event data from XIMP Framework cache, + * by re-issuing the data subscription. In other cases, just plain + * "delta information" is signalled to client. + * + * @param [in] aIndex + * The index of the presence grant request entry to get. + * + * @return The presence grant request entry from given index. + */ + virtual const MPresenceGrantRequestInfo& CurrentRequest( + TInt aIndex ) const = 0; + + + +public: // Access to subscription state + + + /** + * Returns subscription state object holding + * information about data items data subscription state. + * + * @return The data items data subscription state. + * Object ownership is not returned. + */ + virtual const MXIMPDataSubscriptionState& DataSubscriptionState() const = 0; + + + }; + + +#endif // MXIMPFWPRESENCEGRANTREQUESTLISTEVENT_H + + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_presence_management_api/inc/presencemanagementifids.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_presence_management_api/inc/presencemanagementifids.hrh Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,88 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework Presence Management API interface IDs. +* +*/ + +#ifndef PRESENCEMANAGEMENTIFUIDS_HRH +#define PRESENCEMANAGEMENTIFUIDS_HRH + + + +/** + * @defgroup ximppresmanagementapi XIMP Presence Management API + * @ingroup ximppresenceapi + * + * XIMP Framework Presence Management API contains + * abstract management interfaces, which are implemented by + * XIMP Framework. XIMP Framework clients call these + * interfaces to request XIMP Framework execute + * certain presence services. + * @since S60 v3.2 + */ + + +/** + * @defgroup ximppresmanagementapievents XIMP Presence Management API events + * + * XIMP Framework Presence Management API contains also + * abstract event interfaces, which are used to deliver data + * and state information to XIMP Framework clients through + * MXIMPContextObserver::HandlePresenceContextEvent() + * event callback. + * + * @ingroup ximppresmanagementapi + * @since S60 v3.2 + */ + + +// Management IF id's +// 20xx - ximp related +// 21xx - presence related +// 22xx - instant messaging related + + + +// Interface IDs for XIMPFw Presence Management API interfaces +#define PRES_IF_ID_PRESENCE_PUBLISHING 2101 +#define PRES_IF_ID_PRESENTITY_GROUPS 2102 +#define PRES_IF_ID_PRESENCE_WATCHING 2103 +#define PRES_IF_ID_PRESENCE_AUTHORIZATION 2104 +#define PRES_IF_ID_PRESENTITY_GROUP_LIST_EVENT 2105 +#define PRES_IF_ID_PRESENTITY_GROUP_CONTENT_EVENT 2106 +#define PRES_IF_ID_PRESENCE_BLOCK_LIST_EVENT 2107 +#define PRES_IF_ID_PRESENCE_GRANT_REQUEST_LIST_EVENT 2108 +#define PRES_IF_ID_PRESENCE_WATCHER_LIST_EVENT 2109 +#define PRES_IF_ID_PRESENTITY_PRESENCE_EVENT 2110 +#define PRES_IF_ID_OWN_PRESENCE_EVENT 2111 +#define PRES_IF_ID_PRESENCE_FEATURES 2112 + + +// Interface UID for Presencefeatures interface +#define XIMP_ECOM_IF_UID_PRESENCE_INTERFACE 0x2000B185 + +// Interface UID for PresenceCacheReader interface +#define XIMP_ECOM_IF_UID_PRESENCE_CACHE_READER 0x2000B4EC + +// Interface UID for PresenceCacheWriter interface +#define XIMP_ECOM_IF_UID_PRESENCE_CACHE_WRITER 0x2000B4ED + +// Default implementation resulution data +// for XIMP presencefeature interterface Base ECom interface +#define XIMP_ECOM_DEFAULT_DATA_PRESENCE_INTERFACE "default" + + + +#endif // PRESENCEMANAGEMENTIFUIDS_HRH + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_presence_management_api/inc/presencepublishing.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_presence_management_api/inc/presencepublishing.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,141 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Presence publication control interface for clients use. +* +*/ + +#ifndef MXIMPFWPRESENCEPUBLISHING_H +#define MXIMPFWPRESENCEPUBLISHING_H + +#include +#include +#include + + +class MPresenceInfo; +class MPresenceInfoFilter; + + +/** + * Presence publication control interface for clients use. + * Interface is implemented by the XIMP Framework. + * + * MPresencePublishing provides services to publish + * own presence infrmation to binded remote presence service. + * It also provides way to subscribe notifications from own + * presence changes + * + * MPresencePublishing interface can be obtained from + * MXIMPContext interface. + * + * @ingroup ximppresmanagementapi + * @since S60 v3.2 + */ +class MPresencePublishing : public MXIMPBase + { +public: + + /** Interface ID for the MPresencePublishing. */ + enum { KInterfaceId = PRES_IF_ID_PRESENCE_PUBLISHING }; + + +protected: + + /** + * Protected destructor. + * Object instancies can't be deleted via this interface. + */ + virtual ~MPresencePublishing() {} + + +public: //Presence publishing requests + + + /** + * Subscribes own presence information. + * + * Subscribes own presence information from + * remote presence service. + * + * Own presence subscription is asynchronous operation and + * it might evolve network operations. + * + * @param [in] aPif + * Presence info filter defining the presence + * information to subscribe. + * + * @return The request ID identifying the issued request. + */ + virtual TXIMPRequestId SubscribeOwnPresenceL( + const MPresenceInfoFilter& aPif ) = 0; + + + /** + * Unsubscribes own presence information. + * + * Unsubscribing own presence is asynchronous operation + * and it might evolve network operations. + * + * @return The request ID identifying the issued request. + */ + virtual TXIMPRequestId UnsubscribeOwnPresenceL() = 0; + + + + /** + * Publishes own presence information. + * + * Publishes own presence information to remote presence service. + * + * Presence publication is asynchronous operation and + * evolves network operations. + * + * @param [in] aPresence + * Presence info defining the presence information + * to publish. + * + * @return The request ID identifying the issued request. + */ + virtual TXIMPRequestId PublishOwnPresenceL( + const MPresenceInfo& aPresence ) = 0; + + + + +public: //Presence watcher list requests + + + /** + * Subscribes presence watcher list. + * + * @return The request ID identifying the issued request. + */ + virtual TXIMPRequestId SubscribePresenceWatcherListL() = 0; + + + /** + * Unsubscribes presence watcher list. + * + * @return The request ID identifying the issued request. + */ + virtual TXIMPRequestId UnsubscribePresenceWatcherListL() = 0; + + }; + + + +#endif // MXIMPFWPRESENCEPUBLISHING_H + + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_presence_management_api/inc/presencewatcherlistevent.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_presence_management_api/inc/presencewatcherlistevent.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,170 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Event interface for presence watcher list content. +* +*/ + +#ifndef MXIMPFWPRESENCEWATCHERLISTEVENT_H +#define MXIMPFWPRESENCEWATCHERLISTEVENT_H + +#include +#include +#include + + +class MXIMPIdentity; +class MPresenceWatcherInfo; +class MXIMPDataSubscriptionState; + + +/** + * Event interface for presence watcher list content. + * + * This interface is implemented by the XIMP Framework and + * event object is signalled to registered client observers + * through MXIMPContextObserver observer interface. + * This event notifies clients about changes in + * presence watcher list content. + * + * Clients subscribe for this event with + * MPresencePublishing::SubscribePresenceWatcherListL(). + * + * XIMP Framework signals this event when: + * - New subscribed data is received from protocol. + * - Data item data subscription status is updated by + * protocol adaptation. + * - When client unsubscribes the data item. + * - XIMP Framework generates initial data notification + * to client automatically after clients subscription, + * when the initial data comes available from protocol. + * + * @ingroup ximppresmanagementapievents + * @since S60 v3.2 + */ +class MPresenceWatcherListEvent : public MXIMPBase + { +public: + /** Interface ID for the MPresenceWatcherListEvent. */ + enum { KInterfaceId = PRES_IF_ID_PRESENCE_WATCHER_LIST_EVENT }; + + +protected: + + /** + * Protected destructor. + * Object instancies can't be deleted via this interface. + */ + virtual ~MPresenceWatcherListEvent() {} + + +public: // Access to "delta information" + + + /** + * Gets count of new presence watcher entries. + * + * @return The count of new presence watcher entries. + */ + virtual TInt NewWatchersCount() const = 0; + + + + /** + * Gets presence watcher entry by index. + * + * @param [in] aIndex + * The index of the presence watcher entry to get. + * + * @return The presence watcher entry from given index. + */ + virtual const MPresenceWatcherInfo& NewWatcher( + TInt aIndex ) const = 0; + + + + /** + * Gets count of dissappeared presence watcher entries. + * + * @return The count of dissappeared presence watcher entries. + */ + virtual TInt DisappearedWatchersCount() const = 0; + + + + /** + * Gets presence watcher entry by index. + * + * @param [in] aIndex + * The index of the presence watcher entry to get. + * + * @return The presence watcher entry from given index. + */ + virtual const MPresenceWatcherInfo& DisappearedWatcher( + TInt aIndex ) const = 0; + + + +public: // Access to "current information" + + + /** + * Gets count of current presence watcher entries. + * + * Note that, valid "current information" is signalled only when + * the client refreshes the event data from XIMP Framework cache, + * by re-issuing the data subscription. In other cases, just plain + * "delta information" is signalled to client. + * + * @return The count of current presence watcher entries. + */ + virtual TInt CurrentWatchersCount() const = 0; + + + + /** + * Gets presence watcher entry by index. + * + * Note that, current information is signalled only when + * the client refreshes the event data from XIMP Framework cache, + * by re-issuing the data subscription. + * + * @param [in] aIndex + * The index of the presence watcher entry to get. + * + * @return The presence watcher entry from given index. + */ + virtual const MPresenceWatcherInfo& CurrentWatcher( + TInt aIndex ) const = 0; + + + +public: // Access to subscription state + + + /** + * Returns subscription state object holding + * information about data items data subscription state. + * + * @return The data items data subscription state. + * Object ownership is not returned. + */ + virtual const MXIMPDataSubscriptionState& DataSubscriptionState() const = 0; + + + }; + + +#endif // MXIMPFWPRESENCEWATCHERLISTEVENT_H + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_presence_management_api/inc/presencewatching.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_presence_management_api/inc/presencewatching.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,143 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Presence subscription control interface for clients use. +* +*/ + +#ifndef MXIMPFWPRESENCEWATCHING_H +#define MXIMPFWPRESENCEWATCHING_H + +#include +#include +#include + + +class MPresenceInfoFilter; +class MXIMPIdentity; + + + +/** + * Presence subscription control interface for clients use. + * Interface is implemented by the XIMP Framework. + * + * @ingroup ximppresmanagementapi + * @since S60 v3.2 + */ +class MPresenceWatching : public MXIMPBase + { +public: + + /** Interface ID for the MPresenceWatching. */ + enum { KInterfaceId = PRES_IF_ID_PRESENCE_WATCHING }; + + +protected: + + /** + * Protected destructor. + * Object instancies can't be deleted via this interface. + */ + virtual ~MPresenceWatching() {} + + + +public: //Presentity presence subscription + + + /** + * Subscribe presentity presence. + * + * Subscribing presence is asynchronous operation and it + * might evolve network operations. + * + * @param [in] aPresentityId + * Identification of the presentity which presence + * information subscribe to. + * + * @param [in] aPif + * Presence information filter indicating the set + * of presence information to request from the + * presentity. + * + * @return The request ID identifying the issued request. + */ + virtual TXIMPRequestId SubscribePresentityPresenceL( + const MXIMPIdentity& aPresentityId, + const MPresenceInfoFilter& aPif ) = 0; + + + /** + * Unsubscribe presentity presence. + * + * Unsubscribing presence is asynchronous operation and it + * might evolve network operations. + * + * @param [in] aPresentityId + * Identification of the presentity which presence + * information subscribtion to end. + * + * @return The request ID identifying the issued request. + */ + virtual TXIMPRequestId UnsubscribePresentityPresenceL( + const MXIMPIdentity& aPresentityId ) = 0; + + + +public: //Presentity group members presence subscription + + + /** + * Subscribe presentity group members presence. + * + * Subscribing presence is asynchronous operation and it + * might evolve network operations. + * + * @param [in] aGroupId + * Identification of the presentity group for which + * members to request presence information. + * + * @param [in] aPif + * Presence information filter indicating the set + * of presence information to request from the + * presentity group members. + * + * @return The request ID identifying the issued request. + */ + virtual TXIMPRequestId SubscribePresentityGroupMembersPresenceL( + const MXIMPIdentity& aGroupId, + const MPresenceInfoFilter& aPif ) = 0; + + + /** + * Unsubscribe presentity group members presence. + * + * Unsubscribing presence is asynchronous operation and it + * might evolve network operations. + * + * @param [in] aGroupId + * Identification of the presentity group + * which members presence subscribtion to terminate. + * + * @return The request ID identifying the issued request. + */ + virtual TXIMPRequestId UnsubscribePresentityGroupMembersPresenceL( + const MXIMPIdentity& aGroupId ) = 0; + + }; + + +#endif // MXIMPFWPRESENCEWATCHING_H + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_presence_management_api/inc/presentitygroupcontentevent.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_presence_management_api/inc/presentitygroupcontentevent.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,189 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Event interface for presentity group content. +* +*/ + +#ifndef MXIMPFWPRESENTITYGROUPCONTENTEVENT_H +#define MXIMPFWPRESENTITYGROUPCONTENTEVENT_H + +#include +#include +#include + + +class MXIMPIdentity; +class MPresentityGroupMemberInfo; +class MXIMPDataSubscriptionState; + + + +/** + * Event interface for presentity group content event. + * + * This interface is implemented by the XIMP Framework and + * event object is signalled to registered client observers + * through MXIMPContextObserver observer interface. + * This event notifies clients about changes in + * presentity group content. + * + * Clients subscribe for this event with + * MPresentityGroups::SubscribePresentityGroupContentL(). + * + * XIMP Framework signals this event when: + * - New subscribed data is received from protocol. + * - Data item data subscription status is updated by + * protocol adaptation. + * - When client unsubscribes the data item. + * - XIMP Framework generates initial data notification + * to client automatically after clients subscription, + * when the initial data comes available from protocol. + * + * @ingroup ximppresmanagementapievents + * @since S60 v3.2 + */ +class MPresentityGroupContentEvent : public MXIMPBase + { +public: + /** Interface ID for the MPresentityGroupContentEvent. */ + enum { KInterfaceId = PRES_IF_ID_PRESENTITY_GROUP_CONTENT_EVENT }; + + +protected: + + /** + * Protected destructor. + * Object instancies can't be deleted via this interface. + */ + virtual ~MPresentityGroupContentEvent() {}; + + +public: // Access to "delta information" + + + /** + * Presentity group identity information. + */ + virtual const MXIMPIdentity& GroupId() const = 0; + + + + /** + * Gets count of new presentity group members. + * + * @return The count of new presentity group members. + */ + virtual TInt NewMembersCount() const = 0; + + + /** + * Gets presentity group member by index. + * + * @param [in] aIndex + * The index of the presentity group member to get. + * + * @return The presentity group member from given index. + */ + virtual const MPresentityGroupMemberInfo& NewMember( + TInt aIndex ) const = 0; + + + /** + * Gets count of updated presentity group members. + * + * @return The count of updated presentity group members. + */ + virtual TInt UpdatedMembersCount() const = 0; + + + /** + * Gets presentity group member by index. + * + * @param [in] aIndex + * The index of the presentity group member to get. + * + * @return The presentity group member from given index. + */ + virtual const MPresentityGroupMemberInfo& UpdatedMember( + TInt aIndex ) const = 0; + + + /** + * Gets count of disappeared presentity group members. + * + * @return The count of disappeared presentity group members. + */ + virtual TInt DisappearedMembersCount() const = 0; + + + /** + * Gets presentity group member by index. + * + * @param [in] aIndex + * The index of the presentity group member to get. + * + * @return The presentity group member from given index. + */ + virtual const MPresentityGroupMemberInfo& DisappearedMember( + TInt aIndex ) const = 0; + + + +public: // Access to "current information" + + /** + * Gets count of current presentity group members. + * + * Note that, current information is signalled only when + * the client refreshes the event data from XIMP Framework cache, + * by re-issuing the data subscription. + * + * @return The count of current presentity group members. + */ + virtual TInt CurrentMembersCount() const = 0; + + + + /** + * Gets presentity group member by index. + * + * @param [in] aIndex + * The index of the presentity group member to get. + * + * @return The presentity group member from given index. + */ + virtual const MPresentityGroupMemberInfo& CurrentMember( + TInt aIndex ) const = 0; + + + +public: // Access to subscription state + + + /** + * Returns subscription state object holding + * information about data items data subscription state. + * + * @return The data items data subscription state. + * Object ownership is not returned. + */ + virtual const MXIMPDataSubscriptionState& DataSubscriptionState() const = 0; + + }; + + +#endif // MXIMPFWPRESENTITYGROUPCONTENTEVENT_H + + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_presence_management_api/inc/presentitygrouplistevent.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_presence_management_api/inc/presentitygrouplistevent.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,186 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Event interface for presentity group list content. +* +*/ + +#ifndef MXIMPFWPRESENTITYGROUPLISTEVENT_H +#define MXIMPFWPRESENTITYGROUPLISTEVENT_H + +#include +#include +#include + + +class MXIMPIdentity; +class MPresentityGroupInfo; +class MXIMPDataSubscriptionState; + + +/** + * Event interface for presentity group list content. + * + * This interface is implemented by the XIMP Framework and + * event object is signalled to registered client observers + * through MXIMPContextObserver observer interface. + * This event notifies clients about changes in + * presentity group list content. + * + * Clients subscribe for this event with + * MPresentityGroups::SubscribePresentityGroupListL(). + * + * XIMP Framework signals this event when: + * - New subscribed data is received from protocol. + * - Data item data subscription status is updated by + * protocol adaptation. + * - When client unsubscribes the data item. + * - XIMP Framework generates initial data notification + * to client automatically after clients subscription, + * when the initial data comes available from protocol. + * + * @ingroup ximppresmanagementapievents + * @since S60 v3.2 + */ +class MPresentityGroupListEvent : public MXIMPBase + { +public: + /** Interface ID for the MPresentityGroupListEvent. */ + enum { KInterfaceId = PRES_IF_ID_PRESENTITY_GROUP_LIST_EVENT }; + + + +protected: + + /** + * Protected destructor. + * Object instancies can't be deleted via this interface. + */ + virtual ~MPresentityGroupListEvent() {} + + +public: // Access to "delta information" + + + /** + * Gets count of new presentity groups. + * + * @return The count of new presentity groups. + */ + virtual TInt NewGroupsCount() const = 0; + + + /** + * Gets presentity group entry by index. + * + * @param [in] aIndex + * The index of the presentity group entry to get. + * + * @return The presentity group entry from given index. + */ + virtual const MPresentityGroupInfo& NewGroup( + TInt aIndex ) const = 0; + + + /** + * Gets count of updated presentity groups. + * + * @return The count of updated presentity groups. + */ + virtual TInt UpdatedGroupsCount() const = 0; + + + /** + * Gets presentity group entry by index. + * + * @param [in] aIndex + * The index of the presentity group entry to get. + * + * @return The presentity group entry from given index. + */ + virtual const MPresentityGroupInfo& UpdatedGroup( + TInt aIndex ) const = 0; + + + /** + * Gets count of disappeared presentity groups. + * + * @return The count of disappeared presentity groups. + */ + virtual TInt DisappearedGroupsCount() const = 0; + + + /** + * Gets presentity group entry by index. + * + * @param [in] aIndex + * The index of the presentity group entry to get. + * + * @return The presentity group entry from given index. + */ + virtual const MPresentityGroupInfo& DisappearedGroup( + TInt aIndex ) const = 0; + + + +public: // Access to "current information" + + /** + * Gets count of current presentity groups. + * + * Note that, current information is signalled only when + * the client refreshes the event data from XIMP Framework cache, + * by re-issuing the data subscription. + * + * @return The count of current presentity groups. + */ + virtual TInt CurrentGroupsCount() const = 0; + + + /** + * Gets presentity group entry by index. + * + * Note that, current information is signalled only when + * the client refreshes the event data from XIMP Framework cache, + * by re-issuing the data subscription. + * + * @param [in] aIndex + * The index of the presentity group entry to get. + * + * @return The presentity group entry from given index. + */ + virtual const MPresentityGroupInfo& CurrentGroup( + TInt aIndex ) const = 0; + + + +public: // Access to subscription state + + + /** + * Returns subscription state object holding + * information about data items data subscription state. + * + * @return The data items data subscription state. + * Object ownership is not returned. + */ + virtual const MXIMPDataSubscriptionState& DataSubscriptionState() const = 0; + + + }; + + +#endif // MXIMPFWPRESENTITYGROUPLISTEVENT_H + + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_presence_management_api/inc/presentitygroups.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_presence_management_api/inc/presentitygroups.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,244 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Presentity group handling interface for clients use. +* +*/ + +#ifndef MXIMPFWPRESENTITYGROUPS_H +#define MXIMPFWPRESENTITYGROUPS_H + +#include +#include +#include + +class MXIMPIdentity; + + +/** + * Presentity group handling interface for clients use. + * Interface is implemented by the XIMP Framework. + * + * MPresentityGroups provides services for + * XIMP Framework clients to manage presentity groups + * and presentity group members. It provides also services + * to subscribe notifications from presentity group list changes + * and from individual presentity group changes. + * + * Client can retrieve MPresentityGroups interface from + * MXIMPContext interface. + * + * @ingroup ximppresmanagementapi + * @since S60 v3.2 + */ +class MPresentityGroups : public MXIMPBase + { +public: + + /** Interface ID for the MPresentityGroups. */ + enum { KInterfaceId = PRES_IF_ID_PRESENTITY_GROUPS }; + + +protected: + + /** + * Protected destructor. + * Object instancies can't be deleted via this interface. + */ + virtual ~MPresentityGroups() {} + + +public: //Presentity group management requests + + + /** + * Subscribes presentity group list notifications. + * + * @return The request ID identifying the issued request. + */ + virtual TXIMPRequestId SubscribePresentityGroupListL() = 0; + + + + /** + * Unsubscribes presentity group list notifications. + * + * @return The request ID identifying the issued request. + */ + virtual TXIMPRequestId UnsubscribePresentityGroupListL() = 0; + + + + /** + * Creates presentity group. + * + * Note: Remote service may alter given presentity group ID and + * display name. Altered ID and display names are signalled back + * to client through MXIMPRequestCompleteEvent. + * + * @param [in] aGroupId + * Identification for presentity group. + * + * @param [in] aDisplayName + * Presentity group display name. + * + * + * @return The request ID identifying the issued request. + */ + virtual TXIMPRequestId CreatePresentityGroupL( + const MXIMPIdentity& aGroupId, + const TDesC16& aDisplayName ) = 0; + + + /** + * Deletes presentity group. + * + * @param [in] aGroupId + * Identification for presentity group. + * + * @return The request ID identifying the issued request. + */ + virtual TXIMPRequestId DeletePresentityGroupL( + const MXIMPIdentity& aGroupId ) = 0; + + + + /** + * Updates presentity group display name. + * + * Note: Remote service may alter given presentity group display name. + * Altered display name is signalled back to client through + * MXIMPRequestCompleteEvent. + * + * @param [in] aGroupId + * Identification for presentity group. + * + * @param [in] aDisplayName + * New display name for the presentity group. + * + * @return The request ID identifying the issued request. + */ + virtual TXIMPRequestId UpdatePresentityGroupDisplayNameL( + const MXIMPIdentity& aGroupId, + const TDesC16& aDisplayName ) = 0; + + + +public: //Prototypes for presentity group member management requests + + + /** + * Subscribes presentity group content notifications. + * + * @param [in] aGroupId + * Identification for presentity group for which + * to subscribe content notifications. + * + * @return The request ID identifying the issued request. + */ + virtual TXIMPRequestId SubscribePresentityGroupContentL( + const MXIMPIdentity& aGroupId ) = 0; + + + /** + * Unsubscribes presentity group content notifications. + * + * @param [in] aGroupId + * Identification for presentity group for which + * content notification subscription to terminate. + * + * @return The request ID identifying the issued request. + */ + virtual TXIMPRequestId UnsubscribePresentityGroupContentL( + const MXIMPIdentity& aGroupId ) = 0; + + + /** + * Requests the protocol to add new member to + * identified presentity group. + * + * + * Note: Remote service may alter given member and + * display name. Altered ID and display names + * are signalled back to client through MXIMPRequestCompleteEvent. + * + * @param [in] aGroupId + * Identification of the presentity group where to + * add new member. + * + * @param [in] aMemberId + * Identification of the new member. + * + * @param [in] aMemberDisplayName + * Display name for the added member. + * + * @return The request ID identifying the issued request. + */ + virtual TXIMPRequestId AddPresentityGroupMemberL( + const MXIMPIdentity& aGroupId, + const MXIMPIdentity& aMemberId, + const TDesC16& aMemberDisplayName ) = 0; + + + /** + * Requests the XIMPFw to remove member from + * identified presentity group. + * + * @param [in] aGroupId + * Identification of the presentity group from + * where to remove member. + * + * @param [in] aMemberId + * Identification of the member to remove. + * + * @return The request ID identifying the issued request. + */ + virtual TXIMPRequestId RemovePresentityGroupMemberL( + const MXIMPIdentity& aGroupId, + const MXIMPIdentity& aMemberId ) = 0; + + + + /** + * Requests the XIMPFw to update presentity group + * member display name. + * + * Note: Remote service may alter given presentity group member + * display name. Altered display name is signalled back + * to client through MXIMPRequestCompleteEvent. + * + * @param [in] aGroupId + * Identification for presentity group. + * + * @param [in] aMemberId + * Identification of the member which display + * name to update. + * + * @param [in] aMemberDisplayName + * New display name for the member. + * + * @return The request ID identifying the issued request. + */ + virtual TXIMPRequestId UpdatePresentityGroupMemberDisplayNameL( + const MXIMPIdentity& aGroupId, + const MXIMPIdentity& aMemberId, + const TDesC16& aMemberDisplayName ) = 0; + + }; + + + +#endif // MXIMPFWPRESENTITYGROUPS_H + + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_presence_management_api/inc/presentitypresenceevent.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_presence_management_api/inc/presentitypresenceevent.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,110 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Event interface for subscribed presentity presence information. +* +*/ + +#ifndef MXIMPFWPRESENTITYPRESENCEEVENT_H +#define MXIMPFWPRESENTITYPRESENCEEVENT_H + +#include +#include +#include + + +class MXIMPIdentity; +class MPresenceInfo; +class MXIMPDataSubscriptionState; + + +/** + * Event interface for subscribed presentity presence information. + * + * This interface is implemented by the XIMP Framework and + * event object is signalled to registered client observers + * through MXIMPContextObserver observer interface. + * This event notifies clients about changes in subscribed + * presentitys presence information. + * + * Clients subscribe for this event with + * MPresenceWatching::SubscribePresentityPresenceL(). + * + * XIMP Framework signals this event when: + * - New subscribed data is received from protocol. + * - Data item data subscription status is updated by + * protocol adaptation. + * - When client unsubscribes the data item. + * - XIMP Framework generates initial data notification + * to client automatically after clients subscription, + * when the initial data comes available from protocol. + * + * @ingroup ximppresmanagementapievents + * @since S60 v3.2 + */ +class MPresentityPresenceEvent : public MXIMPBase + { +public: + /** Interface ID for the MPresentityPresenceEvent. */ + enum { KInterfaceId = PRES_IF_ID_PRESENTITY_PRESENCE_EVENT }; + + +protected: + + /** + * Protected destructor. + * Object instancies can't be deleted via this interface. + */ + virtual ~MPresentityPresenceEvent() {} + + +public: + + + /** + * Returns indetity of the presentity which presence is + * notified here. + * + * @return The presentity identification. + */ + virtual const MXIMPIdentity& PresentityId() const = 0; + + + /** + * Returns presence info object holding + * the subscribed presentitys presence information. + * + * @return The subscribed presentitys presence info. + * Object ownership is not returned. + */ + virtual const MPresenceInfo& SubscribedPresence() const = 0; + + + /** + * Returns subscription state object holding + * information about presentity presence subscription + * current state. + * + * @return The presentity presence subscription state object. + * Object ownership is not returned. + */ + virtual const MXIMPDataSubscriptionState& DataSubscriptionState() const = 0; + + + }; + + +#endif // MXIMPFWPRESENTITYPRESENCEEVENT_H + + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_presence_management_api/ximp_presence_management_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_presence_management_api/ximp_presence_management_api.metaxml Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,27 @@ + + + XIMP Presence Management API + Contains interfaces for managing and accessing presence information. API provides interfaces for: +- managing remote presence service connections +- publishing and subscribing presence data +- managing contact groups +- managing presence authorizations + c++ + ximpfw + + + + + + + + + + + + + + yes + no + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_presence_protocol_plugin_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_presence_protocol_plugin_api/group/bld.inf Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: File that exports the files belonging to +: XIMP Presence Protocol Plug-in API +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +../inc/protocolpresencewatching.h MW_LAYER_PLATFORM_EXPORT_PATH(protocolpresencewatching.h) +../inc/protocolpresentitygroups.h MW_LAYER_PLATFORM_EXPORT_PATH(protocolpresentitygroups.h) +../inc/protocolpresenceauthorization.h MW_LAYER_PLATFORM_EXPORT_PATH(protocolpresenceauthorization.h) +../inc/protocolpresencefeatures.h MW_LAYER_PLATFORM_EXPORT_PATH(protocolpresencefeatures.h) +../inc/presenceprotocolpluginifids.hrh MW_LAYER_PLATFORM_EXPORT_PATH(presenceprotocolpluginifids.hrh) +../inc/protocolpresencepublishing.h MW_LAYER_PLATFORM_EXPORT_PATH(protocolpresencepublishing.h) diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_presence_protocol_plugin_api/inc/presenceprotocolpluginifids.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_presence_protocol_plugin_api/inc/presenceprotocolpluginifids.hrh Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,60 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework Protocol Plugin API interface IDs. +* +*/ + +#ifndef PRESENCEPROTOCOLPLUGINIFIDS_HRH +#define PRESENCEPROTOCOLPLUGINIFIDS_HRH + + +/** + * @defgroup ximppresprotocolpluginapi XIMP Presence Protocol Plugin API + * @ingroup ximppresenceapi + * + * XIMP Framework Presence Protocol Plugin API contains abstract + * interfaces what protocol adaptation plug-ins must implement. + * XIMP Framework will instantiate protocol plug-ins through + * ECom framework and call methods declared in these interfces. + * + * XIMP Framework will instantiate and execute protocol + * implementations on dedicated Symbian OS server process. + * Protocol implementations are loaded on need basis, based + * on XIMP Framework clients requests. Protocol adaptation + * must derive from CXIMPProtocolPluginBase and make + * concrete protocol implementation available through ECom + * framework. + * + * @since S60 v3.2 + */ + +// ECom interface UID for XIMPFw Protocol Plugin Base +#define XIMP_ECOM_IF_UID_PROTOCOL_PLUGIN_BASE_INTERFACE 0x10282DD7 + + +// Protocol plugin IF id's +// 30xx - ximp related +// 31xx - presence related +// 32xx - instant messaging related + +// Interface IDs for XIMPFw Protocol Plugin API interfaces +#define PRES_IF_ID_PROTOCOL_PRESENCE_AUTHORIZATION 3101 +#define PRES_IF_ID_PROTOCOL_PRESENCE_PUBLISHING 3102 +#define PRES_IF_ID_PROTOCOL_PRESENCE_WATCHING 3103 +#define PRES_IF_ID_PROTOCOL_PRESENTITY_GROUPS 3104 +#define PRES_IF_ID_PROTOCOL_PRESENCE_FEATURES 3105 + +#endif // PRESENCEPROTOCOLPLUGINIFIDS_HRH + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_presence_protocol_plugin_api/inc/protocolpresenceauthorization.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_presence_protocol_plugin_api/inc/protocolpresenceauthorization.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,344 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interface for presence protocol authorization object. +* +*/ + +#ifndef MXIMPFWPROTOCOLPRESENCEAUTHORIZATION_H +#define MXIMPFWPROTOCOLPRESENCEAUTHORIZATION_H + + +#include +#include +#include +#include + + +class MXIMPIdentity; +class MPresenceInfoFilter; + + +/** + * Interface for presence protocol authorization object. + * Interface must be implemented by a XIMP Framework protocol + * plug-ins. + * + * This interface defines actions that XIMP Framework + * requests from a presence protocol connection to + * execute presence authorization related tasks. + * + * Protocol implementation must route requests received through + * this interface, to same remote presence service destination, + * as where the parent MXIMPProtocolConnection is connected. + * (Here the parent MXIMPProtocolConnection means the protocol + * connection instance from where this interface instance + * was retrieved.) + * + * @see MXIMPProtocolConnection + * @ingroup ximppresprotocolpluginapi + * @since S60 v3.2 + */ +class MProtocolPresenceAuthorization : public MXIMPBase + { +public: + + /** Interface ID for the MProtocolPresenceAuthorization. */ + enum { KInterfaceId = PRES_IF_ID_PROTOCOL_PRESENCE_AUTHORIZATION }; + + +protected: + + /** + * Protected destructor. MProtocolPresenceAuthorization + * instancies can't be destroyed via this interface. + */ + virtual inline ~MProtocolPresenceAuthorization() {}; + + + +public: // Subscribe presence grant request list + + + /** + * Requests the protocol to subscribe presence + * grant request list from remote service. + * + * @param [in] aReqId + * Request ID identifying the issued request. + */ + virtual void DoSubscribePresenceGrantRequestListL( + TXIMPRequestId aReqId ) = 0; + + + /** + * Requests the protocol to terminate presence + * grant request list subscription. + * + * @param [in] aReqId + * Request ID identifying the issued request. + */ + virtual void DoUnsubscribePresenceGrantRequestListL( + TXIMPRequestId aReqId ) = 0; + + + + +public: // Granting presence information access to single presentities + + + /** + * Requests the protocol to allow the identified presentity + * to see specified presence information. + * + * @param [in] aPresentityId + * Identification of the presentity to which + * to allow presence information access. + * + * @param [in] aPif + * Presence information filter indicating the + * allowed presence information. + * + * @param [in] aReqId + * Request ID identifying the issued request. + */ + virtual void DoGrantPresenceForPresentityL( + const MXIMPIdentity& aPresentityId, + const MPresenceInfoFilter& aPif, + TXIMPRequestId aReqId ) = 0; + + + /** + * Requests the protocol to update presence information + * filter (PIF) for already existing presence grant. + * + * @param [in] aPresentityId + * Identification of the presentity which presence + * grant PIF to update. + * + * @param [in] aPif + * Indicates the new set of presence information + * to allow for the presentity. Given set + * may be "wider" or "narrower" than the already + * allowed one. + * + * @param [in] aReqId + * Request ID identifying the issued request. + */ + virtual void DoUpdatePresenceGrantPifForPresentityL( + const MXIMPIdentity& aPresentityId, + const MPresenceInfoFilter& aPif, + TXIMPRequestId aReqId ) = 0; + + + /** + * Requests the protocol to withdraw existing + * presence information grant. + * + * @param [in] aPresentityId + * Identification of the presentity which presence + * grant to withdraw. + * + * @param [in] aReqId + * Request ID identifying the issued request. + */ + virtual void DoWithdrawPresenceGrantFromPresentityL( + const MXIMPIdentity& aPresentityId, + TXIMPRequestId aReqId ) = 0; + + + + +public: // Granting presence information access to presentity group members + + + /** + * Requests the protocol to allow the identified presentity + * group members to see specified presence information. + * + * + * @param [in] aGroupId + * Identification of the presentity group for which + * members to allow presence information. + * + * @param [in] aPif + * Presence information filter indicating the + * allowed presence information. + * + * @param [in] aReqId + * Request ID identifying the issued request. + */ + virtual void DoGrantPresenceForPresentityGroupMembersL( + const MXIMPIdentity& aGroupId, + const MPresenceInfoFilter& aPif, + TXIMPRequestId aReqId ) = 0; + + + /** + * Requests the protocol to update presence information + * filter (PIF) for already existing presentity group + * members presence grant. + * + * @param [in] aGroupId + * Identification of the presentity group for which + * members presence grant PIF to update. + * + * @param [in] aPif + * Indicates the new set of presence information + * to allow for the presentities. Given set + * may be "wider" or "narrower" than the already + * allowed one. + * + * @param [in] aReqId + * Request ID identifying the issued request. + */ + virtual void DoUpdatePresenceGrantPifForPresentityGroupMembersL( + const MXIMPIdentity& aGroupId, + const MPresenceInfoFilter& aPif, + TXIMPRequestId aReqId ) = 0; + + + /** + * Requests the protocol to withdraw existing + * presentity group members presence information grant. + * + * @param [in] aGroupId + * Identification of the presentity group + * which members presence grant to terminate. + * + * @param [in] aReqId + * Request ID identifying the issued request. + */ + virtual void DoWithdrawPresenceGrantFromPresentityGroupMembersL( + const MXIMPIdentity& aGroupId, + TXIMPRequestId aReqId ) = 0; + + + +public: // Granting presence information access to everyone + + + /** + * Requests the protocol to allow everyone + * to see specified presence information. + * + * @param [in] aPif + * Presence information filter indicating the + * allowed presence information. + * + * @param [in] aReqId + * Request ID identifying the issued request. + */ + virtual void DoGrantPresenceForEveryoneL( + const MPresenceInfoFilter& aPif, + TXIMPRequestId aReqId ) = 0; + + + /** + * Requests the protocol to update presence information + * filter (PIF) for already existing presence grant. + * + * @param [in] aPif + * Indicates the new set of presence information + * to allow for the presentity. Given set + * may be "wider" or "narrower" than the already + * allowed one. + * + * @param [in] aReqId + * Request ID identifying the issued request. + */ + virtual void DoUpdatePresenceGrantPifForEveryoneL( + const MPresenceInfoFilter& aPif, + TXIMPRequestId aReqId ) = 0; + + + /** + * Requests the protocol to withdraw existing + * presence information grant. + * + * @param [in] aReqId + * Request ID identifying the issued request. + */ + virtual void DoWithdrawPresenceGrantFromEveryoneL( + TXIMPRequestId aReqId ) = 0; + + +public: // Subscribe presence block list + + + /** + * Requests the protocol to subscribe presence + * block list from remote service. + * + * @param [in] aReqId + * Request ID identifying the issued request. + */ + virtual void DoSubscribePresenceBlockListL( + TXIMPRequestId aReqId ) = 0; + + + /** + * Requests the protocol to terminate presence + * block list subscription. + * + * @param [in] aReqId + * Request ID identifying the issued request. + */ + virtual void DoUnsubscribePresenceBlockListL( + TXIMPRequestId aReqId ) = 0; + + + +public: // Blocking presence information access from single presentities + + + /** + * Requests the protocol to block the identified presentity + * from seeing presence information produced by this + * presence connection. + * + * After blocking, identified presentity can't anymore + * access the user own presence information. + * + * @param [in] aPresentityId + * Identification of the presentity for which + * presence information access to block. + * + * @param [in] aReqId + * Request ID identifying the issued request. + */ + virtual void DoBlockPresenceForPresentityL( + const MXIMPIdentity& aPresentityId, + TXIMPRequestId aReqId ) = 0; + + + /** + * Requests the protocol to cancel existing presence + * information block from the identified presentity. + * + * @param [in] aPresentityId + * Identification of the presentity of which + * presence information block to cancel. + * + * @param [in] aReqId + * Request ID identifying the issued request. + */ + virtual void DoCancelPresenceBlockFromPresentityL( + const MXIMPIdentity& aPresentityId, + TXIMPRequestId aReqId ) = 0; + + }; + + + +#endif // MXIMPFWPROTOCOLPRESENCEAUTHORIZATION_H diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_presence_protocol_plugin_api/inc/protocolpresencefeatures.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_presence_protocol_plugin_api/inc/protocolpresencefeatures.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,220 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interface for presence protocol connection object. +* +*/ + +#ifndef MPRESENCEPROTOCOFEATURES_H +#define MPRESENCEPROTOCOFEATURES_H + + +#include +#include +#include +#include + + +class MXIMPContextClientInfo; +class MXIMPProtocolConnectionHost; +class MProtocolPresenceWatching; +class MProtocolPresencePublishing; +class MProtocolPresentityGroups; +class MProtocolPresenceAuthorization; + + + +/** + * Interface for presence protocol connection object. + * Interface must be implemented by a XIMP Framework protocol + * plug-ins. + * + * This interface models a connection from XIMP Framework to + * single remote presence service, over certain presence protocol + * implementation. XIMP Framework calls methods on this interface + * based on XIMP Framework client requests. + * + * XIMP Framework retrieves MXIMPProtocolConnection + * instances through MXIMPProtocolPlugin::AcquireConnectionL(). + * Same MXIMPProtocolConnection instance may be returned by multiple + * MXIMPProtocolPlugin::AcquireConnectionL() calls. In this case + * XIMP Framework shares MXIMPProtocolConnection instance + * by multiple clients, and MXIMPProtocolConnection lifetime is + * extended over utilizing client sessions. When last utilizing + * client session is succesfully closed with + * MXIMPProtocolConnection::CloseSession(), XIMP Framework + * disposes the MXIMPProtocolConnection instance with + * MXIMPProtocolPlugin::ReleaseConnection(). + * + * + * MProtocolPresenceFeatures implementation must provide + * access following feature specific sub-interfaces: + * - MProtocolPresenceWatching + * - MProtocolPresencePublishing + * - MProtocolPresentityGroups + * - MProtocolPresenceAuthorization + * + * Each provided sub-interface defines a set of its own + * presence managements requests, relating to presence watching + * and subscribing, presence publication, presentity groups and + * presentity group member management and to presence authorizations. + * XIMP Framework calls these sub-interfaces to request on + * spesific presence requests from protocol connection. + * + * @see MXIMPProtocolConnectionHost + * @ingroup ximppresprotocolpluginapi + * @since S60 v3.2 + */ +class MProtocolPresenceFeatures : public MXIMPBase + { +public: + + /** Interface ID for the MXIMPProtocolConnection. */ + enum { KInterfaceId = PRES_IF_ID_PROTOCOL_PRESENCE_FEATURES }; + + +protected: + + /** + * Protected destructor. MXIMPProtocolConnection + * objects can't be deleted through this interface. + * + * XIMP Framework disposes MXIMPProtocolConnection + * instances through MXIMPProtocolPlugin::ReleaseConnection(). + */ + virtual inline ~MProtocolPresenceFeatures() {}; + + + +public: // Access to sub-interfaces + + + /** + * Gets reference to presence watching interface. + * + * XIMP Framework calls this method to retrieve a reference + * to protocols MProtocolPresenceWatching interface + * implementation. + * + * Call and interface lifetime convention: + * - This method isn't called before protocol has signalled + * MXIMPProtocolConnection::OpenSessionL() succesfully completed. + * + * - XIMP Framework may call this method multiple times for + * for one MXIMPProtocolConnection instance. + * + * - Each call per one MXIMPProtocolConnection instance, + * must return reference to same interface instance. + * + * - Returned interface instance must remain valid (usable) + * untill last client session, using originating presence protocol + * connection is successfully closed with + * MXIMPProtocolConnection::CloseSession(). + * + * @return Requested interface. + * interface ownership is not returned caller. + */ + virtual MProtocolPresenceWatching& PresenceWatching() = 0; + + + + /** + * Gets reference to presence publishing interface. + * + * XIMP Framework calls this method to retrieve a reference + * to protocols MProtocolPresencePublishing interface + * implementation. + * + * Call and interface lifetime convention: + * - This method isn't called before protocol has signalled + * MXIMPProtocolConnection::OpenSessionL() succesfully completed. + * + * - XIMP Framework may call this method multiple times for + * for one MXIMPProtocolConnection instance. + * + * - Each call per one MXIMPProtocolConnection instance, + * must return reference to same interface instance. + * + * - Returned interface instance must remain valid (usable) + * untill last client session, using originating presence protocol + * connection is successfully closed with + * MXIMPProtocolConnection::CloseSession(). + * + * @return Requested interface. + * interface ownership is not returned caller. + */ + virtual MProtocolPresencePublishing& PresencePublishing() = 0; + + + + /** + * Gets reference to presentity groups interface. + * + * XIMP Framework calls this method to retrieve a reference + * to protocols MProtocolPresentityGroups interface + * implementation. + * + * Call and interface lifetime convention: + * - This method isn't called before protocol has signalled + * MXIMPProtocolConnection::OpenSessionL() succesfully completed. + * + * - XIMP Framework may call this method multiple times for + * for one MXIMPProtocolConnection instance. + * + * - Each call per one MXIMPProtocolConnection instance, + * must return reference to same interface instance. + * + * - Returned interface instance must remain valid (usable) + * untill last client session, using originating presence protocol + * connection is successfully closed with + * MXIMPProtocolConnection::CloseSession(). + * + * @return Requested interface. + * interface ownership is not returned caller. + */ + virtual MProtocolPresentityGroups& PresentityGroups() = 0; + + + + /** + * Gets reference to presence authorization interface. + * + * XIMP Framework calls this method to retrieve a reference + * to protocols MProtocolPresenceAuthorization interface + * implementation. + * + * Call and interface lifetime convention: + * - This method isn't called before protocol has signalled + * MXIMPProtocolConnection::OpenSessionL() succesfully completed. + * + * - XIMP Framework may call this method multiple times for + * for one MXIMPProtocolConnection instance. + * + * - Each call per one MXIMPProtocolConnection instance, + * must return reference to same interface instance. + * + * - Returned interface instance must remain valid (usable) + * untill last client session, using originating presence protocol + * connection is successfully closed with + * MXIMPProtocolConnection::CloseSession(). + * + * @return Requested interface. + * interface ownership is not returned caller. + */ + virtual MProtocolPresenceAuthorization& PresenceAuthorization() = 0; + + }; + + + +#endif // MPRESENCEPROTOCOFEATURES_H diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_presence_protocol_plugin_api/inc/protocolpresencepublishing.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_presence_protocol_plugin_api/inc/protocolpresencepublishing.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,170 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interface for presence protocol publishing object. +* +*/ + +#ifndef MXIMPFWPROTOCOLPRESENCEPUBLISHING_H +#define MXIMPFWPROTOCOLPRESENCEPUBLISHING_H + + +#include +#include +#include +#include + + +class MPresenceInfo; +class MPresenceInfoFilter; +class MXIMPIdentity; + + +/** + * Interface for presence protocol publishing object. + * Interface must be implemented by a XIMP Framework protocol + * plug-ins. + * + * This interface defines actions that XIMP Framework + * requests from a presence protocol connection to + * execute presence publishing related tasks. + * + * Protocol implementation must route requests received through + * this interface, to same remote presence service destination, + * as where the parent MXIMPProtocolConnection is connected. + * (Here the parent MXIMPProtocolConnection means the protocol + * connection instance from where this interface instance + * was retrieved.) + * + * @see MXIMPProtocolConnection + * @ingroup ximppresprotocolpluginapi + * @since S60 v3.2 + */ +class MProtocolPresencePublishing : public MXIMPBase + { +public: + + /** Interface ID for the MProtocolPresencePublishing. */ + enum { KInterfaceId = PRES_IF_ID_PROTOCOL_PRESENCE_PUBLISHING }; + + +protected: + + /** + * Protected destructor. MProtocolPresencePublishing + * instancies can't be destroyed via this interface. + */ + virtual inline ~MProtocolPresencePublishing() {}; + + + +public: // Publish user own presence information + + + /** + * Requests the protocol to publish user own + * presence information to remote service. + * + * + * @param [in] aOwnPresence + * Presence info indicating the own presence + * information to publish to remote service. + * + * @param [in] aReqId + * Request ID identifying the issued request. + */ + virtual void DoPublishOwnPresenceL( + const MPresenceInfo& aOwnPresence, + TXIMPRequestId aReqId ) = 0; + + + + +public: // Subscribe user own presence information + + + /** + * Requests the protocol to subscribe user own + * presence information from remote service. + * + * @param [in] aPif + * Presence information filter indicating the set + * of presence information to subscribe. + * + * @param [in] aReqId + * Request ID identifying the issued request. + */ + virtual void DoSubscribeOwnPresenceL( + const MPresenceInfoFilter& aPif, + TXIMPRequestId aReqId ) = 0; + + + /** + * Requests the protocol to update presence information + * filter (PIF) for already existing own presence subscription. + * + * @param [in] aPif + * Indicates the new set of presence information + * to subscribe. Given set may be "wider" or "narrower" + * than the already subscribed one. + * + * @param [in] aReqId + * Request ID identifying the issued request. + */ + virtual void DoUpdateOwnPresenceSubscriptionPifL( + const MPresenceInfoFilter& aPif, + TXIMPRequestId aReqId ) = 0; + + + /** + * Requests the protocol to terminate own presence + * information subscription. + * + * @param [in] aReqId + * Request ID identifying the issued request. + */ + virtual void DoUnsubscribeOwnPresenceL( + TXIMPRequestId aReqId ) = 0; + + + + +public: // Subscribe presence watcher list content + + + /** + * Requests the protocol to subscribe presence + * watcher list content from remote service. + * + * @param [in] aReqId + * Request ID identifying the issued request. + */ + virtual void DoSubscribePresenceWatcherListL( + TXIMPRequestId aReqId ) = 0; + + + /** + * Requests the protocol to terminate presence + * watcher list content subscription. + * + * @param [in] aReqId + * Request ID identifying the issued request. + */ + virtual void DoUnsubscribePresenceWatcherListL( + TXIMPRequestId aReqId ) = 0; + + }; + + + +#endif // MXIMPFWPROTOCOLPRESENCEPUBLISHING_H diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_presence_protocol_plugin_api/inc/protocolpresencewatching.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_presence_protocol_plugin_api/inc/protocolpresencewatching.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,205 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interface for presence protocol watching object. +* +*/ + +#ifndef MXIMPFWPROTOCOLPRESENCEWATCHING_H +#define MXIMPFWPROTOCOLPRESENCEWATCHING_H + +#include +#include +#include +#include + + +class MPresenceInfo; +class MPresenceInfoFilter; +class MXIMPIdentity; + + +/** + * Interface for presence protocol watching object. + * Interface must be implemented by a XIMP Framework protocol + * plug-ins. + * + * This interface defines actions that XIMP Framework + * requests from a presence protocol connection to + * execute presence watching related tasks. + * + * Protocol implementation must route requests received through + * this interface, to same remote presence service destination, + * as where the parent MXIMPProtocolConnection is connected. + * (Here the parent MXIMPProtocolConnection means the protocol + * connection instance from where this interface instance + * was retrieved.) + * + * @see MXIMPProtocolConnection + * @ingroup ximppresprotocolpluginapi + * @since S60 v3.2 + */ +class MProtocolPresenceWatching : public MXIMPBase + { +public: + + /** Interface ID for the MProtocolPresenceWatching. */ + enum { KInterfaceId = PRES_IF_ID_PROTOCOL_PRESENCE_WATCHING }; + + +protected: + + /** + * Protected destructor. MProtocolPresenceWatching + * instancies can't be destroyed via this interface. + */ + virtual inline ~MProtocolPresenceWatching() {}; + + + +public: // Subscribe presence information from single presentities + + + /** + * Requests the protocol to subscribe presence information + * for identified presentity. + * + * @param [in] aPresentityId + * Identification of the presentity which presence + * information subscribe to. + * + * @param [in] aPif + * Presence information filter indicating the set + * of presence information to request from the + * presentity. + * + * @param [in] aReqId + * Request ID identifying the issued request. + */ + virtual void DoSubscribePresentityPresenceL( + const MXIMPIdentity& aPresentityId, + const MPresenceInfoFilter& aPif, + TXIMPRequestId aReqId ) = 0; + + + /** + * Requests the protocol to update presence information + * filter (PIF) for already existing presence subscription. + * + * @param [in] aPresentityId + * Identification of the presentity which presence + * subscribtion PIF to update. + * + * @param [in] aPif + * Indicates the new set of presence information + * to request from the presentity. Given set + * may be "wider" or "narrower" than the already + * subscribed one. + * + * @param [in] aReqId + * Request ID identifying the issued request. + */ + virtual void DoUpdatePresentityPresenceSubscriptionPifL( + const MXIMPIdentity& aPresentityId, + const MPresenceInfoFilter& aPif, + TXIMPRequestId aReqId ) = 0; + + + /** + * Requests the protocol to terminate presentity + * presence information subscription. + * + * @param [in] aPresentityId + * Identification of the presentity which presence + * subscribtion to terminate. + * + * @param [in] aReqId + * Request ID identifying the issued request. + */ + virtual void DoUnsubscribePresentityPresenceL( + const MXIMPIdentity& aPresentityId, + TXIMPRequestId aReqId ) = 0; + + + + +public: // Subscribe presence information from presentity group members + + + /** + * Requests the protocol to subscribe presence information + * for all the presentities existing in the identified + * presentity group. + * + * @param [in] aGroupId + * Identification of the presentity group for which + * members to request presence information. + * + * @param [in] aPif + * Presence information filter indicating the set + * of presence information to request from the + * presentity group members. + * + * @param [in] aReqId + * Request ID identifying the issued request. + */ + virtual void DoSubscribePresentityGroupMembersPresenceL( + const MXIMPIdentity& aGroupId, + const MPresenceInfoFilter& aPif, + TXIMPRequestId aReqId ) = 0; + + + /** + * Requests the protocol to update presence information + * filter (PIF) for already existing presentity group + * members presence subscription. + * + * @param [in] aGroupId + * Identification of the presentity group for which + * members presence subscribtion PIF to update. + * + * @param [in] aPif + * Indicates the new set of presence information + * to request from the presentities. Given set + * may be "wider" or "narrower" than the already + * subscribed one. + * + * @param [in] aReqId + * Request ID identifying the issued request. + */ + virtual void DoUpdatePresentityGroupMembersPresenceSubscriptionPifL( + const MXIMPIdentity& aGroupId, + const MPresenceInfoFilter& aPif, + TXIMPRequestId aReqId ) = 0; + + + /** + * Requests the protocol to terminate presentity group + * members presence information subscription. + * + * @param [in] aGroupId + * Identification of the presentity group + * which members presence subscribtion to terminate. + * + * @param [in] aReqId + * Request ID identifying the issued request. + */ + virtual void DoUnsubscribePresentityGroupMembersPresenceL( + const MXIMPIdentity& aGroupId, + TXIMPRequestId aReqId ) = 0; + + }; + + + +#endif // MXIMPFWPROTOCOLPRESENCEWATCHING_H diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_presence_protocol_plugin_api/inc/protocolpresentitygroups.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_presence_protocol_plugin_api/inc/protocolpresentitygroups.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,265 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interface for presence protocol presentity groups object. +* +*/ + +#ifndef MXIMPFWPROTOCOLPRESENTITYGROUPS_H +#define MXIMPFWPROTOCOLPRESENTITYGROUPS_H + + +#include +#include +#include +#include + + +class MXIMPIdentity; + + + +/** + * Interface for presence protocol presentity groups object. + * Interface must be implemented by a XIMP Framework protocol + * plug-ins. + * + * This interface defines actions that XIMP Framework + * requests from a presence protocol connection to + * execute presentity groups related tasks. + * + * Protocol implementation must route requests received through + * this interface, to same remote presence service destination, + * as where the parent MXIMPProtocolConnection is connected. + * (Here the parent MXIMPProtocolConnection means the protocol + * connection instance from where this interface instance + * was retrieved.) + * + * @see MXIMPProtocolConnection + * @ingroup ximppresprotocolpluginapi + * @since S60 v3.2 + */ +class MProtocolPresentityGroups : public MXIMPBase + { +public: + + /** Interface ID for the MProtocolPresentityGroups. */ + enum { KInterfaceId = PRES_IF_ID_PROTOCOL_PRESENTITY_GROUPS }; + + +protected: + + /** + * Protected destructor. MProtocolPresentityGroups + * instancies can't be destroyed via this interface. + */ + virtual inline ~MProtocolPresentityGroups() {}; + + + +public: // Subscribe presentity group list content + + + /** + * Requests the protocol to subscribe presentity + * group list content from remote service. + * + * @param [in] aReqId + * Request ID identifying the issued request. + */ + virtual void DoSubscribePresentityGroupListL( + TXIMPRequestId aReqId ) = 0; + + + /** + * Requests the protocol to terminate presentity + * group list content subscription. + * + * @param [in] aReqId + * Request ID identifying the issued request. + */ + virtual void DoUnsubscribePresentityGroupListL( + TXIMPRequestId aReqId ) = 0; + + + +public: // Manage presentity groups + + + /** + * Requests the protocol to create new presentity + * group to remote service. + * + * @param [in] aGroupId + * Identification of the presentity group to create. + * + * @param [in] aDisplayName + * Display name for the created presentity group. + * + * @param [in] aReqId + * Request ID identifying the issued request. + */ + virtual void DoCreatePresentityGroupL( + const MXIMPIdentity& aGroupId, + const TDesC16& aDisplayName, + TXIMPRequestId aReqId ) = 0; + + + /** + * Requests the protocol to delete existing presentity + * group from remote service. + * + * @param [in] aGroupId + * Identification of the presentity group to delete. + * + * @param [in] aReqId + * Request ID identifying the issued request. + */ + virtual void DoDeletePresentityGroupL( + const MXIMPIdentity& aGroupId, + TXIMPRequestId aReqId ) = 0; + + + /** + * Requests the protocol to update existing presentity + * group display name on remote service. + * + * @param [in] aGroupId + * Identification of the presentity group which + * display name to update. + * + * @param [in] aDisplayName + * New display name for the presentity group. + + * @param [in] aReqId + * Request ID identifying the issued request. + */ + virtual void DoUpdatePresentityGroupDisplayNameL( + const MXIMPIdentity& aGroupId, + const TDesC16& aDisplayName, + TXIMPRequestId aReqId ) = 0; + + + +public: // Subscribe presentity group content + + /** + * Requests the protocol to subscribe presentity + * group content from remote service. + * + * @param [in] aGroupId + * Identification of the presentity group of which + * content to subscribe. + * + * @param [in] aReqId + * Request ID identifying the issued request. + */ + virtual void DoSubscribePresentityGroupContentL( + const MXIMPIdentity& aGroupId, + TXIMPRequestId aReqId ) = 0; + + + /** + * Requests the protocol to terminate presentity + * group content subscription. + * + * @param [in] aGroupId + * Identification of the presentity group of which + * content subscribtion to terminate. + * + * @param [in] aReqId + * Request ID identifying the issued request. + */ + virtual void DoUnsubscribePresentityGroupContentL( + const MXIMPIdentity& aGroupId, + TXIMPRequestId aReqId ) = 0; + + + + +public: // Manage presentity group members + + + /** + * Requests the protocol to add new member to + * identified presentity group. + * + * @param [in] aGroupId + * Identification of the presentity group where to + * add new member. + * + * @param [in] aMemberId + * Identification of the new member. + * + * @param [in] aMemberDisplayName + * Display name for the added member. + * + * @param [in] aReqId + * Request ID identifying the issued request. + */ + virtual void DoAddPresentityGroupMemberL( + const MXIMPIdentity& aGroupId, + const MXIMPIdentity& aMemberId, + const TDesC16& aMemberDisplayName, + TXIMPRequestId aReqId ) = 0; + + + /** + * Requests the protocol to remove member from + * identified presentity group. + * + * @param [in] aGroupId + * Identification of the presentity group from + * where to remove member. + * + * @param [in] aMemberId + * Identification of the member to remove. + * + * @param [in] aReqId + * Request ID identifying the issued request. + */ + virtual void DoRemovePresentityGroupMemberL( + const MXIMPIdentity& aGroupId, + const MXIMPIdentity& aMemberId, + TXIMPRequestId aReqId ) = 0; + + + /** + * Requests the protocol to update presentity group + * member display name. + * + * @param [in] aGroupId + * Identification of the presentity group of which + * member display name to update. + * + * @param [in] aMemberId + * Identification of the member which display + * name to update. + * + * @param [in] aMemberDisplayName + * New display name for the member. + * + * @param [in] aReqId + * Request ID identifying the issued request. + */ + virtual void DoUpdatePresentityGroupMemberDisplayNameL( + const MXIMPIdentity& aGroupId, + const MXIMPIdentity& aMemberId, + const TDesC16& aMemberDisplayName, + TXIMPRequestId aReqId ) = 0; + + }; + + + +#endif // MXIMPFWPROTOCOLPRESENTITYGROUPS_H diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_presence_protocol_plugin_api/ximp_presence_protocol_plugin_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_presence_protocol_plugin_api/ximp_presence_protocol_plugin_api.metaxml Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,23 @@ + + + XIMP Presence Protocol Plug-in API + API contains ECom plug-in interface that must be implemented by the presence protocol plug-ins. The plug-in interface aggregates functionality to send and request presence data from remote presence service. + c++ + ximpfw + + + + + + + + + + + + + + yes + no + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_presence_protocol_plugin_host_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_presence_protocol_plugin_host_api/group/bld.inf Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: File that exports the files belonging to +: XIMP Presence Protocol Plug-in Host API +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +../inc/protocolpresencewatchingdatahost.h MW_LAYER_PLATFORM_EXPORT_PATH(protocolpresencewatchingdatahost.h) +../inc/protocolpresenceauthorizationdatahost.h MW_LAYER_PLATFORM_EXPORT_PATH(protocolpresenceauthorizationdatahost.h) +../inc/protocolpresentitygroupsdatahost.h MW_LAYER_PLATFORM_EXPORT_PATH(protocolpresentitygroupsdatahost.h) +../inc/protocolpresencedatahost.h MW_LAYER_PLATFORM_EXPORT_PATH(protocolpresencedatahost.h) +../inc/presenceprotocolpluginhostifids.hrh MW_LAYER_PLATFORM_EXPORT_PATH(presenceprotocolpluginhostifids.hrh) +../inc/protocolpresencepublishingdatahost.h MW_LAYER_PLATFORM_EXPORT_PATH(protocolpresencepublishingdatahost.h) diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_presence_protocol_plugin_host_api/inc/presenceprotocolpluginhostifids.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_presence_protocol_plugin_host_api/inc/presenceprotocolpluginhostifids.hrh Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,56 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Protocol Plugin Host API interface IDs. +* +*/ + +#ifndef PRESENCEPROTOCOLPLUGINHOSTIFIDS_HRH +#define PRESENCEPROTOCOLPLUGINHOSTIFIDS_HRH + + +/** + * @defgroup ximppresprotocolpluginhostapi XIMP Presence Protocol Plugin Host API + * @ingroup ximppresenceapi + * + * Protocol Plugin Host API contains abstract interfaces what + * XIMP Framework implements, and what protocol adaptation + * plug-ins must use to communicate back to XIMP Framework + * direction. XIMP Framework registeres these callback interfaces + * to protocol adaptation plug-ins, after instantiating plug-in + * objects, but before using them any other way. + * + * MXIMPProtocolPluginHost interface is the callback interface for + * the MXIMPProtocolPlugin. + * + * MXIMPProtocolConnectionHost interface is the callback interface for + * the MXIMPProtocolConnection. + * + * @since S60 v3.2 + */ + +// Protocol plugin host IF id's +// 40xx - ximp related +// 41xx - presence related +// 42xx - instant messaging related + +// Interface IDs for XIMPFw Protocol Plugin Host interfaces +#define PRES_IF_ID_PROTOCOL_PRESENTITY_GROUPS_DATAHOST 4101 +#define PRES_IF_ID_PROTOCOL_PRESENCE_PUBLISHING_DATAHOST 4102 +#define PRES_IF_ID_PROTOCOL_PRESENCE_WATCHING_DATAHOST 4103 +#define PRES_IF_ID_PROTOCOL_PRESENCE_AUTHORIZATION_DATAHOST 4104 +#define PRES_IF_ID_PROTOCOL_PRESENCE_DATAHOST 4105 + +#endif // PRESENCEPROTOCOLPLUGINHOSTIFIDS_HRH + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_presence_protocol_plugin_host_api/inc/protocolpresenceauthorizationdatahost.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_presence_protocol_plugin_host_api/inc/protocolpresenceauthorizationdatahost.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,395 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interface for managing cached presence authorization information. +* +*/ + +#ifndef MXIMPFWPROTOCOLPRESENCEAUTHORIZATIONDATAHOST_H +#define MXIMPFWPROTOCOLPRESENCEAUTHORIZATIONDATAHOST_H + +#include +#include +#include + + +class MXIMPIdentity; +class MXIMPObjectCollection; +class MPresenceBlockInfo; +class MPresenceGrantRequestInfo; +class MXIMPDataSubscriptionState; +class MXIMPStatus; + + + +/** + * Interface for managing cached presence authorization information. + * + * Interface is used by protocol adaptations to manage + * presence authorization related information in + * XIMP Framework internal data cache. + * + * This interface is implemented by XIMP Framework. + * Protocol adaptation can obtain reference to this + * interface from MXIMPProtocolConnectionHost interface. + * + * For each separated protocol connection, protocol + * adaptation must use the specific + * MProtocolPresentityGroupsDataHost instance, + * what is received from the connection specific + * MXIMPProtocolConnectionHost instance. + * + * @ingroup ximppresprotocolpluginhostapi + * @since S60 v3.2 + */ +class MProtocolPresenceAuthorizationDataHost : public MXIMPBase + { +public: + + /** Interface ID for the MProtocolPresenceAuthorizationDataHost. */ + enum { KInterfaceId = PRES_IF_ID_PROTOCOL_PRESENCE_AUTHORIZATION_DATAHOST }; + + +protected: + + + /** + * Protected destructor. Object instancies + * can't be deleted via this interface. + */ + virtual ~MProtocolPresenceAuthorizationDataHost() {} + + + +public: // Handling presence grant requests + + + /** + * Notifies XIMP Framework from + * presence grant request list contents. + * + * Protocol adaptation implementation can call this + * method to notify XIMP Framework from + * complete presence grant request list content. + * XIMP Framework calculates the changes + * (new and obsoleted requests) from previous + * presence grant request list content, and notifies + * the subscribing clients from data changes. + * + * XIMP Framework takes ownership of the object + * collection and all objects contained within, if + * the method succeeds without a leave. + * + * @param [in] aGrantRequestList + * MXIMPObjectCollection object containing zero or + * more MPresenceGrantRequestInfo objects. Each + * contained MPresenceGrantRequestInfo shall present + * single presence grant request entry in the list of + * presence grant requests. + * + * @return The request ID identifying the issued request. + * Data cache update request is processed + * asynchronously and operation completion result is + * signalled to adaptation direction through + * MXIMPProtocolConnectionHostObserver interface. + * + * @leave KErrNoMemory if failed to allocate memory. + * @leave KErrArgument if NULL argument(s) were provided. + */ + virtual TXIMPRequestId HandlePresenceGrantRequestListL( + MXIMPObjectCollection* aGrantRequestList ) = 0; + + + + /** + * Notifies XIMP Framework from new presence grant request. + * + * Protocol adaptation implementation can call this + * method to notify XIMP Framework from + * new presence grant request. XIMP Framework calculates + * the change, from previous presence grant request list content, + * and notifies the subscribing clients from data changes. + * + * XIMP Framework takes ownership of the argument(s), + * if method succeeds without a leave. + * + * @param [in] aGrantRequest + * MPresenceGrantRequestInfo object holding + * information about new presence grant request + * entry. + * + * @return The request ID identifying the issued request. + * Data cache update request is processed + * asynchronously and operation completion result is + * signalled to adaptation direction through + * MXIMPProtocolConnectionHostObserver interface. + * + * @leave KErrNoMemory if failed to allocate memory. + * @leave KErrArgument if NULL argument(s) were provided. + */ + virtual TXIMPRequestId HandlePresenceGrantRequestReceivedL( + MPresenceGrantRequestInfo* aGrantRequest ) = 0; + + + + /** + * Notifies XIMP Framework that existing presence + * grant request is obsoleted. + * + * Notifies XIMP Framework that existing presence + * grant request is obsoleted and thus it needs be removed + * from presence grant request list. XIMP Framework + * calculates the change, from previous presence grant request + * list content, and notifies the subscribing clients from + * data changes. + * + * XIMP Framework takes ownership of the argument(s), + * if method succeeds without a leave. + * + * @param [in] aGrantRequestor + * Identity of the presence grant requestor, which + * presence grant request needs to be removed + * from presence grant request list. + * + * @return The request ID identifying the issued request. + * Data cache update request is processed + * asynchronously and operation completion result is + * signalled to adaptation direction through + * MXIMPProtocolConnectionHostObserver interface. + * + * @leave KErrNoMemory if failed to allocate memory. + * @leave KErrArgument if NULL argument(s) were provided. + */ + virtual TXIMPRequestId HandlePresenceGrantRequestObsoletedL( + MXIMPIdentity* aGrantRequestor ) = 0; + + + + /** + * Gets data subscription state for presence grant request list. + * + * Protocol adaptation can call this method to retrieve + * presence grant request list current data subscription state. + * Protocol adaptation can use data subscription state + * information, to optimize its own processing and + * network trafic amount. + * + * @return Presence grant request list data subscription state. + * Interface ownership is not returned to caller. + * Caller shouldn't cache the returned reference + * for later use. + */ + virtual const MXIMPDataSubscriptionState& + PresenceGrantRequestDataSubscriptionState() const = 0; + + + + /** + * Updates data subscription state for presence grant + * request list. + * + * Updates data subscription state for presence grant + * request list. XIMP Framework calculates the + * subscription state change, from previous + * presence grant request list content, and notifies the + * subscribing clients from data changes. + * + * XIMP Framework takes ownership of the argument(s), + * if method succeeds without a leave. + * + * @param [in] aSubscriptionState + * New data subscription state for presence grant + * request list. + * + * @param [in] aStatus + * Optional status object describing the + * the reason, why protocol adaptation updated + * data item subscription state. Given status object + * is passed to clients through data item specific + * data change event. NULL value is accepted. + * + * @return The request ID identifying the issued request. + * Data cache update request is processed + * asynchronously and operation completion result is + * signalled to adaptation direction through + * MXIMPProtocolConnectionHostObserver interface. + * + * @leave KErrNoMemory if failed to allocate memory. + * @leave KErrArgument if NULL subscription state argument was provided. + */ + virtual TXIMPRequestId SetPresenceGrantRequestDataSubscriptionStateL( + MXIMPDataSubscriptionState* aSubscriptionState, + MXIMPStatus* aStatus ) = 0; + + + +public: // Handling presence blocking + + + + /** + * Notifies XIMP Framework from presence block list + * contents. + * + * Protocol adaptation implementation can call this + * method to notify XIMP Framework from complete + * presence block list content. XIMP Framework + * calculates the changes (new and removed block entries) + * from previous presence block list content, and notifies + * the subscribing clients from data changes. + * + * XIMP Framework takes ownership of the object + * collection and all objects contained within, if + * the method succeeds without a leave. + * + * @param [in] aBlockList + * MXIMPObjectCollection object containing zero or + * more MPresenceBlockInfo objects. Each + * contained MPresenceBlockInfo shall present + * single presence block entry in the presence block list. + * + * @return The request ID identifying the issued request. + * Data cache request is processed asynchronously and + * its completion is signalled to adaptation direction + * through MXIMPProtocolConnectionHostObserver interface, + * with MXIMPProtocolRequestCompleteEvent event. + * + * @leave KErrNoMemory if failed to allocate memory. + * @leave KErrArgument if NULL argument(s) were provided. + */ + virtual TXIMPRequestId HandlePresenceBlockListL( + MXIMPObjectCollection* aBlockList ) = 0; + + + + /** + * Notifies XIMP Framework from new + * presence block entry. + * + * Protocol adaptation implementation can call this + * method to notify XIMP Framework from + * new presence block entry. XIMP Framework + * calculates the change, from previous presence block + * list content, and notifies the subscribing clients + * from data changes. + * + * XIMP Framework takes ownership of the argument(s), + * if method succeeds without a leave. + * + * @param [in] aBlockInfo + * MPresenceBlockInfo object containing + * presence block entrys information. + * + * @return The request ID identifying the issued request. + * Data cache request is processed asynchronously and + * its completion is signalled to adaptation direction + * through MXIMPProtocolConnectionHostObserver interface, + * with MXIMPProtocolRequestCompleteEvent event. + * + * @leave KErrNoMemory if failed to allocate memory. + * @leave KErrArgument if NULL argument(s) were provided. + */ + virtual TXIMPRequestId HandlePresenceBlockedL( + MPresenceBlockInfo* aBlockInfo ) = 0; + + + + /** + * Notifies XIMP Framework from cancellation of + * existing presence block entry. + * + * Protocol adaptation can call this method to notify + * XIMP Framework from cancellation of existing + * presence block entry. XIMP Framework calculates + * the change, from previous presence block list content, + * and notifies the subscribing clients from data changes. + * + * XIMP Framework takes ownership of the argument(s), + * if method succeeds without a leave. + * + * @param [in] aBlockedEntityId + * Identity of the presence block entry which to + * remove from presence block list. + * + * @return The request ID identifying the issued request. + * Data cache request is processed asynchronously and + * its completion is signalled to adaptation direction + * through MXIMPProtocolConnectionHostObserver interface, + * with MXIMPProtocolRequestCompleteEvent event. + * + * @leave KErrNoMemory if failed to allocate memory. + * @leave KErrArgument if NULL argument(s) were provided. + */ + virtual TXIMPRequestId HandlePresenceBlockCanceledL( + MXIMPIdentity* aBlockedEntityId ) = 0; + + + + /** + * Gets data subscription state for presence block list. + * + * Protocol adaptation can call this method to retrieve + * presence block list current data subscription state. + * Protocol adaptation can use data subscription state + * information, to optimize its own processing and + * network trafic amount. + * + * @return Presence block list data subscription state. + * Interface ownership is not returned to caller. + * Caller shouldn't cache the returned reference + * for later use. + */ + virtual const MXIMPDataSubscriptionState& + PresenceBlockDataSubscriptionState() const = 0; + + + + /** + * Updates data subscription state for presence block list. + * + * Updates data subscription state for presence block list. + * XIMP Framework calculates the subscription state change, + * from previous presence block list content, and notifies the + * subscribing clients from data changes. + * + * XIMP Framework takes ownership of the argument(s), + * if method succeeds without a leave. + * + * @param [in] aSubscriptionState + * New data subscription state for presence block list. + * + * @param [in] aStatus + * Optional status object describing the + * the reason, why protocol adaptation updated + * data item subscription state. Given status object + * is passed to clients through data item specific + * data change event. NULL value is accepted. + * + * @return The request ID identifying the issued request. + * Data cache request is processed asynchronously and + * its completion is signalled to adaptation direction + * through MXIMPProtocolConnectionHostObserver interface, + * with MXIMPProtocolRequestCompleteEvent event. + * + * @leave KErrNoMemory if failed to allocate memory. + * @leave KErrArgument if NULL subscription state argument was provided. + */ + virtual TXIMPRequestId SetPresenceBlockDataSubscriptionStateL( + MXIMPDataSubscriptionState* aSubscriptionState, + MXIMPStatus* aStatus ) = 0; + + + }; + + +#endif // MXIMPFWPROTOCOLPRESENCEAUTHORIZATIONDATAHOST_H diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_presence_protocol_plugin_host_api/inc/protocolpresencedatahost.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_presence_protocol_plugin_host_api/inc/protocolpresencedatahost.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,157 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interface for presence protocol connection host. +* +*/ + +#ifndef MPROTOCOLPRESENCEDATAHOST_H +#define MPROTOCOLPRESENCEDATAHOST_H + + +#include +#include +#include + + +class MXIMPStatus; +class MPresenceObjectFactory; +class MXIMPProtocolConnectionHostObserver; +class MProtocolPresenceWatchingDataHost; +class MProtocolPresentityGroupsDataHost; +class MProtocolPresencePublishingDataHost; +class MProtocolPresenceAuthorizationDataHost; + + + +// CLASS DECLARATION + +/** + * Interface for presence protocol connection host. + * This interface is implemented by XIMP Framework. + * + * Presence protocol connection host interface defines + * requests that a presence protocol implementation + * can request (callback) from XIMP Framework. + * + * @see MXIMPProtocolConnection + * @ingroup ximppresprotocolpluginhostapi + * @since S60 v3.2 + */ +class MProtocolPresenceDataHost : public MXIMPBase + { +public: + + /** Interface ID for the MXIMPProtocolConnectionHost. */ + enum { KInterfaceId = PRES_IF_ID_PROTOCOL_PRESENCE_DATAHOST }; + + +protected: + + /** + * Protected destructor. MXIMPProtocolConnectionHost instancies + * can't be destroyed via this interface. + */ + virtual inline ~MProtocolPresenceDataHost() {}; + + + +public: // Access to sub-interfaces + + + /** + * Gets reference to object factory interface. + * + * Presence protocol connection implementation + * uses factory interface to instantiate presence + * objects. + * + * @return Object factory interface. + * No ownership is returned caller. + */ + virtual MPresenceObjectFactory& PresenceObjectFactory() = 0; + + + + /** + * Gets reference to + * MProtocolPresenceAuthorizationDataHost interface. + * + * Presence protocol connection implementation uses returned + * data host interface to manage the presence connections + * presence auhtorization data. + * + * @return MProtocolPresenceAuthorizationDataHost interface. + * Interface ownership is not returned caller. + * Returned interface is guaranteed to remain valid (usable) + * as long as this source interface. + */ + virtual MProtocolPresenceAuthorizationDataHost& AuthorizationDataHost() = 0; + + + + /** + * Gets reference to + * MProtocolPresencePublishingDataHost interface. + * + * Presence protocol connection implementation uses returned + * data host interface to manage the presence connections + * presence publication data. + * + * @return MProtocolPresencePublishingDataHost interface. + * Interface ownership is not returned caller. + * Returned interface is guaranteed to remain valid (usable) + * as long as this source interface. + */ + virtual MProtocolPresencePublishingDataHost& PublishingDataHost() = 0; + + + + /** + * Gets reference to + * MProtocolPresenceWatchingDataHost interface. + * + * Presence protocol connection implementation uses returned + * data host interface to manage the presence connections + * presentity presence data. + * + * @return MProtocolPresenceWatchingDataHost interface. + * Interface ownership is not returned caller. + * Returned interface is guaranteed to remain valid (usable) + * as long as this source interface. + */ + virtual MProtocolPresenceWatchingDataHost& WatchingDataHost() = 0; + + + + /** + * Gets reference to + * MProtocolPresentityGroupsDataHost interface. + * + * Presence protocol connection implementation uses returned + * data host interface to manage the presence connections + * presentity groups data. + * + * @return MProtocolPresentityGroupsDataHost interface. + * Interface ownership is not returned caller. + * Returned interface is guaranteed to remain valid (usable) + * as long as this source interface. + */ + virtual MProtocolPresentityGroupsDataHost& GroupsDataHost() = 0; + + + }; + + + +#endif // MPROTOCOLPRESENCEDATAHOST_H diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_presence_protocol_plugin_host_api/inc/protocolpresencepublishingdatahost.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_presence_protocol_plugin_host_api/inc/protocolpresencepublishingdatahost.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,261 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interface for managing cached presence publication information. +* +*/ + +#ifndef MXIMPFWPROTOCOLPRESENCEPUBLISHINGDATAHOST_H +#define MXIMPFWPROTOCOLPRESENCEPUBLISHINGDATAHOST_H + + +#include +#include +#include + + +class MXIMPIdentity; +class MPresenceInfo; +class MXIMPObjectCollection; +class MPresenceWatcherInfo; +class MXIMPDataSubscriptionState; +class MXIMPStatus; + + +/** + * Interface for managing cached presence publication information. + * + * Interface is used by protocol adaptations to manage + * presence publication related information in + * XIMP Framework internal data cache + * + * This interface is implemented by XIMP Framework. + * Protocol adaptation can obtain reference to this + * interface from MXIMPProtocolConnectionHost interface. + * + * For each separated protocol connection, protocol + * adaptation must use the specific + * MProtocolPresentityGroupsDataHost instance, + * what is received from the connection specific + * MXIMPProtocolConnectionHost instance. + * + * @ingroup ximppresprotocolpluginhostapi + * @since S60 v3.2 + */ +class MProtocolPresencePublishingDataHost : public MXIMPBase + { +public: + + /** Interface ID for the MProtocolPresencePublishingDataHost. */ + enum { KInterfaceId = PRES_IF_ID_PROTOCOL_PRESENCE_PUBLISHING_DATAHOST }; + + +protected: + + + /** + * Protected destructor. Object instancies + * can't be deleted via this interface. + */ + virtual ~MProtocolPresencePublishingDataHost() {} + + + +public: // Handling user own presence information + + + /** + * Notifies XIMP Framework from subscribed + * user own presence information. + * + * Protocol adaptation implementation can call this + * method to notify XIMP Framework from user own + * subscribed presence information. XIMP Framework + * updates its cached user own presence status, and + * notifies the subscribing clients from data changes. + * + * XIMP Framework takes ownership of the argument(s), + * if method succeeds without a leave. + * + * @param [in] aPresenceInfo + * MPresenceInfo object containing new + * subscribed own presence information . + * + * @return The request ID identifying the issued request. + * Data cache request is processed asynchronously and + * its completion is signalled to adaptation direction + * through MXIMPProtocolConnectionHostObserver interface, + * with MXIMPProtocolRequestCompleteEvent event. + * + * @leave KErrNoMemory if failed to allocate memory. + * @leave KErrArgument if NULL argument(s) were provided. + */ + virtual TXIMPRequestId HandleSubscribedOwnPresenceL( + MPresenceInfo* aPresenceInfo ) = 0; + + + + /** + * Gets data subscription state for own presence information. + * + * Protocol adaptation can call this method to retrieve + * own presence information current data subscription state. + * Protocol adaptation can use data subscription state + * information, to optimize its own processing and + * network trafic amount. + * + * @return Own presence information data subscription state. + * Interface ownership is not returned to caller. + * Caller shouldn't cache the returned reference + * for later use. + */ + virtual const MXIMPDataSubscriptionState& + OwnPresenceDataSubscriptionState() const = 0; + + + + /** + * Updates data subscription state for presence block list. + * + * Updates data subscription state for own presence information. + * XIMP Framework calculates the subscription state change, + * from previous own presence information content, and notifies the + * subscribing clients from data changes. + * + * XIMP Framework takes ownership of the argument(s), + * if method succeeds without a leave. + * + * @param [in] aSubscriptionState + * New data subscription state for own presence information. + * + * @param [in] aStatus + * Optional status object describing the + * the reason, why protocol adaptation updated + * data item subscription state. Given status object + * is passed to clients through data item specific + * data change event. NULL value is accepted. + * + * @return The request ID identifying the issued request. + * Data cache request is processed asynchronously and + * its completion is signalled to adaptation direction + * through MXIMPProtocolConnectionHostObserver interface, + * with MXIMPProtocolRequestCompleteEvent event. + * + * @leave KErrNoMemory if failed to allocate memory. + * @leave KErrArgument if NULL subscription state argument was provided. + */ + virtual TXIMPRequestId SetOwnPresenceDataSubscriptionStateL( + MXIMPDataSubscriptionState* aSubscriptionState, + MXIMPStatus* aStatus ) = 0; + + + +public: // Handling presence watcher list content + + + + /** + * Notifies XIMP Framework from + * presence watcher list contents. + * + * Protocol adaptation implementation can call this + * method to notify XIMP Framework from + * complete presence watcher list content. + * XIMP Framework calculates the changes + * (new and disappeared watcher entries) from previous + * presence block list content, and notifies + * the subscribing clients from data changes. + * + * XIMP Framework takes ownership of the object + * collection and all objects contained within, if + * the method succeeds without a leave. + * + * @param [in] aWatcherList + * MXIMPObjectCollection object containing zero or + * more MPresenceWatcherInfo objects. Each + * contained MPresenceWatcherInfo shall present + * single presence watcher entry in the list of + * presence watchers. + * + * @return The request ID identifying the issued request. + * Data cache request is processed asynchronously and + * its completion is signalled to adaptation direction + * through MXIMPProtocolConnectionHostObserver interface, + * with MXIMPProtocolRequestCompleteEvent event. + * + * @leave KErrNoMemory if failed to allocate memory. + * @leave KErrArgument if NULL argument(s) were provided. + */ + virtual TXIMPRequestId HandlePresenceWatcherListL( + MXIMPObjectCollection* aWatcherList ) = 0; + + + + /** + * Gets data subscription state for presence watcher list. + * + * Protocol adaptation can call this method to retrieve + * presence watcher list current data subscription state. + * Protocol adaptation can use data subscription state + * information, to optimize its own processing and + * network trafic amount. + * + * @return Presence watcher list data subscription state. + * Interface ownership is not returned to caller. + * Caller shouldn't cache the returned reference + * for later use. + */ + virtual const MXIMPDataSubscriptionState& + PresenceWatcherListDataSubscriptionState() const = 0; + + + + /** + * Updates data subscription state for presence watcher list. + * + * Updates data subscription state for presence watcher list. + * XIMP Framework calculates the subscription state change, + * from previous presence watcher list content, and notifies the + * subscribing clients from data changes. + * + * XIMP Framework takes ownership of the argument(s), + * if method succeeds without a leave. + * + * @param [in] aSubscriptionState + * New data subscription state for presence watcher list. + * + * @param [in] aStatus + * Optional status object describing the + * the reason, why protocol adaptation updated + * data item subscription state. Given status object + * is passed to clients through data item specific + * data change event. NULL value is accepted. + * + * @return The request ID identifying the issued request. + * Data cache request is processed asynchronously and + * its completion is signalled to adaptation direction + * through MXIMPProtocolConnectionHostObserver interface, + * with MXIMPProtocolRequestCompleteEvent event. + * + * @leave KErrNoMemory if failed to allocate memory. + * @leave KErrArgument if NULL subscription state argument was provided. + */ + virtual TXIMPRequestId SetPresenceWatcherListDataSubscriptionStateL( + MXIMPDataSubscriptionState* aSubscriptionState, + MXIMPStatus* aStatus ) = 0; + + + }; + + +#endif // MXIMPFWPROTOCOLPRESENCEPUBLISHINGDATAHOST_H diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_presence_protocol_plugin_host_api/inc/protocolpresencewatchingdatahost.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_presence_protocol_plugin_host_api/inc/protocolpresencewatchingdatahost.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,178 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interface for managing cached subscribed presence information. +* +*/ + +#ifndef MXIMPFWPROTOCOLPRESENCEWATCHINGDATAHOST_H +#define MXIMPFWPROTOCOLPRESENCEWATCHINGDATAHOST_H + +#include +#include +#include + +class MPresenceInfo; +class MXIMPIdentity; +class MXIMPDataSubscriptionState; +class MXIMPStatus; + + + +/** + * Interface for managing cached subscribed presence information. + * + * Interface is used by protocol adaptations to manage + * manage presentities presence information stored + * in XIMP Framework internal data cache. + * + * This interface is implemented by XIMP Framework. + * Protocol adaptation can obtain reference to this + * interface from MXIMPProtocolConnectionHost interface. + * + * For each separated protocol connection, protocol + * adaptation must use the specific + * MProtocolPresentityGroupsDataHost instance, + * what is received from the connection specific + * MXIMPProtocolConnectionHost instance. + * + * @ingroup ximppresprotocolpluginhostapi + * @since S60 v3.2 + */ +class MProtocolPresenceWatchingDataHost : public MXIMPBase + { +public: + + /** Interface ID for the MProtocolPresenceWatchingDataHost. */ + enum { KInterfaceId = PRES_IF_ID_PROTOCOL_PRESENCE_WATCHING_DATAHOST }; + +protected: + + /** + * Protected destructor. Object instancies + * can't be deleted via this interface. + */ + virtual ~MProtocolPresenceWatchingDataHost() {} + + + + +public: // Handling subscribed presence information + + + /** + * Notifies XIMP Framework from subscribed + * presentitys presence information. + * + * Protocol adaptation implementation can call this + * method to notify XIMP Framework from subscribed + * presentitys presence information. XIMP Framework + * updates its cached presentitys presence status, and + * notifies the subscribing clients from data changes. + * + * XIMP Framework takes ownership of the argument(s), + * if method succeeds without a leave. + * + * @param [in] aPresentityId + * MXIMPIdentity object identifying the presentity + * of which subscribed presence information + * is delivered here. + * + * @param [in] aPresenceInfo + * MPresenceInfo object containing new presence + * information for the identified presentity. + * + * @return The request ID identifying the issued request. + * Data cache request is processed asynchronously and + * its completion is signalled to adaptation direction + * through MXIMPProtocolConnectionHostObserver interface, + * with MXIMPProtocolRequestCompleteEvent event. + * + * @leave KErrNoMemory if failed to allocate memory. + * @leave KErrArgument if NULL argument(s) were provided. + */ + virtual TXIMPRequestId HandleSubscribedPresentityPresenceL( + MXIMPIdentity* aPresentityId, + MPresenceInfo* aPresenceInfo ) = 0; + + + + /** + * Gets data subscription state for presentitys presence + * information. + * + * Protocol adaptation can call this method to retrieve + * presentitys presence information data subscription state. + * Protocol adaptation can use data subscription state + * information, to optimize its own processing and + * network trafic amount. + * + * @return Presentitys presence information data subscription state. + * Interface ownership is not returned to caller. + * Caller shouldn't cache the returned reference + * for later use. + */ + virtual const MXIMPDataSubscriptionState& + PresentityPresenceDataSubscriptionState( + const MXIMPIdentity& aPresentityId ) const = 0; + + + + /** + * Updates data subscription state for + * presentitys presence information. + * + * Updates data subscription state for presentitys presence + * subscription. XIMP Framework calculates the subscription + * state change, from previous presentitys presence information + * content, and notifies the subscribing clients from data + * changes. + * + * XIMP Framework takes ownership of the argument(s), + * if method succeeds without a leave. + * + * @param [in] aPresentityId + * MXIMPIdentity object identifying the presentity + * of which presence data subscription state is + * updated here. + * + * @param [in] aSubscriptionState + * New data subscription state for presentitys + * presence information. + * + * @param [in] aStatus + * Optional status object describing the + * the reason, why protocol adaptation updated + * data item subscription state. Given status object + * is passed to clients through data item specific + * data change event. NULL value is accepted. + * + * @return The request ID identifying the issued request. + * Data cache request is processed asynchronously and + * its completion is signalled to adaptation direction + * through MXIMPProtocolConnectionHostObserver interface, + * with MXIMPProtocolRequestCompleteEvent event. + * + * @leave KErrNoMemory if failed to allocate memory. + * @leave KErrArgument if NULL subscription state argument was provided. + */ + virtual TXIMPRequestId SetPresentityPresenceDataSubscriptionStateL( + MXIMPIdentity* aPresentityId, + MXIMPDataSubscriptionState* aSubscriptionState, + MXIMPStatus* aStatus ) = 0; + + + }; + + +#endif // MXIMPFWPROTOCOLPRESENCEWATCHINGDATAHOST_H diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_presence_protocol_plugin_host_api/inc/protocolpresentitygroupsdatahost.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_presence_protocol_plugin_host_api/inc/protocolpresentitygroupsdatahost.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,492 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interface for managing cached presentity group information. +* +*/ + +#ifndef MPROTOCOLPRESENTITYGROUPSDATAHOST_H +#define MPROTOCOLPRESENTITYGROUPSDATAHOST_H + + +#include +#include +#include + + +class MXIMPIdentity; +class MXIMPObjectCollection; +class MPresentityGroupInfo; +class MPresentityGroupMemberInfo; +class MXIMPDataSubscriptionState; +class MXIMPStatus; + + + +/** + * Interface for managing cached presentity group information. + * + * Interface used by protocol adaptations to manage + * manage presentity group information and presentity + * group member information in XIMP Framework + * internal data cache. + * + * This interface is implemented by XIMP Framework. + * Protocol adaptation can obtain reference to this + * interface from MXIMPProtocolConnectionHost interface. + * + * For each separated protocol connection, protocol + * adaptation must use the specific + * MProtocolPresentityGroupsDataHost instance, + * what is received from the connection specific + * MXIMPProtocolConnectionHost instance. + * + * @ingroup ximppresprotocolpluginhostapi + * @since S60 v3.2 + */ +class MProtocolPresentityGroupsDataHost : public MXIMPBase + { +public: + + /** Interface ID for the MProtocolPresentityGroupsDataHost. */ + enum { KInterfaceId = PRES_IF_ID_PROTOCOL_PRESENTITY_GROUPS_DATAHOST }; + +protected: + + /** + * Protected destructor. Object instancies + * can't be deleted via this interface. + */ + virtual ~MProtocolPresentityGroupsDataHost() {} + + + +public: // Handling presentity group information + + + /** + * Notifies XIMP Framework from + * presentity group list contents. + * + * Protocol adaptation implementation can call this + * method to notify XIMP Framework from + * complete presentity group list content. + * XIMP Framework calculates the changes + * (new and removed presentity groups) compared to previous + * presence presentity group list content, and notifies + * the subscribing clients from data changes. + * + * XIMP Framework takes ownership of the object + * collection and all objects contained within, if + * the method succeeds without a leave. + * + * + * @param [in] aGroupList + * MXIMPObjectCollection object containing zero or + * more MPresentityGroupInfo objects. Each + * contained MPresentityGroupInfo shall present + * single presentity group within the presentity + * group list. + * + * @return The request ID identifying the issued request. + * Data cache request is processed asynchronously and + * its completion is signalled to adaptation direction + * through MXIMPProtocolConnectionHostObserver interface, + * with MXIMPProtocolRequestCompleteEvent event. + * + * @leave KErrNoMemory if failed to allocate memory. + * @leave KErrArgument if NULL argument(s) were provided. + */ + virtual TXIMPRequestId HandlePresentityGroupListL( + MXIMPObjectCollection* aGroupList ) = 0; + + + + /** + * Notifies XIMP Framework from new + * presentity group list entry. + * + * Protocol adaptation implementation can call this + * method to notify XIMP Framework from + * new presentity group list entry. XIMP Framework + * calculates the change, from previous presentity + * group list content, and notifies the subscribing + * clients from data changes. + * + * XIMP Framework takes ownership of the argument(s), + * if method succeeds without a leave. + * + * @param [in] aGroupInfo + * MPresentityGroupInfo object holding + * information about new presentity group entry. + * New presentity group is added to the presentity + * group list. + * + * @return The request ID identifying the issued request. + * Data cache request is processed asynchronously and + * its completion is signalled to adaptation direction + * through MXIMPProtocolConnectionHostObserver interface, + * with MXIMPProtocolRequestCompleteEvent event. + * + * @leave KErrNoMemory if failed to allocate memory. + * @leave KErrArgument if NULL argument(s) were provided. + */ + virtual TXIMPRequestId HandlePresentityGroupCreatedL( + MPresentityGroupInfo* aGroupInfo ) = 0; + + + + /** + * Notifies XIMP Framework from deletion of + * existing presentity group. + * + * Protocol adaptation implementation can call this + * method to notify XIMP Framework from deletion + * of existing presentity group. XIMP Framework + * calculates the change, from previous presentity group + * list content, and notifies the subscribing clients + * from data changes. + * + * XIMP Framework takes ownership of the argument(s), + * if method succeeds without a leave. + * + * @param [in] aGroupId + * MXIMPIdentity object identifying the + * presentity group which were deleted and thus + * needs to be removed from presentity group list. + * + * @return The request ID identifying the issued request. + * Data cache request is processed asynchronously and + * its completion is signalled to adaptation direction + * through MXIMPProtocolConnectionHostObserver interface, + * with MXIMPProtocolRequestCompleteEvent event. + * + * @leave KErrNoMemory if failed to allocate memory. + * @leave KErrArgument if NULL argument(s) were provided. + */ + virtual TXIMPRequestId HandlePresentityGroupDeletedL( + MXIMPIdentity* aGroupId ) = 0; + + + + /** + * Notifies XIMP Framework from update of + * existing presentity group displayname. + * + * Protocol adaptation implementation can call this + * method to notify XIMP Framework from update + * of existing presentity group displayname. XIMP Framework + * calculates the change, from previous presentity group + * list content, and notifies the subscribing clients + * from data changes. + * + * XIMP Framework takes ownership of the argument(s), + * if method succeeds without a leave. + * + * @param [in] aGroupInfo + * MPresentityGroupInfo object identifying the + * presentity group and new displayname for the group. + * + * @return The request ID identifying the issued request. + * Data cache request is processed asynchronously and + * its completion is signalled to adaptation direction + * through MXIMPProtocolConnectionHostObserver interface, + * with MXIMPProtocolRequestCompleteEvent event. + * + * @leave KErrNoMemory if failed to allocate memory. + * @leave KErrArgument if NULL argument(s) were provided. + */ + virtual TXIMPRequestId HandlePresentityGroupDisplayNameUpdatedL( + MPresentityGroupInfo* aGroupInfo ) = 0; + + + + /** + * Gets data subscription state for presentity group list. + * + * Protocol adaptation can call this method to retrieve + * presentity group lists data subscription state. + * Protocol adaptation can use data subscription state + * information, to optimize its own processing and + * network trafic amount. + * + * @return Presentity group list data subscription state. + * Interface ownership is not returned to caller. + * Caller shouldn't cache the returned reference + * for later use. + */ + virtual const MXIMPDataSubscriptionState& + PresentityGroupListDataSubscriptionState() const = 0; + + + + /** + * Updates data subscription state for presentity group list. + * + * Updates data subscription state for presentity group list. + * XIMP Framework calculates the subscription state change, + * from previous presentity group list, and + * notifies the subscribing clients from data changes. + * + * XIMP Framework takes ownership of the argument(s), + * if method succeeds without a leave. + * + * @param [in] aSubscriptionState + * New data subscription state for presentity group list. + * + * @param [in] aStatus + * Optional status object describing the + * the reason, why protocol adaptation updated + * data item subscription state. Given status object + * is passed to clients through data item specific + * data change event. NULL value is accepted. + * + * @return The request ID identifying the issued request. + * Data cache request is processed asynchronously and + * its completion is signalled to adaptation direction + * through MXIMPProtocolConnectionHostObserver interface, + * with MXIMPProtocolRequestCompleteEvent event. + * + * @leave KErrNoMemory if failed to allocate memory. + * @leave KErrArgument if NULL subscription state argument was provided. + */ + virtual TXIMPRequestId SetPresentityGroupListDataSubscriptionStateL( + MXIMPDataSubscriptionState* aSubscriptionState, + MXIMPStatus* aStatus ) = 0; + + + +public: // Handling presentity group content + + + /** + * Notifies XIMP Framework from + * presentity group contents. + * + * Protocol adaptation implementation can call this + * method to notify XIMP Framework from presentity group + * content. XIMP Framework calculates the changes + * (added and removed group members) compared to previous + * presentity group content, and notifies the subscribing + * clients from data changes. + * + * XIMP Framework takes ownership of the object + * collection and all objects contained within, if + * the method succeeds without a leave. + * + * @param [in] aGroupId + * MXIMPIdentity object identifying the presentity group + * of which content is notified here. + * + * @param [in] aGroupMembers + * MXIMPObjectCollection object containing zero or + * more MPresentityGroupMemberInfo objects. Each + * contained MPresentityGroupMemberInfo shall + * present single presentity group member, within + * the presentity group. + * + * @return The request ID identifying the issued request. + * Data cache request is processed asynchronously and + * its completion is signalled to adaptation direction + * through MXIMPProtocolConnectionHostObserver interface, + * with MXIMPProtocolRequestCompleteEvent event. + * + * @leave KErrNoMemory if failed to allocate memory. + * @leave KErrArgument if NULL argument(s) were provided. + */ + virtual TXIMPRequestId HandlePresentityGroupContentL( + MXIMPIdentity* aGroupId, + MXIMPObjectCollection* aGroupMembers ) = 0; + + + + /** + * Notifies XIMP Framework from new + * presentity group member entry. + * + * Protocol adaptation implementation can call this + * method to notify XIMP Framework from + * new presentity group member entry. XIMP Framework + * calculates the change, from previous presentity + * group content, and notifies the subscribing + * clients from data changes. + * + * XIMP Framework takes ownership of the argument(s), + * if method succeeds without a leave. + * + * @param [in] aGroupId + * MXIMPIdentity object identifying the presentity + * group to where the group member is added. + * + * @param [in] aGroupMember + * MPresentityGroupMemberInfo object holding + * information about new presentity group member + * entry. New presentity group member is added + * to the presentity group content. + * + * @return The request ID identifying the issued request. + * Data cache request is processed asynchronously and + * its completion is signalled to adaptation direction + * through MXIMPProtocolConnectionHostObserver interface, + * with MXIMPProtocolRequestCompleteEvent event. + * + * @leave KErrNoMemory if failed to allocate memory. + * @leave KErrArgument if NULL argument(s) were provided. + */ + virtual TXIMPRequestId HandlePresentityGroupMemberAddedL( + MXIMPIdentity* aGroupId, + MPresentityGroupMemberInfo* aGroupMember ) = 0; + + + + /** + * Notifies XIMP Framework from remove of + * existing presentity group member. + * + * Protocol adaptation implementation can call this + * method to notify XIMP Framework from remove + * of existing presentity group member. XIMP Framework + * calculates the change, from previous presentity group + * content, and notifies the subscribing clients + * from data changes. + * + * XIMP Framework takes ownership of the argument(s), + * if method succeeds without a leave. + * + * @param [in] aGroupId + * MXIMPIdentity object identifying the presentity + * group from where to remove the group member. + * + * @param [in] aGroupMemberId + * MXIMPIdentity object identifying the presentity + * group member which to remove from the presentity + * group. + * + * @return The request ID identifying the issued request. + * Data cache request is processed asynchronously and + * its completion is signalled to adaptation direction + * through MXIMPProtocolConnectionHostObserver interface, + * with MXIMPProtocolRequestCompleteEvent event. + * + * @leave KErrNoMemory if failed to allocate memory. + * @leave KErrArgument if NULL argument(s) were provided. + */ + virtual TXIMPRequestId HandlePresentityGroupMemberRemovedL( + MXIMPIdentity* aGroupId, + MXIMPIdentity* aGroupMemberId ) = 0; + + + + /** + * Notifies XIMP Framework from displayname update of + * existing presentity group member. + * + * Protocol adaptation implementation can call this + * method to notify XIMP Framework from displayname + * update of existing presentity group member. + * XIMP Framework calculates the change, from previous + * presentity group content, and notifies the subscribing + * clients from data changes. + * + * XIMP Framework takes ownership of the argument(s), + * if method succeeds without a leave. + * + * @param [in] aGroupId + * MXIMPIdentity object identifying the presentity + * group which member displayname to update. + * + * @param [in] aGroupMember + * MPresentityGroupMemberInfo object identifying + * the presentity group member and its new displayname. + * + * @return The request ID identifying the issued request. + * Data cache request is processed asynchronously and + * its completion is signalled to adaptation direction + * through MXIMPProtocolConnectionHostObserver interface, + * with MXIMPProtocolRequestCompleteEvent event. + * + * @leave KErrNoMemory if failed to allocate memory. + * @leave KErrArgument if NULL argument(s) were provided. + */ + virtual TXIMPRequestId HandlePresentityGroupMemberDisplayNameUpdatedL( + MXIMPIdentity* aGroupId, + MPresentityGroupMemberInfo* aGroupMember ) = 0; + + + + /** + * Gets data subscription state for presentity group. + * + * Protocol adaptation can call this method to retrieve + * given presentity groups content subscription state. + * Protocol adaptation can use data subscription state + * information, to optimize its own processing and + * network trafic amount. + * + * @return Presentity groups content subscription state. + * Interface ownership is not returned to caller. + * Caller shouldn't cache the returned reference + * for later use. + */ + virtual const MXIMPDataSubscriptionState& + PresentityGroupContentDataSubscriptionState( + const MXIMPIdentity& aGroupId ) const = 0; + + + + /** + * Updates data subscription state for + * presentity group content. + * + * Updates data subscription state for presentity group content. + * XIMP Framework calculates the subscription state change, + * from previous presentity group content, and + * notifies the subscribing clients from data changes. + * + * XIMP Framework takes ownership of the argument(s), + * if method succeeds without a leave. + * + * @param [in] aGroupId + * MXIMPIdentity object identifying the presentity + * group of which data subscription state is + * updated here. + * + * @param [in] aSubscriptionState + * New data subscription state for presentity group . + * + * @param [in] aStatus + * Optional status object describing the + * the reason, why protocol adaptation updated + * data item subscription state. Given status object + * is passed to clients through data item specific + * data change event. NULL value is accepted. + * + * @return The request ID identifying the issued request. + * Data cache request is processed asynchronously and + * its completion is signalled to adaptation direction + * through MXIMPProtocolConnectionHostObserver interface, + * with MXIMPProtocolRequestCompleteEvent event. + * + * @leave KErrNoMemory if failed to allocate memory. + * @leave KErrArgument if NULL subscription state argument was provided. + */ + virtual TXIMPRequestId SetPresentityGroupContentDataSubscriptionStateL( + MXIMPIdentity* aGroupId, + MXIMPDataSubscriptionState* aSubscriptionState, + MXIMPStatus* aStatus ) = 0; + + + }; + + +#endif // MPROTOCOLPRESENTITYGROUPSDATAHOST_H diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_presence_protocol_plugin_host_api/ximp_presence_protocol_plugin_host_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_presence_protocol_plugin_host_api/ximp_presence_protocol_plugin_host_api.metaxml Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,23 @@ + + + XIMP Presence Protocol Plug-in Host API + API contains interfaces which presence protocol plug-ins use for communicating back to XIMP Framework direction. + c++ + ximpfw + + + + + + + + + + + + + + yes + no + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_search_base_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_search_base_api/group/bld.inf Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,29 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: File that exports the files belonging to +* Search Feature Plugin Base API +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +../inc/searcherrors.hrh MW_LAYER_PLATFORM_EXPORT_PATH(searcherrors.hrh) +../inc/searchdlluids.hrh MW_LAYER_PLATFORM_EXPORT_PATH(searchdlluids.hrh) +../inc/searchoperationdefs.h MW_LAYER_PLATFORM_EXPORT_PATH(searchoperationdefs.h) diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_search_base_api/inc/searchdlluids.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_search_base_api/inc/searchdlluids.hrh Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,62 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework SEARCH Feature plugin DLL uids +* +*/ + + +#ifndef SEARCHDLLUIDS_HRH +#define SEARCHDLLUIDS_HRH + + +// ----------------------------------------------------------------------------- +// Common dll uids +// ----------------------------------------------------------------------------- +// +#define XIMP_SEARCH_DLL_UID_STATIC_INTERFACE 0x1000008d +#define XIMP_SEARCH_DLL_UID_ECOM_PLUGIN 0x10009D8D + + +// ----------------------------------------------------------------------------- +// ECOM implementation UID +// ----------------------------------------------------------------------------- +// +#define XIMP_ECOM_IMPLEMENTATION_UID_SEARCH_INTERFACE 0x2001846F +#define XIMP_ECOM_IMPL_UID_SEARCH_DATAMODEL_INTERFACE 0x20018470 +#define XIMP_ECOM_IMPL_UID_SEARCH_PROCESSOR_INTERFACE 0x20018471 +#define XIMP_ECOM_IMPL_UID_SEARCH_OPERATION_INTERFACE 0x20018472 + +//------------------------------------------------------------------------------------- +// HOOK uids +//------------------------------------------------------------------------------------ + +#define XIMP_DLL_UID_SEARCH_HOOK 0x20018473 +#define XIMP_DLL_UID_SEARCH_DATAMODEL_HOOK 0x20018474 +#define XIMP_DLL_UID_SEARCH_PROCESSOR_HOOK 0x20018475 +#define XIMP_DLL_UID_SEARCH_OPERATIONS_HOOK 0x20018476 + +//------------------------------------------------------------------------------------- +// Dll uids +//------------------------------------------------------------------------------------ + +#define XIMP_DLL_UID_SEARCH_MANAGER 0x20018477 +#define XIMP_DLL_UID_SEARCH_PROCESSOR 0x20018478 +#define XIMP_DLL_UID_SEARCH_OPERATION 0x20018479 +#define XIMP_DLL_UID_SEARCH_DATAMODEL 0x2001847A + + + +#endif // SEARCHDLLUIDS_HRH + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_search_base_api/inc/searcherrors.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_search_base_api/inc/searcherrors.hrh Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,54 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Protocol agnostic error codes for Search Feature Plugin. +* +*/ + +#ifndef SEARCHERRORS_H +#define SEARCHERRORS_H + + + +/** + * Search Feature Plugin error codes. + * + * Error codes returned from Search are either: + * -# System wide Symbian OS error codes (KErrNone, KErrNoMemory, etc.) + * -# Protocol agnostic Search Feature related error codes defined here. + * These error codes have range: KSearchErrBase ... + * + * @ingroup searchbaseapi + * + */ +enum + { + KSearchErrBase = -40131, + + /** + * Generic error code to indicate that request processing + * has failed on Search protocol level to some error, + * which isn't mapped to any other more detailed + * error code. + */ + KErrServiceGeneralError = KSearchErrBase , + + + + + }; + + +#endif // SEARCHERRORS_H + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_search_base_api/inc/searchoperationdefs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_search_base_api/inc/searchoperationdefs.h Thu Dec 17 08:54:49 2009 +0200 @@ -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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Search Feature Plugin operation definitions. + * +*/ + +#ifndef SEARCHOPERATIONDEFS_H +#define SEARCHOPERATIONDEFS_H + +#include + + + +namespace NSearchOps + { + enum TSearchOpTypes + { + + ESearch = 300, + EHandleSearchResults, + ESearchCleaner, + EGetSearchKeys, + EHandleSearchKeys + }; + } + +#endif //SEARCHOPERATIONDEFS_H + + + + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_search_base_api/ximp_search_base_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_search_base_api/ximp_search_base_api.metaxml Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,13 @@ + + +ximp_search_base_api +This is a API that provides the common error codes, plugin UIDs and operation types of search base. +c++ +ximp_search_base_api + + + +yes +no + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_search_data_model_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_search_data_model_api/group/bld.inf Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,30 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: File that exports the files belonging to +: Search Feature Plugin Data Model API +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +../inc/searchdatamodelifids.hrh MW_LAYER_PLATFORM_EXPORT_PATH(searchdatamodelifids.hrh) +../inc/searchobjectfactory.h MW_LAYER_PLATFORM_EXPORT_PATH(searchobjectfactory.h) +../inc/searchinfo.h MW_LAYER_PLATFORM_EXPORT_PATH(searchinfo.h) +../inc/searchkeyinfo.h MW_LAYER_PLATFORM_EXPORT_PATH(searchkeyinfo.h) diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_search_data_model_api/inc/searchdatamodelifids.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_search_data_model_api/inc/searchdatamodelifids.hrh Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,36 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Search Feature Plugin Data Model API interface IDs. +* +*/ + +#ifndef SEARCHDATAMODELIFIDS_HRH +#define SEARCHDATAMODELIFIDS_HRH + +// Data model IF id's +// 20xx - ximp related +// 21xx - presence related +// 22xx - instant messaging related +// 24xx - Search related + + +#define SEARCH_IF_ID_SEARCH_OBJECT_FACTORY 2404 +#define SEARCH_IF_ID_SEARCH_INFO 2402 +#define SEARCH_IF_ID_SEARCH_KEY_INFO 2403 + + +#endif // SEARCHDATAMODELIFIDS_HRH + + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_search_data_model_api/inc/searchinfo.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_search_data_model_api/inc/searchinfo.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,104 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interface for Search info object. +* +*/ + +#ifndef MSEARCHINFO_H +#define MSEARCHINFO_H + +#include +#include +#include +#include + +class MXIMPIdentity; + +/** + * Defines Enums for information type. + * + * Information of following type can be + * stored and retrieve. + * + * + */ + +enum TInfoType + { + + EEmailAddress, + EFirstName, + ELastName + + }; + + +/** + * Interface for Search info object. + * + * Search info holds details of a single search result. + * Search results contains collection of searchinfo. + * + * @ingroup Searchdatamodelapi + * + */ +class MSearchInfo : public MXIMPBase + { + + + public: + + /** Interface ID for the MImSearchInfo. */ + enum { KInterfaceId = SEARCH_IF_ID_SEARCH_INFO }; + + + public: + + /** + * Public destructor. + * Objects can be deleted through this interface. + */ + virtual ~MSearchInfo() {} + + + public: + /** + * Returns the information of particular information type. + * + * @param aType + * TInfoType which information type (e.g. EFirstname, Elastname etc) + * + * @return TDesc16& information of the type passed. + */ + virtual const TDesC16& GetFieldInfo(TInfoType aType ) const =0 ; + + + /** + * Sets the information of a particular type. + * + * @param aFieldInfo + * information to be set. + * + * @param aType + * type of the information.(e.g. EFirstname, Elastname etc) + * + */ + virtual void SetFieldInfoL(const TDesC16& aFieldInfo, TInfoType aType) = 0 ; + }; + + +#endif // MSEARCHINFO_H + + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_search_data_model_api/inc/searchkeyinfo.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_search_data_model_api/inc/searchkeyinfo.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,118 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interface for Search key info object. +* +*/ + +#ifndef MSEARCHKEYINFO_H +#define MSEARCHKEYINFO_H + +#include +#include +#include +#include +#include + + enum TKeyType + { + EKey, + ELabel + }; + +/** file supportedsearchkey.h + * Interface class for seach key info + * + */ +class MSearchKeyInfo : public MXIMPBase + { + + + public: + + /** Interface ID for the MSearchKeyInfo. */ + enum { KInterfaceId = SEARCH_IF_ID_SEARCH_KEY_INFO }; + + + public: + + /** + * Public destructor. + * Objects can be deleted through this interface. + */ + virtual ~MSearchKeyInfo() {} + + + public: + /** + * returns key type + * cleint has to access Key() and Label() methods based on this return value. + * if return value if Ekey , then Key() + * else f return value if ELabel ,then Label() + * + * @return the TKeyType , which is the key type. + * any one value in the range of TKeyType enums + * + */ + virtual TKeyType Type()const =0 ; + + /** + * Sets the key type, whether label or key + * + * @param aType : + * aType to be set any value from the set of TKeyType enums + * + */ + virtual void SetType( TKeyType aType) = 0 ; + + /** + * returns key value + * + * @return the TSearchKey value , which is the key. + * this value is '0' if not set properly. ( If label + * else any one value in the range of TSearchKey enums + * also see searchelement.h for TSearchKey enums value. + */ + virtual TSearchKey Key()const =0 ; + + + /** + * Sets the key value + * + * @param aKey : + * akey to be set any value from the set of TSearchKey enums + * + */ + virtual void SetKey( TSearchKey aKey) = 0 ; + + /** + * returns the search label. + * + * @return TDesc16& value of the label. + */ + virtual const TDesC16& Label() const =0 ; + + + /** + * Sets the label + * + * @param aLabel label to be set + */ + virtual void SetLabelL(const TDesC16& aLabel) = 0 ; + }; + + +#endif // MSEARCHKEYINFO_H + + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_search_data_model_api/inc/searchobjectfactory.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_search_data_model_api/inc/searchobjectfactory.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,99 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interface for Search Feature Plugin object factory. +* +*/ + +#ifndef MSEARCHOBJECTFACTORY_H +#define MSEARCHOBJECTFACTORY_H + +#include +#include +#include +#include + + +class MSearchElement; +class MSearchInfo; +class MSearchKeyInfo; +/** + * Interface for Search Feature Plugin search object factory. + * + * Search object factory is used to instantiate + * data objects declared in data model API. + * + * @ingroup Searchdatamodelapi + * + */ +class MSearchObjectFactory : public MXIMPBase + { + public: + + /** Interface ID for the MSearchObjectFactory. */ + enum { KInterfaceId = SEARCH_IF_ID_SEARCH_OBJECT_FACTORY }; + + + protected: + + /** + * Protected destructor. + * Object instancies can't be deleted via this interface. + */ + virtual ~MSearchObjectFactory() {} + + + + + public: + + /** + * Instantiates new search element object. + * + * @return Newsearch element object instance. + * Object ownership is returned to caller. + * + * @leave KErrNoMemory if failed to allocate memory. + */ + + virtual MSearchElement* NewSearchElementLC() = 0; + + + /** + * Instantiates new search info object. + * + * @return New search info object instance. + * Object ownership is returned to caller. + * + * @leave KErrNoMemory if failed to allocate memory. + */ + virtual MSearchInfo* NewSearchInfoLC() = 0; + + /** + * Instantiates new SearchKey info object. + * + * @return new SearchKey object instance. + * Object ownership is returned to caller. + * + * @leave KErrNoMemory if failed to allocate memory. + */ + virtual MSearchKeyInfo* NewSearchKeyInfoLC() = 0; + + }; + + + +#endif // MSEARCHOBJECTFACTORY_H + + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_search_data_model_api/ximp_search_data_model_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_search_data_model_api/ximp_search_data_model_api.metaxml Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,14 @@ + + +ximp_search_data_model_api +This is a API that provides data model for search related operations. +c++ +searchdatamodel + + + + +yes +no + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_search_management_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_search_management_api/group/bld.inf Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,33 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: File that exports the files belonging to +: Search Feature Plugin Management API +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +../inc/searchmanagementifids.hrh MW_LAYER_PLATFORM_EXPORT_PATH(searchmanagementifids.hrh) +../inc/searchfeature.inl MW_LAYER_PLATFORM_EXPORT_PATH(searchfeature.inl) +../inc/searchfeature.h MW_LAYER_PLATFORM_EXPORT_PATH(searchfeature.h) +../inc/search.h MW_LAYER_PLATFORM_EXPORT_PATH(search.h) +../inc/searchevent.h MW_LAYER_PLATFORM_EXPORT_PATH(searchevent.h ) +../inc/searchelement.h MW_LAYER_PLATFORM_EXPORT_PATH(searchelement.h) +../inc/searchkeysevent.h MW_LAYER_PLATFORM_EXPORT_PATH(searchkeysevent.h) diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_search_management_api/inc/search.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_search_management_api/inc/search.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,101 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Search interface for clients use. +* +*/ + +#ifndef MSEARCH_H +#define MSEARCH_H + +#include +#include + +class MXIMPIdentity; +class MSearchElement ; +class MXIMPObjectCollection; +/** + * Search interface for clients use. + * Interface is implemented by the IM. + * + * @ingroup Searchmanagementapi + * + */ +class MSearch : public MXIMPBase + { +public: + + /** Interface ID for the MSearch. */ + enum { KInterfaceId = SEARCH_IF_ID_SEARCH }; + + +protected: + + /** + * Protected destructor. + * Object instancies can't be deleted via this interface. + */ + virtual ~MSearch() {} + + + +public: + + /** + * start the search, issues the serach request to server + * + * @param [in] aSearchId + * Identification for a search. + * + * @param [in] aObjs + * Its array of search elements.Elements contain what is to be serached. + * + * @param [in] aSearchLimit + * How many results client wants at a time. + * + * @return The request ID identifying the issued request. + * + * + */ + virtual TXIMPRequestId SearchL( const MXIMPIdentity& aSearchId, + const RPointerArray< MSearchElement >& aObjs, + TInt aSearchLimit ) = 0; + + + + /** + * Cancels the search request which was issued. + * + * @param [in] aImSearchId + * Identification for the search to be stopped. + * + * + * @return The request ID identifying the issued request. + * + * + */ + //virtual TXIMPRequestId CancelSearchL( const MXIMPIdentity& aSearchId ) = 0; + + /** + * Requests the protocol plugin for search keys supported. + * Search key basically says client that server supports serach on this + * particular key. Key may be e.g. EUserFirstname + * + */ + virtual TXIMPRequestId GetSearchKeysL() = 0; + }; + + +#endif // MSEARCH_H + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_search_management_api/inc/searchelement.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_search_management_api/inc/searchelement.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,140 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interface for search element +* +*/ + + +#ifndef MSEARCHELEMENT_H +#define MSEARCHELEMENT_H + +#include +#include + +class MXIMPIdentity; +/** + * Enums + * Supported search keys + * Searver may not support all of these : + * Client can query server which are all supported + */ +enum TSearchKey + { + EUserFirstName = 600, + EUserMiddleName, + EUserLastName, + EUserFullName, + EUserCountry, + EUserCity, + EBirthday, + EState, + EUserEmailAddress, + EUser, + EUserNickName, + EOrganisation, + EOrganisationUnit, + EReadLabel // Not for client to set/use + // if client trys to set this , SetrequestL leaves with KErrArgument + // In this case protocol plugin has to read the LABEL + }; + +/** + * Interface for search element object. + * + * + * + * @ingroup searchmanagementapi + * + */ +class MSearchElement: public MXIMPBase + { + public: + + /** Interface ID for the MImSearchRequest. */ + enum { KInterfaceId = SEARCH_IF_ID_SEARCHELEMENT }; + + public: + + /** + * Public destructor. + * Objects instancies can be deleted through this interface. + */ + virtual ~MSearchElement() {} + + public: + /** + * Set search values. + * @param [in] aSearchStringId + * Identification for search word. + * + * + * @param [in] aKey + * search key value. + * + * e.g. to serach for "james" as a first name + * aSearchStringId has to be set with "james" + * aKey is EUserFirstName + * + * @leave KErrArgument if client trys to set 'EReadLabel' as key. + * if aKey = EReadLabel then leaves with KErrArgument + */ + virtual void SetRequestL( MXIMPIdentity& aSearchStringId, TSearchKey aKey ) = 0; + + /** + * Set search values. + * @param [in] aSearchStringId + * Identification for search word. + * + * + * @param [in] aLabelId + * Identification for label. + * + * e.g. to serach for "james" as a first name + * aSearchStringId has to be set with "james" + * aLabelId is "firstname" : this changes from server to server + * client has to query these labels from server and use + */ + virtual void SetRequestL( MXIMPIdentity& aSearchStringId, MXIMPIdentity& aLabelId ) = 0; + + + /** + * returns search identity + * + * + * @return identity of the search : adaptation has to get the text from the Id + */ + virtual MXIMPIdentity& GetSearchId() const =0 ; + + /** + * returns key value of the search + * + * + * @return any enum value of TSearchKey + */ + virtual TSearchKey GetSearchKey()const =0 ; + + /** + * returns label identity + * + * + * @return identity of the label : adaptation has to get the text from the Id + */ + virtual MXIMPIdentity& GetSearchLabel() const =0 ; + + }; + + +#endif //MSEARCHELEMENT_H + +// End of File diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_search_management_api/inc/searchevent.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_search_management_api/inc/searchevent.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,87 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Event interface for Search results. +* +*/ + +#ifndef MSEARCHEVENT_H +#define MSEARCHEVENT_H + +#include +#include + +class MSearchInfo; +class MXIMPIdentity; + +/** + * Event interface for search content. + * + * This interface is implemented by the Search Feature Plugin + * This event notifies clients + * when Search result is received from protocol. + * + * @ingroup searchmanagementapi + */ +class MSearchEvent : public MXIMPBase + { +public: + /** Interface ID for the MSearchEvent. */ + enum { KInterfaceId = SEARCH_IF_ID_SEARCH_EVENT }; + + +protected: + + /** + * Protected destructor. + * Object instancies can't be deleted via this interface. + */ + virtual inline ~MSearchEvent() {}; + + +public: + + + /** + * returns the count of the searched results. + * + * @return The count of count of the searched results. + */ + virtual TInt SearchResultCount() const = 0; + + + /** + * Gets the searched result by index. + * + * @param [in] aIndex + * The index of the search. + * + * @return The searched result from given index. + */ + virtual const MSearchInfo& SearchResult( TInt aIndex ) const = 0; + + + /** + * returns the serachid + * + * @return The serach id fro which result has come. + */ + virtual const MXIMPIdentity& SearchId() const = 0; + + + }; + + +#endif // MSEARCHEVENT_H + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_search_management_api/inc/searchfeature.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_search_management_api/inc/searchfeature.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,111 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interface for XIMP Framework /Search Feature +* +*/ + +#ifndef MSEARCHFEATURE_H +#define MSEARCHFEATURE_H + +#include +#include +#include + + +class MSearch; +class MSearchObjectFactory; + + +/** + * Interface for Search Feature + * + * @ingroup searchmanagementapi + * + */ +class MSearchFeature : public MXIMPBase +{ + + +public: + + /** Interface ID for the MSearchFeature. */ + enum { KInterfaceId = XIMP_ECOM_IF_UID_SEARCH_INTERFACE }; + + +public: + + /** + * Factory method to instantiate MSearchFeature. + * + * Factory method to instantiate platform default + * MXIMPClient implementation through the ECom. + * If the default search Feature isn't supported + * in the platform, leaves with errorcode signalled + * from ECom. + * + * @return The new serach client object. Object + * ownership is returned to caller. + */ + static inline MSearchFeature* NewL( MXIMPContext* aContext ); + + /** + * Public destructor. + * Objects can be deleted through this interface. + */ + virtual inline ~MSearchFeature(); + +protected: + + /** + * Default constructor to zero initialize + * the iEcomDtorID member. + */ + inline MSearchFeature(); + + +public: //Sub interfaces for im context + + + /** + * Gets reference to search object factory interface. + * + * Returned object factory interface is used + * to instantiate search objects. + * + * @return Object factory interface. + * No ownership is returned caller. + */ + virtual MSearchObjectFactory& SearchObjectFactory() const = 0; + + /** + * Gets reference to search interface. + * + * @return Requested interface. + * No ownership is returned caller. + */ + virtual MSearch& Search() const = 0; + +private: // Data + + //OWN: ECom destructor ID + TUid iEcomDtorID; + }; + +#include + + +#endif // MSearchFeature_H + + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_search_management_api/inc/searchfeature.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_search_management_api/inc/searchfeature.inl Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,64 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Search Feature interface used by XIMP clients. +* +*/ + +#include + + +// ----------------------------------------------------------------------------- +// MSearchFeature::NewL( MXIMPContext* aContext) implementation +// Factory method to instantiate the platform default +// MSearchFeature implementation through the ECom framework. +// ----------------------------------------------------------------------------- +// +inline MSearchFeature* MSearchFeature::NewL(MXIMPContext* aContext ) + { + _LIT8( KXIMPSearchDefaultData, XIMP_ECOM_DEFAULT_DATA_SEARCH_INTERFACE ); + + TEComResolverParams resolvingParams; + resolvingParams.SetDataType( KXIMPSearchDefaultData ); + resolvingParams.SetWildcardMatch( ETrue ); + + TAny* imp = REComSession::CreateImplementationL( TUid::Uid( MSearchFeature::KInterfaceId), + _FOFF( MSearchFeature, iEcomDtorID ), + aContext, resolvingParams ); + + return reinterpret_cast< MSearchFeature* >( imp ); + } + + +// ----------------------------------------------------------------------------- +// MSearchFeature::MSearchFeature() implementation +// Zero initializes the iEcomDtorID member. +// ----------------------------------------------------------------------------- +// +inline MSearchFeature::MSearchFeature() + { + iEcomDtorID = TUid::Null(); + } + + +// ----------------------------------------------------------------------------- +// MSearchFeature::~MSearchFeature() +// Destructor notifies the ECom from implementation destruction. +// ----------------------------------------------------------------------------- +// +inline MSearchFeature::~MSearchFeature() + { + REComSession::DestroyedImplementation( iEcomDtorID ); + } + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_search_management_api/inc/searchkeysevent.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_search_management_api/inc/searchkeysevent.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,74 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Event interface for Search keys event. +* +*/ + +#ifndef MSEARCHKEYSEVENT_H +#define MSEARCHKEYSEVENT_H + +#include +#include + +class MSearchKeyInfo; + +/** + * Event interface for search content. + * + * This interface is implemented by the Search Feature Plugin + * This event notifies clients + * when Search Keys are received from protocol. + * + * @ingroup searchmanagementapi + */ +class MSearchKeysEvent : public MXIMPBase + { +public: + /** Interface ID for the MSearchKeysEvent. */ + enum { KInterfaceId = SEARCH_IF_ID_SEARCH_KEYS_EVENT }; + + +protected: + + /** + * Protected destructor. + * Object instancies can't be deleted via this interface. + */ + virtual inline ~MSearchKeysEvent() {}; + +public : + /** + * returns the count of the search key info count. + * + * @return The count of he supported search keys. + */ + virtual TInt InfoCount() const =0; + + /** + * Gets the search key info object by index. + * + * @param [in] aIndex + * The index of the array. + * + * @return The search key info object from given index. + */ + virtual const MSearchKeyInfo& SearchKeyInfo( TInt aIndex ) const = 0; + + + }; + + +#endif // MSEARCHKEYSEVENT_H + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_search_management_api/inc/searchmanagementifids.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_search_management_api/inc/searchmanagementifids.hrh Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,49 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Search Feature Plugin Management API interface IDs. +* +*/ + +#ifndef SEARCHMANAGEMENTIFUIDS_HRH +#define SEARCHMANAGEMENTIFUIDS_HRH + + + + + +// Management IF id's +// 20xx - ximp related +// 21xx - presence related +// 22xx - instant messaging related +// 23xx - search related + + +// Interface IDs for search Feature Plugin Management API interfaces +#define SEARCH_IF_ID_SEARCH 2301 +#define SEARCH_IF_ID_SEARCHELEMENT 2302 +#define SEARCH_IF_ID_SEARCH_EVENT 2304 +#define SEARCH_IF_ID_PROTOCOL_SEARCH_FEATURE 2305 +#define SEARCH_IF_ID_SEARCH_KEYS_EVENT 2306 + +// Interface UID for searchfeatures interface +#define XIMP_ECOM_IF_UID_SEARCH_INTERFACE 0x2001847B + +// Default implementation resulution data +// for XIMP searchfeature interterface Base ECom interface +#define XIMP_ECOM_DEFAULT_DATA_SEARCH_INTERFACE "search" + + + +#endif // SEARCHMANAGEMENTIFUIDS_HRH + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_search_management_api/ximp_search_management_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_search_management_api/ximp_search_management_api.metaxml Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,14 @@ + + +ximp_search_management_api +This is an API that provides getting the search keys, search interfaces to the client. +c++ +searchmanager + + + + +yes +no + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_search_protocol_plugin_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_search_protocol_plugin_api/group/bld.inf Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,31 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: File that exports the files belonging to +: Search Feature Protocol Plug-in API +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + + +../inc/protocolsearchfeature.h MW_LAYER_PLATFORM_EXPORT_PATH(protocolsearchfeature.h) +../inc/searchprotocolpluginifids.hrh MW_LAYER_PLATFORM_EXPORT_PATH(searchprotocolpluginifids.hrh) +../inc/protocolsearch.h MW_LAYER_PLATFORM_EXPORT_PATH(protocolsearch.h) + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_search_protocol_plugin_api/inc/protocolsearch.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_search_protocol_plugin_api/inc/protocolsearch.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,110 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interface for Search Feature Protocol +* +*/ + + + +#ifndef MPROTOCOLSEARCH_H +#define MPROTOCOLSEARCH_H + +#include +#include +#include + +class MXIMPIdentity; +class MSearchElement; +/** + * Interface for Search object. + * Interface must be implemented by a XIMP Framework protocol + * plug-ins. + * + * This interface defines actions that XIMP Framework + * requests from a Search protocol connection to + * execute search related tasks. + * + * + * @ingroup ProtocolSearchpluginapi + * + */ +class MProtocolSearch : public MXIMPBase + { +public: + + /** Interface ID for the MProtocolSearch */ + enum { KInterfaceId = SEARCH_IF_ID_PROTOCOL_SEARCH }; + + +protected: + + /** + * Protected destructor. MProtocolSearch + * instancies can't be destroyed via this interface. + */ + virtual inline ~MProtocolSearch() {}; + + +public: + + /** + * Requests the protocol to start search. + * + * + * @param [in] aSearchId + * Identification for a search. + * + * @param [in] aObjs + * Defines what is to be searched. + * + * @param [in] aSearchLimit + * How many results client wants at a time. + * + * @param [in] aReqId + * request ID identifying the issued request. + */ + virtual void DoSearchL( const MXIMPIdentity& aSearchId, + const RPointerArray< MSearchElement >& aObjs, + TInt aSearchLimit, + TXIMPRequestId aReqId ) = 0; + + + + /** + * Requests the protocol to Stop search. + * + * @param [in] aSearchId + * Identification for a search. + * + * + * @param [in] aReqId + * request ID identifying the issued request + */ +/* virtual void DoCancelSearchL( const MXIMPIdentity& aSearchId, + TXIMPRequestId aReqId ) = 0;*/ + + /** + * Requests the protocol to get the serach keys + * + * + * @param [in] aReqId + * request ID identifying the issued request + */ + virtual void DoGetSearchKeysL( TXIMPRequestId aReqId ) = 0; + + }; + + + +#endif // MPROTOCOLIMSEARCH_H diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_search_protocol_plugin_api/inc/protocolsearchfeature.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_search_protocol_plugin_api/inc/protocolsearchfeature.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,104 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interface for search feature Protocol object. +* +*/ + +#ifndef MPROTOCOLSEARCHFEATURE_H +#define MPROTOCOLSEARCHFEATURE_H + +#include +#include +#include + + + +class MProtocolSearch; +class MProtocolSearchDataHost; + + + +/** + * . + * Interface must be implemented by a XIMP Framework + * protocol plug-ins. + * + * @ingroup protocolsearchpluginapi + * + */ +class MProtocolSearchFeature : public MXIMPBase + { + +public: + + /** Interface ID for the MProtocolSearchFeature. */ + enum { KInterfaceId = SEARCH_IF_ID_PROTOCOL_SEARCH_FEATURE }; + + + + /** + * Protected destructor. MXIMPProtocolConnection + * objects can't be deleted through this interface. + * + * XIMP Framework disposes MXIMPProtocolConnection + * instances through MXIMPProtocolPlugin::ReleaseConnection(). + */ + virtual inline ~MProtocolSearchFeature() {}; + + + + +public: // Access to sub-interfaces + + /** + * Gets reference to search interface. + * + * search calls this method to retrieve a reference + * to protocols MProtocolSearch interface + * implementation. + * + * Call and interface lifetime convention: + * - This method isn't called before protocol has signalled + * MXIMPProtocolConnection::OpenSessionL() succesfully completed. + * + * - XIMP Framework may call this method multiple times for + * for one MXIMPProtocolConnection instance. + * + * - Each call per one MXIMPProtocolConnection instance, + * must return reference to same interface instance. + * + * - Returned interface instance must remain valid (usable) + * untill last client session, using originating im protocol + * connection is successfully closed with + * MXIMPProtocolConnection::CloseSession(). + * + * @return Requested interface. + * interface ownership is not returned caller. + */ + virtual MProtocolSearch& Search() = 0; + + + /** + * Sets reference of serach datahost. + * + * @param aSearchHost + * MProtocolSearchDataHost object reference. + * ownership is not transfered. + */ + virtual void SetHost(MProtocolSearchDataHost& aSearchHost) = 0; + + }; + + +#endif // MPROTOCOLSEARCHFEATURES_H diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_search_protocol_plugin_api/inc/searchprotocolpluginifids.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_search_protocol_plugin_api/inc/searchprotocolpluginifids.hrh Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,36 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Protocol Plugin API interface IDs. +* +*/ + +#ifndef SEARCHPROTOCOLPLUGINIFIDS_HRH +#define SEARCHPROTOCOLPLUGINIFIDS_HRH + + + +// Protocol plugin IF id's +// 30xx - ximp related +// 31xx - presence related +// 32xx - instant messaging related +// 34xx - search related + +// Interface IDs for XIMPFw Protocol Plugin API interfaces + +#define SEARCH_IF_ID_PROTOCOL_SEARCH 3400 +#define SEARCH_IF_ID_PROTOCOL_SEARCH_FEATURES 3401 + +#endif // SEARCHPROTOCOLPLUGINIFIDS_HRH + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_search_protocol_plugin_api/ximp_search_protocol_plugin_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_search_protocol_plugin_api/ximp_search_protocol_plugin_api.metaxml Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,13 @@ + + +ximp_search_protocol_plugin_api +This is an API that provides search interfaces to the adaptation plugin which needs to be implemented by the adaptation. +c++ +ximp_search_protocol_plugin_api + + + +yes +no + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_search_protocol_plugin_host_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_search_protocol_plugin_host_api/group/bld.inf Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,31 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: File that exports the files belonging to +: XIMP Search Feature Plugin Host API +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + + +../inc/searchprotocolpluginhostifids.hrh MW_LAYER_PLATFORM_EXPORT_PATH(searchprotocolpluginhostifids.hrh) +../inc/protocolsearchdatahost.h MW_LAYER_PLATFORM_EXPORT_PATH(protocolsearchdatahost.h) +../inc/protocolsearchfeaturedatahost.h MW_LAYER_PLATFORM_EXPORT_PATH(protocolsearchfeaturedatahost.h) +../inc/protocolsearchpluginhost.h MW_LAYER_PLATFORM_EXPORT_PATH(protocolsearchpluginhost.h) diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_search_protocol_plugin_host_api/inc/protocolsearchdatahost.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_search_protocol_plugin_host_api/inc/protocolsearchdatahost.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,104 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interface for Search Feature Plugin host + * +*/ + +#ifndef MPROTOCOLSEARCHDATAHOST_H +#define MPROTOCOLSEARCHDATAHOST_H + +#include +#include +#include + +class MXIMPStatus; +class MSearchObjectFactory; +class MXIMPProtocolConnectionHostObserver; +class MProtocolImConversationDataHost; +class MProtocolImGroupDataHost; +class MProtocolImInvitationDataHost; +class MProtocolImSearchDataHost; +class MXIMPHost; + +class MProtocolSearchFeatureDataHost; +/** + * search connection host. + * Main interface class for protocol plugin. + * protocol plugin can get sub interfaces to features from this. + * + * @ingroup ProtocolSearchpluginhostapi + */ + + +class MProtocolSearchDataHost + + { +public: + + + /** Interface ID for the MProtocolSearchDataHost. */ + enum { KInterfaceId = XIMP_ECOM_IF_UID_SEARCH_PROCESSOR_INTERFACE }; + + +protected: + + /** + * Protected destructor. MProtocolSearchDataHost instancies + * can't be destroyed via this interface. + */ + virtual inline ~MProtocolSearchDataHost() {}; + + + + +public: // Access to sub-interfaces + + + /** + * Gets reference to object factory interface. + * + * search protocol connection implementation + * uses factory interface to instantiate Im + * objects. + * + * @return Object factory interface. + * No ownership is returned caller. + */ + + virtual MSearchObjectFactory& SearchObjectFactory() = 0; + + + /** + * Gets reference to + * MProtocolSearchFeatureDataHost interface. + * + * Search protocol connection implementation uses returned + * data host interface to manage the + * search data. + * + * @return MProtocolSearchFeatureDataHost interface. + * Interface ownership is not returned caller. + * Returned interface is guaranteed to remain valid (usable) + * as long as this source interface. + */ + + + virtual MProtocolSearchFeatureDataHost& SearchFeatureDataAccess() =0; + + + }; + + +#endif // MPROTOCOLIMDATAHOST_H + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_search_protocol_plugin_host_api/inc/protocolsearchfeaturedatahost.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_search_protocol_plugin_host_api/inc/protocolsearchfeaturedatahost.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,129 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: header for MProtocolSearchFeatureDataHost +* +*/ + +#ifndef MPROTOCOLSEARCHFEATUREDATAHOST_H +#define MPROTOCOLSEARCHFEATUREDATAHOST_H + + +#include +#include + + +class MXIMPIdentity; +class MXIMPObjectCollection; + +/** + * Interface for managing cached search information. + * + * Interface is used by protocol adaptations to manage + * search related information + * + * This interface is implemented by Search plugin + * Protocol adaptation can obtain reference to this + * interface from + * + * @ingroup ProtocolSearchpluginhostapi + */ +class MProtocolSearchFeatureDataHost : public MXIMPBase + { +public: + + /** Interface ID for the MProtocolSearchFeatureDataHost. */ + enum { KInterfaceId = SEARCH_IF_ID_PROTOCOL_SEARCH_DATAHOST }; + + +protected: + + + /** + * Protected destructor. Object instancies + * can't be deleted via this interface. + */ + virtual ~MProtocolSearchFeatureDataHost() {} + + + +public: // Handling search information + + + /** + * Notifies Search plugin for + * search result information. + * + * + * Search plugin takes ownership of the argument(s), + * if method succeeds without a leave. + * + * @param [in] aSearchId + * search id of the search request + + * @param [in] aSearchResults -List of results( MsearchInfos), + * NULL if none. + * + * @return The request id identifying the issued request. + * Data cache request is processed asynchronously and + * its completion is signalled to adaptation direction. + * + * @leave KErrNoMemory if failed to allocate memory. + * @leave KErrArgument if NULL argument(s) were provided. + */ + + virtual TXIMPRequestId HandleSearchResultsL(MXIMPIdentity* aSearchId, + MXIMPObjectCollection* aSearchResults) = 0; + /** + * Notifies Search plugin for + * supported search Keys and serach labels information. + * + * + * Search plugin takes ownership of the argument(s), + * if method succeeds without a leave. + * + * @param [in] aSearchKeyInfos - List of search key info objects + * + * + * @return The request id identifying the issued request. + * Data cache request is processed asynchronously and + * its completion is signalled to adaptation direction. + * + * @leave KErrNoMemory if failed to allocate memory. + * @leave KErrArgument if NULL argument(s) were provided. + */ + virtual TXIMPRequestId HandleSearchKeysL( MXIMPObjectCollection* aSearchKeyInfos ) = 0; + + /** + * Notifies search plugin for + * search stopped. + * + * + * search plugin takes ownership of the argument(s), + * if method succeeds without a leave. + * + * @param [in] aSearchId + * search id of the search request + * + * @return The request id identifying the issued request. + * Data cache request is processed asynchronously and + * its completion is signalled to adaptation. + * @leave KErrNoMemory if failed to allocate memory. + * @leave KErrArgument if NULL argument(s) were provided. + */ + + // virtual TXIMPRequestId HandleSearchCancelL(MXIMPIdentity* aSearchId) = 0; + }; + + +#endif // MPROTOCOLSEARCHFEATUREDATAHOST_H diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_search_protocol_plugin_host_api/inc/protocolsearchpluginhost.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_search_protocol_plugin_host_api/inc/protocolsearchpluginhost.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,150 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Protocol Search Feature Plugin host interface. +* +*/ + +#ifndef MPROTOCOLSEARCHPLUGINHOST_H +#define MPROTOCOLSEARCHPLUGINHOST_H + +#include +#include +#include + + +// CLASS DECLARATION + +/** + * Interface for Search Protocol Plugin host. + * This interface is implemented by search + * + * @ingroup Protocolserachpluginhostapi + * + */ +class MProtocolSearchPluginHost : public MXIMPBase + { +public: + + /** Interface ID for the MProtocolImPluginHost. */ + enum { KInterfaceId = SEARCH_IF_ID_PROTOCOL_PLUGIN_HOST }; + + +protected: + + /** + * Protected destructor. IM Protocol Plugin host + * instancies can't be destroyed via this interface. + */ + virtual inline ~MProtocolSearchPluginHost() {}; + + +public: + + + /** + * Gets reference to object factory interface. + * + * Returned object factory interface is used + * to instantiate IM data objects. + * + * @return Object factory interface. + * No ownership is returned caller. + */ + virtual MSearchObjectFactory& ObjectFactory() = 0; + + + + /** + * Notifies IM that IM protocol + * plug-in has completed (successfully or otherwise) + * the request handling. + * + * /b NOTE: This method isn't yet supported by IM, + * since all MProtocolImPlugin methods are currently + * synchronous. + * + * @param [in] aReqId + * Request ID identifying the request which handling + * is completed. This must equal to value given in + * the processing initiation. If no pending IM + * protocol plug-in request is found with this id, + * plug-in is paniced. + * + * @param [in] aResultCode + * Result code from request handling. + */ + virtual void HandleRequestCompleted( TXIMPRequestId aReqId, + TInt aResultCode ) = 0; + + + /** + * Notifies IM that IM protocol + * plug-in has completed (successfully or otherwise) + * the request handling. + * + * /b NOTE: This method isn't yet supported by IM, + * since all MProtocolImPlugin methods are currently + * synchronous. + * + * @param [in] aReqId + * Request ID identifying the request which handling + * is completed. This must equal to value given in + * the processing initiation. If no pending IM + * protocol plug-in request is found with this id, + * plug-in is paniced. + * @param [in] aResult + * Status object describing result from request handling. + * Object ownership is transfered always to IM. + * NULL value not allowed. + */ + virtual void HandleRequestCompleted( TXIMPRequestId aReqId, + MImStatus* aResult ) = 0; + + + /** + * Notifies IM that IM protocol + * plug-in has completed (successfully or otherwise) + * the request handling. + * + * /b NOTE: This method isn't yet supported by IM, + * since all MProtocolImPlugin methods are currently + * synchronous. + * + * @param [in] aReqId + * Request ID identifying the request which handling + * is completed. This must equal to value given in + * the processing initiation. If no pending IM + * protocol plug-in request is found with this id, + * plug-in is paniced. + * @param [in] aResult + * Status object describing result from request handling. + * Object ownership is transfered always to Im. + * NULL value not allowed. + * @param [in] aParameter + * Additional request complete parameters. + * NULL if no additional parameters to transfer Im. + * Parameter may be single MXIMPBase derived + * object or MImRestrictedObjectCollection object + * containing multiple objects. Ownership of given + * parameter (also the container and contained objects) + * is transfered always to Im. + */ + virtual void HandleRequestCompleted( TXIMPRequestId aReqId, + MImStatus* aResult, + MXIMPBase* aParameter ) = 0; + + }; + + +#endif // MPROTOCOLSEARCHPLUGINHOST_H diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_search_protocol_plugin_host_api/inc/searchprotocolpluginhostifids.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_search_protocol_plugin_host_api/inc/searchprotocolpluginhostifids.hrh Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,40 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Protocol Plugin Host API interface IDs. +* +*/ + +#ifndef PROTOCOLSEARCHPLUGINHOSTIFIDS_HRH +#define PROTOCOLSEARCHPLUGINHOSTIFIDS_HRH + + +// Protocol plugin host IF id's +// 40xx - ximp related +// 41xx - presence related +// 42xx - instant messaging related +// 43xx - instant messaging related + +// Interface IDs for search Plugin Host interfaces + +#define SEARCH_IF_ID_PROTOCOL_PLUGIN_HOST 4300 +#define SEARCH_IF_ID_PROTOCOL_SEARCH_DATAHOST 4301 +#define SEARCH_IF_ID_PROTOCOL_DATA_HOST 4302 + +// Interface UID for Searchfeatures interface +#define XIMP_ECOM_IF_UID_SEARCH_PROCESSOR_INTERFACE 0x2001847C + + +#endif // PROTOCOLSEARCHPLUGINHOSTIFIDS_HRH + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/ximp_search_protocol_plugin_host_api/ximp_search_protocol_plugin_host_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/ximp_search_protocol_plugin_host_api/ximp_search_protocol_plugin_host_api.metaxml Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,14 @@ + + +ximp_search_protocol_plugin_host_api +Interface for managing cached search information. Interface is used by protocol adaptations to manage search related information, this interface is implemented by Search plugin Protocol adaptation. +c++ +searchprocessor + + + + +yes +no + + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/xmpp_settings_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/xmpp_settings_api/group/bld.inf Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,29 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: File that exports the files belonging to +: XIMP IM Base API +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +../inc/xmppparams.h MW_LAYER_PLATFORM_EXPORT_PATH(xmppparams.h) +../inc/xmppservicesettingsapi.h MW_LAYER_PLATFORM_EXPORT_PATH(xmppservicesettingsapi.h) +../inc/xmppsettingsapicommon.h MW_LAYER_PLATFORM_EXPORT_PATH(xmppsettingsapicommon.h) diff -r 000000000000 -r e6b17d312c8b imsrv_plat/xmpp_settings_api/inc/xmppparams.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/xmpp_settings_api/inc/xmppparams.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,85 @@ +/* +* Copyright (c) 2007-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: This header holds the various xmpp params/fields +* +*/ + +#ifndef __XMPPPARAMS_H +#define __XMPPPARAMS_H + +#include +namespace XmppParams + { + /** Presence status */ + enum TPresenceStatus + { + /** Unavailable */ + EUnavailable, + /** Available */ + EAvailable, + /** Chat */ + EChat, + /** Away */ + EAway, + /** Extended away */ + EXAway, + /** Do not disturb */ + EDoNotDisturb, + /** Invisible */ + EInvisible + }; + + // TInt + _LIT( KXmppParamSnapId, "SNAP-ID"); + _LIT( KXmppParamServerPort, "SERVER-ADDRESS_PORT"); + _LIT( KXmppParamMsgToneVolume, "MSG-TONE_VOLUME"); + _LIT( KXmppParamSipProfileId, "VOIP-PROFILE-ID"); + _LIT( KXmppParamVoipProfileId, "SIP-PROFILE-ID"); + // TBool == TInt + _LIT( KXmppParamPublishOnThePhoneState, "PUBLISH-ON-THE-PHONE-STATUS"); + _LIT( KXmppParamAutoAcceptBuddyReq, "ACCEPT-BUDDY-REQ-AUTO-ENABLED"); + // others == TInt + _LIT( KXmppParamPresenceStatus, "PRESENCE-STATUS"); + _LIT( KXmppParamConSecurityOption, "CONNECTION-SECURITY-OPTION"); + // TDesC16 + _LIT( KXmppParamMsgTonePathFile, "MESSAGE-TONE-PATH-FILE"); + _LIT( KXmppParamXmppServerAddress, "XMPP-SERVER-ADDRESS"); + _LIT( KXmppParamDomain, "XMPP-DOMAIN"); + _LIT( KXmppParamUsername, "XMPP-USERNAME"); + _LIT( KXmppParamPassword, "XMPP-PASSWORD"); + _LIT( KXmppParamPresenceStatusFreeTextOnline, "PRESENCE-STATUS-FREE-TEXT-ONLINE"); + _LIT( KXmppParamPresenceStatusFreeTextAway, "PRESENCE-STATUS-FREE-TEXT-AWAY"); + _LIT( KXmppParamPresenceStatusFreeTextBusy, "PRESENCE-STATUS-FREE-TEXT-BUSY"); + _LIT( KXmppParamPresenceStatusFreeTextOffline, "PRESENCE-STATUS-FREE-TEXT-OFFLINE"); + _LIT( KXmppParamPresenceStatusFreeTextInvisible, "PRESENCE-STATUS-FREE-TEXT-INVISIBLE"); + _LIT( KXmppParamLastLoggedInUserName, "XMPP-LAST-LOGGEDIN-USERNAME"); + // gabble specific things + + + _LIT( KXmppParamResource, "RESOURCE-FILE"); + _LIT( KXmppParamOldSSLRequired, "OLD_SSL_REQUIRED"); + _LIT( KXmppParamRegisterRequired, "REGISTER-REQUIRED"); + _LIT( KXmppParamHttpsProxyServerPort, "HTTPS-PROXY-SERVER-ADDRESS_PORT"); + _LIT( KXmppParamHttpsProxyServerAddress, "HTTPS-PROXY-SERVER-ADDERES"); + _LIT( KXmppParamAlais, "ALIAS"); + _LIT( KXmppParamSnapName, "SNAP-NAME"); + _LIT( KXmppParamSettingsName, "SETTINGS-NAME"); + + //Connection manager related + _LIT( KXmppParamConnMgrBus, "CONNMGR_BUS"); + _LIT( KXmppParamConnMgrPath, "CONNMGR_PATH"); + _LIT( KXmppParamProtocol, "PROTOCOL"); + + } +#endif \ No newline at end of file diff -r 000000000000 -r e6b17d312c8b imsrv_plat/xmpp_settings_api/inc/xmppservicesettingsapi.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/xmpp_settings_api/inc/xmppservicesettingsapi.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,301 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: This class handles dynamic name-value pair storing. +* +*/ + + +#ifndef C_XMPPSETTINGSAPI_H +#define C_XMPPSETTINGSAPI_H + + + +#include + +class CRepository; +class CXmppSettingsRecord; +class CXmppSettingsColumn; + + +/** + * This class handles dynamic name-value pair storing. + * Be warned, all actions are final. + * + * + * This is how this component works: + * It has two tables. First one, the column table, contains only single row. + * This table is actually a header table for the record table. When you set + * an new attribute, we check that does it already exist in column table. If + * it does not, it is added as last entry. After that data of the attribute + * is set to the record table into same column as it is attribute name is in + * the column table. Row of the settings record is determined by + * given settingsrecordid. + * + * The column table can hold 0xFFFE (65534) of different user attributes + * and you can add 0xFF (255) different settingsrecords. + * + * Below is an picture of the tables. Only the ID column is mandatory. All + * other columns are defined by user. + * + * ------------------------------------------------------------ + * | COLUMNS TABLE | + * |----------------------------------------------------------- + * | 1 | 2 | 3 | 4 | 5... | | + * ------------------------------------------------------------ + * | ID | SERVER-ADDR | SERVER-PORT | USERNAME | etc...| | + * ------------------------------------------------------------ + * + * ------------------------------------------------------------ + * | RECORDS TABLE | + * |----------------------------------------------------------- + * | 1 | 2 | 3 | 4 | 5... | | + * ------------------------------------------------------------ + * | 1 | www.gizmo.com | 5223 | Myerdin | etc...| | + * ------------------------------------------------------------ + * | 2 | | 5222 | Ballmer | etc...| | + * ------------------------------------------------------------ + * | 3 | login.com | | Apple | etc...| | + * ------------------------------------------------------------ + * | 4 | aaa.bbb.com | 1234 | user | etc...| | + * ------------------------------------------------------------ + * + * Usage examples: + * @code + * ---- Example 1 ---------------------------------------------- + * Usage example: + * First Create settings record: + * + * TUint32 settingId(0); + * CXmppSettingsApi* sapi = CXmppSettingsApi::NewLC(); + * sapi->CreateSettingsRecordL( settingId ); + * CleanupStack::PopAndDestroy( sapi ); + * + * The settingId contains now new id. + * + * ---- Example 2 ---------------------------------------------- + * You can request default settings record (currently returns the first): + * + * TUint32 settingId(0); + * sapi->DefaultSettingsRecordL( settingId ); + * + * The settingId contains now the id. + * + * ---- Example 3 ---------------------------------------------- + * When you want to add new parameter to the settings record, do following: + * + * _LIT( KOurParam, "USERNAME"); + * + * sapi->SetParamL( settingId, + * KOurParam(), + * aUsername ); + * + * If this is the first time the parameter is added to the settings record, + * it creates new room for it. + * + * ---- Example 4 ---------------------------------------------- + * When you want to get parameter from the settings record, do following: + * + * _LIT( KOurParam, "USERNAME"); + * RBuf value; + * value.CreateL( KMaxParamLength ); + * + * sapi->SetParamL( settingId, + * KOurParam(), + * value ); + * + * Value now contains the value recordd in the settings record. If no value + * has been set for this settins records column, then it cannot be + * found ->leaves KErrNotFound. + * + * @endcode + * + * @lib jabbersettings.lib + * @since S60 5.0 + */ +class CXmppSettingsApi: public CBase + { + +public: + + /** + * Two-phased constructor. + * @return Instance of this class + */ + IMPORT_C static CXmppSettingsApi* NewL(); + + IMPORT_C static CXmppSettingsApi* NewLC(); + + /** + * Destructor + */ + IMPORT_C virtual ~CXmppSettingsApi(); + + + /** + * Creates new settings record. + * + * @since S60 5.0 + * @param aSettingsRecordId On return contains the new setting id. + */ + IMPORT_C void CreateSettingsRecordL( TUint32& aSettingsRecordId ); + + /** + * Removes Settings record using given settings record id. + * + * @since S60 5.0 + * @param aSettingsRecordId Setting id to be removed. + */ + IMPORT_C void RemoveSettingsRecordL( TUint32 aSettingsRecordId ); + + /** + * Returns default settings record id. + * + * @since S60 5.0 + * @param aSettingsRecordId On return contains the setting id. + */ + IMPORT_C void DefaultSettingsRecordL( TUint32& aSettingsRecordId ); + + /** + * Fills the array with settings ids. If there is none, array + * is zero length. + * + * @since S60 5.0 + * @param aArray Array is filled with setting ids. + */ + IMPORT_C void GetSettingsRecordIdArrayL( RArray& aArray ); + + /** + * Sets value of the param. If ParamName is not found, it creates new. + * + * @since S60 5.0 + * @param aSettingsRecordId Setting id of interest. + * @param aAttrName Parameters name. + * @param aAttrValue Parameters value. + */ + IMPORT_C void SetParamL( TUint32 aSettingsRecordId, + const TDesC& aAttrName, + const TDesC& aAttrValue ); + + /** + * Sets value of the param. If ParamName is not found, it creates new. + * + * @since S60 5.0 + * @param aSettingsRecordId Setting id of interest. + * @param aAttrName Parameters name. + * @param aAttrValue Parameters value. + */ + IMPORT_C void SetParamL( TUint32 aSettingsRecordId, + const TDesC& aAttrName, + TInt aAttrValue ); + + /** + * Gets value of the param. + * - KErrNotFound if setting collection or Param is not found. + * + * @since S60 5.0 + * @param aSettingsRecordId Setting id of interest. + * @param aAttrName Parameters name. + * @param aAttrValue On return, contains the param value. + */ + IMPORT_C void GetParamL( TUint32 aSettingsRecordId, + const TDesC& aAttrName, + TDes& aAttrValue ); + + /** + * Gets value of the param. + * - KErrNotFound if setting collection or Param is not found. + * + * @since S60 5.0 + * @param aSettingsRecordId Setting id of interest. + * @param aAttrName Parameters name. + * @param aAttrValue On return, contains the param value. + */ + IMPORT_C void GetParamL( TUint32 aSettingsRecordId, + const TDesC& aAttrName, + TInt& aAttrValue ); + + /** + * Removes this param from this Settings record. + * - KErrNotFound If Settings record or param is not found. + * + * @since S60 5.0 + * @param aSettingsRecordId Setting id. + * @param aAttrName Parameters name. + */ + IMPORT_C void RemoveParamL( TUint32 aSettingsRecordId, + const TDesC& aAttrName ); + + + /** + * This method does checks before setting or getting values. + * + * @since S60 5.0 + * @param aSettingsRecordId Setting id to be changed. + * @param aAttrName Parameters name. + * @param aCreateColumnIfNotExist Should new column be created if it is not + * founded (by aAttrName). + * @param aTheKey On return contains key to be created/changed. + */ + IMPORT_C void GetRepositoryKeyL( TUint32 aSettingsRecordId, + const TDesC& aAttrName, + TBool aCreateColumnIfNotExist, + TUint32& aTheKey ); + +private: + + /** + * Default Contructor + */ + CXmppSettingsApi(); + + void ConstructL(); + + /** + * This method does checks before setting or getting values. + * + * @since S60 5.0 + * @param aSettingsRecordId Setting id to be changed. + * @param aAttrName Parameters name. + * @param aCreateColumnIfNotExist Should new column be created if it is not + * founded (by aAttrName). + * @param aTheKey On return contains key to be created/changed. + */ + void GetColumnKeyL( TUint32 aSettingsRecordId, + const TDesC& aAttrName, + TBool aCreateColumnIfNotExist, + TUint32& aTheKey ); + +private: // data + + /** + * Central Repository. + * Own. + */ + CRepository* iRepository; + + /** + * Class for settings records handling. + * Own. + */ + CXmppSettingsRecord* iRecords; + + /** + * Class for column table handling. + * Own. + */ + CXmppSettingsColumn* iColumns; + + }; + +#endif // C_XMPPSETTINGSAPI_H diff -r 000000000000 -r e6b17d312c8b imsrv_plat/xmpp_settings_api/inc/xmppsettingsapicommon.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/xmpp_settings_api/inc/xmppsettingsapicommon.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,37 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Common defines for this component. +* +*/ + + + + +#ifndef _XMPPSETTINGSAPICOMMON_H +#define _XMPPSETTINGSAPICOMMON_H + +#include + +_LIT( KColSettingId, "XMPP-SETTING-ID-COL"); +const TUid KXmppSettingsApiCenRep ={0x1020E334}; +// keys +const TUint32 KXmppKeyColumnTable = 0x00000000; +const TUint32 KXmppKeyDataTable = 0x01000000; +const TUint32 KCurrentSettingIdIndex = 0xFFFFFFFF; + +//masks +const TUint32 KXmppMaskColumns = 0xFFFF0000; +const TUint32 KXmppMaskAllRows = 0xFF00FFFF; + +#endif // _XMPPSETTINGSAPICOMMON_H diff -r 000000000000 -r e6b17d312c8b imsrv_plat/xmpp_settings_api/tsrc/bmarm/xmppsettings_apiu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/xmpp_settings_api/tsrc/bmarm/xmppsettings_apiu.def Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + LibEntryL__FR13CTestModuleIf @ 1 NONAME R3UNUSED ; LibEntryL(CTestModuleIf &) + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/xmpp_settings_api/tsrc/bwins/xmppsettings_apiu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/xmpp_settings_api/tsrc/bwins/xmppsettings_apiu.def Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + ?LibEntryL@@YAPAVCScriptBase@@AAVCTestModuleIf@@@Z @ 1 NONAME ; class CScriptBase * __cdecl LibEntryL(class CTestModuleIf &) + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/xmpp_settings_api/tsrc/conf/xmppsettings_api.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/xmpp_settings_api/tsrc/conf/xmppsettings_api.cfg Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,70 @@ +[Test] +title Test_CreateSettingsRecordL +create xmppsettings_api xmppsettings_apiObj +xmppsettings_apiObj Test_CreateSettingsRecordL +delete xmppsettings_apiObj +[Endtest] + +[Test] +title Test_DefaultSettingsRecord +create xmppsettings_api xmppsettings_apiObj +xmppsettings_apiObj Test_DefaultSettingsRecord +delete xmppsettings_apiObj +[Endtest] + +[Test] +title Test_GetSettingsRecordIdArray +create xmppsettings_api xmppsettings_apiObj +xmppsettings_apiObj Test_GetSettingsRecordIdArray +delete xmppsettings_apiObj +[Endtest] + +[Test] +title Test_SetParamInt +create xmppsettings_api xmppsettings_apiObj +xmppsettings_apiObj Test_SetParamInt +delete xmppsettings_apiObj +[Endtest] + +[Test] +title Test_SetParamLDes +create xmppsettings_api xmppsettings_apiObj +xmppsettings_apiObj Test_SetParamLDes +delete xmppsettings_apiObj +[Endtest] + +[Test] +title Test_GetParamInt +create xmppsettings_api xmppsettings_apiObj +xmppsettings_apiObj Test_GetParamInt +delete xmppsettings_apiObj +[Endtest] + +[Test] +title Test_GetParamLDes +create xmppsettings_api xmppsettings_apiObj +xmppsettings_apiObj Test_GetParamLDes +delete xmppsettings_apiObj +[Endtest] + +[Test] +title Test_RemoveSettingsRecord +create xmppsettings_api xmppsettings_apiObj +xmppsettings_apiObj Test_RemoveSettingsRecord +delete xmppsettings_apiObj +[Endtest] + +[Test] +title Test_RemoveParam +create xmppsettings_api xmppsettings_apiObj +xmppsettings_apiObj Test_RemoveParam +delete xmppsettings_apiObj +[Endtest] + +[Test] +title Test_GetRepositoryKeyL +create xmppsettings_api xmppsettings_apiObj +xmppsettings_apiObj Test_GetRepositoryKeyL +delete xmppsettings_apiObj +[Endtest] + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/xmpp_settings_api/tsrc/eabi/xmppsettings_apiU.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/xmpp_settings_api/tsrc/eabi/xmppsettings_apiU.def Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + _Z9LibEntryLR13CTestModuleIf @ 1 NONAME + diff -r 000000000000 -r e6b17d312c8b imsrv_plat/xmpp_settings_api/tsrc/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/xmpp_settings_api/tsrc/group/bld.inf Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,54 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +PRJ_PLATFORMS +// specify the platforms your component needs to be built for here +// defaults to WINS MARM so you can ignore this if you just build these + + DEFAULT + +PRJ_TESTEXPORTS +// NOTE: If using ARS requirements all export operations should be done under this. +// 'abld test export' + +PRJ_EXPORTS +// Specify the source file followed by its destination here +// copy will be used to copy the source file to its destination +// If there's no destination then the source file will be copied +// +// Example: +/* + +*/ +../init/TestFramework.ini /epoc32/winscw/c/TestFramework/TestFramework.ini +../conf/xmppsettings_api.cfg /epoc32/winscw/c/TestFramework/xmppsettings_api.cfg +PRJ_TESTMMPFILES + + xmppsettings_api.mmp + + +// 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: +// + + +// End of File diff -r 000000000000 -r e6b17d312c8b imsrv_plat/xmpp_settings_api/tsrc/group/xmppsettings_api.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/xmpp_settings_api/tsrc/group/xmppsettings_api.mmp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,77 @@ +/*TYPE TESTCLASS*/ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MMP file for STIF Test Framework's TestScripter +* testclass test module. +* +*/ + +#include + +TARGET xmppsettings_api.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 xmppsettings_api.DEF + +USERINCLUDE ../inc + +OS_LAYER_SYSTEMINCLUDE +APP_LAYER_SYSTEMINCLUDE +MW_LAYER_SYSTEMINCLUDE +SOURCEPATH ../src + +SOURCE xmppsettings_api.cpp +SOURCE xmppsettings_apiBlocks.cpp + +//RESOURCE resource_file +//RESOURCE resource_file2 + +LIBRARY euser.lib +LIBRARY stiftestinterface.lib +LIBRARY stiftestengine.lib +LIBRARY jabbersettings.lib +LIBRARY centralrepository.lib +LANG SC + +/* +START WINS +?wins_specific_information +END + +START MARM +?marm_specific_information +END +*/ +// Other possible keywords: + +// DOCUMENT ?file, that is not compiled, but added to MSVC project workspace (i.e. release notes) +/* +START BITMAP ?target +TARGETPATH ?emulated_path_on_target_machine +HEADER +SOURCE ?color_depth ?source_bitmap +END +*/ +// DEFFILE ?filename +// AIF ?filename + +// End of File diff -r 000000000000 -r e6b17d312c8b imsrv_plat/xmpp_settings_api/tsrc/group/xmppsettings_api.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/xmpp_settings_api/tsrc/group/xmppsettings_api.pkg Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,66 @@ +; +; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +; All rights reserved. +; This component and the accompanying materials are made available +; under the terms of "Eclipse Public License v1.0" +; which accompanies this distribution, and is available +; at the URL "http://www.eclipse.org/legal/epl-v10.html". +; +; Initial Contributors: +; Nokia Corporation - initial contribution. +; +; Contributors: +; +; Description: +; +; Installation file for STIF +; + +; Languages +&EN + +; Provide value for uid +#{"STIF"},(0x00000000),1,1,0,TYPE=SA + +; Series60 product id for S60 3.0 +[0x101F7961], 0, 0, 0, {"Series60ProductID"} + +; Localised Vendor name +%{"Nokia"} + +; Unique Vendor name +:"Nokia" + +; Logo +; None + +; Package signature - Optional +; None + +; Start of Package body + +; Condition blocks +; None + +; Options list +; None + +;INI FILE +"..\init\testframework.ini" -"c:\Testframework\ttestframework.ini" + +;CFG FILES +"..\conf\xmppsettings_api.cfg" -"c:\Testframework\xmppsettings_api.cfg" + +; Install files +"\epoc32\release\armv5\udeb\xmppsettings_api.dll" - "!:\Sys\Bin\xmppsettings_api.dll" + +; Embedded SIS +; None + +; End of Package body + +; PKG dependencies +; None + +; PKG capabilities +; None diff -r 000000000000 -r e6b17d312c8b imsrv_plat/xmpp_settings_api/tsrc/group/xmppsettings_api_DoxyFile.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/xmpp_settings_api/tsrc/group/xmppsettings_api_DoxyFile.txt Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,239 @@ +# +# 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 "Symbian Foundation License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# +# + +# Doxyfile 1.4.1 + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = xmppsettings_api +PROJECT_NUMBER = +OUTPUT_DIRECTORY = \xmppsettings_api\ +CREATE_SUBDIRS = NO +OUTPUT_LANGUAGE = English +USE_WINDOWS_ENCODING = YES +BRIEF_MEMBER_DESC = YES +REPEAT_BRIEF = YES +ABBREVIATE_BRIEF = +ALWAYS_DETAILED_SEC = NO +INLINE_INHERITED_MEMB = NO +FULL_PATH_NAMES = NO +STRIP_FROM_PATH = +STRIP_FROM_INC_PATH = +SHORT_NAMES = NO +JAVADOC_AUTOBRIEF = NO +MULTILINE_CPP_IS_BRIEF = NO +DETAILS_AT_TOP = NO +INHERIT_DOCS = YES +DISTRIBUTE_GROUP_DOC = NO +TAB_SIZE = 8 +ALIASES = +OPTIMIZE_OUTPUT_FOR_C = YES +OPTIMIZE_OUTPUT_JAVA = NO +SUBGROUPING = YES +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- +EXTRACT_ALL = YES +EXTRACT_PRIVATE = NO +EXTRACT_STATIC = NO +EXTRACT_LOCAL_CLASSES = NO +EXTRACT_LOCAL_METHODS = NO +HIDE_UNDOC_MEMBERS = NO +HIDE_UNDOC_CLASSES = NO +HIDE_FRIEND_COMPOUNDS = NO +HIDE_IN_BODY_DOCS = NO +INTERNAL_DOCS = YES +CASE_SENSE_NAMES = YES +HIDE_SCOPE_NAMES = NO +SHOW_INCLUDE_FILES = YES +INLINE_INFO = YES +SORT_MEMBER_DOCS = YES +SORT_BRIEF_DOCS = NO +SORT_BY_SCOPE_NAME = NO +GENERATE_TODOLIST = NO +GENERATE_TESTLIST = NO +GENERATE_BUGLIST = NO +GENERATE_DEPRECATEDLIST= YES +ENABLED_SECTIONS = +MAX_INITIALIZER_LINES = 30 +SHOW_USED_FILES = YES +SHOW_DIRECTORIES = YES +FILE_VERSION_FILTER = +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- +QUIET = NO +WARNINGS = YES +WARN_IF_UNDOCUMENTED = YES +WARN_IF_DOC_ERROR = YES +WARN_NO_PARAMDOC = NO +WARN_FORMAT = "$file:$line: $text" +WARN_LOGFILE = +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = \xmppsettings_api\ +FILE_PATTERNS = *.h \ + *.rh \ + *.hrh +RECURSIVE = YES +EXCLUDE = +EXCLUDE_SYMLINKS = NO +EXCLUDE_PATTERNS = +EXAMPLE_PATH = +EXAMPLE_PATTERNS = +EXAMPLE_RECURSIVE = NO +IMAGE_PATH = +INPUT_FILTER = +FILTER_PATTERNS = +FILTER_SOURCE_FILES = NO +#--------------------------------------------------------------------------- +# configuration options related to source browsing +#--------------------------------------------------------------------------- +SOURCE_BROWSER = NO +INLINE_SOURCES = NO +STRIP_CODE_COMMENTS = YES +REFERENCED_BY_RELATION = YES +REFERENCES_RELATION = YES +VERBATIM_HEADERS = YES +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- +ALPHABETICAL_INDEX = NO +COLS_IN_ALPHA_INDEX = 5 +IGNORE_PREFIX = +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- +GENERATE_HTML = NO +HTML_OUTPUT = html +HTML_FILE_EXTENSION = .html +HTML_HEADER = +HTML_FOOTER = +HTML_STYLESHEET = +HTML_ALIGN_MEMBERS = YES +GENERATE_HTMLHELP = YES +CHM_FILE = +HHC_LOCATION = +GENERATE_CHI = NO +BINARY_TOC = YES +TOC_EXPAND = YES +DISABLE_INDEX = YES +ENUM_VALUES_PER_LINE = 4 +GENERATE_TREEVIEW = YES +TREEVIEW_WIDTH = 250 +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- +GENERATE_LATEX = NO +LATEX_OUTPUT = latex +LATEX_CMD_NAME = latex +MAKEINDEX_CMD_NAME = makeindex +COMPACT_LATEX = NO +PAPER_TYPE = a4wide +EXTRA_PACKAGES = +LATEX_HEADER = +PDF_HYPERLINKS = NO +USE_PDFLATEX = NO +LATEX_BATCHMODE = NO +LATEX_HIDE_INDICES = NO +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- +GENERATE_RTF = YES +RTF_OUTPUT = Doc +COMPACT_RTF = YES +RTF_HYPERLINKS = YES +RTF_STYLESHEET_FILE = +RTF_EXTENSIONS_FILE = +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- +GENERATE_MAN = NO +MAN_OUTPUT = man +MAN_EXTENSION = .3 +MAN_LINKS = NO +#--------------------------------------------------------------------------- +# configuration options related to the XML output +#--------------------------------------------------------------------------- +GENERATE_XML = NO +XML_OUTPUT = xml +XML_SCHEMA = +XML_DTD = +XML_PROGRAMLISTING = YES +#--------------------------------------------------------------------------- +# configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- +GENERATE_AUTOGEN_DEF = NO +#--------------------------------------------------------------------------- +# configuration options related to the Perl module output +#--------------------------------------------------------------------------- +GENERATE_PERLMOD = NO +PERLMOD_LATEX = NO +PERLMOD_PRETTY = YES +PERLMOD_MAKEVAR_PREFIX = +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- +ENABLE_PREPROCESSING = YES +MACRO_EXPANSION = YES +EXPAND_ONLY_PREDEF = NO +SEARCH_INCLUDES = YES +INCLUDE_PATH = +INCLUDE_FILE_PATTERNS = +PREDEFINED = NONSHARABLE_CLASS +EXPAND_AS_DEFINED = +SKIP_FUNCTION_MACROS = YES +#--------------------------------------------------------------------------- +# Configuration::additions related to external references +#--------------------------------------------------------------------------- +TAGFILES = +GENERATE_TAGFILE = +ALLEXTERNALS = NO +EXTERNAL_GROUPS = YES +PERL_PATH = /usr/bin/perl +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- +CLASS_DIAGRAMS = YES +HIDE_UNDOC_RELATIONS = YES +HAVE_DOT = NO +CLASS_GRAPH = YES +COLLABORATION_GRAPH = YES +GROUP_GRAPHS = YES +UML_LOOK = NO +TEMPLATE_RELATIONS = YES +INCLUDE_GRAPH = YES +INCLUDED_BY_GRAPH = YES +CALL_GRAPH = NO +GRAPHICAL_HIERARCHY = YES +DIRECTORY_GRAPH = YES +DOT_IMAGE_FORMAT = png +DOT_PATH = +DOTFILE_DIRS = +MAX_DOT_GRAPH_WIDTH = 1024 +MAX_DOT_GRAPH_HEIGHT = 1024 +MAX_DOT_GRAPH_DEPTH = 0 +DOT_TRANSPARENT = NO +DOT_MULTI_TARGETS = NO +GENERATE_LEGEND = YES +DOT_CLEANUP = YES +#--------------------------------------------------------------------------- +# Configuration::additions related to the search engine +#--------------------------------------------------------------------------- +SEARCHENGINE = NO diff -r 000000000000 -r e6b17d312c8b imsrv_plat/xmpp_settings_api/tsrc/group/xmppsettings_api_nrm.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/xmpp_settings_api/tsrc/group/xmppsettings_api_nrm.mmp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,75 @@ +/*TYPE TESTCLASS*/ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MMP file for STIF Test Framework's TestScripter +* testclass test module. +* +*/ + +#include + +TARGET xmppsettings_api.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 xmppsettings_api.def + +USERINCLUDE ../inc + +OS_LAYER_SYSTEMINCLUDE + +SOURCEPATH ../src + +SOURCE xmppsettings_api.cpp +SOURCE xmppsettings_apiBlocks.cpp + +//RESOURCE resource_file +//RESOURCE resource_file2 + +LIBRARY euser.lib +LIBRARY stiftestinterface.lib +LIBRARY stiftestengine.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 000000000000 -r e6b17d312c8b imsrv_plat/xmpp_settings_api/tsrc/inc/xmppsettings_api.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/xmpp_settings_api/tsrc/inc/xmppsettings_api.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,224 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: STIF testclass declaration +* +*/ + +#ifndef XMPPSETTINGS_API_H +#define XMPPSETTINGS_API_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( Kxmppsettings_apiLogPath, "\\logs\\testframework\\xmppsettings_api\\" ); +// Log file +_LIT( Kxmppsettings_apiLogFile, "xmppsettings_api.txt" ); +_LIT( Kxmppsettings_apiLogFileWithTitle, "xmppsettings_api_[%S].txt" ); + +// FUNCTION PROTOTYPES +//?type ?function_name(?arg_list); + +// FORWARD DECLARATIONS +//class ?FORWARD_CLASSNAME; +class CXmppSettingsApi; +class Cxmppsettings_api; + +// DATA TYPES +//enum ?declaration +//typedef ?declaration +//extern ?data_type; + +// CLASS DECLARATION + +/** +* Cxmppsettings_api test class for STIF Test Framework TestScripter. +* ?other_description_lines +* +* @lib ?library +* @since ?Series60_version +*/ +NONSHARABLE_CLASS(Cxmppsettings_api) : public CScriptBase + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static Cxmppsettings_api* NewL( CTestModuleIf& aTestModuleIf ); + + /** + * Destructor. + */ + virtual ~Cxmppsettings_api(); + + 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. + */ + Cxmppsettings_api( 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. + */ + + void ResetRepository(); + virtual TInt Test_CreateSettingsRecordL( CStifItemParser& aItem ); + virtual TInt Test_DefaultSettingsRecord( CStifItemParser& aItem ); + virtual TInt Test_GetSettingsRecordIdArray(CStifItemParser& aItem ); + virtual TInt Test_SetParamInt(CStifItemParser& aItem ); + virtual TInt Test_SetParamLDes(CStifItemParser& aItem ); + virtual TInt Test_GetParamInt(CStifItemParser& aItem ); + virtual TInt Test_GetParamLDes(CStifItemParser& aItem ); + virtual TInt Test_RemoveSettingsRecord(CStifItemParser& aItem ); + virtual TInt Test_RemoveParam(CStifItemParser& aItem ); + virtual TInt Test_GetRepositoryKeyL(CStifItemParser& aItem); + + /** + * Method used to log version of test class + */ + void SendTestClassVersion(); + + //ADD NEW METHOD DEC HERE + //[TestMethods] - Do not remove + + public: // Data + // ?one_line_short_description_of_data + //?data_declaration; + TInt iXmppSettingId; + TInt iXmppSnapId; + TInt iXmppServerPort; + TInt iMessageToneVolume; + TInt iLastRegistrationError; + + TBool iPublishOnThePhoneStatus; + TBool iRoamingWarning; + TBool iAllowBuddyReq; + TBool iAutoLogin; + TBool iDefaultProfile; + + HBufC* iMessageTone; + HBufC* iSnapName; + HBufC* iSettingsName; + HBufC* iStackVersion; + HBufC* iXmppServerAddress; + HBufC* iUsername; + HBufC* iPassword; + HBufC* iConnectionServer1; + HBufC* iConnectionServer2; + TUint32 iSettingId; + RArray iSettingIdArray; + + CXmppSettingsApi* iApi; + + + + + 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 // XMPPSETTINGS_API_H + +// End of File diff -r 000000000000 -r e6b17d312c8b imsrv_plat/xmpp_settings_api/tsrc/init/TestFramework.ini --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/xmpp_settings_api/tsrc/init/TestFramework.ini Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,45 @@ +# +# This is STIFTestFramework initialization file +# Comment lines start with '#'-character. +# See STIF TestFramework users guide.doc for instructions + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + +[Engine_Defaults] + +TestReportMode= FullReport # Possible values are: 'Empty', 'Summary', 'Environment', + 'TestCases' or 'FullReport' + +CreateTestReport= YES # Possible values: YES or NO + +TestReportFilePath= C:\LOGS\TestFramework\ +TestReportFileName= TestReport + +TestReportFormat= TXT # Possible values: TXT or HTML +TestReportOutput= FILE # Possible values: FILE or RDEBUG +TestReportFileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND + +DeviceResetDllName= StifResetForNokia.dll # e.g. 'StifHWResetStub.dll' for user specific reseting + +[End_Defaults] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Module configurations start + +[New_Module] +ModuleName= testscripter +TestCaseFile= C:\testframework\xmppsettings_api.cfg +[End_Module] + + + + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + +[Logger_Defaults] + +[End_Logger_Defaults] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + +# End of file diff -r 000000000000 -r e6b17d312c8b imsrv_plat/xmpp_settings_api/tsrc/src/xmppsettings_api.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/xmpp_settings_api/tsrc/src/xmppsettings_api.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,254 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: This file contains testclass implementation. +* +*/ + +// INCLUDE FILES +#include +#include "xmppsettings_api.h" +#include +#include + +// EXTERNAL DATA STRUCTURES +//extern ?external_data; + +// EXTERNAL FUNCTION PROTOTYPES +//extern ?external_function( ?arg_type,?arg_type ); + +// CONSTANTS +//const ?type ?constant_var = ?constant; + +// MACROS +//#define ?macro ?macro_def + +// LOCAL CONSTANTS AND MACROS +//const ?type ?constant_var = ?constant; +//#define ?macro_name ?macro_def + +// MODULE DATA STRUCTURES +//enum ?declaration +//typedef ?declaration + +// LOCAL FUNCTION PROTOTYPES +//?type ?function_name( ?arg_type, ?arg_type ); + +// FORWARD DECLARATIONS +//class ?FORWARD_CLASSNAME; + +// ============================= LOCAL FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// ?function_name ?description. +// ?description +// Returns: ?value_1: ?description +// ?value_n: ?description_line1 +// ?description_line2 +// ----------------------------------------------------------------------------- +// +/* +?type ?function_name( + ?arg_type arg, // ?description + ?arg_type arg) // ?description + { + + ?code // ?comment + + // ?comment + ?code + } +*/ + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// Cxmppsettings_api::Cxmppsettings_api +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +Cxmppsettings_api::Cxmppsettings_api( + CTestModuleIf& aTestModuleIf ): + CScriptBase( aTestModuleIf ) + { + } + +// ----------------------------------------------------------------------------- +// Cxmppsettings_api::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void Cxmppsettings_api::ConstructL() + { + iXmppSettingId = 0; + iXmppSnapId = 15; + + iXmppServerPort = 5223; + iMessageToneVolume = 7; + iLastRegistrationError = KErrNone; + + iPublishOnThePhoneStatus = ETrue; + iRoamingWarning = ETrue; + iAllowBuddyReq = ETrue; + iAutoLogin = EFalse; + iDefaultProfile = ETrue; + + iApi = CXmppSettingsApi::NewL(); + iMessageTone = HBufC::NewL( 50 ); + iMessageTone->Des().Copy( _L("c:\\system\\tones\\diipadaapa.wav") ); + + // LOGARG16("messagetone path: %S", iMessageTone); + + iSnapName = HBufC::NewL( 50 ); + iSnapName->Des().Copy( _L("Internet") ); + + iSettingsName = HBufC::NewL( 50 ); + iSettingsName->Des().Copy( _L("XMPP-SETTING 1") ); + + iStackVersion = HBufC::NewL( 50 ); + iStackVersion->Des().Copy( _L("XMPP STACK V1.021 build 127") ); + + iXmppServerAddress = HBufC::NewL( 50 ); + iXmppServerAddress->Des().Copy( _L("chat.gizmoproject.com") ); + + iUsername = HBufC::NewL( 50 ); + iUsername->Des().Copy( _L("lassi") ); + + iPassword = HBufC::NewL( 50 ); + iPassword->Des().Copy( _L("lassi123") ); + + iConnectionServer1 = HBufC::NewL( 50 ); + iConnectionServer1->Des().Copy( _L("Con.Server.gizmo.com") ); + + iConnectionServer2 = HBufC::NewL( 50 ); + iConnectionServer2->Des().Copy( _L("Con2.Server.gizmo.com") ); + + + + //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(Kxmppsettings_apiLogFileWithTitle, &title); + } + else + { + logFileName.Copy(Kxmppsettings_apiLogFile); + } + + iLog = CStifLogger::NewL( Kxmppsettings_apiLogPath, + logFileName, + CStifLogger::ETxt, + CStifLogger::EFile, + EFalse ); + + SendTestClassVersion(); + } + +// ----------------------------------------------------------------------------- +// Cxmppsettings_api::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +Cxmppsettings_api* Cxmppsettings_api::NewL( + CTestModuleIf& aTestModuleIf ) + { + Cxmppsettings_api* self = new (ELeave) Cxmppsettings_api( aTestModuleIf ); + + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); + + return self; + + } + +// Destructor +Cxmppsettings_api::~Cxmppsettings_api() + { + + // Delete resources allocated from test methods + Delete(); + delete iMessageTone; + delete iSnapName; + delete iSettingsName; + delete iStackVersion; + delete iXmppServerAddress; + delete iUsername; + delete iPassword; + delete iConnectionServer1; + delete iConnectionServer2; + delete iApi; + // Delete logger + delete iLog; + + } + +//----------------------------------------------------------------------------- +// Cxmppsettings_api::SendTestClassVersion +// Method used to send version of test class +//----------------------------------------------------------------------------- +// +void Cxmppsettings_api::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("xmppsettings_api.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* ) Cxmppsettings_api::NewL( aTestModuleIf ); + + } + + +// End of File diff -r 000000000000 -r e6b17d312c8b imsrv_plat/xmpp_settings_api/tsrc/src/xmppsettings_apiBlocks.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/xmpp_settings_api/tsrc/src/xmppsettings_apiBlocks.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,605 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: This file contains testclass implementation. +* +*/ + +// [INCLUDE FILES] - do not remove +#include +#include +#include +#include "xmppsettings_api.h" +#include +#include + +// EXTERNAL DATA STRUCTURES +//extern ?external_data; +const TUid KXmppSettingsApiCenRep ={0x1020e334}; +_LIT( KParamName, "XMPP-PARAM-NUMBER-0x%08d"); +_LIT( KParamValue16, "param value - 0x%08d"); +// 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 + } +*/ +void Cxmppsettings_api::ResetRepository() + { + CRepository* rep = CRepository::NewL( KXmppSettingsApiCenRep ); + User::LeaveIfError( rep->Reset() ); + delete rep; + } +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// Cxmppsettings_api::Delete +// Delete here all resources allocated and opened from test methods. +// Called from destructor. +// ----------------------------------------------------------------------------- +// +void Cxmppsettings_api::Delete() + { + + } + +// ----------------------------------------------------------------------------- +// Cxmppsettings_api::RunMethodL +// Run specified method. Contains also table of test mothods and their names. +// ----------------------------------------------------------------------------- +// +TInt Cxmppsettings_api::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( "Test_CreateSettingsRecordL", Cxmppsettings_api::Test_CreateSettingsRecordL ), + ENTRY( "Test_DefaultSettingsRecord", Cxmppsettings_api::Test_DefaultSettingsRecord ), + ENTRY( "Test_GetSettingsRecordIdArray", Cxmppsettings_api::Test_GetSettingsRecordIdArray ), + ENTRY( "Test_SetParamInt", Cxmppsettings_api::Test_SetParamInt ), + ENTRY( "Test_SetParamLDes", Cxmppsettings_api::Test_SetParamLDes ), + ENTRY( "Test_GetParamInt", Cxmppsettings_api::Test_GetParamInt ), + ENTRY( "Test_GetParamLDes", Cxmppsettings_api::Test_GetParamLDes ), + ENTRY( "Test_RemoveSettingsRecord", Cxmppsettings_api::Test_RemoveSettingsRecord ), + ENTRY( "Test_RemoveParam", Cxmppsettings_api::Test_RemoveParam ), + ENTRY( "Test_GetRepositoryKeyL", Cxmppsettings_api::Test_GetRepositoryKeyL ), + + + //ADD NEW ENTRY HERE + // [test cases entries] - Do not remove + + }; + + const TInt count = sizeof( KFunctions ) / + sizeof( TStifFunctionInfo ); + + return RunInternalL( KFunctions, count, aItem ); + + } + +// ----------------------------------------------------------------------------- +// Cxmppsettings_api::ExampleL +// Example test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Cxmppsettings_api::Test_CreateSettingsRecordL( CStifItemParser& aItem ) + { + + ResetRepository(); + iApi->CreateSettingsRecordL( iSettingId ); + if(0==iSettingId) + { + return KErrGeneral; + } + + RArray array; + + iApi->GetSettingsRecordIdArrayL( array ); + TInt arraycount = array.Count(); + if(0==arraycount) + { + return KErrGeneral; + } + if(iSettingId!=array[0]) + { + return KErrGeneral; + } + array.Reset(); + array.Close(); + ResetRepository(); + TInt count = 5; + for (TInt i=0; i< count; i++ ) + { + iApi->CreateSettingsRecordL( iSettingId ) ; + } + iApi->GetSettingsRecordIdArrayL( array ); + arraycount = array.Count(); + if(count!=arraycount) + { + return KErrGeneral; + } + array.Reset(); + array.Close(); + ResetRepository(); + return KErrNone; + } + +TInt Cxmppsettings_api::Test_DefaultSettingsRecord( CStifItemParser& aItem ) + { + ResetRepository(); + iApi->CreateSettingsRecordL( iSettingId ); + TUint32 settingId; + iApi->DefaultSettingsRecordL( settingId ); + if(settingId!=iSettingId) + { + return KErrGeneral; + } + ResetRepository(); + return KErrNone; + + } + +TInt Cxmppsettings_api::Test_GetSettingsRecordIdArray( CStifItemParser& aItem ) + { + + ResetRepository(); + iApi->CreateSettingsRecordL( iSettingId ); + if(0==iSettingId) + { + return KErrGeneral; + } + + RArray array; + + iApi->GetSettingsRecordIdArrayL( array ); + TInt arraycount = array.Count(); + if(0==arraycount) + { + return KErrGeneral; + } + if(iSettingId!=array[0]) + { + return KErrGeneral; + } + array.Reset(); + array.Close(); + ResetRepository(); + TInt count = 5; + for (TInt i=0; i< count; i++ ) + { + iApi->CreateSettingsRecordL( iSettingId ) ; + } + iApi->GetSettingsRecordIdArrayL( array ); + arraycount = array.Count(); + if(count!=arraycount) + { + return KErrGeneral; + } + array.Reset(); + array.Close(); + ResetRepository(); + return KErrNone; + } +TInt Cxmppsettings_api::Test_SetParamInt( CStifItemParser& aItem ) + { + ResetRepository(); + iApi->CreateSettingsRecordL( iSettingId ); + + _LIT( KParamName, "XMPP-PARAM-NUMBER-0x%08d"); + + TInt count = 128; // 0xFF + TInt err; + for (TInt i=0; i < count; i++ ) + { + HBufC* paramName = HBufC::NewL( KParamName().Length()+20 ); + paramName->Des().AppendFormat( KParamName(), i ); + + TInt paramValue(i); + + TRAP(err,iApi->SetParamL( iSettingId, *paramName, paramValue)); + if(err!=KErrNone) + { + ResetRepository(); + return KErrGeneral; + } + + delete paramName; + } + ResetRepository(); + return KErrNone; + } + +TInt Cxmppsettings_api::Test_SetParamLDes( CStifItemParser& aItem ) + { + TInt err; + ResetRepository(); + iApi->CreateSettingsRecordL( iSettingId ); + + TInt count = 128; // 0xFF + + for (TInt i=0; i < count; i++ ) + { + HBufC* paramName = HBufC::NewL( KParamName().Length()+20 ); + paramName->Des().AppendFormat( KParamName(), i ); + + HBufC* paramValue = HBufC::NewL( KParamValue16().Length()+20 ); + paramValue->Des().AppendFormat( KParamValue16(), i ); + + TRAP(err,iApi->SetParamL( iSettingId, *paramName, *paramValue)); + if(err!=KErrNone) + { + ResetRepository(); + delete paramName; + delete paramValue; + return KErrGeneral; + } + + delete paramName; + delete paramValue; + } + ResetRepository(); + return KErrNone; + + } + +TInt Cxmppsettings_api::Test_GetParamInt( CStifItemParser& aItem ) + { + ResetRepository(); + iApi->CreateSettingsRecordL( iSettingId ); + + _LIT( KParamName, "XMPP-PARAM-NUMBER-0x%08d"); + + TInt count = 128; // 0xFF + TInt err; + for (TInt i=0; i < count; i++ ) + { + HBufC* paramName = HBufC::NewL( KParamName().Length()+20 ); + paramName->Des().AppendFormat( KParamName(), i ); + + TInt paramValue(i); + + TRAP(err,iApi->SetParamL( iSettingId, *paramName, paramValue)); + if(err!=KErrNone) + { + ResetRepository(); + return KErrGeneral; + } + + delete paramName; + } + for ( TInt i=0; i < count; i++ ) + { + HBufC* paramName = HBufC::NewL( KParamName().Length()+20 ); + paramName->Des().AppendFormat( KParamName(), i ); + + TInt paramValue(0); + + iApi->GetParamL( iSettingId,*paramName,paramValue); + + if( i!= paramValue) + { + return KErrGeneral; + } + + delete paramName; + } + ResetRepository(); + return KErrNone; + } + +TInt Cxmppsettings_api::Test_GetParamLDes( CStifItemParser& aItem ) + { + ResetRepository(); + iApi->CreateSettingsRecordL( iSettingId ); + + _LIT( KParamName, "XMPP-PARAM-NUMBER-0x%08d"); + + TInt count = 128; // 0xFF + TInt err; + for (TInt i=0; i < count; i++ ) + { + HBufC* paramName = HBufC::NewL( KParamName().Length()+20 ); + paramName->Des().AppendFormat( KParamName(), i ); + + HBufC* paramValue = HBufC::NewL( KParamValue16().Length()+20 ); + paramValue->Des().AppendFormat( KParamValue16(), i ); + + TRAP(err,iApi->SetParamL( iSettingId, *paramName, *paramValue)); + if(err!=KErrNone) + { + ResetRepository(); + delete paramName; + delete paramValue; + return KErrGeneral; + } + + delete paramName; + delete paramValue; + } + for ( TInt i=0; i < count; i++ ) + { + HBufC* paramName = HBufC::NewL( KParamName().Length()+20 ); + paramName->Des().AppendFormat( KParamName(), i ); + + HBufC* paramValue = HBufC::NewL( KParamValue16().Length()+20 ); + paramValue->Des().AppendFormat( KParamValue16(), i ); + + RBuf buf; + buf.CreateL( 255 ); + + TRAP(err,iApi->GetParamL( iSettingId,*paramName, buf) ); + + if(err!=KErrNone) + { + return KErrGeneral; + } + //*paramValue, buf, ; + + delete paramName; + delete paramValue; + + buf.Close(); + } + ResetRepository(); + return KErrNone; + } + +TInt Cxmppsettings_api::Test_RemoveSettingsRecord( CStifItemParser& aItem ) + { + ResetRepository(); + iApi->CreateSettingsRecordL( iSettingId ); + iApi->RemoveSettingsRecordL( iSettingId ); + + RArray array; + + iApi->GetSettingsRecordIdArrayL( array ); + TInt arraycount = array.Count(); + if(1==arraycount) + { + return KErrGeneral; + } + + array.Reset(); + + iSettingId = 0; + + ResetRepository(); + + TInt count = 128; + + for (TInt i=1; i< count; i++ ) + { + iApi->CreateSettingsRecordL( iSettingId); + } + + // because cen rep is reseted after every test, indexes should start + // from zero and go up to count. So its safe to assume that these + // indexes exist :) + + iApi->RemoveSettingsRecordL( 1 ); + iApi->RemoveSettingsRecordL( 55 ); + iApi->RemoveSettingsRecordL( 123 ); + iApi->RemoveSettingsRecordL( 96 ) ; + iApi->RemoveSettingsRecordL( 2 ); + + iApi->GetSettingsRecordIdArrayL( array ); + arraycount = array.Count(); + if((count-6)!=arraycount) + { + return KErrGeneral; + } + + for( TInt i=0; i < array.Count(); i++ ) + { + iApi->RemoveSettingsRecordL( array[i] ); + } + + array.Reset(); + iApi->GetSettingsRecordIdArrayL( array ); + if( 0!=(array.Count())) + { + return KErrGeneral; + } + array.Reset(); + array.Close(); + ResetRepository(); + return KErrNone; + + } +TInt Cxmppsettings_api::Test_RemoveParam( CStifItemParser& aItem ) + { + + + ResetRepository(); + iApi->CreateSettingsRecordL( iSettingId ); + + _LIT( KParamName, "XMPP-PARAM-NUMBER-0x%08d"); + + TInt count = 128; // 0xFF + TInt err; + for (TInt i=0; i < count; i++ ) + { + HBufC* paramName = HBufC::NewL( KParamName().Length()+20 ); + paramName->Des().AppendFormat( KParamName(), i ); + + TInt paramValue(i); + + TRAP(err,iApi->SetParamL( iSettingId, *paramName, paramValue)); + if(err!=KErrNone) + { + ResetRepository(); + return KErrGeneral; + } + + delete paramName; + } + + count = 128; // 0xFF + + TInt param = 56; + + HBufC* paramName = HBufC::NewL( KParamName().Length()+20 ); + paramName->Des().AppendFormat( KParamName(), param ); + + iApi->RemoveParamL( iSettingId,*paramName); + TInt paramvalue; + + TRAP(err,iApi->GetParamL( iSettingId,*paramName,paramvalue)); + if(err!= -1) + { + return KErrGeneral; + } + iApi->SetParamL( iSettingId,*paramName,12345); + delete paramName; + + for (TInt i=0; i < count; i++ ) + { + HBufC* paramName = HBufC::NewL( KParamName().Length() + 20 ); + paramName->Des().AppendFormat( KParamName(), i ); + + iApi->RemoveParamL( iSettingId,*paramName); + + delete paramName; + } + + + ResetRepository(); + return KErrNone; + + + } +TInt Cxmppsettings_api::Test_GetRepositoryKeyL( CStifItemParser& aItem ) + { + ResetRepository(); + iApi->CreateSettingsRecordL( iSettingId ); + + _LIT( KParamName, "XMPP-PARAM-NUMBER-0x%08d"); + + TInt count = 128; // 0xFF + TInt err; + for (TInt i=0; i < count; i++ ) + { + HBufC* paramName = HBufC::NewL( KParamName().Length()+20 ); + paramName->Des().AppendFormat( KParamName(), i ); + + HBufC* paramValue = HBufC::NewL( KParamValue16().Length()+20 ); + paramValue->Des().AppendFormat( KParamValue16(), i ); + + TRAP(err,iApi->SetParamL( iSettingId, *paramName, *paramValue)); + if(err!=KErrNone) + { + ResetRepository(); + delete paramName; + delete paramValue; + return KErrGeneral; + } + TBool CreateColumnIfNotExist = EFalse ; + TUint32 TheKey; + TRAP(err,iApi->GetRepositoryKeyL( iSettingId, + *paramName, + CreateColumnIfNotExist, + TheKey )); + delete paramName; + delete paramValue; + } + for ( TInt i=0; i < count; i++ ) + { + HBufC* paramName = HBufC::NewL( KParamName().Length()+20 ); + paramName->Des().AppendFormat( KParamName(), i ); + + HBufC* paramValue = HBufC::NewL( KParamValue16().Length()+20 ); + paramValue->Des().AppendFormat( KParamValue16(), i ); + + RBuf buf; + buf.CreateL( 255 ); + + TRAP(err,iApi->GetParamL( iSettingId,*paramName, buf) ); + + if(err!=KErrNone) + { + return KErrGeneral; + } + //*paramValue, buf, ; + + delete paramName; + delete paramValue; + + buf.Close(); + } + ResetRepository(); + return KErrNone; + } +// ----------------------------------------------------------------------------- +// Cxmppsettings_api::?member_function +// ?implementation_description +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +/* +TInt Cxmppsettings_api::?member_function( + CItemParser& aItem ) + { + + ?code + + } +*/ + +// ========================== OTHER EXPORTED FUNCTIONS ========================= +// None + +// [End of File] - Do not remove diff -r 000000000000 -r e6b17d312c8b imsrv_plat/xmpp_settings_api/xmpp_settings_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imsrv_plat/xmpp_settings_api/xmpp_settings_api.metaxml Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,14 @@ + + +xmpp_settings_api +This is a API that provides read and write facility for protocol specific settings. +c++ +xmppsettingsapi + + + + +yes +no + + diff -r 000000000000 -r e6b17d312c8b layers.sysdef.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/layers.sysdef.xml Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,14 @@ + + +]> + + + + + + + + + + \ No newline at end of file diff -r 000000000000 -r e6b17d312c8b package_definition.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/package_definition.xml Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,111 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 000000000000 -r e6b17d312c8b sysdef_1_4_0.dtd --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sysdef_1_4_0.dtd Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,86 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 000000000000 -r e6b17d312c8b ximpfw/core/bwins/ximpdatamodelu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/bwins/ximpdatamodelu.def Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,116 @@ +EXPORTS + ??0CXIMPApiDataObjBase@@QAE@XZ @ 1 NONAME ; CXIMPApiDataObjBase::CXIMPApiDataObjBase(void) + ??0CXIMPApiEventBase@@QAE@XZ @ 2 NONAME ; CXIMPApiEventBase::CXIMPApiEventBase(void) + ??0CXIMPApiObjBase@@IAE@XZ @ 3 NONAME ; CXIMPApiObjBase::CXIMPApiObjBase(void) + ??0CXIMPConfigurationItemBase@@QAE@AAVMXIMPItemParentBase@@@Z @ 4 NONAME ; CXIMPConfigurationItemBase::CXIMPConfigurationItemBase(class MXIMPItemParentBase &) + ??0CXIMPSubscriptionItemBase@@QAE@AAVMXIMPItemParentBase@@@Z @ 5 NONAME ; CXIMPSubscriptionItemBase::CXIMPSubscriptionItemBase(class MXIMPItemParentBase &) + ??1CXIMPApiDataObjBase@@UAE@XZ @ 6 NONAME ; CXIMPApiDataObjBase::~CXIMPApiDataObjBase(void) + ??1CXIMPApiEventBase@@UAE@XZ @ 7 NONAME ; CXIMPApiEventBase::~CXIMPApiEventBase(void) + ??1CXIMPApiObjBase@@UAE@XZ @ 8 NONAME ; CXIMPApiObjBase::~CXIMPApiObjBase(void) + ??1CXIMPConfigurationItemBase@@UAE@XZ @ 9 NONAME ; CXIMPConfigurationItemBase::~CXIMPConfigurationItemBase(void) + ??1CXIMPSubscriptionItemBase@@MAE@XZ @ 10 NONAME ; CXIMPSubscriptionItemBase::~CXIMPSubscriptionItemBase(void) + ??9CXIMPIdentityImp@@QBEHABV0@@Z @ 11 NONAME ; int CXIMPIdentityImp::operator!=(class CXIMPIdentityImp const &) const + ?Accessor@FeaturePluginHolder@@SAPAVMApiDataObjFactoryAccessor@@H@Z @ 12 NONAME ; class MApiDataObjFactoryAccessor * FeaturePluginHolder::Accessor(int) + ?AccessorCount@FeaturePluginHolder@@SAHXZ @ 13 NONAME ; int FeaturePluginHolder::AccessorCount(void) + ?ActivateSubscriberL@CXIMPSubscriptionItemBase@@QAEXPAV1@@Z @ 14 NONAME ; void CXIMPSubscriptionItemBase::ActivateSubscriberL(class CXIMPSubscriptionItemBase *) + ?ActivateSubscriberL@CXIMPSubscriptionItemBase@@UAEXPAVMXIMPPscContext@@@Z @ 15 NONAME ; void CXIMPSubscriptionItemBase::ActivateSubscriberL(class MXIMPPscContext *) + ?AddConfiguratorL@CXIMPConfigurationItemBase@@QAEXPAV1@@Z @ 16 NONAME ; void CXIMPConfigurationItemBase::AddConfiguratorL(class CXIMPConfigurationItemBase *) + ?AddConfiguratorL@CXIMPConfigurationItemBase@@QAEXPAVMXIMPPscContext@@@Z @ 17 NONAME ; void CXIMPConfigurationItemBase::AddConfiguratorL(class MXIMPPscContext *) + ?AddFeatureL@CXIMPFeatureInfoImp@@QAEHABVTDesC8@@@Z @ 18 NONAME ; int CXIMPFeatureInfoImp::AddFeatureL(class TDesC8 const &) + ?AddSubscriberL@CXIMPSubscriptionItemBase@@QAEXPAV1@@Z @ 19 NONAME ; void CXIMPSubscriptionItemBase::AddSubscriberL(class CXIMPSubscriptionItemBase *) + ?AddSubscriberL@CXIMPSubscriptionItemBase@@QAEXPAVMXIMPPscContext@@@Z @ 20 NONAME ; void CXIMPSubscriptionItemBase::AddSubscriberL(class MXIMPPscContext *) + ?AppendParamL@CXIMPRequestCompleteEventImp@@QAEXPAVCXIMPApiDataObjBase@@@Z @ 21 NONAME ; void CXIMPRequestCompleteEventImp::AppendParamL(class CXIMPApiDataObjBase *) + ?BaseConstructL@CXIMPConfigurationItemBase@@QAEXXZ @ 22 NONAME ; void CXIMPConfigurationItemBase::BaseConstructL(void) + ?BaseConstructL@CXIMPSubscriptionItemBase@@QAEXXZ @ 23 NONAME ; void CXIMPSubscriptionItemBase::BaseConstructL(void) + ?ChangeStatusAfterAdd@CXIMPSubscriptionItemBase@@QAEXXZ @ 24 NONAME ; void CXIMPSubscriptionItemBase::ChangeStatusAfterAdd(void) + ?ChangeStatusAfterRemove@CXIMPSubscriptionItemBase@@QAEXXZ @ 25 NONAME ; void CXIMPSubscriptionItemBase::ChangeStatusAfterRemove(void) + ?CleanIfExpired@CXIMPSubscriptionItemBase@@QAEHXZ @ 26 NONAME ; int CXIMPSubscriptionItemBase::CleanIfExpired(void) + ?Compare@CXIMPIdentityImp@@QBEHABV1@@Z @ 27 NONAME ; int CXIMPIdentityImp::Compare(class CXIMPIdentityImp const &) const + ?CompletionResultImp@CXIMPRequestCompleteEventImp@@QAEAAVCXIMPStatusImp@@XZ @ 28 NONAME ; class CXIMPStatusImp & CXIMPRequestCompleteEventImp::CompletionResultImp(void) + ?ConfigurationStatus@CXIMPConfigurationItemBase@@QAE?AW4TConfigurationStatus@1@PAVMXIMPPscContext@@@Z @ 29 NONAME ; enum CXIMPConfigurationItemBase::TConfigurationStatus CXIMPConfigurationItemBase::ConfigurationStatus(class MXIMPPscContext *) + ?Context@CXIMPSubscriptionItemBase@@QAEAAVMXIMPPscContext@@H@Z @ 30 NONAME ; class MXIMPPscContext & CXIMPSubscriptionItemBase::Context(int) + ?ContextCount@CXIMPSubscriptionItemBase@@QBEHXZ @ 31 NONAME ; int CXIMPSubscriptionItemBase::ContextCount(void) const + ?ContextStateImp@CXIMPContextStateEventImp@@QAEAAVCXIMPContextStateImp@@XZ @ 32 NONAME ; class CXIMPContextStateImp & CXIMPContextStateEventImp::ContextStateImp(void) + ?CountOfSubscribers@CXIMPSubscriptionItemBase@@QAEHXZ @ 33 NONAME ; int CXIMPSubscriptionItemBase::CountOfSubscribers(void) + ?DataSubscriptionState@CXIMPSubscriptionItemBase@@QAEABVMXIMPDataSubscriptionState@@XZ @ 34 NONAME ; class MXIMPDataSubscriptionState const & CXIMPSubscriptionItemBase::DataSubscriptionState(void) + ?ExternalizeL@CXIMPContextEventFilter@@QBEXAAVRWriteStream@@@Z @ 35 NONAME ; void CXIMPContextEventFilter::ExternalizeL(class RWriteStream &) const + ?ExternalizeL@XIMPApiDataObjFactory@@SAXAAVRWriteStream@@ABV?$RArray@USXIMPReqParam@@@@@Z @ 36 NONAME ; void XIMPApiDataObjFactory::ExternalizeL(class RWriteStream &, class RArray const &) + ?ExternalizeL@XIMPApiDataObjFactory@@SAXAAVRWriteStream@@ABVCXIMPApiDataObjBase@@@Z @ 37 NONAME ; void XIMPApiDataObjFactory::ExternalizeL(class RWriteStream &, class CXIMPApiDataObjBase const &) + ?ForceClose@CXIMPConfigurationItemBase@@QAEXXZ @ 38 NONAME ; void CXIMPConfigurationItemBase::ForceClose(void) + ?ForceClose@CXIMPSubscriptionItemBase@@QAEXXZ @ 39 NONAME ; void CXIMPSubscriptionItemBase::ForceClose(void) + ?HandleUnknownGetInterface@CXIMPApiObjBase@@IBEPAXJW4TIfGetOps@MXIMPBase@@@Z @ 40 NONAME ; void * CXIMPApiObjBase::HandleUnknownGetInterface(long, enum MXIMPBase::TIfGetOps) const + ?InitializeL@FeaturePluginHolder@@SAXXZ @ 41 NONAME ; void FeaturePluginHolder::InitializeL(void) + ?InternalizeL@CXIMPContextClientInfoImp@@QAEXAAVRReadStream@@@Z @ 42 NONAME ; void CXIMPContextClientInfoImp::InternalizeL(class RReadStream &) + ?InternalizeL@CXIMPContextEventFilter@@QAEXAAVRReadStream@@@Z @ 43 NONAME ; void CXIMPContextEventFilter::InternalizeL(class RReadStream &) + ?InternalizeL@CXIMPContextStateImp@@QAEXAAVRReadStream@@@Z @ 44 NONAME ; void CXIMPContextStateImp::InternalizeL(class RReadStream &) + ?InternalizeL@CXIMPDataSubscriptionStateImp@@QAEXAAVRReadStream@@@Z @ 45 NONAME ; void CXIMPDataSubscriptionStateImp::InternalizeL(class RReadStream &) + ?InternalizeL@CXIMPFeatureInfoImp@@QAEXAAVRReadStream@@@Z @ 46 NONAME ; void CXIMPFeatureInfoImp::InternalizeL(class RReadStream &) + ?InternalizeL@CXIMPIdentityImp@@QAEXAAVRReadStream@@@Z @ 47 NONAME ; void CXIMPIdentityImp::InternalizeL(class RReadStream &) + ?InternalizeL@CXIMPProtocolInfoImp@@QAEXAAVRReadStream@@@Z @ 48 NONAME ; void CXIMPProtocolInfoImp::InternalizeL(class RReadStream &) + ?InternalizeL@CXIMPServiceInfoImp@@QAEXAAVRReadStream@@@Z @ 49 NONAME ; void CXIMPServiceInfoImp::InternalizeL(class RReadStream &) + ?InternalizeL@CXIMPStatusImp@@QAEXAAVRReadStream@@@Z @ 50 NONAME ; void CXIMPStatusImp::InternalizeL(class RReadStream &) + ?InternalizeL@XIMPApiDataObjFactory@@SAXAAVRReadStream@@AAV?$RArray@USXIMPReqParam@@@@@Z @ 51 NONAME ; void XIMPApiDataObjFactory::InternalizeL(class RReadStream &, class RArray &) + ?InternalizeLC@XIMPApiDataObjFactory@@SAPAVCXIMPApiDataObjBase@@AAVRReadStream@@@Z @ 52 NONAME ; class CXIMPApiDataObjBase * XIMPApiDataObjFactory::InternalizeLC(class RReadStream &) + ?IsContext@CXIMPConfigurationItemBase@@QBEHPAVMXIMPPscContext@@@Z @ 53 NONAME ; int CXIMPConfigurationItemBase::IsContext(class MXIMPPscContext *) const + ?IsContext@CXIMPSubscriptionItemBase@@QBEHPAVMXIMPPscContext@@@Z @ 54 NONAME ; int CXIMPSubscriptionItemBase::IsContext(class MXIMPPscContext *) const + ?IsEventAccepted@CXIMPContextEventFilter@@QBEHJ@Z @ 55 NONAME ; int CXIMPContextEventFilter::IsEventAccepted(long) const + ?Match@CXIMPContextClientInfoImp@@QBEHPBV1@@Z @ 56 NONAME ; int CXIMPContextClientInfoImp::Match(class CXIMPContextClientInfoImp const *) const + ?NewCombinedLC@CXIMPContextEventFilter@@SAPAV1@ABV?$TArray@PAVCXIMPContextEventFilter@@@@@Z @ 57 NONAME ; class CXIMPContextEventFilter * CXIMPContextEventFilter::NewCombinedLC(class TArray const &) + ?NewFromStreamLC@CXIMPContextClientInfoImp@@SAPAVCXIMPApiDataObjBase@@AAVRReadStream@@@Z @ 58 NONAME ; class CXIMPApiDataObjBase * CXIMPContextClientInfoImp::NewFromStreamLC(class RReadStream &) + ?NewFromStreamLC@CXIMPContextStateImp@@SAPAVCXIMPApiDataObjBase@@AAVRReadStream@@@Z @ 59 NONAME ; class CXIMPApiDataObjBase * CXIMPContextStateImp::NewFromStreamLC(class RReadStream &) + ?NewFromStreamLC@CXIMPDataSubscriptionStateImp@@SAPAVCXIMPApiDataObjBase@@AAVRReadStream@@@Z @ 60 NONAME ; class CXIMPApiDataObjBase * CXIMPDataSubscriptionStateImp::NewFromStreamLC(class RReadStream &) + ?NewFromStreamLC@CXIMPFeatureInfoImp@@SAPAVCXIMPApiDataObjBase@@AAVRReadStream@@@Z @ 61 NONAME ; class CXIMPApiDataObjBase * CXIMPFeatureInfoImp::NewFromStreamLC(class RReadStream &) + ?NewFromStreamLC@CXIMPIdentityImp@@SAPAVCXIMPApiDataObjBase@@AAVRReadStream@@@Z @ 62 NONAME ; class CXIMPApiDataObjBase * CXIMPIdentityImp::NewFromStreamLC(class RReadStream &) + ?NewFromStreamLC@CXIMPProtocolInfoImp@@SAPAVCXIMPApiDataObjBase@@AAVRReadStream@@@Z @ 63 NONAME ; class CXIMPApiDataObjBase * CXIMPProtocolInfoImp::NewFromStreamLC(class RReadStream &) + ?NewFromStreamLC@CXIMPServiceInfoImp@@SAPAVCXIMPApiDataObjBase@@AAVRReadStream@@@Z @ 64 NONAME ; class CXIMPApiDataObjBase * CXIMPServiceInfoImp::NewFromStreamLC(class RReadStream &) + ?NewFromStreamLC@CXIMPStatusImp@@SAPAVCXIMPApiDataObjBase@@AAVRReadStream@@@Z @ 65 NONAME ; class CXIMPApiDataObjBase * CXIMPStatusImp::NewFromStreamLC(class RReadStream &) + ?NewL@CXIMPContextClientInfoImp@@SAPAV1@XZ @ 66 NONAME ; class CXIMPContextClientInfoImp * CXIMPContextClientInfoImp::NewL(void) + ?NewL@CXIMPContextEventFilter@@SAPAV1@PBV?$TArray@J@@@Z @ 67 NONAME ; class CXIMPContextEventFilter * CXIMPContextEventFilter::NewL(class TArray const *) + ?NewL@CXIMPContextStateEventImp@@SAPAV1@XZ @ 68 NONAME ; class CXIMPContextStateEventImp * CXIMPContextStateEventImp::NewL(void) + ?NewL@CXIMPContextStateImp@@SAPAV1@XZ @ 69 NONAME ; class CXIMPContextStateImp * CXIMPContextStateImp::NewL(void) + ?NewL@CXIMPDataSubscriptionStateImp@@SAPAV1@XZ @ 70 NONAME ; class CXIMPDataSubscriptionStateImp * CXIMPDataSubscriptionStateImp::NewL(void) + ?NewL@CXIMPFeatureInfoImp@@SAPAV1@XZ @ 71 NONAME ; class CXIMPFeatureInfoImp * CXIMPFeatureInfoImp::NewL(void) + ?NewL@CXIMPIdentityImp@@SAPAV1@XZ @ 72 NONAME ; class CXIMPIdentityImp * CXIMPIdentityImp::NewL(void) + ?NewL@CXIMPObjectCollectionImp@@SAPAV1@XZ @ 73 NONAME ; class CXIMPObjectCollectionImp * CXIMPObjectCollectionImp::NewL(void) + ?NewL@CXIMPObjectFactoryImp@@SAPAV1@XZ @ 74 NONAME ; class CXIMPObjectFactoryImp * CXIMPObjectFactoryImp::NewL(void) + ?NewL@CXIMPRequestCompleteEventImp@@SAPAV1@XZ @ 75 NONAME ; class CXIMPRequestCompleteEventImp * CXIMPRequestCompleteEventImp::NewL(void) + ?NewL@CXIMPRestrictedObjectCollectionImp@@SAPAV1@H@Z @ 76 NONAME ; class CXIMPRestrictedObjectCollectionImp * CXIMPRestrictedObjectCollectionImp::NewL(int) + ?NewL@CXIMPServiceInfoImp@@SAPAV1@XZ @ 77 NONAME ; class CXIMPServiceInfoImp * CXIMPServiceInfoImp::NewL(void) + ?NewL@CXIMPStatusImp@@SAPAV1@XZ @ 78 NONAME ; class CXIMPStatusImp * CXIMPStatusImp::NewL(void) + ?NewLC@CXIMPContextClientInfoImp@@SAPAV1@XZ @ 79 NONAME ; class CXIMPContextClientInfoImp * CXIMPContextClientInfoImp::NewLC(void) + ?NewLC@CXIMPContextEventFilter@@SAPAV1@PBV?$TArray@J@@@Z @ 80 NONAME ; class CXIMPContextEventFilter * CXIMPContextEventFilter::NewLC(class TArray const *) + ?NewLC@CXIMPContextStateEventImp@@SAPAV1@XZ @ 81 NONAME ; class CXIMPContextStateEventImp * CXIMPContextStateEventImp::NewLC(void) + ?NewLC@CXIMPContextStateImp@@SAPAV1@XZ @ 82 NONAME ; class CXIMPContextStateImp * CXIMPContextStateImp::NewLC(void) + ?NewLC@CXIMPDataSubscriptionStateImp@@SAPAV1@XZ @ 83 NONAME ; class CXIMPDataSubscriptionStateImp * CXIMPDataSubscriptionStateImp::NewLC(void) + ?NewLC@CXIMPFeatureInfoImp@@SAPAV1@XZ @ 84 NONAME ; class CXIMPFeatureInfoImp * CXIMPFeatureInfoImp::NewLC(void) + ?NewLC@CXIMPIdentityImp@@SAPAV1@ABVTDesC16@@@Z @ 85 NONAME ; class CXIMPIdentityImp * CXIMPIdentityImp::NewLC(class TDesC16 const &) + ?NewLC@CXIMPIdentityImp@@SAPAV1@XZ @ 86 NONAME ; class CXIMPIdentityImp * CXIMPIdentityImp::NewLC(void) + ?NewLC@CXIMPObjectCollectionImp@@SAPAV1@XZ @ 87 NONAME ; class CXIMPObjectCollectionImp * CXIMPObjectCollectionImp::NewLC(void) + ?NewLC@CXIMPProtocolInfoImp@@SAPAV1@ABVTDesC16@@VTUid@@ABVCXIMPFeatureInfoImp@@@Z @ 88 NONAME ; class CXIMPProtocolInfoImp * CXIMPProtocolInfoImp::NewLC(class TDesC16 const &, class TUid, class CXIMPFeatureInfoImp const &) + ?NewLC@CXIMPProtocolInfoImp@@SAPAV1@XZ @ 89 NONAME ; class CXIMPProtocolInfoImp * CXIMPProtocolInfoImp::NewLC(void) + ?NewLC@CXIMPRequestCompleteEventImp@@SAPAV1@AAVTXIMPRequestId@@H@Z @ 90 NONAME ; class CXIMPRequestCompleteEventImp * CXIMPRequestCompleteEventImp::NewLC(class TXIMPRequestId &, int) + ?NewLC@CXIMPRestrictedObjectCollectionImp@@SAPAV1@H@Z @ 91 NONAME ; class CXIMPRestrictedObjectCollectionImp * CXIMPRestrictedObjectCollectionImp::NewLC(int) + ?NewLC@CXIMPServiceInfoImp@@SAPAV1@VTUid@@ABVTDesC16@@11J@Z @ 92 NONAME ; class CXIMPServiceInfoImp * CXIMPServiceInfoImp::NewLC(class TUid, class TDesC16 const &, class TDesC16 const &, class TDesC16 const &, long) + ?NewLC@CXIMPServiceInfoImp@@SAPAV1@XZ @ 93 NONAME ; class CXIMPServiceInfoImp * CXIMPServiceInfoImp::NewLC(void) + ?NewLC@CXIMPStatusImp@@SAPAV1@XZ @ 94 NONAME ; class CXIMPStatusImp * CXIMPStatusImp::NewLC(void) + ?PackL@XIMPEventCodec@@SAPAVHBufC8@@AAVCXIMPApiEventBase@@AAJ@Z @ 95 NONAME ; class HBufC8 * XIMPEventCodec::PackL(class CXIMPApiEventBase &, long &) + ?PackL@XIMPEventCodec@@SAXAAVCXIMPApiEventBase@@AAJPAVCBufFlat@@@Z @ 96 NONAME ; void XIMPEventCodec::PackL(class CXIMPApiEventBase &, long &, class CBufFlat *) + ?PresenceObjFactoryAccessor@FeaturePluginHolder@@SAPAVMApiDataObjFactoryAccessor@@XZ @ 97 NONAME ; class MApiDataObjFactoryAccessor * FeaturePluginHolder::PresenceObjFactoryAccessor(void) + ?Release@FeaturePluginHolder@@SAXXZ @ 98 NONAME ; void FeaturePluginHolder::Release(void) + ?RemoveConfigurator@CXIMPConfigurationItemBase@@QAEXPAV1@@Z @ 99 NONAME ; void CXIMPConfigurationItemBase::RemoveConfigurator(class CXIMPConfigurationItemBase *) + ?RemoveConfigurator@CXIMPConfigurationItemBase@@QAEXPAVMXIMPPscContext@@@Z @ 100 NONAME ; void CXIMPConfigurationItemBase::RemoveConfigurator(class MXIMPPscContext *) + ?RemoveSubscriber@CXIMPSubscriptionItemBase@@QAEXPAV1@@Z @ 101 NONAME ; void CXIMPSubscriptionItemBase::RemoveSubscriber(class CXIMPSubscriptionItemBase *) + ?RemoveSubscriber@CXIMPSubscriptionItemBase@@QAEXPAVMXIMPPscContext@@@Z @ 102 NONAME ; void CXIMPSubscriptionItemBase::RemoveSubscriber(class MXIMPPscContext *) + ?SetDataSubscriptionStateL@CXIMPSubscriptionItemBase@@UAEXAAVCXIMPDataSubscriptionStateImp@@@Z @ 103 NONAME ; void CXIMPSubscriptionItemBase::SetDataSubscriptionStateL(class CXIMPDataSubscriptionStateImp &) + ?SetObjectOwnership@CXIMPRestrictedObjectCollectionImp@@QAEXH@Z @ 104 NONAME ; void CXIMPRestrictedObjectCollectionImp::SetObjectOwnership(int) + ?SetRequestId@CXIMPRequestCompleteEventImp@@QAEXABVTXIMPRequestId@@@Z @ 105 NONAME ; void CXIMPRequestCompleteEventImp::SetRequestId(class TXIMPRequestId const &) + ?SetStateChangeReasonImp@CXIMPContextStateEventImp@@QAEXPAVCXIMPStatusImp@@@Z @ 106 NONAME ; void CXIMPContextStateEventImp::SetStateChangeReasonImp(class CXIMPStatusImp *) + ?SetStateValue@CXIMPContextStateImp@@QAEXW4TState@MXIMPContextState@@@Z @ 107 NONAME ; void CXIMPContextStateImp::SetStateValue(enum MXIMPContextState::TState) + ?StateChangeReasonImp@CXIMPContextStateEventImp@@QAEPAVCXIMPStatusImp@@XZ @ 108 NONAME ; class CXIMPStatusImp * CXIMPContextStateEventImp::StateChangeReasonImp(void) + ?StatusLC@CXIMPSubscriptionItemBase@@QBEPAVCXIMPDataSubscriptionStateImp@@PAVMXIMPPscContext@@@Z @ 109 NONAME ; class CXIMPDataSubscriptionStateImp * CXIMPSubscriptionItemBase::StatusLC(class MXIMPPscContext *) const + ?SubscriptionStatus@CXIMPSubscriptionItemBase@@QAE?AW4TSubscriptionStatus@1@PAVMXIMPPscContext@@@Z @ 110 NONAME ; enum CXIMPSubscriptionItemBase::TSubscriptionStatus CXIMPSubscriptionItemBase::SubscriptionStatus(class MXIMPPscContext *) + ?SynthesiseSubscriptionEventToAllCtxsL@CXIMPSubscriptionItemBase@@UAEXXZ @ 111 NONAME ; void CXIMPSubscriptionItemBase::SynthesiseSubscriptionEventToAllCtxsL(void) + ?UnPackL@XIMPEventCodec@@SAPAVCXIMPApiEventBase@@ABVTDesC8@@AAJ@Z @ 112 NONAME ; class CXIMPApiEventBase * XIMPEventCodec::UnPackL(class TDesC8 const &, long &) + ?UpdateExpirationL@CXIMPSubscriptionItemBase@@QAEXXZ @ 113 NONAME ; void CXIMPSubscriptionItemBase::UpdateExpirationL(void) + ?UpdateSubscriptionStateL@CXIMPSubscriptionItemBase@@QAEXW4TSubscriptionEvent@1@@Z @ 114 NONAME ; void CXIMPSubscriptionItemBase::UpdateSubscriptionStateL(enum CXIMPSubscriptionItemBase::TSubscriptionEvent) + diff -r 000000000000 -r e6b17d312c8b ximpfw/core/bwins/ximpmanageru.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/bwins/ximpmanageru.def Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + ?NewMXIMPClientL@CXIMPClientImp@@SAPAVMXIMPClient@@XZ @ 1 NONAME ; class MXIMPClient * CXIMPClientImp::NewMXIMPClientL(void) + diff -r 000000000000 -r e6b17d312c8b ximpfw/core/bwins/ximpoperationsu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/bwins/ximpoperationsu.def Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,7 @@ +EXPORTS + ??0CXIMPOperationBind2@@QAE@XZ @ 1 NONAME ; CXIMPOperationBind2::CXIMPOperationBind2(void) + ??0CXIMPOperationBind@@QAE@XZ @ 2 NONAME ; CXIMPOperationBind::CXIMPOperationBind(void) + ??0CXIMPOperationForcedTeardown@@QAE@XZ @ 3 NONAME ; CXIMPOperationForcedTeardown::CXIMPOperationForcedTeardown(void) + ??0CXIMPOperationUnbind@@QAE@XZ @ 4 NONAME ; CXIMPOperationUnbind::CXIMPOperationUnbind(void) + ?NewL@CXIMPOperationFactory@@SAPAV1@XZ @ 5 NONAME ; class CXIMPOperationFactory * CXIMPOperationFactory::NewL(void) + diff -r 000000000000 -r e6b17d312c8b ximpfw/core/bwins/ximpprocessoru.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/bwins/ximpprocessoru.def Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,97 @@ +EXPORTS + ??0CXIMPOperationBase@@QAE@XZ @ 1 NONAME ; CXIMPOperationBase::CXIMPOperationBase(void) + ??1CXIMPOperationBase@@UAE@XZ @ 2 NONAME ; CXIMPOperationBase::~CXIMPOperationBase(void) + ?ActivateEventL@CXIMPEventManager@@QAEXAAVCXIMPApiEventBase@@PAVCXIMPPscContext@@@Z @ 3 NONAME ; void CXIMPEventManager::ActivateEventL(class CXIMPApiEventBase &, class CXIMPPscContext *) + ?ActivateRequestCompleteEvent@CXIMPEventManager@@QAEXAAVCXIMPRequestCompleteEventImp@@PAVCXIMPPscContext@@@Z @ 4 NONAME ; void CXIMPEventManager::ActivateRequestCompleteEvent(class CXIMPRequestCompleteEventImp &, class CXIMPPscContext *) + ?AddEventL@CXIMPEventManager@@QAEXAAVCXIMPApiEventBase@@AAV?$RPointerArray@VCXIMPPscContext@@@@@Z @ 5 NONAME ; void CXIMPEventManager::AddEventL(class CXIMPApiEventBase &, class RPointerArray &) + ?AddEventL@CXIMPEventManager@@QAEXAAVCXIMPApiEventBase@@PAVCXIMPPscContext@@@Z @ 6 NONAME ; void CXIMPEventManager::AddEventL(class CXIMPApiEventBase &, class CXIMPPscContext *) + ?AddNewOperationL@CXIMPPscContext@@QAE?AVTXIMPRequestId@@HABVTDesC8@@@Z @ 7 NONAME ; class TXIMPRequestId CXIMPPscContext::AddNewOperationL(int, class TDesC8 const &) + ?AppendToOpQueueL@CXIMPPscContext@@QAEXPAVCXIMPOperationBase@@@Z @ 8 NONAME ; void CXIMPPscContext::AppendToOpQueueL(class CXIMPOperationBase *) + ?AppendToOpQueueUpdateReqIdL@CXIMPPscContext@@QAE?AVTXIMPRequestId@@PAVCXIMPOperationBase@@@Z @ 9 NONAME ; class TXIMPRequestId CXIMPPscContext::AppendToOpQueueUpdateReqIdL(class CXIMPOperationBase *) + ?AuthorizationDataAccess@CProtocolPresenceDataHostImp@@QAEAAVCProtocolPresenceAuthorizationDataHostImp@@XZ @ 10 NONAME ; class CProtocolPresenceAuthorizationDataHostImp & CProtocolPresenceDataHostImp::AuthorizationDataAccess(void) + ?BaseConstructL@CXIMPOperationBase@@QAEXVTXIMPRequestId@@PAVCXIMPPscContext@@@Z @ 11 NONAME ; void CXIMPOperationBase::BaseConstructL(class TXIMPRequestId, class CXIMPPscContext *) + ?BeginOperation@CXIMPOperationBase@@UAEXXZ @ 12 NONAME ; void CXIMPOperationBase::BeginOperation(void) + ?ClientInfo@CXIMPPscContext@@QBEPAVCXIMPContextClientInfoImp@@XZ @ 13 NONAME ; class CXIMPContextClientInfoImp * CXIMPPscContext::ClientInfo(void) const + ?Context@CXIMPOperationBase@@UAEPAVCXIMPPscContext@@XZ @ 14 NONAME ; class CXIMPPscContext * CXIMPOperationBase::Context(void) + ?CreateRequestCompleteEventL@CXIMPOperationBase@@MAEXXZ @ 15 NONAME ; void CXIMPOperationBase::CreateRequestCompleteEventL(void) + ?DestroyCachedUnbind@CXIMPPscContext@@QAEXXZ @ 16 NONAME ; void CXIMPPscContext::DestroyCachedUnbind(void) + ?DisassociateHost@CXIMPHostManager@@QAEXPAVCXIMPHost@@@Z @ 17 NONAME ; void CXIMPHostManager::DisassociateHost(class CXIMPHost *) + ?DropTopEvent@CXIMPContextEventQueue@@QAEXXZ @ 18 NONAME ; void CXIMPContextEventQueue::DropTopEvent(void) + ?EndOperation@CXIMPOperationBase@@UAEXXZ @ 19 NONAME ; void CXIMPOperationBase::EndOperation(void) + ?EventData@CXIMPEventCapsule@@QBEABVTDesC8@@XZ @ 20 NONAME ; class TDesC8 const & CXIMPEventCapsule::EventData(void) const + ?EventQueue@CXIMPPscContext@@QBEAAVCXIMPContextEventQueue@@XZ @ 21 NONAME ; class CXIMPContextEventQueue & CXIMPPscContext::EventQueue(void) const + ?EventReqId@CXIMPEventCapsule@@QBE?AVTXIMPRequestId@@XZ @ 22 NONAME ; class TXIMPRequestId CXIMPEventCapsule::EventReqId(void) const + ?EventType@CXIMPEventCapsule@@QBEJXZ @ 23 NONAME ; long CXIMPEventCapsule::EventType(void) const + ?ExternalizeL@CXIMPProtocolRequestCompleteEventImp@@QBEXAAVRWriteStream@@@Z @ 24 NONAME ; void CXIMPProtocolRequestCompleteEventImp::ExternalizeL(class RWriteStream &) const + ?FeatureManager@CXIMPGlobals@@QAEPAVCXIMPFeatureManager@@XZ @ 25 NONAME ; class CXIMPFeatureManager * CXIMPGlobals::FeatureManager(void) + ?FeaturesForSessionLC@CXIMPPscContext@@QAEPAVCXIMPFeatureInfoImp@@XZ @ 26 NONAME ; class CXIMPFeatureInfoImp * CXIMPPscContext::FeaturesForSessionLC(void) + ?GetCachedUnbind@CXIMPPscContext@@QAEPAVCXIMPOperationBase@@XZ @ 27 NONAME ; class CXIMPOperationBase * CXIMPPscContext::GetCachedUnbind(void) + ?GetFrameworkFeaturesL@CXIMPFeatureManager@@QAEPAVHBufC8@@XZ @ 28 NONAME ; class HBufC8 * CXIMPFeatureManager::GetFrameworkFeaturesL(void) + ?GetProtocolL@CXIMPPluginFactory@@QAEPAVCXIMPProtocolPluginBase@@VTUid@@@Z @ 29 NONAME ; class CXIMPProtocolPluginBase * CXIMPPluginFactory::GetProtocolL(class TUid) + ?GetProtocolsL@CXIMPPluginFactory@@QAEPAVHBufC8@@XZ @ 30 NONAME ; class HBufC8 * CXIMPPluginFactory::GetProtocolsL(void) + ?GetReqCompleteEvent@CXIMPOperationBase@@UAEPAVCXIMPRequestCompleteEventImp@@XZ @ 31 NONAME ; class CXIMPRequestCompleteEventImp * CXIMPOperationBase::GetReqCompleteEvent(void) + ?GroupsDataAccess@CProtocolPresenceDataHostImp@@QAEAAVCProtocolPresentityGroupsDataHostImp@@XZ @ 32 NONAME ; class CProtocolPresentityGroupsDataHostImp & CProtocolPresenceDataHostImp::GroupsDataAccess(void) + ?HasElements@CXIMPContextEventQueue@@QBEHXZ @ 33 NONAME ; int CXIMPContextEventQueue::HasElements(void) const + ?HostManager@CXIMPGlobals@@QAEPAVCXIMPHostManager@@XZ @ 34 NONAME ; class CXIMPHostManager * CXIMPGlobals::HostManager(void) + ?InstallL@CXIMPGlobals@@SAXPAVMXIMPOperationFactory@@PAVMXIMPGlobalsObserver@@@Z @ 35 NONAME ; void CXIMPGlobals::InstallL(class MXIMPOperationFactory *, class MXIMPGlobalsObserver *) + ?Instance@CXIMPGlobals@@SAPAV1@XZ @ 36 NONAME ; class CXIMPGlobals * CXIMPGlobals::Instance(void) + ?InternalizeL@CXIMPProtocolRequestCompleteEventImp@@QAEXAAVRReadStream@@@Z @ 37 NONAME ; void CXIMPProtocolRequestCompleteEventImp::InternalizeL(class RReadStream &) + ?IsHostAssigned@CXIMPPscContext@@QBEHXZ @ 38 NONAME ; int CXIMPPscContext::IsHostAssigned(void) const + ?IsServerOperation@CXIMPOperationBase@@QBEHXZ @ 39 NONAME ; int CXIMPOperationBase::IsServerOperation(void) const + ?NewFromStreamLC@CXIMPProtocolRequestCompleteEventImp@@SAPAV1@AAVRReadStream@@@Z @ 40 NONAME ; class CXIMPProtocolRequestCompleteEventImp * CXIMPProtocolRequestCompleteEventImp::NewFromStreamLC(class RReadStream &) + ?NewL@CProtocolPresenceAuthorizationDataHostImp@@SAPAV1@AAVMXIMPHost@@@Z @ 41 NONAME ; class CProtocolPresenceAuthorizationDataHostImp * CProtocolPresenceAuthorizationDataHostImp::NewL(class MXIMPHost &) + ?NewL@CProtocolPresenceDataHostImp@@SAPAV1@AAVMXIMPHost@@@Z @ 42 NONAME ; class CProtocolPresenceDataHostImp * CProtocolPresenceDataHostImp::NewL(class MXIMPHost &) + ?NewL@CProtocolPresencePublishingDataHostImp@@SAPAV1@AAVMXIMPHost@@@Z @ 43 NONAME ; class CProtocolPresencePublishingDataHostImp * CProtocolPresencePublishingDataHostImp::NewL(class MXIMPHost &) + ?NewL@CProtocolPresenceWatchingDataHostImp@@SAPAV1@AAVMXIMPHost@@@Z @ 44 NONAME ; class CProtocolPresenceWatchingDataHostImp * CProtocolPresenceWatchingDataHostImp::NewL(class MXIMPHost &) + ?NewL@CProtocolPresentityGroupsDataHostImp@@SAPAV1@AAVMXIMPHost@@@Z @ 45 NONAME ; class CProtocolPresentityGroupsDataHostImp * CProtocolPresentityGroupsDataHostImp::NewL(class MXIMPHost &) + ?NewL@CXIMPContextEventQueue@@SAPAV1@XZ @ 46 NONAME ; class CXIMPContextEventQueue * CXIMPContextEventQueue::NewL(void) + ?NewL@CXIMPEventCapsule@@SAPAV1@AAVCXIMPApiEventBase@@H@Z @ 47 NONAME ; class CXIMPEventCapsule * CXIMPEventCapsule::NewL(class CXIMPApiEventBase &, int) + ?NewL@CXIMPEventManager@@SAPAV1@XZ @ 48 NONAME ; class CXIMPEventManager * CXIMPEventManager::NewL(void) + ?NewL@CXIMPHostManager@@SAPAV1@XZ @ 49 NONAME ; class CXIMPHostManager * CXIMPHostManager::NewL(void) + ?NewL@CXIMPProtocolRequestCompleteEventImp@@SAPAV1@XZ @ 50 NONAME ; class CXIMPProtocolRequestCompleteEventImp * CXIMPProtocolRequestCompleteEventImp::NewL(void) + ?NewL@CXIMPPscContext@@SAPAV1@K@Z @ 51 NONAME ; class CXIMPPscContext * CXIMPPscContext::NewL(unsigned long) + ?NewLC@CProtocolPresenceDataHostImp@@SAPAV1@AAVMXIMPHost@@@Z @ 52 NONAME ; class CProtocolPresenceDataHostImp * CProtocolPresenceDataHostImp::NewLC(class MXIMPHost &) + ?NewLC@CXIMPHost@@SAPAV1@AAVMXIMPProtocolConnection@@J@Z @ 53 NONAME ; class CXIMPHost * CXIMPHost::NewLC(class MXIMPProtocolConnection &, long) + ?NoMoreHosts@CXIMPGlobals@@QAEXXZ @ 54 NONAME ; void CXIMPGlobals::NoMoreHosts(void) + ?OperationFactory@CXIMPGlobals@@QAEPAVMXIMPOperationFactory@@XZ @ 55 NONAME ; class MXIMPOperationFactory * CXIMPGlobals::OperationFactory(void) + ?OrderOfContexts@CXIMPPscContext@@SAHABV1@0@Z @ 56 NONAME ; int CXIMPPscContext::OrderOfContexts(class CXIMPPscContext const &, class CXIMPPscContext const &) + ?PluginFactory@CXIMPGlobals@@QAEPAVCXIMPPluginFactory@@XZ @ 57 NONAME ; class CXIMPPluginFactory * CXIMPGlobals::PluginFactory(void) + ?PresenceDataCache@CProtocolPresenceDataHostImp@@QAEAAVCPresenceDataCache@@XZ @ 58 NONAME ; class CPresenceDataCache & CProtocolPresenceDataHostImp::PresenceDataCache(void) + ?PresenceInfoFilter@CXIMPPscContext@@UBEPAVCPresenceInfoFilterImp@@W4TFilterStoreType@MXIMPPscContext@@PBVCXIMPIdentityImp@@@Z @ 59 NONAME ; class CPresenceInfoFilterImp * CXIMPPscContext::PresenceInfoFilter(enum MXIMPPscContext::TFilterStoreType, class CXIMPIdentityImp const *) const + ?ProcessL@CXIMPOperationBase@@UAEXXZ @ 60 NONAME ; void CXIMPOperationBase::ProcessL(void) + ?PublishingDataAccess@CProtocolPresenceDataHostImp@@QAEAAVCProtocolPresencePublishingDataHostImp@@XZ @ 61 NONAME ; class CProtocolPresencePublishingDataHostImp & CProtocolPresenceDataHostImp::PublishingDataAccess(void) + ?Ready@CXIMPEventCapsule@@QBEHXZ @ 62 NONAME ; int CXIMPEventCapsule::Ready(void) const + ?RegisterSessionQueueL@CXIMPEventManager@@QAEXAAVCXIMPContextEventQueue@@@Z @ 63 NONAME ; void CXIMPEventManager::RegisterSessionQueueL(class CXIMPContextEventQueue &) + ?RequestCompletedL@CXIMPOperationBase@@UAEXXZ @ 64 NONAME ; void CXIMPOperationBase::RequestCompletedL(void) + ?RequestId@CXIMPOperationBase@@UBE?AVTXIMPRequestId@@XZ @ 65 NONAME ; class TXIMPRequestId CXIMPOperationBase::RequestId(void) const + ?SelectTopEventIfNeededL@CXIMPContextEventQueue@@QAEXXZ @ 66 NONAME ; void CXIMPContextEventQueue::SelectTopEventIfNeededL(void) + ?ServiceInfo@CXIMPPscContext@@QBEPAVCXIMPServiceInfoImp@@XZ @ 67 NONAME ; class CXIMPServiceInfoImp * CXIMPPscContext::ServiceInfo(void) const + ?SessionId@CXIMPPscContext@@QBEKXZ @ 68 NONAME ; unsigned long CXIMPPscContext::SessionId(void) const + ?SetClientInfo@CXIMPPscContext@@QAEXPAVCXIMPContextClientInfoImp@@@Z @ 69 NONAME ; void CXIMPPscContext::SetClientInfo(class CXIMPContextClientInfoImp *) + ?SetEventFilter@CXIMPContextEventQueue@@QAEXAAVCXIMPContextEventFilter@@@Z @ 70 NONAME ; void CXIMPContextEventQueue::SetEventFilter(class CXIMPContextEventFilter &) + ?SetHost@CXIMPOperationBase@@UAEXAAVMXIMPHost@@@Z @ 71 NONAME ; void CXIMPOperationBase::SetHost(class MXIMPHost &) + ?SetObjectCollection@CXIMPOperationBase@@UAEXPAVMXIMPBase@@@Z @ 72 NONAME ; void CXIMPOperationBase::SetObjectCollection(class MXIMPBase *) + ?SetOpL@CXIMPOperationBase@@UAEXPAVCXIMPPscContext@@@Z @ 73 NONAME ; void CXIMPOperationBase::SetOpL(class CXIMPPscContext *) + ?SetPresenceInfoFilterL@CXIMPPscContext@@QAEXW4TFilterStoreType@MXIMPPscContext@@PAVCPresenceInfoFilterImp@@PBVCXIMPIdentityImp@@@Z @ 74 NONAME ; void CXIMPPscContext::SetPresenceInfoFilterL(enum MXIMPPscContext::TFilterStoreType, class CPresenceInfoFilterImp *, class CXIMPIdentityImp const *) + ?SetReady@CXIMPEventCapsule@@QAEXH@Z @ 75 NONAME ; void CXIMPEventCapsule::SetReady(int) + ?SetReqId@CXIMPOperationBase@@UAEXVTXIMPRequestId@@@Z @ 76 NONAME ; void CXIMPOperationBase::SetReqId(class TXIMPRequestId) + ?SetRequestId@CXIMPProtocolRequestCompleteEventImp@@QAEXABVTXIMPRequestId@@@Z @ 77 NONAME ; void CXIMPProtocolRequestCompleteEventImp::SetRequestId(class TXIMPRequestId const &) + ?SetResultCode@CXIMPOperationBase@@UAEXH@Z @ 78 NONAME ; void CXIMPOperationBase::SetResultCode(int) + ?SetResultCode@CXIMPProtocolRequestCompleteEventImp@@QAEXH@Z @ 79 NONAME ; void CXIMPProtocolRequestCompleteEventImp::SetResultCode(int) + ?SetServerOperation@CXIMPOperationBase@@QAEXXZ @ 80 NONAME ; void CXIMPOperationBase::SetServerOperation(void) + ?SetServiceInfo@CXIMPPscContext@@QAEXPAVCXIMPServiceInfoImp@@@Z @ 81 NONAME ; void CXIMPPscContext::SetServiceInfo(class CXIMPServiceInfoImp *) + ?SetStatus@CXIMPOperationBase@@UAEXPAVMXIMPStatus@@@Z @ 82 NONAME ; void CXIMPOperationBase::SetStatus(class MXIMPStatus *) + ?StartConsuming@CXIMPContextEventQueue@@QAEXAAVMXIMPEventQueueObserver@@@Z @ 83 NONAME ; void CXIMPContextEventQueue::StartConsuming(class MXIMPEventQueueObserver &) + ?Status@CXIMPOperationBase@@UBEAAVMXIMPStatus@@XZ @ 84 NONAME ; class MXIMPStatus & CXIMPOperationBase::Status(void) const + ?StopConsuming@CXIMPContextEventQueue@@QAEXXZ @ 85 NONAME ; void CXIMPContextEventQueue::StopConsuming(void) + ?TopEventDataL@CXIMPContextEventQueue@@QAEABVTDesC8@@XZ @ 86 NONAME ; class TDesC8 const & CXIMPContextEventQueue::TopEventDataL(void) + ?TopEventReqIdL@CXIMPContextEventQueue@@QAE?AVTXIMPRequestId@@XZ @ 87 NONAME ; class TXIMPRequestId CXIMPContextEventQueue::TopEventReqIdL(void) + ?Type@CXIMPOperationBase@@UBEHXZ @ 88 NONAME ; int CXIMPOperationBase::Type(void) const + ?UninstallD@CXIMPGlobals@@SAXXZ @ 89 NONAME ; void CXIMPGlobals::UninstallD(void) + ?UnregisterSessionQueue@CXIMPEventManager@@QAEXAAVCXIMPContextEventQueue@@@Z @ 90 NONAME ; void CXIMPEventManager::UnregisterSessionQueue(class CXIMPContextEventQueue &) + ?UpdateEventData@CXIMPEventCapsule@@QAEXAAVCXIMPApiEventBase@@@Z @ 91 NONAME ; void CXIMPEventCapsule::UpdateEventData(class CXIMPApiEventBase &) + ?UpdateEventDataL@CXIMPEventCapsule@@QAEXAAVCXIMPApiEventBase@@@Z @ 92 NONAME ; void CXIMPEventCapsule::UpdateEventDataL(class CXIMPApiEventBase &) + ?WatchingDataAccess@CProtocolPresenceDataHostImp@@QAEAAVCProtocolPresenceWatchingDataHostImp@@XZ @ 93 NONAME ; class CProtocolPresenceWatchingDataHostImp & CProtocolPresenceDataHostImp::WatchingDataAccess(void) + ?GetContext@CXIMPOperationBase@@QAEPAVMXIMPPscContext@@XZ @ 94 NONAME ; class MXIMPPscContext * CXIMPOperationBase::GetContext(void) + ?GetObjCollection@CXIMPOperationBase@@QAEPAVMXIMPRestrictedObjectCollection@@XZ @ 95 NONAME ; class MXIMPRestrictedObjectCollection * CXIMPOperationBase::GetObjCollection(void) + diff -r 000000000000 -r e6b17d312c8b ximpfw/core/bwins/ximpsrvclientu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/bwins/ximpsrvclientu.def Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,24 @@ +EXPORTS + ??0RXIMPSrvContextClient@@QAE@XZ @ 1 NONAME ; RXIMPSrvContextClient::RXIMPSrvContextClient(void) + ??0RXIMPSrvRootClient@@QAE@XZ @ 2 NONAME ; RXIMPSrvRootClient::RXIMPSrvRootClient(void) + ??0TXIMPProcessStartupParam@@QAE@XZ @ 3 NONAME ; TXIMPProcessStartupParam::TXIMPProcessStartupParam(void) + ?CancelListening@RXIMPSrvContextClient@@QAEXXZ @ 4 NONAME ; void RXIMPSrvContextClient::CancelListening(void) + ?Close@RXIMPSrvContextClient@@QAEXXZ @ 5 NONAME ; void RXIMPSrvContextClient::Close(void) + ?Close@RXIMPSrvRootClient@@QAEXXZ @ 6 NONAME ; void RXIMPSrvRootClient::Close(void) + ?Connect@RXIMPSrvRootClient@@QAEHXZ @ 7 NONAME ; int RXIMPSrvRootClient::Connect(void) + ?ConnectL@RXIMPSrvContextClient@@QAEXVTUid@@@Z @ 8 NONAME ; void RXIMPSrvContextClient::ConnectL(class TUid) + ?ConnectToServer@XIMPProcessStarter@@SAHABVTDesC16@@0PBV?$TArray@VTXIMPProcessStartupParam@@@@AAVRSessionBase@@0ABVTVersion@@H@Z @ 9 NONAME ; int XIMPProcessStarter::ConnectToServer(class TDesC16 const &, class TDesC16 const &, class TArray const *, class RSessionBase &, class TDesC16 const &, class TVersion const &, int) + ?DoQueueOperation@RXIMPSrvContextClient@@QAEHHABVTDesC8@@AAVTXIMPRequestId@@@Z @ 10 NONAME ; int RXIMPSrvContextClient::DoQueueOperation(int, class TDesC8 const &, class TXIMPRequestId &) + ?DropTopEvent@RXIMPSrvContextClient@@QAEHXZ @ 11 NONAME ; int RXIMPSrvContextClient::DropTopEvent(void) + ?FetchTopEventDataLC@RXIMPSrvContextClient@@QAEPAVHBufC8@@XZ @ 12 NONAME ; class HBufC8 * RXIMPSrvContextClient::FetchTopEventDataLC(void) + ?FetchTopEventReqId@RXIMPSrvContextClient@@QAEHAAVTXIMPRequestId@@@Z @ 13 NONAME ; int RXIMPSrvContextClient::FetchTopEventReqId(class TXIMPRequestId &) + ?FullExePathForClienLocation@XIMPProcessStarter@@SAXABVTDesC16@@AAV?$TBuf@$0BAA@@@@Z @ 14 NONAME ; void XIMPProcessStarter::FullExePathForClienLocation(class TDesC16 const &, class TBuf<256> &) + ?GetContextFeaturesL@RXIMPSrvContextClient@@QBEPAVHBufC8@@XZ @ 15 NONAME ; class HBufC8 * RXIMPSrvContextClient::GetContextFeaturesL(void) const + ?GetKnownProtocolsL@RXIMPSrvRootClient@@QAEPAVHBufC8@@XZ @ 16 NONAME ; class HBufC8 * RXIMPSrvRootClient::GetKnownProtocolsL(void) + ?GetSupportedFrameworkFeaturesL@RXIMPSrvRootClient@@QAEPAVHBufC8@@XZ @ 17 NONAME ; class HBufC8 * RXIMPSrvRootClient::GetSupportedFrameworkFeaturesL(void) + ?InstallEventFilterL@RXIMPSrvContextClient@@QAEXABVTDesC8@@@Z @ 18 NONAME ; void RXIMPSrvContextClient::InstallEventFilterL(class TDesC8 const &) + ?ListenEvent@RXIMPSrvContextClient@@QAEXAAVTRequestStatus@@@Z @ 19 NONAME ; void RXIMPSrvContextClient::ListenEvent(class TRequestStatus &) + ?Set@TXIMPProcessStartupParam@@QAEXHH@Z @ 20 NONAME ; void TXIMPProcessStartupParam::Set(int, int) + ?StartInstance@XIMPProcessStarter@@SAHABVTDesC16@@0PBV?$TArray@VTXIMPProcessStartupParam@@@@@Z @ 21 NONAME ; int XIMPProcessStarter::StartInstance(class TDesC16 const &, class TDesC16 const &, class TArray const *) + ?DoQueueOperation2@RXIMPSrvContextClient@@QAEHHABVTDesC8@@AAVTXIMPRequestId@@@Z @ 22 NONAME ; int RXIMPSrvContextClient::DoQueueOperation2(int, class TDesC8 const &, class TXIMPRequestId &) + diff -r 000000000000 -r e6b17d312c8b ximpfw/core/bwins/ximputilsu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/bwins/ximputilsu.def Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,27 @@ +EXPORTS + ??0CXIMPSrvSessionAdapter@@QAE@AAVMXIMPSrv@@@Z @ 1 NONAME ; CXIMPSrvSessionAdapter::CXIMPSrvSessionAdapter(class MXIMPSrv &) + ??0TXIMPBlockTraceHandler@@QAE@PBG@Z @ 2 NONAME ; TXIMPBlockTraceHandler::TXIMPBlockTraceHandler(unsigned short const *) + ??0TXIMPRequestIdBuilder@@QAE@XZ @ 3 NONAME ; TXIMPRequestIdBuilder::TXIMPRequestIdBuilder(void) + ??1CXIMPSrvSessionAdapter@@UAE@XZ @ 4 NONAME ; CXIMPSrvSessionAdapter::~CXIMPSrvSessionAdapter(void) + ??1TXIMPBlockTraceHandler@@QAE@XZ @ 5 NONAME ; TXIMPBlockTraceHandler::~TXIMPBlockTraceHandler(void) + ?BuildRequestId@TXIMPRequestIdBuilder@@QBE?AVTXIMPRequestId@@XZ @ 6 NONAME ; class TXIMPRequestId TXIMPRequestIdBuilder::BuildRequestId(void) const + ?ExternalizeL@XIMPRBuf16Helper@@SAXABVRBuf16@@AAVRWriteStream@@@Z @ 7 NONAME ; void XIMPRBuf16Helper::ExternalizeL(class RBuf16 const &, class RWriteStream &) + ?ExternalizeL@XIMPRBuf8Helper@@SAXABVRBuf8@@AAVRWriteStream@@@Z @ 8 NONAME ; void XIMPRBuf8Helper::ExternalizeL(class RBuf8 const &, class RWriteStream &) + ?GrowIfNeededL@XIMPRBuf16Helper@@SAXAAVRBuf16@@H@Z @ 9 NONAME ; void XIMPRBuf16Helper::GrowIfNeededL(class RBuf16 &, int) + ?GrowIfNeededL@XIMPRBuf8Helper@@SAXAAVRBuf8@@H@Z @ 10 NONAME ; void XIMPRBuf8Helper::GrowIfNeededL(class RBuf8 &, int) + ?InternalizeL@XIMPRBuf16Helper@@SAXAAVRBuf16@@AAVRReadStream@@@Z @ 11 NONAME ; void XIMPRBuf16Helper::InternalizeL(class RBuf16 &, class RReadStream &) + ?InternalizeL@XIMPRBuf8Helper@@SAXAAVRBuf8@@AAVRReadStream@@@Z @ 12 NONAME ; void XIMPRBuf8Helper::InternalizeL(class RBuf8 &, class RReadStream &) + ?NormalExit@TXIMPBlockTraceHandler@@QAEXXZ @ 13 NONAME ; void TXIMPBlockTraceHandler::NormalExit(void) + ?PackArrayL@TXIMPHBuf8Packer@@SAPAVHBufC8@@ABV?$RPointerArray@VHBufC8@@@@@Z @ 14 NONAME ; class HBufC8 * TXIMPHBuf8Packer::PackArrayL(class RPointerArray const &) + ?Panic@NXIMPPrivPanic@@YAXW4TReason@1@@Z @ 15 NONAME ; void NXIMPPrivPanic::Panic(enum NXIMPPrivPanic::TReason) + ?Server@CXIMPSrvSessionAdapter@@IAEAAVMXIMPSrv@@XZ @ 16 NONAME ; class MXIMPSrv & CXIMPSrvSessionAdapter::Server(void) + ?ServiceError@CXIMPSrvSessionAdapter@@UAEXABVRMessage2@@H@Z @ 17 NONAME ; void CXIMPSrvSessionAdapter::ServiceError(class RMessage2 const &, int) + ?ServiceL@CXIMPSrvSessionAdapter@@UAEXABVRMessage2@@@Z @ 18 NONAME ; void CXIMPSrvSessionAdapter::ServiceL(class RMessage2 const &) + ?SetNewValueL@XIMPRBuf16Helper@@SAXAAVRBuf16@@ABVTDesC16@@@Z @ 19 NONAME ; void XIMPRBuf16Helper::SetNewValueL(class RBuf16 &, class TDesC16 const &) + ?SetNewValueL@XIMPRBuf8Helper@@SAXAAVRBuf8@@ABVTDesC8@@@Z @ 20 NONAME ; void XIMPRBuf8Helper::SetNewValueL(class RBuf8 &, class TDesC8 const &) + ?SetProtocolId@TXIMPRequestIdBuilder@@QAEXK@Z @ 21 NONAME ; void TXIMPRequestIdBuilder::SetProtocolId(unsigned long) + ?SetRequestId@TXIMPRequestIdBuilder@@QAEXK@Z @ 22 NONAME ; void TXIMPRequestIdBuilder::SetRequestId(unsigned long) + ?SetSessionId@TXIMPRequestIdBuilder@@QAEXK@Z @ 23 NONAME ; void TXIMPRequestIdBuilder::SetSessionId(unsigned long) + ?Trace@XIMPTrace@@SAXV?$TRefByValue@$$CBVTDesC16@@@@ZZ @ 24 NONAME ; void XIMPTrace::Trace(class TRefByValue, ...) + ?UnPackArrayL@TXIMPHBuf8Packer@@SAXAAV?$RPointerArray@VHBufC8@@@@ABVTDesC8@@@Z @ 25 NONAME ; void TXIMPHBuf8Packer::UnPackArrayL(class RPointerArray &, class TDesC8 const &) + diff -r 000000000000 -r e6b17d312c8b ximpfw/core/eabi/ximpdatamodelu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/eabi/ximpdatamodelu.def Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,153 @@ +EXPORTS + _ZN14CXIMPStatusImp12InternalizeLER11RReadStream @ 1 NONAME + _ZN14CXIMPStatusImp15NewFromStreamLCER11RReadStream @ 2 NONAME + _ZN14CXIMPStatusImp4NewLEv @ 3 NONAME + _ZN14CXIMPStatusImp5NewLCEv @ 4 NONAME + _ZN14XIMPEventCodec5PackLER17CXIMPApiEventBaseRl @ 5 NONAME + _ZN14XIMPEventCodec5PackLER17CXIMPApiEventBaseRlP8CBufFlat @ 6 NONAME + _ZN14XIMPEventCodec7UnPackLERK6TDesC8Rl @ 7 NONAME + _ZN15CXIMPApiObjBaseC2Ev @ 8 NONAME + _ZN15CXIMPApiObjBaseD0Ev @ 9 NONAME + _ZN15CXIMPApiObjBaseD1Ev @ 10 NONAME + _ZN15CXIMPApiObjBaseD2Ev @ 11 NONAME + _ZN16CXIMPIdentityImp12InternalizeLER11RReadStream @ 12 NONAME + _ZN16CXIMPIdentityImp15NewFromStreamLCER11RReadStream @ 13 NONAME + _ZN16CXIMPIdentityImp4NewLEv @ 14 NONAME + _ZN16CXIMPIdentityImp5NewLCERK7TDesC16 @ 15 NONAME + _ZN16CXIMPIdentityImp5NewLCEv @ 16 NONAME + _ZN17CXIMPApiEventBaseC2Ev @ 17 NONAME + _ZN17CXIMPApiEventBaseD0Ev @ 18 NONAME + _ZN17CXIMPApiEventBaseD1Ev @ 19 NONAME + _ZN17CXIMPApiEventBaseD2Ev @ 20 NONAME + _ZN19CXIMPApiDataObjBaseC2Ev @ 21 NONAME + _ZN19CXIMPApiDataObjBaseD0Ev @ 22 NONAME + _ZN19CXIMPApiDataObjBaseD1Ev @ 23 NONAME + _ZN19CXIMPApiDataObjBaseD2Ev @ 24 NONAME + _ZN19CXIMPFeatureInfoImp11AddFeatureLERK6TDesC8 @ 25 NONAME + _ZN19CXIMPFeatureInfoImp12InternalizeLER11RReadStream @ 26 NONAME + _ZN19CXIMPFeatureInfoImp15NewFromStreamLCER11RReadStream @ 27 NONAME + _ZN19CXIMPFeatureInfoImp4NewLEv @ 28 NONAME + _ZN19CXIMPFeatureInfoImp5NewLCEv @ 29 NONAME + _ZN19CXIMPServiceInfoImp12InternalizeLER11RReadStream @ 30 NONAME + _ZN19CXIMPServiceInfoImp15NewFromStreamLCER11RReadStream @ 31 NONAME + _ZN19CXIMPServiceInfoImp4NewLEv @ 32 NONAME + _ZN19CXIMPServiceInfoImp5NewLCE4TUidRK7TDesC16S3_S3_l @ 33 NONAME + _ZN19CXIMPServiceInfoImp5NewLCEv @ 34 NONAME + _ZN19FeaturePluginHolder11InitializeLEv @ 35 NONAME + _ZN19FeaturePluginHolder13AccessorCountEv @ 36 NONAME + _ZN19FeaturePluginHolder26PresenceObjFactoryAccessorEv @ 37 NONAME + _ZN19FeaturePluginHolder7ReleaseEv @ 38 NONAME + _ZN19FeaturePluginHolder8AccessorEi @ 39 NONAME + _ZN20CXIMPContextStateImp12InternalizeLER11RReadStream @ 40 NONAME + _ZN20CXIMPContextStateImp13SetStateValueEN17MXIMPContextState6TStateE @ 41 NONAME + _ZN20CXIMPContextStateImp15NewFromStreamLCER11RReadStream @ 42 NONAME + _ZN20CXIMPContextStateImp4NewLEv @ 43 NONAME + _ZN20CXIMPContextStateImp5NewLCEv @ 44 NONAME + _ZN20CXIMPProtocolInfoImp12InternalizeLER11RReadStream @ 45 NONAME + _ZN20CXIMPProtocolInfoImp15NewFromStreamLCER11RReadStream @ 46 NONAME + _ZN20CXIMPProtocolInfoImp5NewLCERK7TDesC164TUidRK19CXIMPFeatureInfoImp @ 47 NONAME + _ZN20CXIMPProtocolInfoImp5NewLCEv @ 48 NONAME + _ZN21CXIMPObjectFactoryImp4NewLEv @ 49 NONAME + _ZN21XIMPApiDataObjFactory12ExternalizeLER12RWriteStreamRK19CXIMPApiDataObjBase @ 50 NONAME + _ZN21XIMPApiDataObjFactory12ExternalizeLER12RWriteStreamRK6RArrayI13SXIMPReqParamE @ 51 NONAME + _ZN21XIMPApiDataObjFactory12InternalizeLER11RReadStreamR6RArrayI13SXIMPReqParamE @ 52 NONAME + _ZN21XIMPApiDataObjFactory13InternalizeLCER11RReadStream @ 53 NONAME + _ZN23CXIMPContextEventFilter12InternalizeLER11RReadStream @ 54 NONAME + _ZN23CXIMPContextEventFilter13NewCombinedLCERK6TArrayIPS_E @ 55 NONAME + _ZN23CXIMPContextEventFilter4NewLEPK6TArrayIlE @ 56 NONAME + _ZN23CXIMPContextEventFilter5NewLCEPK6TArrayIlE @ 57 NONAME + _ZN24CXIMPObjectCollectionImp4NewLEv @ 58 NONAME + _ZN24CXIMPObjectCollectionImp5NewLCEv @ 59 NONAME + _ZN25CXIMPContextClientInfoImp12InternalizeLER11RReadStream @ 60 NONAME + _ZN25CXIMPContextClientInfoImp15NewFromStreamLCER11RReadStream @ 61 NONAME + _ZN25CXIMPContextClientInfoImp4NewLEv @ 62 NONAME + _ZN25CXIMPContextClientInfoImp5NewLCEv @ 63 NONAME + _ZN25CXIMPContextStateEventImp15ContextStateImpEv @ 64 NONAME + _ZN25CXIMPContextStateEventImp20StateChangeReasonImpEv @ 65 NONAME + _ZN25CXIMPContextStateEventImp23SetStateChangeReasonImpEP14CXIMPStatusImp @ 66 NONAME + _ZN25CXIMPContextStateEventImp4NewLEv @ 67 NONAME + _ZN25CXIMPContextStateEventImp5NewLCEv @ 68 NONAME + _ZN25CXIMPSubscriptionItemBase10ForceCloseEv @ 69 NONAME + _ZN25CXIMPSubscriptionItemBase14AddSubscriberLEP15MXIMPPscContext @ 70 NONAME + _ZN25CXIMPSubscriptionItemBase14AddSubscriberLEPS_ @ 71 NONAME + _ZN25CXIMPSubscriptionItemBase14BaseConstructLEv @ 72 NONAME + _ZN25CXIMPSubscriptionItemBase14CleanIfExpiredEv @ 73 NONAME + _ZN25CXIMPSubscriptionItemBase16RemoveSubscriberEP15MXIMPPscContext @ 74 NONAME + _ZN25CXIMPSubscriptionItemBase16RemoveSubscriberEPS_ @ 75 NONAME + _ZN25CXIMPSubscriptionItemBase17UpdateExpirationLEv @ 76 NONAME + _ZN25CXIMPSubscriptionItemBase18CountOfSubscribersEv @ 77 NONAME + _ZN25CXIMPSubscriptionItemBase18SubscriptionStatusEP15MXIMPPscContext @ 78 NONAME + _ZN25CXIMPSubscriptionItemBase19ActivateSubscriberLEP15MXIMPPscContext @ 79 NONAME + _ZN25CXIMPSubscriptionItemBase19ActivateSubscriberLEPS_ @ 80 NONAME + _ZN25CXIMPSubscriptionItemBase20ChangeStatusAfterAddEv @ 81 NONAME + _ZN25CXIMPSubscriptionItemBase21DataSubscriptionStateEv @ 82 NONAME + _ZN25CXIMPSubscriptionItemBase23ChangeStatusAfterRemoveEv @ 83 NONAME + _ZN25CXIMPSubscriptionItemBase24UpdateSubscriptionStateLENS_18TSubscriptionEventE @ 84 NONAME + _ZN25CXIMPSubscriptionItemBase25SetDataSubscriptionStateLER29CXIMPDataSubscriptionStateImp @ 85 NONAME + _ZN25CXIMPSubscriptionItemBase37SynthesiseSubscriptionEventToAllCtxsLEv @ 86 NONAME + _ZN25CXIMPSubscriptionItemBase7ContextEi @ 87 NONAME + _ZN25CXIMPSubscriptionItemBaseC2ER19MXIMPItemParentBase @ 88 NONAME + _ZN25CXIMPSubscriptionItemBaseD0Ev @ 89 NONAME + _ZN25CXIMPSubscriptionItemBaseD1Ev @ 90 NONAME + _ZN25CXIMPSubscriptionItemBaseD2Ev @ 91 NONAME + _ZN26CXIMPConfigurationItemBase10ForceCloseEv @ 92 NONAME + _ZN26CXIMPConfigurationItemBase14BaseConstructLEv @ 93 NONAME + _ZN26CXIMPConfigurationItemBase16AddConfiguratorLEP15MXIMPPscContext @ 94 NONAME + _ZN26CXIMPConfigurationItemBase16AddConfiguratorLEPS_ @ 95 NONAME + _ZN26CXIMPConfigurationItemBase18RemoveConfiguratorEP15MXIMPPscContext @ 96 NONAME + _ZN26CXIMPConfigurationItemBase18RemoveConfiguratorEPS_ @ 97 NONAME + _ZN26CXIMPConfigurationItemBase19ConfigurationStatusEP15MXIMPPscContext @ 98 NONAME + _ZN26CXIMPConfigurationItemBaseC2ER19MXIMPItemParentBase @ 99 NONAME + _ZN26CXIMPConfigurationItemBaseD0Ev @ 100 NONAME + _ZN26CXIMPConfigurationItemBaseD1Ev @ 101 NONAME + _ZN26CXIMPConfigurationItemBaseD2Ev @ 102 NONAME + _ZN28CXIMPRequestCompleteEventImp12AppendParamLEP19CXIMPApiDataObjBase @ 103 NONAME + _ZN28CXIMPRequestCompleteEventImp12SetRequestIdERK14TXIMPRequestId @ 104 NONAME + _ZN28CXIMPRequestCompleteEventImp19CompletionResultImpEv @ 105 NONAME + _ZN28CXIMPRequestCompleteEventImp4NewLEv @ 106 NONAME + _ZN28CXIMPRequestCompleteEventImp5NewLCER14TXIMPRequestIdi @ 107 NONAME + _ZN29CXIMPDataSubscriptionStateImp12InternalizeLER11RReadStream @ 108 NONAME + _ZN29CXIMPDataSubscriptionStateImp15NewFromStreamLCER11RReadStream @ 109 NONAME + _ZN29CXIMPDataSubscriptionStateImp4NewLEv @ 110 NONAME + _ZN29CXIMPDataSubscriptionStateImp5NewLCEv @ 111 NONAME + _ZN34CXIMPRestrictedObjectCollectionImp18SetObjectOwnershipEi @ 112 NONAME + _ZN34CXIMPRestrictedObjectCollectionImp4NewLEi @ 113 NONAME + _ZN34CXIMPRestrictedObjectCollectionImp5NewLCEi @ 114 NONAME + _ZNK15CXIMPApiObjBase25HandleUnknownGetInterfaceElN9MXIMPBase9TIfGetOpsE @ 115 NONAME + _ZNK16CXIMPIdentityImp7CompareERKS_ @ 116 NONAME + _ZNK16CXIMPIdentityImpneERKS_ @ 117 NONAME + _ZNK23CXIMPContextEventFilter12ExternalizeLER12RWriteStream @ 118 NONAME + _ZNK23CXIMPContextEventFilter15IsEventAcceptedEl @ 119 NONAME + _ZNK25CXIMPContextClientInfoImp5MatchEPKS_ @ 120 NONAME + _ZNK25CXIMPSubscriptionItemBase12ContextCountEv @ 121 NONAME + _ZNK25CXIMPSubscriptionItemBase8StatusLCEP15MXIMPPscContext @ 122 NONAME + _ZNK25CXIMPSubscriptionItemBase9IsContextEP15MXIMPPscContext @ 123 NONAME + _ZNK26CXIMPConfigurationItemBase9IsContextEP15MXIMPPscContext @ 124 NONAME + _ZTI15CXIMPApiObjBase @ 125 NONAME ; ## + _ZTI17CXIMPApiEventBase @ 126 NONAME ; ## + _ZTI19CXIMPApiDataObjBase @ 127 NONAME ; ## + _ZTI21CXIMPObjectFactoryImp @ 128 NONAME ; ## + _ZTI24CXIMPObjectCollectionImp @ 129 NONAME ; ## + _ZTI25CXIMPSubscriptionItemBase @ 130 NONAME ; ## + _ZTI26CXIMPConfigurationItemBase @ 131 NONAME ; ## + _ZTI34CXIMPRestrictedObjectCollectionImp @ 132 NONAME ; ## + _ZTIN24CXIMPObjectCollectionImp22CXIMPCollectionElementE @ 133 NONAME ; ## + _ZTV15CXIMPApiObjBase @ 134 NONAME ; ## + _ZTV17CXIMPApiEventBase @ 135 NONAME ; ## + _ZTV19CXIMPApiDataObjBase @ 136 NONAME ; ## + _ZTV21CXIMPObjectFactoryImp @ 137 NONAME ; ## + _ZTV24CXIMPObjectCollectionImp @ 138 NONAME ; ## + _ZTV25CXIMPSubscriptionItemBase @ 139 NONAME ; ## + _ZTV26CXIMPConfigurationItemBase @ 140 NONAME ; ## + _ZTV34CXIMPRestrictedObjectCollectionImp @ 141 NONAME ; ## + _ZTVN24CXIMPObjectCollectionImp22CXIMPCollectionElementE @ 142 NONAME ; ## + _ZThn144_N26CXIMPConfigurationItemBaseD0Ev @ 143 NONAME ; ## + _ZThn144_N26CXIMPConfigurationItemBaseD1Ev @ 144 NONAME ; ## + _ZThn28_N25CXIMPSubscriptionItemBase19ActivateSubscriberLEP15MXIMPPscContext @ 145 NONAME ; ## + _ZThn28_N25CXIMPSubscriptionItemBase25SetDataSubscriptionStateLER29CXIMPDataSubscriptionStateImp @ 146 NONAME ; ## + _ZThn28_N25CXIMPSubscriptionItemBase37SynthesiseSubscriptionEventToAllCtxsLEv @ 147 NONAME ; ## + _ZThn28_N25CXIMPSubscriptionItemBaseD0Ev @ 148 NONAME ; ## + _ZThn28_N25CXIMPSubscriptionItemBaseD1Ev @ 149 NONAME ; ## + _ZThn28_N26CXIMPConfigurationItemBaseD0Ev @ 150 NONAME ; ## + _ZThn28_N26CXIMPConfigurationItemBaseD1Ev @ 151 NONAME ; ## + diff -r 000000000000 -r e6b17d312c8b ximpfw/core/eabi/ximpmanageru.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/eabi/ximpmanageru.def Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + _ZN14CXIMPClientImp15NewMXIMPClientLEv @ 1 NONAME + diff -r 000000000000 -r e6b17d312c8b ximpfw/core/eabi/ximpoperationsu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/eabi/ximpoperationsu.def Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,21 @@ +EXPORTS + _ZN18CXIMPOperationBindC1Ev @ 1 NONAME + _ZN18CXIMPOperationBindC2Ev @ 2 NONAME + _ZN19CXIMPOperationBind2C1Ev @ 3 NONAME + _ZN19CXIMPOperationBind2C2Ev @ 4 NONAME + _ZN20CXIMPOperationUnbindC1Ev @ 5 NONAME + _ZN20CXIMPOperationUnbindC2Ev @ 6 NONAME + _ZN21CXIMPOperationFactory4NewLEv @ 7 NONAME + _ZN28CXIMPOperationForcedTeardownC1Ev @ 8 NONAME + _ZN28CXIMPOperationForcedTeardownC2Ev @ 9 NONAME + _ZTI18CXIMPOperationBind @ 10 NONAME ; ## + _ZTI19CXIMPOperationBind2 @ 11 NONAME ; ## + _ZTI20CXIMPOperationUnbind @ 12 NONAME ; ## + _ZTI21CXIMPOperationFactory @ 13 NONAME ; ## + _ZTI28CXIMPOperationForcedTeardown @ 14 NONAME ; ## + _ZTV18CXIMPOperationBind @ 15 NONAME ; ## + _ZTV19CXIMPOperationBind2 @ 16 NONAME ; ## + _ZTV20CXIMPOperationUnbind @ 17 NONAME ; ## + _ZTV21CXIMPOperationFactory @ 18 NONAME ; ## + _ZTV28CXIMPOperationForcedTeardown @ 19 NONAME ; ## + diff -r 000000000000 -r e6b17d312c8b ximpfw/core/eabi/ximpprocessoru.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/eabi/ximpprocessoru.def Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,128 @@ +EXPORTS + _ZN12CXIMPGlobals10UninstallDEv @ 1 NONAME + _ZN12CXIMPGlobals11HostManagerEv @ 2 NONAME + _ZN12CXIMPGlobals11NoMoreHostsEv @ 3 NONAME + _ZN12CXIMPGlobals13PluginFactoryEv @ 4 NONAME + _ZN12CXIMPGlobals14FeatureManagerEv @ 5 NONAME + _ZN12CXIMPGlobals16OperationFactoryEv @ 6 NONAME + _ZN12CXIMPGlobals8InstallLEP21MXIMPOperationFactoryP20MXIMPGlobalsObserver @ 7 NONAME + _ZN12CXIMPGlobals8InstanceEv @ 8 NONAME + _ZN15CXIMPPscContext13SetClientInfoEP25CXIMPContextClientInfoImp @ 9 NONAME + _ZN15CXIMPPscContext14SetServiceInfoEP19CXIMPServiceInfoImp @ 10 NONAME + _ZN15CXIMPPscContext15GetCachedUnbindEv @ 11 NONAME + _ZN15CXIMPPscContext15OrderOfContextsERKS_S1_ @ 12 NONAME + _ZN15CXIMPPscContext16AddNewOperationLEiRK6TDesC8 @ 13 NONAME + _ZN15CXIMPPscContext16AppendToOpQueueLEP18CXIMPOperationBase @ 14 NONAME + _ZN15CXIMPPscContext19DestroyCachedUnbindEv @ 15 NONAME + _ZN15CXIMPPscContext20FeaturesForSessionLCEv @ 16 NONAME + _ZN15CXIMPPscContext22SetPresenceInfoFilterLEN15MXIMPPscContext16TFilterStoreTypeEP22CPresenceInfoFilterImpPK16CXIMPIdentityImp @ 17 NONAME + _ZN15CXIMPPscContext27AppendToOpQueueUpdateReqIdLEP18CXIMPOperationBase @ 18 NONAME + _ZN15CXIMPPscContext4NewLEm @ 19 NONAME + _ZN16CXIMPHostManager16DisassociateHostEP9CXIMPHost @ 20 NONAME + _ZN17CXIMPEventCapsule15UpdateEventDataER17CXIMPApiEventBase @ 21 NONAME + _ZN17CXIMPEventCapsule16UpdateEventDataLER17CXIMPApiEventBase @ 22 NONAME + _ZN17CXIMPEventCapsule4NewLER17CXIMPApiEventBasei @ 23 NONAME + _ZN17CXIMPEventCapsule8SetReadyEi @ 24 NONAME + _ZN17CXIMPEventManager14ActivateEventLER17CXIMPApiEventBaseP15CXIMPPscContext @ 25 NONAME + _ZN17CXIMPEventManager21RegisterSessionQueueLER22CXIMPContextEventQueue @ 26 NONAME + _ZN17CXIMPEventManager22UnregisterSessionQueueER22CXIMPContextEventQueue @ 27 NONAME + _ZN17CXIMPEventManager28ActivateRequestCompleteEventER28CXIMPRequestCompleteEventImpP15CXIMPPscContext @ 28 NONAME + _ZN17CXIMPEventManager4NewLEv @ 29 NONAME + _ZN17CXIMPEventManager9AddEventLER17CXIMPApiEventBaseP15CXIMPPscContext @ 30 NONAME + _ZN17CXIMPEventManager9AddEventLER17CXIMPApiEventBaseR13RPointerArrayI15CXIMPPscContextE @ 31 NONAME + _ZN18CXIMPOperationBase10GetContextEv @ 32 NONAME + _ZN18CXIMPOperationBase12EndOperationEv @ 33 NONAME + _ZN18CXIMPOperationBase13SetResultCodeEi @ 34 NONAME + _ZN18CXIMPOperationBase14BaseConstructLE14TXIMPRequestIdP15CXIMPPscContext @ 35 NONAME + _ZN18CXIMPOperationBase14BeginOperationEv @ 36 NONAME + _ZN18CXIMPOperationBase16GetObjCollectionEv @ 37 NONAME + _ZN18CXIMPOperationBase17RequestCompletedLEv @ 38 NONAME + _ZN18CXIMPOperationBase18SetServerOperationEv @ 39 NONAME + _ZN18CXIMPOperationBase19GetReqCompleteEventEv @ 40 NONAME + _ZN18CXIMPOperationBase19SetObjectCollectionEP9MXIMPBase @ 41 NONAME + _ZN18CXIMPOperationBase27CreateRequestCompleteEventLEv @ 42 NONAME + _ZN18CXIMPOperationBase6SetOpLEP15CXIMPPscContext @ 43 NONAME + _ZN18CXIMPOperationBase7ContextEv @ 44 NONAME + _ZN18CXIMPOperationBase7SetHostER9MXIMPHost @ 45 NONAME + _ZN18CXIMPOperationBase8ProcessLEv @ 46 NONAME + _ZN18CXIMPOperationBase8SetReqIdE14TXIMPRequestId @ 47 NONAME + _ZN18CXIMPOperationBase9SetStatusEP11MXIMPStatus @ 48 NONAME + _ZN18CXIMPOperationBaseC2Ev @ 49 NONAME + _ZN18CXIMPOperationBaseD0Ev @ 50 NONAME + _ZN18CXIMPOperationBaseD1Ev @ 51 NONAME + _ZN18CXIMPOperationBaseD2Ev @ 52 NONAME + _ZN18CXIMPPluginFactory12GetProtocolLE4TUid @ 53 NONAME + _ZN18CXIMPPluginFactory13GetProtocolsLEv @ 54 NONAME + _ZN19CXIMPFeatureManager21GetFrameworkFeaturesLEv @ 55 NONAME + _ZN22CXIMPContextEventQueue12DropTopEventEv @ 56 NONAME + _ZN22CXIMPContextEventQueue13StopConsumingEv @ 57 NONAME + _ZN22CXIMPContextEventQueue13TopEventDataLEv @ 58 NONAME + _ZN22CXIMPContextEventQueue14SetEventFilterER23CXIMPContextEventFilter @ 59 NONAME + _ZN22CXIMPContextEventQueue14StartConsumingER23MXIMPEventQueueObserver @ 60 NONAME + _ZN22CXIMPContextEventQueue14TopEventReqIdLEv @ 61 NONAME + _ZN22CXIMPContextEventQueue23SelectTopEventIfNeededLEv @ 62 NONAME + _ZN22CXIMPContextEventQueue4NewLEv @ 63 NONAME + _ZN28CProtocolPresenceDataHostImp16GroupsDataAccessEv @ 64 NONAME + _ZN28CProtocolPresenceDataHostImp17PresenceDataCacheEv @ 65 NONAME + _ZN28CProtocolPresenceDataHostImp18WatchingDataAccessEv @ 66 NONAME + _ZN28CProtocolPresenceDataHostImp20PublishingDataAccessEv @ 67 NONAME + _ZN28CProtocolPresenceDataHostImp23AuthorizationDataAccessEv @ 68 NONAME + _ZN28CProtocolPresenceDataHostImp4NewLER9MXIMPHost @ 69 NONAME + _ZN28CProtocolPresenceDataHostImp5NewLCER9MXIMPHost @ 70 NONAME + _ZN36CProtocolPresenceWatchingDataHostImp4NewLER9MXIMPHost @ 71 NONAME + _ZN36CProtocolPresentityGroupsDataHostImp4NewLER9MXIMPHost @ 72 NONAME + _ZN36CXIMPProtocolRequestCompleteEventImp12InternalizeLER11RReadStream @ 73 NONAME + _ZN36CXIMPProtocolRequestCompleteEventImp12SetRequestIdERK14TXIMPRequestId @ 74 NONAME + _ZN36CXIMPProtocolRequestCompleteEventImp13SetResultCodeEi @ 75 NONAME + _ZN36CXIMPProtocolRequestCompleteEventImp4NewLEv @ 76 NONAME + _ZN38CProtocolPresencePublishingDataHostImp4NewLER9MXIMPHost @ 77 NONAME + _ZN41CProtocolPresenceAuthorizationDataHostImp4NewLER9MXIMPHost @ 78 NONAME + _ZN9CXIMPHost5NewLCER23MXIMPProtocolConnectionl @ 79 NONAME + _ZNK15CXIMPPscContext10ClientInfoEv @ 80 NONAME + _ZNK15CXIMPPscContext10EventQueueEv @ 81 NONAME + _ZNK15CXIMPPscContext11ServiceInfoEv @ 82 NONAME + _ZNK15CXIMPPscContext14IsHostAssignedEv @ 83 NONAME + _ZNK15CXIMPPscContext18PresenceInfoFilterEN15MXIMPPscContext16TFilterStoreTypeEPK16CXIMPIdentityImp @ 84 NONAME + _ZNK15CXIMPPscContext9SessionIdEv @ 85 NONAME + _ZNK17CXIMPEventCapsule10EventReqIdEv @ 86 NONAME + _ZNK17CXIMPEventCapsule5ReadyEv @ 87 NONAME + _ZNK17CXIMPEventCapsule9EventDataEv @ 88 NONAME + _ZNK17CXIMPEventCapsule9EventTypeEv @ 89 NONAME + _ZNK18CXIMPOperationBase17IsServerOperationEv @ 90 NONAME + _ZNK18CXIMPOperationBase4TypeEv @ 91 NONAME + _ZNK18CXIMPOperationBase6StatusEv @ 92 NONAME + _ZNK18CXIMPOperationBase9RequestIdEv @ 93 NONAME + _ZNK22CXIMPContextEventQueue11HasElementsEv @ 94 NONAME + _ZNK36CXIMPProtocolRequestCompleteEventImp12ExternalizeLER12RWriteStream @ 95 NONAME + _ZTI12CXIMPGlobals @ 96 NONAME ; ## + _ZTI15CXIMPPscContext @ 97 NONAME ; ## + _ZTI16CXIMPHostManager @ 98 NONAME ; ## + _ZTI17CXIMPEventCapsule @ 99 NONAME ; ## + _ZTI17CXIMPEventManager @ 100 NONAME ; ## + _ZTI18CXIMPOperationBase @ 101 NONAME ; ## + _ZTI18CXIMPPluginFactory @ 102 NONAME ; ## + _ZTI19CXIMPFeatureManager @ 103 NONAME ; ## + _ZTI22CXIMPContextEventQueue @ 104 NONAME ; ## + _ZTI28CProtocolPresenceDataHostImp @ 105 NONAME ; ## + _ZTI36CProtocolPresenceWatchingDataHostImp @ 106 NONAME ; ## + _ZTI36CProtocolPresentityGroupsDataHostImp @ 107 NONAME ; ## + _ZTI38CProtocolPresencePublishingDataHostImp @ 108 NONAME ; ## + _ZTI41CProtocolPresenceAuthorizationDataHostImp @ 109 NONAME ; ## + _ZTI9CXIMPHost @ 110 NONAME ; ## + _ZTV12CXIMPGlobals @ 111 NONAME ; ## + _ZTV15CXIMPPscContext @ 112 NONAME ; ## + _ZTV16CXIMPHostManager @ 113 NONAME ; ## + _ZTV17CXIMPEventCapsule @ 114 NONAME ; ## + _ZTV17CXIMPEventManager @ 115 NONAME ; ## + _ZTV18CXIMPOperationBase @ 116 NONAME ; ## + _ZTV18CXIMPPluginFactory @ 117 NONAME ; ## + _ZTV19CXIMPFeatureManager @ 118 NONAME ; ## + _ZTV22CXIMPContextEventQueue @ 119 NONAME ; ## + _ZTV28CProtocolPresenceDataHostImp @ 120 NONAME ; ## + _ZTV36CProtocolPresenceWatchingDataHostImp @ 121 NONAME ; ## + _ZTV36CProtocolPresentityGroupsDataHostImp @ 122 NONAME ; ## + _ZTV38CProtocolPresencePublishingDataHostImp @ 123 NONAME ; ## + _ZTV41CProtocolPresenceAuthorizationDataHostImp @ 124 NONAME ; ## + _ZTV9CXIMPHost @ 125 NONAME ; ## + _ZThn28_NK15CXIMPPscContext18PresenceInfoFilterEN15MXIMPPscContext16TFilterStoreTypeEPK16CXIMPIdentityImp @ 126 NONAME ; ## + diff -r 000000000000 -r e6b17d312c8b ximpfw/core/eabi/ximpsrvclientu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/eabi/ximpsrvclientu.def Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,27 @@ +EXPORTS + _ZN18RXIMPSrvRootClient18GetKnownProtocolsLEv @ 1 NONAME + _ZN18RXIMPSrvRootClient30GetSupportedFrameworkFeaturesLEv @ 2 NONAME + _ZN18RXIMPSrvRootClient5CloseEv @ 3 NONAME + _ZN18RXIMPSrvRootClient7ConnectEv @ 4 NONAME + _ZN18RXIMPSrvRootClientC1Ev @ 5 NONAME + _ZN18RXIMPSrvRootClientC2Ev @ 6 NONAME + _ZN18XIMPProcessStarter13StartInstanceERK7TDesC16S2_PK6TArrayI24TXIMPProcessStartupParamE @ 7 NONAME + _ZN18XIMPProcessStarter15ConnectToServerERK7TDesC16S2_PK6TArrayI24TXIMPProcessStartupParamER12RSessionBaseS2_RK8TVersioni @ 8 NONAME + _ZN18XIMPProcessStarter27FullExePathForClienLocationERK7TDesC16R4TBufILi256EE @ 9 NONAME + _ZN21RXIMPSrvContextClient11ListenEventER14TRequestStatus @ 10 NONAME + _ZN21RXIMPSrvContextClient12DropTopEventEv @ 11 NONAME + _ZN21RXIMPSrvContextClient15CancelListeningEv @ 12 NONAME + _ZN21RXIMPSrvContextClient16DoQueueOperationEiRK6TDesC8R14TXIMPRequestId @ 13 NONAME + _ZN21RXIMPSrvContextClient17DoQueueOperation2EiRK6TDesC8R14TXIMPRequestId @ 14 NONAME + _ZN21RXIMPSrvContextClient18FetchTopEventReqIdER14TXIMPRequestId @ 15 NONAME + _ZN21RXIMPSrvContextClient19FetchTopEventDataLCEv @ 16 NONAME + _ZN21RXIMPSrvContextClient19InstallEventFilterLERK6TDesC8 @ 17 NONAME + _ZN21RXIMPSrvContextClient5CloseEv @ 18 NONAME + _ZN21RXIMPSrvContextClient8ConnectLE4TUid @ 19 NONAME + _ZN21RXIMPSrvContextClientC1Ev @ 20 NONAME + _ZN21RXIMPSrvContextClientC2Ev @ 21 NONAME + _ZN24TXIMPProcessStartupParam3SetEii @ 22 NONAME + _ZN24TXIMPProcessStartupParamC1Ev @ 23 NONAME + _ZN24TXIMPProcessStartupParamC2Ev @ 24 NONAME + _ZNK21RXIMPSrvContextClient19GetContextFeaturesLEv @ 25 NONAME + diff -r 000000000000 -r e6b17d312c8b ximpfw/core/eabi/ximputilsu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/eabi/ximputilsu.def Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,34 @@ +EXPORTS + _ZN14NXIMPPrivPanic5PanicENS_7TReasonE @ 1 NONAME + _ZN15XIMPRBuf8Helper12ExternalizeLERK5RBuf8R12RWriteStream @ 2 NONAME + _ZN15XIMPRBuf8Helper12InternalizeLER5RBuf8R11RReadStream @ 3 NONAME + _ZN15XIMPRBuf8Helper12SetNewValueLER5RBuf8RK6TDesC8 @ 4 NONAME + _ZN15XIMPRBuf8Helper13GrowIfNeededLER5RBuf8i @ 5 NONAME + _ZN16TXIMPHBuf8Packer10PackArrayLERK13RPointerArrayI6HBufC8E @ 6 NONAME + _ZN16TXIMPHBuf8Packer12UnPackArrayLER13RPointerArrayI6HBufC8ERK6TDesC8 @ 7 NONAME + _ZN16XIMPRBuf16Helper12ExternalizeLERK6RBuf16R12RWriteStream @ 8 NONAME + _ZN16XIMPRBuf16Helper12InternalizeLER6RBuf16R11RReadStream @ 9 NONAME + _ZN16XIMPRBuf16Helper12SetNewValueLER6RBuf16RK7TDesC16 @ 10 NONAME + _ZN16XIMPRBuf16Helper13GrowIfNeededLER6RBuf16i @ 11 NONAME + _ZN21TXIMPRequestIdBuilder12SetRequestIdEm @ 12 NONAME + _ZN21TXIMPRequestIdBuilder12SetSessionIdEm @ 13 NONAME + _ZN21TXIMPRequestIdBuilder13SetProtocolIdEm @ 14 NONAME + _ZN21TXIMPRequestIdBuilderC1Ev @ 15 NONAME + _ZN21TXIMPRequestIdBuilderC2Ev @ 16 NONAME + _ZN22CXIMPSrvSessionAdapter12ServiceErrorERK9RMessage2i @ 17 NONAME + _ZN22CXIMPSrvSessionAdapter6ServerEv @ 18 NONAME + _ZN22CXIMPSrvSessionAdapter8ServiceLERK9RMessage2 @ 19 NONAME + _ZN22CXIMPSrvSessionAdapterC2ER8MXIMPSrv @ 20 NONAME + _ZN22CXIMPSrvSessionAdapterD0Ev @ 21 NONAME + _ZN22CXIMPSrvSessionAdapterD1Ev @ 22 NONAME + _ZN22CXIMPSrvSessionAdapterD2Ev @ 23 NONAME + _ZN22TXIMPBlockTraceHandler10NormalExitEv @ 24 NONAME + _ZN22TXIMPBlockTraceHandlerC1EPKt @ 25 NONAME + _ZN22TXIMPBlockTraceHandlerC2EPKt @ 26 NONAME + _ZN22TXIMPBlockTraceHandlerD1Ev @ 27 NONAME + _ZN22TXIMPBlockTraceHandlerD2Ev @ 28 NONAME + _ZN9XIMPTrace5TraceE11TRefByValueIK7TDesC16Ez @ 29 NONAME + _ZNK21TXIMPRequestIdBuilder14BuildRequestIdEv @ 30 NONAME + _ZTI22CXIMPSrvSessionAdapter @ 31 NONAME ; ## + _ZTV22CXIMPSrvSessionAdapter @ 32 NONAME ; ## + diff -r 000000000000 -r e6b17d312c8b ximpfw/core/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/group/bld.inf Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,38 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Build information file for project Presence Framework +* +*/ + + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +PRJ_MMPFILES +ximputils.mmp +ximpdatamodel.mmp +ximpprocessor.mmp +ximpoperations.mmp +ximprootserver.mmp +ximpserver.mmp +ximpsrvclient.mmp +ximpmanager.mmp +ximpecomhook.mmp + +PRJ_TESTMMPFILES + +PRJ_TESTEXPORTS + diff -r 000000000000 -r e6b17d312c8b ximpfw/core/group/ximpdatamodel.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/group/ximpdatamodel.mmp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,103 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project definition file for XIMP Data Model +* +*/ + +#include +#include +#include "../../group/ximpdlluids.hrh" + + + +TARGET ximpdatamodel.dll +TARGETTYPE dll +UID XIMP_DLL_UID_STATIC_INTERFACE XIMP_DLL_UID_COMMON + +CAPABILITY CAP_GENERAL_DLL +VENDORID VID_DEFAULT + + +// --------------------------------------------------------------------------- +SOURCEPATH ../srcdatamodel +// --------------------------------------------------------------------------- +// API data objects +SOURCE ximpfeatureinfoimp.cpp +SOURCE ximpprotocolinfoimp.cpp +SOURCE ximpserviceinfoimp.cpp +SOURCE ximpcontextclientinfoimp.cpp +SOURCE ximpcontextstateimp.cpp +SOURCE ximpdatasubscriptionstateimp.cpp +SOURCE ximpstatusimp.cpp +SOURCE ximpidentityimp.cpp +SOURCE ximprestrictedobjectcollectionimp.cpp +SOURCE ximpobjectcollectionimp.cpp +SOURCE ximpfeaturepluginholder.cpp + + +// API data events +SOURCE ximprequestcompleteeventimp.cpp +SOURCE ximpcontextstateeventimp.cpp + + + + +// --------------------------------------------------------------------------- +SOURCEPATH ../srcdatamodel +// --------------------------------------------------------------------------- +//Base classes for data types +SOURCE ximpapiobjbase.cpp +SOURCE ximpapieventbase.cpp +SOURCE ximpeventcodec.cpp +SOURCE ximpapidataobjbase.cpp +SOURCE ximpapidataobjfactory.cpp +SOURCE ximpsubscriptionitembase.cpp +SOURCE ximpconfigurationitembase.cpp +SOURCE ximpcontexteventfilter.cpp + +//Facade APIs to adaptation +SOURCE ximpobjectfactoryimp.cpp + + + + + +USERINCLUDE ../srcdatamodel +USERINCLUDE ../srcprocessor +USERINCLUDE ../srcoperations +USERINCLUDE ../../presence/srcpresencedatamodel +USERINCLUDE ../srcutils + + +// TODO remove unnecessary +SYSTEMINCLUDE ../../inc/core/base +SYSTEMINCLUDE ../../inc/core/datamodel +SYSTEMINCLUDE ../../inc/core/protocolplugin +SYSTEMINCLUDE ../../inc/core/protocolpluginhost +SYSTEMINCLUDE ../../inc/presence/presencedatamodel +SYSTEMINCLUDE ../../inc/presence/presencemanagement +SYSTEMINCLUDE ../../inc/presence/presenceprotocolplugin +SYSTEMINCLUDE ../../inc/presence/presenceprotocolpluginhost +MW_LAYER_SYSTEMINCLUDE + + +LIBRARY euser.lib +LIBRARY bafl.lib +LIBRARY estor.lib +LIBRARY ximputils.lib +LIBRARY ecom.lib + + + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/core/group/ximpecomhook.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/group/ximpecomhook.mmp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,50 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project definition file for ECom Hook +* +*/ + +#include +#include +#include "../../group/ximpdlluids.hrh" + + + +TARGET ximpecomhook.dll +CAPABILITY CAP_ECOM_PLUGIN +TARGETTYPE PLUGIN +UID XIMP_DLL_UID_ECOM_PLUGIN XIMP_DLL_UID_COMMON +VENDORID VID_DEFAULT + + +SOURCEPATH ../srcfrontend/srcecomhook +START RESOURCE ximpecomhook.rss +TARGET ximpecomhook.rsc +END + + +SOURCEPATH ../srcfrontend/srcecomhook +SOURCE ximpecomhook.cpp + + +USERINCLUDE ../srcfrontend/srcmanager +USERINCLUDE ../../group +USERINCLUDE ../../core/srcdatamodel + +MW_LAYER_SYSTEMINCLUDE + + +LIBRARY euser.lib +LIBRARY ximpmanager.lib +LIBRARY ecom.lib \ No newline at end of file diff -r 000000000000 -r e6b17d312c8b ximpfw/core/group/ximpmanager.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/group/ximpmanager.mmp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,67 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project definition file for Presence Manager +* +*/ + +#include +#include +#include "../../group/ximpdlluids.hrh" + + + +TARGET ximpmanager.dll +TARGETTYPE dll +UID XIMP_DLL_UID_STATIC_INTERFACE XIMP_DLL_UID_COMMON + +CAPABILITY CAP_GENERAL_DLL +VENDORID VID_DEFAULT + + +SOURCEPATH ../srcfrontend/srcmanager +SOURCE ximpclientifsingleton.cpp +SOURCE ximpcontextclientproxy.cpp +SOURCE ximpcontexteventpump.cpp +SOURCE ximpcntxteventobsarray.cpp +SOURCE ximpclientimp.cpp +SOURCE ximpcontextimp.cpp + +USERINCLUDE ../srcfrontend/srcmanager +USERINCLUDE ../srcclient +USERINCLUDE ../srcutils +USERINCLUDE ../srcdatamodel +USERINCLUDE ../srcoperations +USERINCLUDE ../../presence/srcpresencedatamodel +USERINCLUDE ../../presence/srcpresencedatamodel/presencepublishing + +// TODO remove unnecessary +SYSTEMINCLUDE ../../inc/core/base +SYSTEMINCLUDE ../../inc/core/datamodel +SYSTEMINCLUDE ../../inc/core/protocolplugin +SYSTEMINCLUDE ../../inc/core/protocolpluginhost +SYSTEMINCLUDE ../../inc/presence/presencedatamodel +SYSTEMINCLUDE ../../inc/presence/presenceprotocolplugin +SYSTEMINCLUDE ../../inc/presence/presenceprotocolpluginhost +MW_LAYER_SYSTEMINCLUDE + + +LIBRARY euser.lib +LIBRARY ecom.lib +LIBRARY bafl.lib +LIBRARY estor.lib +LIBRARY ximputils.lib +LIBRARY ximpdatamodel.lib +LIBRARY ximpsrvclient.lib + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/core/group/ximpoperations.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/group/ximpoperations.mmp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,92 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project definition file for PrFw presence operations +* +*/ + +#include +#include +#include "../../group/ximpdlluids.hrh" + + + + +TARGET ximpoperations.dll +TARGETTYPE dll +UID XIMP_DLL_UID_STATIC_INTERFACE XIMP_DLL_UID_COMMON + +CAPABILITY CAP_GENERAL_DLL +VENDORID VID_DEFAULT + + + +// --------------------------------------------------------------------------- +SOURCEPATH ../srcoperations +// --------------------------------------------------------------------------- + +// Common infrastucture +SOURCE ximpoperationfactoryimp.cpp + + + + +// --------------------------------------------------------------------------- +SOURCEPATH ../srcoperations/sessionmng +// --------------------------------------------------------------------------- + +// Client - session management +SOURCE ximpoperationunbind.cpp +SOURCE ximpoperationbind.cpp +SOURCE ximpoperationbind2.cpp + +// Adaptation - session state notifications +SOURCE ximpoperationforcedteardown.cpp + +// Internal - autonomous session maintenance + + + +USERINCLUDE ../srcoperations +USERINCLUDE ../srcoperations/sessionmng +USERINCLUDE ../../core/srcdatamodel + + +USERINCLUDE ../srcutils +USERINCLUDE ../srcprocessor +USERINCLUDE ../../presence/srcpresenceoperations + + +// TODO remove unnecessary +SYSTEMINCLUDE ../../inc/core/base +SYSTEMINCLUDE ../../inc/core/datamodel +SYSTEMINCLUDE ../../inc/core/protocolplugin +SYSTEMINCLUDE ../../inc/core/protocolpluginhost +SYSTEMINCLUDE ../../inc/presence/presencedatamodel +SYSTEMINCLUDE ../../inc/presence/presencemanagement +SYSTEMINCLUDE ../../inc/presence/presenceprotocolplugin +SYSTEMINCLUDE ../../inc/presence/presenceprotocolpluginhost +MW_LAYER_SYSTEMINCLUDE + + + +LIBRARY euser.lib +LIBRARY estor.lib +LIBRARY ximputils.lib +LIBRARY ximpdatamodel.lib +LIBRARY ximpprocessor.lib +LIBRARY presenceoperation.lib +LIBRARY ecom.lib + +// End of file + diff -r 000000000000 -r e6b17d312c8b ximpfw/core/group/ximpprocessor.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/group/ximpprocessor.mmp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,104 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project definition file for Presence Framework +* +*/ + +#include +#include +#include "../../group/ximpdlluids.hrh" + + + +TARGET ximpprocessor.dll +TARGETTYPE dll +UID XIMP_DLL_UID_STATIC_INTERFACE XIMP_DLL_UID_COMMON + + +CAPABILITY CAP_GENERAL_DLL +VENDORID VID_DEFAULT + + +SOURCEPATH ../srcprocessor +SOURCE ximpglobals.cpp +SOURCE ximppluginfactory.cpp +SOURCE ximpfeaturemanager.cpp +SOURCE ximphostmanager.cpp +SOURCE ximphostimp.cpp +SOURCE ximppsccontextimp.cpp +SOURCE ximpoperationbase.cpp +SOURCE ximpprotocolrequestcompleteeventimp.cpp + +//Event system +SOURCE ximpeventmanager.cpp +SOURCE ximpeventcapsule.cpp +SOURCE ximpcontexteventqueue.cpp + +SOURCEPATH ../../presence/srcpresenceprocessor +//Data host +SOURCE protocolpresencedatahostimp.cpp +SOURCE protocolpresenceauthorizationdatahostimp.cpp +SOURCE protocolpresencepublishingdatahostimp.cpp +SOURCE protocolpresencewatchingdatahostimp.cpp +SOURCE protocolpresentitygroupsdatahostimp.cpp + + + + + + + + + + +USERINCLUDE ../srcprocessor +USERINCLUDE ../srcoperations +USERINCLUDE ../srcutils +USERINCLUDE ../../presence/srcpresenceprocessor +USERINCLUDE ../../core/srcdatamodel +USERINCLUDE ../../presence/srcpresenceoperations +USERINCLUDE ../../presence/srcpresencedatamodel +USERINCLUDE ../../presence/srcpresencedatamodel/presentitygroups +USERINCLUDE ../../presence/srcpresencedatamodel/presencewatching +USERINCLUDE ../../presence/srcpresencedatamodel/presenceauthorization +USERINCLUDE ../../presence/srcpresencedatamodel/presencepublishing +USERINCLUDE ../../group + + + + + +// TODO remove unnecessary +SYSTEMINCLUDE ../../inc/core/base +SYSTEMINCLUDE ../../inc/core/datamodel +SYSTEMINCLUDE ../../inc/core/protocolplugin +SYSTEMINCLUDE ../../inc/core/protocolpluginhost +SYSTEMINCLUDE ../../inc/presence/presencedatamodel +SYSTEMINCLUDE ../../inc/presence/presencemanagement +SYSTEMINCLUDE ../../inc/presence/presenceprotocolplugin +SYSTEMINCLUDE ../../inc/presence/presenceprotocolpluginhost +MW_LAYER_SYSTEMINCLUDE + + +LIBRARY euser.lib +LIBRARY ecom.lib +LIBRARY estor.lib +LIBRARY centralrepository.lib +LIBRARY bafl.lib +LIBRARY ximputils.lib +LIBRARY ximpdatamodel.lib +LIBRARY presencedatamodel.lib +LIBRARY flogger.lib + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/core/group/ximprootserver.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/group/ximprootserver.mmp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,47 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project definition file for Presence Framework Root Server +* +*/ + +#include +#include +#include "../../group/ximpdlluids.hrh" + + +TARGET ximprootserver.exe +TARGETTYPE exe +UID 0x0 XIMP_EXE_UID_ROOT_SERVER + +CAPABILITY CAP_SERVER +VENDORID VID_DEFAULT + +SOURCEPATH ../srcrootserver +SOURCE ximprootserver.cpp +SOURCE ximprootserversessionadapter.cpp +SOURCE ximprootsession.cpp + +USERINCLUDE ../srcrootserver +USERINCLUDE ../srcprocessor +USERINCLUDE ../srcoperations +USERINCLUDE ../srcutils +SYSTEMINCLUDE ../../inc/core/base +MW_LAYER_SYSTEMINCLUDE + + +LIBRARY euser.lib +LIBRARY ecom.lib +LIBRARY ximputils.lib +LIBRARY ximpprocessor.lib +LIBRARY ximpoperations.lib \ No newline at end of file diff -r 000000000000 -r e6b17d312c8b ximpfw/core/group/ximpserver.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/group/ximpserver.mmp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,60 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project definition file for Presence Framework PSC Server +* +*/ + +#include +#include +#include "../../group/ximpdlluids.hrh" + +TARGET ximpserver.exe +TARGETTYPE exe +UID 0x0 XIMP_EXE_UID_PROTOCOL_CONNECTION_SERVER + +CAPABILITY CAP_SERVER +VENDORID VID_DEFAULT +EPOCSTACKSIZE 0x5000 // 20KB +SOURCEPATH ../srcpscserver +SOURCE ximpserver.cpp +SOURCE ximpserversessionadapter.cpp +SOURCE ximpcontextsession.cpp + + +USERINCLUDE ../srcpscserver +USERINCLUDE ../srcprocessor +USERINCLUDE ../srcoperations +USERINCLUDE ../../core/srcdatamodel +USERINCLUDE ../../presence/srcpresencedatamodel +USERINCLUDE ../../presence/srcpresencedatamodel/presentitygroups +USERINCLUDE ../../presence/srcpresencedatamodel/presencewatching +USERINCLUDE ../../presence/srcpresencedatamodel/presenceauthorization +USERINCLUDE ../../presence/srcpresencedatamodel/presencepublishing +USERINCLUDE ../srcutils +SYSTEMINCLUDE ../../inc/core/base +SYSTEMINCLUDE ../../inc/core/datamodel +SYSTEMINCLUDE ../../inc/core/protocolplugin + + +MW_LAYER_SYSTEMINCLUDE + + +LIBRARY euser.lib +LIBRARY estor.lib +LIBRARY ecom.lib +LIBRARY ximputils.lib +LIBRARY ximpdatamodel.lib +LIBRARY ximpprocessor.lib +LIBRARY ximpoperations.lib + diff -r 000000000000 -r e6b17d312c8b ximpfw/core/group/ximpsrvclient.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/group/ximpsrvclient.mmp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,49 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project definition file for Presence Framework Server Client +* +*/ + +// To get the MW_LAYER_SYSTEMINCLUDE-definition +#include + +#include + +#include "../../group/ximpdlluids.hrh" + + +TARGET ximpsrvclient.dll +TARGETTYPE dll +UID XIMP_DLL_UID_STATIC_INTERFACE XIMP_DLL_UID_COMMON + +CAPABILITY CAP_GENERAL_DLL +VENDORID VID_DEFAULT + +SOURCEPATH ../srcclient +SOURCE ximpprocessstarter.cpp +SOURCE ximpsrvrootclient.cpp +SOURCE ximpsrvcontextclient.cpp + +USERINCLUDE ../srcutils +USERINCLUDE ../srcclient +USERINCLUDE ../srcpscserver +USERINCLUDE ../srcrootserver +// Default system include paths for middleware layer modules. +MW_LAYER_SYSTEMINCLUDE + + +LIBRARY euser.lib // base +LIBRARY estor.lib // streams +LIBRARY efsrv.lib // file server +LIBRARY ximputils.lib \ No newline at end of file diff -r 000000000000 -r e6b17d312c8b ximpfw/core/group/ximputils.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/group/ximputils.mmp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,56 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project definition file for Presence Framework Utils +* +*/ + +#include +#include +#include "../../group/ximpdlluids.hrh" + + + +TARGET ximputils.dll +TARGETTYPE dll +UID XIMP_DLL_UID_STATIC_INTERFACE XIMP_DLL_UID_COMMON + +CAPABILITY CAP_GENERAL_DLL +VENDORID VID_DEFAULT + + +SOURCEPATH ../srcutils +SOURCE ximpsrvsessionadapter.cpp +SOURCE ximpsrvmessageimp.cpp +SOURCE ximprequestidbuilder.cpp + +//Trace services +SOURCE ximptrace.cpp + +//Common helpers +SOURCE ximprbufhelpers.cpp +SOURCE ximpobjecthelpers.cpp +SOURCE ximppanics.cpp + +// TODO remove unnecessary +USERINCLUDE ../srcutils +USERINCLUDE ../../core/srcdatamodel +SYSTEMINCLUDE ../../inc/presence/presencedatamodel +SYSTEMINCLUDE ../../inc/core/datamodel +MW_LAYER_SYSTEMINCLUDE + + +LIBRARY euser.lib // base +LIBRARY estor.lib // streams +LIBRARY flogger.lib + diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcclient/ximpprocessstarter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcclient/ximpprocessstarter.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,396 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework process starter implementation. +* +*/ + + +// INCLUDE FILES +#include "ximpprocessstarter.h" +#include +#include + + +// CONSTANTS +_LIT( KEka2ExeDir,"\\sys\\bin\\"); +_LIT( KEka2LaunchMutexExt, "[lMtx]" ); +const TInt KEka2SrvConnTries = 7; // Try to start 7 times + // before giving up +const TInt KEka2SrvConnInitialRetryWait = 500; // MicroSeconds => 0.0005s + + + +// ============================================================== +// ====================== HELPER CLASS ========================== +// ============================================================== + +/** + * RSessionBase accessor to give to the XIMPProcessStarter + * access to RSessionBase::CreateSession(). + */ +class REka2SessionBaseAccessor : public RSessionBase + { + public: // Constructor + inline REka2SessionBaseAccessor() + { + } + + public: // New functions + + /** + * Public access to RSessionBase::CreateSession(). + */ + inline TInt CreateSession( const TDesC& aServer, + const TVersion& aVersion, + TInt aAsyncMessageSlots ) + { + return RSessionBase::CreateSession( aServer, + aVersion, + aAsyncMessageSlots ); + } + }; + + +// ============================================================== +// ====================== PROCESSSTARTER ======================== +// ============================================================== + + +// -------------------------------------------------------------- +// XIMPProcessStarter::FullExePathForClienLocation() +// -------------------------------------------------------------- +// +EXPORT_C void XIMPProcessStarter::FullExePathForClienLocation( + const TDesC& aExeName, + TFileName& aFullExePath ) + { + //Get drive (C:) where this client code is installed + { + TFileName tmp; + Dll::FileName( tmp ); + aFullExePath.Copy( TParsePtrC( tmp ).Drive() ); + } + + //Build the rest from the exe path + aFullExePath.Append( KEka2ExeDir ); + aFullExePath.Append( aExeName ); + } + + +// -------------------------------------------------------------- +// XIMPProcessStarter::StartInstance() +// -------------------------------------------------------------- +// +EXPORT_C TInt XIMPProcessStarter::StartInstance( + const TDesC& aFullExePath, + const TDesC& aCommand, + const TArray< TXIMPProcessStartupParam >* aParams ) + { + RMutex launchMutex; + TInt error = KErrNotFound; + + { + // Dynamic mutex name used to allow code share + TName launchMutexName( TParsePtrC( aFullExePath ).Name() ); + launchMutexName.Append( KEka2LaunchMutexExt ); + + // Open or Create mutex to serialize to access to server startup code. + // (race condition safe way) + while( error == KErrNotFound ) + { + error = launchMutex.CreateGlobal( launchMutexName ); + if( error != KErrAlreadyExists ) + { + break; + } + error = launchMutex.OpenGlobal( launchMutexName ); + } + + if( error != KErrNone ) + { + return error; + } + } + + + launchMutex.Wait(); + + //Serialized access + error = XIMPProcessStarter::DoStartInstance( aFullExePath, + aCommand, + aParams ); + + launchMutex.Signal(); + launchMutex.Close(); + + return error; + } + + +// -------------------------------------------------------------- +// XIMPProcessStarter::ConnectToServer() +// -------------------------------------------------------------- +// +EXPORT_C TInt XIMPProcessStarter::ConnectToServer( + const TDesC& aFullExePath, + const TDesC& aCommand, + const TArray< TXIMPProcessStartupParam >* aParams, + RSessionBase& aSessionToConnect, + const TDesC& aServerName, + const TVersion& aClientVersion, + TInt aAsyncMessageSlots ) + { + if( aSessionToConnect.Handle() != KNullHandle ) + { + return KErrInUse; + } + + TInt err = KErrNone; + TInt startupWait = KEka2SrvConnInitialRetryWait; + + //Server connect and launch loop + for( TInt trie = 0 ; trie < KEka2SrvConnTries ; trie++ ) + { + REka2SessionBaseAccessor acc; + err = acc.CreateSession( aServerName, + aClientVersion, + aAsyncMessageSlots ); + + if( err == KErrNone ) + { + //session ownership is now on client + aSessionToConnect = acc; + return KErrNone; + } + + else if( ( err == KErrNotFound ) || + ( err == KErrServerTerminated ) ) + { + //Server missing or died when connecting + //Start a new server + err = XIMPProcessStarter::StartInstance( aFullExePath, + aCommand, + aParams ); + + //If process exist already, then all is fine + //(some other process started it between the origical connect and launch trie) + if( err == KErrAlreadyExists ) + { + err = KErrNone; + } + + //If server process start failed, bail out. + if( err != KErrNone ) + { + return err; + } + + //If this is 2nd or subsequent try, + //give some time for server to startup + if( trie > 0 ) + { + User::After( startupWait ); // CSI: 92 # + startupWait = 2 * startupWait; + } + } + + else + { + //Server process start failed. Bail out. + return err; + } + } + + return err; + } + + +// -------------------------------------------------------------- +// XIMPProcessStarter::DoStartServerInstance() +// -------------------------------------------------------------- +// +TInt XIMPProcessStarter::DoStartInstance( + const TDesC& aFullExePath, + const TDesC& aCommand, + const TArray< TXIMPProcessStartupParam >* aParams ) + { + TInt error = KErrNone; + + //Create process + RProcess process; + error = process.Create( aFullExePath, aCommand ); + + if( error == KErrNone ) + { + //Set process startup parameters + error = ApplyParameters( aParams, process ); + + //And execute the process and wait it's startup + if( error == KErrNone ) + { + TRequestStatus rendezvousStatus; + process.Rendezvous( rendezvousStatus ); + + process.Resume(); + User::WaitForRequest( rendezvousStatus ); // CSI: 94 # + error = rendezvousStatus.Int(); + + if( process.ExitType() != EExitPending ) + { + //Something failed in server startup + //Force the error code to be always something + //else than KErrNone + if( error == KErrNone ) + { + error = KErrServerTerminated; + } + } + } + } + + process.Close(); + + return error; + } + + +// -------------------------------------------------------------- +// XIMPProcessStarter::ApplyParameters() +// -------------------------------------------------------------- +// +TInt XIMPProcessStarter::ApplyParameters( + const TArray< TXIMPProcessStartupParam >* aParams, + RProcess& aProcess ) + { + TInt error = KErrNone; + if( aParams ) + { + const TInt paramCount = aParams->Count(); + for( TInt ix = 0; ix < paramCount; ix++ ) + { + error = (*aParams)[ ix ].ApplyParam( aProcess ); + if( error != KErrNone ) + { + break; + } + } + } + + return error; + } + + +// ============================================================== +// ================== TPROCESSSTARTUPPARAM ====================== +// ============================================================== + +// -------------------------------------------------------------- +// TXIMPProcessStartupParam::TXIMPProcessStartupParam() +// -------------------------------------------------------------- +// +EXPORT_C TXIMPProcessStartupParam::TXIMPProcessStartupParam() + : iType( EUnknown ), + iSlot( KErrNotFound ) + { + } + + +// -------------------------------------------------------------- +// TXIMPProcessStartupParam::Set() +// -------------------------------------------------------------- +// +void TXIMPProcessStartupParam::Set( TInt aSlot, + const RHandleBase& aHandle ) + { + iType = EHandle; + iSlot = aSlot; + iHandle = &aHandle; + } + + +// -------------------------------------------------------------- +// TXIMPProcessStartupParam::Set() +// -------------------------------------------------------------- +// +void TXIMPProcessStartupParam::Set( TInt aSlot, + const RSubSessionBase& aSubSession ) + { + iType = ESubSession; + iSlot = aSlot; + iSubSession = &aSubSession; + } + + +// -------------------------------------------------------------- +// TXIMPProcessStartupParam::Set() +// -------------------------------------------------------------- +// +void TXIMPProcessStartupParam::Set( TInt aSlot, + const TDesC16& aDes ) + { + iType = EDes16; + iSlot = aSlot; + iDes16.Set( aDes ); + } + + +// -------------------------------------------------------------- +// TXIMPProcessStartupParam::Set() +// -------------------------------------------------------------- +// +void TXIMPProcessStartupParam::Set( TInt aSlot, + const TDesC8& aDes ) + { + iType = EDes8; + iSlot = aSlot; + iDes8.Set( aDes ); + } + + +// -------------------------------------------------------------- +// TXIMPProcessStartupParam::Set() +// -------------------------------------------------------------- +// +EXPORT_C void TXIMPProcessStartupParam::Set( TInt aSlot, + TInt aInt ) + { + iType = EInt; + iSlot = aSlot; + iInt = aInt; + } + + +// -------------------------------------------------------------- +// TXIMPProcessStartupParam::ApplyParam() +// -------------------------------------------------------------- +// +TInt TXIMPProcessStartupParam::ApplyParam( RProcess& aProcess ) const + { + switch( iType ) + { + case EHandle: return aProcess.SetParameter( iSlot, *iHandle ); + case ESubSession: return aProcess.SetParameter( iSlot, *iSubSession ); + case EDes16: return aProcess.SetParameter( iSlot, iDes16 ); + case EDes8: return aProcess.SetParameter( iSlot, iDes8 ); + case EInt: return aProcess.SetParameter( iSlot, iInt ); + } + + return KErrUnknown; + } + + +// END OF FILE + + + diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcclient/ximpprocessstarter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcclient/ximpprocessstarter.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,151 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework process starter. +* +*/ + +#ifndef XIMPPROCESSSTARTER_H +#define XIMPPROCESSSTARTER_H + +#include +class TXIMPProcessStartupParam; + + + +/** + * + * + * + * + * @lib ?library + * @since S60 v4.0 + */ +class XIMPProcessStarter + { +public: // New methods + /** + * + * + * + * + */ + IMPORT_C static void FullExePathForClienLocation( + const TDesC& aExeName, + TFileName& aFullExePath ); + + /** + * + * Usage example: + * TFixedArray< TXIMPProcessStartupParam, 2 > params; + * params[ 0 ].Set( 1, 1001 ); + * params[ 2 ].Set( 2, _L("value") ); + * TArray< TXIMPProcessStartupParam> paramsArray = params.Array(); + * TInt err = XIMPProcessStarter::StartInstance( KMySrvServerExe, + * _L("command line"), + * ¶msArray ); + */ + IMPORT_C static TInt StartInstance( + const TDesC& aFullExePath, + const TDesC& aCommand, + const TArray< TXIMPProcessStartupParam >* aParams ); + + + /** + * + * + * + * + */ + IMPORT_C static TInt ConnectToServer( + const TDesC& aFullExePath, + const TDesC& aCommand, + const TArray< TXIMPProcessStartupParam >* aParams, + RSessionBase& aSessionToConnect, + const TDesC& aServerName, + const TVersion& aClientVersion, + TInt aAsyncMessageSlots ); + + + +private: // Helpers + static TInt DoStartInstance( + const TDesC& aFullExePath, + const TDesC& aCommand, + const TArray< TXIMPProcessStartupParam >* aParams ); + + static TInt ApplyParameters( + const TArray< TXIMPProcessStartupParam >* aParams, + RProcess& aProcess ); + + }; + + + + +/** + * Generic process startup parameters. + * + * + * + */ +class TXIMPProcessStartupParam + { +public: + + /** + * C++ constructor + */ + IMPORT_C TXIMPProcessStartupParam(); + + /** + * + */ + void Set( TInt aSlot, const RHandleBase& aHandle ); + void Set( TInt aSlot, const RSubSessionBase& aSubSession ); + void Set( TInt aSlot, const TDesC16& aDes ); + void Set( TInt aSlot, const TDesC8& aDes ); + IMPORT_C void Set( TInt aSlot, TInt aInt ); + + + /** + * + * + * @return + */ + TInt ApplyParam( RProcess& aProcess ) const; + + + +private: //data + + enum TParamType{ EUnknown, EHandle, ESubSession, + EDes16, EDes8, EInt }; + //OWN: + TParamType iType; + + //OWN: + TInt iSlot; + + //OWN: + const RHandleBase* iHandle; + const RSubSessionBase* iSubSession; + TPtrC16 iDes16; + TPtrC8 iDes8; + TInt iInt; + }; + + +#endif // XIMPPROCESSSTARTER_H + + diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcclient/ximpsrvcontextclient.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcclient/ximpsrvcontextclient.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,273 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework PSC Server context session. + * +*/ + +#include "ximpsrvcontextclient.h" +#include "ximpprocessstarter.h" +#include "ximpserverdefs.h" + +#include + +//Import NXIMPSrv +using namespace NXIMPSrv; + + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// RXIMPSrvContextClient::RXIMPSrvContextClient() +// --------------------------------------------------------------------------- +// +EXPORT_C RXIMPSrvContextClient::RXIMPSrvContextClient() + { + } + + +// --------------------------------------------------------------------------- +// RXIMPSrvContextClient::Connect() +// --------------------------------------------------------------------------- +// +EXPORT_C void RXIMPSrvContextClient::ConnectL( TUid aProtocolImpUid ) + { + iMyUid = aProtocolImpUid; + + // create the server name: "!XIMPCtxSrv9bde667a" + HBufC* serverName = HBufC::NewLC( NName::KSymbianServer().Length() + + NStartupParam::KProtocolUidMaxLen + + 1 ); + + serverName->Des().Copy( NName::KSymbianServer ); + serverName->Des().AppendNumFixedWidth( iMyUid.iUid, + EHex, + NStartupParam::KProtocolUidMaxLen ); + + // Pass the UID to server side. + // For security reasons it was not allowed to pass the complete + // server name descriptor but just the UID part + RArray< TXIMPProcessStartupParam > params; + CleanupClosePushL( params ); + + TXIMPProcessStartupParam paramUid; + paramUid.Set( NStartupParam::KProtocolUidIndex, + iMyUid.iUid ); + + User::LeaveIfError( params.Append( paramUid ) ); + TArray< TXIMPProcessStartupParam > array = params.Array(); + + + //Get path to correct exe to launch + TFileName fullExePath; + XIMPProcessStarter::FullExePathForClienLocation( NName::KExecutable, + fullExePath ); + + //Create a connection + TInt ret = XIMPProcessStarter::ConnectToServer( fullExePath, + KNullDesC, + &array, + *this, + *serverName, + TVersion( NVersion::KMajor, + NVersion::KMinor, + NVersion::KBuild ), + NRequest::KMsgSlotCount ); + User::LeaveIfError( ret ); + CleanupStack::PopAndDestroy( 2, serverName ); // params, serverName + + //Mutate the server side session to correct type + User::LeaveIfError( SendReceive( NRequest::EBecomeCtxSession ) ); + } + + + +// --------------------------------------------------------------------------- +// RXIMPSrvContextClient::Close() +// --------------------------------------------------------------------------- +// +EXPORT_C void RXIMPSrvContextClient::Close() + { + RSessionBase::Close(); + #if _BullseyeCoverage + cov_write(); + #endif + } + + +// --------------------------------------------------------------------------- +// RXIMPSrvContextClient::DoQueueOperation() +// --------------------------------------------------------------------------- +// +EXPORT_C TInt RXIMPSrvContextClient::DoQueueOperation( + TInt aOperationType, + const TDesC8& aOperationParams, + TXIMPRequestId& aReqId ) + { + TPckgBuf< TXIMPRequestId > reqIdPck; + + TIpcArgs msgArgs; + msgArgs.Set( 0, aOperationType ); + msgArgs.Set( 1, &aOperationParams ); + msgArgs.Set( 2, &reqIdPck ); + + TInt err = SendReceive( NRequest::ECtxSsQueueOperation, msgArgs ); + + aReqId = reqIdPck(); + return err; + } + +// --------------------------------------------------------------------------- +// RXIMPSrvContextClient::DoQueueOperation2() +// --------------------------------------------------------------------------- +// +EXPORT_C TInt RXIMPSrvContextClient::DoQueueOperation2( + TInt aOperationType, + const TDesC8& aOperationParams, + TXIMPRequestId& aReqId ) + { + TPckgBuf< TXIMPRequestId > reqIdPck; + + TIpcArgs msgArgs; + msgArgs.Set( 0, aOperationType ); + msgArgs.Set( 1, &aOperationParams ); + msgArgs.Set( 2, &reqIdPck ); + + TInt err = SendReceive( NRequest::ECtxSsQueueBindOperation, msgArgs ); + aReqId = reqIdPck(); + return err; + } + +// --------------------------------------------------------------------------- +// RXIMPSrvContextClient::GetContextCapabilitiesL() +// --------------------------------------------------------------------------- +// +EXPORT_C HBufC8* RXIMPSrvContextClient::GetContextFeaturesL() const + { + return PrepareAndGetDataL( NRequest::ECtxSsPrepareContextFeatures ); + } + + +// --------------------------------------------------------------------------- +// RXIMPSrvContextClient::ListenEvent() +// --------------------------------------------------------------------------- +// +EXPORT_C void RXIMPSrvContextClient::ListenEvent( TRequestStatus& aStatus ) + { + SendReceive( NRequest::ECtxSsSetEventListenScout, aStatus ); + } + + +// --------------------------------------------------------------------------- +// RXIMPSrvContextClient::CancelListening() +// --------------------------------------------------------------------------- +// +EXPORT_C void RXIMPSrvContextClient::CancelListening() + { + SendReceive( NRequest::ECtxSsCancelEventListenScout ); + } + + +// --------------------------------------------------------------------------- +// RXIMPSrvContextClient::InstallEventFilterL() +// --------------------------------------------------------------------------- +// +EXPORT_C void RXIMPSrvContextClient::InstallEventFilterL( + const TDesC8& aFilterData ) + { + TIpcArgs msgArgs; + msgArgs.Set( 0, &aFilterData ); + User::LeaveIfError( SendReceive( NRequest::ECtxSsInstallEventFilter, + msgArgs ) ); + } + + +// --------------------------------------------------------------------------- +// RXIMPSrvContextClient::FetchTopEventDataLC() +// --------------------------------------------------------------------------- +// +EXPORT_C HBufC8* RXIMPSrvContextClient::FetchTopEventDataLC() + { + TInt bufSize = SendReceive( NRequest::ECtxSsFetchTopEventDataSize ); + User::LeaveIfError( bufSize ); + + HBufC8* eventBuf = HBufC8::NewLC( bufSize ); + TPtr8 ptrBuf( eventBuf->Des() ); + + TIpcArgs msgArgs; + msgArgs.Set( 0, &ptrBuf ); + + User::LeaveIfError( SendReceive( NRequest::ECtxSsFetchTopEventData, + msgArgs ) ); + return eventBuf; + } + + +// --------------------------------------------------------------------------- +// RXIMPSrvContextClient::FetchTopEventReqId() +// --------------------------------------------------------------------------- +// +EXPORT_C TInt RXIMPSrvContextClient::FetchTopEventReqId( + TXIMPRequestId& aReqId ) + { + TPckgBuf< TXIMPRequestId > reqIdPck; + + TIpcArgs msgArgs; + msgArgs.Set( 0, &reqIdPck ); + + TInt err = SendReceive( NRequest::ECtxSsFetchTopEventReqId, msgArgs ); + + aReqId = reqIdPck(); + return err; + } + + + +// --------------------------------------------------------------------------- +// RXIMPSrvContextClient::DropTopEvent() +// --------------------------------------------------------------------------- +// +EXPORT_C TInt RXIMPSrvContextClient::DropTopEvent() + { + TInt err = SendReceive( NRequest::ECtxSsDropTopEvent ); + return err; + } + + + +// --------------------------------------------------------------------------- +// RXIMPSrvContextClient::PrepareAndGetDataL() +// --------------------------------------------------------------------------- +// +HBufC8* RXIMPSrvContextClient::PrepareAndGetDataL( TInt aMsg ) const + { + TInt bufSize = SendReceive( aMsg ); + User::LeaveIfError( bufSize ); + + HBufC8* buf = HBufC8::NewLC( bufSize ); + TPtr8 ptrBuf( buf->Des() ); + + TIpcArgs msgArgs; + msgArgs.Set( 0, &ptrBuf ); + + User::LeaveIfError( SendReceive( NRequest::ECtxSsGetPreparedData, + msgArgs ) ); + + CleanupStack::Pop( buf ); + return buf; + } + + +// End of file + + diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcclient/ximpsrvcontextclient.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcclient/ximpsrvcontextclient.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,174 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework PSC Server context session. + * +*/ + +#ifndef XIMPSRVCONTEXTCLIENT_H__ +#define XIMPSRVCONTEXTCLIENT_H__ + +#include +#include + + +class CXIMPContextEventFilter; +class CXIMPServiceInfoImp; +class CXIMPFeatureInfoImp; +class CBufFlat; + + +/** + * XIMP Framework server context session. + * + * @lib ximpsrvclient.dll + * @since S60 v3.2 + */ +class RXIMPSrvContextClient : public RSessionBase + { + public: + + /** + * Default constructor. + */ + IMPORT_C RXIMPSrvContextClient(); + + + /** + * Session connection method. + * @param aProtocolImpUid The UID of protocol to associate with + * this context client. + */ + IMPORT_C void ConnectL( TUid aProtocolImpUid ); + + + /** + * Closes server connection. + */ + IMPORT_C void Close(); + + + /** + * Issues context operation request to server. + * + * @param aOperationType In parameter identifying the operation. + * @param aOperationParams In parameter package for operation. + * @param aReqId Request ID identifying started request. + * @return Error from issuing the request. + */ + IMPORT_C TInt DoQueueOperation( + TInt aOperationType, + const TDesC8& aOperationParams, + TXIMPRequestId& aReqId ); + + + /** + * Issues context operation request to server. + * To be used when binding with settings id + * + * @param aOperationType In parameter identifying the operation. + * @param aOperationParams In parameter package for operation. + * @param aReqId Request ID identifying started request. + * @return Error from issuing the request. + */ + IMPORT_C TInt DoQueueOperation2( + TInt aOperationType, + const TDesC8& aOperationParams, + TXIMPRequestId& aReqId ); + + /** + * Gets presence contexts features. + * + * @return Presence context features as an externalized + * CXIMPFeatureInfoImp. Object ownership is returned to caller. + */ + IMPORT_C HBufC8* GetContextFeaturesL() const; + + + /** + * Issues asynchronous request to listen presence context + * events. + * + * @param aStatus Request status to complete + * when new event object is available. + */ + IMPORT_C void ListenEvent( TRequestStatus& aStatus ); + + + /** + * Cancels event listen request. + */ + IMPORT_C void CancelListening(); + + + /** + * Installs new event filter for presence context event queue. + * + * @return aFilterData Event filter data to use. + */ + IMPORT_C void InstallEventFilterL( const TDesC8& aFilterData ); + + + /** + * Gets event data from event queue. + * + * @return Event object data from event queue. + * Object ownership is returned to caller. + * Leaves with KErrNotFound if there isn't + * any event available in event queue. + */ + IMPORT_C HBufC8* FetchTopEventDataLC(); + + + /** + * Fetch top event req id. + * + * @param aReqId On the return contains, the top event req id. + * + * @return Error from req id fetch. + */ + IMPORT_C TInt FetchTopEventReqId( TXIMPRequestId& aReqId ); + + + /** + * Drops top event from event queue. + * + * @return Error from drop. + */ + IMPORT_C TInt DropTopEvent(); + + + private: + + /** + * Helper to prepare and get data from server side. + * + * @return Externalized object to be passed onward + */ + HBufC8* PrepareAndGetDataL( TInt aMsg ) const; + + + private: + + /** + * UID of the used protocol. + */ + TUid iMyUid; + + }; + + +#endif // XIMPSRVCONTEXTCLIENT_H__ + + + diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcclient/ximpsrvrootclient.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcclient/ximpsrvrootclient.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,129 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework server root client implementation +* +*/ + + +// INCLUDE FILES +#include "ximpbase.h" +#include "ximpsrvrootclient.h" +#include "ximpprocessstarter.h" +#include "ximprootserverdefs.h" + +#include +#include + + +//Include Root server namespace +using namespace NRootSrv; + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// RXIMPSrvRootClient::RXIMPSrvRootClient() +// --------------------------------------------------------------------------- +// +EXPORT_C RXIMPSrvRootClient::RXIMPSrvRootClient() + { + } + + +// --------------------------------------------------------------------------- +// RXIMPSrvRootClient::Connect() +// --------------------------------------------------------------------------- +// +EXPORT_C TInt RXIMPSrvRootClient::Connect() + { + TFileName fullExePath; + XIMPProcessStarter::FullExePathForClienLocation( NName::KExecutable, + fullExePath ); + + TInt ret = XIMPProcessStarter::ConnectToServer( fullExePath, + KNullDesC, + NULL, + *this, + NName::KSymbianServer, + TVersion( NVersion::KMajor, + NVersion::KMinor, + NVersion::KBuild ), + NRequest::KMsgSlotCount ); + + if ( ret == KErrNone ) + { + TIpcArgs msgArgs; + ret = SendReceive( NRequest::EBecomeRootSession, msgArgs ); + } + + return ret; + } + + +// --------------------------------------------------------------------------- +// RXIMPSrvRootClient::Close() +// --------------------------------------------------------------------------- +// +EXPORT_C void RXIMPSrvRootClient::Close() + { + RSessionBase::Close(); + #if _BullseyeCoverage + cov_write(); + #endif + } + + +// --------------------------------------------------------------------------- +// RXIMPSrvRootClient::GetProtocolListL() +// --------------------------------------------------------------------------- +// +EXPORT_C HBufC8* RXIMPSrvRootClient::GetKnownProtocolsL() + { + return GetDataL( NRequest::ERootSsPrepareProtocolList ); + } + + +// --------------------------------------------------------------------------- +// RXIMPSrvRootClient::GetSupportedFrameworkFeaturesL() +// --------------------------------------------------------------------------- +// +EXPORT_C HBufC8* RXIMPSrvRootClient::GetSupportedFrameworkFeaturesL() + { + return GetDataL( NRequest::ERootSsPrepareSupportedFeatures ); + } + + +// --------------------------------------------------------------------------- +// RXIMPSrvRootClient::GetDataL() +// --------------------------------------------------------------------------- +// +HBufC8* RXIMPSrvRootClient::GetDataL( TInt aMsg ) + { + TInt bufSize = SendReceive( aMsg ); + User::LeaveIfError( bufSize ); + + HBufC8* buf = HBufC8::NewLC( bufSize ); + TPtr8 ptrBuf( buf->Des() ); + + TIpcArgs msgArgs; + msgArgs.Set( 0, &ptrBuf ); + + User::LeaveIfError( SendReceive( NRequest::ERootSsFetchServerSideData, msgArgs ) ); + + CleanupStack::Pop( buf ); + return buf; + } + + +// End of file + diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcclient/ximpsrvrootclient.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcclient/ximpsrvrootclient.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,88 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework server root session. +* +*/ + +#ifndef XIMPSRVROOTCLIENT_H__ +#define XIMPSRVROOTCLIENT_H__ + +#include +#include + + +/** + * XIMP Framework server root session. + * + * @lib ximpsrvclient.dll + * @since S60 v3.2 + */ +class RXIMPSrvRootClient : public RSessionBase + { +public: + + /** + * Default constructor. + */ + IMPORT_C RXIMPSrvRootClient(); + + + /** + * Session connection method. + * + * @return Error code from creating server connection. + */ + IMPORT_C TInt Connect(); + + + /** + * Closes server connection. + */ + IMPORT_C void Close(); + + + /** + * Retrieves a list of known protocols and their details. + * + * @return Externalized version of + * RXIMPObjOwningPtrArray< CXIMPProtocolInfoImp >, containing the + * protocols. Ownership transferred to caller. + */ + IMPORT_C HBufC8* GetKnownProtocolsL(); + + + /** + * Gets supported framework features. + * + * @return Supported framework features, externalized + * CXIMPFeatureInfoImp. Ownership transferred to caller. + */ + IMPORT_C HBufC8* GetSupportedFrameworkFeaturesL(); + +private: + + /** + * Helper to get data from server side. + * @return Externalized object to be passed onward + */ + HBufC8* GetDataL( TInt aMsg ); + + + }; + + +#endif // XIMPSRVROOTCLIENT_H__ + + + diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcdatamodel/ximpapidataobjbase.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcdatamodel/ximpapidataobjbase.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,42 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: API data object base implementation. +* +*/ + +#include "ximpapidataobjbase.h" + + +// ============================ MEMBER FUNCTIONS ============================= + +// --------------------------------------------------------------------------- +// CXIMPApiDataObjBase::CXIMPApiDataObjBase() +// --------------------------------------------------------------------------- +// +EXPORT_C CXIMPApiDataObjBase::CXIMPApiDataObjBase() + { + } + + +// --------------------------------------------------------------------------- +// CXIMPApiDataObjBase::~CXIMPApiDataObjBase() +// --------------------------------------------------------------------------- +// +EXPORT_C CXIMPApiDataObjBase::~CXIMPApiDataObjBase() + { + } + + + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcdatamodel/ximpapidataobjfactory.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcdatamodel/ximpapidataobjfactory.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,125 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Base class for API implementations. +* +*/ + + +#include + +#include "ximpapidataobjfactory.h" +#include "ximpapidataobjbase.h" + +// to access the internal factory methods of feature plug-ins +#include "ximpfeaturepluginholder.h" +#include "apidataobjfactoryaccessor.h" +#include "apidataobjfactory.h" + +// ============================ MEMBER FUNCTIONS ============================= + +// --------------------------------------------------------------------------- +// XIMPApiDataObjFactory::InternalizeL +// --------------------------------------------------------------------------- +// +EXPORT_C void XIMPApiDataObjFactory::InternalizeL( + RReadStream& aStream, + RPrReqParamArray& aArray ) + { + TInt32 arrLen = aStream.ReadInt32L(); + + for ( TInt i = 0; i < arrLen; i++ ) + { + SXIMPReqParam param; + param.iParamType = aStream.ReadInt32L(); + CXIMPApiDataObjBase* dataObject = NewDataObjectFromStreamLC( param.iParamType, aStream ); + + // Try to create presence data object + MApiDataObjFactoryAccessor* presenceObjFactoryAcc = FeaturePluginHolder::PresenceObjFactoryAccessor(); + if ( !dataObject && presenceObjFactoryAcc ) + { + dataObject = presenceObjFactoryAcc->ApiDataObjFactory().NewFromStreamLC( param.iParamType, aStream ); + } + + if ( !dataObject ) + { + TInt accesorCount = FeaturePluginHolder::AccessorCount() ; + for (TInt i=0; iApiDataObjFactory().NewFromStreamLC( param.iParamType, aStream ); + if(dataObject) + { + break ; + } + } + } + + + param.iParam = dataObject; + aArray.AppendL( param ); + CleanupStack::Pop( dataObject ); + } + } + +// --------------------------------------------------------------------------- +// XIMPApiDataObjFactory::ExternalizeL +// --------------------------------------------------------------------------- +// +EXPORT_C void XIMPApiDataObjFactory::ExternalizeL( + RWriteStream& aWs, + const RPrReqParamArray& aArray ) + { + // write array length + aWs.WriteInt32L( aArray.Count() ); + + for ( TInt i = 0; i < aArray.Count(); i++ ) + { + // trust the type within the param struct + aWs.WriteInt32L( aArray[ i ].iParamType ); + + // write the actual object + CXIMPApiDataObjBase* theBase = aArray[ i ].iParam; + theBase->ExternalizeL( aWs ); + } + + aWs.CommitL(); + } + +// --------------------------------------------------------------------------- +// XIMPApiDataObjFactory::InternalizeLC +// --------------------------------------------------------------------------- +// +EXPORT_C CXIMPApiDataObjBase* XIMPApiDataObjFactory::InternalizeLC( + RReadStream& aStream ) + { + TInt32 objType = aStream.ReadInt32L(); + CXIMPApiDataObjBase* dataObject = NewDataObjectFromStreamLC( objType, aStream ); + return dataObject; + } + +// --------------------------------------------------------------------------- +// XIMPApiDataObjFactory::ExternalizeL +// --------------------------------------------------------------------------- +// +EXPORT_C void XIMPApiDataObjFactory::ExternalizeL( + RWriteStream& aWs, + const CXIMPApiDataObjBase& aDataObj ) + { + aWs.WriteInt32L( aDataObj.Base().GetInterfaceId() ); + aDataObj.ExternalizeL( aWs ); + aWs.CommitL(); + } + +// End of file + diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcdatamodel/ximpapidataobjfactory.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcdatamodel/ximpapidataobjfactory.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,114 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Codec to pack and unpack data objects. +* +*/ + +#ifndef XIMPAPIDATAOBJFACTORY_H +#define XIMPAPIDATAOBJFACTORY_H + +#include +#include "ximptypehelpers.h" + +class CXIMPApiDataObjBase; +class RReadStream; +class RWriteStream; + + +/** + * Codec to pack and unpack data object arrays. + * + * @lib ximpdatamodel.dll + * @since S60 v3.2 + */ +NONSHARABLE_CLASS( XIMPApiDataObjFactory ) + { +public: + + /** + * Unpacks a request parameter array from a + * descriptor back to array format. + * @param aDataObjArrayData The packed array + * @param aArray The array which to fill + */ + IMPORT_C static void InternalizeL( + RReadStream& aStream, + RPrReqParamArray& aArray + ); + + /** + * Packs a given request parameter array into + * a stream. + * @param aWs The stream to pack into + * @param aArray The array to pack + */ + IMPORT_C static void ExternalizeL( + RWriteStream& aWs, + const RPrReqParamArray& aArray + ); + + /** + * Internalize a CXIMPApiDataObjBase-derived object + * from the given stream, ownership is returned to the caller. + * @param aStream The stream + * @return The object instance + */ + IMPORT_C static CXIMPApiDataObjBase* InternalizeLC( + RReadStream& aStream ); + + /** + * Externalize a CXIMPApiDataObjBase-derived object + * to the given stream. + * @param aWs The write stream + * @param aDataObj The data object + */ + IMPORT_C static void ExternalizeL( + RWriteStream& aWs, + const CXIMPApiDataObjBase& aDataObj ); + + /* + * Packs a given array into a stream. + * @param aStream The stream + * @param aArray The array + */ + template< class INFOIMP> + static inline void InternalizeL( + RReadStream& aStream, + RPointerArray& aArray + ); + + /** + * Unpacks an array of info fields back to array format. + * @param aWs The stream + * @param aArray The array which to fill + */ + template< class INFOIMP > + static inline void ExternalizeL( + RWriteStream& aWs, + const RPointerArray& aArray + ); + +private: + + XIMPApiDataObjFactory(); + ~XIMPApiDataObjFactory(); + + + + }; + +// template methods need inline implementation +#include "ximpapidataobjfactory.inl" + +#endif // XIMPAPIDATAOBJFACTORY_H diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcdatamodel/ximpapidataobjfactory.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcdatamodel/ximpapidataobjfactory.inl Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,214 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Inline methods for codec to pack and unpack data objects. +* +*/ + + +//#include +#include "ximptypehelpers.h" +#include "ximpapidataobjfactory.h" +#include "ximpapidataobjbase.h" +#include "ximpidentityimp.h" +//#include "presentitygroupmemberinfoimp.h" +//#include "presentitygroupinfoimp.h" +#include "ximpfeatureinfoimp.h" +#include "ximpcontextclientinfoimp.h" +//#include "presencegrantrequestinfoimp.h" +//#include "presencewatcherinfoimp.h" +#include "ximpprotocolinfoimp.h" +#include "ximpserviceinfoimp.h" +#include "ximpstatusimp.h" +//#include "presenceinfofieldimp.h" +//#include "presenceinfofieldvaluetextimp.h" +//#include "presenceinfofieldvaluebinaryimp.h" +//#include "presenceinfofieldvalueenumimp.h" +//#include "servicepresenceinfoimp.h" +//#include "devicepresenceinfoimp.h" + +/** + * Type definition for exact API data object constructor signature. + */ +typedef CXIMPApiDataObjBase* (*TApiDataObjConstructor)( RReadStream& ); + + + +/** + * Structure for mapping data object interface IDs to + * to corect API data object constructors. + */ +struct SApiDataObjConstructorMap + { + //Interface id + TInt32 iInterfaceId; + + //Function pointer to data object interface implementation + TApiDataObjConstructor iConstructorPtr; + } ; + + + +/** + * Helper macro to initialise KApiDataObjConstructorTable members. + * + * Macro forces that each data object implementation class to have static + * NewFromStreamLC() member function to instantiate the object. + * + * See TApiDataObjConstructor type definition for exact constructor + * signature. + */ +#define CONSTRUCTOR_ENTRY( TheImplementedIf, TheClass ) \ + { TheImplementedIf::KInterfaceId, TheClass::NewFromStreamLC } \ + +/** + * Constructor function mapping for data object interface implementations. + * + * When new data object types are implemented, add them here. + */ +const SApiDataObjConstructorMap KApiDataObjConstructorTable[] = + { + CONSTRUCTOR_ENTRY( MXIMPIdentity, CXIMPIdentityImp ), + // CONSTRUCTOR_ENTRY( MPresentityGroupMemberInfo, CPresentityGroupMemberInfoImp ), + // CONSTRUCTOR_ENTRY( MPresentityGroupInfo, CPresentityGroupInfoImp ), + CONSTRUCTOR_ENTRY( MXIMPFeatureInfo, CXIMPFeatureInfoImp ), + CONSTRUCTOR_ENTRY( MXIMPContextClientInfo, CXIMPContextClientInfoImp ), + // CONSTRUCTOR_ENTRY( MPresenceGrantRequestInfo, CPresenceGrantRequestInfoImp ), + // CONSTRUCTOR_ENTRY( MPresenceWatcherInfo, CPresenceWatcherInfoImp ), + CONSTRUCTOR_ENTRY( MXIMPProtocolInfo, CXIMPProtocolInfoImp ), + CONSTRUCTOR_ENTRY( MXIMPServiceInfo, CXIMPServiceInfoImp ), + CONSTRUCTOR_ENTRY( MXIMPStatus, CXIMPStatusImp ), + // CONSTRUCTOR_ENTRY( MPresenceInfoField, CPresenceInfoFieldImp ), + // CONSTRUCTOR_ENTRY( MPresenceInfoFieldValueText, CPresenceInfoFieldValueTextImp ), + // CONSTRUCTOR_ENTRY( MPresenceInfoFieldValueBinary, CPresenceInfoFieldValueBinaryImp ), + // CONSTRUCTOR_ENTRY( MPresenceInfoFieldValueEnum, CPresenceInfoFieldValueEnumImp ), + // CONSTRUCTOR_ENTRY( MDevicePresenceInfo, CDevicePresenceInfoImp ), + // CONSTRUCTOR_ENTRY( MServicePresenceInfo, CServicePresenceInfoImp ) + }; + + +/** + * Count of constructor mappings. + */ +const TInt KApiDataObjConstructorCount = sizeof( KApiDataObjConstructorTable ) + / sizeof( SApiDataObjConstructorMap ); + + + +// ============================ HELPER FUNCTIONS ============================= + + +namespace { + + /** + * Helper function to locate constructor function for + * data object interface ID. + * + * @param aDataObjInterfaceId The data object interface ID. + * @return Data object constructor function. + */ + TApiDataObjConstructor ConstructorForInterface( TInt32 aDataObjInterfaceId ) + { + //Locate correct constructor + for( TInt ix = 0; ix < KApiDataObjConstructorCount; ix++ ) + { + const SApiDataObjConstructorMap map = KApiDataObjConstructorTable[ ix ]; + if( map.iInterfaceId == aDataObjInterfaceId ) + { + return map.iConstructorPtr; + } + } + + + //If assertion below fails, check that data object implementation + //class implementing requested data object interface (aDataObjInterfaceId) + //is registered to KApiDataObjConstructorTable +// __ASSERT_DEBUG( EFalse, +// User::Panic( _L("XIMPApiDataObjFactory"), KErrUnknown ) ); + + return NULL; + } + + + /** + * Helper function to instantiate new data object object + * of requested type and construct it from the stream. + * + * @param aDataObjInterfaceId + * @return Data object constructor function. + */ + CXIMPApiDataObjBase* NewDataObjectFromStreamLC( TInt32 aDataObjInterfaceId, + RReadStream& aStream ) + { + TApiDataObjConstructor newFromStreamLC = NULL; + + //Locate correct constructor for interface ID + newFromStreamLC = ConstructorForInterface( aDataObjInterfaceId ); + + //Instantiate the object + if ( newFromStreamLC ) + { + CXIMPApiDataObjBase* dataObject = newFromStreamLC( aStream ); + return dataObject; + } + + return NULL; + } + +} // namespace + +// --------------------------------------------------------------------------- +// XIMPApiDataObjFactory::InternalizeL +// --------------------------------------------------------------------------- +// +template< class INFOIMP > +inline void XIMPApiDataObjFactory::InternalizeL( + RReadStream& aStream, + RPointerArray& aArray ) + { + TInt32 arrLen = aStream.ReadInt32L(); + + for ( TInt i = 0; i < arrLen; i++ ) + { + TInt paramType = aStream.ReadInt32L(); + INFOIMP* infoObj = ( INFOIMP* ) NewDataObjectFromStreamLC( paramType, aStream ); + aArray.AppendL( infoObj ); + CleanupStack::Pop( infoObj ); + } + } + +// --------------------------------------------------------------------------- +// XIMPApiDataObjFactory::ExternalizeL +// --------------------------------------------------------------------------- +// +template +inline void XIMPApiDataObjFactory::ExternalizeL( + RWriteStream& aWs, + const RPointerArray& aArray ) + { + aWs.WriteInt32L( aArray.Count() ); // array length + + for ( TInt i = 0; i < aArray.Count(); i++ ) + { + INFOIMP* infoField = aArray[ i ]; + + // write the type + aWs.WriteInt32L( infoField->Base().GetInterfaceId() ); + + // write the actual object + infoField->ExternalizeL( aWs ); + } + + aWs.CommitL(); + } + diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcdatamodel/ximpapieventbase.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcdatamodel/ximpapieventbase.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,42 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: API event object base implementation. +* +*/ + +#include "ximpapieventbase.h" + + +// ============================ MEMBER FUNCTIONS ============================= + +// --------------------------------------------------------------------------- +// CXIMPApiEventBase::CXIMPApiEventBase() +// --------------------------------------------------------------------------- +// +EXPORT_C CXIMPApiEventBase::CXIMPApiEventBase() + { + } + + +// --------------------------------------------------------------------------- +// CXIMPApiEventBase::~CXIMPApiEventBase() +// --------------------------------------------------------------------------- +// +EXPORT_C CXIMPApiEventBase::~CXIMPApiEventBase() + { + } + + + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcdatamodel/ximpapiobjbase.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcdatamodel/ximpapiobjbase.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,65 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Base class for XIMP API implementations. +* +*/ + +#include "ximpapiobjbase.h" + + +// ============================ MEMBER FUNCTIONS ============================= + +// --------------------------------------------------------------------------- +// CXIMPApiObjBase::CXIMPApiObjBase() +// --------------------------------------------------------------------------- +// +EXPORT_C CXIMPApiObjBase::CXIMPApiObjBase() + { + } + + +// --------------------------------------------------------------------------- +// CXIMPApiObjBase::~CXIMPApiObjBase() +// --------------------------------------------------------------------------- +// +EXPORT_C CXIMPApiObjBase::~CXIMPApiObjBase() + { + HandleUnknownGetInterface(0,MXIMPBase::EReturnNullIfUnknown); + } + + +// --------------------------------------------------------------------------- +// CXIMPApiObjBase::HandleUnknownGetInterface() +// --------------------------------------------------------------------------- +// +EXPORT_C TAny* CXIMPApiObjBase::HandleUnknownGetInterface( + TInt32 aInterfaceId, + MXIMPBase::TIfGetOps aOps ) const + { + XIMP_UNUSED_FORMAL_PARAM( aInterfaceId ); + + if( aOps == MXIMPBase::EPanicIfUnknown ) + { + #ifdef __WINS__ + User::SetJustInTime(ETrue); + #endif // __WINS__ + + User::Panic( _L("CXIMPApiObjBase"), KErrExtensionNotSupported ); + } + + return NULL; + } + + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcdatamodel/ximpconfigurationitem.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcdatamodel/ximpconfigurationitem.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,44 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Configuration item interface +* +*/ + +#ifndef MXIMPPSCCONFIGURATIONITEM_H +#define MXIMPPSCCONFIGURATIONITEM_H + +//class MXIMPPscContext; + +/** + * Context interface. + * + * @since S60 v3.2 + */ +class MXIMPConfigurationItem + { + +public: // Interface + + +protected: // Destruction + + /** + * Object cannot be deleted through this interface + */ + virtual ~MXIMPConfigurationItem(){} + }; + +/* ======================================================================== */ + +#endif // MXIMPPSCCONFIGURATIONITEM_H diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcdatamodel/ximpconfigurationitembase.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcdatamodel/ximpconfigurationitembase.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,196 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Configuration item base for configuration items. +* +*/ + + +#include "ximpconfigurationitembase.h" +#include "ximpitemparent.h" + +// --------------------------------------------------------------------------- +// CXIMPConfigurationItemBase::OrderOfItems() +// --------------------------------------------------------------------------- +// +TInt CXIMPConfigurationItemBase::OrderOfItems( const CXIMPConfigurationItemBase& aFirst, + const CXIMPConfigurationItemBase& aSecond ) + { + if( &aFirst < &aSecond ) + { + return -1; + } + else if( &aFirst == &aSecond ) + { + return 0; + } + else + { + return 1; + } + } + + +// --------------------------------------------------------------------------- +// CXIMPConfigurationItemBase::CXIMPConfigurationItemBase() +// --------------------------------------------------------------------------- +// +EXPORT_C CXIMPConfigurationItemBase::CXIMPConfigurationItemBase( MXIMPItemParentBase& aParent ) +: CXIMPSubscriptionItemBase( aParent ) + { + } + +// --------------------------------------------------------------------------- +// CXIMPConfigurationItemBase::BaseConstructL() +// --------------------------------------------------------------------------- +// +EXPORT_C void CXIMPConfigurationItemBase::BaseConstructL() + { + CXIMPSubscriptionItemBase::BaseConstructL(); + } + +// --------------------------------------------------------------------------- +// CXIMPConfigurationItemBase::~CXIMPConfigurationItemBase() +// --------------------------------------------------------------------------- +// +EXPORT_C CXIMPConfigurationItemBase::~CXIMPConfigurationItemBase() + { + iConfigContexts.Close(); + iConfigItems.Close(); + } + +// --------------------------------------------------------------------------- +// CXIMPConfigurationItemBase::ConfigurationStatus() +// --------------------------------------------------------------------------- +// +EXPORT_C CXIMPConfigurationItemBase::TConfigurationStatus + CXIMPConfigurationItemBase::ConfigurationStatus( MXIMPPscContext* aContext ) + { + // Calculate situation + TInt count = iConfigContexts.Count() + iConfigItems.Count(); + TBool contextFound = IsContext( aContext ); + if( count == 0 ) + { + return ENotConfiguredAtAll; + } + else if( contextFound ) + { + if( count == 1 ) + { + return EConfiguredForCtxOnly; + } + return EConfiguredForCtxAndOthers; + } + return EConfiguredForOtherCtxOnly; + } + +// --------------------------------------------------------------------------- +// CXIMPConfigurationItemBase::AddConfiguratorL() +// --------------------------------------------------------------------------- +// +EXPORT_C void CXIMPConfigurationItemBase::AddConfiguratorL( MXIMPPscContext* aContext ) + { + TLinearOrder< MXIMPPscContext > order( OrderOfContexts ); + if( IsContext( aContext ) ) + { + User::Leave( KErrAlreadyExists ); + } + iConfigContexts.InsertInOrderL( aContext, order ); + User::LeaveIfError( Open() ); + } + +// --------------------------------------------------------------------------- +// CXIMPConfigurationItemBase::RemoveConfigurator() +// --------------------------------------------------------------------------- +// +EXPORT_C void CXIMPConfigurationItemBase::RemoveConfigurator( MXIMPPscContext* aContext ) + { + TLinearOrder< MXIMPPscContext > order( OrderOfContexts ); + TInt index = iConfigContexts.FindInOrder( aContext, order ); + if( index >= 0 ) + { + iConfigContexts.Remove( index ); + Close(); + } + else + { + iParent.UnregisterExpiringItem( this ); + } + } + +// --------------------------------------------------------------------------- +// CXIMPConfigurationItemBase::AddConfiguratorL() +// --------------------------------------------------------------------------- +// +EXPORT_C void CXIMPConfigurationItemBase::AddConfiguratorL( CXIMPConfigurationItemBase* aItem ) + { + TLinearOrder< CXIMPConfigurationItemBase > order( OrderOfItems ); + TInt index = iConfigItems.FindInOrder( aItem, order ); + if( index != KErrNotFound ) + { + return; + } + + iConfigItems.InsertInOrderL( aItem, order ); + User::LeaveIfError( Open() ); + } + +// --------------------------------------------------------------------------- +// CXIMPConfigurationItemBase::RemoveConfigurator() +// --------------------------------------------------------------------------- +// +EXPORT_C void CXIMPConfigurationItemBase::RemoveConfigurator( CXIMPConfigurationItemBase* aItem ) + { + TLinearOrder< CXIMPConfigurationItemBase > order( OrderOfItems ); + TInt index = iConfigItems.FindInOrder( aItem, order ); + if( index >= 0 ) + { + iConfigItems.Remove( index ); + Close(); + } + else + { + iParent.UnregisterExpiringItem( this ); + } + } + +// --------------------------------------------------------------------------- +// CXIMPConfigurationItemBase::IsContext() +// --------------------------------------------------------------------------- +// +EXPORT_C TBool CXIMPConfigurationItemBase::IsContext( MXIMPPscContext* aContext ) const + { + TLinearOrder< MXIMPPscContext > order( OrderOfContexts ); + return iConfigContexts.FindInOrder( aContext, order ) != KErrNotFound; + } + +// --------------------------------------------------------------------------- +// CXIMPConfigurationItemBase::ForceClose() +// --------------------------------------------------------------------------- +// +EXPORT_C void CXIMPConfigurationItemBase::ForceClose() + { + CXIMPSubscriptionItemBase::ForceClose(); + TInt count = iConfigContexts.Count(); + for( TInt a = 0; a < count; ++a ) + { + // RemoveSubscriber removes first one every time. + RemoveConfigurator( iConfigContexts[ 0 ] ); + } + count = iConfigItems.Count(); + for( TInt a = 0; a < count; ++a ) + { + RemoveConfigurator( iConfigItems[ 0 ] ); + } + } +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcdatamodel/ximpconfigurationitembase.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcdatamodel/ximpconfigurationitembase.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,148 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Configuration item base for configuration items. +* +*/ + +#ifndef CXIMPPSCCONFIGURATIONITEMBASE_H +#define CXIMPPSCCONFIGURATIONITEMBASE_H + +#include +#include "ximpconfigurationitem.h" +#include "ximpsubscriptionitembase.h" + +/** + * Configuration item base + * + * @since S60 v3.2 + */ +class CXIMPConfigurationItemBase : public CXIMPSubscriptionItemBase, + public MXIMPConfigurationItem + { +public: // Definitions + + /** + * Authorization status + */ + enum TConfigurationStatus + { + ENotConfiguredAtAll, + EConfiguredForOtherCtxOnly, + EConfiguredForCtxOnly, + EConfiguredForCtxAndOthers + }; + +public: // Construction and destruction + + /** + * Destruction + * - Remember to inform parent about delete. + */ + IMPORT_C virtual ~CXIMPConfigurationItemBase(); + + /** + * Construction + */ + IMPORT_C CXIMPConfigurationItemBase( MXIMPItemParentBase& aParent ); + + /** + * Base construction. Must be called from inherited classes ConstructL + */ + IMPORT_C void BaseConstructL(); + + +public: // New methods + + /** + * Authorizationstatus for context. + * + * ENotConfiguredAtAll - Configure not done by any context. + * EConfiguredForOtherCtxOnly - Configure done by others but not aContext + * EConfiguredForCtxOnly - Configure done by aContext only. + * EConfiguredForCtxAndOthers - Configure done by others and aContext. + * + * @param aContext Check authorization status for aContext. + */ + IMPORT_C TConfigurationStatus ConfigurationStatus( MXIMPPscContext* aContext ); + + /** + * Add configurator for item. + * @param aContext. Context to be added. + */ + IMPORT_C void AddConfiguratorL( MXIMPPscContext* aContext ); + + /** + * Remove configurator from item + * @param aContext. Context to be removed. + */ + IMPORT_C void RemoveConfigurator( MXIMPPscContext* aContext ); + + /** + * Add configurator for item. + * @param aItem. Item to be added. + */ + IMPORT_C void AddConfiguratorL( CXIMPConfigurationItemBase* aItem ); + + /** + * Remove configurator from item + * @param aContext. Item to be removed. + */ + IMPORT_C void RemoveConfigurator( CXIMPConfigurationItemBase* aItem ); + + + +public: // From CXIMPSubscriptionItemBase + + /** + * @see CXIMPSubscriptionItemBase + */ + IMPORT_C TBool IsContext( MXIMPPscContext* aContext ) const; + + /** + * @see CXIMPSubscriptionItemBase + */ + IMPORT_C void ForceClose(); + + +public: // From MXIMPConfigurationItem + + +protected: // Helpers + + /** + * For linear ordering by pointers + */ + static TInt OrderOfItems( const CXIMPConfigurationItemBase& aFirst, + const CXIMPConfigurationItemBase& aSecond ); + +protected: // New interface methods. + + +protected: // Data + + /** + * Configured contexts. + */ + RPointerArray< MXIMPPscContext > iConfigContexts; + RPointerArray< MXIMPPscContext > iPreConfigContexts; + RPointerArray< CXIMPConfigurationItemBase > iConfigItems; + RPointerArray< CXIMPConfigurationItemBase > iPreConfigItems; + }; + + +/* ======================================================================== */ + + + +#endif // CXIMPPSCCONFIGURATIONITEMBASE_H diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcdatamodel/ximpcontextclientinfoimp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcdatamodel/ximpcontextclientinfoimp.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,181 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MXIMPContextClientInfo API object implementation. +* +*/ + +#include "ximpcontextclientinfoimp.h" +#include "ximpidentityimp.h" + +// ============================ MEMBER FUNCTIONS ============================= + + +// --------------------------------------------------------------------------- +// CXIMPContextClientInfoImp::NewLC() +// --------------------------------------------------------------------------- +// +EXPORT_C CXIMPContextClientInfoImp* CXIMPContextClientInfoImp::NewLC() + { + CXIMPContextClientInfoImp* self = new( ELeave ) CXIMPContextClientInfoImp; + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + + +// --------------------------------------------------------------------------- +// CXIMPContextClientInfoImp::NewL() +// --------------------------------------------------------------------------- +// +EXPORT_C CXIMPContextClientInfoImp* CXIMPContextClientInfoImp::NewL() + { + CXIMPContextClientInfoImp* self = NewLC(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// CXIMPContextClientInfoImp::NewFromStreamLC() +// --------------------------------------------------------------------------- +// +XIMPIMP_IMPLEMENT_DATAOBJ_NEWFROMSTREAM( CXIMPContextClientInfoImp ) + + +// --------------------------------------------------------------------------- +// Implement supported interface access. +// --------------------------------------------------------------------------- +// +XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CXIMPContextClientInfoImp, + MXIMPContextClientInfo ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + + +XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CXIMPContextClientInfoImp, + MXIMPContextClientInfo ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + +// --------------------------------------------------------------------------- +// CXIMPContextClientInfoImp::~CXIMPContextClientInfoImp() +// --------------------------------------------------------------------------- +// +CXIMPContextClientInfoImp::~CXIMPContextClientInfoImp() + { + delete iClientId; + } + + +// --------------------------------------------------------------------------- +// CXIMPContextClientInfoImp::CXIMPContextClientInfoImp() +// --------------------------------------------------------------------------- +// +CXIMPContextClientInfoImp::CXIMPContextClientInfoImp() + { + } + +// --------------------------------------------------------------------------- +// CXIMPContextClientInfoImp::ConstructL() +// --------------------------------------------------------------------------- +// +void CXIMPContextClientInfoImp::ConstructL() + { + iClientId = CXIMPIdentityImp::NewL(); + } + + +// --------------------------------------------------------------------------- +// CXIMPContextClientInfoImp::ConstructL() +// --------------------------------------------------------------------------- +// +void CXIMPContextClientInfoImp::ConstructL( const TDesC16& aClientId ) + { + iClientId = CXIMPIdentityImp::NewLC( aClientId ); + CleanupStack::Pop(); //iClientId + } + +// --------------------------------------------------------------------------- +// CXIMPContextClientInfoImp::ExternalizeL() +// --------------------------------------------------------------------------- +// +void CXIMPContextClientInfoImp::ExternalizeL( RWriteStream& aStream ) const + { + iClientId->ExternalizeL( aStream ); + } + + +// --------------------------------------------------------------------------- +// CXIMPContextClientInfoImp::InternalizeL() +// --------------------------------------------------------------------------- +// +EXPORT_C void CXIMPContextClientInfoImp::InternalizeL( RReadStream& aStream ) + { + iClientId->InternalizeL( aStream ); + } + + +// --------------------------------------------------------------------------- +// CXIMPContextClientInfoImp::Match() +// --------------------------------------------------------------------------- +// +EXPORT_C TBool CXIMPContextClientInfoImp::Match( + const CXIMPContextClientInfoImp* aClientInfoImp ) const + { + return iClientId->Compare( *aClientInfoImp->iClientId ) == 0; + } + +// --------------------------------------------------------------------------- +// CXIMPContextClientInfoImp::EqualsContent() +// --------------------------------------------------------------------------- +// +TBool CXIMPContextClientInfoImp::EqualsContent( + const CXIMPApiDataObjBase& aOtherInstance ) const + { + const CXIMPContextClientInfoImp* tmp = + TXIMPGetImpClassOrPanic< const CXIMPContextClientInfoImp>::From( + aOtherInstance.Base() ); + + TBool same = Match( tmp ); + TBool x; + x = ETrue; // do some comparison of member variable here + same &= x; + return same; + } + +// --------------------------------------------------------------------------- +// From MXIMPContextClientInfo class. +// CXIMPContextClientInfoImp::ClientId() +// --------------------------------------------------------------------------- +// +const MXIMPIdentity& CXIMPContextClientInfoImp::ClientId() const + { + return *iClientId; + } + + +// --------------------------------------------------------------------------- +// From MXIMPContextClientInfo class. +// CXIMPContextClientInfoImp::SetClientIdL() +// --------------------------------------------------------------------------- +// +void CXIMPContextClientInfoImp::SetClientIdL( + MXIMPIdentity* aIdentity ) + { + CXIMPIdentityImp* tmp = + TXIMPGetImpClassOrPanic< CXIMPIdentityImp>::From( *aIdentity ); + + delete iClientId; + iClientId = tmp; + } + + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcdatamodel/ximpcontextclientinfoimp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcdatamodel/ximpcontextclientinfoimp.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,106 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MXIMPContextClientInfo API object implementation. +* +*/ + +#ifndef CXIMPPRESENCECONTEXTCLIENTINFOIMP_H +#define CXIMPPRESENCECONTEXTCLIENTINFOIMP_H + +#include + +#include "ximpapidataobjbase.h" +#include + + +class CXIMPIdentityImp; + + +/** + * MXIMPContextClientInfo API object implementation. + * + * @lib ximpdatamodel.dll + * @since S60 v3.2 + */ +NONSHARABLE_CLASS( CXIMPContextClientInfoImp ): public CXIMPApiDataObjBase, + public MXIMPContextClientInfo + { +public: + /** The class ID. */ + enum { KClassId = XIMPIMP_CLSID_CXIMPCONTEXTCLIENTINFOIMP }; + +public: + + IMPORT_C static CXIMPContextClientInfoImp* NewLC(); + IMPORT_C static CXIMPContextClientInfoImp* NewL(); + + virtual ~CXIMPContextClientInfoImp(); + +private: + + CXIMPContextClientInfoImp(); + void ConstructL( const TDesC16& aClientId ); + void ConstructL(); + + /** + * @see CXIMPApiDataObjBase + */ + XIMPIMP_DECLARE_DATAOBJ_BASE_PRIV_METHODS + +public: // From MXIMPBase + + /** + * Implementation of MXIMPBase interface methods + * @see MXIMPBase + */ + XIMPIMP_DECLARE_IF_BASE_METHODS + + /** + * @see CXIMPApiDataObjBase + */ + XIMPIMP_DECLARE_DATAOBJ_BASE_METHODS + + +public: // From MXIMPContextClientInfo + + const MXIMPIdentity& ClientId() const; + void SetClientIdL( MXIMPIdentity* aIdentity ); + + +public: // New functions + + /** + * Internalizes object data from given stream. + * @param aStream Stream to read. + */ + IMPORT_C void InternalizeL( RReadStream& aStream ); + + + /** + * Tests if the given CXIMPContextClientInfoImp object matches + * this one. + * @param aServiceInfoImp An Object to match + */ + IMPORT_C TBool Match( const CXIMPContextClientInfoImp* aClientInfoImp ) const; + +private: // data + + /** + * ClientId + */ + CXIMPIdentityImp* iClientId; + }; + + +#endif // CXIMPPRESENCECONTEXTCLIENTINFOIMP_H diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcdatamodel/ximpcontexteventfilter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcdatamodel/ximpcontexteventfilter.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,276 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Presence context event filter. +* +*/ + +#include "ximpcontexteventfilter.h" + +const TInt KXIMPEventListGranurality = 3; + + +// ============================ MEMBER FUNCTIONS ============================= + +// --------------------------------------------------------------------------- +// CXIMPContextEventFilter::NewLC() +// --------------------------------------------------------------------------- +// +EXPORT_C CXIMPContextEventFilter* CXIMPContextEventFilter::NewLC( + const TArray< TInt32 >* aAcceptedEvents ) + { + CXIMPContextEventFilter* self = + new( ELeave ) CXIMPContextEventFilter; + CleanupStack::PushL( self ); + self->SetFilterL( aAcceptedEvents ); + return self; + } + +// --------------------------------------------------------------------------- +// CXIMPContextEventFilter::NewL() +// --------------------------------------------------------------------------- +// +EXPORT_C CXIMPContextEventFilter* CXIMPContextEventFilter::NewL( + const TArray< TInt32 >* aAcceptedEvents ) + { + CXIMPContextEventFilter* self = NewLC( aAcceptedEvents ); + CleanupStack::Pop( self ); + return self; + } + + +// --------------------------------------------------------------------------- +// CXIMPContextEventFilter::NewCombinedLC() +// --------------------------------------------------------------------------- +// +EXPORT_C CXIMPContextEventFilter* + CXIMPContextEventFilter::NewCombinedLC( + const TArray< CXIMPContextEventFilter* >& aFilters ) + { + CXIMPContextEventFilter* self = + new( ELeave ) CXIMPContextEventFilter; + CleanupStack::PushL( self ); + self->CombineFilterL( aFilters ); + return self; + } + + +// --------------------------------------------------------------------------- +// CXIMPContextEventFilter::~CXIMPContextEventFilter() +// --------------------------------------------------------------------------- +// +CXIMPContextEventFilter::~CXIMPContextEventFilter() + { + delete iAcceptedEvents; + } + + +// --------------------------------------------------------------------------- +// CXIMPContextEventFilter::CXIMPContextEventFilter() +// --------------------------------------------------------------------------- +// +CXIMPContextEventFilter::CXIMPContextEventFilter() + { + } + + +// --------------------------------------------------------------------------- +// CXIMPContextEventFilter::IsEventAccepted() +// --------------------------------------------------------------------------- +// +EXPORT_C TBool CXIMPContextEventFilter::IsEventAccepted( + TInt32 aEvent ) const + { + TBool accepted = ETrue; + + + //If there isn't iAcceptedEvents list limiting accepted event types, + //all types are accepted by default + if( iAcceptedEvents ) + { + TInt pos; + if( !FindEventPosition( aEvent, *iAcceptedEvents, pos ) ) + { + accepted = EFalse; + } + } + + return accepted; + } + + +// --------------------------------------------------------------------------- +// CXIMPContextEventFilter::ExternalizeL() +// --------------------------------------------------------------------------- +// +EXPORT_C void CXIMPContextEventFilter::ExternalizeL( + RWriteStream& aStream ) const + { + if( !iAcceptedEvents ) + { + aStream.WriteInt32L( 0 ); + } + else + { + TInt count = iAcceptedEvents->Count(); + aStream.WriteInt32L( count ); + for( TInt ix = 0; ix < count; ++ix ) + { + aStream.WriteInt32L( ( *iAcceptedEvents )[ ix ] ); + } + } + } + + +// --------------------------------------------------------------------------- +// CXIMPContextEventFilter::InternalizeL() +// --------------------------------------------------------------------------- +// +EXPORT_C void CXIMPContextEventFilter::InternalizeL( + RReadStream& aStream ) + { + TInt count = aStream.ReadInt32L(); + if( count ) + { + //We are internalizing data which we have previously externalized + // => Internalized array can be directly set as current array + + CArrayFix< TInt32 >* events = + new (ELeave) CArrayFixFlat< TInt32 >( KXIMPEventListGranurality ); + CleanupStack::PushL( events ); + + for( TInt ix = 0; ix < count; ++ix ) + { + events->AppendL( aStream.ReadInt32L() ); + } + delete iAcceptedEvents; + iAcceptedEvents = events; + + CleanupStack::Pop( events ); + } + + else + { + delete iAcceptedEvents; + iAcceptedEvents = NULL; + } + } + + +// --------------------------------------------------------------------------- +// CXIMPContextEventFilter::SetFilterL() +// --------------------------------------------------------------------------- +// +void CXIMPContextEventFilter::SetFilterL( + const TArray< TInt32 >* aAcceptedEvents ) + { + if( aAcceptedEvents ) + { + CArrayFix< TInt32 >* events = + new (ELeave) CArrayFixFlat< TInt32 >( KXIMPEventListGranurality ); + CleanupStack::PushL( events ); + + CopyUniqueEventsL( *aAcceptedEvents, *events ); + + delete iAcceptedEvents; + iAcceptedEvents = events; + CleanupStack::Pop( events ); + } + + else + { + //Set all accepted + delete iAcceptedEvents; + iAcceptedEvents = NULL; + } + } + + +// --------------------------------------------------------------------------- +// CXIMPContextEventFilter::CombineFilterL() +// --------------------------------------------------------------------------- +// +void CXIMPContextEventFilter::CombineFilterL( + const TArray< CXIMPContextEventFilter* >& aFilters ) + { + const TInt filterCount = aFilters.Count(); + + CArrayFix< TInt32 >* combinedEvents = new (ELeave) CArrayFixFlat< TInt32 >( KXIMPEventListGranurality ); + CleanupStack::PushL( combinedEvents ); + + for( TInt ix = 0; ix < filterCount; ix++ ) + { + const CXIMPContextEventFilter* sourceFilter = aFilters[ ix ]; + if( sourceFilter->iAcceptedEvents ) + { + CopyUniqueEventsL( sourceFilter->iAcceptedEvents->Array(), + *combinedEvents ); + } + + else + { + //Set all accepted + delete combinedEvents; + combinedEvents = NULL; + break; + } + } + + + delete iAcceptedEvents; + iAcceptedEvents = combinedEvents; + + CleanupStack::Pop(); //combinedEvents + } + + +// --------------------------------------------------------------------------- +// CXIMPContextEventFilter::CopyUniqueEventsL() +// --------------------------------------------------------------------------- +// +void CXIMPContextEventFilter::CopyUniqueEventsL( + const TArray< TInt32 >& aSource, + CArrayFix< TInt32 >& aTarget ) + { + + const TInt eventCount = aSource.Count(); + + for( TInt ix = 0; ix < eventCount; ix++ ) + { + const TInt32 event = aSource[ ix ]; + TInt pos; + if( !FindEventPosition( event, aTarget, pos ) ) + { + aTarget.InsertL( pos, event ); + } + } + } + + +// --------------------------------------------------------------------------- +// CXIMPContextEventFilter::FindEventPosition() +// --------------------------------------------------------------------------- +// +TBool CXIMPContextEventFilter::FindEventPosition( + const TInt32 aEvent, const CArrayFix< TInt32 >& aEvents, TInt& aPos ) const + { + TKeyArrayFix key( 0, ECmpTInt32 ); + if( aEvents.FindIsq( aEvent, key, aPos ) == 0 ) + { + //FindIsq() returns zero, if element is found => this is mapped to ETrue + return ETrue; + } + + return EFalse; + } + diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcdatamodel/ximpcontexteventfilter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcdatamodel/ximpcontexteventfilter.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,128 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Presence context event filter. +* +*/ + +#ifndef CXIMPPRESENCECONTEXTEVENTFILTER_H +#define CXIMPPRESENCECONTEXTEVENTFILTER_H + +#include "ximpapiobjbase.h" +#include + +/** + * Presence Context event filter. + * + * @lib ximpdatamodel.dll + * @since S60 v3.2 + */ +NONSHARABLE_CLASS( CXIMPContextEventFilter ) : public CBase + { +public: + + /** + * Instantiates new event filter object. + * + * Initializes the list of accepted events + * from given array. + * + * @param aAcceptedEvents List of events to accept. + * If NULL, all events are accepted. Default value NULL + */ + IMPORT_C static CXIMPContextEventFilter* NewLC( + const TArray< TInt32 >* aAcceptedEvents = NULL ); + + IMPORT_C static CXIMPContextEventFilter* NewL( + const TArray< TInt32 >* aAcceptedEvents = NULL ); + + + /** + * Instantiates new event filter object. + * + * Collects the accepted events from given event + * filter objects. + * + * @param aFilters List of events filters + * from where to gather accepted events. + */ + IMPORT_C static CXIMPContextEventFilter* NewCombinedLC( + const TArray< CXIMPContextEventFilter* >& aFilters ); + + + /** + * Destructor. + */ + virtual ~CXIMPContextEventFilter(); + + +private: + CXIMPContextEventFilter(); + + + +public: + + + /** + * Checks is the given event accepted or not. + * + * @param aEvent The event to check. + * @return ETrue if given event type is accepted, + * else EFalse. + */ + IMPORT_C TBool IsEventAccepted( TInt32 aEvent ) const; + + + /** + * Extenalizes object data to given stream. + * @param aStream Stream to write. + */ + IMPORT_C void ExternalizeL( RWriteStream& aStream ) const; + + + /** + * Internalizes object data from given stream. + * @param aStream Stream to read. + */ + IMPORT_C void InternalizeL( RReadStream& aStream ); + + +private: + void SetFilterL( const TArray< TInt32 >* aAcceptedEvents ); + + void CombineFilterL( + const TArray< CXIMPContextEventFilter* >& aFilters ); + + void CopyUniqueEventsL( const TArray< TInt32 >& aSource, + CArrayFix< TInt32 >& aTarget ); + + TBool FindEventPosition( const TInt32 aEvent, + const CArrayFix< TInt32 >& aEvents, + TInt& aPos ) const; + + + +private: // data + + /** + * The list of accepted events. + * NULL if all events are accepted. + * Own. + */ + CArrayFix< TInt32 >* iAcceptedEvents; + + }; + + +#endif // CXIMPPRESENCECONTEXTEVENTFILTER_H diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcdatamodel/ximpcontextstateeventimp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcdatamodel/ximpcontextstateeventimp.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,265 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MXIMPContextStateEvent API object implementation. + * +*/ + +#include + +#include "ximpcontextstateimp.h" +#include "ximpstatusimp.h" +#include "ximpcontextstateeventimp.h" + + +namespace + { + enum TStatusObjectExistency + { + ENoStatusObject = 0, + EHasStatusObject = 1 + }; + } + + +// --------------------------------------------------------------------------- +// CXIMPContextStateEventImp::NewLC() +// --------------------------------------------------------------------------- +// +EXPORT_C CXIMPContextStateEventImp* CXIMPContextStateEventImp::NewLC() + { + CXIMPContextStateEventImp* self = new( ELeave ) CXIMPContextStateEventImp(); + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + + +// --------------------------------------------------------------------------- +// CXIMPContextStateEventImp::NewL() +// --------------------------------------------------------------------------- +// +EXPORT_C CXIMPContextStateEventImp* CXIMPContextStateEventImp::NewL() + { + CXIMPContextStateEventImp* self = CXIMPContextStateEventImp::NewLC(); + CleanupStack::Pop( self ); + return self; + } + + +// --------------------------------------------------------------------------- +// CXIMPContextStateEventImp::NewFromStreamLC() +// Instantiation method for event automation. +// --------------------------------------------------------------------------- +// +CXIMPApiEventBase* CXIMPContextStateEventImp::NewFromStreamLC( + RReadStream& aStream ) + { + CXIMPContextStateEventImp* self = new( ELeave ) CXIMPContextStateEventImp; + CleanupStack::PushL( self ); + self->ConstructL( aStream ); + return self; + } + + +// --------------------------------------------------------------------------- +// CXIMPContextStateEventImp::~CXIMPContextStateEventImp() +// --------------------------------------------------------------------------- +// +CXIMPContextStateEventImp::~CXIMPContextStateEventImp() + { + delete iState; + delete iStateChangeReason; + } + + +// --------------------------------------------------------------------------- +// CXIMPContextStateEventImp::CXIMPContextStateEventImp() +// --------------------------------------------------------------------------- +// +CXIMPContextStateEventImp::CXIMPContextStateEventImp() + { + } + + +// --------------------------------------------------------------------------- +// CXIMPContextStateEventImp::ConstructL() +// --------------------------------------------------------------------------- +// +void CXIMPContextStateEventImp::ConstructL() + { + iState = CXIMPContextStateImp::NewL(); + } + + +// --------------------------------------------------------------------------- +// CXIMPContextStateEventImp::ConstructL() +// --------------------------------------------------------------------------- +// +void CXIMPContextStateEventImp::ConstructL( RReadStream& aStream ) + { + iState = CXIMPContextStateImp::NewL(); + iState->InternalizeL( aStream ); + + + TStatusObjectExistency exists = + ( TStatusObjectExistency ) aStream.ReadInt8L(); + + if( exists == EHasStatusObject ) + { + iStateChangeReason = CXIMPStatusImp::NewL(); + iStateChangeReason->InternalizeL( aStream ); + } + } + +// --------------------------------------------------------------------------- +// Implement supported interface access. +// --------------------------------------------------------------------------- +// +XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CXIMPContextStateEventImp, + MXIMPContextStateEvent ) + XIMPIMP_IF_BASE_GET_CLASS( CXIMPApiEventBase, this ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + +XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CXIMPContextStateEventImp, + MXIMPContextStateEvent ) + XIMPIMP_IF_BASE_GET_CONST_CLASS( CXIMPApiEventBase, this ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + + + +// --------------------------------------------------------------------------- +// Implement methods from base event interface and base event class +// --------------------------------------------------------------------------- +// +XIMPIMP_IMPLEMENT_EVENT_BASE_METHODS( CXIMPContextStateEventImp, + MXIMPContextStateEvent ) + +// --------------------------------------------------------------------------- +// CXIMPContextStateEventImp::EqualsContent() +// --------------------------------------------------------------------------- +// +TBool CXIMPContextStateEventImp::EqualsContent( + const CXIMPApiEventBase& aOtherInstance ) const + { + const CXIMPContextStateEventImp* tmp = + TXIMPGetImpClassOrPanic< const CXIMPContextStateEventImp>::From( + aOtherInstance.Base() ); + + TBool same = ETrue; + + TBool x = iState->EqualsContent(*(tmp->iState)); + same &= x; + + + if( (!iStateChangeReason) && (!tmp->iStateChangeReason) ) + { + //both are NULL + same &= ETrue; + } + else if ((iStateChangeReason) && (tmp->iStateChangeReason)) + { + //both not NULL, contents need to be checked + x = iStateChangeReason->ResultCode() == tmp->iStateChangeReason->ResultCode(); + same &= x; + + x = 0 == iStateChangeReason->ProtocolResultDescription().Compare( + tmp->iStateChangeReason->ProtocolResultDescription() ); + same &= x; + } + else + { + // One of them is NULL + same &= EFalse; + } + + return same; + } + +// --------------------------------------------------------------------------- +// CXIMPContextStateEventImp::ExternalizeL() +// --------------------------------------------------------------------------- +// +void CXIMPContextStateEventImp::ExternalizeL( RWriteStream& aStream ) const + { + iState->ExternalizeL( aStream ); + + if( iStateChangeReason ) + { + aStream.WriteInt8L( EHasStatusObject ); + iStateChangeReason->ExternalizeL( aStream ); + } + else + { + aStream.WriteInt8L( ENoStatusObject ); + } + } + + +// --------------------------------------------------------------------------- +// CXIMPContextStateEventImp::StateChangeReason() +// --------------------------------------------------------------------------- +// +const MXIMPStatus* CXIMPContextStateEventImp::StateChangeReason() const + { + return iStateChangeReason; + } + + +// --------------------------------------------------------------------------- +// CXIMPContextStateEventImp::ContextState() +// --------------------------------------------------------------------------- +// +const MXIMPContextState& + CXIMPContextStateEventImp::ContextState() const + { + return *iState; + } + + +// --------------------------------------------------------------------------- +// CXIMPContextStateEventImp::ContextStateImp() +// --------------------------------------------------------------------------- +// +EXPORT_C CXIMPContextStateImp& + CXIMPContextStateEventImp::ContextStateImp() + { + return *iState; + } + + +// --------------------------------------------------------------------------- +// CXIMPContextStateEventImp::SetStateChangeReasonImp() +// --------------------------------------------------------------------------- +// +EXPORT_C void CXIMPContextStateEventImp::SetStateChangeReasonImp( + CXIMPStatusImp* aStateChangeReason ) + { + delete iStateChangeReason; + iStateChangeReason = aStateChangeReason; + } + + +// --------------------------------------------------------------------------- +// CXIMPContextStateEventImp::StateChangeReasonImp() +// --------------------------------------------------------------------------- +// +EXPORT_C CXIMPStatusImp* + CXIMPContextStateEventImp::StateChangeReasonImp() + { + return iStateChangeReason; + } + + +// End of file + diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcdatamodel/ximpcontextstateeventimp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcdatamodel/ximpcontextstateeventimp.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,126 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MXIMPContextStateEventImp API object implementation. + * +*/ + +#ifndef CXIMPPRESENCECONTEXTSTATEEVENTIMP_H +#define CXIMPPRESENCECONTEXTSTATEEVENTIMP_H + +#include "ximpapieventbase.h" +#include +#include + + +class RWriteStream; +class RReadStream; +class MXIMPStatus; +class CXIMPStatusImp; +class CXIMPContextStateImp; + + +/** + * MXIMPContextStateEventImp API object implementation. + * + * @lib ximpdatamodel.dll + * @since S60 v3.2 + */ +NONSHARABLE_CLASS( CXIMPContextStateEventImp ): public CXIMPApiEventBase, + public MXIMPContextStateEvent + { + public: + /** The class ID. */ + enum { KClassId = XIMPIMP_CLSID_CXIMPCONTEXTSTATEEVENTIMP }; + + public: + + /** + * Exported instantiation method for initializing + * new event object. + */ + IMPORT_C static CXIMPContextStateEventImp* NewLC(); + IMPORT_C static CXIMPContextStateEventImp* NewL(); + + + /** + * Instantiation method for event automation. + * Method signature must be exactly this to work + * with event delivery automation system. + * + * Event implementation must be registered to + * XIMPEventCodec KXIMPEventConstructorTable. + */ + static CXIMPApiEventBase* NewFromStreamLC( RReadStream& aStream ); + + virtual ~CXIMPContextStateEventImp(); + + + private: + CXIMPContextStateEventImp(); + void ConstructL(); + void ConstructL( RReadStream& aStream ); + + + public: // From API base interfaces + + /** + * Implementation of MXIMPBase interface methods + * @see MXIMPBase + */ + XIMPIMP_DECLARE_IF_BASE_METHODS + + + /** + * Implementation of MXIMPEventBase interface and + * CXIMPApiEventBase methods + * + * @see MXIMPEventBase + * @see CXIMPApiEventBase + */ + XIMPIMP_DECLARE_EVENT_BASE_METHODS + + + public: // From MXIMPContextStateEvent + + /** + * Implementation of MXIMPContextStateEvent interface methods + * @see MXIMPContextStateEventImp + */ + const MXIMPStatus* StateChangeReason() const; + const MXIMPContextState& ContextState() const; + + IMPORT_C CXIMPContextStateImp& ContextStateImp(); + IMPORT_C void SetStateChangeReasonImp( CXIMPStatusImp* aStateChangeReason ); + IMPORT_C CXIMPStatusImp* StateChangeReasonImp(); + + + + private: // data + + /** + * + * Own. + */ + CXIMPContextStateImp* iState; + + + /** + * State change reason. + * Own. + */ + CXIMPStatusImp* iStateChangeReason; + }; + + +#endif // CXIMPPRESENCECONTEXTSTATEEVENTIMP_H diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcdatamodel/ximpcontextstateimp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcdatamodel/ximpcontextstateimp.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,160 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MXIMPContextState API object implementation. +* +*/ + +#include "ximpcontextstateimp.h" + + + +// ============================ MEMBER FUNCTIONS ============================= + +// --------------------------------------------------------------------------- +// CXIMPContextStateImp::NewLC() +// --------------------------------------------------------------------------- +// +EXPORT_C CXIMPContextStateImp* CXIMPContextStateImp::NewLC() + { + CXIMPContextStateImp* self = new( ELeave ) CXIMPContextStateImp; + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + + +// --------------------------------------------------------------------------- +// CXIMPContextStateImp::NewL() +// --------------------------------------------------------------------------- +// +EXPORT_C CXIMPContextStateImp* CXIMPContextStateImp::NewL() + { + CXIMPContextStateImp* self = CXIMPContextStateImp::NewLC(); + CleanupStack::Pop( self ); + return self; + } + + + +// --------------------------------------------------------------------------- +// CXIMPContextStateImp::~CXIMPContextStateImp() +// --------------------------------------------------------------------------- +// +CXIMPContextStateImp::~CXIMPContextStateImp() + { + } + + +// --------------------------------------------------------------------------- +// CXIMPContextStateImp::CXIMPContextStateImp() +// --------------------------------------------------------------------------- +// +CXIMPContextStateImp::CXIMPContextStateImp() + { + iContextState = MXIMPContextState::EInactive; + } + + +// --------------------------------------------------------------------------- +// CXIMPContextStateImp::ConstructL() +// --------------------------------------------------------------------------- +// +void CXIMPContextStateImp::ConstructL() + { + } + + +// --------------------------------------------------------------------------- +// CXIMPContextStateImp::NewFromStreamLC() +// --------------------------------------------------------------------------- +// +XIMPIMP_IMPLEMENT_DATAOBJ_NEWFROMSTREAM( CXIMPContextStateImp ) + + +// --------------------------------------------------------------------------- +// Implement supported interface access. +// --------------------------------------------------------------------------- +// +XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CXIMPContextStateImp, + MXIMPContextState ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + + +XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CXIMPContextStateImp, + MXIMPContextState ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + + + +// --------------------------------------------------------------------------- +// CXIMPContextStateImp::ContextState() +// --------------------------------------------------------------------------- +MXIMPContextState::TState CXIMPContextStateImp::ContextState() const + { + return iContextState; + } + + +// --------------------------------------------------------------------------- +// CXIMPContextStateImp::ExternalizeL() +// --------------------------------------------------------------------------- +// +void CXIMPContextStateImp::ExternalizeL( RWriteStream& aStream ) const + { + aStream.WriteInt32L( iContextState ); + } + + +// --------------------------------------------------------------------------- +// CXIMPContextStateImp::InternalizeL() +// --------------------------------------------------------------------------- +// +EXPORT_C void CXIMPContextStateImp::InternalizeL( RReadStream& aStream ) + { + iContextState = (MXIMPContextState::TState) aStream.ReadInt32L(); + } + + +// --------------------------------------------------------------------------- +// CXIMPContextStateImp::SetStateValue() +// --------------------------------------------------------------------------- +// +EXPORT_C void CXIMPContextStateImp::SetStateValue( + MXIMPContextState::TState aState ) + { + iContextState = aState; + } + + +// --------------------------------------------------------------------------- +// CXIMPContextStateImp::EqualsContent() +// --------------------------------------------------------------------------- +// +TBool CXIMPContextStateImp::EqualsContent( + const CXIMPApiDataObjBase& aOtherInstance ) const + { + const CXIMPContextStateImp* tmp = + TXIMPGetImpClassOrPanic< const CXIMPContextStateImp >::From( + aOtherInstance.Base() ); + + TBool totallySame = ETrue; + TBool x; + x = iContextState == tmp->iContextState; + totallySame &= x; + + return totallySame; + } + + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcdatamodel/ximpcontextstateimp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcdatamodel/ximpcontextstateimp.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,110 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MXIMPContextState API object implementation. +* +*/ + +#ifndef CXIMPPRESENCECONTEXTSTATEIMP_H +#define CXIMPPRESENCECONTEXTSTATEIMP_H + +#include "ximpapidataobjbase.h" +#include +#include + + +/** + * MXIMPContextState API object implementation. + * + * @lib ximpdatamodel.dll + * @since S60 v3.2 + */ +NONSHARABLE_CLASS( CXIMPContextStateImp ): public CXIMPApiDataObjBase, + public MXIMPContextState + { +public: + /** The class ID. */ + enum { KClassId = XIMPIMP_CLSID_CXIMPCONTEXTSTATEIMP }; + +public: + + IMPORT_C static CXIMPContextStateImp* NewLC(); + IMPORT_C static CXIMPContextStateImp* NewL(); + virtual ~CXIMPContextStateImp(); + + +private: + + CXIMPContextStateImp(); + void ConstructL(); + + /** + * @see CXIMPApiDataObjBase + */ + XIMPIMP_DECLARE_DATAOBJ_BASE_PRIV_METHODS + +public: // From MXIMPBase + + /** + * Implementation of MXIMPBase interface methods + * @see MXIMPBase + */ + XIMPIMP_DECLARE_IF_BASE_METHODS + + /** + * @see CXIMPApiDataObjBase + */ + XIMPIMP_DECLARE_DATAOBJ_BASE_METHODS + + +public: // From MXIMPContextState + + /** + * Implementation of MXIMPContextState interface methods + * @see MXIMPContextState + */ + MXIMPContextState::TState ContextState() const; + + + +public: // New functions + + /** + * Internalizes object data from given stream. + * @param aStream Stream to read. + */ + IMPORT_C void InternalizeL( RReadStream& aStream ); + + + /** + * + * + */ + IMPORT_C void SetStateValue( MXIMPContextState::TState aState ); + + +private: // data + + + /** + * Result code. + * Own. + */ + TState iContextState; + + }; + + +#endif // CXIMPPRESENCECONTEXTSTATEIMP_H + + diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcdatamodel/ximpdatasubscriptionstateimp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcdatamodel/ximpdatasubscriptionstateimp.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,232 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MXIMPDataSubscriptionState API object implementation. +* +*/ + +#include "ximpdatasubscriptionstateimp.h" +#include "ximptrace.h" + +// ============================ MEMBER FUNCTIONS ============================= + +// --------------------------------------------------------------------------- +// CXIMPDataSubscriptionStateImp::NewLC() +// --------------------------------------------------------------------------- +// +EXPORT_C CXIMPDataSubscriptionStateImp* CXIMPDataSubscriptionStateImp::NewLC() + { + CXIMPDataSubscriptionStateImp* self = new( ELeave ) CXIMPDataSubscriptionStateImp; + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + + +// --------------------------------------------------------------------------- +// CXIMPDataSubscriptionStateImp::NewL() +// --------------------------------------------------------------------------- +// +EXPORT_C CXIMPDataSubscriptionStateImp* CXIMPDataSubscriptionStateImp::NewL() + { + CXIMPDataSubscriptionStateImp* self = CXIMPDataSubscriptionStateImp::NewLC(); + CleanupStack::Pop( self ); + return self; + } + + + +// --------------------------------------------------------------------------- +// CXIMPDataSubscriptionStateImp::~CXIMPDataSubscriptionStateImp() +// --------------------------------------------------------------------------- +// +CXIMPDataSubscriptionStateImp::~CXIMPDataSubscriptionStateImp() + { + } + + +// --------------------------------------------------------------------------- +// CXIMPDataSubscriptionStateImp::CXIMPDataSubscriptionStateImp() +// --------------------------------------------------------------------------- +// +CXIMPDataSubscriptionStateImp::CXIMPDataSubscriptionStateImp() + { + iSubscriptionState = MXIMPDataSubscriptionState::ESubscriptionInactive; + iDataState = MXIMPDataSubscriptionState::EDataUnavailable; + } + + +// --------------------------------------------------------------------------- +// CXIMPDataSubscriptionStateImp::ConstructL() +// --------------------------------------------------------------------------- +// +void CXIMPDataSubscriptionStateImp::ConstructL() + { + } + + +// --------------------------------------------------------------------------- +// CXIMPDataSubscriptionStateImp::NewFromStreamLC() +// --------------------------------------------------------------------------- +// +XIMPIMP_IMPLEMENT_DATAOBJ_NEWFROMSTREAM( CXIMPDataSubscriptionStateImp ) + + +// --------------------------------------------------------------------------- +// Implement supported interface access. +// --------------------------------------------------------------------------- +// +XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CXIMPDataSubscriptionStateImp, + MXIMPDataSubscriptionState ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + + +XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CXIMPDataSubscriptionStateImp, + MXIMPDataSubscriptionState ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + + + +// --------------------------------------------------------------------------- +// From class MXIMPDataSubscriptionState. +// CXIMPDataSubscriptionStateImp::SubscriptionState() +// --------------------------------------------------------------------------- +// +MXIMPDataSubscriptionState::TSubscriptionState + CXIMPDataSubscriptionStateImp::SubscriptionState() const + { + return iSubscriptionState; + } + + +// --------------------------------------------------------------------------- +// From class MXIMPDataSubscriptionState. +// CXIMPDataSubscriptionStateImp::DataState() +// --------------------------------------------------------------------------- +// +MXIMPDataSubscriptionState::TDataState + CXIMPDataSubscriptionStateImp::DataState() const + { + return iDataState; + } + + +// --------------------------------------------------------------------------- +// From class MXIMPDataSubscriptionState. +// CXIMPDataSubscriptionStateImp::SetSubscriptionState() +// --------------------------------------------------------------------------- +// +void CXIMPDataSubscriptionStateImp::SetSubscriptionStateL( + MXIMPDataSubscriptionState::TSubscriptionState aSubscriptionState ) + { + SetSubscriptionState( aSubscriptionState ); + } + + +// --------------------------------------------------------------------------- +// From class MXIMPDataSubscriptionState. +// CXIMPDataSubscriptionStateImp::SetDataState() +// --------------------------------------------------------------------------- +// +void CXIMPDataSubscriptionStateImp::SetDataStateL( + MXIMPDataSubscriptionState::TDataState aDataState ) + { + SetDataState( aDataState ); + } + + +// --------------------------------------------------------------------------- +// From class MXIMPDataSubscriptionState. +// CXIMPDataSubscriptionStateImp::SetSubscriptionState() +// --------------------------------------------------------------------------- +// +void CXIMPDataSubscriptionStateImp::SetSubscriptionState( + MXIMPDataSubscriptionState::TSubscriptionState aSubscriptionState ) + { + if ( MXIMPDataSubscriptionState::ESubscriptionActive == aSubscriptionState ) + { + TRACE( _L("CXIMPDataSubscriptionStateImp::SetSubscriptionState ESubscriptionActive" ) ); + } + else if ( MXIMPDataSubscriptionState::ESubscriptionInactive == aSubscriptionState ) + { + TRACE( _L("CXIMPDataSubscriptionStateImp::SetSubscriptionState ESubscriptionInactive" ) ); + } + else + { + TRACE( _L("CXIMPDataSubscriptionStateImp::SetSubscriptionState XXX" ) ); + } + iSubscriptionState = aSubscriptionState; + } + + +// --------------------------------------------------------------------------- +// From class MXIMPDataSubscriptionState. +// CXIMPDataSubscriptionStateImp::SetDataState() +// --------------------------------------------------------------------------- +// +void CXIMPDataSubscriptionStateImp::SetDataState( + MXIMPDataSubscriptionState::TDataState aDataState ) + { + iDataState = aDataState; + } + + +// --------------------------------------------------------------------------- +// CXIMPDataSubscriptionStateImp::ExternalizeL() +// --------------------------------------------------------------------------- +// +void CXIMPDataSubscriptionStateImp::ExternalizeL( RWriteStream& aStream ) const + { + aStream.WriteInt32L( iSubscriptionState ); + aStream.WriteInt32L( iDataState ); + } + + +// --------------------------------------------------------------------------- +// CXIMPDataSubscriptionStateImp::InternalizeL() +// --------------------------------------------------------------------------- +// +EXPORT_C void CXIMPDataSubscriptionStateImp::InternalizeL( RReadStream& aStream ) + { + iSubscriptionState = + (MXIMPDataSubscriptionState::TSubscriptionState) aStream.ReadInt32L(); + + iDataState = + (MXIMPDataSubscriptionState::TDataState) aStream.ReadInt32L(); + } + + +// --------------------------------------------------------------------------- +// CXIMPDataSubscriptionStateImp::EqualsContent() +// --------------------------------------------------------------------------- +// +TBool CXIMPDataSubscriptionStateImp::EqualsContent( + const CXIMPApiDataObjBase& aOtherInstance ) const + { + const CXIMPDataSubscriptionStateImp* tmp = + TXIMPGetImpClassOrPanic< const CXIMPDataSubscriptionStateImp >::From( + aOtherInstance.Base() ); + + TBool totallySame = ETrue; + TBool x; + x = iSubscriptionState == tmp->iSubscriptionState; + totallySame &= x; + + x = iDataState == tmp->iDataState; + totallySame &= x; + + return totallySame; + } + + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcdatamodel/ximpdatasubscriptionstateimp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcdatamodel/ximpdatasubscriptionstateimp.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,146 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MXIMPDataSubscriptionState API object implementation. +* +*/ + +#ifndef CXIMPDATASUBSCRIPTIONSTATEIMP_H +#define CXIMPDATASUBSCRIPTIONSTATEIMP_H + +#include "ximpapidataobjbase.h" +#include +#include + +/** + * MXIMPDataSubscriptionState API object implementation. + * + * @lib ximpdatamodel.dll + * @since S60 v3.2 + */ +NONSHARABLE_CLASS( CXIMPDataSubscriptionStateImp ): public CXIMPApiDataObjBase, + public MXIMPDataSubscriptionState + { +public: + /** The class ID. */ + enum { KClassId = XIMPIMP_CLSID_CXIMPDATASUBSCRIPTIONSTATEIMP }; + +public: + + /** + * Construction methods. + */ + IMPORT_C static CXIMPDataSubscriptionStateImp* NewLC(); + IMPORT_C static CXIMPDataSubscriptionStateImp* NewL(); + + /** + * Destruction + */ + virtual ~CXIMPDataSubscriptionStateImp(); + +private: + + /** + * Construction + */ + CXIMPDataSubscriptionStateImp(); + void ConstructL(); + + /** + * @see CXIMPApiDataObjBase + */ + XIMPIMP_DECLARE_DATAOBJ_BASE_PRIV_METHODS + +public: // From MXIMPBase + + /** + * Implementation of MXIMPBase interface methods + * @see MXIMPBase + */ + XIMPIMP_DECLARE_IF_BASE_METHODS + + /** + * @see CXIMPApiDataObjBase + */ + XIMPIMP_DECLARE_DATAOBJ_BASE_METHODS + + +public: // From MXIMPDataSubscriptionState + + /** + * Implementation of MXIMPDataSubscriptionState interface methods + * @see MXIMPDataSubscriptionState + */ + MXIMPDataSubscriptionState::TSubscriptionState SubscriptionState() const; + + /** + * Implementation of MXIMPDataSubscriptionState interface methods + * @see MXIMPDataSubscriptionState + */ + MXIMPDataSubscriptionState::TDataState DataState() const; + + /** + * Implementation of MXIMPDataSubscriptionState interface methods + * @see MXIMPDataSubscriptionState + */ + void SetSubscriptionStateL( MXIMPDataSubscriptionState::TSubscriptionState aSubscriptionState ); + + /** + * Implementation of MXIMPDataSubscriptionState interface methods + * @see MXIMPDataSubscriptionState + */ + void SetDataStateL( MXIMPDataSubscriptionState::TDataState aDataState ); + +public: // New functions + + /** + * Internalizes object data from given stream. + * @param aStream Stream to read. + */ + IMPORT_C void InternalizeL( RReadStream& aStream ); + + /** + * Set subscriptionstate for internal usage. + * Created as non leaving version of method. + * @param aSubscriptionState New subscription state for state object. + */ + void SetSubscriptionState( MXIMPDataSubscriptionState::TSubscriptionState aSubscriptionState ); + + /** + * Set data state for internal use. + * Created as non leaving version of method. + * @param aDataState New data state for state object. + */ + void SetDataState( MXIMPDataSubscriptionState::TDataState aDataState ); + +private: // data + + + /** + * Subscription state. + * Own. + */ + TSubscriptionState iSubscriptionState; + + + /** + * Data state. + * Own. + */ + TDataState iDataState; + }; + + +#endif // CXIMPDATASUBSCRIPTIONSTATEIMP_H + + diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcdatamodel/ximpeventcodec.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcdatamodel/ximpeventcodec.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,233 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Base class for API implementations. +* +*/ + + +#include +#include + +#include "ximpeventcodec.h" +#include "ximprequestcompleteeventimp.h" +#include "ximpcontextstateeventimp.h" + + +/** + * Type definition for exact API event constructor signature. + */ +typedef CXIMPApiEventBase* (*TApiEventConstructor)( RReadStream& ); + + + +/** + * Structure for mapping event interface IDs to + * to corect API event constructors. + */ +struct SApiEventConstructorMap + { + //Interface id + TInt32 iInterfaceId; + + //Function pointer to event interface implementation + TApiEventConstructor iConstructorPtr; + } ; + + + +/** + * Helper macro to initialise KApiEventConstructorTable members. + * + * Macro forces that each event implementation class to have static + * NewFromStreamLC() memeber function to instantiate the object. + * + * See TApiEventConstructor type definition for exact constructor + * signature. + */ +#define CONSTRUCTOR_ENTRY( TheImplementedIf, TheClass ) \ + { TheImplementedIf::KInterfaceId, TheClass::NewFromStreamLC } \ + + + +/** + * Constructor function mapping for event interface implementations. + * + * When new event types are implemented, add them here. + */ +const SApiEventConstructorMap KApiEventConstructorTable[] = + { + CONSTRUCTOR_ENTRY( MXIMPRequestCompleteEvent, CXIMPRequestCompleteEventImp ), + CONSTRUCTOR_ENTRY( MXIMPContextStateEvent, CXIMPContextStateEventImp ) + }; + + +/** + * Count of constructor mappings. + */ +const TInt KApiEventConstructorCount = sizeof( KApiEventConstructorTable ) + / sizeof( SApiEventConstructorMap ); + + + +// ============================ HELPER FUNCTIONS ============================= + + +/** + * Helper function to locate constructor function for + * event interface ID. + * + * @param aEventInterfaceId The event interface ID. + * @return Event object constructor function. + */ +TApiEventConstructor ConstructorForInterface( TInt32 aEventInterfaceId ) + { + //Locate correct constructor + for( TInt ix = 0; ix < KApiEventConstructorCount; ix++ ) + { + const SApiEventConstructorMap map = KApiEventConstructorTable[ ix ]; + if( map.iInterfaceId == aEventInterfaceId ) + { + return map.iConstructorPtr; + } + } + + + //If assertion below fails, check that event implementation + //class implementing requested event interface (aEventInterfaceId) + //is registered to KApiEventConstructorTable +// __ASSERT_DEBUG( EFalse, +// User::Panic( _L("XIMPEventCodec"), KErrUnknown ) ); + + return NULL; + } + + +/** + * Helper function to instantiate new event object + * of requested type and construct it from the stream. + * + * @param aEventInterfaceId + * @return Event object constructor function. + */ +CXIMPApiEventBase* NewEventObjectFromStreamLC( TInt32 aEventInterfaceId, + RReadStream& aStream ) + { + TApiEventConstructor newFromStreamLC = NULL; + + //Locate correct constructor for interface ID + newFromStreamLC = ConstructorForInterface( aEventInterfaceId ); + + if ( newFromStreamLC ) + { + //Instantiate the object + CXIMPApiEventBase* eventObject = newFromStreamLC( aStream ); + return eventObject; + } + + + // if no constructor + return NULL; + } + + + +// ============================ MEMBER FUNCTIONS ============================= + +// --------------------------------------------------------------------------- +// XIMPEventCodec::PackL() +// --------------------------------------------------------------------------- +// +EXPORT_C HBufC8* XIMPEventCodec::PackL( CXIMPApiEventBase& aEventObj, + TInt32& aTypeOfEvent ) + { + CBufFlat* buffer = CBufFlat::NewL( 10 ); // initial granularity to 10 + CleanupStack::PushL( buffer ); + + RBufWriteStream ws; + CleanupClosePushL( ws ); + ws.Open( *buffer ); // CSI: 65 # + + //Ask real event type through the event base interface + TInt32 eventIfId = aEventObj.Base().GetInterfaceId(); + + //And write both event type and data + ws.WriteInt32L( eventIfId ); + aEventObj.ExternalizeL( ws ); + ws.CommitL(); + CleanupStack::PopAndDestroy(); //ws + + HBufC8* heapBuf = buffer->Ptr( 0 ).AllocL(); + + CleanupStack::PopAndDestroy( buffer ); + + + aTypeOfEvent = eventIfId; + return heapBuf; + } + + +// --------------------------------------------------------------------------- +// XIMPEventCodec::PackL() +// --------------------------------------------------------------------------- +// +EXPORT_C void XIMPEventCodec::PackL( CXIMPApiEventBase& aEventObj, + TInt32& aTypeOfEvent, + CBufFlat* aBuffer ) + { + RBufWriteStream ws; + CleanupClosePushL( ws ); + ws.Open( *aBuffer ); // CSI: 65 # + + //Ask real event type through the event base interface + TInt32 eventIfId = aEventObj.Base().GetInterfaceId(); + + //And write both event type and data + ws.WriteInt32L( eventIfId ); + aEventObj.ExternalizeL( ws ); + ws.CommitL(); + CleanupStack::PopAndDestroy(); //ws + + aTypeOfEvent = eventIfId; + } + + +// --------------------------------------------------------------------------- +// XIMPEventCodec::UnPackL() +// --------------------------------------------------------------------------- +// +EXPORT_C CXIMPApiEventBase* XIMPEventCodec::UnPackL( const TDesC8& aEventData, + TInt32& aTypeOfEvent ) + { + RDesReadStream rs; + rs.Open( aEventData ); // CSI: 65 # + CleanupClosePushL( rs ); + + TInt32 eventIfId = rs.ReadInt32L(); + CXIMPApiEventBase* eventObject = NewEventObjectFromStreamLC( eventIfId, rs ); + + if ( eventObject ) + { + CleanupStack::Pop(); //eventObject + } + + CleanupStack::PopAndDestroy(); // rs + + + aTypeOfEvent = eventIfId; + return eventObject; + } + + +// End of file + diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcdatamodel/ximpeventcodec.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcdatamodel/ximpeventcodec.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,73 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Codec to pack and unpack event objects. +* +*/ + +#ifndef XIMPEVENTCODEC_H +#define XIMPEVENTCODEC_H + +#include + +class CXIMPApiEventBase; +class RReadStream; + + +/** + * Codec to pack and unpack event objects. + * + * @lib ximpdatamodel.dll + * @since S60 v3.2 + */ +NONSHARABLE_CLASS( XIMPEventCodec ) + { +public: + + /** + * + * + * + * @param + * + * @return + * + */ + IMPORT_C static HBufC8* PackL( CXIMPApiEventBase& aEventObj, + TInt32& aTypeOfEvent ); + IMPORT_C static void PackL( CXIMPApiEventBase& aEventObj, + TInt32& aTypeOfEvent, + CBufFlat* aBuffer ); + + /** + * + * + * + * @param + * + * @return + * + */ + IMPORT_C static CXIMPApiEventBase* UnPackL( const TDesC8& aEventData, + TInt32& aTypeOfEvent ); + + +private: + + XIMPEventCodec(); + ~XIMPEventCodec(); + + }; + + +#endif // XIMPEVENTCODEC_H diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcdatamodel/ximpfeatureinfoimp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcdatamodel/ximpfeatureinfoimp.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,233 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MXIMPFeatureInfo API object implementation. +* +*/ + +#include "ximpfeatureinfoimp.h" +#include "ximprbufhelpers.h" + + +const TInt KXIMPFeatureInfoGranularity = 5; + +// ============================ MEMBER FUNCTIONS ============================= + +// --------------------------------------------------------------------------- +// CXIMPFeatureInfoImp::NewLC() +// --------------------------------------------------------------------------- +// +EXPORT_C CXIMPFeatureInfoImp* CXIMPFeatureInfoImp::NewLC() + { + CXIMPFeatureInfoImp* self = new( ELeave ) CXIMPFeatureInfoImp; + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + + +// --------------------------------------------------------------------------- +// CXIMPFeatureInfoImp::NewLC() +// --------------------------------------------------------------------------- +// +EXPORT_C CXIMPFeatureInfoImp* CXIMPFeatureInfoImp::NewL() + { + CXIMPFeatureInfoImp* self = CXIMPFeatureInfoImp::NewLC(); + CleanupStack::Pop( self ); + return self; + } + + + +// --------------------------------------------------------------------------- +// CXIMPFeatureInfoImp::~CXIMPFeatureInfoImp() +// --------------------------------------------------------------------------- +// +CXIMPFeatureInfoImp::~CXIMPFeatureInfoImp() + { + if ( iFeatures ) + { + iFeatures->Reset(); + } + delete iFeatures; + } + + +// --------------------------------------------------------------------------- +// CXIMPFeatureInfoImp::CXIMPFeatureInfoImp() +// --------------------------------------------------------------------------- +// +CXIMPFeatureInfoImp::CXIMPFeatureInfoImp() + { + } + + +// --------------------------------------------------------------------------- +// CXIMPFeatureInfoImp::ConstructL() +// --------------------------------------------------------------------------- +// +void CXIMPFeatureInfoImp::ConstructL() + { + iFeatures = new ( ELeave ) CDesC8ArraySeg( KXIMPFeatureInfoGranularity ); + } + +// --------------------------------------------------------------------------- +// CXIMPFeatureInfoImp::NewFromStreamLC() +// --------------------------------------------------------------------------- +// +XIMPIMP_IMPLEMENT_DATAOBJ_NEWFROMSTREAM( CXIMPFeatureInfoImp ) + + +// --------------------------------------------------------------------------- +// Implement supported interface access. +// --------------------------------------------------------------------------- +// +XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CXIMPFeatureInfoImp, + MXIMPFeatureInfo ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + +XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CXIMPFeatureInfoImp, + MXIMPFeatureInfo ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + + +// --------------------------------------------------------------------------- +// CXIMPFeatureInfoImp::FeatureIds() +// --------------------------------------------------------------------------- +const MDesC8Array& CXIMPFeatureInfoImp::FeatureIds() const + { + return *iFeatures; + } + + +// --------------------------------------------------------------------------- +// CXIMPFeatureInfoImp::HasFeatureId() +// --------------------------------------------------------------------------- +TInt CXIMPFeatureInfoImp::HasFeatureId( const TDesC8& aFeatureId ) + { + TInt index(0); + return FindFeature( aFeatureId, index ); + } + + +// --------------------------------------------------------------------------- +// CXIMPFeatureInfoImp::AddFeatureL() +// --------------------------------------------------------------------------- +EXPORT_C TInt CXIMPFeatureInfoImp::AddFeatureL( const TDesC8& aFeature ) + { + // First check if the feature already exists + TInt index( 0 ); + if ( FindFeature( aFeature, index ) == 0 ) + { + return KErrAlreadyExists; + } + + // Add to features + iFeatures->InsertIsqL( aFeature ); + return KErrNone; + } + + +// --------------------------------------------------------------------------- +// CXIMPFeatureInfoImp::FindFeature() +// --------------------------------------------------------------------------- +TInt CXIMPFeatureInfoImp::FindFeature( const TDesC8& aFeature, TInt& aIndex ) + { + if ( iFeatures->FindIsq( aFeature, aIndex ) != 0 ) + { + return KErrNotFound; + } + + return KErrNone; + } + + +// --------------------------------------------------------------------------- +// CXIMPFeatureInfoImp::ExternalizeL() +// --------------------------------------------------------------------------- +// +void CXIMPFeatureInfoImp::ExternalizeL( RWriteStream& aStream ) const + { + const TInt featureCount = iFeatures->MdcaCount(); + aStream.WriteInt32L( featureCount ); + + for ( TInt count = 0; count < featureCount; count++ ) + { + TPtrC8 temp (iFeatures->MdcaPoint( count ) ); + aStream.WriteInt32L( temp.Length() ); + aStream.WriteL( temp ); + } + } + + +// --------------------------------------------------------------------------- +// CXIMPFeatureInfoImp::InternalizeL() +// --------------------------------------------------------------------------- +// +EXPORT_C void CXIMPFeatureInfoImp::InternalizeL( RReadStream& aStream ) + { + iFeatures->Reset(); + + const TInt featureCount = aStream.ReadInt32L(); + + RBuf8 temp; + CleanupClosePushL( temp ); + + for ( TInt count( 0 ); count < featureCount; count++ ) + { + const TInt length = aStream.ReadInt32L(); + XIMPRBuf8Helper::GrowIfNeededL( temp, length ); + aStream.ReadL( temp, length ); + + // Fine to simply append new entries, since we are internalizing + // data which has been already validated and ordered + iFeatures->AppendL( temp ); + } + + CleanupStack::PopAndDestroy(); // temp + } + +// --------------------------------------------------------------------------- +// CXIMPFeatureInfoImp::EqualsContent() +// --------------------------------------------------------------------------- +// +TBool CXIMPFeatureInfoImp::EqualsContent( + const CXIMPApiDataObjBase& aOtherInstance ) const + { + const CXIMPFeatureInfoImp* tmp = + TXIMPGetImpClassOrPanic< const CXIMPFeatureInfoImp >::From( aOtherInstance.Base() ); + + TBool same = ETrue; + TBool x; + + x = iFeatures->MdcaCount() == tmp->iFeatures->MdcaCount(); + same &= x; + + if ( ! same ) + { + // early-out if lengths mismatch to avoid costly array + // comparison + return EFalse; + } + + // arrays must be in same order with same content. + for ( TInt i = 0; i < iFeatures->Count(); i++ ) + { + x = 0 == iFeatures->MdcaPoint( i ).Compare( tmp->iFeatures->MdcaPoint( i ) ); + same &= x; + } + + return same; + } + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcdatamodel/ximpfeatureinfoimp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcdatamodel/ximpfeatureinfoimp.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,126 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MXIMPFeatureInfo API object implementation. +* +*/ + +#ifndef CXIMPFEATUREINFOIMP_H +#define CXIMPFEATUREINFOIMP_H + + +#include "ximpapidataobjbase.h" +#include +#include // RWriteStream, RReadStream +#include // CDesC8ArraySeg + + +/** + * MXIMPFeatureInfo API object implementation. + * + * @lib ximpdatamodel.dll + * @since S60 v3.2 + */ +NONSHARABLE_CLASS( CXIMPFeatureInfoImp ): public CXIMPApiDataObjBase, + public MXIMPFeatureInfo + { +public: + /** The class ID. */ + enum { KClassId = XIMPIMP_CLSID_CXIMPFEATUREINFOIMP }; + + +public: + + IMPORT_C static CXIMPFeatureInfoImp* NewLC(); + IMPORT_C static CXIMPFeatureInfoImp* NewL(); + virtual ~CXIMPFeatureInfoImp(); + + +private: + + CXIMPFeatureInfoImp(); + void ConstructL(); + + /** + * @see CXIMPApiDataObjBase + */ + XIMPIMP_DECLARE_DATAOBJ_BASE_PRIV_METHODS + + +public: // From MXIMPBase + + /** + * Implementation of MXIMPBase interface methods + * @see MXIMPBase + */ + XIMPIMP_DECLARE_IF_BASE_METHODS + + /** + * @see CXIMPApiDataObjBase + */ + XIMPIMP_DECLARE_DATAOBJ_BASE_METHODS + +public: // From MXIMPFeatureInfo + + /** + * Implementation of MXIMPFeatureInfo interface methods + * @see MXIMPFeatureInfo + */ + const MDesC8Array& FeatureIds() const; + TInt HasFeatureId( const TDesC8& aFeatureId ); + + +public: // New methods + + /** + * Adds a feature. + * + * @param aFeature Feature to be added. + * @return KErrNone if the feature was added successfully, + * KErrAlreadyExists if the feature already exists, + */ + IMPORT_C TInt AddFeatureL( const TDesC8& aFeature ); + + /** + * Internalizes object data from given stream. + * @param aStream Stream to read. + */ + IMPORT_C void InternalizeL( RReadStream& aStream ); + + +private: // helpers + + /** + * Find a feature from features. + * + * @param [in] aFeature That is searched. + * @param [out] aIndex If found the index position of the found feature, + * if not found the place where it should be inserted. + * @return KErrNone if the feature exists, + * KErrNotFound if the feature isn't found, + */ + TInt FindFeature( const TDesC8& aFeature, TInt& aIndex ); + + +private: // data + + /** + * Supported features + * Own. + */ + CDesC8ArraySeg* iFeatures; + + }; + + +#endif // CXIMPFEATUREINFOIMP_H diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcdatamodel/ximpfeaturepluginholder.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcdatamodel/ximpfeaturepluginholder.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,198 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Presence Service Connection globals holder + * +*/ + + +#include +#include "ximpfeaturepluginholder.h" +#include "apidataobjfactoryaccessor.h" + +const TInt KPluginArrayGranularity = 3; + +// ============================ HELPER CLASS =============================== + + +/** + * Nested structure to hold global accessor objects. + */ + +// FIXME: probably better would be to encapsulate the struct to CBase object +NONSHARABLE_STRUCT( SAccessorHolder ) + { + /** + * Presence obj factory accessor + * Owned. + */ + MApiDataObjFactoryAccessor* iPresenceAccessor; + + + // array of accessor plugins + CArrayFixFlat* iAccessorPlugins; + + /** + * TODO: Add here more accessors + */ + + /** + * Reference counter + */ + TInt iRefCount; + }; + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +EXPORT_C void FeaturePluginHolder::InitializeL( ) + { + SAccessorHolder* singleton = ( SAccessorHolder* ) Dll::Tls(); + + if( !singleton ) + { + singleton = new ( ELeave ) SAccessorHolder; + Dll::SetTls( singleton ); + + // Initialize the variables + singleton->iRefCount = 0; + singleton->iPresenceAccessor = NULL; + + TRAP_IGNORE( singleton->iPresenceAccessor = MApiDataObjFactoryAccessor::NewPresenceAccessorL( ) ); + + //added to hold accessor plugins + singleton->iAccessorPlugins = new(ELeave)CArrayFixFlat(KPluginArrayGranularity); + + FeaturePluginHolder::LoadAccessorPluginsL() ; + } + else + { + // increase the reference counter + singleton->iRefCount++; + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +EXPORT_C MApiDataObjFactoryAccessor* FeaturePluginHolder::PresenceObjFactoryAccessor() + { + SAccessorHolder* singleton = ( SAccessorHolder* ) Dll::Tls(); + if( !singleton ) + { + User::Panic( _L("cximpglobals"), KErrNotFound ); + } + + return singleton->iPresenceAccessor; + } + + +// ----------------------------------------------------------------------------- +// FeaturePluginHolder::Release() +// ----------------------------------------------------------------------------- +// +EXPORT_C void FeaturePluginHolder::Release( ) + { + SAccessorHolder* singleton = ( SAccessorHolder* ) Dll::Tls(); + if ( !singleton->iRefCount ) + { + // No more users, clean the TLS up + delete singleton->iPresenceAccessor; + if ( singleton->iAccessorPlugins ) + { + TInt idx = KErrNotFound; + while( singleton->iAccessorPlugins->Count() ) + { + idx = singleton->iAccessorPlugins->Count() - 1; + // Delete object + delete singleton->iAccessorPlugins->At( idx ); + // Delete element + singleton->iAccessorPlugins->Delete( idx ); + } + } + + delete singleton->iAccessorPlugins; + REComSession::FinalClose(); + + delete singleton; + Dll::SetTls(NULL); + } + else + { + singleton->iRefCount--; + } + } + +void FeaturePluginHolder::LoadAccessorPluginsL() +{ + SAccessorHolder* singleton = ( SAccessorHolder* ) Dll::Tls(); + if(!singleton) + { + User::Panic( _L("cximpglobals"), KErrNotFound ); + } + else + { + RImplInfoPtrArray pluginArray; + MApiDataObjFactoryAccessor::ListAllImplementationsL(pluginArray) ; + if ( pluginArray.Count() ) + { + for( TInt i = 0; i < pluginArray.Count(); i++ ) + { + MApiDataObjFactoryAccessor* implementation = NULL ; + + CImplementationInformation* info = pluginArray[ i ]; + + TUid id = info->ImplementationUid(); + TRAPD(err, implementation = MApiDataObjFactoryAccessor::NewL(id) ); + CleanupStack::PushL(implementation); + if(err == KErrNone) + { + singleton->iAccessorPlugins->AppendL( implementation ); + } + CleanupStack::Pop(implementation); + } + } + pluginArray.ResetAndDestroy(); + } +} + +EXPORT_C TInt FeaturePluginHolder::AccessorCount() +{ + SAccessorHolder* singleton = ( SAccessorHolder* ) Dll::Tls(); + if(!singleton) + { + User::Panic( _L("cximpglobals"), KErrNotFound ); + } + + return singleton->iAccessorPlugins->Count() ; + +} + +EXPORT_C MApiDataObjFactoryAccessor* FeaturePluginHolder::Accessor(TInt index) +{ + SAccessorHolder* singleton = ( SAccessorHolder* ) Dll::Tls(); + if(!singleton) + { + User::Panic( _L("cximpglobals"), KErrNotFound ); + } + + return singleton->iAccessorPlugins->At(index) ; +} + +// End of file + + diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcdatamodel/ximpfeaturepluginholder.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcdatamodel/ximpfeaturepluginholder.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,83 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Presence Service Connection globals holder + * +*/ + +#ifndef FEATUREPLUGINHOLDER_H +#define FEATUREPLUGINHOLDER_H + +class MApiDataObjFactoryAccessor; + +/** + * Static helper class for accessing the Feature Plug-in datamodel internal interfaces. + * + * @lib ximpdatamodel.dll + * @since S60 v5.0 + */ +class FeaturePluginHolder + { + public: + + /** + * Initializes the TLS where the pointers to the different accessor objects + * from feature plug-ins are stores. The TLS is reference counted. + * + * + */ + IMPORT_C static void InitializeL(); + + /** + * Returns the API Data Model Object Factory Accessor from the presence feature plug-in. + * + * + */ + IMPORT_C static MApiDataObjFactoryAccessor* PresenceObjFactoryAccessor( ); + + /** + * Cleans the TLS, reference counted. + * + * + */ + IMPORT_C static void Release(); + + /** + * Returns the API Data Model Object Factory Accessor count + * + * + */ + IMPORT_C static TInt AccessorCount(); + + /** + * Returns the API Data Model Object Factory Accessor from given index + * + * + */ + IMPORT_C static MApiDataObjFactoryAccessor* Accessor(TInt index) ; + + + + private: + + /** + * Loads all ecom accessor + * + * + */ + void static LoadAccessorPluginsL() ; + }; + +#endif // FEATUREPLUGINHOLDER_H + + diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcdatamodel/ximpidentityimp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcdatamodel/ximpidentityimp.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,193 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MXIMPIdentity API object implementation. +* +*/ + + +#include "ximpidentityimp.h" +#include "ximprbufhelpers.h" + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// CXIMPIdentityImp::NewLC() +// --------------------------------------------------------------------------- +// +EXPORT_C CXIMPIdentityImp* CXIMPIdentityImp::NewLC() + { + CXIMPIdentityImp* self = new( ELeave ) CXIMPIdentityImp; + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + + +EXPORT_C CXIMPIdentityImp* CXIMPIdentityImp::NewL() + { + CXIMPIdentityImp* self = CXIMPIdentityImp::NewLC(); + CleanupStack::Pop( self ); + return self; + } + + +EXPORT_C CXIMPIdentityImp* CXIMPIdentityImp::NewLC( const TDesC16& aIdentity ) + { + CXIMPIdentityImp* self = new( ELeave ) CXIMPIdentityImp; + CleanupStack::PushL( self ); + self->ConstructL( aIdentity ); + return self; + } + +// --------------------------------------------------------------------------- +// CXIMPIdentityImp::~CXIMPIdentityImp() +// --------------------------------------------------------------------------- +// +CXIMPIdentityImp::~CXIMPIdentityImp() + { + iIdentity.Close(); + } + + +// --------------------------------------------------------------------------- +// CXIMPIdentityImp::CXIMPIdentityImp() +// --------------------------------------------------------------------------- +// +CXIMPIdentityImp::CXIMPIdentityImp() + { + } + + +// --------------------------------------------------------------------------- +// CXIMPIdentityImp::ConstructL() +// --------------------------------------------------------------------------- +// +void CXIMPIdentityImp::ConstructL() + { + iIdentity.CreateL( 0 ); + } + +void CXIMPIdentityImp::ConstructL( const TDesC16& aIdentity ) + { + iIdentity.CreateL( aIdentity ); + } + +// --------------------------------------------------------------------------- +// CXIMPIdentityImp::NewFromStreamLC() +// --------------------------------------------------------------------------- +// +XIMPIMP_IMPLEMENT_DATAOBJ_NEWFROMSTREAM( CXIMPIdentityImp ) + + +// --------------------------------------------------------------------------- +// Implement supported interface access. +// --------------------------------------------------------------------------- +// +XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CXIMPIdentityImp, + MXIMPIdentity ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + + +XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CXIMPIdentityImp, + MXIMPIdentity ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + + + +// --------------------------------------------------------------------------- +// CXIMPIdentityImp::SetIdentityL() +// --------------------------------------------------------------------------- +// +void CXIMPIdentityImp::SetIdentityL( const TDesC16& aIdentity ) + { + iIdentity.Close(); + iIdentity.CreateL( aIdentity ); + } + + +// --------------------------------------------------------------------------- +// CXIMPIdentityImp::Identity() +// --------------------------------------------------------------------------- +// +const TDesC16& CXIMPIdentityImp::Identity() const + { + return iIdentity; + } + + +// --------------------------------------------------------------------------- +// CXIMPIdentityImp::ExternalizeL() +// --------------------------------------------------------------------------- +// +void CXIMPIdentityImp::ExternalizeL( RWriteStream& aStream ) const + { + XIMPRBuf16Helper::ExternalizeL( iIdentity, aStream ); + } + + +// --------------------------------------------------------------------------- +// CXIMPIdentityImp::InternalizeL() +// --------------------------------------------------------------------------- +// +EXPORT_C void CXIMPIdentityImp::InternalizeL( RReadStream& aStream ) + { + XIMPRBuf16Helper::InternalizeL( iIdentity, aStream ); + } + +// --------------------------------------------------------------------------- +// CXIMPIdentityImp::operator!=() +// --------------------------------------------------------------------------- +// +EXPORT_C TBool CXIMPIdentityImp::operator!=( const CXIMPIdentityImp& aOther ) const + { + if( iIdentity.Compare( aOther.iIdentity ) ) + { + return ETrue; + } + else + { + return EFalse; + } + } + +// --------------------------------------------------------------------------- +// CXIMPIdentityImp::EqualsContent() +// --------------------------------------------------------------------------- +// +TBool CXIMPIdentityImp::EqualsContent( + const CXIMPApiDataObjBase& aOtherInstance ) const + { + const CXIMPIdentityImp* tmp = + TXIMPGetImpClassOrPanic< const CXIMPIdentityImp >::From( aOtherInstance.Base() ); + + TBool same = ETrue; + + TBool x; + x = 0 == iIdentity.Compare( tmp->iIdentity ); + same &= x; + + return same; + } + + +// --------------------------------------------------------------------------- +// CXIMPIdentityImp::Compare() +// --------------------------------------------------------------------------- +// +EXPORT_C TInt CXIMPIdentityImp::Compare( const CXIMPIdentityImp& aOther ) const + { + return iIdentity.Compare( aOther.iIdentity ); + } + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcdatamodel/ximpitemparent.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcdatamodel/ximpitemparent.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,140 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Item parent interface. +* +*/ + +#ifndef CXIMPITEMPARENT_H +#define CXIMPITEMPARENT_H + +#include + +class COwnPresenceSubscriptionItem; +class CGroupListSubscriptionItem; +class CGroupContentSubscriptionItem; +class CPresentityPresenceSubscriptionItem; +class CPresentityGroupMembersPresenceSubscriptionItem; +class CWatcherListSubscriptionItem; +class CGrantRequestListSubscriptionItem; +//class CXIMPSubscriptionItemBase; +class CXIMPApiEventBase; +class MXIMPPscContext; +class CXIMPIdentityImp; +class CPresenceConfigurationItem; +class CGroupMembersPresenceConfigurationItem; +class CXIMPConfigurationItemBase; +class CBlockListSubscriptionItem; +class CPresenceToEveryoneConfigurationItem; +class MPresenceCacheWriter; + +// FIX ME +#define PRESENCE_ITEM_PARENT 0xE0000009 + +/** + * Item parent interface. + * + * @since S60 v3.2 + */ +class MXIMPItemParent : public MXIMPItemParentBase + { + public: + enum { KInterfaceId = PRESENCE_ITEM_PARENT}; + +public: // Definitions + + /** + * Remove item + * @param aChild Item pointer to remove. + */ + virtual void RemoveMe( COwnPresenceSubscriptionItem* aChild ) = 0; + virtual void RemoveMe( CGroupListSubscriptionItem* aChild ) = 0; + virtual void RemoveMe( CGroupContentSubscriptionItem* aChild ) = 0; + virtual void RemoveMe( CPresentityPresenceSubscriptionItem* aChild ) = 0; + virtual void RemoveMe( CWatcherListSubscriptionItem* aChild ) = 0; + virtual void RemoveMe( CPresentityGroupMembersPresenceSubscriptionItem* aChild ) = 0; + virtual void RemoveMe( CGrantRequestListSubscriptionItem* aChild ) = 0; + virtual void RemoveMe( CBlockListSubscriptionItem* aChild ) = 0; + + virtual void RemoveMe( CPresenceConfigurationItem* aChild ) = 0; + virtual void RemoveMe( CPresenceToEveryoneConfigurationItem* aChild ) = 0; + virtual void RemoveMe( CGroupMembersPresenceConfigurationItem* aChild ) = 0; + + /** + * Add event + */ + virtual void AddEventL( CXIMPApiEventBase& aEvent, MXIMPPscContext* aContext ) = 0; + + /** + * Register item for expiration purposes. + */ + //virtual void RegisterExpiringItemL( CXIMPSubscriptionItemBase* aExpireItem ) = 0; + + /** + * Unregister item from expiration purposes. + */ + //virtual void UnregisterExpiringItem( CXIMPSubscriptionItemBase* aExpireItem ) = 0; + + /** + * Add item as subscriber for presentity presence. + */ + virtual void AddPresentityPresenceSubscriberL( const CXIMPIdentityImp& aIdentity, CXIMPSubscriptionItemBase* aItem, CXIMPIdentityImp* aGroup = NULL ) = 0; + + /** + * Remove item from subscribing presentity presence. + */ + virtual void RemovePresentityPresenceSubscriber( const CXIMPIdentityImp& aIdentity, CXIMPSubscriptionItemBase* aItem ) = 0; + + /** + * Activate item for subscribing presentity presence + */ + virtual void ActivatePresentityPresenceSubscriberL( const CXIMPIdentityImp& aIdentity, CXIMPSubscriptionItemBase* aItem ) = 0; + + /** + * Synthesise presentity presence subscription event + */ + virtual void SynthesisePresentityPresenceSubscriptionEventToL( const CXIMPIdentityImp& aIdentity, MXIMPPscContext* aContext, TBool aForceEvent ) = 0; + + /** + * Add item as configurator for presentity presence. + */ + virtual void AddPresenceConfiguratorL( const CXIMPIdentityImp& aIdentity, CXIMPConfigurationItemBase* aItem ) = 0; + + /** + * Remove item from configuring presentity presence. + */ + virtual void RemovePresenceConfigurator( const CXIMPIdentityImp& aIdentity, CXIMPConfigurationItemBase* aItem ) = 0; + + /** + * Return the protocol ID of the host of the parent + */ + virtual TInt32 ProtocolUID( ) = 0; + + /** + * Return the global presence cache object + */ + virtual MPresenceCacheWriter* ExternalCache( ) = 0; + +protected: // Destruction + + /** + * Object cannot be delted through this interface + */ + virtual ~MXIMPItemParent(){} + }; + +/* ======================================================================== */ + + + +#endif // CXIMPITEMPARENT_H diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcdatamodel/ximpobjectcollectionimp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcdatamodel/ximpobjectcollectionimp.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,359 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MXIMPObjectCollection implementation + * +*/ + +#include "ximpobjectcollectionimp.h" + + +// ============================ HELPER CLASS ============================= + +// --------------------------------------------------------------------------- +// CXIMPCollectionElement::NewL +// --------------------------------------------------------------------------- +// +CXIMPObjectCollectionImp::CXIMPCollectionElement* +CXIMPObjectCollectionImp::CXIMPCollectionElement::NewL( + CXIMPApiObjBase* aObject, const TDesC8& aName ) + { + CXIMPCollectionElement* self = new ( ELeave ) CXIMPCollectionElement(); + CleanupStack::PushL( self ); + self->ConstructL( aObject, aName ); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// CXIMPCollectionElement::ConstructL +// --------------------------------------------------------------------------- +// +void CXIMPObjectCollectionImp::CXIMPCollectionElement::ConstructL( + CXIMPApiObjBase* aObject, const TDesC8& aName ) + { + iObject = aObject; + + if ( aName.Length() > 0 ) + { + iName = aName.AllocL(); + } + else + { + // at least an empty one always exists + iName = HBufC8::NewL( 0 ); + } + } + +// --------------------------------------------------------------------------- +// CXIMPCollectionElement::CXIMPCollectionElement +// --------------------------------------------------------------------------- +// +CXIMPObjectCollectionImp::CXIMPCollectionElement::CXIMPCollectionElement() + { + } + +// --------------------------------------------------------------------------- +// CXIMPCollectionElement::~CXIMPCollectionElement +// --------------------------------------------------------------------------- +// +CXIMPObjectCollectionImp::CXIMPCollectionElement::~CXIMPCollectionElement() + { + delete iObject; + delete iName; + } + +// --------------------------------------------------------------------------- +// CXIMPCollectionElement::GetObject +// --------------------------------------------------------------------------- +// +CXIMPApiObjBase* CXIMPObjectCollectionImp::CXIMPCollectionElement::GetObject() + { + CXIMPApiObjBase* obj = iObject; + iObject = NULL; + return obj; + } + +// ============================ MEMBER FUNCTIONS ============================= + +// --------------------------------------------------------------------------- +// CXIMPObjectCollectionImp::NewL() +// --------------------------------------------------------------------------- +// +EXPORT_C CXIMPObjectCollectionImp* CXIMPObjectCollectionImp::NewL() + { + CXIMPObjectCollectionImp* self = NewLC(); + CleanupStack::Pop( self ); + return self; + } + + +// --------------------------------------------------------------------------- +// CXIMPObjectCollectionImp::NewLC() +// --------------------------------------------------------------------------- +// +EXPORT_C CXIMPObjectCollectionImp* CXIMPObjectCollectionImp::NewLC() + { + CXIMPObjectCollectionImp* self = new ( ELeave ) CXIMPObjectCollectionImp; + CleanupStack::PushL( self ); + return self; + } + + +// --------------------------------------------------------------------------- +// CXIMPObjectCollectionImp::~CXIMPObjectCollectionImp() +// --------------------------------------------------------------------------- +// +CXIMPObjectCollectionImp::~CXIMPObjectCollectionImp() + { + iCollection.ResetAndDestroy(); + } + +// --------------------------------------------------------------------------- +// CXIMPObjectCollectionImp::CXIMPObjectCollectionImp() +// --------------------------------------------------------------------------- +// +CXIMPObjectCollectionImp::CXIMPObjectCollectionImp() + { + } + + +// --------------------------------------------------------------------------- +// Implement supported interface access. +// --------------------------------------------------------------------------- +// +XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CXIMPObjectCollectionImp, + MXIMPObjectCollection ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + + +XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CXIMPObjectCollectionImp, + MXIMPObjectCollection ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + + + +// --------------------------------------------------------------------------- +// CXIMPObjectCollectionImp::LookupByType() +// --------------------------------------------------------------------------- +// +void CXIMPObjectCollectionImp::LookupByType( + const MXIMPBase*& aObject, + TInt32 aInterfaceId ) const + { + TInt start = FindLRUIndex( aObject ); + + aObject = NULL; + + // now find the object without name + for ( TInt i = start; i < iCollection.Count(); i++ ) + { + const CXIMPObjectCollectionImp::CXIMPCollectionElement* element = iCollection[ i ]; + + if ( ! element->iName->Length() ) + { + // no name, ok + if ( aInterfaceId == element->iObject->Base().GetInterfaceId() ) + { + // got a match! + aObject = &(element->iObject->Base()); + return; + } + } + } + + return; + } + +// --------------------------------------------------------------------------- +// CXIMPObjectCollectionImp::LookupByTypeAndName() +// --------------------------------------------------------------------------- +// +void CXIMPObjectCollectionImp::LookupByTypeAndName( + const MXIMPBase*& aObject, + TInt32 aInterfaceId, + const TDesC8& aMatch ) const + { + TInt start = FindLRUIndex( aObject ); + + aObject = NULL; + + // now find the object with name + for ( TInt i = start; i < iCollection.Count(); i++ ) + { + const CXIMPObjectCollectionImp::CXIMPCollectionElement* element = iCollection[ i ]; + + if ( ( KErrNotFound != element->iName->MatchF( aMatch ) ) + && ( aInterfaceId == element->iObject->Base().GetInterfaceId() ) ) + { + // got a match with correct name and interface id + aObject = &(element->iObject->Base()); + return; + } + } + + return; + } + + +// --------------------------------------------------------------------------- +// CXIMPObjectCollectionImp::AddObjectL +// --------------------------------------------------------------------------- +// +void CXIMPObjectCollectionImp::AddObjectL( + MXIMPBase* aObject ) + { + AddObjectWithNameL( aObject, KNullDesC8 ); + } + +// --------------------------------------------------------------------------- +// CXIMPObjectCollectionImp::AddObjectWithNameL +// --------------------------------------------------------------------------- +// +void CXIMPObjectCollectionImp::AddObjectWithNameL( + MXIMPBase* aObject, + const TDesC8& aName ) + { + // NULL is not accepted + User::LeaveIfError( aObject == NULL ? KErrArgument : KErrNone ); + + // name must not contain wildcards + User::LeaveIfError( ValidateName( aName ) ); + + CXIMPApiObjBase* base = ( CXIMPApiObjBase* ) + aObject->GetInterface( XIMPIMP_CLSID_CXIMPAPIOBJBASE, EPanicIfUnknown ); + CXIMPObjectCollectionImp::CXIMPCollectionElement* element = + CXIMPObjectCollectionImp::CXIMPCollectionElement::NewL( base, aName ); + CleanupStack::PushL( element ); + iCollection.AppendL( element ); + CleanupStack::Pop( element ); + } + +// --------------------------------------------------------------------------- +// CXIMPObjectCollectionImp::GetByType +// --------------------------------------------------------------------------- +// +TBool CXIMPObjectCollectionImp::GetByType( + MXIMPBase*& aObject, + TInt32 aInterfaceId ) + { + aObject = NULL; + + // now find the object without name + for ( TInt i = 0; i < iCollection.Count(); i++ ) + { + CXIMPObjectCollectionImp::CXIMPCollectionElement* element = iCollection[ i ]; + + if ( ! element->iName->Length() ) + { + // no name, ok + if ( aInterfaceId == element->iObject->Base().GetInterfaceId() ) + { + // got a match! + CXIMPApiObjBase* object = element->GetObject(); + iCollection.Remove( i ); + delete element; + aObject = &(object->Base()); + return ETrue; + } + } + } + + return EFalse; + } + +// --------------------------------------------------------------------------- +// CXIMPObjectCollectionImp::GetByTypeAndName +// --------------------------------------------------------------------------- +// +TBool CXIMPObjectCollectionImp::GetByTypeAndName( + MXIMPBase*& aObject, + TInt32 aInterfaceId, + const TDesC8& aMatch ) + { + aObject = NULL; + + // now find the object with name + for ( TInt i = 0; i < iCollection.Count(); i++ ) + { + CXIMPObjectCollectionImp::CXIMPCollectionElement* element = iCollection[ i ]; + + if ( ( KErrNotFound != element->iName->MatchF( aMatch ) ) + && ( aInterfaceId == element->iObject->Base().GetInterfaceId() ) ) + { + // got a match with correct name and interface id + CXIMPApiObjBase* object = element->GetObject(); + iCollection.Remove( i ); + delete element; + aObject = &(object->Base()); + return ETrue; + } + } + + return EFalse; + } + +// --------------------------------------------------------------------------- +// CXIMPObjectCollectionImp::FindLRUIndex() +// --------------------------------------------------------------------------- +// +TInt CXIMPObjectCollectionImp::FindLRUIndex( const MXIMPBase*& aObject ) const + { + TInt start = 0; + + // naive lookup, least recently used (from beginning to the end). + // find starting position + if ( aObject != NULL ) + { + TBool found = EFalse; + for ( TInt i = 0; ( i < iCollection.Count()-1 ) && ( ! found ); i++ ) + { + const CXIMPObjectCollectionImp::CXIMPCollectionElement* element = iCollection[ i ]; + if ( aObject == &(element->iObject->Base()) ) + { + found = ETrue; + start = i; + } + } + } + + return start; + } + +// --------------------------------------------------------------------------- +// CXIMPObjectCollectionImp::ValidateName() +// --------------------------------------------------------------------------- +// +TInt CXIMPObjectCollectionImp::ValidateName( const TDesC8& aName ) const + { + const TUint8* pName = aName.Ptr(); + + TInt pNameLen = aName.Length(); + for( ; pNameLen; pName++, pNameLen-- ) + { + if( *pName > 0x7e || + *pName < 0x20 || + *pName == '*' || + *pName == '?' || + *pName == ':' ) + { + return KErrBadName; + } + } + + return KErrNone; + } + + + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcdatamodel/ximpobjectcollectionimp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcdatamodel/ximpobjectcollectionimp.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,176 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Object collection implementation. + * +*/ + +#ifndef XIMPOBJECTCOLLECTIONIMP_H +#define XIMPOBJECTCOLLECTIONIMP_H + +#include "ximpapiobjbase.h" +#include +#include + + +/** + * Object collection implementation. + * + * @see MXIMPObjectCollection + * @ingroup ximpdatamodelapi + * @since S60 v3.2 + */ +class CXIMPObjectCollectionImp : public CXIMPApiObjBase, + public MXIMPObjectCollection + { + +private: // helper class + + class CXIMPCollectionElement : public CBase + { + public: + + static CXIMPCollectionElement* NewL( CXIMPApiObjBase* aObject, const TDesC8& aName ); + ~CXIMPCollectionElement(); + + /** + * Get the stored object. Ownership transferred + * to the caller. + * @param The stored object + */ + CXIMPApiObjBase* GetObject(); + + private: + + CXIMPCollectionElement(); + void ConstructL( CXIMPApiObjBase* aObject, const TDesC8& aName ); + + public: + // owns: the object + CXIMPApiObjBase* iObject; + + // owns: the name (always valid, but can be empty) + HBufC8* iName; + }; + +public: + + /** The class ID. */ + enum { KClassId = XIMPIMP_CLSID_CXIMPOBJECTCOLLECTIONIMP }; + +public: + + IMPORT_C static CXIMPObjectCollectionImp* NewLC(); + IMPORT_C static CXIMPObjectCollectionImp* NewL(); + +public: + + /** + * Destruction + */ + ~CXIMPObjectCollectionImp(); + + +private: + + CXIMPObjectCollectionImp(); + + +public: // From MXIMPBase + + /** + * Implementation of MXIMPBase interface methods + * @see MXIMPBase + */ + XIMPIMP_DECLARE_IF_BASE_METHODS + +public: // from MXIMPObjectCollection + + // object lookup + + /** + * @see MXIMPObjectCollection + */ + void LookupByType( + const MXIMPBase*& aObject, + TInt32 aInterfaceId ) const; + + /** + * @see MXIMPObjectCollection + */ + void LookupByTypeAndName( + const MXIMPBase*& aObject, + TInt32 aInterfaceId, + const TDesC8& aMatch ) const; + + // set management + + /** + * @see MXIMPObjectCollection + */ + void AddObjectL( + MXIMPBase* aObject ); + + /** + * @see MXIMPObjectCollection + */ + void AddObjectWithNameL( + MXIMPBase* aObject, + const TDesC8& aName ); + + + /** + * @see MXIMPObjectCollection + */ + TBool GetByType( + MXIMPBase*& aObject, + TInt32 aInterfaceId ); + + /** + * @see MXIMPObjectCollection + */ + TBool GetByTypeAndName( + MXIMPBase*& aObject, + TInt32 aInterfaceId, + const TDesC8& aMatch ); + +private: // helpers + + /** + * Find the index of the least recently used + * object. Since the internal array is LIFO, + * we walk the array forwards to find the index of + * least recently used object. + * @param aObject The object from which to start + * @return The index + */ + TInt FindLRUIndex( const MXIMPBase*& aObject ) const; + + /** + * Validate a given name. Checks that wildcard characters do not exist. + * @return KErrNone if the name is OK, KErrBadName otherwise + */ + TInt ValidateName( const TDesC8& aName ) const; + +private: // data + + /** + * OWN: Objects + */ + RXIMPObjOwningPtrArray< CXIMPCollectionElement > iCollection; + + }; + + +#endif // XIMPOBJECTCOLLECTIONIMP_H + diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcdatamodel/ximpobjectfactoryimp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcdatamodel/ximpobjectfactoryimp.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,120 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of MPresenceManagement + * +*/ + +#include "ximpobjectfactoryimp.h" +#include "ximpstatusimp.h" +#include "ximprestrictedobjectcollectionimp.h" +#include "ximpobjectcollectionimp.h" +#include "ximpidentityimp.h" +#include "ximpdatasubscriptionstateimp.h" + + +// ============================ MEMBER FUNCTIONS ============================= + +// --------------------------------------------------------------------------- +// CXIMPObjectFactoryImp::NewL() +// --------------------------------------------------------------------------- +// +EXPORT_C CXIMPObjectFactoryImp* CXIMPObjectFactoryImp::NewL() + { + CXIMPObjectFactoryImp* self = new( ELeave ) CXIMPObjectFactoryImp; + return self; + } + +// --------------------------------------------------------------------------- +// Implement supported interface access. +// --------------------------------------------------------------------------- +// +XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CXIMPObjectFactoryImp, + MXIMPObjectFactory ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + + +XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CXIMPObjectFactoryImp, + MXIMPObjectFactory ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + +// --------------------------------------------------------------------------- +// CXIMPObjectFactoryImp::~CXIMPObjectFactoryImp() +// --------------------------------------------------------------------------- +// +CXIMPObjectFactoryImp::~CXIMPObjectFactoryImp() + { + #if _BullseyeCoverage + cov_write(); + #endif + } + + +// --------------------------------------------------------------------------- +// CXIMPObjectFactoryImp::CXIMPObjectFactoryImp() +// --------------------------------------------------------------------------- +// +CXIMPObjectFactoryImp::CXIMPObjectFactoryImp() + { + } + + +// --------------------------------------------------------------------------- +// CXIMPObjectFactoryImp::NewStatusLC() +// --------------------------------------------------------------------------- +// +MXIMPStatus* CXIMPObjectFactoryImp::NewStatusLC() + { + return CXIMPStatusImp::NewLC(); + } + + +// --------------------------------------------------------------------------- +// CXIMPObjectFactoryImp::NewIdentityLC() +// --------------------------------------------------------------------------- +// +MXIMPIdentity* CXIMPObjectFactoryImp::NewIdentityLC() + { + return CXIMPIdentityImp::NewLC(); + } + + +// --------------------------------------------------------------------------- +// CXIMPObjectFactoryImp::NewRestrictedObjectCollectionLC() +// --------------------------------------------------------------------------- +// +MXIMPRestrictedObjectCollection* CXIMPObjectFactoryImp::NewRestrictedObjectCollectionLC() + { + return CXIMPRestrictedObjectCollectionImp::NewLC(); + } + + +// --------------------------------------------------------------------------- +// CXIMPObjectFactoryImp::NewRestrictedObjectCollectionLC() +// --------------------------------------------------------------------------- +// +MXIMPObjectCollection* CXIMPObjectFactoryImp::NewObjectCollectionLC() + { + return CXIMPObjectCollectionImp::NewLC(); + } + +// --------------------------------------------------------------------------- +// CXIMPObjectFactoryImp::NewRestrictedObjectCollectionLC() +// --------------------------------------------------------------------------- +// +MXIMPDataSubscriptionState* CXIMPObjectFactoryImp::NewDataSubscriptionStateLC() + { + return CXIMPDataSubscriptionStateImp::NewLC(); + } + + diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcdatamodel/ximpobjectfactoryimp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcdatamodel/ximpobjectfactoryimp.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,72 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of MXIMPObjectFactory + * +*/ + +#ifndef CXIMPOBJECTFACTORYIMP_H +#define CXIMPOBJECTFACTORYIMP_H + +#include +#include "ximpapiobjbase.h" + + + + +/** + * MXIMPObjectFactory API object implementation. + * + * @lib ximpmanager.dll + * @since S60 v3.2 + */ +class CXIMPObjectFactoryImp: public CXIMPApiObjBase, + public MXIMPObjectFactory + { + public: + /** The class ID. */ + enum { KClassId = XIMPIMP_CLSID_CXIMPOBJECTFACTORYIMP }; + + +public: + + IMPORT_C static CXIMPObjectFactoryImp* NewL(); + ~CXIMPObjectFactoryImp(); + +private: + CXIMPObjectFactoryImp(); + + + +public: // From MXIMPBase + + /** + * Implementation of MXIMPBase interface methods + * @see MXIMPBase + */ + XIMPIMP_DECLARE_IF_BASE_METHODS + + +public: //From MXIMPObjectFactory + + + MXIMPStatus* NewStatusLC(); + MXIMPIdentity* NewIdentityLC(); + MXIMPRestrictedObjectCollection* NewRestrictedObjectCollectionLC(); + MXIMPObjectCollection* NewObjectCollectionLC(); + MXIMPDataSubscriptionState* NewDataSubscriptionStateLC(); + + }; + + +#endif // CXIMPOBJECTFACTORYIMP_H diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcdatamodel/ximpprotocolinfoimp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcdatamodel/ximpprotocolinfoimp.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,202 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MXIMPProtocolInfo API object implementation. +* +*/ + +#include "ximpprotocolinfoimp.h" +#include "ximpobjecthelpers.h" +#include "ximpfeatureinfoimp.h" +#include "ximprbufhelpers.h" + + + +// ============================ MEMBER FUNCTIONS ============================= + +// --------------------------------------------------------------------------- +// CXIMPProtocolInfoImp::NewLC() +// --------------------------------------------------------------------------- +// +EXPORT_C CXIMPProtocolInfoImp* CXIMPProtocolInfoImp::NewLC() + { + CXIMPProtocolInfoImp* self = new( ELeave ) CXIMPProtocolInfoImp; + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + + +// --------------------------------------------------------------------------- +// CXIMPProtocolInfoImp::NewLC() +// --------------------------------------------------------------------------- +// +EXPORT_C CXIMPProtocolInfoImp* CXIMPProtocolInfoImp::NewLC( + const TDesC16& aDisplayName, + TUid aImplementationUid, + const CXIMPFeatureInfoImp& aFeatures ) + { + CXIMPProtocolInfoImp* self = new( ELeave ) CXIMPProtocolInfoImp; + CleanupStack::PushL( self ); + self->ConstructL( aDisplayName, aImplementationUid, aFeatures ); + return self; + } + + +// --------------------------------------------------------------------------- +// CXIMPProtocolInfoImp::~CXIMPProtocolInfoImp() +// --------------------------------------------------------------------------- +// +CXIMPProtocolInfoImp::~CXIMPProtocolInfoImp() + { + iDisplayName.Close(); + delete iFeatures; + } + + +// --------------------------------------------------------------------------- +// CXIMPProtocolInfoImp::CXIMPProtocolInfoImp() +// --------------------------------------------------------------------------- +// +CXIMPProtocolInfoImp::CXIMPProtocolInfoImp() + { + } + + +// --------------------------------------------------------------------------- +// CXIMPProtocolInfoImp::ConstructL() +// --------------------------------------------------------------------------- +// +void CXIMPProtocolInfoImp::ConstructL( const TDesC16& aDisplayName, + TUid aImplementationUid, + const CXIMPFeatureInfoImp& aFeatures ) + { + iDisplayName.CreateL( aDisplayName ); + iImplementationUid = aImplementationUid; + iFeatures = TXIMPObjectCloner< CXIMPFeatureInfoImp >::CloneL( aFeatures ); + } + + +// --------------------------------------------------------------------------- +// CXIMPProtocolInfoImp::ConstructL() +// --------------------------------------------------------------------------- +// +void CXIMPProtocolInfoImp::ConstructL() + { + // Initialize the RBufs to zero size. Later on realloc as needed. + iDisplayName.CreateL( 0 ); + iFeatures = CXIMPFeatureInfoImp::NewL(); + } + +// --------------------------------------------------------------------------- +// CXIMPProtocolInfoImp::NewFromStreamLC() +// --------------------------------------------------------------------------- +// +XIMPIMP_IMPLEMENT_DATAOBJ_NEWFROMSTREAM( CXIMPProtocolInfoImp ) + + +// --------------------------------------------------------------------------- +// Implement supported interface access. +// --------------------------------------------------------------------------- +// +XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CXIMPProtocolInfoImp, + MXIMPProtocolInfo ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + + +XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CXIMPProtocolInfoImp, + MXIMPProtocolInfo ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + + + +// --------------------------------------------------------------------------- +// CXIMPProtocolInfoImp::DisplayName() +// --------------------------------------------------------------------------- +const TDesC16& CXIMPProtocolInfoImp::DisplayName() const + { + return iDisplayName; + } + + +// --------------------------------------------------------------------------- +// CXIMPProtocolInfoImp::ImplementationUid() +// --------------------------------------------------------------------------- +TUid CXIMPProtocolInfoImp::ImplementationUid() const + { + return iImplementationUid; + } + + +// --------------------------------------------------------------------------- +// CXIMPProtocolInfoImp::GetProtocolFeaturesLC() +// --------------------------------------------------------------------------- +MXIMPFeatureInfo* CXIMPProtocolInfoImp::GetProtocolFeaturesLC() const + { + return TXIMPObjectCloner< CXIMPFeatureInfoImp >::CloneLC( *iFeatures ); + } + + +// --------------------------------------------------------------------------- +// CXIMPProtocolInfoImp::ExternalizeL() +// --------------------------------------------------------------------------- +// +void CXIMPProtocolInfoImp::ExternalizeL( RWriteStream& aStream ) const + { + XIMPRBuf16Helper::ExternalizeL( iDisplayName, aStream ); + aStream.WriteInt32L( iImplementationUid.iUid ); + + iFeatures->ExternalizeL( aStream ); + } + + +// --------------------------------------------------------------------------- +// CXIMPProtocolInfoImp::InternalizeL() +// --------------------------------------------------------------------------- +// +EXPORT_C void CXIMPProtocolInfoImp::InternalizeL( RReadStream& aStream ) + { + XIMPRBuf16Helper::InternalizeL( iDisplayName, aStream ); + iImplementationUid.iUid = aStream.ReadInt32L(); + + iFeatures->InternalizeL( aStream ); + } + +// --------------------------------------------------------------------------- +// CXIMPProtocolInfoImp::EqualsContent +// --------------------------------------------------------------------------- +// +TBool CXIMPProtocolInfoImp::EqualsContent( + const CXIMPApiDataObjBase& aOtherInstance ) const + { + const CXIMPProtocolInfoImp* tmp = + TXIMPGetImpClassOrPanic< const CXIMPProtocolInfoImp >::From( + aOtherInstance.Base() ); + + + TBool same = ETrue; + TBool x; + x = 0 == iDisplayName.Compare( tmp->iDisplayName ); + same &= x; + + x = iImplementationUid == tmp->iImplementationUid; + same &= x; + + x = iFeatures->EqualsContent( *( tmp->iFeatures ) ); + same &= x; + + return same; + } + + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcdatamodel/ximpprotocolinfoimp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcdatamodel/ximpprotocolinfoimp.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,128 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MXIMPProtocolInfo API object implementation. +* +*/ + +#ifndef CXIMPPROTOCOLINFOIMP_H +#define CXIMPPROTOCOLINFOIMP_H + +#include "ximpapidataobjbase.h" +#include +#include + + +class MXIMPFeatureInfo; +class CXIMPFeatureInfoImp; + + +/** + * MXIMPProtocolInfo API object implementation. + * + * @lib ximpdatamodel.dll + * @since S60 v3.2 + */ +NONSHARABLE_CLASS( CXIMPProtocolInfoImp ): public CXIMPApiDataObjBase, + public MXIMPProtocolInfo + { +public: + /** The class ID. */ + enum { KClassId = XIMPIMP_CLSID_CXIMPPROTOCOLINFOIMP }; + +public: + + IMPORT_C static CXIMPProtocolInfoImp* NewLC(); + + IMPORT_C static CXIMPProtocolInfoImp* NewLC( + const TDesC16& aDisplayName, + TUid aImplementationUid, + const CXIMPFeatureInfoImp& aFeatures ); + + virtual ~CXIMPProtocolInfoImp(); + +private: + + CXIMPProtocolInfoImp(); + void ConstructL( const TDesC16& aDisplayName, + TUid aImplementationUid, + const CXIMPFeatureInfoImp& aFeatures ); + void ConstructL(); + + /** + * @see CXIMPApiDataObjBase + */ + XIMPIMP_DECLARE_DATAOBJ_BASE_PRIV_METHODS + +public: // From MXIMPBase + + /** + * Implementation of MXIMPBase interface methods + * @see MXIMPBase + */ + XIMPIMP_DECLARE_IF_BASE_METHODS + + /** + * @see CXIMPApiDataObjBase + */ + XIMPIMP_DECLARE_DATAOBJ_BASE_METHODS + +public: // From MXIMPProtocolInfo + + /** + * Implementation of MXIMPProtocolInfo interface methods + * @see MXIMPProtocolInfo + */ + const TDesC16& DisplayName() const; + TUid ImplementationUid() const; + MXIMPFeatureInfo* GetProtocolFeaturesLC() const; + + + +public: // New functions + + /** + * Internalizes object data from given stream. + * @param aStream Stream to read. + */ + IMPORT_C void InternalizeL( RReadStream& aStream ); + + +private: // data + + /** + * Protocol plug-in display name. + * Own. + */ + RBuf iDisplayName; + + + /** + * Protocol plug-in implementation uid. + * Own. + */ + TUid iImplementationUid; + + + /** + * Protocol plug-in feature info. + * Own. + */ + CXIMPFeatureInfoImp* iFeatures; + + }; + + +#endif // CXIMPPROTOCOLINFOIMP_H + + diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcdatamodel/ximprequestcompleteeventimp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcdatamodel/ximprequestcompleteeventimp.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,299 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MXIMPRequestCompleteEvent API object implementation. +* +*/ + + +#include + +#include "ximprequestcompleteeventimp.h" +#include "ximpstatusimp.h" +#include "ximpapidataobjfactory.h" +#include "ximpapidataobjbase.h" + + +// --------------------------------------------------------------------------- +// CXIMPRequestCompleteEventImp::NewL() +// --------------------------------------------------------------------------- +// +EXPORT_C CXIMPRequestCompleteEventImp* CXIMPRequestCompleteEventImp::NewL() + { + TXIMPRequestId nullId = TXIMPRequestId::Null(); + + CXIMPRequestCompleteEventImp* self = + new( ELeave ) CXIMPRequestCompleteEventImp( nullId ); + CleanupStack::PushL( self ); + self->ConstructL( KErrNone ); + CleanupStack::Pop( self ); + return self; + } + + + +// --------------------------------------------------------------------------- +// CXIMPRequestCompleteEventImp::NewLC() +// --------------------------------------------------------------------------- +// +EXPORT_C CXIMPRequestCompleteEventImp* CXIMPRequestCompleteEventImp::NewLC( + TXIMPRequestId& aRequestId, TInt aDefaultErrorValue ) + { + CXIMPRequestCompleteEventImp* self = + new( ELeave ) CXIMPRequestCompleteEventImp( aRequestId ); + CleanupStack::PushL( self ); + self->ConstructL( aDefaultErrorValue ); + return self; + } + + +// --------------------------------------------------------------------------- +// CXIMPRequestCompleteEventImp::NewLC() +// Instantiation method for event automation. +// --------------------------------------------------------------------------- +// +CXIMPApiEventBase* + CXIMPRequestCompleteEventImp::NewFromStreamLC( RReadStream& aStream ) + { + CXIMPRequestCompleteEventImp* self = new( ELeave ) CXIMPRequestCompleteEventImp; + CleanupStack::PushL( self ); + self->ConstructL( aStream ); + return self; + } + + +// --------------------------------------------------------------------------- +// CXIMPRequestCompleteEventImp::~CXIMPRequestCompleteEventImp() +// --------------------------------------------------------------------------- +// +CXIMPRequestCompleteEventImp::~CXIMPRequestCompleteEventImp() + { + delete iResult; + + // remove the owned objects + for ( TInt i = 0; i < iParamArray.Count(); i++ ) + { + SXIMPReqParam param = iParamArray[i]; + delete param.iParam; + param.iParam = NULL; + } + iParamArray.Close(); + } + + +// --------------------------------------------------------------------------- +// CXIMPRequestCompleteEventImp::CXIMPRequestCompleteEventImp() +// --------------------------------------------------------------------------- +// +CXIMPRequestCompleteEventImp::CXIMPRequestCompleteEventImp() + { + } + + +// --------------------------------------------------------------------------- +// CXIMPRequestCompleteEventImp::CXIMPRequestCompleteEventImp() +// --------------------------------------------------------------------------- +// +CXIMPRequestCompleteEventImp::CXIMPRequestCompleteEventImp( + TXIMPRequestId& aRequestId ) : + iReqId( aRequestId ) + { + } + + +// --------------------------------------------------------------------------- +// CXIMPRequestCompleteEventImp::ConstructL() +// --------------------------------------------------------------------------- +// +void CXIMPRequestCompleteEventImp::ConstructL( TInt aDefaultErrorValue ) + { + iResult = CXIMPStatusImp::NewL(); + iResult->SetResultCode( aDefaultErrorValue ); + } + + +// --------------------------------------------------------------------------- +// CXIMPRequestCompleteEventImp::ConstructL() +// --------------------------------------------------------------------------- +// +void CXIMPRequestCompleteEventImp::ConstructL( RReadStream& aStream ) + { + // normal params + TPckgBuf< TXIMPRequestId > bufReqId; + aStream.ReadL( bufReqId ); + iReqId = bufReqId(); + + iResult = CXIMPStatusImp::NewL(); + iResult->InternalizeL( aStream ); + + // the array with variable parameters + XIMPApiDataObjFactory::InternalizeL( aStream, iParamArray ); + } + +// --------------------------------------------------------------------------- +// Implement supported interface access. +// --------------------------------------------------------------------------- +// +XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CXIMPRequestCompleteEventImp, + MXIMPRequestCompleteEvent ) + XIMPIMP_IF_BASE_GET_CLASS( CXIMPApiEventBase, this ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + +XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CXIMPRequestCompleteEventImp, + MXIMPRequestCompleteEvent ) + XIMPIMP_IF_BASE_GET_CONST_CLASS( CXIMPApiEventBase, this ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + + +// --------------------------------------------------------------------------- +// Implement methods from base event interface and base event class +// --------------------------------------------------------------------------- +// +XIMPIMP_IMPLEMENT_EVENT_BASE_METHODS( CXIMPRequestCompleteEventImp, + MXIMPRequestCompleteEvent ) + +// --------------------------------------------------------------------------- +// CXIMPRequestCompleteEventImp::RequestId() +// --------------------------------------------------------------------------- +// +const TXIMPRequestId& CXIMPRequestCompleteEventImp::RequestId() const + { + return iReqId; + } + + +// --------------------------------------------------------------------------- +// CXIMPRequestCompleteEventImp::CompletionResult() +// --------------------------------------------------------------------------- +// +const MXIMPStatus& CXIMPRequestCompleteEventImp::CompletionResult() const + { + return *iResult; + } + + + +// --------------------------------------------------------------------------- +// CXIMPRequestCompleteEventImp::LookupCompletionDataByType() +// --------------------------------------------------------------------------- +// +const MXIMPBase* CXIMPRequestCompleteEventImp::LookupCompletionDataByType( + TInt32 aInterfaceId ) const + { + const TInt count = iParamArray.Count(); + for( TInt i = 0; i < count; i++ ) + { + if( iParamArray[ i ].iParamType == aInterfaceId ) + { + return &iParamArray[ i ].iParam->Base(); + } + } + + return NULL; + } + + + + +// --------------------------------------------------------------------------- +// CXIMPRequestCompleteEventImp::SetRequestId() +// --------------------------------------------------------------------------- +// +EXPORT_C void CXIMPRequestCompleteEventImp::SetRequestId( const TXIMPRequestId& aRequestId ) + { + iReqId = aRequestId; + } + +// --------------------------------------------------------------------------- +// CXIMPRequestCompleteEventImp::EqualsContent +// --------------------------------------------------------------------------- +// +TBool CXIMPRequestCompleteEventImp::EqualsContent( + const CXIMPApiEventBase& aOtherInstance ) const + { + const CXIMPRequestCompleteEventImp* tmp = + TXIMPGetImpClassOrPanic< const CXIMPRequestCompleteEventImp >::From( + aOtherInstance.Base() ); + + TBool same = ETrue; + + TBool x = ( iResult->ResultCode() == tmp->iResult->ResultCode() ); + same &= x; + + x = ( 0 == iResult->ProtocolResultDescription().Compare( + tmp->iResult->ProtocolResultDescription() ) ); + same &= x; + + // check parameter arrays for equality + TInt myCount = iParamArray.Count(); + TInt otherCount = tmp->iParamArray.Count(); + + x = myCount == otherCount; + same &= x; + + if ( x ) + { + // don't do potentially expensive operation unless arrays are + // have same number of elements + + for ( TInt i = 0; i < myCount; i++ ) + { + // assumes the parameters are IN ORDER + x = iParamArray[ i ].iParam->EqualsContent( *( tmp->iParamArray[ i ].iParam ) ); + same &= x; + } + } + + return same; + } + +// --------------------------------------------------------------------------- +// CXIMPRequestCompleteEventImp::ExternalizeL() +// --------------------------------------------------------------------------- +// +void CXIMPRequestCompleteEventImp::ExternalizeL( RWriteStream& aStream ) const + { + // normal params + TPckgBuf< TXIMPRequestId > bufReqId( iReqId ); + aStream.WriteL( bufReqId ); + + iResult->ExternalizeL( aStream ); + + // the array with variable parameters + XIMPApiDataObjFactory::ExternalizeL( aStream, iParamArray ); + } + +// --------------------------------------------------------------------------- +// CXIMPRequestCompleteEventImp::AppendParamL +// --------------------------------------------------------------------------- +// +EXPORT_C void CXIMPRequestCompleteEventImp::AppendParamL( CXIMPApiDataObjBase* aObj ) + { + SXIMPReqParam param; + param.iParamType = aObj->Base().GetInterfaceId(); + param.iParam = aObj; + iParamArray.AppendL( param ); + } + + +// --------------------------------------------------------------------------- +// CXIMPRequestCompleteEventImp::CompletionResultImp() +// --------------------------------------------------------------------------- +// +EXPORT_C CXIMPStatusImp& CXIMPRequestCompleteEventImp::CompletionResultImp() + { + return *iResult; + } + +// End of file + diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcdatamodel/ximprequestcompleteeventimp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcdatamodel/ximprequestcompleteeventimp.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,149 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MXIMPRequestCompleteEvent API object implementation. +* +*/ + +#ifndef CXIMPREQUESTCOMPLETEEVENTIMP_H +#define CXIMPREQUESTCOMPLETEEVENTIMP_H + +#include "ximpapieventbase.h" +#include "ximptypehelpers.h" +#include + +class RWriteStream; +class RReadStream; +class CXIMPStatusImp; +class MXIMPStatus; +class CXIMPApiDataObjBase; + + +/** + * MXIMPRequestCompleteEvent API object implementation. + * + * @lib ximpdatamodel.dll + * @since S60 v3.2 + */ +NONSHARABLE_CLASS( CXIMPRequestCompleteEventImp ): + public CXIMPApiEventBase, + public MXIMPRequestCompleteEvent + { + public: + /** The class ID. */ + enum { KClassId = XIMPIMP_CLSID_CXIMPREQUESTCOMPLETEEVENTIMP }; + +public: + + /** + * Exported instantiation method for initializing + * new event object. + */ + IMPORT_C static CXIMPRequestCompleteEventImp* NewL(); + IMPORT_C static CXIMPRequestCompleteEventImp* NewLC( + TXIMPRequestId& aRequestId, TInt aDefaultErrorValue = KErrNone ); + + + /** + * Instantiation method for event automation. + * Method signature must be exactly this to work + * with event delivery automation system. + * + * Event implementation must be registered to + * XIMPEventCodec KXIMPEventConstructorTable. + */ + static CXIMPApiEventBase* NewFromStreamLC( RReadStream& aStream ); + + + virtual ~CXIMPRequestCompleteEventImp(); + +private: + CXIMPRequestCompleteEventImp( TXIMPRequestId& aRequestId ); + CXIMPRequestCompleteEventImp(); + void ConstructL( TInt aDefaultErrorValue ); + void ConstructL( RReadStream& aStream ); + +public: // From MXIMPRequestCompleteEvent + + /** + * Implementation of MXIMPRequestCompleteEvent interface methods + * @see MXIMPRequestCompleteEvent + */ + const TXIMPRequestId& RequestId() const; + const MXIMPStatus& CompletionResult() const; + const MXIMPBase* LookupCompletionDataByType( TInt32 aInterfaceId ) const; + + +public: + + /** + * Set request id + * @param aRequestId New requestId. + */ + IMPORT_C void SetRequestId( const TXIMPRequestId& aRequestId ); + + /** + * Add data object as a parameter to this event. Ownership + * transferred. + * @param aObj The fully constructed data object to add + */ + IMPORT_C void AppendParamL( CXIMPApiDataObjBase* aObj ); + + + IMPORT_C CXIMPStatusImp& CompletionResultImp(); + +public: // From API base interfaces + + /** + * Implementation of MXIMPBase interface methods + * @see MXIMPBase + */ + XIMPIMP_DECLARE_IF_BASE_METHODS + + + /** + * Implementation of MXIMPEventBase interface and + * CXIMPApiEventBase methods + * + * @see MXIMPEventBase + * @see CXIMPApiEventBase + */ + XIMPIMP_DECLARE_EVENT_BASE_METHODS + +private: // data + + /** + * Completed request. + * Own. + */ + TXIMPRequestId iReqId; + + + /** + * Request result. + * This is set to KErrNoMemory for default value. + * Reason for that is error handling in low memory situation + * CXIMPEventCapsule will send KErrNoMemory version of event if + * event cannot be updated because of low memory. + * Own. + */ + CXIMPStatusImp* iResult; + + /** + * Array of params + */ + RPrReqParamArray iParamArray; + }; + + +#endif // CXIMPREQUESTCOMPLETEEVENTIMP_H diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcdatamodel/ximprestrictedobjectcollectionimp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcdatamodel/ximprestrictedobjectcollectionimp.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,201 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MXIMPRestrictedObjectCollection implementation +* +*/ + +#include "ximprestrictedobjectcollectionimp.h" + +// ============================ MEMBER FUNCTIONS ============================= + + +// --------------------------------------------------------------------------- +// CXIMPRestrictedObjectCollectionImp::NewL() +// --------------------------------------------------------------------------- +// +EXPORT_C CXIMPRestrictedObjectCollectionImp* + CXIMPRestrictedObjectCollectionImp::NewL( TBool aObjectOwning /*= ETrue*/ ) + { + CXIMPRestrictedObjectCollectionImp* self = NewLC( aObjectOwning ); + CleanupStack::Pop( self ); + return self; + } + + +// --------------------------------------------------------------------------- +// CXIMPRestrictedObjectCollectionImp::NewLC() +// --------------------------------------------------------------------------- +// +EXPORT_C CXIMPRestrictedObjectCollectionImp* + CXIMPRestrictedObjectCollectionImp::NewLC( TBool aObjectOwning /*= ETrue*/ ) + { + CXIMPRestrictedObjectCollectionImp* self = + new (ELeave) CXIMPRestrictedObjectCollectionImp( aObjectOwning ); + + CleanupStack::PushL( self ); + return self; + } + + +// --------------------------------------------------------------------------- +// CXIMPRestrictedObjectCollectionImp::~CXIMPRestrictedObjectCollectionImp() +// --------------------------------------------------------------------------- +// +CXIMPRestrictedObjectCollectionImp::~CXIMPRestrictedObjectCollectionImp() + { + if( iOwnObjects ) + { + iApiObjects.ResetAndDestroy(); + } + else + { + iApiObjects.Reset(); + } + } + + +// --------------------------------------------------------------------------- +// CXIMPRestrictedObjectCollectionImp::CXIMPRestrictedObjectCollectionImp() +// --------------------------------------------------------------------------- +// +CXIMPRestrictedObjectCollectionImp::CXIMPRestrictedObjectCollectionImp( TBool aObjectOwning ) +: iOwnObjects( aObjectOwning ) + { + } + + +// --------------------------------------------------------------------------- +// Implement supported interface access. +// --------------------------------------------------------------------------- +// +XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CXIMPRestrictedObjectCollectionImp, + MXIMPRestrictedObjectCollection ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + + +XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CXIMPRestrictedObjectCollectionImp, + MXIMPRestrictedObjectCollection ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + + + +// --------------------------------------------------------------------------- +// CXIMPRestrictedObjectCollectionImp::LookupByType() +// --------------------------------------------------------------------------- +// +void CXIMPRestrictedObjectCollectionImp::LookupByType( + const MXIMPBase*& aObject, + TInt32 aInterfaceId ) const + { + aObject = NULL; + + TInt index = iApiObjects.FindInOrder( aInterfaceId, + OrderIfIdAndApiObject ); + if( index != KErrNotFound ) + { + const CXIMPApiObjBase* theObject = iApiObjects[ index ]; + aObject = &theObject->Base(); + } + } + + + +// --------------------------------------------------------------------------- +// CXIMPRestrictedObjectCollectionImp::AddOrReplaceTypeL() +// --------------------------------------------------------------------------- +// +void CXIMPRestrictedObjectCollectionImp::AddOrReplaceTypeL( + MXIMPBase* aObject ) + { + CXIMPApiObjBase* theObject = TXIMPGetImpClassOrPanic< CXIMPApiObjBase >::From( *aObject ); + + + TInt index = KErrNotFound; + TInt entryExists = iApiObjects.FindInOrder( theObject, + index, + OrderApiObjects ); + + if( entryExists == KErrNotFound ) + { + iApiObjects.InsertL( theObject, index ); + } + else + { + CXIMPApiObjBase* oldObject = iApiObjects[ index ]; + if( iOwnObjects ) + { + delete oldObject; + } + iApiObjects[ index ] = theObject; + } + } + + + +// --------------------------------------------------------------------------- +// CXIMPRestrictedObjectCollectionImp::GetByType() +// --------------------------------------------------------------------------- +// +void CXIMPRestrictedObjectCollectionImp::GetByType( + MXIMPBase*& aObject, + TInt32 aInterfaceId ) + { + aObject = NULL; + + TInt index = iApiObjects.FindInOrder( aInterfaceId, + OrderIfIdAndApiObject ); + if( index != KErrNotFound ) + { + CXIMPApiObjBase* theObject = iApiObjects[ index ]; + aObject = &theObject->Base(); + iApiObjects.Remove( index ); + } + } + + + +// --------------------------------------------------------------------------- +// CXIMPRestrictedObjectCollectionImp::OrderIfIdAndApiObject() +// --------------------------------------------------------------------------- +// +TInt CXIMPRestrictedObjectCollectionImp::OrderIfIdAndApiObject( + const TInt32* aIfId, + const CXIMPApiObjBase& aRhs ) + { + return (*aIfId) - aRhs.Base().GetInterfaceId(); + } + + +// --------------------------------------------------------------------------- +// CXIMPRestrictedObjectCollectionImp::OrderApiObjects() +// --------------------------------------------------------------------------- +// +TInt CXIMPRestrictedObjectCollectionImp::OrderApiObjects( + const CXIMPApiObjBase& aLhs, + const CXIMPApiObjBase& aRhs ) + { + const TInt32 interfaceId = aLhs.Base().GetInterfaceId(); + return OrderIfIdAndApiObject( &interfaceId, aRhs ); + } + + +// --------------------------------------------------------------------------- +// CXIMPRestrictedObjectCollectionImp::SetObjectOwnership() +// --------------------------------------------------------------------------- +// +EXPORT_C void CXIMPRestrictedObjectCollectionImp::SetObjectOwnership( TBool aObjectOwning /*= ETrue*/ ) + { + iOwnObjects = aObjectOwning; + } +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcdatamodel/ximprestrictedobjectcollectionimp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcdatamodel/ximprestrictedobjectcollectionimp.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,129 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MXIMPRestrictedObjectCollection implementation +* +*/ + +#ifndef CXIMPRESTRICTEDOBJECTCOLLECTIONIMP_H +#define CXIMPRESTRICTEDOBJECTCOLLECTIONIMP_H + +#include +#include +#include "ximpapiobjbase.h" + + +/** + * + * @since S60 v3.2 + */ +class CXIMPRestrictedObjectCollectionImp : public CXIMPApiObjBase, + public MXIMPRestrictedObjectCollection + { +public: + + /** The class ID. */ + enum { KClassId = XIMPIMP_CLSID_CXIMPRESTRICTEDOBJECTCOLLECTIONIMP }; + +public: + + /* + * Construction of instance + * @param aObjectOwning. ETrue objects are owned by instance. + * EFalse objects are not owned by instance. + * Default = ETrue + */ + IMPORT_C static CXIMPRestrictedObjectCollectionImp* NewLC( TBool aObjectOwning = ETrue ); + + /* + * Construction of instance + * @param aObjectOwning. ETrue objects are owned by instance. + * EFalse objects are not owned by instance. + * Default = ETrue + */ + IMPORT_C static CXIMPRestrictedObjectCollectionImp* NewL( TBool aObjectOwning = ETrue ); + + +public: + + /** + * Destruction + */ + ~CXIMPRestrictedObjectCollectionImp(); + + +private: + + /** + * Construction + * @param aObjectOwning. ETrue objects are owned by instance. + * EFalse objects are not owned by instance. + */ + CXIMPRestrictedObjectCollectionImp( TBool aObjectOwning ); + + +public: // From MXIMPBase + + /** + * Implementation of MXIMPBase interface methods + * @see MXIMPBase + */ + XIMPIMP_DECLARE_IF_BASE_METHODS + +public: // From MXIMPRestrictedObjectCollection + + void LookupByType( const MXIMPBase*& aObject, TInt32 aInterfaceId ) const; + void AddOrReplaceTypeL( MXIMPBase* aObject ); + void GetByType( MXIMPBase*& aObject, TInt32 aInterfaceId ); + + + +public: // New methods + + /** + * Set object ownership + * @param aObjectOwning. ETrue objects are owned by instance. + * EFalse objects are not owned by instance. + * Default = ETrue + */ + IMPORT_C void SetObjectOwnership( TBool aObjectOwning = ETrue ); + +private: // Helpers + static TInt OrderIfIdAndApiObject( const TInt32* aIfId, + const CXIMPApiObjBase& aRhs ); + + static TInt OrderApiObjects( const CXIMPApiObjBase& aLhs, + const CXIMPApiObjBase& aRhs ); + + + +private: // data + + /** + * Owning of objects. ETrue, Owns, EFalse does not own. + */ + TBool iOwnObjects; + + /** + * OWN: Check iOwnObjects + */ + RXIMPObjOwningPtrArray< CXIMPApiObjBase > iApiObjects; + + }; + + +#endif // CXIMPRESTRICTEDOBJECTCOLLECTIONIMP_H + + + + diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcdatamodel/ximpserviceinfoimp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcdatamodel/ximpserviceinfoimp.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,253 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MXIMPServiceInfo API object implementation. +* +*/ + +#include "ximpserviceinfoimp.h" +#include "ximprbufhelpers.h" + + + +// ============================ MEMBER FUNCTIONS ============================= + + +// --------------------------------------------------------------------------- +// CXIMPServiceInfoImp::NewLC() +// --------------------------------------------------------------------------- +// +EXPORT_C CXIMPServiceInfoImp* CXIMPServiceInfoImp::NewLC() + { + CXIMPServiceInfoImp* self = new( ELeave ) CXIMPServiceInfoImp; + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + + +// --------------------------------------------------------------------------- +// CXIMPServiceInfoImp::NewL() +// --------------------------------------------------------------------------- +// +EXPORT_C CXIMPServiceInfoImp* CXIMPServiceInfoImp::NewL() + { + CXIMPServiceInfoImp* self = NewLC(); + CleanupStack::Pop( self ); + return self; + } + + + +// --------------------------------------------------------------------------- +// CXIMPServiceInfoImp::NewLC() +// --------------------------------------------------------------------------- +// +EXPORT_C CXIMPServiceInfoImp* CXIMPServiceInfoImp::NewLC( + TUid aProtocolImplUid, + const TDesC16& aServiceAddress, + const TDesC16& aUsername, + const TDesC16& aPassword, + TInt32 aIapId ) + { + CXIMPServiceInfoImp* self = new( ELeave ) CXIMPServiceInfoImp(); + CleanupStack::PushL( self ); + self->ConstructL( aProtocolImplUid, aServiceAddress, aUsername, aPassword, aIapId ); + return self; + } + +// --------------------------------------------------------------------------- +// CXIMPServiceInfoImp::~CXIMPServiceInfoImp() +// --------------------------------------------------------------------------- +// +CXIMPServiceInfoImp::~CXIMPServiceInfoImp() + { + iAddress.Close(); + iUserId.Close(); + iPassword.Close(); + } + + +// --------------------------------------------------------------------------- +// CXIMPServiceInfoImp::CXIMPServiceInfoImp() +// --------------------------------------------------------------------------- +// +CXIMPServiceInfoImp::CXIMPServiceInfoImp() + { + } + + +// --------------------------------------------------------------------------- +// CXIMPServiceInfoImp::ConstructL() +// --------------------------------------------------------------------------- +// +void CXIMPServiceInfoImp::ConstructL( TUid aProtocolImplUid, + const TDesC16& aServiceAddress, + const TDesC16& aUsername, + const TDesC16& aPassword, + TInt32 aIapId ) + { + iProtocolUid = aProtocolImplUid; + iIapId = aIapId; + iAddress.CreateL( aServiceAddress ); + iUserId.CreateL( aUsername ); + iPassword.CreateL( aPassword ); + } + + +// --------------------------------------------------------------------------- +// CXIMPServiceInfoImp::ConstructL() +// --------------------------------------------------------------------------- +// +void CXIMPServiceInfoImp::ConstructL() + { + // Initialize RBufs to zero length, realloc later when needed + iAddress.CreateL( 0 ); + iUserId.CreateL( 0 ); + iPassword.CreateL( 0 ); + } + +// --------------------------------------------------------------------------- +// CXIMPServiceInfoImp::NewFromStreamLC() +// --------------------------------------------------------------------------- +// +XIMPIMP_IMPLEMENT_DATAOBJ_NEWFROMSTREAM( CXIMPServiceInfoImp ) + + +// --------------------------------------------------------------------------- +// Implement supported interface access. +// --------------------------------------------------------------------------- +// +XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CXIMPServiceInfoImp, + MXIMPServiceInfo ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + + +XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CXIMPServiceInfoImp, + MXIMPServiceInfo ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + + +// --------------------------------------------------------------------------- +// From class MXIMPServiceInfo. +// CXIMPServiceInfoImp::Address() +// --------------------------------------------------------------------------- +// +const TDesC16& CXIMPServiceInfoImp::ServiceAddress() const + { + return iAddress; + } + + +// --------------------------------------------------------------------------- +// From class MXIMPServiceInfo. +// CXIMPServiceInfoImp::UserId() +// --------------------------------------------------------------------------- +// +const TDesC16& CXIMPServiceInfoImp::UserId() const + { + return iUserId; + } + + +// --------------------------------------------------------------------------- +// From class MXIMPServiceInfo. +// CXIMPServiceInfoImp::Password() +// --------------------------------------------------------------------------- +// +const TDesC16& CXIMPServiceInfoImp::Password() const + { + return iPassword; + } + + +// --------------------------------------------------------------------------- +// From class MXIMPServiceInfo. +// CXIMPServiceInfoImp::IapId() +// --------------------------------------------------------------------------- +// +TInt32 CXIMPServiceInfoImp::IapId() const + { + return iIapId; + } + + +// --------------------------------------------------------------------------- +// From class MXIMPServiceInfo. +// CXIMPServiceInfoImp::ProtocolImplUid() +// --------------------------------------------------------------------------- +// +TUid CXIMPServiceInfoImp::ProtocolImplUid() const + { + return iProtocolUid; + } + + +// --------------------------------------------------------------------------- +// CXIMPServiceInfoImp::ExternalizeL() +// --------------------------------------------------------------------------- +// +void CXIMPServiceInfoImp::ExternalizeL( RWriteStream& aStream ) const + { + XIMPRBuf16Helper::ExternalizeL( iAddress, aStream ); + XIMPRBuf16Helper::ExternalizeL( iUserId, aStream ); + XIMPRBuf16Helper::ExternalizeL( iPassword, aStream ); + + aStream.WriteInt32L( iProtocolUid.iUid ); + aStream.WriteInt32L( iIapId ); + } + + +// --------------------------------------------------------------------------- +// CXIMPServiceInfoImp::InternalizeL() +// --------------------------------------------------------------------------- +// +EXPORT_C void CXIMPServiceInfoImp::InternalizeL( RReadStream& aStream ) + { + XIMPRBuf16Helper::InternalizeL( iAddress, aStream ); + XIMPRBuf16Helper::InternalizeL( iUserId, aStream ); + XIMPRBuf16Helper::InternalizeL( iPassword, aStream ); + + iProtocolUid.iUid = aStream.ReadInt32L(); + iIapId = aStream.ReadInt32L(); + } + +// --------------------------------------------------------------------------- +// CXIMPServiceInfoImp::EqualsContent() +// --------------------------------------------------------------------------- +// +TBool CXIMPServiceInfoImp::EqualsContent( + const CXIMPApiDataObjBase& aOtherInstance ) const + { + const CXIMPServiceInfoImp* tmp = + TXIMPGetImpClassOrPanic< const CXIMPServiceInfoImp >::From( aOtherInstance.Base() ); + + + TBool same = ETrue; + TBool x = EFalse; + + if( ServiceAddress().Compare( tmp->ServiceAddress() ) == 0 && + UserId().Compare( tmp->UserId() ) == 0 && + Password().Compare( tmp->Password() ) == 0 && + ProtocolImplUid() == tmp->ProtocolImplUid() ) + { + x = ETrue; + } + + same &= x; + + return same; + } + + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcdatamodel/ximpserviceinfoimp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcdatamodel/ximpserviceinfoimp.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,134 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MXIMPServiceInfo API object implementation. +* +*/ + +#ifndef CXIMPSERVICEINFOIMP_H +#define CXIMPSERVICEINFOIMP_H + + +#include "ximpapidataobjbase.h" +#include +#include + +/** + * MXIMPServiceInfo API object implementation. + * + * @lib ximpdatamodel.dll + * @since S60 v3.2 + */ +NONSHARABLE_CLASS( CXIMPServiceInfoImp ): public CXIMPApiDataObjBase, + public MXIMPServiceInfo + { +public: + /** The class ID. */ + enum { KClassId = XIMPIMP_CLSID_CXIMPSERVICEINFOIMP }; + + +public: + + IMPORT_C static CXIMPServiceInfoImp* NewLC(); + IMPORT_C static CXIMPServiceInfoImp* NewL(); + IMPORT_C static CXIMPServiceInfoImp* NewLC( TUid aProtocolImplUid, + const TDesC16& aServiceAddress, + const TDesC16& aUsername, + const TDesC16& aPassword, + TInt32 aIapId ); + virtual ~CXIMPServiceInfoImp(); + +private: + + CXIMPServiceInfoImp(); + void ConstructL(); + void ConstructL( TUid aProtocolImplUid, + const TDesC16& aServiceAddress, + const TDesC16& aUsername, + const TDesC16& aPassword, + TInt32 aIapId ); + + /** + * @see CXIMPApiDataObjBase + */ + XIMPIMP_DECLARE_DATAOBJ_BASE_PRIV_METHODS + +public: // From MXIMPBase + + /** + * Implementation of MXIMPBase interface methods + * @see MXIMPBase + */ + XIMPIMP_DECLARE_IF_BASE_METHODS + + /** + * @see CXIMPApiDataObjBase + */ + XIMPIMP_DECLARE_DATAOBJ_BASE_METHODS + +public: // From MXIMPServiceInfo + + /** + * Implementation of MXIMPServiceInfo interface methods + * @see MXIMPServiceInfo + */ + const TDesC16& ServiceAddress() const; + const TDesC16& UserId() const; + const TDesC16& Password() const; + TInt32 IapId() const; + TUid ProtocolImplUid() const; + + +public: // New functions + + + /** + * Internalizes object data from given stream. + * @param aStream Stream to read. + */ + IMPORT_C void InternalizeL( RReadStream& aStream ); + +private: // data + + /** + * Service address + * Own. + */ + RBuf iAddress; + + /** + * User ID + * Own. + */ + RBuf iUserId; + + /** + * Password + * Own. + */ + RBuf iPassword; + + /** + * Protocol Uid + */ + TUid iProtocolUid; + + /** + * IAP id + */ + TInt32 iIapId; + + }; + + +#endif // CXIMPSERVICEINFOIMP_H diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcdatamodel/ximpstatusimp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcdatamodel/ximpstatusimp.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,208 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MXIMPStatus API object implementation. +* +*/ + +#include "ximpstatusimp.h" +#include "ximpobjecthelpers.h" +#include "ximpfeatureinfoimp.h" +#include "ximprbufhelpers.h" + + + +// ============================ MEMBER FUNCTIONS ============================= + +// --------------------------------------------------------------------------- +// CXIMPStatusImp::NewLC() +// --------------------------------------------------------------------------- +// +EXPORT_C CXIMPStatusImp* CXIMPStatusImp::NewLC() + { + CXIMPStatusImp* self = new( ELeave ) CXIMPStatusImp; + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + + +// --------------------------------------------------------------------------- +// CXIMPStatusImp::NewL() +// --------------------------------------------------------------------------- +// +EXPORT_C CXIMPStatusImp* CXIMPStatusImp::NewL() + { + CXIMPStatusImp* self = CXIMPStatusImp::NewLC(); + CleanupStack::Pop( self ); + return self; + } + + + +// --------------------------------------------------------------------------- +// CXIMPStatusImp::~CXIMPStatusImp() +// --------------------------------------------------------------------------- +// +CXIMPStatusImp::~CXIMPStatusImp() + { + iProtocolResultDescription.Close(); + } + + +// --------------------------------------------------------------------------- +// CXIMPStatusImp::CXIMPStatusImp() +// --------------------------------------------------------------------------- +// +CXIMPStatusImp::CXIMPStatusImp() + { + } + + +// --------------------------------------------------------------------------- +// CXIMPStatusImp::ConstructL() +// --------------------------------------------------------------------------- +// +void CXIMPStatusImp::ConstructL() + { + // Initialize the RBufs to zero size. Later on realloc as needed. + iProtocolResultDescription.CreateL( 0 ); + iResultCode = KErrNone; + iProtocolResultCode = KErrNone; + } + +// --------------------------------------------------------------------------- +// CXIMPStatusImp::NewFromStreamLC() +// --------------------------------------------------------------------------- +// +XIMPIMP_IMPLEMENT_DATAOBJ_NEWFROMSTREAM( CXIMPStatusImp ) + + +// --------------------------------------------------------------------------- +// Implement supported interface access. +// --------------------------------------------------------------------------- +// +XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CXIMPStatusImp, + MXIMPStatus ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + + +XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CXIMPStatusImp, + MXIMPStatus ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + + + +// --------------------------------------------------------------------------- +// CXIMPStatusImp::ResultCode() +// --------------------------------------------------------------------------- +TInt CXIMPStatusImp::ResultCode() const + { + return iResultCode; + } + + +// --------------------------------------------------------------------------- +// CXIMPStatusImp::ProtocolResultCode() +// --------------------------------------------------------------------------- +TInt CXIMPStatusImp::ProtocolResultCode() const + { + return iProtocolResultCode; + } + +// --------------------------------------------------------------------------- +// CXIMPStatusImp::ProtocolResultDescription() +// --------------------------------------------------------------------------- +const TDesC16& CXIMPStatusImp::ProtocolResultDescription() const + { + return iProtocolResultDescription; + } + + +// --------------------------------------------------------------------------- +// CXIMPStatusImp::SetResultCode() +// --------------------------------------------------------------------------- +void CXIMPStatusImp::SetResultCode( TInt aCode ) + { + iResultCode = aCode; + } + + +// --------------------------------------------------------------------------- +// CXIMPStatusImp::SetProtocolResultCode() +// --------------------------------------------------------------------------- +void CXIMPStatusImp::SetProtocolResultCode( TInt aCode ) + { + iProtocolResultCode = aCode; + } + + +// --------------------------------------------------------------------------- +// CXIMPStatusImp::SetProtocolResultDescriptionL() +// --------------------------------------------------------------------------- +void CXIMPStatusImp::SetProtocolResultDescriptionL( + const TDesC16& aDescription ) + { + XIMPRBuf16Helper::SetNewValueL( iProtocolResultDescription, aDescription ); + } + + +// --------------------------------------------------------------------------- +// CXIMPStatusImp::ExternalizeL() +// --------------------------------------------------------------------------- +// +void CXIMPStatusImp::ExternalizeL( RWriteStream& aStream ) const + { + aStream.WriteInt32L( iResultCode ); + aStream.WriteInt32L( iProtocolResultCode ); + XIMPRBuf16Helper::ExternalizeL( iProtocolResultDescription, aStream ); + } + + +// --------------------------------------------------------------------------- +// CXIMPStatusImp::InternalizeL() +// --------------------------------------------------------------------------- +// +EXPORT_C void CXIMPStatusImp::InternalizeL( RReadStream& aStream ) + { + iResultCode = aStream.ReadInt32L(); + iProtocolResultCode = aStream.ReadInt32L(); + XIMPRBuf16Helper::InternalizeL( iProtocolResultDescription, aStream ); + } + +// --------------------------------------------------------------------------- +// CXIMPStatusImp::EqualsContent() +// --------------------------------------------------------------------------- +// +TBool CXIMPStatusImp::EqualsContent( + const CXIMPApiDataObjBase& aOtherInstance ) const + { + const CXIMPStatusImp* tmp = + TXIMPGetImpClassOrPanic< const CXIMPStatusImp >::From( aOtherInstance.Base() ); + + TBool same = ETrue; + TBool x; + x = iResultCode == tmp->iResultCode; + same &= x; + + x = iProtocolResultCode == tmp->iProtocolResultCode; + same &= x; + + x = 0 == iProtocolResultDescription.Compare( tmp->iProtocolResultDescription ); + same &= x; + + return same; + } + + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcdatamodel/ximpstatusimp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcdatamodel/ximpstatusimp.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,122 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MXIMPStatus API object implementation. +* +*/ + +#ifndef CXIMPSTATUSIMP_H +#define CXIMPSTATUSIMP_H + +#include "ximpapidataobjbase.h" +#include +#include + + +/** + * MXIMPStatus API object implementation. + * + * @lib ximpdatamodel.dll + * @since S60 v3.2 + */ +NONSHARABLE_CLASS( CXIMPStatusImp ): public CXIMPApiDataObjBase, + public MXIMPStatus + { +public: + /** The class ID. */ + enum { KClassId = XIMPIMP_CLSID_CXIMPSTATUSIMP }; + +public: + + IMPORT_C static CXIMPStatusImp* NewLC(); + IMPORT_C static CXIMPStatusImp* NewL(); + virtual ~CXIMPStatusImp(); + + +private: + + CXIMPStatusImp(); + void ConstructL(); + + /** + * @see CXIMPApiDataObjBase + */ + XIMPIMP_DECLARE_DATAOBJ_BASE_PRIV_METHODS + +public: // From MXIMPBase + + /** + * Implementation of MXIMPBase interface methods + * @see MXIMPBase + */ + XIMPIMP_DECLARE_IF_BASE_METHODS + + /** + * @see CXIMPApiDataObjBase + */ + XIMPIMP_DECLARE_DATAOBJ_BASE_METHODS + +public: // From MXIMPStatus + + /** + * Implementation of MXIMPStatus interface methods + * @see MXIMPStatus + */ + TInt ResultCode() const; + TInt ProtocolResultCode() const; + const TDesC16& ProtocolResultDescription() const; + + void SetResultCode( TInt aCode ); + void SetProtocolResultCode( TInt aCode ); + void SetProtocolResultDescriptionL( const TDesC16& aDescription ); + + + + +public: // New functions + + /** + * Internalizes object data from given stream. + * @param aStream Stream to read. + */ + IMPORT_C void InternalizeL( RReadStream& aStream ); + +private: // data + + + /** + * Result code. + * Own. + */ + TInt iResultCode; + + + /** + * Protocol result code. + * Own. + */ + TInt iProtocolResultCode; + + + /** + * Protocol description. + * Own. + */ + RBuf iProtocolResultDescription; + + }; + + +#endif // CXIMPSTATUSIMP_H + + diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcdatamodel/ximpsubscriptionitembase.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcdatamodel/ximpsubscriptionitembase.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,574 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Presence Service Connection subscription item base implementation. +* +*/ + + +#include "ximpsubscriptionitembase.h" +#include "ximpitemparent.h" +#include "ximppanics.h" +#include "ximppsccontext.h" +#include "ximpdatasubscriptionstateimp.h" +#include "ximpobjecthelpers.h" + +#include "ximptrace.h" + +const TInt KXIMPContentAutoExpiryTime = 15; // Seconds + + +// --------------------------------------------------------------------------- +// CXIMPSubscriptionItemBase::OrderOfContexts() +// --------------------------------------------------------------------------- +// +TInt CXIMPSubscriptionItemBase::OrderOfContexts( const MXIMPPscContext& aFirst, + const MXIMPPscContext& aSecond ) + { + if( &aFirst < &aSecond ) + { + return -1; + } + else if( &aFirst == &aSecond ) + { + return 0; + } + else + { + return 1; + } + } + +// --------------------------------------------------------------------------- +// CXIMPSubscriptionItemBase::OrderOfContexts() +// --------------------------------------------------------------------------- +// +TInt CXIMPSubscriptionItemBase::OrderOfItems( const CXIMPSubscriptionItemBase& aFirst, + const CXIMPSubscriptionItemBase& aSecond ) + { + if( &aFirst < &aSecond ) + { + return -1; + } + else if( &aFirst == &aSecond ) + { + return 0; + } + else + { + return 1; + } + } + + +// --------------------------------------------------------------------------- +// CXIMPSubscriptionItemBase::CXIMPSubscriptionItemBase() +// --------------------------------------------------------------------------- +// +EXPORT_C CXIMPSubscriptionItemBase::CXIMPSubscriptionItemBase( MXIMPItemParentBase& aParent ) +: iParent( aParent ) + { + } + +// --------------------------------------------------------------------------- +// CXIMPSubscriptionItemBase::BaseConstructL() +// --------------------------------------------------------------------------- +// +EXPORT_C void CXIMPSubscriptionItemBase::BaseConstructL() + { + CXIMPDataSubscriptionStateImp* datasubscription = NULL; + SetDataSubscriptionStateL(*datasubscription); + iSubscriptionState = CXIMPDataSubscriptionStateImp::NewL(); + } + +// --------------------------------------------------------------------------- +// CXIMPSubscriptionItemBase::~CXIMPSubscriptionItemBase() +// --------------------------------------------------------------------------- +// +EXPORT_C CXIMPSubscriptionItemBase::~CXIMPSubscriptionItemBase() + { + __ASSERT_ALWAYS( !CountOfSubscribers(), + User::Panic( NXIMPPrivPanic::KCategory, NXIMPPrivPanic::EArrayCountNotValid ) ); + iContexts.Close(); + iPreContexts.Close(); + iItems.Close(); + iPreItems.Close(); + delete iSubscriptionState; + } + +// --------------------------------------------------------------------------- +// CXIMPSubscriptionItemBase::SubscriptionStatus() +// --------------------------------------------------------------------------- +// +EXPORT_C CXIMPSubscriptionItemBase::TSubscriptionStatus + CXIMPSubscriptionItemBase::SubscriptionStatus( MXIMPPscContext* aContext ) + { + // Calculate situation + TInt count = iContexts.Count() + iItems.Count(); + TBool contextFound = IsContext( aContext ); + if( count == 0 ) + { + return ENotSubscribedAtAll; + } + else if( contextFound ) + { + if( count == 1 ) + { + return ESubscribedForCtxOnly; + } + return ESubscribedForCtxAndOthers; + } + return ESubscribedForOtherCtxOnly; + } + +// --------------------------------------------------------------------------- +// CXIMPSubscriptionItemBase::AddSubscriberL() +// --------------------------------------------------------------------------- +// +EXPORT_C void CXIMPSubscriptionItemBase::AddSubscriberL( MXIMPPscContext* aContext ) + { + TRACE_2( _L("CXIMPSubscriptionItemBase::AddSubscriberL( MXIMPPscContext* aContext ) : this = %d , aContext = %d"), this, aContext ); + + TRACE_1( _L("CXIMPSubscriptionItemBase::AddSubscriberL( MXIMPPscContext* aContext ) : iPreContexts.Count 1 = %d"), iPreContexts.Count() ); + TRACE_1( _L("CXIMPSubscriptionItemBase::AddSubscriberL( MXIMPPscContext* aContext ) : iContexts.Count 1 = %d"), iContexts.Count() ); + + TLinearOrder< MXIMPPscContext > order( OrderOfContexts ); + if( IsContext( aContext ) ) + { + User::Leave( KErrAlreadyExists ); + } + + TInt index = iPreContexts.FindInOrder( aContext, order ); + TRACE_1( _L("CXIMPSubscriptionItemBase::AddSubscriberL( MXIMPPscContext* aContext ) : iPreContexts.FindInOrder = %d"), index ); + + if( index != KErrNotFound ) + { + User::Leave( KErrAlreadyExists ); + } + + iPreContexts.InsertInOrderL( aContext, order ); + + User::LeaveIfError( Open() ); + + TRACE_1( _L("CXIMPSubscriptionItemBase::AddSubscriberL( MXIMPPscContext* aContext ) : iPreContexts.Count 2 = %d"), iPreContexts.Count() ); + TRACE_1( _L("CXIMPSubscriptionItemBase::AddSubscriberL( MXIMPPscContext* aContext ) : iContexts.Count 2 = %d"), iContexts.Count() ); + + ChangeStatusAfterAdd(); + } + +// --------------------------------------------------------------------------- +// CXIMPSubscriptionItemBase::RemoveSubscriber() +// --------------------------------------------------------------------------- +// +EXPORT_C void CXIMPSubscriptionItemBase::RemoveSubscriber( MXIMPPscContext* aContext ) + { + TRACE_1( _L("CXIMPSubscriptionItemBase::RemoveSubscriber( MXIMPPscContext* aContext ) : iPreContexts.Count 1 = %d"), iPreContexts.Count() ); + TRACE_1( _L("CXIMPSubscriptionItemBase::RemoveSubscriber( MXIMPPscContext* aContext ) : iContexts.Count 1 = %d"), iContexts.Count() ); + + TLinearOrder< MXIMPPscContext > order( OrderOfContexts ); + TInt index = iContexts.FindInOrder( aContext, order ); + TInt preIndex = iPreContexts.FindInOrder( aContext, order ); + + TRACE_1( _L("CXIMPSubscriptionItemBase::RemoveSubscriber( MXIMPPscContext* aContext ) : iContexts.FindInOrder = %d"), index ); + TRACE_1( _L("CXIMPSubscriptionItemBase::RemoveSubscriber( MXIMPPscContext* aContext ) : iPreContexts.FindInOrder = %d"), preIndex ); + + if( index >= 0 ) + { + TRACE_1( _L("CXIMPSubscriptionItemBase::RemoveSubscriber( MXIMPPscContext* aContext ) : iContexts.Remove( index ): aContext = %d"), aContext ); + + iContexts.Remove( index ); + ChangeStatusAfterRemove(); + Close(); + } + else if( preIndex >= 0 ) + { + TRACE_1( _L("CXIMPSubscriptionItemBase::RemoveSubscriber( MXIMPPscContext* aContext ) : iPreContexts.Remove( preIndex ): aContext = %d"), aContext ); + + iPreContexts.Remove( preIndex ); + ChangeStatusAfterRemove(); + Close(); + } + else + { + TRACE( _L("CXIMPSubscriptionItemBase::RemoveSubscriber( MXIMPPscContext* aContext ) : iParent.UnregisterExpiringItem") ); + + iParent.UnregisterExpiringItem( this ); + } + + TRACE_1( _L("CXIMPSubscriptionItemBase::RemoveSubscriber( MXIMPPscContext* aContext ) : iPreContexts.Count 2 = %d"), iPreContexts.Count() ); + TRACE_1( _L("CXIMPSubscriptionItemBase::RemoveSubscriber( MXIMPPscContext* aContext ) : iContexts.Count 2 = %d"), iContexts.Count() ); + + } + +// --------------------------------------------------------------------------- +// CXIMPSubscriptionItemBase::AddSubscriberL() +// --------------------------------------------------------------------------- +// +EXPORT_C void CXIMPSubscriptionItemBase::AddSubscriberL( CXIMPSubscriptionItemBase* aItem ) + { + TRACE( _L("CXIMPSubscriptionItemBase::AddSubscriberL( CXIMPSubscriptionItemBase* aItem ) : begin") ); + + TLinearOrder< CXIMPSubscriptionItemBase > order( OrderOfItems ); + TInt index = iItems.FindInOrder( aItem, order ); + if( index != KErrNotFound ) + { + return; + } + index = iPreItems.FindInOrder( aItem, order ); + if( index != KErrNotFound ) + { + return; + } + + iPreItems.InsertInOrderL( aItem, order ); + User::LeaveIfError( Open() ); + ChangeStatusAfterAdd(); + + TRACE( _L("CXIMPSubscriptionItemBase::AddSubscriberL( CXIMPSubscriptionItemBase* aItem ) : end") ); + } + +// --------------------------------------------------------------------------- +// CXIMPSubscriptionItemBase::RemoveSubscriber() +// --------------------------------------------------------------------------- +// +EXPORT_C void CXIMPSubscriptionItemBase::RemoveSubscriber( CXIMPSubscriptionItemBase* aItem ) + { + TRACE( _L("CXIMPSubscriptionItemBase::RemoveSubscriberL( CXIMPSubscriptionItemBase* aItem ) : begin") ); + + TLinearOrder< CXIMPSubscriptionItemBase > order( OrderOfItems ); + TInt index = iItems.FindInOrder( aItem, order ); + TInt preIndex = iPreItems.FindInOrder( aItem, order ); + if( index >= 0 ) + { + iItems.Remove( index ); + ChangeStatusAfterRemove(); + Close(); + } + else if( preIndex >= 0 ) + { + iPreItems.Remove( index ); + ChangeStatusAfterRemove(); + Close(); + } + else + { + iParent.UnregisterExpiringItem( this ); + } + + TRACE( _L("CXIMPSubscriptionItemBase::RemoveSubscriberL( CXIMPSubscriptionItemBase* aItem ) : end") ); + } + +// --------------------------------------------------------------------------- +// CXIMPSubscriptionItemBase::ForceClose() +// --------------------------------------------------------------------------- +// +EXPORT_C void CXIMPSubscriptionItemBase::ForceClose() + { + TInt count = iContexts.Count(); + for( TInt a = 0; a < count; ++a ) + { + // RemoveSubscriber removes first one every time. + RemoveSubscriber( iContexts[ 0 ] ); + } + count = iItems.Count(); + for( TInt a = 0; a < count; ++a ) + { + RemoveSubscriber( iItems[ 0 ] ); + } + } + +// --------------------------------------------------------------------------- +// CXIMPSubscriptionItemBase::CleanIfExpired() +// --------------------------------------------------------------------------- +// +EXPORT_C TBool CXIMPSubscriptionItemBase::CleanIfExpired() + { + TTime timeNow; + timeNow.UniversalTime(); + TBool expired = + ( iExpireTime + TTimeIntervalSeconds( KXIMPContentAutoExpiryTime ) ) < timeNow; + if( expired ) + { + CleanExpired(); + } + return expired; + } + +// --------------------------------------------------------------------------- +// CXIMPSubscriptionItemBase::UpdateSubscriptionStateL() +// --------------------------------------------------------------------------- +// +EXPORT_C void CXIMPSubscriptionItemBase::UpdateSubscriptionStateL( TSubscriptionEvent aUpdateState ) + { + switch( aUpdateState ) + { + case ECompleteDataReceived: + { + if( CountOfSubscribers() == 0 ) + { + UpdateExpirationL(); + } + break; + } + default: + { + User::Panic( NXIMPPrivPanic::KCategory, NXIMPPrivPanic::ESubscriptionItemLogicError ); + break; + } + } + } + + +// --------------------------------------------------------------------------- +// CXIMPSubscriptionItemBase::DataSubscriptionState() +// --------------------------------------------------------------------------- +// +EXPORT_C const MXIMPDataSubscriptionState& CXIMPSubscriptionItemBase::DataSubscriptionState() + { + return *iSubscriptionState; + } + +// --------------------------------------------------------------------------- +// CXIMPSubscriptionItemBase::ContextCount() +// --------------------------------------------------------------------------- +// +EXPORT_C TInt CXIMPSubscriptionItemBase::ContextCount() const + { +// return iContexts.Count(); + TInt count = iContexts.Count(); + TRACE_1( _L("CXIMPSubscriptionItemBase::ContextCount() : return = %d"), count ); + return count; + } + +// --------------------------------------------------------------------------- +// CXIMPSubscriptionItemBase::Context() +// --------------------------------------------------------------------------- +// +EXPORT_C MXIMPPscContext& CXIMPSubscriptionItemBase::Context( TInt aIndex ) + { + return *iContexts[ aIndex ]; + } + +// --------------------------------------------------------------------------- +// CXIMPSubscriptionItemBase::Context() +// --------------------------------------------------------------------------- +// +EXPORT_C TBool CXIMPSubscriptionItemBase::IsContext( MXIMPPscContext* aContext ) const + { + TLinearOrder< MXIMPPscContext > order( OrderOfContexts ); +// return iContexts.FindInOrder( aContext, order ) != KErrNotFound; + TBool ret = iContexts.FindInOrder( aContext, order ) != KErrNotFound; + TRACE_1( _L("CXIMPSubscriptionItemBase::IsContext( MXIMPPscContext* aContext ) : return = %d"), (TInt)ret ); + return ret; + } + +// --------------------------------------------------------------------------- +// CXIMPSubscriptionItemBase::SynthesiseSubscriptionEventToAllCtxsL() +// --------------------------------------------------------------------------- +// +EXPORT_C void CXIMPSubscriptionItemBase::SynthesiseSubscriptionEventToAllCtxsL() + { + TRACE_1( _L("CXIMPSubscriptionItemBase::SynthesiseSubscriptionEventToAllCtxsL() : this = %d " ), this ); + RPointerArray< MXIMPPscContext > contextArray; + CleanupClosePushL( contextArray ); + TLinearOrder< MXIMPPscContext > order( OrderOfContexts ); + + TInt contextCount = iContexts.Count(); + + TRACE_1( _L("CXIMPSubscriptionItemBase::SynthesiseSubscriptionEventToAllCtxsL() contextCount = %d"), contextCount ); + TRACE_1( _L("CXIMPSubscriptionItemBase::SynthesiseSubscriptionEventToAllCtxsL() : iPreContexts.Count = %d"), iPreContexts.Count() ); + + for( TInt a = 0; a < contextCount; ++a ) + { + contextArray.InsertInOrderL( iContexts[ a ], order ); + } + + TInt itemCount = iItems.Count(); + TRACE_1( _L("CXIMPSubscriptionItemBase::SynthesiseSubscriptionEventToAllCtxsL() itemCount = %d"), itemCount ); + + for( TInt a = 0; a < itemCount; ++a ) + { + TInt contextCount = iItems[ a ]->ContextCount(); + for( TInt b = 0; b < contextCount; ++b ) + { + TInt error = contextArray.InsertInOrder( &iItems[ a ]->Context( b ), order ); + if( error != KErrNotFound ) + { + User::LeaveIfError( error ); + } + } + } + + TInt count = contextArray.Count(); + TRACE_1( _L("CXIMPSubscriptionItemBase::SynthesiseSubscriptionEventToAllCtxsL() contextArray.Count() = %d"), count ); + + for( TInt a = 0; a < count; ++a ) + { + TRACE_1( _L("CXIMPSubscriptionItemBase::SynthesiseSubscriptionEventToAllCtxsL() Sending event to = %d"), a ); + TInt error ( KErrNone ); + TRAP( error, SynthesiseSubscriptionEventToL( contextArray[ a ], ETrue ); ); + TRACE_1( _L("CXIMPSubscriptionItemBase::SynthesiseSubscriptionEventToAllCtxsL() : TRAPD( error, SynthesiseSubscriptionEventToL = %d"), error ); + } + CleanupStack::PopAndDestroy(); // contextArray + } + +// --------------------------------------------------------------------------- +// CXIMPSubscriptionItemBase::ActivateSubscriberL() +// --------------------------------------------------------------------------- +// +EXPORT_C void CXIMPSubscriptionItemBase::ActivateSubscriberL( MXIMPPscContext* aContext ) + { + TRACE_1( _L("CXIMPSubscriptionItemBase::ActivateSubscriberL( MXIMPPscContext* aContext ) : this = %d "),this ); + TLinearOrder< MXIMPPscContext > order( OrderOfContexts ); + TInt index = iPreContexts.FindInOrder( aContext, order ); + + TRACE_1( _L("CXIMPSubscriptionItemBase::ActivateSubscriberL() : MXIMPPscContext* aContext = %d"), aContext ); + + TRACE_1( _L("CXIMPSubscriptionItemBase::ActivateSubscriberL() : iPreContexts.Count 1 = %d"), iPreContexts.Count() ); + TRACE_1( _L("CXIMPSubscriptionItemBase::ActivateSubscriberL() : iContexts.Count 1 = %d"), iContexts.Count() ); + TRACE_1( _L("CXIMPSubscriptionItemBase::ActivateSubscriberL() : iPreContexts.FindInOrder = %d"), index ); + if( index != KErrNotFound ) + { + iContexts.InsertInOrderL( iPreContexts[ index ], order ); + iPreContexts.Remove( index ); + } + + TRACE_1( _L("CXIMPSubscriptionItemBase::ActivateSubscriberL() : iPreContexts.Count 2 = %d"), iPreContexts.Count() ); + TRACE_1( _L("CXIMPSubscriptionItemBase::ActivateSubscriberL() : iContexts.Count 2 = %d"), iContexts.Count() ); + } + +// --------------------------------------------------------------------------- +// CXIMPSubscriptionItemBase::ActivateSubscriberL() +// --------------------------------------------------------------------------- +// +EXPORT_C void CXIMPSubscriptionItemBase::ActivateSubscriberL( CXIMPSubscriptionItemBase* aItem ) + { + TRACE( _L("CXIMPSubscriptionItemBase::ActivateSubscriberL( CXIMPSubscriptionItemBase* aItem )" ) ); + TLinearOrder< CXIMPSubscriptionItemBase > order( OrderOfItems ); + TInt index = iPreItems.FindInOrder( aItem, order ); + TRACE_1( _L("CXIMPSubscriptionItemBase::ActivateSubscriberL() : iPreItems.FindInOrder = %d"), index ); + + if( index != KErrNotFound ) + { + iItems.InsertInOrderL( iPreItems[ index ], order ); + iPreItems.Remove( index ); + } + } + +// --------------------------------------------------------------------------- +// CXIMPSubscriptionItemBase::Status() +// --------------------------------------------------------------------------- +// +EXPORT_C void CXIMPSubscriptionItemBase::SetDataSubscriptionStateL( CXIMPDataSubscriptionStateImp& aNewState ) + { + // Some handle logic for terminating subscribers, data expiration etc. missing. + delete iSubscriptionState; + iSubscriptionState = &aNewState; + } + +// --------------------------------------------------------------------------- +// CXIMPSubscriptionItemBase::Status() +// --------------------------------------------------------------------------- +// +EXPORT_C CXIMPDataSubscriptionStateImp* CXIMPSubscriptionItemBase::StatusLC( MXIMPPscContext* aContext ) const + { + MXIMPDataSubscriptionState::TSubscriptionState subscriptionState = iSubscriptionState->SubscriptionState(); + MXIMPDataSubscriptionState::TDataState dataState = iSubscriptionState->DataState(); + CXIMPDataSubscriptionStateImp* state = + TXIMPObjectCloner< CXIMPDataSubscriptionStateImp >::CloneL( *iSubscriptionState ); + CleanupStack::PushL( state ); + + state->SetSubscriptionState( MXIMPDataSubscriptionState::ESubscriptionInactive ); + state->SetDataState( MXIMPDataSubscriptionState::EDataUnavailable ); + TInt count = iItems.Count(); + for( TInt a = 0; a < count; ++a ) + { + if( iItems[ a ]->IsContext( aContext ) ) + { + state->SetSubscriptionState( subscriptionState ); + state->SetDataState( dataState ); + return state; + } + } + count = iPreItems.Count(); + for( TInt a = 0; a < count; ++a ) + { + if( iPreItems[ a ]->IsContext( aContext ) ) + { + state->SetSubscriptionState( MXIMPDataSubscriptionState::ESubscriptionActive ); + } + } + + TLinearOrder< MXIMPPscContext > order( OrderOfContexts ); + TInt index = iContexts.FindInOrder( aContext, order ); + if( index == KErrNotFound ) + { + index = iPreContexts.FindInOrder( aContext, order ); + if( index != KErrNotFound ) // Not yet activated + { + state->SetSubscriptionState( MXIMPDataSubscriptionState::ESubscriptionActive ); + } + } + else + { + state->SetSubscriptionState( subscriptionState ); + state->SetDataState( dataState ); + } + return state; + } + +// --------------------------------------------------------------------------- +// CXIMPSubscriptionItemBase::UpdateExpirationL() +// --------------------------------------------------------------------------- +// +EXPORT_C void CXIMPSubscriptionItemBase::UpdateExpirationL() + { + if( CountOfSubscribers() == 0 ) + { + iParent.RegisterExpiringItemL( this ); + } + iExpireTime.UniversalTime(); + } + + +// --------------------------------------------------------------------------- +// CXIMPSubscriptionItemBase::ChangeStatusAfterRemove() +// --------------------------------------------------------------------------- +// +EXPORT_C void CXIMPSubscriptionItemBase::ChangeStatusAfterRemove() + { + if( CountOfSubscribers() == 0 ) + { + iSubscriptionState->SetSubscriptionState( MXIMPDataSubscriptionState::ESubscriptionInactive ); + } + } + + +// --------------------------------------------------------------------------- +// CXIMPSubscriptionItemBase::ChangeStatusAfterAdd() +// --------------------------------------------------------------------------- +// +EXPORT_C void CXIMPSubscriptionItemBase::ChangeStatusAfterAdd() + { + iSubscriptionState->SetSubscriptionState( MXIMPDataSubscriptionState::ESubscriptionActive ); + } + +// --------------------------------------------------------------------------- +// CXIMPSubscriptionItemBase::CountOfSubscribers() +// --------------------------------------------------------------------------- +// +EXPORT_C TInt CXIMPSubscriptionItemBase::CountOfSubscribers() + { + return iItems.Count() + iPreItems.Count() + iContexts.Count() + iPreContexts.Count(); + } +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcdatamodel/ximptypehelpers.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcdatamodel/ximptypehelpers.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,48 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Typedef helpers for really long typenames. + * +*/ + +#ifndef XIMPTYPEHELPERS_H +#define XIMPTYPEHELPERS_H + +#include "ximpapiobjbase.h" +#include + + +class CXIMPIdentityImp; +class CXIMPApiDataObjBase; + +// Key for opening up the typedefs: +// +// R(Xyz)Array = RXIMPObjOwningPtrArray +// +// When adding new types, follow these conventions. +// + +typedef RXIMPObjOwningPtrArray RPrIdImpArray; + + +struct SXIMPReqParam + { + CXIMPApiDataObjBase* iParam; + TInt iParamType; + }; + +typedef RArray RPrReqParamArray; + +#endif // XIMPTYPEHELPERS_H + + diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcfrontend/srcecomhook/ximpecomhook.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcfrontend/srcecomhook/ximpecomhook.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,46 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework ECom Hook implementation. +* +*/ + + +#include "ximpdlluids.hrh" +#include "ximpclientimp.h" +#include +#include + + +// --------------------------------------------------------------------------- +// Key value pair table to identify correct constructor +// function for the requested interface. +// --------------------------------------------------------------------------- +// +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY( XIMP_ECOM_IMPLEMENTATION_UID_CLIENT_INTERFACE, + CXIMPClientImp::NewMXIMPClientL ) + }; + + +// --------------------------------------------------------------------------- +// Exported function to return the implementation proxy table +// --------------------------------------------------------------------------- +// +EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount ) + { + aTableCount = sizeof( ImplementationTable ) / sizeof( TImplementationProxy ); + return ImplementationTable; + } + diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcfrontend/srcecomhook/ximpecomhook.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcfrontend/srcecomhook/ximpecomhook.rss Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,53 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ECom registery info for ECom hook +* +*/ + + +#include +#include "ximpmanagementifids.hrh" +#include "ximpdlluids.hrh" + + + +// --------------------------------------------------------------------------- +// ECom registery info for Presence Framework ECom hook +// --------------------------------------------------------------------------- +// +RESOURCE REGISTRY_INFO theInfo + { + resource_format_version = RESOURCE_FORMAT_VERSION_2; + dll_uid = XIMP_DLL_UID_COMMON; + + interfaces = + { + INTERFACE_INFO + { + interface_uid = XIMP_ECOM_IF_UID_CLIENT_INTERFACE; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = XIMP_ECOM_IMPLEMENTATION_UID_CLIENT_INTERFACE; + version_no = 1; + display_name = "S60 Default PrFw"; + default_data = XIMP_ECOM_DEFAULT_DATA_CLIENT_INTERFACE; + opaque_data = ""; + } + }; + } + }; + } + diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcfrontend/srcmanager/ximpclientifsingleton.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcfrontend/srcmanager/ximpclientifsingleton.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,138 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Reference counted singleton for XIMP client side. +* +*/ + +#include "ximpclientifsingleton.h" +#include "ximpsrvrootclient.h" + + + +// ============================ HELPER CLASS =============================== + + +/** + * CXIMPClientIfSingleton nested structure + * to hold global objects. + */ +NONSHARABLE_STRUCT( CXIMPClientIfSingleton::SGlobals ) + { + /** + * Root connection to XIMP server. + * The CXIMPClientIfSingleton manages and ows the connection. + */ + RXIMPSrvRootClient iRootClient; + }; + + + + + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CXIMPClientIfSingleton::InstanceL() +// Singleton access method. +// ----------------------------------------------------------------------------- +// +CXIMPClientIfSingleton* CXIMPClientIfSingleton::InstanceL() + { + CXIMPClientIfSingleton* singleton; + + singleton = ( CXIMPClientIfSingleton* ) Dll::Tls(); + if( !singleton ) + { + singleton = CXIMPClientIfSingleton::NewLC(); + User::LeaveIfError( Dll::SetTls( singleton ) ); + CleanupStack::Pop(); + } + else + { + User::LeaveIfError(singleton->Open()); // Open return KErrNone. + } + + return singleton; + } + + +// ----------------------------------------------------------------------------- +// CXIMPClientIfSingleton::NewLC() +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CXIMPClientIfSingleton* CXIMPClientIfSingleton::NewLC() + { + CXIMPClientIfSingleton* self = new( ELeave ) CXIMPClientIfSingleton; + CleanupClosePushL( *self ); + self->ConstructL(); + return self; + } + + +// ----------------------------------------------------------------------------- +// CXIMPClientIfSingleton::CXIMPClientIfSingleton() +// ----------------------------------------------------------------------------- +// +CXIMPClientIfSingleton::CXIMPClientIfSingleton() + { + } + + +// Destructor +CXIMPClientIfSingleton::~CXIMPClientIfSingleton() + { + //Destroy global objects + if( iGlobals ) + { + iGlobals->iRootClient.Close(); + } + + //And the holder + delete iGlobals; + Dll::SetTls( NULL ); + #if _BullseyeCoverage + cov_write(); + #endif + } + + + +// ----------------------------------------------------------------------------- +// CXIMPClientIfSingleton::ConstructL() +// ----------------------------------------------------------------------------- +// +void CXIMPClientIfSingleton::ConstructL() + { + //Reserve the object holder and zero initialize it + iGlobals = new ( ELeave ) SGlobals; + Mem::FillZ( iGlobals, sizeof( SGlobals ) ); + + //Construct needed global objects + User::LeaveIfError( iGlobals->iRootClient.Connect() ); + } + + + +// ----------------------------------------------------------------------------- +// CXIMPClientIfSingleton::RootClient() +// ----------------------------------------------------------------------------- +// +RXIMPSrvRootClient& CXIMPClientIfSingleton::RootClient() + { + return iGlobals->iRootClient; + } + + + diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcfrontend/srcmanager/ximpclientifsingleton.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcfrontend/srcmanager/ximpclientifsingleton.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,108 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Reference counted singleton for XIMP client side. +* +*/ + +#ifndef CXIMPCLIENTIFSINGLETON_H +#define CXIMPCLIENTIFSINGLETON_H + +#include + + +class RXIMPSrvRootClient; + + + +/** + * Reference counted singleton for XIMP Framework + * client IF library. + * + * @lib ximpclientinterface.dll + * @since S60 v3.2 + */ +NONSHARABLE_CLASS( CXIMPClientIfSingleton ) : public CObject + { + /** Private nested structure to hold global objects */ + struct SGlobals; + + +public: // singleton access + + /** + * Singleton access method. + * + * Gets pointer to XIMP Client Interface library singleton. + */ + static CXIMPClientIfSingleton* InstanceL(); + + + +private: + + /** + * Two-phased constructor. + * Leaves created object on the CleanupStack. + */ + static CXIMPClientIfSingleton* NewLC(); + + + /** + * C++ default constructor. + */ + CXIMPClientIfSingleton(); + + + /** + * Private destructor. + * + * Singleton holder is reference counted. + * It is automaticly destroyed when last + * holded object or reference is destroyed. + */ + ~CXIMPClientIfSingleton(); + + + + /** + * Symbian 2nd phase constructor + */ + void ConstructL(); + + + +public: + + + /** + * Gets reference to XIMP client side Root Server session. + * + * @return Connected XIMP Root Server session. + */ + RXIMPSrvRootClient& RootClient(); + + +private: // Data + + + /** + * Object holder having pointers to XIMP client side global objects. + * Both holder and pointed objects own. + */ + SGlobals* iGlobals; + }; + +#endif // CXIMPCLIENTIFSINGLETON_H + + diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcfrontend/srcmanager/ximpclientimp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcfrontend/srcmanager/ximpclientimp.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,142 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MXIMPClient API object implementation. +* +*/ + +#include "ximpclientimp.h" +#include "ximpclientifsingleton.h" +#include "ximpobjecthelpers.h" +#include "ximpsrvrootclient.h" +#include "ximpprotocolinfoimp.h" +#include "ximpfeatureinfoimp.h" +#include "ximpcontextimp.h" +#include "ximpobjecthelpers.h" + + +// ============================ MEMBER FUNCTIONS ============================= + + +// --------------------------------------------------------------------------- +// CXIMPClientImp::NewMXIMPClientL() +// --------------------------------------------------------------------------- +// +EXPORT_C MXIMPClient* CXIMPClientImp::NewMXIMPClientL() + { + CXIMPClientImp* self = new( ELeave ) CXIMPClientImp; + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// Implement supported interface access. +// --------------------------------------------------------------------------- +// +XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CXIMPClientImp, + MXIMPClient ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + + +XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CXIMPClientImp, + MXIMPClient ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + +// --------------------------------------------------------------------------- +// CXIMPClientImp::~CXIMPClientImp() +// --------------------------------------------------------------------------- +// +CXIMPClientImp::~CXIMPClientImp() + { + if( iSingleton ) + { + //Singleton is refercen counted + //So the Close() is enough to release the reference + iSingleton->Close(); + } + } + +// --------------------------------------------------------------------------- +// CXIMPClientImp::CXIMPClientImp() +// --------------------------------------------------------------------------- +// +CXIMPClientImp::CXIMPClientImp() + { + } + + +// --------------------------------------------------------------------------- +// void CXIMPClientImp::ConstructL() +// --------------------------------------------------------------------------- +// +void CXIMPClientImp::ConstructL() + { + iSingleton = CXIMPClientIfSingleton::InstanceL(); + } + +// --------------------------------------------------------------------------- +// CXIMPClientImp::GetProtocolsL() +// --------------------------------------------------------------------------- +// +void CXIMPClientImp::GetProtocolsL( + RXIMPObjOwningPtrArray< MXIMPProtocolInfo >& aProtocols ) + { + aProtocols.ResetAndDestroy(); + + RXIMPObjOwningPtrArray< CXIMPProtocolInfoImp > foundProtocols; + CleanupClosePushL( foundProtocols ); + + HBufC8* pack = iSingleton->RootClient().GetKnownProtocolsL(); + CleanupStack::PushL( pack ); + + TXIMPObjectPacker< CXIMPProtocolInfoImp >::UnPackArrayL( foundProtocols, + *pack ); + CleanupStack::PopAndDestroy( pack ); + + TXIMPObjectMover< CXIMPProtocolInfoImp, + MXIMPProtocolInfo >::MoveFromPtrArrayToL( foundProtocols, + aProtocols ); + CleanupStack::PopAndDestroy(); //foundProtocols + } + + + +// --------------------------------------------------------------------------- +// CXIMPClientImp::GetFrameworkFeaturesLC() +// --------------------------------------------------------------------------- +// +MXIMPFeatureInfo* CXIMPClientImp::GetFrameworkFeaturesLC() + { + CXIMPFeatureInfoImp* features = CXIMPFeatureInfoImp::NewLC(); + + HBufC8* pack = iSingleton->RootClient().GetSupportedFrameworkFeaturesL(); + CleanupStack::PushL( pack ); + TXIMPObjectPacker< CXIMPFeatureInfoImp >::UnPackL( *features, *pack ); + CleanupStack::PopAndDestroy( pack ); + + return features; + } + + +// --------------------------------------------------------------------------- +// CXIMPClientImp::NewPresenceContextLC() +// --------------------------------------------------------------------------- +// +MXIMPContext* CXIMPClientImp::NewPresenceContextLC() + { + return CXIMPContextImp::NewLC(); + } + + diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcfrontend/srcmanager/ximpclientimp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcfrontend/srcmanager/ximpclientimp.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,88 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MXIMPClient API object implementation. +* +*/ + +#ifndef CXIMPCLIENTIMP_H +#define CXIMPCLIENTIMP_H + +#include +#include "ximpapiobjbase.h" + + +class CXIMPClientIfSingleton; +class MXIMPFeatureInfo; + + +/** + * MXIMPClient API object implementation. + * + * @lib ximpmanager.dll + * @since S60 v3.2 + */ +NONSHARABLE_CLASS( CXIMPClientImp ): public CXIMPApiObjBase, + public MXIMPClient + { + public: + /** The class ID. */ + enum { KClassId = XIMPIMP_CLSID_CXIMPCLIENTIMP }; + + +public: + + IMPORT_C static MXIMPClient* NewMXIMPClientL(); + virtual ~CXIMPClientImp(); + +private: + + CXIMPClientImp(); + void ConstructL(); + + + +public: // From MXIMPBase + + /** + * Implementation of MXIMPBase interface methods + * @see MXIMPBase + */ + XIMPIMP_DECLARE_IF_BASE_METHODS + + +public: //From MXIMPClient + + + /** + * Implementation of MXIMPClient interface methods + * @see MXIMPClient + */ + void GetProtocolsL( RXIMPObjOwningPtrArray< MXIMPProtocolInfo >& aProtocols ); + MXIMPFeatureInfo* GetFrameworkFeaturesLC(); + MXIMPContext* NewPresenceContextLC(); + + + +private: // data + + /** + * XIMP client side singleton. + * Own. + */ + CXIMPClientIfSingleton* iSingleton; + + }; + + +#endif // CXIMPCLIENTIMP_H diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcfrontend/srcmanager/ximpcntxteventobsarray.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcfrontend/srcmanager/ximpcntxteventobsarray.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,375 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Presence context observer array. +* +*/ + +#include "ximpcntxteventobsarray.h" +#include "ximpcontexteventfilter.h" +#include "ximpundotask.h" +#include + + + +// ============================ HELPER CLASS ================================= + +/** + * Array entry helper holding pointer to actual observer and event + * filter that is used to filter events delivered to the observer. + * + * @lib ximpmanager.dll + * @since S60 v3.2 + */ +NONSHARABLE_CLASS( CXIMPCntxtEventObsArray::CObsEntry ) + : public CBase + { +public: + + /** + * Two phased constructor. + * + * @param aObserver The observer. + * @param aAcceptedEvents The accepted events. May be NULL. + */ + static CObsEntry* NewLC( MXIMPContextObserver& aObserver, // CSI: 42 # + const TArray< TInt32 >* aAcceptedEvents ); + + + /** + * Destructor. + */ + virtual ~CObsEntry(); + +private: + + CObsEntry( MXIMPContextObserver& aObserver ); + +public: + + /** + * Gets the observer. + * @return The observer. + */ + MXIMPContextObserver& Observer(); + + + /** + * Gets the event filter that should + * be used to filter events delivered to observer. + * @return The event filter. + */ + const CXIMPContextEventFilter& EventFilter() const; + + + +private: // data + + /** + * The observer. + * Not own. + */ + MXIMPContextObserver& iObserver; + + + /** + * The event filter associated to the observer. + * Own. + */ + CXIMPContextEventFilter* iEventFilter; + }; + + + + + +// --------------------------------------------------------------------------- +// CXIMPCntxtEventObsArray::CObsEntry::NewLC() +// --------------------------------------------------------------------------- +// +CXIMPCntxtEventObsArray::CObsEntry* + CXIMPCntxtEventObsArray::CObsEntry::NewLC( + MXIMPContextObserver& aObserver, + const TArray< TInt32 >* aAcceptedEvents ) + { + CObsEntry* self = new( ELeave ) CObsEntry( aObserver ); + CleanupStack::PushL( self ); + + self->iEventFilter = CXIMPContextEventFilter::NewLC( aAcceptedEvents ); + CleanupStack::Pop( self->iEventFilter ); + + return self; + } + + +// --------------------------------------------------------------------------- +// CXIMPCntxtEventObsArray::CObsEntry::~CObsEntry() +// --------------------------------------------------------------------------- +// +CXIMPCntxtEventObsArray::CObsEntry::~CObsEntry() + { + delete iEventFilter; + } + + +// --------------------------------------------------------------------------- +// CXIMPCntxtEventObsArray::CObsEntry::CObsEntry() +// --------------------------------------------------------------------------- +// +CXIMPCntxtEventObsArray::CObsEntry::CObsEntry( + MXIMPContextObserver& aObserver ) + : iObserver( aObserver ) + { + } + + +// --------------------------------------------------------------------------- +// CXIMPCntxtEventObsArray::CObsEntry::Observer() +// --------------------------------------------------------------------------- +// +MXIMPContextObserver& + CXIMPCntxtEventObsArray::CObsEntry::Observer() + { + return iObserver; + } + + +// --------------------------------------------------------------------------- +// CXIMPCntxtEventObsArray::CObsEntry::EventFilter() +// --------------------------------------------------------------------------- +// +const CXIMPContextEventFilter& + CXIMPCntxtEventObsArray::CObsEntry::EventFilter() const + { + return *iEventFilter; + } + + + +// ============================ MEMBER FUNCTIONS ============================= + +// --------------------------------------------------------------------------- +// CXIMPCntxtEventObsArray::NewL() +// --------------------------------------------------------------------------- +// +CXIMPCntxtEventObsArray* + CXIMPCntxtEventObsArray::NewL() + { + CXIMPCntxtEventObsArray* self = new( ELeave ) CXIMPCntxtEventObsArray(); + return self; + } + + +// --------------------------------------------------------------------------- +// CXIMPCntxtEventObsArray::CXIMPCntxtEventObsArray() +// --------------------------------------------------------------------------- +// +CXIMPCntxtEventObsArray::~CXIMPCntxtEventObsArray() + { + iObservers.ResetAndDestroy(); + } + + +// --------------------------------------------------------------------------- +// CXIMPCntxtEventObsArray::CXIMPCntxtEventObsArray() +// --------------------------------------------------------------------------- +// +CXIMPCntxtEventObsArray::CXIMPCntxtEventObsArray() + { + } + + +// --------------------------------------------------------------------------- +// CXIMPCntxtEventObsArray::AddObserverLC() +// --------------------------------------------------------------------------- +// +MXIMPUndoTask* CXIMPCntxtEventObsArray::AddObserverLC( + MXIMPContextObserver& aObserver, + const TArray< TInt32 >* aEventFilter ) + { + __ASSERT_ALWAYS( !IsReqistered( aObserver ), + User::Leave( KErrAlreadyExists ) ); + + //Create undo task + CXIMPUndoPtrArrayEntryAdd< CObsEntry >* undoTask = + CXIMPUndoPtrArrayEntryAdd< CObsEntry >::NewLC(); + + //Create observer entry and add it to observer array + CObsEntry* observerEntry = CObsEntry::NewLC( aObserver, aEventFilter ); + iObservers.AppendL( observerEntry ); + CleanupStack::Pop( observerEntry ); + + //Initialize undo task to remove and destroy just added + //observer entry from observer array on undoTask destruction + undoTask->InitToRemoveAndDestroyOnUndo( *observerEntry, iObservers ); + return undoTask; + } + + +// --------------------------------------------------------------------------- +// CXIMPCntxtEventObsArray::UpdateObserverLC() +// --------------------------------------------------------------------------- +// +MXIMPUndoTask* CXIMPCntxtEventObsArray::UpdateObserverLC( + MXIMPContextObserver& aObserver, + const TArray< TInt32 >* aEventFilter ) + { + __ASSERT_ALWAYS( IsReqistered( aObserver ), + User::Leave( KErrAlreadyExists ) ); + + //Create undo task + CXIMPUndoPtrArrayEntryReplace< CObsEntry >* undoTask = + CXIMPUndoPtrArrayEntryReplace< CObsEntry >::NewLC(); + + //Create entry & filter for observer + CObsEntry* newEntry = CObsEntry::NewLC( aObserver, aEventFilter ); + CleanupStack::Pop( newEntry ); + + //Replace existing entry with new one + const TInt index = FindEntryPosition( aObserver ); + CObsEntry* oldEntry = iObservers[ index ]; + iObservers[ index ] = newEntry; + + //Initialize undo task to switch back to old entry in case of undo + //Undo task takes care of deleting of the entry + //which remains out of array + undoTask->InitToReplaceOnUndo( *newEntry, iObservers, *oldEntry ); + return undoTask; + } + + +// --------------------------------------------------------------------------- +// CXIMPCntxtEventObsArray::RemoveObserver() +// --------------------------------------------------------------------------- +// +void CXIMPCntxtEventObsArray::RemoveObserver( + MXIMPContextObserver& aObserver ) + { + const TInt entryPos = FindEntryPosition( aObserver ); + if( entryPos != KErrNotFound ) + { + delete iObservers[ entryPos ]; + iObservers.Remove( entryPos ); + } + } + + +// --------------------------------------------------------------------------- +// CXIMPCntxtEventObsArray::CollectEventFilterLC() +// --------------------------------------------------------------------------- +// +CXIMPContextEventFilter* + CXIMPCntxtEventObsArray::CollectEventFilterLC() + { + RPointerArray < CXIMPContextEventFilter > tempArray; + CleanupClosePushL( tempArray ); + for (TInt ii( 0 ); ii < iObservers.Count(); ii++ ) + { + const CXIMPContextEventFilter* tempFilter = &(iObservers[ii]->EventFilter()); + tempArray.AppendL( tempFilter ); + } + TArray daArray = tempArray.Array(); + CXIMPContextEventFilter* retFilter = CXIMPContextEventFilter::NewCombinedLC( daArray ); + CleanupStack::Pop(); // retFilter + CleanupStack::PopAndDestroy(); // tempArray + CleanupStack::PushL( retFilter ); + return retFilter; + } + + +// --------------------------------------------------------------------------- +// DeliverEventToObserver() +// --------------------------------------------------------------------------- +// +void DeliverEventToObserver( MXIMPContextObserver& aObsrver, + const MXIMPContext& aCntxtInterface, + const MXIMPBase& aEvent ) + { + aObsrver.HandlePresenceContextEvent( aCntxtInterface, aEvent ); + } + + + +// --------------------------------------------------------------------------- +// CXIMPCntxtEventObsArray::DeliverEvent() +// --------------------------------------------------------------------------- +// +void CXIMPCntxtEventObsArray::DeliverEvent( + MXIMPContext& aCntxtInterface, + MXIMPBase& aEvent ) + { + TInt32 eventType = aEvent.GetInterfaceId(); + + const TInt entryCount = iObservers.Count(); + for( TInt ix = 0; ix < entryCount; ix++ ) + { + CObsEntry* obsEntry = iObservers[ ix ]; + if( obsEntry->EventFilter().IsEventAccepted( eventType ) ) + { + MXIMPContextObserver& obs = obsEntry->Observer(); + __ASSERT_ALWAYS_NO_LEAVE( DeliverEventToObserver( obs, + aCntxtInterface, + aEvent ) ); + } + } + } + + + +// --------------------------------------------------------------------------- +// CXIMPCntxtEventObsArray::HasObservers() +// --------------------------------------------------------------------------- +// +TBool CXIMPCntxtEventObsArray::HasObservers() const + { + return ( iObservers.Count() > 0 ); + } + + +// --------------------------------------------------------------------------- +// CXIMPCntxtEventObsArray::IsReqistered() +// --------------------------------------------------------------------------- +// +TBool CXIMPCntxtEventObsArray::IsReqistered( + MXIMPContextObserver& aObserver ) const + { + return ( FindEntryPosition( aObserver ) != KErrNotFound ); + } + + +// --------------------------------------------------------------------------- +// CXIMPCntxtEventObsArray::FindEntryPosition() +// --------------------------------------------------------------------------- +// +TInt CXIMPCntxtEventObsArray::FindEntryPosition( + MXIMPContextObserver& aObserver ) const + { + const TInt entryCount = iObservers.Count(); + for( TInt ix = 0; ix < entryCount; ix++ ) + { + CObsEntry* observerEntry = iObservers[ ix ]; + if( &observerEntry->Observer() == &aObserver ) + { + return ix; + } + } + + return KErrNotFound; + } + + + + + + + diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcfrontend/srcmanager/ximpcntxteventobsarray.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcfrontend/srcmanager/ximpcntxteventobsarray.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,141 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Presence context observer array. +* +*/ + +#ifndef XIMPPRESCNTXTEVENTOBSARRAY_H +#define XIMPPRESCNTXTEVENTOBSARRAY_H + +#include + +class MXIMPContextObserver; +class MXIMPContext; +class RXIMPSrvContextClient; +class CXIMPContextEventFilter; +class MXIMPUndoTask; +class MXIMPBase; + + +/** + * Presence context observer array. + * + * @lib ximpmanager.dll + * @since S60 v3.2 + */ +NONSHARABLE_CLASS( CXIMPCntxtEventObsArray ) + : public CBase + { + /** Private nested helper classes */ + class CObsEntry; + + +public: + + static CXIMPCntxtEventObsArray* NewL(); + virtual ~CXIMPCntxtEventObsArray(); + +private: + + CXIMPCntxtEventObsArray(); + + +public: + + /** + * Adds new observer to observer list. + * + * @param aObserver Client side observer to add. + * @param aEventFilter Event filter for observer. Can be NULL. + * + * @return Undo object. When undo is activated, removes + * just added observer from observers list. + */ + MXIMPUndoTask* AddObserverLC( MXIMPContextObserver& aObserver, + const TArray< TInt32 >* aEventFilter ); + + + /** + * Updates observer event filter. + * + * @param aObserver Client side observer which filter to update. + * @param aEventFilter New event filter for observer. Can be NULL. + * + * @return Undo object. When undo is activated, takes old + * event filter in to use for observer. + */ + MXIMPUndoTask* UpdateObserverLC( MXIMPContextObserver& aObserver, + const TArray< TInt32 >* aEventFilter ); + + + /** + * Removes given observer from observers list. + * + * @param aObserver Client side observer to remove. + */ + void RemoveObserver( MXIMPContextObserver& aObserver ); + + + /** + * Collects event filter from currently registered + * observers. + * + * @return Collected event filter instance. + */ + CXIMPContextEventFilter* CollectEventFilterLC(); + + + /** + * Delivers given event to registered observers. + * + * @param aCntxtInterface Source context interface for event. + * @param aEvent The event object to deliver. + */ + void DeliverEvent( MXIMPContext& aCntxtInterface, + MXIMPBase& aEvent ); + + /** + * Checks is there observers registered. + * @return ETrue if there is observer registered. Else EFalse. + */ + TBool HasObservers() const; + + + /** + * Checks is the given observer registered or not. + * + * @param aObserver Observer to check. + * @return ETrue if observer is registered. Else EFalse. + */ + TBool IsReqistered( MXIMPContextObserver& aObserver ) const; + + + +private: + + TInt FindEntryPosition( MXIMPContextObserver& aObserver ) const; + + +private: // data + + /** + * The observers. + * Own. + */ + RPointerArray< CObsEntry > iObservers; + }; + + + +#endif // XIMPPRESCNTXTEVENTOBSARRAY_H diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcfrontend/srcmanager/ximpcontextclientproxy.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcfrontend/srcmanager/ximpcontextclientproxy.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,332 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Proxy class to manage context client session. + * +*/ + + +#include "ximpcontextclientproxy.h" +#include "ximppanics.h" + + +const TInt KXIMPWaitListGranurality = 10; + +// ============================ MEMBER FUNCTIONS ============================= + +// --------------------------------------------------------------------------- +// CXIMPContextClientProxy::CXIMPContextClientProxy() +// --------------------------------------------------------------------------- +// +CXIMPContextClientProxy::CXIMPContextClientProxy() + : iCtxConnectionState( ENotConnected ), + iReqWaitList( KXIMPWaitListGranurality ) + { + } + + +// --------------------------------------------------------------------------- +// CXIMPContextClientProxy::~CXIMPContextClientProxy() +// --------------------------------------------------------------------------- +// +CXIMPContextClientProxy::~CXIMPContextClientProxy() + { + iReqWaitList.Reset(); + Close(); + } + + +// --------------------------------------------------------------------------- +// CXIMPContextClientProxy::InitServerSessionLC() +// --------------------------------------------------------------------------- +// +void CXIMPContextClientProxy::InitServerSessionLC( TUid aProtocolUid ) + { + __ASSERT_ALWAYS( iCtxConnectionState == ENotConnected, + User::Leave( KErrAlreadyExists ) ); + + iCtxConnection.ConnectL( aProtocolUid ); + iCtxConnectionState = EInTransition; + CleanupClosePushL( *this ); + } + + +// --------------------------------------------------------------------------- +// CXIMPContextClientProxy::QueueAsyncConnectionOpenL() +// --------------------------------------------------------------------------- +// +TXIMPRequestId CXIMPContextClientProxy::QueueAsyncConnectionOpenL( + TInt aOperationType, + const TDesC8& aOperationParams ) + { + //Async open requests are accepted only when client context is + //transition state + __ASSERT_ALWAYS( iCtxConnectionState == EInTransition, + User::Leave( KErrNotReady ) ); + + return DoQueueAsyncOpL( aOperationType, aOperationParams, EXIMPAsyncOpenReq ); + } + +// --------------------------------------------------------------------------- +// CXIMPContextClientProxy::QueueAsyncConnectionOpen2L() +// --------------------------------------------------------------------------- +// +TXIMPRequestId CXIMPContextClientProxy::QueueAsyncConnectionOpen2L( + TInt aOperationType, + const TDesC8& aOperationParams ) + { + //Async open requests are accepted only when client context is + //transition state + __ASSERT_ALWAYS( iCtxConnectionState == EInTransition, + User::Leave( KErrNotReady ) ); + + return DoQueueAsyncOp2L( aOperationType, aOperationParams, EXIMPAsyncOpenReq ); + } + +// --------------------------------------------------------------------------- +// CXIMPContextClientProxy::QueueAsyncConnectionCloseL() +// --------------------------------------------------------------------------- +// +TXIMPRequestId CXIMPContextClientProxy::QueueAsyncConnectionCloseL( + TInt aOperationType, + const TDesC8& aOperationParams ) + { + //Async close requests are accepted when client context is + //fully binded or in transition state + __ASSERT_ALWAYS( ( iCtxConnectionState == EConnected ) || + ( iCtxConnectionState == EInTransition ), + User::Leave( KErrNotReady ) ); + + return DoQueueAsyncOpL( aOperationType, aOperationParams, EXIMPAsyncCloseReq ); + } + + + +// --------------------------------------------------------------------------- +// CXIMPContextClientProxy::QueueOperationL() +// --------------------------------------------------------------------------- +// +TXIMPRequestId CXIMPContextClientProxy::QueueOperationL( + TInt aOperationType, + const TDesC8& aOperationParams ) + { + //New operation requests are accepted only when client context is + //fully binded + __ASSERT_ALWAYS( iCtxConnectionState == EConnected, + User::Leave( KErrNotReady ) ); + + return DoQueueAsyncOpL( aOperationType, aOperationParams, EXIMPAsyncGeneralReq ); + } + + + +// --------------------------------------------------------------------------- +// CXIMPContextClientProxy::DirectSessionL() +// --------------------------------------------------------------------------- +// +const RXIMPSrvContextClient& CXIMPContextClientProxy::DirectSessionL() const + { + //Other direct requests are accepted only when client context is fully binded + + __ASSERT_ALWAYS( iCtxConnectionState == EConnected, + User::Leave( KErrNotReady ) ); + return iCtxConnection; + } + + +// --------------------------------------------------------------------------- +// CXIMPContextClientProxy::EventPumpSessionL() +// --------------------------------------------------------------------------- +// +RXIMPSrvContextClient& CXIMPContextClientProxy::EventPumpSessionL() + { + //Event pump requests are accepted when client context is either fully binded + //or in transition state + __ASSERT_ALWAYS( iCtxConnectionState != ENotConnected, + User::Leave( KErrNotReady ) ); + + return iCtxConnection; + } + + + +// --------------------------------------------------------------------------- +// CXIMPContextClientProxy::EventPumpSession() +// --------------------------------------------------------------------------- +// +RXIMPSrvContextClient* CXIMPContextClientProxy::EventPumpSession() + { + //Event pump requests are accepted when client context is either fully binded + //or in transition state + + if( iCtxConnectionState != ENotConnected ) + { + return &iCtxConnection; + } + else + { + return NULL; + } + } + + + +// --------------------------------------------------------------------------- +// CXIMPContextClientProxy::Close() +// --------------------------------------------------------------------------- +// +void CXIMPContextClientProxy::Close() + { + iCtxConnection.Close(); + iCtxConnectionState = ENotConnected; + } + + +// --------------------------------------------------------------------------- +// CXIMPContextClientProxy::DoQueueAsyncOpL() +// --------------------------------------------------------------------------- +// +TXIMPRequestId CXIMPContextClientProxy::DoQueueAsyncOpL( + TInt aOperationType, + const TDesC8& aOperationParams, + TXIMPAsyncReqType aReqType ) + { + iReqWaitList.ExtendL(); + TXIMPRequestId regId; + + TInt err = iCtxConnection.DoQueueOperation( aOperationType, + aOperationParams, + regId ); + + if( err == KErrNone ) + { + TXIMPAsyncReqEntry reqEntry; + reqEntry.iReqId = regId; + reqEntry.iReqType = aReqType; + + iReqWaitList[ iReqWaitList.Count() - 1 ] = reqEntry; + } + else + { + iReqWaitList.Delete( iReqWaitList.Count() - 1 ); + User::Leave( err ); + } + + return regId; + } + +// --------------------------------------------------------------------------- +// CXIMPContextClientProxy::DoQueueAsyncOp2L() +// --------------------------------------------------------------------------- +// +TXIMPRequestId CXIMPContextClientProxy::DoQueueAsyncOp2L( + TInt aOperationType, + const TDesC8& aOperationParams, + TXIMPAsyncReqType aReqType ) + { + iReqWaitList.ExtendL(); + TXIMPRequestId regId; + + TInt err = iCtxConnection.DoQueueOperation2( aOperationType, + aOperationParams, + regId ); + + if( err == KErrNone ) + { + TXIMPAsyncReqEntry reqEntry; + reqEntry.iReqId = regId; + reqEntry.iReqType = aReqType; + + iReqWaitList[ iReqWaitList.Count() - 1 ] = reqEntry; + } + else + { + iReqWaitList.Delete( iReqWaitList.Count() - 1 ); + User::Leave( err ); + } + + return regId; + } + + +// --------------------------------------------------------------------------- +// CXIMPContextClientProxy::HandleReqCompleted() +// --------------------------------------------------------------------------- +// +void CXIMPContextClientProxy::HandleReqCompleted( TXIMPRequestId aReqId, + TInt aCompletionCode ) + { + const TInt count = iReqWaitList.Count(); + for( TInt ix = 0; ix < count; ix++ ) + { + TXIMPAsyncReqEntry entry = iReqWaitList[ ix ]; + if( entry.iReqId == aReqId ) + { + iReqWaitList.Delete( ix ); + UpdateCtxConnectionStatus( entry.iReqType, aCompletionCode ); + return; + } + } + + NXIMPPrivPanic::Panic( NXIMPPrivPanic::EMatchingClientSideReqNotFound ); + } + + +// --------------------------------------------------------------------------- +// CXIMPContextClientProxy::GetTopPendingReq() +// --------------------------------------------------------------------------- +// +TBool CXIMPContextClientProxy::GetTopPendingReq( TXIMPRequestId& aReqId ) const + { + if( iReqWaitList.Count() > 0 ) + { + aReqId = iReqWaitList[ 0 ].iReqId; + return ETrue; + } + + aReqId = TXIMPRequestId::Null(); + return EFalse; + } + + +// --------------------------------------------------------------------------- +// CXIMPContextClientProxy::UpdateCtxConnectionStatus() +// --------------------------------------------------------------------------- +// +void CXIMPContextClientProxy::UpdateCtxConnectionStatus( + TXIMPAsyncReqType aReqType, + TInt aCompletionCode ) + { + if( aReqType == EXIMPAsyncOpenReq ) + { + if( aCompletionCode == KErrNone ) + { + iCtxConnectionState = EConnected; + } + else + { + Close(); + } + } + + + if( aReqType == EXIMPAsyncCloseReq ) + { + Close(); + } + } + + + + + diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcfrontend/srcmanager/ximpcontextclientproxy.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcfrontend/srcmanager/ximpcontextclientproxy.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,239 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Proxy class to manage context client session. +* +*/ + +#ifndef CXIMPCONTEXTCLIENTPROXY_H +#define CXIMPCONTEXTCLIENTPROXY_H + + +#include "ximpsrvcontextclient.h" +#include + + + +/** + * Type of the request. + */ +enum TXIMPAsyncReqType + { + EXIMPAsyncOpenReq, + EXIMPAsyncCloseReq, + EXIMPAsyncGeneralReq + }; + + +/** + * Request entry structure for client side request wait list. + */ +NONSHARABLE_CLASS( TXIMPAsyncReqEntry ) + { +public: + + /** + * Id of the request. + * Own. + */ + TXIMPRequestId iReqId; + + /** + * Type of request. + * Own. + */ + TXIMPAsyncReqType iReqType; + }; + + + +/** + * Proxy class to manage context client session. + * + * @lib ximpmanager.dll + * @since S60 v3.2 + */ +NONSHARABLE_CLASS( CXIMPContextClientProxy ): public CBase + { +public: + CXIMPContextClientProxy(); + ~CXIMPContextClientProxy(); + + +public: // New methods + + /** + * Opens context client session to + * server handling the given protocol. + * + * Handles errors by leaving. Pushes + * close to cleanupstack to close + * automaticly the session in + * case of leave. + * + * @param aProtocolUid Protocol implementation uid. + */ + void InitServerSessionLC( TUid aProtocolUid ); + + + + /** + * Issues context connection open request to server. + * + * @param aOperationType In parameter identifying the operation. + * @param aOperationParams In parameter package for operation. + * @return Request ID identifying started request. + */ + TXIMPRequestId QueueAsyncConnectionOpenL( + TInt aOperationType, + const TDesC8& aOperationParams ); + + /** + * Issues context connection open request to server. + * To be used when binding with settings is + * + * @param aOperationType In parameter identifying the operation. + * @param aOperationParams In parameter package for operation. + * @return Request ID identifying started request. + */ + TXIMPRequestId QueueAsyncConnectionOpen2L( + TInt aOperationType, + const TDesC8& aOperationParams ); + + + /** + * Issues context connection close request to server. + * + * @param aOperationType In parameter identifying the operation. + * @param aOperationParams In parameter package for operation. + * @return Request ID identifying started request. + */ + TXIMPRequestId QueueAsyncConnectionCloseL( + TInt aOperationType, + const TDesC8& aOperationParams ); + + + + /** + * Issues context operation request to server. + * + * @param aOperationType In parameter identifying the operation. + * @param aOperationParams In parameter package for operation. + * @return Request ID identifying started request. + */ + TXIMPRequestId QueueOperationL( + TInt aOperationType, + const TDesC8& aOperationParams ); + + /** + * Gets RXIMPSrvContextClient session. + * If there isn't a valid session, handles + * error by leaving. + * + * @return Valid RXIMPSrvContextClient session. + */ + RXIMPSrvContextClient& EventPumpSessionL(); + + + /** + * Gets RXIMPSrvContextClient session. + * If there isn't a valid session, returns NULL. + * + * @return Valid RXIMPSrvContextClient session. + */ + RXIMPSrvContextClient* EventPumpSession(); + + + + /** + * Gets RXIMPSrvContextClient session. + * If there isn't a valid session, handles + * error by leaving. + * + * @return Valid RXIMPSrvContextClient session. + */ + const RXIMPSrvContextClient& DirectSessionL() const; + + + + /** + * Closes RXIMPSrvContextClient session. + */ + void Close(); + + + /** + * Removes identified request from wait list and + * updates properly the proxy server connection + * status based on the given request completion code. + * + * @param aReqId Request id to drop from wait list. + * @param aCompletionCode Completion code indicating + * how request was completed. + */ + void HandleReqCompleted( TXIMPRequestId aReqId, TInt aCompletionCode ); + + + /** + * Gets topmost request ID from wait list. + * + * @param aReqId On the return contains topmost req id from wait list. + * @return ETrue if the wait list contained elements. + * EFalse if the wait list was empty. + */ + TBool GetTopPendingReq( TXIMPRequestId& aReqId ) const; + + + +private: // Helpers + + TXIMPRequestId DoQueueAsyncOpL( TInt aOperationType, + const TDesC8& aOperationParams, + TXIMPAsyncReqType aReqType ); + + + TXIMPRequestId DoQueueAsyncOp2L( TInt aOperationType, + const TDesC8& aOperationParams, + TXIMPAsyncReqType aReqType ); + + + void UpdateCtxConnectionStatus( TXIMPAsyncReqType aReqType, + TInt aCompletionCode ); + + +private: // data + + /** + * Managed context session to server. + * Own. + */ + RXIMPSrvContextClient iCtxConnection; + + + /** + * Flag to maintain session status. + * Own. + */ + enum TCtxConnectionState { ENotConnected, EInTransition, EConnected }; + TCtxConnectionState iCtxConnectionState; + + /** + * Array to maintain pending clientside requests. + * Own. + */ + CArrayFixSeg< TXIMPAsyncReqEntry > iReqWaitList; + + }; + + +#endif // CXIMPCONTEXTCLIENTPROXY_H diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcfrontend/srcmanager/ximpcontexteventpump.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcfrontend/srcmanager/ximpcontexteventpump.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,416 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Presence context event pump. +* +*/ + +#include "ximpcontexteventpump.h" +#include "ximpcntxteventobsarray.h" +#include "ximpundotask.h" + +#include "ximpcontexteventfilter.h" +#include "ximpsrvcontextclient.h" +#include "ximpapieventbase.h" +#include "ximpeventcodec.h" +#include "ximpcontextclientproxy.h" +#include "ximpobjecthelpers.h" +#include "ximppanics.h" +#include "ximprequestcompleteeventimp.h" +#include "ximpstatusimp.h" +#include "ximpcontextstateeventimp.h" +#include "ximpcontextstateimp.h" + +#include "ximpfeaturepluginholder.h" +#include "apidataobjfactoryaccessor.h" +#include "eventcodec.h" + + +#include +#include + + +// ============================ MEMBER FUNCTIONS ============================= + +// --------------------------------------------------------------------------- +// CXIMPContextEventPump::NewL() +// Instantiate new event pump. +// --------------------------------------------------------------------------- +// +CXIMPContextEventPump* CXIMPContextEventPump::NewL( + MXIMPContext& aCntxtInterface, + CXIMPContextClientProxy& aContextProxy ) + { + CXIMPContextEventPump* self; + self = new( ELeave ) CXIMPContextEventPump( aCntxtInterface, + aContextProxy ); + + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + + return self; + } + + +// --------------------------------------------------------------------------- +// CXIMPContextEventPump::~CXIMPContextEventPump() +// Destroy the event pump. +// Cancels possibly pending asynhronous requests. +// --------------------------------------------------------------------------- +// +CXIMPContextEventPump::~CXIMPContextEventPump() + { + Cancel(); + delete iObservers; + delete iSpareReqCompleteEvent; + delete iSpareCtxStateEvent; + + FeaturePluginHolder::Release(); + } + + +// --------------------------------------------------------------------------- +// CXIMPContextEventPump::CXIMPContextEventPump() +// --------------------------------------------------------------------------- +// +CXIMPContextEventPump::CXIMPContextEventPump( + MXIMPContext& aCntxtInterface, + CXIMPContextClientProxy& aContextProxy ) + : CActive(CActive::EPriorityStandard), + iCntxtInterface( aCntxtInterface ), + iCtxClientProxy( &aContextProxy ) + { + CActiveScheduler::Add( this ); + } + + +// --------------------------------------------------------------------------- +// CXIMPContextEventPump::ConstructL() +// --------------------------------------------------------------------------- +// +void CXIMPContextEventPump::ConstructL() + { + iObservers = CXIMPCntxtEventObsArray::NewL(); + + + iSpareReqCompleteEvent = CXIMPRequestCompleteEventImp::NewL(); + iSpareReqCompleteEvent->CompletionResultImp().SetProtocolResultDescriptionL( KNullDesC ); + iSpareReqCompleteEvent->CompletionResultImp().SetProtocolResultCode( KErrNone ); + + + iSpareCtxStateEvent = CXIMPContextStateEventImp::NewL(); + + CXIMPStatusImp* status = CXIMPStatusImp::NewLC(); + status->SetProtocolResultDescriptionL( KNullDesC ); + status->SetProtocolResultCode( KErrNone ); + + iSpareCtxStateEvent->SetStateChangeReasonImp( status ); + CleanupStack::Pop( status ); + + // Initialize the datamodel's feature plugin holder. + // That stores the different internal IF accessor as global data + FeaturePluginHolder::InitializeL(); + } + + +// --------------------------------------------------------------------------- +// CXIMPContextEventPump::RegisterObserverL() +// Reqisters new event observer. +// --------------------------------------------------------------------------- +// +void CXIMPContextEventPump::RegisterObserverL( + MXIMPContextObserver& aObserver, + const TArray< TInt32 >* aEventFilter ) + { + MXIMPUndoTask* undo = NULL; + + if( iObservers->IsReqistered( aObserver ) ) + { + //Update existing observer with new filter. UpdateObserverLC() + //returns undoTask object that will undo the observer update + //if there happens a leave before undo->CancelUndo() call. + undo = iObservers->UpdateObserverLC( aObserver, aEventFilter ); + } + else + { + //Add new event observer. AddObserverLC() returns undoTask object + //that will undo the adding of new entry if there happens a leave before + //undo->CancelUndo() call. + undo = iObservers->AddObserverLC( aObserver, aEventFilter ); + } + + //Collect event filter from observers + CXIMPContextEventFilter* filter = iObservers->CollectEventFilterLC(); + + + //Update the event filter to the server side. + //Update is done everytime when observer is registered + //since filter isn't updated when observer is removed + TryInstallEventFilterL( *filter ); + + //Issue event request to server side + TryRefreshEventRequest(); + + CleanupStack::PopAndDestroy( filter ); + + undo->CancelUndo(); + CleanupStack::PopAndDestroy(); //undo + } + + +// --------------------------------------------------------------------------- +// CXIMPContextEventPump::UnRegisterObserver() +// Unreqisters event observer. +// --------------------------------------------------------------------------- +// +void CXIMPContextEventPump::UnRegisterObserver( + MXIMPContextObserver& aObserver ) + { + //To simplify logic, event types are not unregistered here + //but on the next time when the new observer is registered + //and cobined event filer is rebuild + iObservers->RemoveObserver( aObserver ); + + if( iObservers->HasObservers() ) + { + Cancel(); + } + } + + +// --------------------------------------------------------------------------- +// CXIMPContextEventPump::StartEventPumpLC() +// --------------------------------------------------------------------------- +// +void CXIMPContextEventPump::StartEventPumpLC() + { + CleanupClosePushL( *this ); + + CXIMPContextEventFilter* filter = iObservers->CollectEventFilterLC(); + TryInstallEventFilterL( *filter ); + CleanupStack::PopAndDestroy( filter ); + + TryRefreshEventRequest(); + } + + + +// --------------------------------------------------------------------------- +// CXIMPContextEventPump::Close() +// --------------------------------------------------------------------------- +// +void CXIMPContextEventPump::Close() + { + Cancel(); + } + + + +// ----------------------------------------------------------------------------- +// CXIMPContextEventPump::RunL() +// +// Handles one and only one event from XIMP server side event queue. +// (Only one event is handled in one EventPump RunL() round.) +// Steps: +// 1. Retrieve event data from server to client side +// 2. Convert event data to concrete event object +// 3. Delete the event data from server side +// 4. Dispatch event to observers +// 5. Request new event notification (Request must be issued after event +// dispatch, because concrete observer may start nested active scheduler +// loop, and it could cause re-entrance to EventPump::RunL()) +// ----------------------------------------------------------------------------- +// +void CXIMPContextEventPump::RunL() + { + TInt status ( iStatus.Int() ); + User::LeaveIfError( status ); + + + HBufC8* eventData = iCtxClientProxy->EventPumpSessionL().FetchTopEventDataLC(); + TInt32 typeOfEvent; + CXIMPApiEventBase* eventObject = XIMPEventCodec::UnPackL( *eventData, + typeOfEvent ); + + MApiDataObjFactoryAccessor* presenceObjFactoryAcc = FeaturePluginHolder::PresenceObjFactoryAccessor(); + if ( !eventObject && presenceObjFactoryAcc ) + { + // Try to create presence event + eventObject = presenceObjFactoryAcc->EventCodec().UnPackL( *eventData, + typeOfEvent ); + } + + if ( !eventObject ) + { + TInt accesorCount = FeaturePluginHolder::AccessorCount() ; + for (TInt i=0; iEventCodec().UnPackL( *eventData, + typeOfEvent ); + if(eventObject) + { + break ; + } + } + } + } + + + + // Check whether have received an unknown event + __ASSERT_ALWAYS( eventObject, + User::Panic( _L("XIMPContextEventPump"), KErrUnknown ) ); + + CleanupStack::PopAndDestroy(); //eventData + CleanupStack::PushL( eventObject ); + + User::LeaveIfError( iCtxClientProxy->EventPumpSessionL().DropTopEvent() ); + if( eventObject->Base().GetInterfaceId() == MXIMPRequestCompleteEvent::KInterfaceId ) + { + const MXIMPRequestCompleteEvent* complEvent = + TXIMPGetInterface< const MXIMPRequestCompleteEvent >::From( eventObject->Base(), + MXIMPBase::EPanicIfUnknown ); + + iCtxClientProxy->HandleReqCompleted( complEvent->RequestId(), + complEvent->CompletionResult().ResultCode() ); + } + + iObservers->DeliverEvent( iCntxtInterface, eventObject->Base() ); + CleanupStack::PopAndDestroy( eventObject ); + + TryRefreshEventRequest(); + } + + +// ----------------------------------------------------------------------------- +// CXIMPContextEventPump::RunError() +// +// Handle leave from CXIMPContextEventPump::RunL() +// by restarting the event request. +// ----------------------------------------------------------------------------- +// +TInt CXIMPContextEventPump::RunError( TInt aError ) + { + if( aError == KErrServerTerminated ) + { + //Server has died. + //Complete all pending client requests with KErrServerTerminated + //and unbind the client context. + + //Note: This should be perhaps splitted to asynhronous steps + //to follow general paradigm of XIMP observer callbacks. + //Also Ctx state events should be properly indicated to client + //(Now they are notified after possible Bind() completion notification) + + TXIMPRequestId reqId; + while( iCtxClientProxy->GetTopPendingReq( reqId ) ) + { + iSpareReqCompleteEvent->SetRequestId( reqId ); + iSpareReqCompleteEvent->CompletionResultImp().SetResultCode( aError ); + + iObservers->DeliverEvent( iCntxtInterface, *iSpareReqCompleteEvent ); + + iCtxClientProxy->HandleReqCompleted( iSpareReqCompleteEvent->RequestId(), + iSpareReqCompleteEvent->CompletionResult().ResultCode() ); + } + + iSpareCtxStateEvent->StateChangeReasonImp()->SetResultCode( aError ); + iSpareCtxStateEvent->ContextStateImp().SetStateValue( MXIMPContextState::EInactive ); + iObservers->DeliverEvent( iCntxtInterface, *iSpareCtxStateEvent ); + } + + else + { + //If it was a RequestComplete event, which handling failed here + //on the client side, here is manufactured artificially matching + //completion event to notify failure to client + + __ASSERT_ALWAYS( iCtxClientProxy->EventPumpSession(), + User::Panic( NXIMPPrivPanic::KCategory, + NXIMPPrivPanic::EFrontEndEventPumpNoServerClient ) ); + + + TXIMPRequestId reqId = TXIMPRequestId::Null(); + + iCtxClientProxy->EventPumpSession()->FetchTopEventReqId( reqId ); + iCtxClientProxy->EventPumpSession()->DropTopEvent(); + + if( reqId != TXIMPRequestId::Null() ) + { + iSpareReqCompleteEvent->SetRequestId( reqId ); + iSpareReqCompleteEvent->CompletionResultImp().SetResultCode( aError ); + + iObservers->DeliverEvent( iCntxtInterface, *iSpareReqCompleteEvent ); + + iCtxClientProxy->HandleReqCompleted( iSpareReqCompleteEvent->RequestId(), + iSpareReqCompleteEvent->CompletionResult().ResultCode() ); + } + + TryRefreshEventRequest(); + } + + return KErrNone; + } + + +// ----------------------------------------------------------------------------- +// CXIMPContextEventPump::DoCancel() +// ----------------------------------------------------------------------------- +// +void CXIMPContextEventPump::DoCancel() + { + __ASSERT_ALWAYS( iCtxClientProxy->EventPumpSession(), + User::Panic( NXIMPPrivPanic::KCategory, + NXIMPPrivPanic::EFrontEndEventPumpNoServerClient ) ); + + //Eventpump is stopping. + //Cancel pending event notification request + iCtxClientProxy->EventPumpSession()->CancelListening(); + } + + +// ----------------------------------------------------------------------------- +// CXIMPContextEventPump::TryRefreshEventRequest() +// ----------------------------------------------------------------------------- +// +void CXIMPContextEventPump::TryRefreshEventRequest() + { + if( !IsActive() && + iObservers->HasObservers() && + iCtxClientProxy->EventPumpSession() ) + { + iCtxClientProxy->EventPumpSession()->ListenEvent( iStatus ); + SetActive(); + } + } + + +// ----------------------------------------------------------------------------- +// CXIMPContextEventPump::TryInstallEventFilterL() +// ----------------------------------------------------------------------------- +// +void CXIMPContextEventPump::TryInstallEventFilterL( + const CXIMPContextEventFilter& aFilter ) + { + if( iCtxClientProxy->EventPumpSession() ) + { + HBufC8* pack = TXIMPObjectPacker::PackL( aFilter ); + CleanupStack::PushL( pack ); + iCtxClientProxy->EventPumpSession()->InstallEventFilterL( *pack ); + CleanupStack::PopAndDestroy( pack ); + } + } diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcfrontend/srcmanager/ximpcontexteventpump.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcfrontend/srcmanager/ximpcontexteventpump.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,170 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Presence context event pump. +* +*/ + +#ifndef CXIMPPRESENCECONTEXTEVENTPUMP_H +#define CXIMPPRESENCECONTEXTEVENTPUMP_H + +#include "ximpcontexteventpump.h" +#include + + +class MXIMPContext; +class MXIMPContextObserver; +class CXIMPContextClientProxy; +class CXIMPCntxtEventObsArray; +class CXIMPContextEventFilter; +class CXIMPRequestCompleteEventImp; +class CXIMPContextStateEventImp; +class MApiDataObjFactoryAccessor; + +/** + * Presence context event pump. + * + * @lib ximpmanager.dll + * @since S60 v3.2 + */ +NONSHARABLE_CLASS( CXIMPContextEventPump ) + : public CActive + { +public: + + + static CXIMPContextEventPump* NewL( MXIMPContext& aCntxtInterface, + CXIMPContextClientProxy& aContextProxy ); + virtual ~CXIMPContextEventPump(); + +private: + + CXIMPContextEventPump( MXIMPContext& aCntxtInterface, + CXIMPContextClientProxy& aContextProxy ); + void ConstructL(); + + + + +public: + + + /** + * Registers observer with event type filter. + * + * Combines event type filter from so far + * registered observers and installs filter + * to server if there exists a valid server connection. + * + * @param aObserver The observer to notify from presence events. + * @param aEventFilter Event filter array for limiting accepted events. + */ + void RegisterObserverL( MXIMPContextObserver& aObserver, + const TArray< TInt32 >* aEventFilter ); + + /** + * Unregisters observer. + * + * @param aObserver The observer to unregister. + */ + void UnRegisterObserver( MXIMPContextObserver& aObserver ); + + + /** + * Combines event type filter from so far registered + * observers and installs filter to server. + */ + void StartEventPumpLC(); + + + /** + * Stops event pump from pumping events. + */ + void Close(); + + + +public: // From CActive + + /** + * Handles an active object’s request completion event. + * Gets event data from server side and notifies observers. + */ + void RunL(); + + + /** + * Handles a leave occurring in the RunL(). + * + * @param aError The leave code from RunL(). + * @return Always KErrNone. + */ + TInt RunError( TInt aError ); + + + /** + * Implements cancellation of an outstanding request. + * This function is called as part of the active object’s Cancel(). + */ + void DoCancel(); + + +private: + + void TryRefreshEventRequest(); + void TryInstallEventFilterL( const CXIMPContextEventFilter& aFilter ); + + + +private: // data + + + + /** + * Client interface for event notify. + * Not own. + */ + MXIMPContext& iCntxtInterface; + + + /** + * Context client for getting events. + * Not own. + */ + CXIMPContextClientProxy* iCtxClientProxy; + + + /** + * Array of observers. + * Own. + */ + CXIMPCntxtEventObsArray* iObservers; + + + /** + * Spare req complete event. + * Own. + */ + CXIMPRequestCompleteEventImp* iSpareReqCompleteEvent; + + + /** + * Spare ctx state change event. + * Own. + */ + CXIMPContextStateEventImp* iSpareCtxStateEvent; + + }; + + +#endif // CXIMPPRESENCECONTEXTEVENTPUMP_H diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcfrontend/srcmanager/ximpcontextimp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcfrontend/srcmanager/ximpcontextimp.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,418 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of MXIMPContext + * +*/ + +#include "ximpcontextimp.h" +#include "ximpcontexteventpump.h" +#include "ximpserviceinfoimp.h" +#include "ximpfeatureinfoimp.h" +#include "ximpobjecthelpers.h" +#include "ximpoperationdefs.h" + +#include "ximpobjectfactoryimp.h" + +#include "ximpcontextclientinfoimp.h" +#include "ximpidentityimp.h" +#include "ximpcontextclientproxy.h" + + +_LIT( KZeroId, "0" ); + +// ============================ MEMBER FUNCTIONS ============================= + +// --------------------------------------------------------------------------- +// CXIMPContextImp::NewLC() +// --------------------------------------------------------------------------- +// +CXIMPContextImp* CXIMPContextImp::NewLC() + { + CXIMPContextImp* self = new( ELeave ) CXIMPContextImp; + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + +// --------------------------------------------------------------------------- +// Implement supported interface access. +// --------------------------------------------------------------------------- +// +XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CXIMPContextImp, + MXIMPContext ) + +XIMPIMP_IF_BASE_GET_INTERFACE(MXIMPContextInternal, this) + +XIMPIMP_IF_BASE_GET_INTERFACE_END() + + +XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CXIMPContextImp, + MXIMPContext ) +XIMPIMP_IF_BASE_GET_CONST_INTERFACE(MXIMPContextInternal, this) + +XIMPIMP_IF_BASE_GET_INTERFACE_END() + +// --------------------------------------------------------------------------- +// CXIMPContextImp::~CXIMPContextImp() +// --------------------------------------------------------------------------- +// +CXIMPContextImp::~CXIMPContextImp() + { + delete iObjFactory; + delete iEventPump; + delete iCtxProxy; + } + + +// --------------------------------------------------------------------------- +// CXIMPContextImp::CXIMPContextImp() +// --------------------------------------------------------------------------- +// +CXIMPContextImp::CXIMPContextImp() + { + } + + +// --------------------------------------------------------------------------- +// CXIMPContextImp::ConstructL() +// --------------------------------------------------------------------------- +// +void CXIMPContextImp::ConstructL() + { + iCtxProxy = new ( ELeave ) CXIMPContextClientProxy; + iEventPump = CXIMPContextEventPump::NewL( *this, *iCtxProxy ); + iObjFactory = CXIMPObjectFactoryImp::NewL(); + } + +// --------------------------------------------------------------------------- +// CXIMPContextImp::RegisterObserverL() +// --------------------------------------------------------------------------- +// +void CXIMPContextImp::RegisterObserverL( + MXIMPContextObserver& aObserver, + const TArray< TInt32 >* aEventFilter ) + { + iEventPump->RegisterObserverL( aObserver, aEventFilter ); + } + + +// --------------------------------------------------------------------------- +// CXIMPContextImp::UnregisterObserver() +// --------------------------------------------------------------------------- +// +void CXIMPContextImp::UnregisterObserver( + MXIMPContextObserver& aObserver ) + { + iEventPump->UnRegisterObserver( aObserver ); + } + + +// --------------------------------------------------------------------------- +// CXIMPContextImp::BindToL() +// --------------------------------------------------------------------------- +// +TXIMPRequestId CXIMPContextImp::BindToL( + TUid aProtocolImpUid, + const TDesC16& aServiceAddress, + const TDesC16& aUsername, + const TDesC16& aPassword, + TInt32 aIapId ) + + { + //Setup context connection + + return BindToL( aProtocolImpUid, + aServiceAddress, + aUsername, + aPassword, + KZeroId, + aIapId ); + + } + +// --------------------------------------------------------------------------- +// CXIMPContextImp::BindToL() +// --------------------------------------------------------------------------- +// +TXIMPRequestId CXIMPContextImp::BindToL( + TUid aProtocolImpUid, + const TDesC16& aServiceAddress, + const TDesC16& aUsername, + const TDesC16& aPassword, + const TDesC16& aClientId, + TInt32 aIapId ) + + { + //Setup context connection + iCtxProxy->InitServerSessionLC( aProtocolImpUid ); //Pushes session close + iEventPump->StartEventPumpLC(); //Pushes pump close + + + //Combine bind parameters and issue request + CXIMPServiceInfoImp* serviceInfo = CXIMPServiceInfoImp::NewLC( aProtocolImpUid, + aServiceAddress, + aUsername, + aPassword, + aIapId ); + + + CXIMPContextClientInfoImp* clientInfo = CXIMPContextClientInfoImp::NewLC(); + { + CXIMPIdentityImp* identity = CXIMPIdentityImp::NewLC(); + identity->SetIdentityL( aClientId ); + clientInfo->SetClientIdL( identity ); + CleanupStack::Pop( identity ); + } + + + HBufC8* packBufDesc = NULL; + { + CBufFlat* packBuf = CBufFlat::NewL( KObjectBufGranurality ); + CleanupStack::PushL( packBuf ); + + RBufWriteStream ws; + ws.Open( *packBuf ); // CSI: 65 # + CleanupClosePushL( ws ); + + serviceInfo->ExternalizeL( ws ); + clientInfo->ExternalizeL( ws ); + + ws.CommitL(); + CleanupStack::PopAndDestroy(); //ws + + packBufDesc = packBuf->Ptr(0).AllocL(); + CleanupStack::PopAndDestroy( packBuf ); + } + + CleanupStack::PushL( packBufDesc ); + + TXIMPRequestId reqId = iCtxProxy->QueueAsyncConnectionOpenL( NXIMPOps::EXIMPBindContext, + *packBufDesc ); + + CleanupStack::PopAndDestroy( packBufDesc ); + CleanupStack::PopAndDestroy( clientInfo ); + CleanupStack::PopAndDestroy( serviceInfo ); + + + CleanupStack::Pop(); //Pop the pump close + CleanupStack::Pop(); //Pop the session close + + return reqId; + } + + +// --------------------------------------------------------------------------- +// CXIMPContextImp::BindToL() +// --------------------------------------------------------------------------- +// +TXIMPRequestId CXIMPContextImp::BindToL( + TUid aProtocolImpUid, + TInt aSettingsId ) + + { + //Setup context connection + iCtxProxy->InitServerSessionLC( aProtocolImpUid ); //Pushes session close + iEventPump->StartEventPumpLC(); //Pushes pump close + + + //Combine bind parameters and issue request + CXIMPServiceInfoImp* serviceInfo = CXIMPServiceInfoImp::NewLC( aProtocolImpUid, + KNullDesC, + KNullDesC, + KNullDesC, + aSettingsId ); + + CXIMPContextClientInfoImp* clientInfo = CXIMPContextClientInfoImp::NewLC(); + { + CXIMPIdentityImp* identity = CXIMPIdentityImp::NewLC(); + identity->SetIdentityL( KZeroId ); + clientInfo->SetClientIdL( identity ); + CleanupStack::Pop( identity ); + } + + + HBufC8* packBufDesc = NULL; + { + CBufFlat* packBuf = CBufFlat::NewL( KObjectBufGranurality ); + CleanupStack::PushL( packBuf ); + + RBufWriteStream ws; + ws.Open( *packBuf ); // CSI: 65 # + CleanupClosePushL( ws ); + + serviceInfo->ExternalizeL( ws ); + clientInfo->ExternalizeL( ws ); + + ws.CommitL(); + CleanupStack::PopAndDestroy(); //ws + + packBufDesc = packBuf->Ptr(0).AllocL(); + CleanupStack::PopAndDestroy( packBuf ); + } + + CleanupStack::PushL( packBufDesc ); + + TXIMPRequestId reqId = iCtxProxy->QueueAsyncConnectionOpen2L( NXIMPOps::EXIMPBindContext2, + *packBufDesc ); + + CleanupStack::PopAndDestroy( packBufDesc ); + CleanupStack::PopAndDestroy( clientInfo ); + CleanupStack::PopAndDestroy( serviceInfo ); + + + CleanupStack::Pop(); //Pop the pump close + CleanupStack::Pop(); //Pop the session close + + return reqId; + } + +// --------------------------------------------------------------------------- +// CXIMPContextImp::BindToL() +// --------------------------------------------------------------------------- +// + TXIMPRequestId CXIMPContextImp::BindToL( TUid aProtocolImpUid, + const TDesC16& aUsername, + const TDesC16& aPassword, + TInt aSettingsId ) + { + //Setup context connection + iCtxProxy->InitServerSessionLC( aProtocolImpUid ); //Pushes session close + iEventPump->StartEventPumpLC(); //Pushes pump close + + + //Combine bind parameters and issue request + CXIMPServiceInfoImp* serviceInfo = CXIMPServiceInfoImp::NewLC( aProtocolImpUid, + KNullDesC, + aUsername, + aPassword, + aSettingsId ); + + CXIMPContextClientInfoImp* clientInfo = CXIMPContextClientInfoImp::NewLC(); + { + CXIMPIdentityImp* identity = CXIMPIdentityImp::NewLC(); + identity->SetIdentityL( KZeroId ); + clientInfo->SetClientIdL( identity ); + CleanupStack::Pop( identity ); + } + + + HBufC8* packBufDesc = NULL; + { + CBufFlat* packBuf = CBufFlat::NewL( KObjectBufGranurality ); + CleanupStack::PushL( packBuf ); + + RBufWriteStream ws; + ws.Open( *packBuf ); // CSI: 65 # + CleanupClosePushL( ws ); + + serviceInfo->ExternalizeL( ws ); + clientInfo->ExternalizeL( ws ); + + ws.CommitL(); + CleanupStack::PopAndDestroy(); //ws + + packBufDesc = packBuf->Ptr(0).AllocL(); + CleanupStack::PopAndDestroy( packBuf ); + } + + CleanupStack::PushL( packBufDesc ); + + TXIMPRequestId reqId = iCtxProxy->QueueAsyncConnectionOpenL( NXIMPOps::EXIMPBindContext2, + *packBufDesc ); + + CleanupStack::PopAndDestroy( packBufDesc ); + CleanupStack::PopAndDestroy( clientInfo ); + CleanupStack::PopAndDestroy( serviceInfo ); + + + CleanupStack::Pop(); //Pop the pump close + CleanupStack::Pop(); //Pop the session close + + return reqId; + } +// --------------------------------------------------------------------------- +// CXIMPContextImp::UnbindL() +// --------------------------------------------------------------------------- +// +TXIMPRequestId CXIMPContextImp::UnbindL() + { + return iCtxProxy->QueueAsyncConnectionCloseL( NXIMPOps::EXIMPUnbindContext, + KNullDesC8 ); + } + + +// --------------------------------------------------------------------------- +// CXIMPContextImp::GetContextFeaturesLC() +// --------------------------------------------------------------------------- +// +MXIMPFeatureInfo* CXIMPContextImp::GetContextFeaturesLC() const + { + CXIMPFeatureInfoImp* features = CXIMPFeatureInfoImp::NewLC(); + + HBufC8* featurePck = iCtxProxy->DirectSessionL().GetContextFeaturesL(); + CleanupStack::PushL( featurePck ); + TXIMPObjectPacker::UnPackL( *features, *featurePck ); + CleanupStack::PopAndDestroy( featurePck ); + + return features; + } + + +// --------------------------------------------------------------------------- +// CXIMPContextImp::ObjectFactory() +// --------------------------------------------------------------------------- +// +MXIMPObjectFactory& CXIMPContextImp::ObjectFactory() const + { + return *iObjFactory; + } + + +// --------------------------------------------------------------------------- +// CXIMPContextImp::ObjectFactory() +// --------------------------------------------------------------------------- +// +TXIMPRequestId CXIMPContextImp::QueueOperationL( TInt aOperationType, + const TDesC8& aOperationParams ) + { + return iCtxProxy->QueueOperationL(aOperationType, aOperationParams ); + } + +// --------------------------------------------------------------------------- +// CXIMPContextImp::ConvertStringToUidL() +// --------------------------------------------------------------------------- +// +void CXIMPContextImp::ConvertStringToUidL( const TDesC8& aData, + TUid& aUid ) + { + // Make sure aData is in the correct format - "0x12345678" + _LIT8(K0x, "0x"); + _LIT8(K0X, "0X"); + + if( (aData.Length() == 10) && + ( (aData.FindF( K0x ) == 0) || ( aData.FindF( K0X ) == 0 ) ) ) + { + // only take the right 8 characters (ie discard the "0x") + TLex8 lex( aData.Right( 8 ) ); + TUint32 value = 0; + User::LeaveIfError( lex.Val( value, EHex ) ); + aUid.iUid = value; + } + else + { + User::Leave( KErrCorrupt ); + } + } + + diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcfrontend/srcmanager/ximpcontextimp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcfrontend/srcmanager/ximpcontextimp.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,140 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of MXIMPContext +* +*/ + +#ifndef CXIMPPRESENCECONTEXTIMP_H +#define CXIMPPRESENCECONTEXTIMP_H + +#include +#include "ximpcontextinternal.h" + +#include "ximpapiobjbase.h" + + +class MXIMPContextObserver; +class CXIMPContextEventPump; +class MXIMPFeatureInfo; +class CXIMPObjectFactoryImp; +class CXIMPContextClientProxy; + + +/** + * MXIMPContext API object implementation. + * + * @lib ximpmanager.dll + * @since S60 v3.2 + */ +NONSHARABLE_CLASS( CXIMPContextImp ): public CXIMPApiObjBase, + public MXIMPContext, + public MXIMPContextInternal + { + public: + /** The class ID. */ + enum { KClassId = XIMPIMP_CLSID_CXIMPCONTEXTIMP }; + + +public: + + static CXIMPContextImp* NewLC(); + virtual ~CXIMPContextImp(); + + +private: + + CXIMPContextImp(); + void ConstructL(); + + +public: // From MXIMPBase + + /** + * Implementation of MXIMPBase interface methods + * @see MXIMPBase + */ + XIMPIMP_DECLARE_IF_BASE_METHODS + + +public: //From MXIMPContext + + /** + * Implementation of MXIMPContext interface methods + * @see MXIMPContext + */ + void RegisterObserverL( MXIMPContextObserver& aObserver, + const TArray* aEventFilter ); + + void UnregisterObserver( MXIMPContextObserver& aObserver ); + + TXIMPRequestId BindToL( TUid aProtocolImpUid, + const TDesC16& aServiceAddress, + const TDesC16& aUsername, + const TDesC16& aPassword, + TInt32 aIapId ); + TXIMPRequestId BindToL( TUid aProtocolImpUid, + const TDesC16& aServiceAddress, + const TDesC16& aUsername, + const TDesC16& aPassword, + const TDesC16& aClientId, + TInt32 aIapId ); + TXIMPRequestId BindToL( TUid aProtocolImpUid, + TInt aSettingsId ); + TXIMPRequestId BindToL( TUid aProtocolImpUid, + const TDesC16& aUsername, + const TDesC16& aPassword, + TInt aSettingsId ) ; + + TXIMPRequestId UnbindL(); + + MXIMPFeatureInfo* GetContextFeaturesLC() const; + + MXIMPObjectFactory& ObjectFactory() const; + +public: // From MXIMPContextInternal + + TXIMPRequestId QueueOperationL( TInt aOperationType, + const TDesC8& aOperationParams ); + + +private: // Helpers + + /** + * Converts a string to a uid. + * String must be in Hex and begin with "0x". + */ + void ConvertStringToUidL( const TDesC8& aData, TUid& aUid ); + + +private: // data + + /** + * Context session proxy for having a connection context server. + */ + CXIMPContextClientProxy* iCtxProxy; + + /** + * Object factory sub interface. + */ + CXIMPObjectFactoryImp* iObjFactory; + + /** + * Event pump. + * Own. + */ + CXIMPContextEventPump* iEventPump; + }; + + +#endif // CXIMPPRESENCECONTEXTIMP_H diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcfrontend/srcmanager/ximpundotask.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcfrontend/srcmanager/ximpundotask.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,226 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: UndoTask related helpers. +* +*/ + +#ifndef XIMPUNDOTASK_H +#define XIMPUNDOTASK_H + +#include + + +/** + * Abstract UndoTask object interface. + * UndoTask object encapsulates data and logic + * needed to perform the undo operation. + * + * Concrete UndoTasks perform the desired undo operation + * on its desctructor. So the concrete UndoTask object + * can be pushed on the cleanupstack to have the undo + * performed automaticly in case of leave. + * + * If undo operation should not be performed on destruction, + * it should be canceled with CancelUndo(). However, + * the undo object needs still to be deleted or + * PopAndDestroy():ed. + * + * @since S60 v3.2 + */ +class MXIMPUndoTask + { + +public: + + /** + * Cancels the undo operation. + * + * When called, undo isn't performed on + * destcruction. + */ + virtual void CancelUndo() = 0; + + + /** + * Public destructor. + * Object instancies can be deleted via this interface. + * + * Destruction performs the desired undo operation, + * unless it has been previously canceled. + */ + virtual ~MXIMPUndoTask() {} + }; + + + + + +/** + * Templated UndoTask to perform entry removal from + * pointer array. + * + * @since S60 v3.2 + */ +template< class T > +class CXIMPUndoPtrArrayEntryAdd : public CBase, + public MXIMPUndoTask + { +public: + + /** + * Constructor to allocate new undo + * task object. + */ + inline static CXIMPUndoPtrArrayEntryAdd* NewLC(); + + + /** + * Destructor. + * + * Destruction performs the undo operation, + * unless it has been previously canceled. + */ + inline ~CXIMPUndoPtrArrayEntryAdd(); + + +private: + inline CXIMPUndoPtrArrayEntryAdd(); + + +public: + + /** + * Initializes the undo operation to remove and destroy + * given object from given object array. + * + * @param aObj Templated object to remove. + * @param aObjArray Templated object array from which + * to remove. + */ + inline void InitToRemoveAndDestroyOnUndo( T& aObj, + RPointerArray< T >& aObjArray ); + + /** + * Cancels the initialized undo operation. + */ + inline void CancelUndo(); + + +private: // data + + /** + * Pointer to RPointerArray from where to remove the entry. + * Not own. + */ + RPointerArray< T >* iObjArray; + + + /** + * Pointer to entry which to remove from the array. + * + * Object is removed from the array and deleted + * when this undo object is destroyed. + */ + T* iObj; + }; + + + + + + +/** + * Templated UndoTask to perform entry replace on + * pointer array. + * + * @since S60 v4.0 + */ +template< class T > +class CXIMPUndoPtrArrayEntryReplace : public CBase, + public MXIMPUndoTask + { +public: + + /** + * Constructor to allocate new undo + * task object. + */ + inline static CXIMPUndoPtrArrayEntryReplace* NewLC(); + + + /** + * Destructor. + * + * Destruction performs the undo operation, + * unless it has been previously canceled. + */ + inline ~CXIMPUndoPtrArrayEntryReplace(); + + +private: + inline CXIMPUndoPtrArrayEntryReplace(); + + +public: + + /** + * Initializes the undo operation to remove and destroy + * given object from given object array. + * + * @param aTarget Templated object which to replace. + * @param aObjArray Templated object array on which to replace. + * @param aSource Templated object which to insert. + */ + inline void InitToReplaceOnUndo( T& aTarget, + RPointerArray< T >& aObjArray, + T& aSource ); + + /** + * Cancels the initialized undo operation. + */ + inline void CancelUndo(); + + +private: // data + + /** + * Pointer to RPointerArray from where to replace the entry. + * Not own. + */ + RPointerArray< T >* iObjArray; + + + /** + * Pointer to entry which to replace on the the array. + * Object is deleted and replaced with source object + * when this undo object is destroyed. + */ + T* iTarget; + + + /** + * Pointer to entry which to insert on the the array. + * + * Object is deleted when undo is canceled. + */ + T* iSource; + + }; + + +#include "ximpundotask.inl" + +#endif // XIMPUNDOTASK_H + + diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcfrontend/srcmanager/ximpundotask.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcfrontend/srcmanager/ximpundotask.inl Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,182 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: UndoTask related helpers. +* +*/ + +#include "ximppanics.h" + + +// ============================ MEMBER FUNCTIONS ============================= + +// --------------------------------------------------------------------------- +// CXIMPUndoPtrArrayEntryAdd::NewLC() +// --------------------------------------------------------------------------- +// +template< class T > +CXIMPUndoPtrArrayEntryAdd* CXIMPUndoPtrArrayEntryAdd::NewLC() + { + CXIMPUndoPtrArrayEntryAdd* self = new (ELeave) CXIMPUndoPtrArrayEntryAdd; + CleanupStack::PushL( self ); + return self; + } + + +// --------------------------------------------------------------------------- +// CXIMPUndoPtrArrayEntryAdd::~CXIMPUndoPtrArrayEntryAdd() +// --------------------------------------------------------------------------- +// +template< class T > +CXIMPUndoPtrArrayEntryAdd::~CXIMPUndoPtrArrayEntryAdd() + { + if( iObjArray ) + { + TInt index = iObjArray->Find( iObj ); + if( index != KErrNotFound ) + { + iObjArray->Remove( index ); + } + + delete iObj; + } + } + + +// --------------------------------------------------------------------------- +// CXIMPUndoPtrArrayEntryAdd::CXIMPUndoPtrArrayEntryAdd() +// --------------------------------------------------------------------------- +// +template< class T > +CXIMPUndoPtrArrayEntryAdd::CXIMPUndoPtrArrayEntryAdd() + { + } + + +// --------------------------------------------------------------------------- +// CXIMPUndoPtrArrayEntryAdd::InitToRemoveAndDestroyOnUndo() +// --------------------------------------------------------------------------- +// +template< class T > +void CXIMPUndoPtrArrayEntryAdd::InitToRemoveAndDestroyOnUndo( + T& aObj, + RPointerArray< T >& aObjArray ) + { + __ASSERT_ALWAYS( !iObjArray, + User::Panic( NXIMPPrivPanic::KCategory, + NXIMPPrivPanic::EPtrArrayEntryAddUndoInitialized ) ); + + iObjArray = &aObjArray; + iObj = &aObj; + } + + +// --------------------------------------------------------------------------- +// CXIMPUndoPtrArrayEntryAdd::CancelUndo() +// --------------------------------------------------------------------------- +// +template< class T > +void CXIMPUndoPtrArrayEntryAdd::CancelUndo() + { + iObjArray = NULL; + iObj = NULL; + } + + + + +// ============================ MEMBER FUNCTIONS ============================= + +// --------------------------------------------------------------------------- +// CXIMPUndoPtrArrayEntryReplace::NewLC() +// --------------------------------------------------------------------------- +// +template< class T > +CXIMPUndoPtrArrayEntryReplace* CXIMPUndoPtrArrayEntryReplace::NewLC() + { + CXIMPUndoPtrArrayEntryReplace* self = + new (ELeave) CXIMPUndoPtrArrayEntryReplace; + CleanupStack::PushL( self ); + return self; + } + + +// --------------------------------------------------------------------------- +// CXIMPUndoPtrArrayEntryReplace::~CXIMPUndoPtrArrayEntryReplace() +// --------------------------------------------------------------------------- +// +template< class T > +CXIMPUndoPtrArrayEntryReplace::~CXIMPUndoPtrArrayEntryReplace() + { + if( iObjArray ) + { + const TInt index = iObjArray->Find( iTarget ); + if( index != KErrNotFound ) + { + (*iObjArray)[ index ] = iSource; + delete iTarget; + } + else + { + delete iSource; + } + } + } + + +// --------------------------------------------------------------------------- +// CXIMPUndoPtrArrayEntryReplace::CXIMPUndoPtrArrayEntryReplace() +// --------------------------------------------------------------------------- +// +template< class T > +CXIMPUndoPtrArrayEntryReplace::CXIMPUndoPtrArrayEntryReplace() + { + } + + +// --------------------------------------------------------------------------- +// CXIMPUndoPtrArrayEntryReplace::InitToReplaceOnUndo() +// --------------------------------------------------------------------------- +// +template< class T > +void CXIMPUndoPtrArrayEntryReplace::InitToReplaceOnUndo( + T& aTarget, + RPointerArray< T >& aObjArray, + T& aSource ) + { + __ASSERT_ALWAYS( !iObjArray, + User::Panic( NXIMPPrivPanic::KCategory, + NXIMPPrivPanic::EPtrArrayEntryReplaceUndoInitialized ) ); + + iObjArray = &aObjArray; + iTarget = &aTarget; + iSource = &aSource; + } + + +// --------------------------------------------------------------------------- +// CXIMPUndoPtrArrayEntryReplace::CancelUndo() +// --------------------------------------------------------------------------- +// +template< class T > +void CXIMPUndoPtrArrayEntryReplace::CancelUndo() + { + iObjArray = NULL; + iTarget = NULL; + + delete iSource; + iSource = NULL; + } + + + diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcoperations/sessionmng/ximpoperationbind.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcoperations/sessionmng/ximpoperationbind.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,152 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Concrete bind operation + * +*/ + +#include + +#include "ximpoperationbind.h" +#include "ximpserviceinfoimp.h" +#include "ximpcontextclientinfoimp.h" +#include "ximpobjecthelpers.h" +#include "ximpcontextstateeventimp.h" +#include "ximpcontextstateimp.h" +#include "ximppsccontextimp.h" +#include "ximphost.h" +#include "ximpstatusimp.h" + +#include "ximptrace.h" +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// CXIMPOperationBind::CXIMPOperationBind() +// --------------------------------------------------------------------------- +// +EXPORT_C CXIMPOperationBind::CXIMPOperationBind() + { + } + + +// --------------------------------------------------------------------------- +// CXIMPOperationBind::ConstructL +// --------------------------------------------------------------------------- +// +void CXIMPOperationBind::ConstructL( const TDesC8& aParamPck ) + { + if( iContext->IsHostAssigned() ) + { + User::Leave( KErrAlreadyExists ); + } + CXIMPContextClientInfoImp* clientInfo = CXIMPContextClientInfoImp::NewLC(); + CXIMPServiceInfoImp* serviceInfo = CXIMPServiceInfoImp::NewLC(); + + { + RDesReadStream rs; + CleanupClosePushL( rs ); + rs.Open( aParamPck ); // CSI: 65 # + + serviceInfo->InternalizeL( rs ); + clientInfo->InternalizeL( rs ); + + CleanupStack::PopAndDestroy(); // rs + } + + + CleanupStack::Pop( serviceInfo ); + iContext->SetServiceInfo( serviceInfo ); + + CleanupStack::Pop( clientInfo ); + iContext->SetClientInfo( clientInfo ); + + iTempEvent = CXIMPContextStateEventImp::NewL(); + iTempEvent->ContextStateImp().SetStateValue( MXIMPContextState::EInactive ); + } + +// --------------------------------------------------------------------------- +// CXIMPOperationBind::~CXIMPOperationBind() +// --------------------------------------------------------------------------- +// +CXIMPOperationBind::~CXIMPOperationBind() + { + delete iTempEvent; + } + +// --------------------------------------------------------------------------- +// CXIMPOperationBind::ProcessL() +// --------------------------------------------------------------------------- +// +void CXIMPOperationBind::ProcessL() + { + TRACE(_L("CXIMPOperationBind::ProcessL()" ) ); + CXIMPOperationBase::ProcessL(); + + iTempEvent->ContextStateImp().SetStateValue( MXIMPContextState::EBinding ); + iMyHost->ActivateEventL( *iTempEvent, iContext ); + + MXIMPProtocolConnection& connection = iMyHost->GetConnection(); + connection.OpenSessionL( *iContext->ClientInfo(), iReqId ); + } + +// --------------------------------------------------------------------------- +// CXIMPOperationBind::RequestCompleted() +// --------------------------------------------------------------------------- +// +void CXIMPOperationBind::RequestCompletedL() + { + TRACE(_L("CXIMPOperationBind::RequestCompletedL()" ) ); + CXIMPOperationBase::RequestCompletedL(); + + if( iStatusObj->ResultCode() != KErrNone ) + { + // Remove unbind, because bind did not succeed. this + // can be done only when attempting to connect for the first time + iContext->DestroyCachedUnbind(); + iTempEvent->ContextStateImp().SetStateValue( + MXIMPContextState::EInactive ); + + iMyHost->UnregisterSession( iContext ); + } + else + { + iTempEvent->ContextStateImp().SetStateValue( MXIMPContextState::EActive ); + } + iMyHost->ActivateEventL( *iTempEvent, iContext ); + } + +// --------------------------------------------------------------------------- +// CXIMPOperationBind::Type() +// --------------------------------------------------------------------------- +// +TInt CXIMPOperationBind::Type() const + { + return NXIMPOps::EXIMPBindContext; + } + +// ----------------------------------------------------------------------------- +// CXIMPOperationBind::BeginOperationL +// ----------------------------------------------------------------------------- +// +void CXIMPOperationBind::BeginOperation() + { + } + +// ----------------------------------------------------------------------------- +// CXIMPOperationBind::EndOperationL +// ----------------------------------------------------------------------------- +// +void CXIMPOperationBind::EndOperation() + { + } +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcoperations/sessionmng/ximpoperationbind.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcoperations/sessionmng/ximpoperationbind.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,65 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Bind operation + * +*/ + +#ifndef C_PSCOPERATIONBIND_H +#define C_PSCOPERATIONBIND_H + + +#include +#include + +#include "ximpoperationbase.h" +#include "ximpoperationdefs.h" + +class CXIMPContextStateEventImp; + +/** + * Bind operation + * + * @lib ximpoperation.lib + * @since S60 v4.0 + */ +class CXIMPOperationBind : public CXIMPOperationBase + { + + public: + + IMPORT_C CXIMPOperationBind(); + + void ConstructL( const TDesC8& aParamPck ); + + ~CXIMPOperationBind(); + + public: // from CXIMPOperationBase + + void ProcessL(); + + void RequestCompletedL(); + + TInt Type() const; + + void BeginOperation(); + void EndOperation(); + + private: // data + + // State event for client + CXIMPContextStateEventImp* iTempEvent; + }; + + +#endif // C_PSCOPERATIONBIND_H diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcoperations/sessionmng/ximpoperationbind2.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcoperations/sessionmng/ximpoperationbind2.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,153 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Concrete bind operation + * +*/ + +#include + +#include "ximpoperationbind2.h" +#include "ximpserviceinfoimp.h" +#include "ximpcontextclientinfoimp.h" +#include "ximpobjecthelpers.h" +#include "ximpcontextstateeventimp.h" +#include "ximpcontextstateimp.h" +#include "ximppsccontextimp.h" +#include "ximphost.h" +#include "ximpstatusimp.h" + +#include "ximptrace.h" +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// CXIMPOperationBind2::CXIMPOperationBind2() +// --------------------------------------------------------------------------- +// +EXPORT_C CXIMPOperationBind2::CXIMPOperationBind2() + { + } + + +// --------------------------------------------------------------------------- +// CXIMPOperationBind2::ConstructL +// --------------------------------------------------------------------------- +// +void CXIMPOperationBind2::ConstructL( const TDesC8& aParamPck ) + { + if( iContext->IsHostAssigned() ) + { + User::Leave( KErrAlreadyExists ); + } + CXIMPContextClientInfoImp* clientInfo = CXIMPContextClientInfoImp::NewLC(); + CXIMPServiceInfoImp* serviceInfo = CXIMPServiceInfoImp::NewLC(); + + { + RDesReadStream rs; + CleanupClosePushL( rs ); + rs.Open( aParamPck ); // CSI: 65 # + + serviceInfo->InternalizeL( rs ); + clientInfo->InternalizeL( rs ); + + CleanupStack::PopAndDestroy(); // rs + } + + + CleanupStack::Pop( serviceInfo ); + iContext->SetServiceInfo( serviceInfo ); + + CleanupStack::Pop( clientInfo ); + iContext->SetClientInfo( clientInfo ); + + iTempEvent = CXIMPContextStateEventImp::NewL(); + iTempEvent->ContextStateImp().SetStateValue( MXIMPContextState::EInactive ); + } + +// --------------------------------------------------------------------------- +// CXIMPOperationBind2::~CXIMPOperationBind2() +// --------------------------------------------------------------------------- +// +CXIMPOperationBind2::~CXIMPOperationBind2() + { + delete iTempEvent; + } + +// --------------------------------------------------------------------------- +// CXIMPOperationBind2::ProcessL() +// --------------------------------------------------------------------------- +// +void CXIMPOperationBind2::ProcessL() + { + TRACE(_L("CXIMPOperationBind2::ProcessL()" ) ); + CXIMPOperationBase::ProcessL(); + + iTempEvent->ContextStateImp().SetStateValue( MXIMPContextState::EBinding ); + iMyHost->ActivateEventL( *iTempEvent, iContext ); + + TInt32 settingsId = iContext->ServiceInfo()->IapId(); + MXIMPProtocolConnection& connection = iMyHost->GetConnection(); + connection.OpenSessionL( settingsId, iReqId ); + } + +// --------------------------------------------------------------------------- +// CXIMPOperationBind2::RequestCompleted() +// --------------------------------------------------------------------------- +// +void CXIMPOperationBind2::RequestCompletedL() + { + TRACE(_L("CXIMPOperationBind2::RequestCompletedL()" ) ); + CXIMPOperationBase::RequestCompletedL(); + + if( iStatusObj->ResultCode() != KErrNone ) + { + // Remove unbind, because bind did not succeed. this + // can be done only when attempting to connect for the first time + iContext->DestroyCachedUnbind(); + iTempEvent->ContextStateImp().SetStateValue( + MXIMPContextState::EInactive ); + + iMyHost->UnregisterSession( iContext ); + } + else + { + iTempEvent->ContextStateImp().SetStateValue( MXIMPContextState::EActive ); + } + iMyHost->ActivateEventL( *iTempEvent, iContext ); + } + +// --------------------------------------------------------------------------- +// CXIMPOperationBind2::Type() +// --------------------------------------------------------------------------- +// +TInt CXIMPOperationBind2::Type() const + { + return NXIMPOps::EXIMPBindContext2; + } + +// ----------------------------------------------------------------------------- +// CXIMPOperationBind2::BeginOperationL +// ----------------------------------------------------------------------------- +// +void CXIMPOperationBind2::BeginOperation() + { + } + +// ----------------------------------------------------------------------------- +// CXIMPOperationBind2::EndOperationL +// ----------------------------------------------------------------------------- +// +void CXIMPOperationBind2::EndOperation() + { + } +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcoperations/sessionmng/ximpoperationbind2.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcoperations/sessionmng/ximpoperationbind2.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,65 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Bind operation + * +*/ + +#ifndef C_XIMPOPERATIONBIND2_H +#define C_XIMPOPERATIONBIND2_H + + +#include +#include + +#include "ximpoperationbase.h" +#include "ximpoperationdefs.h" + +class CXIMPContextStateEventImp; + +/** + * Bind operation + * + * @lib prfwoperation.lib + * @since S60 v4.0 + */ +class CXIMPOperationBind2 : public CXIMPOperationBase + { + + public: + + IMPORT_C CXIMPOperationBind2(); + + void ConstructL( const TDesC8& aParamPck ); + + ~CXIMPOperationBind2(); + + public: // from CXIMPOperationBase + + void ProcessL(); + + void RequestCompletedL(); + + TInt Type() const; + + void BeginOperation(); + void EndOperation(); + + private: // data + + // State event for client + CXIMPContextStateEventImp* iTempEvent; + }; + + +#endif // C_XIMPOPERATIONBIND2_H diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcoperations/sessionmng/ximpoperationforcedteardown.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcoperations/sessionmng/ximpoperationforcedteardown.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,94 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Forced teardown operation + * +*/ + + +#include "ximpoperationforcedteardown.h" +#include "ximphost.h" + +#include "ximptrace.h" +// ============================ MEMBER FUNCTIONS ============================= + +// --------------------------------------------------------------------------- +// CXIMPOperationForcedTeardown::~CXIMPOperationForcedTeardown() +// --------------------------------------------------------------------------- +// +CXIMPOperationForcedTeardown::~CXIMPOperationForcedTeardown() + { + } + +// --------------------------------------------------------------------------- +// CXIMPOperationForcedTeardown::CXIMPOperationForcedTeardown() +// --------------------------------------------------------------------------- +// +EXPORT_C CXIMPOperationForcedTeardown::CXIMPOperationForcedTeardown() + { + } + +// --------------------------------------------------------------------------- +// CXIMPOperationForcedTeardown::ConstructL() +// --------------------------------------------------------------------------- +// +void CXIMPOperationForcedTeardown::ConstructL( const TDesC8& /* aParamPck */ ) + { + // ignored. can't give parameters to this operation. + } + +// --------------------------------------------------------------------------- +// CXIMPOperationForcedTeardown::SetHost +// --------------------------------------------------------------------------- +// +void CXIMPOperationForcedTeardown::SetHost( MXIMPHost& aMyHost ) + { + CXIMPOperationBase::SetHost( aMyHost ); + } + +// --------------------------------------------------------------------------- +// CXIMPOperationForcedTeardown::ProcessL() +// --------------------------------------------------------------------------- +// +void CXIMPOperationForcedTeardown::ProcessL() + { + TRACE(_L("CXIMPOperationForcedTeardown::ProcessL()" ) ); + CXIMPOperationBase::ProcessL(); + + iMyHost->ForcedTeardownL(); + iMyHost->HandleSessionMgmtRequestCompleted( iReqId, KErrNone ); + } + +// --------------------------------------------------------------------------- +// CXIMPOperationForcedTeardown::RequestCompleted() +// --------------------------------------------------------------------------- +// +void CXIMPOperationForcedTeardown::RequestCompletedL() + { + TRACE(_L("CXIMPOperationForcedTeardown::RequestCompletedL()" ) ); + CXIMPOperationBase::RequestCompletedL(); + + // no special handling for error situations + } + + +// --------------------------------------------------------------------------- +// CXIMPOperationForcedTeardown::Type() +// --------------------------------------------------------------------------- +// +TInt CXIMPOperationForcedTeardown::Type() const + { + return NXIMPOps::EXIMPForcedTeardown; + } + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcoperations/sessionmng/ximpoperationforcedteardown.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcoperations/sessionmng/ximpoperationforcedteardown.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,59 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Forced teardown operation + * +*/ + +#ifndef CPSCOPERATIONFORCEDTEARDOWN_H +#define CPSCOPERATIONFORCEDTEARDOWN_H + + +#include + +#include +#include "ximpoperationbase.h" +#include "ximpoperationdefs.h" + +class MXIMPHost; + +/** + * Forced tear down operation. + * Activates all cached unbinds. + * + * @lib ximpoperations.lib + * @since S60 v4.0 + */ +class CXIMPOperationForcedTeardown : public CXIMPOperationBase + { + public: + + IMPORT_C CXIMPOperationForcedTeardown(); + + void ConstructL( const TDesC8& aParamPck ); + + ~CXIMPOperationForcedTeardown(); + + public: // from CXIMPOperationBase + + void SetHost( MXIMPHost& aMyHost ); + void ProcessL(); + void RequestCompletedL(); + TInt Type() const; + + private: // data + + }; + + +#endif // CPSCOPERATIONFORCEDTEARDOWN_H diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcoperations/sessionmng/ximpoperationunbind.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcoperations/sessionmng/ximpoperationunbind.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,138 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Concrete unbind operation + * +*/ + + +#include +#include + +#include "ximpoperationunbind.h" +#include "ximpcontextclientinfoimp.h" +#include "ximpcontextstateeventimp.h" +#include "ximpcontextstateimp.h" +#include "ximphost.h" +#include "ximppsccontextimp.h" + +#include "ximptrace.h" + + +// ======== LOCAL FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// ?description +// --------------------------------------------------------------------------- +// + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// CXIMPOperationUnbind::CXIMPOperationUnbind() +// --------------------------------------------------------------------------- +// +EXPORT_C CXIMPOperationUnbind::CXIMPOperationUnbind() + { + } + +// --------------------------------------------------------------------------- +// CXIMPOperationUnbind::ConstructL +// --------------------------------------------------------------------------- +// +void CXIMPOperationUnbind::ConstructL( const TDesC8& /* aParamPck */ ) + { + iTempEvent = CXIMPContextStateEventImp::NewL(); + iTempEvent->ContextStateImp().SetStateValue( MXIMPContextState::EInactive ); + } + +// --------------------------------------------------------------------------- +// CXIMPOperationUnbind::~CXIMPOperationUnbind() +// --------------------------------------------------------------------------- +// +CXIMPOperationUnbind::~CXIMPOperationUnbind() + { + delete iTempEvent; + } + +// --------------------------------------------------------------------------- +// CXIMPOperationUnbind::ProcessL() +// --------------------------------------------------------------------------- +// +void CXIMPOperationUnbind::ProcessL() + { + TRACE(_L("CXIMPOperationUnbind::ProcessL()" ) ); + CXIMPOperationBase::ProcessL(); + MXIMPProtocolConnection& connection = iMyHost->GetConnection(); + + iTempEvent->ContextStateImp().SetStateValue( MXIMPContextState::EUnbinding ); + iMyHost->ActivateEventL( *iTempEvent, iContext ); + + // normal case, call plugin + connection.CloseSession( *iContext->ClientInfo(), iReqId ); + } + +// --------------------------------------------------------------------------- +// CXIMPOperationUnbind::RequestCompleted() +// --------------------------------------------------------------------------- +// +void CXIMPOperationUnbind::RequestCompletedL() + { + TRACE(_L("CXIMPOperationUnbind::RequestCompletedL()" ) ); + CXIMPOperationBase::RequestCompletedL(); + + iTempEvent->ContextStateImp().SetStateValue( MXIMPContextState::EInactive ); + iMyHost->ActivateEventL( *iTempEvent, iContext ); + } + +// --------------------------------------------------------------------------- +// CXIMPOperationUnbind::Type() +// --------------------------------------------------------------------------- +// +TInt CXIMPOperationUnbind::Type() const + { + return NXIMPOps::EXIMPUnbindContext; + } + +// ----------------------------------------------------------------------------- +// CXIMPOperationBase::SetResultCode() +// ----------------------------------------------------------------------------- +// +void CXIMPOperationUnbind::SetResultCode( TInt /*aResultCode*/ ) + { + // Succeeds always. + CXIMPOperationBase::SetResultCode( KErrNone ); + } + +// ----------------------------------------------------------------------------- +// CXIMPOperationBase::SetResultCode() +// ----------------------------------------------------------------------------- +// +void CXIMPOperationUnbind::SetStatus( MXIMPStatus* aStatus ) + { + // Succeeds always. + CXIMPOperationBase::SetStatus( aStatus ); + CXIMPOperationBase::SetResultCode( KErrNone ); + } + +// ----------------------------------------------------------------------------- +// CXIMPOperationBase::EndOperation() +// ----------------------------------------------------------------------------- +// +void CXIMPOperationUnbind::EndOperation() + { + CXIMPOperationBase::EndOperation(); + iMyHost->UnregisterSession( iContext ); + } + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcoperations/sessionmng/ximpoperationunbind.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcoperations/sessionmng/ximpoperationunbind.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,69 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of CXIMPOperationUnbind + * +*/ + +#ifndef C_PSCOPERATIONUNBIND_H +#define C_PSCOPERATIONUNBIND_H + + +#include +#include + +#include "ximpoperationbase.h" +#include "ximpoperationdefs.h" + +class CXIMPContextStateEventImp; + +/** + * Unbind operation. + * + * @lib ximpoperations.lib + * @since S60 v4.0 + */ +class CXIMPOperationUnbind : public CXIMPOperationBase + { + + public: + + IMPORT_C CXIMPOperationUnbind(); + + void ConstructL( const TDesC8& aParamPck ); + + ~CXIMPOperationUnbind(); + + public: // from CXIMPOperationBase + + void ProcessL(); + + void RequestCompletedL(); + + TInt Type() const; + + void SetResultCode( TInt aResultCode ); + void SetStatus( MXIMPStatus* aStatus ); + + void EndOperation(); + + private: // data + + /** + * + */ + CXIMPContextStateEventImp* iTempEvent; + }; + + +#endif // C_PSCOPERATIONUNBIND_H diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcoperations/ximpoperationfactory.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcoperations/ximpoperationfactory.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,49 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Presence Service Connection operation factory + * +*/ + + +#ifndef XIMPCPSCOPERATIONFACTORY_H +#define XIMPCPSCOPERATIONFACTORY_H + +#include +class CXIMPOperationBase; + +/** + * Operation factory interface + * + * @lib ximpoperation.dll + * @since S60 v4.0 + */ +class MXIMPOperationFactory + { + public: // Allow desctruction through this interface. + + virtual ~MXIMPOperationFactory(){} + + public: // From MXIMPOperationFactory + + /** + * Create operation by operation id. + * @param aOperation. Identifies operation needed to create. + * @return Operation as base object. + */ + virtual CXIMPOperationBase* CreateOperationL( TInt aOperation ) = 0; + }; + +#endif // XIMPCPSCOPERATIONFACTORY_H + + diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcoperations/ximpoperationfactoryimp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcoperations/ximpoperationfactoryimp.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,209 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Presence service operation factory + * +*/ + + +#include "ximpoperationfactoryimp.h" +#include "ximpoperationdefs.h" +#include "ximpoperationbind.h" +#include "ximpoperationbind2.h" +#include "ximpoperationunbind.h" +#include "ximpoperationforcedteardown.h" +#include "ximppanics.h" + +#include "presenceoperationfactoryimp.h" +#include "ximptrace.h" +#include "ximpoperationfactory1.h" + +using namespace NXIMPOps; + +const TInt KPluginArrayGranularity = 3; + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CXIMPOperationFactory::NewL() +// Singleton access method. +// ----------------------------------------------------------------------------- +// +EXPORT_C CXIMPOperationFactory* CXIMPOperationFactory::NewL() + { + CXIMPOperationFactory* self = new ( ELeave ) CXIMPOperationFactory(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// ----------------------------------------------------------------------------- +// CXIMPOperationFactory::CXIMPOperationFactory() +// ----------------------------------------------------------------------------- +// +CXIMPOperationFactory::CXIMPOperationFactory() + { + } + +// ----------------------------------------------------------------------------- +// CXIMPOperationFactory::~CXIMPOperationFactory() +// ----------------------------------------------------------------------------- +// +CXIMPOperationFactory::~CXIMPOperationFactory() + { + #if _BullseyeCoverage + cov_write(); + #endif + delete iPresenceOperation; + //delete iImOperation; + if ( iOperationPlugins ) + { + TInt idx = KErrNotFound; + while( iOperationPlugins->Count() ) + { + idx = iOperationPlugins->Count() - 1; + // Delete object + delete iOperationPlugins->At( idx ); + // Delete element + iOperationPlugins->Delete( idx ); + } + } + + delete iOperationPlugins; + REComSession::FinalClose(); + } + + +// ----------------------------------------------------------------------------- +// CXIMPOperationFactory::ConstructL() +// ----------------------------------------------------------------------------- +// +void CXIMPOperationFactory::ConstructL() + { + iPresenceOperation = CPresenceOperationFactory::NewL(); + + //TRAPD(err, iImOperation = MXIMPOperationFactory1::NewL()); + + iOperationPlugins = new(ELeave)CArrayFixFlat(KPluginArrayGranularity); + + LoadOperationPluginsL() ; + } + + +// ----------------------------------------------------------------------------- +// CXIMPOperationFactory::CreateOperationL() +// ----------------------------------------------------------------------------- +// +CXIMPOperationBase* CXIMPOperationFactory::CreateOperationL( TInt aOperation ) + { + CXIMPOperationBase* op = NULL; + NXIMPOps::TXIMPOpTypes operation = ( NXIMPOps::TXIMPOpTypes ) aOperation; + switch( operation ) + { + case EXIMPBindContext: + { + op = new ( ELeave ) CXIMPOperationBind(); + TRACE( _L("Operation Bind created") ); + break; + } + + case EXIMPBindContext2: + { + op = new ( ELeave ) CXIMPOperationBind2(); + TRACE( _L("Operation Bind2 created") ); + break; + } + + + case EXIMPUnbindContext: + { + op = new ( ELeave ) CXIMPOperationUnbind(); + TRACE( _L("Operation Unbind created") ); + break; + } + + case EXIMPForcedTeardown: + { + op = new ( ELeave ) CXIMPOperationForcedTeardown(); + TRACE( _L("Operation ForcedTeardown created") ); + break; + } + default: + { + + // this for time being, change presence interface + op = iPresenceOperation->CreateOperationL( aOperation ); + if(!op) + { + TInt count = iOperationPlugins->Count() ; + + for(TInt i=0; iAt(i)->CreateOperationL(aOperation) ; + if(op) + { + // got the operation object, no need to pass it to other plugins + break; + } + } + } + break; + } + } + return op; + } + +void CleanupEComArray(TAny* aArray) + { + (static_cast (aArray))->ResetAndDestroy(); + (static_cast (aArray))->Close(); + } +// ----------------------------------------------------------------------------- +// CXIMPOperationFactory::LoadOperationPluginsL() +// ----------------------------------------------------------------------------- +// +void CXIMPOperationFactory::LoadOperationPluginsL() +{ + RImplInfoPtrArray pluginArray; + MXIMPOperationFactory1::ListAllImplementationsL(pluginArray) ; + if ( pluginArray.Count() ) + { + for( TInt i = 0; i < pluginArray.Count(); i++ ) + { + MXIMPOperationFactory1* implementation = NULL ; + CImplementationInformation* info = pluginArray[ i ]; + TUid id = info->ImplementationUid(); + TRAPD(err, implementation = MXIMPOperationFactory1::NewL(id) ); + CleanupStack::PushL(implementation); + if(err == KErrNone) + { + iOperationPlugins->AppendL( implementation ); + } + CleanupStack::Pop(implementation); + } + } + pluginArray.ResetAndDestroy(); +} + + +// End of file + + + + + + + + + diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcoperations/ximpoperationfactoryimp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcoperations/ximpoperationfactoryimp.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,78 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Presence Service Connection operation factory + * +*/ + + +#ifndef XIMPCPSCOPERATIONFACTORYIMP_H +#define XIMPCPSCOPERATIONFACTORYIMP_H + + +#include +class CXIMPOperationBase; +class CPresenceOperationFactory; +class CImOperationFactory; + +class MXIMPOperationFactory1 ; + +#include "ximpoperationfactory.h" +#include "ximpoperationfactory1.h" + +/** + * Operation factory + * Class is owned by and handled as singleton by CXIMPGlobals. + * + * @lib ximpoperation.dll + * @since S60 v4.0 + */ +class CXIMPOperationFactory : public CBase, + public MXIMPOperationFactory + { + public: // Construction and desctruction + + IMPORT_C static CXIMPOperationFactory* NewL(); + + virtual ~CXIMPOperationFactory(); + + private: // Construction + + /** + * C++ default constructor. + */ + CXIMPOperationFactory(); + + /** + * Symbian 2nd phase constructor + */ + void ConstructL(); + + void LoadOperationPluginsL() ; + + public: // From MXIMPOperationFactory + + /** + * @see MXIMPOperationFactory + */ + CXIMPOperationBase* CreateOperationL( TInt aOperation ); + + private: // Data + CPresenceOperationFactory* iPresenceOperation; + + CArrayFixFlat* iOperationPlugins; + }; + +#endif // XIMPCPSCOPERATIONFACTORY_H + + diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcprocessor/ximpcontexteventqueue.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcprocessor/ximpcontexteventqueue.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,426 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of context event queue + * +*/ + +#include "ximpcontexteventqueue.h" +#include "ximpeventqueueobserver.h" + +#include "ximpglobals.h" +#include "ximpeventmanager.h" +#include "ximpeventcapsule.h" +#include "ximpcontexteventfilter.h" +#include "ximppanics.h" +#include "ximpcontextstateeventimp.h" +#include "ximprequestcompleteeventimp.h" + +#include + + + +// ============================ MEMBER FUNCTIONS ============================= + +// --------------------------------------------------------------------------- +// CXIMPContextEventQueue::NewL() +// --------------------------------------------------------------------------- +// +EXPORT_C CXIMPContextEventQueue* CXIMPContextEventQueue::NewL() + { + CXIMPContextEventQueue* self = + new( ELeave ) CXIMPContextEventQueue( ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + + +// --------------------------------------------------------------------------- +// CXIMPContextEventQueue::~CXIMPContextEventQueue() +// --------------------------------------------------------------------------- +// +CXIMPContextEventQueue::~CXIMPContextEventQueue() + { + ClearQueuedEvents(); + delete iEventFilter; + + TInt eventCount = iPreservedEvents.Count(); + for( TInt ix = 0; ix < eventCount ; ix++ ) + { + iPreservedEvents[ ix ]->Close(); + } + iPreservedEvents.Reset(); + eventCount = iRequestCompleteEvents.Count(); + for( TInt ix = 0; ix < eventCount ; ix++ ) + { + iRequestCompleteEvents[ ix ]->Close(); + } + iRequestCompleteEvents.Reset(); + } + + +// --------------------------------------------------------------------------- +// CXIMPContextEventQueue::CXIMPContextEventQueue() +// --------------------------------------------------------------------------- +// +CXIMPContextEventQueue::CXIMPContextEventQueue() + { + } + + +// ----------------------------------------------------------------------------- +// CXIMPContextEventQueue::ConstructL() +// ----------------------------------------------------------------------------- +// +void CXIMPContextEventQueue::ConstructL() + { + iEventFilter = CXIMPContextEventFilter::NewL(); + CXIMPContextStateEventImp* tempEvent = + CXIMPContextStateEventImp::NewLC(); + + for( TInt a = 0; a < 6; ++a ) // Count of different states + complete + { + AddPreservedEventL( *tempEvent ); + } + + CleanupStack::PopAndDestroy(); // tempEvent + StopConsuming(); + } + + +// ----------------------------------------------------------------------------- +// CXIMPContextEventQueue::SetEventFilter() +// ----------------------------------------------------------------------------- +// +EXPORT_C void CXIMPContextEventQueue::SetEventFilter( + CXIMPContextEventFilter& aFilter ) + { + delete iEventFilter; + iEventFilter = &aFilter; + + //Refilter event queue so we don't deliver such events + //that client isn't wanting + TInt eventCount = iPreservedEvents.Count(); + for( TInt ix = 0; ix < eventCount ; ix++ ) + { + CXIMPEventCapsule* event = iPreservedEvents[ ix ]; + if( !iEventFilter->IsEventAccepted( event->EventType() ) && + event->Ready() ) + { + event->SetReady( EFalse ); + } + } + + eventCount = iEvents.Count() - 1; + for( TInt ix = eventCount; ix >= 0 ; ix-- ) + { + CXIMPEventCapsule* event = iEvents[ ix ]; + if( !iEventFilter->IsEventAccepted( event->EventType() ) ) + { + event->Close(); + iEvents.Remove( ix ); + } + } + } + + +// ----------------------------------------------------------------------------- +// CXIMPContextEventQueue::StartConsuming() +// ----------------------------------------------------------------------------- +// +EXPORT_C void CXIMPContextEventQueue::StartConsuming( + MXIMPEventQueueObserver& aQueueObserver ) + { + iObserver = &aQueueObserver; + } + + +// ----------------------------------------------------------------------------- +// CXIMPContextEventQueue::StopConsuming() +// ----------------------------------------------------------------------------- +// +EXPORT_C void CXIMPContextEventQueue::StopConsuming() + { + iObserver = NULL; + ClearQueuedEvents(); + } + + +// ----------------------------------------------------------------------------- +// CXIMPContextEventQueue::HasElements() +// ----------------------------------------------------------------------------- +// +EXPORT_C TBool CXIMPContextEventQueue::HasElements() const + { + TInt eventCount = iPreservedEvents.Count(); + TInt count = 0; + for( TInt a = 0; a < eventCount; ++a ) + { + if( iPreservedEvents[ a ]->Ready() ) + { + ++count; + } + } + + eventCount = iRequestCompleteEvents.Count(); + for( TInt a = 0; a < eventCount; ++a ) + { + if( iRequestCompleteEvents[ a ]->Ready() ) + { + ++count; + } + } + + return ( iEvents.Count() + count > 0 ); + } + + +// ----------------------------------------------------------------------------- +// CXIMPContextEventQueue::FindNextEvent() +// ----------------------------------------------------------------------------- +// +TBool CXIMPContextEventQueue::FindNextEvent( RPointerArray< CXIMPEventCapsule >& aArray ) + { + TInt eventIndex = KErrNotFound; + TInt eventCount = aArray.Count(); + for( TInt a = 0; a < eventCount; ++a ) + { + if( aArray[ a ]->Ready() ) + { + if( iNextEventToGo ) + { + if( *aArray[ a ] < *iNextEventToGo ) + { + eventIndex = a; + iNextEventToGo = aArray[ a ]; + } + } + else + { + eventIndex = a; + iNextEventToGo = aArray[ a ]; + } + } + } + return eventIndex; + } + +// ----------------------------------------------------------------------------- +// CXIMPContextEventQueue::SelectTopEventIfNeededL() +// ----------------------------------------------------------------------------- +// +EXPORT_C void CXIMPContextEventQueue::SelectTopEventIfNeededL() + { + if( iNextEventToGo ) + { + return; + } + + __ASSERT_ALWAYS( HasElements(), User::Leave( KErrNotFound ) ); + + TInt presEvent = FindNextEvent( iPreservedEvents ); + TInt reqEvent = FindNextEvent( iRequestCompleteEvents ); + TInt event = FindNextEvent( iEvents ); + + if( event != KErrNotFound ) + { + iEvents.Remove( event ); + } + else if( reqEvent != KErrNotFound ) + { + iRequestCompleteEvents.Remove( reqEvent ); + } + else + { + User::LeaveIfError(iNextEventToGo->Open()); //Open always return KErrNone. + } + } + +// ----------------------------------------------------------------------------- +// CXIMPContextEventQueue::TopEventDataL() +// ----------------------------------------------------------------------------- +// +EXPORT_C const TDesC8& CXIMPContextEventQueue::TopEventDataL() + { + __ASSERT_ALWAYS( iNextEventToGo, + User::Leave( KErrNotFound ) ); + + return iNextEventToGo->EventData(); + } + + +// ----------------------------------------------------------------------------- +// CXIMPContextEventQueue::TopEventReqIdL() +// ----------------------------------------------------------------------------- +// +EXPORT_C TXIMPRequestId CXIMPContextEventQueue::TopEventReqIdL() + { + __ASSERT_ALWAYS( iNextEventToGo, + User::Leave( KErrNotFound ) ); + + return iNextEventToGo->EventReqId(); + } + + +// ----------------------------------------------------------------------------- +// CXIMPContextEventQueue::DropTopEvent() +// ----------------------------------------------------------------------------- +// +EXPORT_C void CXIMPContextEventQueue::DropTopEvent() + { + if( iNextEventToGo ) + { + iNextEventToGo->SetReady( EFalse ); // For preserved events + iNextEventToGo->Close(); + iNextEventToGo = NULL; + } + } + + +// ----------------------------------------------------------------------------- +// CXIMPContextEventQueue::AddEventL() +// ----------------------------------------------------------------------------- +// +void CXIMPContextEventQueue::AddEventL( CXIMPEventCapsule& aEvent ) + { + // Queue accepts the event if: + // 1. it has a registered observer + // 2. event type is a accepted one + TInt32 eventType = aEvent.EventType(); + if( eventType == MXIMPRequestCompleteEvent::KInterfaceId ) + { + aEvent.SetReady( EFalse ); + iRequestCompleteEvents.AppendL( &aEvent ); + User::LeaveIfError(aEvent.Open()); //Open always return KErrNone. + } + else if( iObserver && + iEventFilter->IsEventAccepted( eventType ) ) + { + iEvents.AppendL( &aEvent ); + User::LeaveIfError(aEvent.Open()); //Open always return KErrNone. + aEvent.SetTimeStamp( iTimeStamp++ ); + iObserver->NewEventAvailable(); + } + } + +// ----------------------------------------------------------------------------- +// CXIMPContextEventQueue::AddPreservedEventL() +// ----------------------------------------------------------------------------- +// +void CXIMPContextEventQueue::AddPreservedEventL( CXIMPApiEventBase& aEvent ) + { + // Queue accepts the event always. Activation uses filter. + CXIMPEventCapsule* capsulatedEvent = CXIMPEventCapsule::NewL( aEvent, EFalse ); + CleanupClosePushL( *capsulatedEvent ); + iPreservedEvents.AppendL( capsulatedEvent ); + CleanupStack::Pop( capsulatedEvent ); + } + +// ----------------------------------------------------------------------------- +// CXIMPContextEventQueue::ActivatePreservedEventL() +// ----------------------------------------------------------------------------- +// +void CXIMPContextEventQueue::ActivatePreservedEventL( CXIMPApiEventBase& aEvent ) + { + if( iObserver ) + { + TInt eventCount = iPreservedEvents.Count(); + for( TInt a = 0; a < eventCount; ++a ) + { + if( !iPreservedEvents[ a ]->Ready() ) + { + iPreservedEvents[ a ]->UpdateEventDataL( aEvent ); + if( iEventFilter->IsEventAccepted( iPreservedEvents[ a ]->EventType() ) ) + { + iPreservedEvents[ a ]->SetReady( ETrue ); + iPreservedEvents[ a ]->SetTimeStamp( iTimeStamp++ ); + iObserver->NewEventAvailable(); + } + return; + } + } + } + } + +// ----------------------------------------------------------------------------- +// CXIMPContextEventQueue::ActivateRequestCompleteEvent() +// ----------------------------------------------------------------------------- +// +void CXIMPContextEventQueue::ActivateRequestCompleteEvent( CXIMPRequestCompleteEventImp& aEvent ) + { + TInt eventCount = iRequestCompleteEvents.Count(); + for( TInt a = 0; a < eventCount; ++a ) + { + if( iRequestCompleteEvents[ a ]->EventReqId() == aEvent.RequestId() ) + { + if( iObserver ) + { + if( iEventFilter->IsEventAccepted( iRequestCompleteEvents[ a ]->EventType() ) ) + { + iRequestCompleteEvents[ a ]->UpdateEventData( aEvent ); + iRequestCompleteEvents[ a ]->SetReady( ETrue ); + iRequestCompleteEvents[ a ]->SetTimeStamp( iTimeStamp++ ); + iObserver->NewEventAvailable(); + } + } + else + { + iRequestCompleteEvents[ a ]->Close(); + iRequestCompleteEvents.Remove( a ); + } + return; + } + } + } + +// ----------------------------------------------------------------------------- +// CXIMPContextEventQueue::ActivateRequestCompleteEvent() +// ----------------------------------------------------------------------------- +// +void CXIMPContextEventQueue::RemoveRequestCompleteEvent( CXIMPRequestCompleteEventImp& aEvent ) + { + TInt eventCount = iRequestCompleteEvents.Count(); + for( TInt a = 0; a < eventCount; ++a ) + { + if( iRequestCompleteEvents[ a ]->EventReqId() == aEvent.RequestId() ) + { + iRequestCompleteEvents[ a ]->Close(); + iRequestCompleteEvents.Remove( a ); + return; + } + } + } + +// ----------------------------------------------------------------------------- +// CXIMPContextEventQueue::ClearQueuedEvents() +// ----------------------------------------------------------------------------- +// +void CXIMPContextEventQueue::ClearQueuedEvents() + { + const TInt eventCount = iEvents.Count(); + for( TInt ix = 0; ix < eventCount ; ix++ ) + { + iEvents[ ix ]->Close(); + } + + iEvents.Reset(); + if( iNextEventToGo ) + { + iNextEventToGo->Close(); + iNextEventToGo = NULL; + } + } + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcprocessor/ximpcontexteventqueue.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcprocessor/ximpcontexteventqueue.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,188 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: implementation of CXIMPContextEventQueue + * +*/ + +#ifndef XIMPCONTEXTEVENTQUEUE_H +#define XIMPCONTEXTEVENTQUEUE_H + +#include +#include + +class CXIMPEventCapsule; +class CXIMPContextEventFilter; +class MXIMPEventQueueObserver; +class CXIMPApiEventBase; +class CXIMPRequestCompleteEventImp; + +/** + * Event queue for client to process. + */ +class CXIMPContextEventQueue : public CBase + { +public: // Constructors and destructors + + /** + * Construction + */ + IMPORT_C static CXIMPContextEventQueue* NewL(); + + /** + * Destruction + */ + ~CXIMPContextEventQueue(); + +protected: // Constructors + + /** + * Construction + */ + CXIMPContextEventQueue(); + + /** + * Construction + */ + void ConstructL(); + +public: // New functions + + /** + * Set event filter for filtering events + * @param aFilter New filter. + */ + IMPORT_C void SetEventFilter( CXIMPContextEventFilter& aFilter ); + + /** + * Start consuming events. + * @param aQueueObserver Observer to notify when event is ready + */ + IMPORT_C void StartConsuming( MXIMPEventQueueObserver& aQueueObserver ); + + /** + * Stop event consuming. + */ + IMPORT_C void StopConsuming(); + + /** + * Check if there is elements. + */ + IMPORT_C TBool HasElements() const; + IMPORT_C void SelectTopEventIfNeededL(); + IMPORT_C const TDesC8& TopEventDataL(); + IMPORT_C TXIMPRequestId TopEventReqIdL(); + IMPORT_C void DropTopEvent(); + + /** + * Add new event to queue. + */ + void AddEventL( CXIMPEventCapsule& aEvent ); + + /** + * Activate new request complete event to queue. + * @param aEvent Event to activate. + */ + void ActivateRequestCompleteEvent( CXIMPRequestCompleteEventImp& aEvent ); + + /** + * Remove request complete event from queue + * @param aEvent Event to remove + */ + void RemoveRequestCompleteEvent( CXIMPRequestCompleteEventImp& aEvent ); + + /** + * Activate preserved event for sending. + */ + void ActivatePreservedEventL( CXIMPApiEventBase& aEvent ); + + /** + * Get id of queue. + * @return Id of queue. + */ + inline TUint32 SessionIdOfQueue() const { return iId; } + + /** + * Set id of queue + * @param aId Id of queue. + */ + inline void SetSessionIdOfQueue( TUint32 aId ) { iId = aId; } + +private: // Helpers + + /** + * Clear queued events. + */ + void ClearQueuedEvents(); + + /** + * Add new preserved event to queue. + */ + void AddPreservedEventL( CXIMPApiEventBase& aEvent ); + + /** + * Find next ready event from array. Timestamp is used to choose first one. + * iNextEventToGo is filled with oldest event. iNextEventToGo can be filled + * with reference event before call. + * @param aArray. Array of events to choose. + * @return Index of found event in array + */ + TInt FindNextEvent( RPointerArray< CXIMPEventCapsule >& aArray ); + +private: // Data + + /** + * Queue ID. + */ + TUint32 iId; + + /** + * Events array. Reference to events own. + */ + RPointerArray< CXIMPEventCapsule > iEvents; + + /** + * Preserved events array. Reference to events own. + */ + RPointerArray< CXIMPEventCapsule > iPreservedEvents; + + /** + * Request complete events waiting for completion. + */ + RPointerArray< CXIMPEventCapsule > iRequestCompleteEvents; + + /** + * Event filter. Own. + */ + CXIMPContextEventFilter* iEventFilter; + + /** + * Queue observer. Ref. + */ + MXIMPEventQueueObserver* iObserver; + + /** + * Helper variable to contain next event to go. + */ + CXIMPEventCapsule* iNextEventToGo; + + /** + * Timestamp for events. + */ + TUint32 iTimeStamp; + + }; + +#endif // XIMPCONTEXTEVENTQUEUE_H + + diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcprocessor/ximpeventcapsule.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcprocessor/ximpeventcapsule.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,183 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Event capsulation for shared ownership. +* +*/ + +#include "ximpeventcapsule.h" +#include "ximpeventcodec.h" +#include "ximpapieventbase.h" +#include "ximprbufhelpers.h" +#include + + +// --------------------------------------------------------------------------- +// CXIMPEventCapsule::NewL() +// --------------------------------------------------------------------------- +// +EXPORT_C CXIMPEventCapsule* CXIMPEventCapsule::NewL( CXIMPApiEventBase& aEvent, + TBool aEventReady /* = ETrue */ ) + { + CXIMPEventCapsule* self = new( ELeave ) CXIMPEventCapsule( aEventReady ); + CleanupClosePushL( *self ); + self->ConstructL( aEvent ); + CleanupStack::Pop( self ); + return self; + } + + +// --------------------------------------------------------------------------- +// CXIMPEventCapsule::~CXIMPEventCapsule +// --------------------------------------------------------------------------- +// +CXIMPEventCapsule::~CXIMPEventCapsule() + { + iEventBuf.Close(); + delete iBuffer; + } + + +// --------------------------------------------------------------------------- +// CXIMPEventCapsule::ConstructL() +// --------------------------------------------------------------------------- +// +void CXIMPEventCapsule::ConstructL( CXIMPApiEventBase& aEvent ) + { + iReqId = TXIMPRequestId::Null(); + + iBuffer = CBufFlat::NewL( 10 ); // initial granularity to 10 + XIMPEventCodec::PackL( aEvent, iEventType, iBuffer ); + iEventBuf.CreateL( iBuffer->Ptr( 0 ) ); + + InitReqId( aEvent ); + } + +// --------------------------------------------------------------------------- +// CXIMPEventCapsule::CXIMPEventCapsule() +// --------------------------------------------------------------------------- +// +CXIMPEventCapsule::CXIMPEventCapsule( TBool aEventReady ) +: iEventReady( aEventReady ) + { + } + + +// --------------------------------------------------------------------------- +// CXIMPEventCapsule::EventData() +// --------------------------------------------------------------------------- +// +EXPORT_C const TDesC8& CXIMPEventCapsule::EventData() const + { + return iEventBuf; + } + + +// --------------------------------------------------------------------------- +// CXIMPEventCapsule::EventData() +// --------------------------------------------------------------------------- +// +EXPORT_C TXIMPRequestId CXIMPEventCapsule::EventReqId() const + { + return iReqId; + } + + +// --------------------------------------------------------------------------- +// CXIMPEventCapsule::EventType() +// --------------------------------------------------------------------------- +// +EXPORT_C TInt32 CXIMPEventCapsule::EventType() const + { + return iEventType; + } + + +// --------------------------------------------------------------------------- +// CXIMPEventCapsule::Ready() +// --------------------------------------------------------------------------- +// +EXPORT_C TBool CXIMPEventCapsule::Ready() const + { + return iEventReady; + } + +// --------------------------------------------------------------------------- +// CXIMPEventCapsule::UpdateEventDataL() +// --------------------------------------------------------------------------- +// +EXPORT_C void CXIMPEventCapsule::UpdateEventDataL( CXIMPApiEventBase& aEvent ) + { + XIMPEventCodec::PackL( aEvent, iEventType, iBuffer ); + XIMPRBuf8Helper::SetNewValueL( iEventBuf, iBuffer->Ptr( 0 ) ); + + InitReqId( aEvent ); + } + +// --------------------------------------------------------------------------- +// CXIMPEventCapsule::UpdateEventData() +// --------------------------------------------------------------------------- +// +EXPORT_C void CXIMPEventCapsule::UpdateEventData( CXIMPApiEventBase& aEvent ) + { + // If update fails old data is used. + TRAP_IGNORE( + UpdateEventDataL( aEvent ); + ) + } + +// --------------------------------------------------------------------------- +// CXIMPEventCapsule::SetReady() +// --------------------------------------------------------------------------- +// +EXPORT_C void CXIMPEventCapsule::SetReady( TBool aReady ) + { + iEventReady = aReady; + } + +// --------------------------------------------------------------------------- +// CXIMPEventCapsule::operator<() +// --------------------------------------------------------------------------- +// +TBool CXIMPEventCapsule::operator<( const CXIMPEventCapsule& aOther ) const + { + return iTimeStamp < aOther.iTimeStamp; + } + +// --------------------------------------------------------------------------- +// CXIMPEventCapsule::SetTimeStamp() +// --------------------------------------------------------------------------- +// +void CXIMPEventCapsule::SetTimeStamp( TUint32 aTimeStamp ) + { + iTimeStamp = aTimeStamp; + } + + +// --------------------------------------------------------------------------- +// CXIMPEventCapsule::InitReqId() +// --------------------------------------------------------------------------- +// +void CXIMPEventCapsule::InitReqId( const CXIMPApiEventBase& aEvent ) + { + if( aEvent.Base().GetInterfaceId() == MXIMPRequestCompleteEvent::KInterfaceId ) + { + const MXIMPRequestCompleteEvent* complEvent = + TXIMPGetInterface< const MXIMPRequestCompleteEvent >::From( aEvent.Base(), + MXIMPBase::EPanicIfUnknown ); + + iReqId = complEvent->RequestId(); + } + } + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcprocessor/ximpeventcapsule.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcprocessor/ximpeventcapsule.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,146 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Event capsulation for shared ownership. +* +*/ + +#ifndef CXIMPEVENTCAPSULE_H +#define CXIMPEVENTCAPSULE_H + +#include +#include + +class CXIMPApiEventBase; + +/** + * Event capsulation for shared ownership. + * + * @lib ximpprocessor.lib + * @since S60 v3.2 + */ +class CXIMPEventCapsule : public CObject + { + +public: + + /** + * Construction + * @aEvent. Event for capsulation. Ownership transferred. + */ + IMPORT_C static CXIMPEventCapsule* NewL( CXIMPApiEventBase& aEvent, + TBool aEventReady = ETrue ); + +private: + + /** + * Direct deletion not allowed. + * Deletion happens through reference counting. + */ + ~CXIMPEventCapsule(); + CXIMPEventCapsule( TBool aEventReady ); + void ConstructL( CXIMPApiEventBase& aEvent ); + +public: // new methods + + /** + * Reference to capsulated event + * @return packed event. + */ + IMPORT_C const TDesC8& EventData() const; + + + /** + * Req Id of capsulated event + * @return Req Id. If Capsuled event is + * some other type than RequestComplete event, + * then req id has TXIMPRequestId::Null() value. + */ + IMPORT_C TXIMPRequestId EventReqId() const; + + /** + * Event type for filtering events. + * @return Event interface id. + */ + IMPORT_C TInt32 EventType() const; + + /** + * Event is ready + * @return ETrue if event is ready. EFalse if not. + */ + IMPORT_C TBool Ready() const; + + /** + * Update event data. + */ + IMPORT_C void UpdateEventDataL( CXIMPApiEventBase& aEvent ); + IMPORT_C void UpdateEventData( CXIMPApiEventBase& aEvent ); + + /** + * Set event ready for sending. + */ + IMPORT_C void SetReady( TBool aReady ); + + /** + * Check which one should be handled first. + */ + TBool operator<( const CXIMPEventCapsule& aOther ) const; + + /** + * Set timestamp for order check. + */ + void SetTimeStamp( TUint32 aTimeStamp ); + + +private: // Helpers + + /** + * Initializes the reg id member if the passed event is + * req complete type. + */ + void InitReqId( const CXIMPApiEventBase& aEvent ); + +private: // Data + + /** + * Capsulated event. Owns. + */ + RBuf8 iEventBuf; + + /** + * Event type for filtering + */ + TInt32 iEventType; + + /** + * If event is not ready this is set as ETrue + */ + TBool iEventReady; + + /** + * Used for packing. + */ + CBufFlat* iBuffer; + + /** + * Time stamp for order. + */ + TUint32 iTimeStamp; + + /** + * Request ID. + */ + TXIMPRequestId iReqId; + }; + +#endif //CXIMPEVENTCAPSULE_H diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcprocessor/ximpeventmanager.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcprocessor/ximpeventmanager.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,177 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework server event manager implementation +* +*/ + +#include "ximpeventmanager.h" +#include "ximpeventcapsule.h" +#include "ximpcontexteventqueue.h" +#include "ximppsccontextimp.h" + + +// ======== LOCAL FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// OrderOfEvents() +// --------------------------------------------------------------------------- +// +TInt OrderOfEvents( const CXIMPContextEventQueue& aFirst, const CXIMPContextEventQueue& aSecond ) + { + TUint32 firstSessionId = aFirst.SessionIdOfQueue(); + TUint32 secondSessionId = aSecond.SessionIdOfQueue(); + if( firstSessionId < secondSessionId ) + { + return -1; + } + else if( firstSessionId == secondSessionId ) + { + return 0; + } + else + { + return 1; + } + } + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// CXIMPEventManager::CXIMPHostManager() +// --------------------------------------------------------------------------- +// +CXIMPEventManager::CXIMPEventManager() + { + } + + +// --------------------------------------------------------------------------- +// CXIMPEventManager::ConstructL() +// --------------------------------------------------------------------------- +// +void CXIMPEventManager::ConstructL() + { + } + + +// --------------------------------------------------------------------------- +// CXIMPEventManager::NewL() +// --------------------------------------------------------------------------- +// +EXPORT_C CXIMPEventManager* CXIMPEventManager::NewL() + { + CXIMPEventManager* self = new( ELeave ) CXIMPEventManager; + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + + +// --------------------------------------------------------------------------- +// CXIMPEventManager::~CXIMPEventManager() +// --------------------------------------------------------------------------- +// +CXIMPEventManager::~CXIMPEventManager() + { + iEventQueues.Close(); + } + + +// --------------------------------------------------------------------------- +// CXIMPEventManager::RegisterSessionQueueL() +// --------------------------------------------------------------------------- +// +EXPORT_C void CXIMPEventManager::RegisterSessionQueueL( CXIMPContextEventQueue& aQueue ) + { + TLinearOrder< CXIMPContextEventQueue > order( *OrderOfEvents ); + iEventQueues.InsertInOrderL( &aQueue, order ); + } + +// --------------------------------------------------------------------------- +// CXIMPEventManager::UnregisterSessionQueue() +// --------------------------------------------------------------------------- +// +EXPORT_C void CXIMPEventManager::UnregisterSessionQueue( CXIMPContextEventQueue& aQueue ) + { + TLinearOrder< CXIMPContextEventQueue > order( *OrderOfEvents ); + TInt index = iEventQueues.FindInOrder( &aQueue, order ); + if( index >= 0 ) + { + iEventQueues.Remove( index ); + } + } + +// --------------------------------------------------------------------------- +// CXIMPEventManager::AddEventL() +// --------------------------------------------------------------------------- +// +EXPORT_C void CXIMPEventManager::AddEventL( CXIMPApiEventBase& aEvent, + CXIMPPscContext* aContext ) + { + if( aContext ) + { + RPointerArray< CXIMPPscContext > array; + CleanupClosePushL( array ); + array.AppendL( aContext ); + AddEventL( aEvent, array ); + CleanupStack::PopAndDestroy(); // array + } + } + +// --------------------------------------------------------------------------- +// CXIMPEventManager::ActivateEventL() +// --------------------------------------------------------------------------- +// +EXPORT_C void CXIMPEventManager::ActivateEventL( CXIMPApiEventBase& aEvent, + CXIMPPscContext* aContext ) + { + if( aContext ) + { + aContext->EventQueue().ActivatePreservedEventL( aEvent ); + } + } + +// --------------------------------------------------------------------------- +// CXIMPEventManager::ActivateRequestCompleteEvent() +// --------------------------------------------------------------------------- +// +EXPORT_C void CXIMPEventManager::ActivateRequestCompleteEvent( CXIMPRequestCompleteEventImp& aEvent, + CXIMPPscContext* aContext ) + { + if( aContext ) + { + aContext->EventQueue().ActivateRequestCompleteEvent( aEvent ); + } + } + +// --------------------------------------------------------------------------- +// CXIMPEventManager::AddEventL() +// --------------------------------------------------------------------------- +// +EXPORT_C void CXIMPEventManager::AddEventL( CXIMPApiEventBase& aEvent, + RPointerArray< CXIMPPscContext >& aSessions ) + { + CXIMPEventCapsule* capsulatedEvent = CXIMPEventCapsule::NewL( aEvent ); + CleanupClosePushL( *capsulatedEvent ); + TInt sessionCount = aSessions.Count(); + for( TInt a = 0; a < sessionCount; ++a ) + { + aSessions[ a ]->EventQueue().AddEventL( *capsulatedEvent ); + } + CleanupStack::PopAndDestroy( capsulatedEvent ); + } + + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcprocessor/ximpeventmanager.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcprocessor/ximpeventmanager.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,104 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework server event manager implementation +* +*/ + +#ifndef C_PSCEVENTMANAGER_H +#define C_PSCEVENTMANAGER_H + + +#include "ximpbase.h" +#include + +class CXIMPContextEventQueue; +class CXIMPApiEventBase; +class CXIMPPscContext; +class CXIMPRequestCompleteEventImp; + +/** + * Event handling. + * + * @since S60 v4.0 + */ +class CXIMPEventManager : public CBase + { + +public: + + /** + * Construction + */ + IMPORT_C static CXIMPEventManager* NewL(); + + /** + * Destruction + */ + virtual ~CXIMPEventManager(); + +private: + + /** + * Construction + */ + CXIMPEventManager(); + + /** + * Construction + */ + void ConstructL(); + + +public: // New methods + + /** + * Register session queue. + * @param aQueue Session queue for registration. + */ + IMPORT_C void RegisterSessionQueueL( CXIMPContextEventQueue& aQueue ); + + /** + * Unregister session by id. + * @param aSessionId, Session id for unregistration. + */ + IMPORT_C void UnregisterSessionQueue( CXIMPContextEventQueue& aQueue ); + + /** + * Add event to session. + * @param aEvent Event to add. + * @param aSessionId, Session that receives event. + */ + IMPORT_C void AddEventL( CXIMPApiEventBase& aEvent, CXIMPPscContext* aContext ); + IMPORT_C void ActivateEventL( CXIMPApiEventBase& aEvent, CXIMPPscContext* aContext ); + IMPORT_C void ActivateRequestCompleteEvent( CXIMPRequestCompleteEventImp& aEvent, + CXIMPPscContext* aContext ); + + /** + * Add event to session. + * @param aEvent Event to add. + * @param aSessionId, Array of sessions that receives event. + */ + IMPORT_C void AddEventL( CXIMPApiEventBase& aEvent, + RPointerArray< CXIMPPscContext >& aSessions ); +private: // data + + /** + * Array of event queues. + * Does not own items. + */ + RPointerArray< CXIMPContextEventQueue > iEventQueues; + }; + + +#endif // C_PSCEVENTMANAGER_H diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcprocessor/ximpeventqueueobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcprocessor/ximpeventqueueobserver.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,52 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Observer for Event queue +* +*/ + +#ifndef MXIMPEVENTQUEUEOBSERVER_H +#define MXIMPEVENTQUEUEOBSERVER_H + +#include + +/** + * Event queue observer. + * + * @since S60 v3.2 + */ +class MXIMPEventQueueObserver + { +protected: + + /** + * Protected destructor. Observer instancies + * can't be destroyed via this interface. + */ + virtual ~MXIMPEventQueueObserver() {} + +public: + + /** + * Notifies observer that new event was + * added to event queue and it is + * available for observer consumption. + */ + virtual void NewEventAvailable() = 0; + + }; + +#endif // MXIMPEVENTQUEUEOBSERVER_H + + + diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcprocessor/ximpfeaturemanager.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcprocessor/ximpfeaturemanager.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,103 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: feature manager of XIMP +* +*/ + + +#include "ximpfeaturemanager.h" +#include "ximpfeatureinfoimp.h" +#include "ximpobjecthelpers.h" + +#include + +// ======== LOCAL FUNCTIONS ======== + + +// ======== MEMBER FUNCTIONS ======== + + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +CXIMPFeatureManager::CXIMPFeatureManager() + { + + } + + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +void CXIMPFeatureManager::ConstructL() + { + //iCenRep = CRepository::NewL(); + } + + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +CXIMPFeatureManager* CXIMPFeatureManager::NewL() + { + CXIMPFeatureManager* self = new( ELeave ) CXIMPFeatureManager; + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +CXIMPFeatureManager::~CXIMPFeatureManager() + { + //delete iCenRep; + } + + +// ----------------------------------------------------------------------------- +// CXIMPFeatureManager::GetProtocolsL() +// ----------------------------------------------------------------------------- +// +EXPORT_C HBufC8* CXIMPFeatureManager::GetFrameworkFeaturesL() + { + CXIMPFeatureInfoImp* featInfo = CXIMPFeatureInfoImp::NewLC(); + + /* + TInt featuresLength( KErrNotFound ); + iCenRep->Get( 0x1, featuresLength ); + + HBufC8* tmpBuffer = HBufC8::NewLC( featuresLength ); + TPtr8 tmpPtr( tmpBuffer->Des() ); + iCenRep->Get( 0x2, tmpPtr ); + + featInfo->AddFeatureL( tmpPtr ); + + CleanupStack::PopAndDestroy( tmpBuffer ); + */ + + HBufC8* pack = TXIMPObjectPacker< CXIMPFeatureInfoImp >::PackL( *featInfo ); + CleanupStack::PopAndDestroy( featInfo ); + + return pack; + } + +// End of file + diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcprocessor/ximpfeaturemanager.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcprocessor/ximpfeaturemanager.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,89 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: implementation of CXIMPFeatureManager +* +*/ + +#ifndef C_CPSCFEATUREMANAGER_H +#define C_CPSCFEATUREMANAGER_H + + +#include + +class CRepository; + +/** + * ?one_line_short_description + * + * ?more_complete_description + * + * @lib ?library + * @since S60 v4.0 + */ +class CXIMPFeatureManager : public CBase + { + +public: + + static CXIMPFeatureManager* NewL(); + + + virtual ~CXIMPFeatureManager(); + + +private: + + CXIMPFeatureManager(); + void ConstructL(); + + +public: + + /** + * ?description + * + * @since S60 ?S60_version + * @param ?arg1 ?description + * @param ?arg2 ?description + * @return ?description + */ + IMPORT_C HBufC8* GetFrameworkFeaturesL(); + + +private: + + +private: // data + + /** + * ?description_of_member + */ + //?type ?member_name; + + /** + * Pointer to a cenrep client + * Own. + */ + CRepository* iCenRep; + + /** + * ?description_of_pointer_member + * Not own. *** Write "Not own" if some other class owns this object. + */ + //?type* ?member_name; + + }; + + +#endif // C_CPSCFEATUREMANAGER_H diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcprocessor/ximpglobals.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcprocessor/ximpglobals.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,222 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Presence Service Connection globals holder + * +*/ + + +#include "ximpglobals.h" +#include "ximppluginfactory.h" +#include "ximpfeaturemanager.h" +#include "ximphostmanager.h" +#include "ximpoperationfactory.h" +#include "ximpglobalsobserver.h" + +// ============================ HELPER CLASS =============================== + + +/** + * CXIMPGlobals nested structure + * to hold global objects. + */ +NONSHARABLE_STRUCT( CXIMPGlobals::SGlobals ) + { + /** + * Plugin Factory + * Owned. + */ + CXIMPPluginFactory* iPluginFactory; + + /** + * Feature Manager + * Owned. + */ + CXIMPFeatureManager* iFeatureManager; + + /** + * Host Manager + * Owned. + */ + CXIMPHostManager* iHostManager; + + /** + * Operation factory + * Owned. + */ + MXIMPOperationFactory* iOperationFactory; + + /** + * Observer for events from globals. + * Only internal hostmanager notifications for now. + * Not owned. + */ + MXIMPGlobalsObserver* iGlobalsObserver; + }; + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CXIMPGlobals::InstallL() +// Singleton access method. +// ----------------------------------------------------------------------------- +// +EXPORT_C void CXIMPGlobals::InstallL( + MXIMPOperationFactory* aOperationFactory, + MXIMPGlobalsObserver* aGlobalsObserver + ) + { + CXIMPGlobals* singleton = ( CXIMPGlobals* ) Dll::Tls(); + + if( !singleton ) + { + singleton = CXIMPGlobals::NewLC( aOperationFactory, aGlobalsObserver ); + User::LeaveIfError( Dll::SetTls( singleton ) ); + CleanupStack::Pop( singleton ); + } + else + { + User::Panic( _L("cximpglobals"), KErrAlreadyExists ); + } + } + +// ----------------------------------------------------------------------------- +// CXIMPGlobals::Instance() +// Singleton access method. +// ----------------------------------------------------------------------------- +// +EXPORT_C CXIMPGlobals* CXIMPGlobals::Instance() + { + CXIMPGlobals* singleton = ( CXIMPGlobals* ) Dll::Tls(); + if( !singleton ) + { + User::Panic( _L("cximpglobals"), KErrNotFound ); + } + + return singleton; + } + +// ----------------------------------------------------------------------------- +// CXIMPGlobals::Uninstall() +// Singleton access method. +// ----------------------------------------------------------------------------- +// +EXPORT_C void CXIMPGlobals::UninstallD() + { + delete ( CXIMPGlobals* ) Dll::Tls(); + } + +// ----------------------------------------------------------------------------- +// CXIMPGlobals::NewLC() +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CXIMPGlobals* CXIMPGlobals::NewLC( MXIMPOperationFactory* aOperationFactory, + MXIMPGlobalsObserver* aGlobalsObserver + ) + { + CXIMPGlobals* self = new( ELeave ) CXIMPGlobals; + CleanupStack::PushL( self ); + self->ConstructL( aOperationFactory, aGlobalsObserver ); + return self; + } + +// ----------------------------------------------------------------------------- +// CXIMPGlobals::CXIMPGlobals() +// ----------------------------------------------------------------------------- +// +CXIMPGlobals::CXIMPGlobals() + { + } + +// ----------------------------------------------------------------------------- +// CXIMPGlobals::~CXIMPGlobals() +// ----------------------------------------------------------------------------- +// +CXIMPGlobals::~CXIMPGlobals() + { + //Destroy global objects + if( iGlobals ) + { + delete iGlobals->iPluginFactory; + delete iGlobals->iFeatureManager; + delete iGlobals->iHostManager; + delete iGlobals->iOperationFactory; + } + + //And the holder + delete iGlobals; + Dll::SetTls( NULL ); + + #if _BullseyeCoverage + cov_write(); + #endif + } + +// ----------------------------------------------------------------------------- +// CXIMPGlobals::ConstructL() +// ----------------------------------------------------------------------------- +// +void CXIMPGlobals::ConstructL( + MXIMPOperationFactory* aOperationFactory, + MXIMPGlobalsObserver* aGlobalsObserver + ) + { + //Reserve the object holder and zero initialize it + iGlobals = new ( ELeave ) SGlobals; + Mem::FillZ( iGlobals, sizeof( SGlobals ) ); + + //Construct needed global objects + iGlobals->iPluginFactory = CXIMPPluginFactory::NewL(); + iGlobals->iFeatureManager = CXIMPFeatureManager::NewL(); + iGlobals->iHostManager = CXIMPHostManager::NewL(); + if( !aOperationFactory ) + { + User::Leave( KErrArgument ); + } + + iGlobals->iOperationFactory = aOperationFactory; + iGlobals->iGlobalsObserver = aGlobalsObserver; + } + + +EXPORT_C CXIMPPluginFactory* CXIMPGlobals::PluginFactory() + { + return iGlobals->iPluginFactory; + } + + +EXPORT_C CXIMPFeatureManager* CXIMPGlobals::FeatureManager() + { + return iGlobals->iFeatureManager; + } + +EXPORT_C CXIMPHostManager* CXIMPGlobals::HostManager() + { + return iGlobals->iHostManager; + } + +EXPORT_C MXIMPOperationFactory* CXIMPGlobals::OperationFactory() + { + return iGlobals->iOperationFactory; + } + +EXPORT_C void CXIMPGlobals::NoMoreHosts() + { + // inform the observer (PscServer) about host dying. + iGlobals->iGlobalsObserver->AllHostsDied(); + } + +// End of file + + diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcprocessor/ximpglobals.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcprocessor/ximpglobals.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,115 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Presence Service Connection globals holder + * +*/ + +#ifndef CPSCGLOBALS_H +#define CPSCGLOBALS_H + +#include + +class CXIMPPluginFactory; +class CXIMPFeatureManager; +class CXIMPHostManager; +class MXIMPOperationFactory; +class MXIMPGlobalsObserver; + +/** + * Singleton for XIMP Framework client IF library. + * + * @lib ximpprocessor.dll + * @since S60 v4.0 + */ +class CXIMPGlobals : public CBase + { + private: + + /** Private nested structure to hold global objects */ + struct SGlobals; + + public: // singleton access + + /** + * Singleton access method. + * + * Gets pointer to Psc Globals singleton. + * + */ + IMPORT_C static CXIMPGlobals* Instance(); + + IMPORT_C static void InstallL( MXIMPOperationFactory* aOperationFactory, MXIMPGlobalsObserver* aGlobalsObserver ); + + IMPORT_C static void UninstallD(); + + private: + + /** + * Two-phased constructor. + * Leaves created object on the CleanupStack. + */ + static CXIMPGlobals* NewLC( MXIMPOperationFactory* aOperationFactory, + MXIMPGlobalsObserver* aGlobalsObserver ); + + + /** + * C++ default constructor. + */ + CXIMPGlobals(); + + + /** + * Private destructor. + * + * Singleton holder is reference counted. + * It is automaticly destroyed when last + * holded object or reference is destroyed. + */ + ~CXIMPGlobals(); + + /** + * Symbian 2nd phase constructor + */ + void ConstructL( MXIMPOperationFactory* aOperationFactory, + MXIMPGlobalsObserver* aGlobalsObserver ); + + public: + + IMPORT_C CXIMPPluginFactory* PluginFactory(); + IMPORT_C CXIMPFeatureManager* FeatureManager(); + IMPORT_C CXIMPHostManager* HostManager(); + IMPORT_C MXIMPOperationFactory* OperationFactory(); + + /** + * Host manager informs the globals that there are no more hosts. + * This is signalled to the server. The point is to keep the + * server alive for the right time. + */ + IMPORT_C void NoMoreHosts(); + + // IMPORT_C CPscVariant* PscVariant); + + private: // Data + + /** + * Object holder having pointers to global objects. + * Both holder and pointed objects owned. + */ + SGlobals* iGlobals; + + }; + +#endif // CPSCGLOBALS_H + + diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcprocessor/ximpglobalsobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcprocessor/ximpglobalsobserver.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,44 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Presence Service Connection observer for events from Globals + * +*/ + + +#ifndef XIMPCPSCGLOBALSOBSERVER_H +#define XIMPCPSCGLOBALSOBSERVER_H + +#include + +/** + * Observer interface for events originating from the singleton "globals" + * holder. + * + * @lib ximpoperation.dll + * @since S60 v4.0 + */ +class MXIMPGlobalsObserver + { + public: + + /** + * Signal about host deletion. + * The server can shutdown itself after this. + */ + virtual void AllHostsDied() = 0; + }; + +#endif // XIMPCPSCGLOBALSOBSERVER_H + + diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcprocessor/ximphostimp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcprocessor/ximphostimp.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,1104 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Presence connection host + * +*/ + +#include +#include + +#include "ximpapiobjbase.h" +#include "ximpstatusimp.h" +#include "ximpoperationbase.h" +#include "ximphostimp.h" +#include "ximpglobals.h" +#include "ximppluginfactory.h" +#include "ximpeventmanager.h" +#include "ximphoststates.h" +#include "ximpcontextstateeventimp.h" +#include "ximpobjectfactoryimp.h" +#include "ximppanics.h" +#include "ximppsccontextimp.h" +#include "presencedatacacheimp.h" +#include "ximpserviceinfoimp.h" +#include "ximpoperationbase.h" +#include "ximpoperationfactory.h" +#include "ximpoperationfactory1.h" +#include "ximpobjecthelpers.h" +#include "ximpoperationdefs.h" +#include "ximpcontexteventqueue.h" +#include "ximphostmanager.h" +#include "ximpidentityimp.h" +#include "ximprestrictedobjectcollectionimp.h" +#include "ximprequestcompleteeventimp.h" +#include "ximpcontextclientinfoimp.h" + +#include "protocolpresencedatahostimp.h" + +#include "protocolpresenceauthorizationdatahostimp.h" +#include "protocolpresencepublishingdatahostimp.h" +#include "protocolpresencewatchingdatahostimp.h" +#include "protocolpresentitygroupsdatahostimp.h" +#include "ximpprotocolrequestcompleteeventimp.h" + +#include + +#include "ximpdlluids.hrh" +#include "ximptrace.h" + +// TODO: illegal dependency to presence operations +#include "presenceoperationdefs.h" + +// ======== LOCAL FUNCTIONS ======== +const TInt KPluginArrayGranularity = 3; + + +// --------------------------------------------------------------------------- +// OrderOfObservers() +// --------------------------------------------------------------------------- +// +TInt OrderOfObservers( const MXIMPProtocolConnectionHostObserver& aA, + const MXIMPProtocolConnectionHostObserver& aB ) + { + if( &aA < &aB ) + { + return -1; + } + else if( &aA > &aB ) + { + return 1; + } + return 0; + } + +// ======== MEMBER FUNCTIONS ======== + +using namespace NXIMPHost; + +// This should be variated. Branding variation can be one +// possibility. One is to leave adaptation deside how soon +// cleanup will be done. +// Now 5 sec used for testing purposes. Better value could be +// some minutes. +const TInt KPscHostCleanerTimerLength = 5; // in sec + +// --------------------------------------------------------------------------- +// CXIMPHost::CXIMPHost() +// --------------------------------------------------------------------------- +// +CXIMPHost::CXIMPHost( MXIMPProtocolConnection& aConnection, TInt32 aProtocolUid ) +: iConnection( aConnection ), iProtocolUid( aProtocolUid ) + { + iState = NXIMPHost::EXIMPNotConnected; + + iHostOriginatedOpIndex = 1; + + iReferences = 1; + + iReqIdBuilder.SetSessionId( (unsigned) this ); + + iForcedTearDown = EFalse; + } + + +// --------------------------------------------------------------------------- +// CXIMPHost::ConstructL() +// --------------------------------------------------------------------------- +// +void CXIMPHost::ConstructL() + { + iObjFactory = CXIMPObjectFactoryImp::NewL(); + iEventManager = CXIMPEventManager::NewL(); + + iPresenceDataHost = CProtocolPresenceDataHostImp::NewL( *this ); + + iDataHostArray = new(ELeave)CArrayFixFlat(KPluginArrayGranularity); + + LoadDataHostArrayL() ; + +/* iDataCache = CPresenceDataCache::NewL( *this ); + iAuthDataHost = CProtocolPresenceAuthorizationDataHostImp::NewL( *this ); + iPublishingDataHost = CProtocolPresencePublishingDataHostImp::NewL( *this ); + iWatchingDataHost = CProtocolPresenceWatchingDataHostImp::NewL( *this ); + iGroupsDataHost = CProtocolPresentityGroupsDataHostImp::NewL( *this ); +*/ + iCleanerTimer = CPeriodic::NewL( CActive::EPriorityStandard ); + + for ( int i = 0;i < 5;i++ ) + { + iCallBack.Append( new ( ELeave ) CAsyncCallBack( CActive::EPriorityHigh ) ); + } + + iCallBack[ECompleteRequestCallback]->Set( TCallBack( CompleteRequestCallback, this ) ); + iCallBack[ECompleteAdaptationRequestCallback]->Set( TCallBack( CompleteAdaptationRequestCallback, this ) ); + iCallBack[ECompleteSessionMgmtRequestCallback]->Set( TCallBack( CompleteSessionMgmtRequestCallback, this ) ); + iCallBack[ECompleteInternalRequestCallback]->Set( TCallBack( CompleteInternalRequestCallback, this ) ); + iCallBack[EStartProcessCallback]->Set( TCallBack( StartProcessCallback, this ) ); + + iAdaptationReqCompleteEvent = CXIMPProtocolRequestCompleteEventImp::NewL(); + + StartCleanerTimer(); + } + + +// --------------------------------------------------------------------------- +// CXIMPHost::NewLC() +// --------------------------------------------------------------------------- +// +EXPORT_C CXIMPHost* CXIMPHost::NewLC( MXIMPProtocolConnection& aConnection, TInt32 aProtocolUid ) + { + CXIMPHost* self = new( ELeave ) CXIMPHost( aConnection, aProtocolUid ); + CleanupClosePushL( *self ); + self->ConstructL(); + return self; + } + + +// --------------------------------------------------------------------------- +// CXIMPHost::~CXIMPHost() +// --------------------------------------------------------------------------- +// +CXIMPHost::~CXIMPHost() + { + __ASSERT_ALWAYS( iReferences == 0, User::Panic( NXIMPPrivPanic::KCategory, NXIMPPrivPanic::EHostStillReferenced ) ); + + delete iCleanerTimer; + + delete iObjFactory; + iOperations.Close(); + delete iEventManager; + __ASSERT_ALWAYS( iCurrentOperation == 0, + User::Panic( NXIMPPrivPanic::KCategory, NXIMPPrivPanic::EHostCurrentOperationStillActive ) ); + iRegSessions.Close(); + + delete iPresenceDataHost; + + if ( iDataHostArray ) + { + TInt idx = KErrNotFound; + while( iDataHostArray->Count() ) + { + idx = iDataHostArray->Count() - 1; + // Delete object + delete iDataHostArray->At( idx ); + // Delete element + iDataHostArray->Delete( idx ); + } + } + delete iDataHostArray; + + /* delete iDataCache; + delete iAuthDataHost; + delete iPublishingDataHost; + delete iWatchingDataHost; + delete iGroupsDataHost; +*/ + // delete iCallBack; + iCallBack.ResetAndDestroy(); + + CXIMPGlobals::Instance()->HostManager()->DisassociateHost( this ); + + delete iAdaptationReqCompleteEvent; + iConnectionHostObservers.Reset(); + } + +// --------------------------------------------------------------------------- +// CXIMPHost::Open() +// --------------------------------------------------------------------------- +// +void CXIMPHost::Open() + { + iReferences++; + } + +// --------------------------------------------------------------------------- +// CXIMPHost::Close() +// --------------------------------------------------------------------------- +// +void CXIMPHost::Close() + { + __ASSERT_ALWAYS( iReferences >= 0, User::Panic( NXIMPPrivPanic::KCategory, NXIMPPrivPanic::EHostNegativeReferenceCount )); + + iReferences--; + + if ( iReferences <= 0 ) + { + delete this; + } + } + + +// --------------------------------------------------------------------------- +// Implement supported interface access. +// --------------------------------------------------------------------------- +// +XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CXIMPHost, MXIMPProtocolConnectionHost ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() +XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CXIMPHost, MXIMPProtocolConnectionHost ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + + + +// --------------------------------------------------------------------------- +// CXIMPHost::ObjectFactory() +// --------------------------------------------------------------------------- +// +MXIMPObjectFactory& CXIMPHost::ObjectFactory() + { + return *iObjFactory; + } + +// --------------------------------------------------------------------------- +// From MXIMPProtocolConnectionHost class. +// CXIMPHost::AuthorizationDataHost() +// --------------------------------------------------------------------------- +// +MProtocolPresenceDataHost& CXIMPHost::ProtocolPresenceDataHost() + { + return *iPresenceDataHost; + } + + +// --------------------------------------------------------------------------- +// CXIMPHost::RegisterObserverL() +// --------------------------------------------------------------------------- +// +void CXIMPHost::RegisterObserverL( + MXIMPProtocolConnectionHostObserver& aObserver, + const TArray* aEventFilter /*= NULL*/ ) + { + XIMP_UNUSED_FORMAL_PARAM( aEventFilter ); + TLinearOrder< MXIMPProtocolConnectionHostObserver > order( *OrderOfObservers ); + TInt error = iConnectionHostObservers.InsertInOrder( &aObserver, order ); + if( error != KErrAlreadyExists ) + { + User::LeaveIfError( error ); + } + } + +// --------------------------------------------------------------------------- +// CXIMPHost::UnregisterConnectionHostObserver() +// --------------------------------------------------------------------------- +// +void CXIMPHost::UnregisterConnectionHostObserver( + MXIMPProtocolConnectionHostObserver& aObserver ) + { + TLinearOrder< MXIMPProtocolConnectionHostObserver > order( *OrderOfObservers ); + TInt index = iConnectionHostObservers.FindInOrder( &aObserver, order ); + if( index > KErrNotFound ) + { + iConnectionHostObservers.Remove( index ); + } + } + +// --------------------------------------------------------------------------- +// CXIMPHost::HandleRequestCompleted() +// --------------------------------------------------------------------------- +// +void CXIMPHost::HandleRequestCompleted( + TXIMPRequestId aReqId, + TInt aResultCode ) + { + CXIMPOperationBase& operation = OperationForRequestId( aReqId ); + + operation.SetResultCode( aResultCode ); + CompleteRequest( aReqId ); + } + +// --------------------------------------------------------------------------- +// CXIMPHost::HandleRequestCompleted() +// --------------------------------------------------------------------------- +// +void CXIMPHost::HandleRequestCompleted( TXIMPRequestId aReqId, + MXIMPStatus* aResult ) + { + CXIMPOperationBase& operation = OperationForRequestId( aReqId ); + + operation.SetStatus( aResult ); + CompleteRequest( aReqId ); + } + + +// --------------------------------------------------------------------------- +// CXIMPHost::HandleRequestCompleted() +// --------------------------------------------------------------------------- +// +void CXIMPHost::HandleRequestCompleted( TXIMPRequestId aReqId, + MXIMPStatus* aResult, + MXIMPBase* aParameter ) + { + CXIMPOperationBase& operation = OperationForRequestId( aReqId ); + + operation.SetObjectCollection( aParameter ); + HandleRequestCompleted( aReqId, aResult ); + } + +// --------------------------------------------------------------------------- +// CXIMPHost::CompleteRequest() +// --------------------------------------------------------------------------- +// +void CXIMPHost::CompleteRequest( TXIMPRequestId aReqId ) + { + CXIMPOperationBase& operation = OperationForRequestId( aReqId ); + +#ifdef _DEBUG + if ( operation.Context() ) + TRACE_2( _L("Operation completed for client \"%S\" with result code: %d"), + &operation.Context()->ClientInfo()->ClientId().Identity(), + operation.Status().ResultCode() ); +#endif + + // iCallBack->Set( TCallBack( CompleteRequestCallback, this ) ); + iCallBack[ECompleteRequestCallback]->CallBack(); + } + +// --------------------------------------------------------------------------- +// CXIMPHost::HandleConnectionTerminated() +// --------------------------------------------------------------------------- +// +TXIMPRequestId CXIMPHost::HandleConnectionTerminated( MXIMPStatus* aReason ) + { + TRACE_1( _L("CXIMPHost::HandleConnectionTerminated aReason = %d"), aReason ); + // This should be set for operation as a reason. + XIMP_UNUSED_FORMAL_PARAM( aReason ); +/* + if ( iState != EXIMPConnected ) + { + // we are not in a valid state + User::Panic( NXIMPPrivPanic::KCategory, + NXIMPPrivPanic::EInvalidStateForSessionLost ); + } +*/ + TXIMPRequestId reqId; + + // tear down + // we must run the cached unbinds to force teardown + // Right way to do this is using non leaving operation add. This can be done + // if operation queue is implemented as linked list. When operation queue is fixed + // assert should be removed. + TRAPD( error, reqId = AddNewOperationL( NXIMPOps::EXIMPForcedTeardown ) ); + __ASSERT_ALWAYS( error == KErrNone, User::Panic( _L("HandleSessionLost"), -667 ) ); + + iForcedTearDown = ETrue; + + return reqId; + } + + +// --------------------------------------------------------------------------- +// CXIMPHost::UnregisterSession() +// --------------------------------------------------------------------------- +// +void CXIMPHost::UnregisterSession( CXIMPPscContext* aContext ) + { + if( !aContext ) + { + return; + } + iEventManager->UnregisterSessionQueue( aContext->EventQueue() ); + TLinearOrder< CXIMPPscContext > order( *CXIMPPscContext::OrderOfContexts ); + TInt index = iRegSessions.FindInOrder( aContext, order ); + if( index >= 0 ) + { + iPresenceDataHost->PresenceDataCache().CleanResources( *aContext ); + iRegSessions.Remove( index ); + } + } + +// --------------------------------------------------------------------------- +// CXIMPHost::FakeCompleteRequest() +// --------------------------------------------------------------------------- +// +void CXIMPHost::FakeCompleteRequest( TXIMPRequestId aReqId, TInt aResult ) + { + HandleRequestCompleted( aReqId, aResult ); + } + +// --------------------------------------------------------------------------- +// CXIMPHost::HandleAdaptationRequestCompleted() +// --------------------------------------------------------------------------- +// +void CXIMPHost::HandleAdaptationRequestCompleted( TXIMPRequestId aReqId, TInt aResult ) + { + CXIMPOperationBase& operation = OperationForRequestId( aReqId ); + + operation.SetResultCode( aResult ); + // iCallBack->Set( TCallBack( CompleteAdaptationRequestCallback, this ) ); + iCallBack[ECompleteAdaptationRequestCallback]->CallBack(); + } + +// --------------------------------------------------------------------------- +// CXIMPHost::HandleSessionMgmtRequestCompleted() +// --------------------------------------------------------------------------- +// +void CXIMPHost::HandleSessionMgmtRequestCompleted( TXIMPRequestId aReqId, TInt aResult ) + { + CXIMPOperationBase& operation = OperationForRequestId( aReqId ); + + operation.SetResultCode( aResult ); + // iCallBack->Set( TCallBack( CompleteSessionMgmtRequestCallback, this ) ); + iCallBack[ECompleteSessionMgmtRequestCallback]->CallBack(); + } + +// --------------------------------------------------------------------------- +// CXIMPHost::HandleInternalRequestCompleted() +// --------------------------------------------------------------------------- +// +void CXIMPHost::HandleInternalRequestCompleted( TXIMPRequestId aReqId, TInt aResult ) + { + CXIMPOperationBase& operation = OperationForRequestId( aReqId ); + + operation.SetResultCode( aResult ); + // iCallBack->Set( TCallBack( CompleteInternalRequestCallback, this ) ); + iCallBack[ECompleteInternalRequestCallback]->CallBack(); + } + +// --------------------------------------------------------------------------- +// CXIMPHost::PresenceDataAccess() +// --------------------------------------------------------------------------- +// +CProtocolPresenceDataHostImp& CXIMPHost::PresenceDataAccess() + { + return *iPresenceDataHost; + } + +// --------------------------------------------------------------------------- +// CXIMPHost::DataAccess() +// --------------------------------------------------------------------------- +// +/*CPresenceDataCache& CXIMPHost::DataAccess() + { + return *iDataCache; + } + +// --------------------------------------------------------------------------- +// CXIMPHost::AuthorizationDataAccess() +// --------------------------------------------------------------------------- +// +CProtocolPresenceAuthorizationDataHostImp& CXIMPHost::AuthorizationDataAccess() + { + return *iAuthDataHost; + } + +// --------------------------------------------------------------------------- +// CXIMPHost::PublishingDataAccess() +// --------------------------------------------------------------------------- +// +CProtocolPresencePublishingDataHostImp& CXIMPHost::PublishingDataAccess() + { + return *iPublishingDataHost; + } + +// --------------------------------------------------------------------------- +// CXIMPHost::WatchingDataAccess() +// --------------------------------------------------------------------------- +// +CProtocolPresenceWatchingDataHostImp& CXIMPHost::WatchingDataAccess() + { + return *iWatchingDataHost; + } + +// --------------------------------------------------------------------------- +// CXIMPHost::GroupsDataAccess() +// --------------------------------------------------------------------------- +// +CProtocolPresentityGroupsDataHostImp& CXIMPHost::GroupsDataAccess() + { + return *iGroupsDataHost; + } +*/ +// --------------------------------------------------------------------------- +// CXIMPHost::RegisterSessionL() +// --------------------------------------------------------------------------- +// +void CXIMPHost::RegisterSessionL( CXIMPPscContext* aContext ) + { + if( !aContext ) + { + User::Leave( KErrArgument ); + } + iEventManager->RegisterSessionQueueL( aContext->EventQueue() ); + TLinearOrder< CXIMPPscContext > order( *CXIMPPscContext::OrderOfContexts ); + TInt err = iRegSessions.InsertInOrder( aContext, order ); + if( err != KErrNone ) + { + iEventManager->UnregisterSessionQueue( aContext->EventQueue() ); + User::Leave( err ); + } + } + +// --------------------------------------------------------------------------- +// CXIMPHost::AddNewOperationL() +// --------------------------------------------------------------------------- +// +void CXIMPHost::AddNewOperationL( CXIMPOperationBase& aOperation ) + { + iOperations.AppendL( &aOperation ); + aOperation.SetHost( *this ); + + if ( !iProcessing ) + { + ActivateProcessing(); + } + } + +// --------------------------------------------------------------------------- +// CXIMPHost::AddNewOperationL() +// --------------------------------------------------------------------------- +// +TXIMPRequestId CXIMPHost::AddNewOperationL( NXIMPOps::TXIMPOpTypes aOpType ) + { + iReqIdBuilder.SetProtocolId( iProtocolUid ); + iReqIdBuilder.SetRequestId( iAdaptationOperationIndex ); + TXIMPRequestId reqId = iReqIdBuilder.BuildRequestId(); + + iAdaptationOperationIndex++; + CXIMPOperationBase* op = + CXIMPGlobals::Instance()->OperationFactory()->CreateOperationL( aOpType ); + CleanupStack::PushL( op ); + op->BaseConstructL( reqId, NULL ); + op->ConstructL( KNullDesC8 ); + AddNewOperationL( *op ); + CleanupStack::Pop(); //operation + return reqId; + } + +// --------------------------------------------------------------------------- +// CXIMPHost::AddNewOperationL() +// --------------------------------------------------------------------------- +// +TXIMPRequestId CXIMPHost::AddNewOperationL( CXIMPOperationBase* aOperation ) + { + iReqIdBuilder.SetProtocolId( iProtocolUid ); + iReqIdBuilder.SetRequestId( iAdaptationOperationIndex ); + TXIMPRequestId reqId = iReqIdBuilder.BuildRequestId(); + + iAdaptationOperationIndex++; + aOperation->BaseConstructL( reqId, NULL ); + aOperation->ConstructL( KNullDesC8 ); + AddNewOperationL( *aOperation ); + return reqId; + } + + +// --------------------------------------------------------------------------- +// CXIMPHost::GetConnection() +// --------------------------------------------------------------------------- +// +MXIMPProtocolConnection& CXIMPHost::GetConnection() const + { + return iConnection; + } + +// --------------------------------------------------------------------------- +// CXIMPHost::AddEventL() +// --------------------------------------------------------------------------- +// +void CXIMPHost::AddEventL( CXIMPApiEventBase& aEvent, MXIMPPscContext* aContext ) + { + AddEventL( aEvent, static_cast< CXIMPPscContext* >( aContext ) ); + } + +// --------------------------------------------------------------------------- +// CXIMPHost::AddEventL() +// --------------------------------------------------------------------------- +// +void CXIMPHost::AddEventL( CXIMPApiEventBase& aEvent, CXIMPPscContext* aContext ) + { + if( aContext ) + { + iEventManager->AddEventL( aEvent, aContext ); + } + else + { + iEventManager->AddEventL( aEvent, iRegSessions ); + } + } + +// --------------------------------------------------------------------------- +// CXIMPHost::ActivateEventL() +// --------------------------------------------------------------------------- +// +void CXIMPHost::ActivateEventL( CXIMPApiEventBase& aEvent, MXIMPPscContext* aContext ) + { + ActivateEventL( aEvent, static_cast< CXIMPPscContext* >( aContext ) ); + } + +// --------------------------------------------------------------------------- +// CXIMPHost::ActivateEventL() +// --------------------------------------------------------------------------- +// +void CXIMPHost::ActivateEventL( CXIMPApiEventBase& aEvent, CXIMPPscContext* aContext ) + { + iEventManager->ActivateEventL( aEvent, aContext ); + } + +// --------------------------------------------------------------------------- +// CXIMPHost::StartProcessing() +// --------------------------------------------------------------------------- +// +void CXIMPHost::StartProcessing() + { + CXIMPOperationBase* currentOperation = iCurrentOperation; + iCurrentOperation = NULL; + + iProcessing = EFalse; + + if( iOperations.Count() > 0 ) + { + ActivateProcessing(); + } + + delete currentOperation; // might invoke destruction of host. + } + +// --------------------------------------------------------------------------- +// CXIMPHost::ActivateProcessing() +// --------------------------------------------------------------------------- +// +void CXIMPHost::ActivateProcessing() + { + // take the first operation from the queue + if( !iCurrentOperation ) + { + if( iOperations.Count() <= 0 ) + { + return; + } + iCurrentOperation = iOperations[0]; + iOperations.Remove( 0 ); + } + + iCurrentOperation->BeginOperation(); + iProcessing = ETrue; + // iCallBack->Set( TCallBack( StartProcessCallback, this ) ); + iCallBack[EStartProcessCallback]->CallBack(); + } + +// --------------------------------------------------------------------------- +// CXIMPHost::StartProcessCallback() +// --------------------------------------------------------------------------- +// +TInt CXIMPHost::StartProcessCallback( TAny *aInstance ) + { + ( static_cast< CXIMPHost* >( aInstance ) )->DoStartProcessCallback(); + return 0; // ignored by CAsychCallBack + } + +// --------------------------------------------------------------------------- +// CXIMPHost::DoStartProcessCallbackL() +// --------------------------------------------------------------------------- +// +void CXIMPHost::DoStartProcessCallback() + { +#ifdef _DEBUG + if ( iCurrentOperation->Context() ) + TRACE_1( _L("Start processing operation for client \"%S\""), + &iCurrentOperation->Context()->ClientInfo()->ClientId().Identity() ); +#endif + + TRAPD( err, iCurrentOperation->ProcessL() ); + + if ( err != KErrNone ) + { + HandleRequestCompleted( iCurrentOperation->RequestId(), err ); + // internal operation End event and deletion of iCurrentOperation happen within CompleteRequest + } + } + +// --------------------------------------------------------------------------- +// CXIMPHost::CompleteRequestCallback() +// --------------------------------------------------------------------------- +// +TInt CXIMPHost::CompleteRequestCallback( TAny *aInstance ) + { + static_cast< CXIMPHost* >( aInstance )->DoCompleteRequestCallback(); + return 0; // ignored by CAsychCallBack + } + +// --------------------------------------------------------------------------- +// CXIMPHost::CompleteAdaptationRequestCallback() +// --------------------------------------------------------------------------- +// +TInt CXIMPHost::CompleteAdaptationRequestCallback( TAny *aInstance ) + { + static_cast< CXIMPHost* >( aInstance )->DoCompleteAdaptationRequestCallback(); + return 0; // ignored by CAsychCallBack + } + +// --------------------------------------------------------------------------- +// CXIMPHost::CompleteSessionMgmtRequestCallback() +// --------------------------------------------------------------------------- +// +TInt CXIMPHost::CompleteSessionMgmtRequestCallback( TAny *aInstance ) + { + static_cast< CXIMPHost* >( aInstance )->DoCompleteSessionMgmtRequestCallback(); + return 0; // ignored by CAsychCallBack + } + +// --------------------------------------------------------------------------- +// CXIMPHost::CompleteInternalRequestCallback() +// --------------------------------------------------------------------------- +// +TInt CXIMPHost::CompleteInternalRequestCallback( TAny *aInstance ) + { + static_cast< CXIMPHost* >( aInstance )->DoCompleteInternalRequestCallback(); + return 0; // ignored by CAsychCallBack + } + +// --------------------------------------------------------------------------- +// CXIMPHost::DoCompleteRequestCallback() +// --------------------------------------------------------------------------- +// +void CXIMPHost::DoCompleteRequestCallback() + { + TRAPD( error, iCurrentOperation->RequestCompletedL() ); + + // Get event and update result code to event's status container + CXIMPRequestCompleteEventImp* reqCompEvent = iCurrentOperation->GetReqCompleteEvent(); + + if( error != KErrNone ) + { + reqCompEvent->CompletionResultImp().SetResultCode( error ); + } + + if(!(iCurrentOperation->IsServerOperation())) + { + // send the event + iEventManager->ActivateRequestCompleteEvent( *reqCompEvent, iCurrentOperation->Context() ); + } + + iCurrentOperation->EndOperation(); + StartProcessing(); + } + +// --------------------------------------------------------------------------- +// CXIMPHost::DoCompleteAdaptationRequestCallback() +// --------------------------------------------------------------------------- +// +void CXIMPHost::DoCompleteAdaptationRequestCallback() + { + TInt leaveError = KErrNone; + TRAP( leaveError, iCurrentOperation->RequestCompletedL() ); // CSI: 42 # + + if( leaveError != KErrNone ) + { + iAdaptationReqCompleteEvent->SetResultCode( leaveError ); + } + else + { + const TXIMPRequestId reqId = iCurrentOperation->RequestId(); + const TInt result = iCurrentOperation->Status().ResultCode(); + + iAdaptationReqCompleteEvent->SetRequestId( reqId ); + iAdaptationReqCompleteEvent->SetResultCode( result ); + } + + + TInt count = iConnectionHostObservers.Count(); + for( TInt a = 0; a < count; ++a ) + { + iConnectionHostObservers[ a ]->HandleProtocolConnectionHostEvent( *this, + *iAdaptationReqCompleteEvent ); + } + + iCurrentOperation->EndOperation(); + + StartProcessing(); + } + +// --------------------------------------------------------------------------- +// CXIMPHost::DoCompleteSessionMgmtRequestCallback() +// --------------------------------------------------------------------------- +// +void CXIMPHost::DoCompleteSessionMgmtRequestCallback() + { + TRAP_IGNORE( + iCurrentOperation->RequestCompletedL(); + iCurrentOperation->EndOperation(); + ) + + StartProcessing(); + } + +// --------------------------------------------------------------------------- +// CXIMPHost::DoCompleteInternalRequestCallback() +// --------------------------------------------------------------------------- +// +void CXIMPHost::DoCompleteInternalRequestCallback() + { + TRAP_IGNORE( + iCurrentOperation->RequestCompletedL(); + iCurrentOperation->EndOperation(); + ) + + StartProcessing(); + } + +// --------------------------------------------------------------------------- +// CXIMPHost::ForcedTeardown() +// --------------------------------------------------------------------------- +// +void CXIMPHost::ForcedTeardownL() + { + // activate all cached unbinds in all contexts, + // first ones will do unshare, the last one will be the actual unbind. + // psc host FSA takes care of proper events. + // + // but if all binds failed, then there are no cached unbinds since + // each bind operation has destroyed the cached unbind. in that + // case we are already in PSCNotConnected state. + + TInt foundOps = 0; + + for ( TInt i = 0; i < iRegSessions.Count(); i++ ) + { + CXIMPPscContext* context = iRegSessions[ i ]; + CXIMPOperationBase* op = context->GetCachedUnbind(); + + // the operation might already be killed + if ( op ) + { + op->SetServerOperation(); + foundOps++; + + // This trap can be removed after event queue is changed to + // linked list. See CXIMPHost::HandleConnectionTerminated + TRAPD( err, AddNewOperationL( *op ); ); + if ( err != KErrNone ) + { + // could not append operation, so just delete it + delete op; + } + } + } + + //__ASSERT_ALWAYS( foundOps > 0, User::Panic( NXIMPPrivPanic::KCategory, NXIMPPrivPanic::ENoCachedUnbindsFound ) ); + } + + +// --------------------------------------------------------------------------- +// CXIMPHost::StartCleanerTimer() +// --------------------------------------------------------------------------- +// +void CXIMPHost::StartCleanerTimer() + { + if( !iCleanerTimer->IsActive() ) + { + TInt time = 1000000 * KPscHostCleanerTimerLength; + TCallBack callback( CleanerCallback, this ); + iCleanerTimer->Start( time, time, callback ); + } + } + + +// --------------------------------------------------------------------------- +// CXIMPHost::CreateOperationL() +// --------------------------------------------------------------------------- +// +TXIMPRequestId CXIMPHost::AddNewOperationL( + TInt aOperation, + MXIMPBase* aParam, + MXIMPBase* aParam2 /*=NULL*/ ) + { + CXIMPRestrictedObjectCollectionImp* collection = CXIMPRestrictedObjectCollectionImp::NewLC( EFalse ); + collection->AddOrReplaceTypeL( aParam ); + if( aParam2 ) + { + collection->AddOrReplaceTypeL( aParam2 ); + } + TXIMPRequestId reqId = AddNewOperationL( aOperation, collection ); + CleanupStack::Pop( collection ); + return reqId; + } + + +// --------------------------------------------------------------------------- +// CXIMPHost::AddNewOperationL() +// --------------------------------------------------------------------------- +// +TXIMPRequestId CXIMPHost::AddNewOperationL( + TInt aOperation, + CXIMPRestrictedObjectCollectionImp* aParams ) + { + CXIMPOperationBase* operation = + CXIMPGlobals::Instance()->OperationFactory()->CreateOperationL( aOperation ); + CleanupStack::PushL( operation ); + TXIMPRequestId reqId = AddNewOperationL( operation ); + CleanupStack::Pop( operation ); + operation->SetObjectCollection( aParams ); + aParams->SetObjectOwnership(); + return reqId; + } + +// --------------------------------------------------------------------------- +// CXIMPHost::CleanerCallback() +// --------------------------------------------------------------------------- +// +TInt CXIMPHost::CleanerCallback( TAny* aMyself ) + { + (static_cast(aMyself))->DoCleanerCallback(); + return 0; // ignored by CPeriodic + } + +// --------------------------------------------------------------------------- +// CXIMPHost::DoCleanerCallback() +// --------------------------------------------------------------------------- +// +void CXIMPHost::DoCleanerCallback() + { + TRAPD( err, DoCleanerCallbackL() ); + + if ( err != KErrNone ) + { + // Try to start cleaner again after interval when error happened. + StartCleanerTimer(); + } + } + +// --------------------------------------------------------------------------- +// CXIMPHost::DoCleanerCallbackL() +// --------------------------------------------------------------------------- +// +void CXIMPHost::DoCleanerCallbackL() + { + // create CleanerOperation + + iCleanerTimer->Cancel(); // CPeriodic must be stopped + + // host originated operations have session id of 0 + iReqIdBuilder.SetProtocolId( 0 ); + iReqIdBuilder.SetRequestId( iHostOriginatedOpIndex ); + TXIMPRequestId reqId = iReqIdBuilder.BuildRequestId(); + + iHostOriginatedOpIndex++; + //// for Presence Operation Cleaner + CXIMPOperationBase* op = + CXIMPGlobals::Instance()->OperationFactory()->CreateOperationL( + NPresenceOps::EXIMPCleaner ); + op->BaseConstructL( reqId, NULL ); + CleanupStack::PushL( op ); + AddNewOperationL( *op ); // ownership was transferred to operation queue + CleanupStack::Pop( op ); + + + // let every protocol host create their cleanup operation + TInt count = iDataHostArray->Count() ; + + for(TInt i=0; iAt(i)->GetCleanupOperation(); + CXIMPOperationBase* cleanupop = + CXIMPGlobals::Instance()->OperationFactory()->CreateOperationL(cleanupid); + + if ( cleanupop ) + { + cleanupop->BaseConstructL( reqIdim, NULL ); + CleanupStack::PushL( cleanupop ); + AddNewOperationL( *cleanupop ); // ownership was transferred to operation queue + CleanupStack::Pop( cleanupop ); + } + } + } + + +// --------------------------------------------------------------------------- +// CXIMPHost::OperationForRequestId() +// --------------------------------------------------------------------------- +// +CXIMPOperationBase& CXIMPHost::OperationForRequestId( TXIMPRequestId aReqId ) + { + __ASSERT_ALWAYS( iCurrentOperation, User::Panic( NXIMPPrivPanic::KCategory, + NXIMPPrivPanic::ECurrentOperationNull ) ); + + if ( iCurrentOperation->RequestId() != aReqId ) + { + // we were not processing this request, panic the plugin (and the + // server, as it is...) + User::Panic( NXIMPPlugin::KCategory, NXIMPPlugin::EInvalidRequestId ); + } + return *iCurrentOperation; + } + +// --------------------------------------------------------------------------- +// CXIMPHost::ProtocolUID() +// --------------------------------------------------------------------------- +// +TInt32 CXIMPHost::ProtocolUID() + { + return iProtocolUid; + } + + +// --------------------------------------------------------------------------- +// CXIMPHost::SetProtocolHosts() +// --------------------------------------------------------------------------- +// +void CXIMPHost::SetProtocolHosts() + { + // enumurate through all the host plugins to set the host in corresponding protocol features + TInt count = iDataHostArray->Count() ; + + for(TInt i=0; iAt(i)->SetHostToProtocol() ; + } + } +// --------------------------------------------------------------------------- +// CXIMPHost::GetProtocolHost() +// --------------------------------------------------------------------------- +// +TAny* CXIMPHost::GetProtocolHost(TInt aInterfaceId) + { + // provide interface by enumurating and getting the one + TAny* ptr = NULL ; + TInt count = iDataHostArray->Count() ; + + for(TInt i=0; iAt(i)->GetInterface(aInterfaceId); + if(ptr) + { + break ; + } + } + return ptr; + } + +void CXIMPHost::LoadDataHostArrayL() + { + RImplInfoPtrArray pluginArray; + MProtocolDataHost::ListAllImplementationsL(pluginArray) ; + if ( pluginArray.Count() ) + { + for( TInt i = 0; i < pluginArray.Count(); i++ ) + { + MProtocolDataHost* implementation = NULL ; + CImplementationInformation* info = pluginArray[ i ]; + TUid id = info->ImplementationUid(); + TRAPD(err, implementation = MProtocolDataHost::NewL( id,*this) ); + CleanupStack::PushL(implementation); + if(err == KErrNone) + { + iDataHostArray->AppendL( implementation ); + } + CleanupStack::Pop(implementation); + } + } + pluginArray.ResetAndDestroy(); + + } +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcprocessor/ximphostimp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcprocessor/ximphostimp.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,381 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Presence connection host + * +*/ + +#ifndef CPSCHOSTIMP_H +#define CPSCHOSTIMP_H + +#include +#include +#include + +#include "ximpapiobjbase.h" +#include "ximphost.h" +#include "ximpoperationdefs.h" +#include "ximprequestidbuilder.h" + + +class CXIMPOperationBase; +class CXIMPEventManager; +class MXIMPObjectFactory; +class CXIMPObjectFactoryImp; +class CXIMPPscContext; +class MPresenceDataCache; +class CPresenceDataCache; +class CXIMPContextStateEventImp; +class CPeriodic; +class MXIMPProtocolConnection; +class CProtocolPresenceAuthorizationDataHostImp; +class MProtocolPresenceAuthorizationDataHost; +class CProtocolPresencePublishingDataHostImp; +class MProtocolPresencePublishingDataHost; +class CProtocolPresenceWatchingDataHostImp; +class MProtocolPresenceWatchingDataHost; +class CProtocolPresentityGroupsDataHostImp; +class MProtocolPresentityGroupsDataHost; +class CXIMPRestrictedCollectionImp; +class CXIMPProtocolRequestCompleteEventImp; +class MProtocolPresenceDataHost; +class CProtocolPresenceDataHostImp; +class MProtocolDataHost; + + +/** + * Presence connection host. + * + * @lib ximpprocessor.lib + * @since S60 v3.2 + */ +class CXIMPHost : public CXIMPApiObjBase, + public MXIMPProtocolConnectionHost, + public MXIMPHost + + { +public: + /** The class ID. */ + enum { KClassId = XIMPIMP_CLSID_CXIMPPSCHOST }; + +public: + + IMPORT_C static CXIMPHost* NewLC( MXIMPProtocolConnection& aConnection, TInt32 aProtocolUid ); + + /** + * Mark a reference to this object. + */ + void Open(); + + /** + * Remove a reference to this object. + * Once all references are removed, the class destroys itself. + */ + void Close(); + +protected: + + /** + * Reference counted. Use Close to remove a reference, and Open to open it. + * Can't be CObject-derived, since already derives from another C-class. + */ + virtual ~CXIMPHost(); + + CXIMPHost( MXIMPProtocolConnection& aConnection, TInt32 aProtocolUid ); + void ConstructL(); + +public: // From MXIMPBase + + /** + * Implementation of MXIMPBase interface methods + * @see MXIMPBase + */ + XIMPIMP_DECLARE_IF_BASE_METHODS + + +public: // From MXIMPProtocolConnectionHost + + void HandleRequestCompleted( TXIMPRequestId aReqId, TInt aResultCode ); + void HandleRequestCompleted( TXIMPRequestId aReqId, MXIMPStatus* aResult ); + void HandleRequestCompleted( TXIMPRequestId aReqId, + MXIMPStatus* aResult, + MXIMPBase* aParameter ); + TXIMPRequestId HandleConnectionTerminated( MXIMPStatus* aReason ); + MXIMPObjectFactory& ObjectFactory(); + MProtocolPresenceDataHost& ProtocolPresenceDataHost(); + + + + void RegisterObserverL( + MXIMPProtocolConnectionHostObserver& aObserver, + const TArray* aEventFilter = NULL ); + void UnregisterConnectionHostObserver( + MXIMPProtocolConnectionHostObserver& aObserver ); + + +public: // MXIMPHost + + MXIMPProtocolConnection& GetConnection() const; + + void AddEventL( CXIMPApiEventBase& aEvent, MXIMPPscContext* aContext ); + void ActivateEventL( CXIMPApiEventBase& aEvent, MXIMPPscContext* aContext ); + + void UnregisterSession( CXIMPPscContext* aContext ); + + void FakeCompleteRequest( TXIMPRequestId aReqId, TInt aResult ); + void HandleAdaptationRequestCompleted( TXIMPRequestId aReqId, TInt aResult ); + void HandleSessionMgmtRequestCompleted( TXIMPRequestId aReqId, TInt aResult ); + void HandleInternalRequestCompleted( TXIMPRequestId aReqId, TInt aResult ); + + CProtocolPresenceDataHostImp& PresenceDataAccess(); + + + // get corresponding protocol host from the array of hosts + TAny* GetProtocolHost(TInt aInterfaceId) ; + +/* CPresenceDataCache& DataAccess(); + CProtocolPresenceAuthorizationDataHostImp& AuthorizationDataAccess(); + CProtocolPresencePublishingDataHostImp& PublishingDataAccess(); + CProtocolPresenceWatchingDataHostImp& WatchingDataAccess(); + CProtocolPresentityGroupsDataHostImp& GroupsDataAccess(); +*/ + void AddNewOperationL( CXIMPOperationBase& aOperation ); + TXIMPRequestId AddNewOperationL( CXIMPOperationBase* aOperation ); + + void ForcedTeardownL(); + + void StartCleanerTimer(); + + TXIMPRequestId AddNewOperationL( + TInt aOperation, MXIMPBase* aParam, MXIMPBase* aParam2 = NULL ); + TXIMPRequestId AddNewOperationL( + TInt aOperation, CXIMPRestrictedObjectCollectionImp* aParams ); + + TInt32 ProtocolUID( ); + + // to set the specific prtocol hosts + void SetProtocolHosts(); + +public: // New functions + + void AddEventL( CXIMPApiEventBase& aEvent, CXIMPPscContext* aContext ); + void ActivateEventL( CXIMPApiEventBase& aEvent, CXIMPPscContext* aContext ); + + + void RegisterSessionL( CXIMPPscContext* aContext ); + +private: + + /** + * Delete old operation and try to launch processing. + */ + void StartProcessing(); + + /** + * Activate next operation for processing and start processing. + */ + void ActivateProcessing(); + + /** + * Helper for completing the request, to avoid cyclical + * call chain from StartProcessingL to HandleRequestCompleted and back. + * @param aResult The error code + * @see HandleRequestCompleted + */ + void CompleteRequest( TXIMPRequestId aReqId ); + + /** + * Callback method for process starting. + */ + static TInt StartProcessCallback( TAny *aInstance ); + + /** + * Leaving version of Callback method for process starting. + */ + void DoStartProcessCallback(); + + /** + * Callback method for request complete. + */ + static TInt CompleteRequestCallback( TAny *aInstance ); + static TInt CompleteAdaptationRequestCallback( TAny* aInstance ); + static TInt CompleteSessionMgmtRequestCallback( TAny* aInstance ); + static TInt CompleteInternalRequestCallback( TAny* aInstance ); + + /** + * Leaving version of Callback method for request complete. + */ + void DoCompleteRequestCallback(); + void DoCompleteAdaptationRequestCallback(); + void DoCompleteSessionMgmtRequestCallback(); + void DoCompleteInternalRequestCallback(); + + /** + * Callback for timer cleaner + * @see TCallBack + */ + static TInt CleanerCallback( TAny* aMyself ); + + /** + * Actual callback called from CleanerCallback. + */ + void DoCleanerCallback(); + + /** + * Leaving version of cleaner timer callback. + */ + void DoCleanerCallbackL(); + + /** + * This panics if active operation is not found for requestid. + */ + CXIMPOperationBase& OperationForRequestId( TXIMPRequestId aReqId ); + + TXIMPRequestId AddNewOperationL( NXIMPOps::TXIMPOpTypes aOpType ); + + /** + * This is to load all the protocol hosts + */ + void LoadDataHostArrayL() ; + +private: // data + + /** + * iConnection + */ + MXIMPProtocolConnection& iConnection; + + /** + * Uid for protocol to use for request id builder + */ + TInt32 iProtocolUid; + + /** + * Reference counter + */ + TInt iReferences; + + /** + * State identifier + */ + TBool iProcessing; + + /** + * Container for the operations. Owns the operations. + * Own. + */ + RXIMPObjOwningPtrArray< CXIMPOperationBase > iOperations; + + TBool iRunFromContextActivated; + CXIMPOperationBase* iCurrentOperation; + + // not owned + + CXIMPEventManager* iEventManager; + + + /** + * Container for session datas that are registered to this + * host. + * Shared ownership. Cleanup for items must be done with close method. Not delete. + */ + RPointerArray< CXIMPPscContext > iRegSessions; + + /** + * Internal state of the host + */ + NXIMPHost::THostStates iState; + + /** + * Timer for clean operation creation. + */ + CPeriodic* iCleanerTimer; + + /** + * Object factory. + */ + CXIMPObjectFactoryImp* iObjFactory; + + /** + * Data cache + */ +// CPresenceDataCache* iDataCache; + + /** + * Data hosts + */ + + CProtocolPresenceDataHostImp* iPresenceDataHost; + + /** + * array to hold data hosts + */ + CArrayFixFlat* iDataHostArray; + +/* CProtocolPresenceAuthorizationDataHostImp* iAuthDataHost; + CProtocolPresencePublishingDataHostImp* iPublishingDataHost; + CProtocolPresenceWatchingDataHostImp* iWatchingDataHost; + CProtocolPresentityGroupsDataHostImp* iGroupsDataHost; +*/ + /** + * Operation index for host-originated operations + * (currently only reconnect operation) + */ + TInt iHostOriginatedOpIndex; + + /** + * Active object for async calls. + */ + //CAsyncCallBack* iCallBack; + enum + { + ECompleteRequestCallback = 0, + ECompleteAdaptationRequestCallback, + ECompleteSessionMgmtRequestCallback, + ECompleteInternalRequestCallback, + EStartProcessCallback + }; + RPointerArray< CAsyncCallBack > iCallBack; + + /** + * + */ + TInt iAdaptationOperationIndex; + + + /** + * Builder for TXIMPRequestIds. Owned. + */ + TXIMPRequestIdBuilder iReqIdBuilder; + + /** + * Observers for adaptation requests. + */ + RPointerArray< MXIMPProtocolConnectionHostObserver > iConnectionHostObservers; + + + /** + * Adaptation request complete event. + */ + CXIMPProtocolRequestCompleteEventImp* iAdaptationReqCompleteEvent; + + /** + * Forced tear down flag. + */ + + TBool iForcedTearDown; + }; + + +#endif // CPSCHOST_H + diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcprocessor/ximphostmanager.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcprocessor/ximphostmanager.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,249 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: implementation of CXIMPHostManager + * +*/ + + + +#include +#include + +#include +#include + +#include "ximphostmanager.h" +#include "ximpserviceinfoimp.h" +#include "ximphostimp.h" +#include "ximpoperationdefs.h" +#include "ximpobjecthelpers.h" +//#include "ximpcontext.h" +#include "ximppsccontext.h" +#include "ximppanics.h" +#include "ximpglobals.h" +#include "ximppluginfactory.h" +#include "ximpobjectfactoryimp.h" +#include "ximppsccontextimp.h" +#include "ximpcontextclientinfoimp.h" + +// ======== LOCAL FUNCTIONS ======== + +TInt OrderOfHosts( const CXIMPHost& aFirst, const CXIMPHost& aSecond ) + { + if( &aFirst.GetConnection() < &aSecond.GetConnection() ) + { + return -1; + } + else if( &aFirst.GetConnection() == &aSecond.GetConnection() ) + { + return 0; + } + else + { + return 1; + } + } + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// CXIMPHostManager::CXIMPHostManager() +// --------------------------------------------------------------------------- +// +CXIMPHostManager::CXIMPHostManager() + { + } + + +// --------------------------------------------------------------------------- +// CXIMPHostManager::ConstructL() +// --------------------------------------------------------------------------- +// +void CXIMPHostManager::ConstructL() + { + iObjFactory = CXIMPObjectFactoryImp::NewL(); + } + + +// --------------------------------------------------------------------------- +// CXIMPHostManager::NewL() +// --------------------------------------------------------------------------- +// +CXIMPHostManager* CXIMPHostManager::NewL() + { + CXIMPHostManager* self = new( ELeave ) CXIMPHostManager; + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + + +// --------------------------------------------------------------------------- +// CXIMPHostManager::~CXIMPHostManager() +// --------------------------------------------------------------------------- +// +CXIMPHostManager::~CXIMPHostManager() + { + // host manager CANNOT OWN the hostimp objects. + // it's a fatal error to have hosts in the array + // at this point. + __ASSERT_ALWAYS( iHosts.Count() == 0, User::Panic( NXIMPPrivPanic::KCategory, NXIMPPrivPanic::EHostMgrHostsHaveNotBeenDeleted ) ); + + iHosts.Close(); + delete iObjFactory; + + if( iProtocol ) + { + delete iProtocol; + } + } + +// --------------------------------------------------------------------------- +// Implement supported interface access. +// --------------------------------------------------------------------------- +// +XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CXIMPHostManager, MXIMPProtocolPluginHost ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() +XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CXIMPHostManager, MXIMPProtocolPluginHost ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + + + +// --------------------------------------------------------------------------- +// CXIMPHostManager::DisassociateHost() +// --------------------------------------------------------------------------- +// +EXPORT_C void CXIMPHostManager::DisassociateHost( CXIMPHost* aHost ) + { + // go backwards to avoid modifying index when removing + TInt count = iHosts.Count(); + for( TInt a = count-1; a >= 0; a-- ) + { + if( iHosts[ a ] == aHost ) + { + // remove this host + MXIMPProtocolConnection& connection = aHost->GetConnection(); + iProtocol->ReleaseConnection( connection ); + iHosts.Remove( a ); + } + } + + count = iHosts.Count(); + if ( count == 0 ) + { + // no more hosts + CXIMPGlobals::Instance()->NoMoreHosts(); + } + } + +// --------------------------------------------------------------------------- +// CXIMPHostManager::AcquireHostForContextL() +// --------------------------------------------------------------------------- +// +CXIMPHost* CXIMPHostManager::AcquireHostForContextLC( CXIMPPscContext& aContext ) + { + CXIMPServiceInfoImp* serviceInfo = aContext.ServiceInfo(); + if( !iProtocol ) + { + if( !serviceInfo ) + { + User::Leave( KErrArgument ); + } + CXIMPPluginFactory* factory = CXIMPGlobals::Instance()->PluginFactory(); + iProtocol = factory->GetProtocolL( serviceInfo->ProtocolImplUid() ); + iProtocol->PrimeHost( *this ); + } + return GetHostForConnectionLC( + iProtocol->AcquireConnectionL( *serviceInfo, *aContext.ClientInfo() ), + serviceInfo->ProtocolImplUid().iUid ); + } + +// --------------------------------------------------------------------------- +// CXIMPHostManager::GetHostForConnectionL() +// --------------------------------------------------------------------------- +// +CXIMPHost* CXIMPHostManager::GetHostForConnectionLC( + MXIMPProtocolConnection& aConnection, TInt32 aProtocolUid ) + { + CXIMPHost* newHost = CXIMPHost::NewLC( aConnection, aProtocolUid ); + TLinearOrder< CXIMPHost > order( *OrderOfHosts ); + TInt index = iHosts.FindInOrder( newHost, order ); + if( index == KErrNotFound ) + { + iHosts.InsertInOrderL( newHost, order ); + aConnection.PrimeHost( *newHost ); + // this will allow protocol hosts to set in adaptations + newHost->SetProtocolHosts() ; + } + else + { + User::LeaveIfError( index ); + CleanupStack::PopAndDestroy(); //newHost + newHost = iHosts[ index ]; + newHost->Open(); // CSI: 65 # Does not return a value. + CleanupClosePushL( *newHost ); + } + return newHost; + } + +// --------------------------------------------------------------------------- +// CXIMPHostManager::HandleRequestCompleted() +// --------------------------------------------------------------------------- +// +void CXIMPHostManager::HandleRequestCompleted( TXIMPRequestId aReqId, + TInt aResultCode ) + { + XIMP_UNUSED_FORMAL_PARAM( aReqId ); + XIMP_UNUSED_FORMAL_PARAM( aResultCode ); + } + +// --------------------------------------------------------------------------- +// CXIMPHostManager::HandleRequestCompleted() +// --------------------------------------------------------------------------- +// +void CXIMPHostManager::HandleRequestCompleted( TXIMPRequestId aReqId, + MXIMPStatus* aResult ) + { + XIMP_UNUSED_FORMAL_PARAM( aReqId ); + XIMP_UNUSED_FORMAL_PARAM( aResult ); + } + + + +// --------------------------------------------------------------------------- +// CXIMPHostManager::HandleRequestCompleted() +// --------------------------------------------------------------------------- +// +void CXIMPHostManager::HandleRequestCompleted( TXIMPRequestId aReqId, + MXIMPStatus* aResult, + MXIMPBase* aParameter ) + { + XIMP_UNUSED_FORMAL_PARAM( aReqId ); + XIMP_UNUSED_FORMAL_PARAM( aResult ); + XIMP_UNUSED_FORMAL_PARAM( aParameter ); + } + + + +// --------------------------------------------------------------------------- +// CXIMPHostManager::ObjectFactory() +// --------------------------------------------------------------------------- +// +MXIMPObjectFactory& CXIMPHostManager::ObjectFactory() + { + return *iObjFactory; + } + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcprocessor/ximphostmanager.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcprocessor/ximphostmanager.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,129 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: implementation of CXIMPHostManager + * +*/ + +#ifndef C_PSCHOSTMANAGER_H +#define C_PSCHOSTMANAGER_H + + +#include +#include +#include "ximphostimp.h" + +#include "ximpbase.h" + +class CXIMPOperationBase; +class CXIMPFeatureInfoImp; +class CXIMPPscContext; +class CXIMPServiceInfoImp; +class CXIMPProtocolPluginBase; + +/** + * ?one_line_short_description + * + * ?more_complete_description + * + * @lib ?library + * @since S60 v4.0 + */ +class CXIMPHostManager : public CXIMPApiObjBase, + public MXIMPProtocolPluginHost + { + +public: // Definitions + + /** The class ID. */ + enum { KClassId = XIMPIMP_CLSID_CXIMPPSCHOSTMANAGER }; + + +public: + + IMPORT_C static CXIMPHostManager* NewL(); + + virtual ~CXIMPHostManager(); + + +private: + + CXIMPHostManager(); + void ConstructL(); + +public: + + /** + * Dissociate the given host from the list of known + * hosts. + * @param aHost The host to disassociate. + */ + IMPORT_C void DisassociateHost( CXIMPHost* aHost ); + + /** + * Acquire host for context. + */ + CXIMPHost* AcquireHostForContextLC( CXIMPPscContext& aContext ); + +public: // From MXIMPBase + + /** + * Implementation of MXIMPBase interface methods + * @see MXIMPBase + */ + XIMPIMP_DECLARE_IF_BASE_METHODS + + +private: // From MXIMPProtocolPluginHost + + MXIMPObjectFactory& ObjectFactory(); + + void HandleRequestCompleted( TXIMPRequestId aReqId, + TInt aResultCode ); + + void HandleRequestCompleted( TXIMPRequestId aReqId, + MXIMPStatus* aResult ); + + void HandleRequestCompleted( TXIMPRequestId aReqId, + MXIMPStatus* aResult, + MXIMPBase* aParameter ); + +private: // Helper methods + + /** + * Get host for connection. If does not exists, create one. + */ + CXIMPHost* GetHostForConnectionLC( MXIMPProtocolConnection& aConnection, + TInt32 aProtocolUid ); + +private: // data + + /** + * List of known hosts. + * Does not own, only knows the hosts. + */ + RPointerArray iHosts; + + /** + * Object factory. + */ + CXIMPObjectFactoryImp* iObjFactory; + + /** + * Protocol + */ + CXIMPProtocolPluginBase* iProtocol; + }; + + +#endif // C_PSCHOSTMANAGER_H diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcprocessor/ximpoperationbase.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcprocessor/ximpoperationbase.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,290 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Base class for operations methods + * +*/ + + + +#include "ximprequestcompleteeventimp.h" +#include "ximprestrictedobjectcollectionimp.h" +#include "ximpoperationbase.h" +#include "ximpstatusimp.h" +#include "ximppanics.h" +#include "ximppsccontextimp.h" +#include "ximphost.h" + +// ----------------------------------------------------------------------------- +// CXIMPOperationBase::CXIMPOperationBase() +// C++ default constructor. +// ----------------------------------------------------------------------------- +// +EXPORT_C CXIMPOperationBase::CXIMPOperationBase() : iServerOperation(EFalse) + { + } + +// ----------------------------------------------------------------------------- +// CXIMPOperationBase::BaseConstructL +// Base class construction +// ----------------------------------------------------------------------------- +// +EXPORT_C void CXIMPOperationBase::BaseConstructL( TXIMPRequestId aRequestId, + CXIMPPscContext* aContext ) + { + iStatusObj = CXIMPStatusImp::NewL(); + iObjCollection = CXIMPRestrictedObjectCollectionImp::NewL(); + iReqId = aRequestId; + SetOpL( aContext ); + + CreateRequestCompleteEventL(); + } + +// ----------------------------------------------------------------------------- +// CXIMPOperationBase::CreateRequestCompleteEventL() +// ----------------------------------------------------------------------------- +// +EXPORT_C void CXIMPOperationBase::CreateRequestCompleteEventL() + { + // Default value for request complete event to handle low memory situations. + iReqCompleteEvent = CXIMPRequestCompleteEventImp::NewLC( iReqId, KErrNoMemory ); + CleanupStack::Pop(); // iReqCompleteEvent + } + +// ----------------------------------------------------------------------------- +// CXIMPOperationBase::~CXIMPOperationBase() +// Destructor +// ----------------------------------------------------------------------------- +// +EXPORT_C CXIMPOperationBase::~CXIMPOperationBase() + { + + GetObjCollection(); + GetContext(); + Type(); + + delete iStatusObj; + delete iObjCollection; + + if ( iContext ) + { + iContext->Close(); + } + delete iReqCompleteEvent; + if( iMyHost ) + { + iMyHost->Close(); + } + } + +// ----------------------------------------------------------------------------- +// CXIMPOperationBase::SetHost() +// ----------------------------------------------------------------------------- +// +EXPORT_C void CXIMPOperationBase::SetHost( MXIMPHost& aMyHost ) + { + if( iMyHost ) + { + iMyHost->Close(); + } + iMyHost = &aMyHost; + iMyHost->Open(); // CSI: 65 # Does not fail. + } + +// ----------------------------------------------------------------------------- +// CXIMPOperationBase::ProcessL() +// ----------------------------------------------------------------------------- +// +EXPORT_C void CXIMPOperationBase::ProcessL() + { + __ASSERT_ALWAYS( iMyHost, User::Panic( NXIMPPrivPanic::KCategory, + NXIMPPrivPanic::EHostNotFound ) ); + } + +// ----------------------------------------------------------------------------- +// CXIMPOperationBase::RequestCompletedL() +// ----------------------------------------------------------------------------- +// +EXPORT_C void CXIMPOperationBase::RequestCompletedL() + { + iReqCompleteEvent->CompletionResultImp().SetResultCode( iStatusObj->ResultCode() ); + } + +// ----------------------------------------------------------------------------- +// CXIMPOperationBase::GetReqCompleteEvent() +// ----------------------------------------------------------------------------- +// +EXPORT_C CXIMPRequestCompleteEventImp* CXIMPOperationBase::GetReqCompleteEvent() + { + return iReqCompleteEvent; + } + +// ----------------------------------------------------------------------------- +// CXIMPOperationBase::Type() +// ----------------------------------------------------------------------------- +// +EXPORT_C TInt CXIMPOperationBase::Type() const + { + return NXIMPOps::EPrNone; + } + +// ----------------------------------------------------------------------------- +// CXIMPOperationBase::SetOp() +// ----------------------------------------------------------------------------- +// +EXPORT_C void CXIMPOperationBase::SetOpL( CXIMPPscContext* aContext ) + { + if( aContext ) + { + User::LeaveIfError( aContext->Open() ); + } + if( iContext ) + { + iContext->Close(); + } + iContext = aContext; + } + +// ----------------------------------------------------------------------------- +// CXIMPOperationBase::SetReqId() +// ----------------------------------------------------------------------------- +// +EXPORT_C void CXIMPOperationBase::SetReqId( TXIMPRequestId aRequestId ) + { + iReqId = aRequestId; + iReqCompleteEvent->SetRequestId( iReqId ); + } + +// ----------------------------------------------------------------------------- +// CXIMPOperationBase::SetResultCode() +// ----------------------------------------------------------------------------- +// +EXPORT_C void CXIMPOperationBase::SetResultCode( TInt aResultCode ) + { + iStatusObj->SetResultCode( aResultCode ); + } + +// ----------------------------------------------------------------------------- +// CXIMPOperationBase::SetResultCode() +// ----------------------------------------------------------------------------- +// +EXPORT_C void CXIMPOperationBase::SetStatus( MXIMPStatus* aStatus ) + { + CXIMPStatusImp* status = NULL; + if( aStatus ) + { + status = + TXIMPGetImpClassOrPanic< CXIMPStatusImp >::From( *aStatus ); + delete iStatusObj; + iStatusObj = status; + } + } + +// ----------------------------------------------------------------------------- +// CXIMPOperationBase::SetObjectCollection() +// ----------------------------------------------------------------------------- +// +EXPORT_C void CXIMPOperationBase::SetObjectCollection( MXIMPBase* aCollection ) + { + CXIMPRestrictedObjectCollectionImp* objectCollection = NULL; + if( aCollection ) + { + objectCollection = + TXIMPGetImpClassOrPanic< CXIMPRestrictedObjectCollectionImp >::From( *aCollection ); + delete iObjCollection; + iObjCollection = objectCollection; + } + + } + +// ----------------------------------------------------------------------------- +// CXIMPOperationBase::Context() +// ----------------------------------------------------------------------------- +// +EXPORT_C CXIMPPscContext* CXIMPOperationBase::Context() + { + return iContext; + } + +// ----------------------------------------------------------------------------- +// CXIMPOperationBase::RequestId +// ----------------------------------------------------------------------------- +// +EXPORT_C TXIMPRequestId CXIMPOperationBase::RequestId() const + { + return iReqId; + } + +// ----------------------------------------------------------------------------- +// CXIMPOperationBase::BeginOperationL +// ----------------------------------------------------------------------------- +// +EXPORT_C void CXIMPOperationBase::BeginOperation() + { + } + +// ----------------------------------------------------------------------------- +// CXIMPOperationBase::EndOperationL +// ----------------------------------------------------------------------------- +// +EXPORT_C void CXIMPOperationBase::EndOperation() + { + + } + +// ----------------------------------------------------------------------------- +// CXIMPOperationBase::Status +// ----------------------------------------------------------------------------- +// +EXPORT_C MXIMPStatus& CXIMPOperationBase::Status() const + { + return *iStatusObj; + } + +// ----------------------------------------------------------------------------- +// CXIMPOperationBase::SetServerOperation +// ----------------------------------------------------------------------------- +// +EXPORT_C void CXIMPOperationBase::SetServerOperation() + { + iServerOperation = ETrue; + } + +// ----------------------------------------------------------------------------- +// CXIMPOperationBase::IsServerOperation +// ----------------------------------------------------------------------------- +// +EXPORT_C TBool CXIMPOperationBase::IsServerOperation() const + { + return iServerOperation; + } + +// ----------------------------------------------------------------------------- +// CXIMPOperationBase::GetContext +// ----------------------------------------------------------------------------- +// +EXPORT_C MXIMPPscContext* CXIMPOperationBase::GetContext() +{ + return iContext ; +} + +// ----------------------------------------------------------------------------- +// CXIMPOperationBase::GetObjCollection +// ----------------------------------------------------------------------------- +// +EXPORT_C MXIMPRestrictedObjectCollection* CXIMPOperationBase::GetObjCollection() +{ + return iObjCollection ; +} + +// end of file diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcprocessor/ximppluginfactory.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcprocessor/ximppluginfactory.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,245 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Presence Service plugin factory + * +*/ + + +#include "ximppluginfactory.h" +#include "ximpobjecthelpers.h" +#include "ximpprotocolinfoimp.h" +#include "ximpfeatureinfoimp.h" + +#include + +#include +#include + +// ============================ HELPER CLASS =============================== +// simple wrapper class with array deletion on close +class RImplInfoPtrArray2 : public RImplInfoPtrArray + { + public: + void Close() + { + ResetAndDestroy(); + } + }; + +_LIT8( KProvider, "

" ); +_LIT8( KFeatureId, "" ); +_LIT8( KSupportedSchema, "" ); +_LIT8( KTagMatch, "**" ); + +const TInt KTagLength = 3; + + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CXIMPPluginFactory::NewL() +// Singleton access method. +// ----------------------------------------------------------------------------- +// +CXIMPPluginFactory* CXIMPPluginFactory::NewL() + { + CXIMPPluginFactory* self = new ( ELeave ) CXIMPPluginFactory(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// ----------------------------------------------------------------------------- +// CXIMPPluginFactory::CXIMPPluginFactory() +// ----------------------------------------------------------------------------- +// +CXIMPPluginFactory::CXIMPPluginFactory() + { + } + +// ----------------------------------------------------------------------------- +// CXIMPPluginFactory::~CXIMPPluginFactory() +// ----------------------------------------------------------------------------- +// +CXIMPPluginFactory::~CXIMPPluginFactory() + { + } + + +// ----------------------------------------------------------------------------- +// CXIMPPluginFactory::ConstructL() +// ----------------------------------------------------------------------------- +// +void CXIMPPluginFactory::ConstructL() + { + } + + +// ----------------------------------------------------------------------------- +// CXIMPPluginFactory::GetProtocolsL() +// ----------------------------------------------------------------------------- +// +EXPORT_C HBufC8* CXIMPPluginFactory::GetProtocolsL() + { + RXIMPObjOwningPtrArray< CXIMPProtocolInfoImp > protocolInfoArray; + CleanupClosePushL( protocolInfoArray ); + + // For each valid plugin, create CXIMPProtocolInfoImp and fill it up + RImplInfoPtrArray2 protocols; + CleanupClosePushL( protocols ); + + REComSession::ListImplementationsL( TUid::Uid( + CXIMPProtocolPluginBase::KInterfaceId ), + protocols ); + + const TInt implCount = protocols.Count(); + for( TInt i( 0 ); i < implCount; i++ ) + { + CXIMPFeatureInfoImp* featInfo = + ParseProtocolInfoLC( protocols[i]->OpaqueData() ); + CXIMPProtocolInfoImp* tmpProtInfo = + CXIMPProtocolInfoImp::NewLC( protocols[i]->DisplayName(), + protocols[i]->ImplementationUid(), + *featInfo ); + User::LeaveIfError( protocolInfoArray.Append( tmpProtInfo ) ); + CleanupStack::Pop( tmpProtInfo ); + CleanupStack::PopAndDestroy( featInfo ); + } + + CleanupStack::PopAndDestroy(); // protocols + + + HBufC8* pack = TXIMPObjectPacker< CXIMPProtocolInfoImp >::PackArrayL( + protocolInfoArray ); + CleanupStack::PopAndDestroy(); // protocolInfoArray + return pack; + } + + +// ----------------------------------------------------------------------------- +// CXIMPPluginFactory::GetProtocolL() +// ----------------------------------------------------------------------------- +// +EXPORT_C CXIMPProtocolPluginBase* CXIMPPluginFactory::GetProtocolL( + TUid aProtocolUid ) + { + TAny* requestedProtocol = NULL; + TUid destructorId; + + requestedProtocol = REComSession::CreateImplementationL( aProtocolUid, + destructorId ); + + CXIMPProtocolPluginBase* plugIn = ( CXIMPProtocolPluginBase* )requestedProtocol; + plugIn->SetDestructorId( destructorId ); + return plugIn; + } + + +// ----------------------------------------------------------------------------- +// CXIMPPluginFactory::ParseProtocolInfoLC() +// ----------------------------------------------------------------------------- +// +CXIMPFeatureInfoImp* CXIMPPluginFactory::ParseProtocolInfoLC( + const TDesC8& aFeaturesBuffer ) + { + CXIMPFeatureInfoImp* featInfo = CXIMPFeatureInfoImp::NewLC(); + + ParseTaggedDataL( aFeaturesBuffer, featInfo ); + + return featInfo; + } + + +// ----------------------------------------------------------------------------- +// CXIMPPluginFactory::ParseTaggedDataL() +// ----------------------------------------------------------------------------- +// +void CXIMPPluginFactory::ParseTaggedDataL( const TDesC8& aData, + CXIMPFeatureInfoImp* aFeatInfo ) + { + TPtrC8 data(aData); + TInt readPosition = 0; + TBool moreData = data.Length() ? ETrue : EFalse; + while (moreData) + { + // Assumes that this segment will begin with a tag + TPtrC8 restOfData = data.Mid(readPosition); + + TInt endPos = restOfData.MatchF(KTagMatch); + if (endPos == KErrNotFound) + User::Leave(KErrCorrupt); + + // extract the tag + TPtrC8 tag = restOfData.Left(KTagLength); + + readPosition += KTagLength; + + // Find the next tag + restOfData.Set(data.Mid(readPosition)); + endPos = restOfData.MatchF(KTagMatch); + + TPtrC8 tagData; + if (endPos == KErrNotFound) + { + // If we didn't find a tag, we must be at the end of the data + tagData.Set(restOfData); + readPosition = restOfData.Length(); + moreData = EFalse; + } + else + { + tagData.Set(restOfData.Left(endPos)); + readPosition += endPos; + } + + ProcessTaggedDataL( tag, tagData, aFeatInfo ); + } + } + + +// ----------------------------------------------------------------------------- +// CXIMPPluginFactory::ProcessTaggedDataL() +// ----------------------------------------------------------------------------- +// +void CXIMPPluginFactory::ProcessTaggedDataL( const TDesC8& aTag, + const TDesC8& aData, + CXIMPFeatureInfoImp* aFeatInfo ) + { + // This parsing handling needs to be updated when + // protocol feature handling is properly defined. + + // Also CXIMPFeatureInfoImp members should be reconsidered + // at that point + + if ( aTag == KProvider ) + { + //SetProviderL( aData ); + } + else if ( aTag == KFeatureId ) + { + aFeatInfo->AddFeatureL( aData ); + } + else if ( aTag == KSupportedSchema ) + { + //SetSupportedSchemaL( aData ); + } + else + { + User::Leave(KErrCorrupt); + } + } +// End of file + + diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcprocessor/ximppluginfactory.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcprocessor/ximppluginfactory.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,96 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Presence Service Connection plugin factory + * +*/ + + +#ifndef CPSCPLUGINFACTORY_H +#define CPSCPLUGINFACTORY_H + + +#include +#include + + +class MXIMPFeatureInfo; +class MXIMPProtocolInfo; +class CXIMPFeatureInfoImp; +class CXIMPProtocolPluginBase; + + +/** + * Plugin factory and plugin utility. + * Class is owned by and handled as singleton by CXIMPGlobals. + * + * @lib ximpprocessor.dll + * @since S60 v4.0 + */ +class CXIMPPluginFactory : public CBase + { + public: + + static CXIMPPluginFactory* NewL(); + + ~CXIMPPluginFactory(); + + private: + + /** + * C++ default constructor. + */ + CXIMPPluginFactory(); + + /** + * Symbian 2nd phase constructor + */ + void ConstructL(); + + + public: + + /** + * Get a list of protocols. + * + * Retrieves a list of presence protocols. + * @return Externalized form of RXIMPObjOwningPtrArray< + * CXIMPProtocolInfoImp > containing the protocols + */ + IMPORT_C HBufC8* GetProtocolsL(); + + + IMPORT_C CXIMPProtocolPluginBase* GetProtocolL( TUid aProtocolUid ); + + + CXIMPFeatureInfoImp* ParseProtocolInfoLC( const TDesC8& aFeaturesBuffer ); + + + private: + + void ParseTaggedDataL( const TDesC8& aData, + CXIMPFeatureInfoImp* aFeatInfo ); + + + void ProcessTaggedDataL( const TDesC8& aTag, + const TDesC8& aData, + CXIMPFeatureInfoImp* aFeatInfo ); + + + private: // Data + + }; + +#endif // CPSCPLUGINFACTORY_H + + diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcprocessor/ximpprotocolrequestcompleteeventimp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcprocessor/ximpprotocolrequestcompleteeventimp.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,175 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MXIMPProtocolRequestCompleteEvent API object implementation. +* +*/ + +#include +#include "ximpprotocolrequestcompleteeventimp.h" + + + +// --------------------------------------------------------------------------- +// CXIMPProtocolRequestCompleteEventImp::NewL() +// --------------------------------------------------------------------------- +// +EXPORT_C CXIMPProtocolRequestCompleteEventImp* + CXIMPProtocolRequestCompleteEventImp::NewL() + { + CXIMPProtocolRequestCompleteEventImp* self = + new( ELeave ) CXIMPProtocolRequestCompleteEventImp(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + + +// --------------------------------------------------------------------------- +// CXIMPProtocolRequestCompleteEventImp::NewLC() +// --------------------------------------------------------------------------- +// +CXIMPProtocolRequestCompleteEventImp* + CXIMPProtocolRequestCompleteEventImp::NewFromStreamLC( RReadStream& aStream ) + { + CXIMPProtocolRequestCompleteEventImp* self = + new( ELeave ) CXIMPProtocolRequestCompleteEventImp; + CleanupStack::PushL( self ); + self->ConstructL(); + self->InternalizeL( aStream ); + return self; + } + + + +// --------------------------------------------------------------------------- +// CXIMPProtocolRequestCompleteEventImp::~CXIMPProtocolRequestCompleteEventImp() +// --------------------------------------------------------------------------- +// +CXIMPProtocolRequestCompleteEventImp::~CXIMPProtocolRequestCompleteEventImp() + { + } + + +// --------------------------------------------------------------------------- +// CXIMPProtocolRequestCompleteEventImp::CXIMPProtocolRequestCompleteEventImp() +// --------------------------------------------------------------------------- +// +CXIMPProtocolRequestCompleteEventImp::CXIMPProtocolRequestCompleteEventImp() + { + } + + +// --------------------------------------------------------------------------- +// CXIMPProtocolRequestCompleteEventImp::ConstructL() +// --------------------------------------------------------------------------- +// +void CXIMPProtocolRequestCompleteEventImp::ConstructL() + { + } + + + + +// --------------------------------------------------------------------------- +// From class MXIMPProtocolRequestCompleteEvent. +// CXIMPProtocolRequestCompleteEventImp::RequestId() +// --------------------------------------------------------------------------- +// +const TXIMPRequestId& CXIMPProtocolRequestCompleteEventImp::RequestId() const + { + return iReqId; + } + + +// --------------------------------------------------------------------------- +// From class MXIMPProtocolRequestCompleteEvent. +// CXIMPProtocolRequestCompleteEventImp::ResultCode() +// --------------------------------------------------------------------------- +// +TInt CXIMPProtocolRequestCompleteEventImp::ResultCode() const + { + return iResult; + } + + + +// --------------------------------------------------------------------------- +// CXIMPProtocolRequestCompleteEventImp::SetRequestId() +// --------------------------------------------------------------------------- +// +EXPORT_C void CXIMPProtocolRequestCompleteEventImp::SetRequestId( + const TXIMPRequestId& aRequestId ) + { + iReqId = aRequestId; + } + + +// --------------------------------------------------------------------------- +// CXIMPProtocolRequestCompleteEventImp::SetResultCode() +// --------------------------------------------------------------------------- +// +EXPORT_C void CXIMPProtocolRequestCompleteEventImp::SetResultCode( + TInt aResult ) + { + iResult = aResult; + } + + +// --------------------------------------------------------------------------- +// CXIMPProtocolRequestCompleteEventImp::ExternalizeL() +// --------------------------------------------------------------------------- +// +EXPORT_C void CXIMPProtocolRequestCompleteEventImp::ExternalizeL( + RWriteStream& aStream ) const + { + TPckgBuf< TXIMPRequestId > bufReqId( iReqId ); + aStream.WriteL( bufReqId ); + + aStream.WriteInt32L( iResult ); + } + + +// --------------------------------------------------------------------------- +// CXIMPProtocolRequestCompleteEventImp::InternalizeL() +// --------------------------------------------------------------------------- +// +EXPORT_C void CXIMPProtocolRequestCompleteEventImp::InternalizeL( + RReadStream& aStream ) + { + TPckgBuf< TXIMPRequestId > bufReqId; + aStream.ReadL( bufReqId ); + iReqId = bufReqId(); + + iResult = aStream.ReadInt32L(); + } + + +// --------------------------------------------------------------------------- +// Implement supported interface access. +// --------------------------------------------------------------------------- +// +XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CXIMPProtocolRequestCompleteEventImp, + MXIMPProtocolRequestCompleteEvent ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + +XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CXIMPProtocolRequestCompleteEventImp, + MXIMPProtocolRequestCompleteEvent ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + + + + +// End of file + diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcprocessor/ximpprotocolrequestcompleteeventimp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcprocessor/ximpprotocolrequestcompleteeventimp.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,120 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MXIMPProtocolRequestCompleteEvent API object implementation. +* +*/ + +#ifndef CXIMPPROTOCOLREQUESTCOMPLETEEVENTIMP_H +#define CXIMPPROTOCOLREQUESTCOMPLETEEVENTIMP_H + +#include "ximpapieventbase.h" +#include + + +class RWriteStream; +class RReadStream; + + +/** + * MXIMPProtocolRequestCompleteEvent API object implementation. + * + * @lib ximpdatamodel.dll + * @since S60 v3.2 + */ +NONSHARABLE_CLASS( CXIMPProtocolRequestCompleteEventImp ): + public CXIMPApiObjBase, + public MXIMPProtocolRequestCompleteEvent + { + public: + /** The class ID. */ + enum { KClassId = XIMPIMP_CLSID_CXIMPPROTOCOLREQUESTCOMPLETEEVENTIMP }; + +public: + + /** + * Exported instantiation method for initializing + * new event object. + */ + IMPORT_C static CXIMPProtocolRequestCompleteEventImp* NewL(); + IMPORT_C static CXIMPProtocolRequestCompleteEventImp * NewFromStreamLC( RReadStream& aStream ); + virtual ~CXIMPProtocolRequestCompleteEventImp(); + +private: + CXIMPProtocolRequestCompleteEventImp(); + void ConstructL(); + + +public: // From MXIMPProtocolRequestCompleteEvent + + /** + * Implementation of MXIMPProtocolRequestCompleteEvent interface methods + * @see MXIMPProtocolRequestCompleteEvent + */ + const TXIMPRequestId& RequestId() const; + TInt ResultCode() const; + + +public: + + /** + * Set request id + * @param aRequestId New requestId. + */ + IMPORT_C void SetRequestId( const TXIMPRequestId& aRequestId ); + + + /** + * Set reseult code + * @param aResult New result. + */ + IMPORT_C void SetResultCode( TInt aResult ); + + + IMPORT_C void ExternalizeL( RWriteStream& aStream ) const; + + + IMPORT_C void InternalizeL( RReadStream& aStream ); + + + +public: // From API base interfaces + + /** + * Implementation of MXIMPBase interface methods + * @see MXIMPBase + */ + XIMPIMP_DECLARE_IF_BASE_METHODS + + + + +private: // data + + /** + * Completed request. + * Own. + */ + TXIMPRequestId iReqId; + + + /** + * Request result. + * Own. + */ + TInt iResult; + + }; + + +#endif // CXIMPPROTOCOLREQUESTCOMPLETEEVENTIMP_H diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcprocessor/ximppsccontextimp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcprocessor/ximppsccontextimp.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,457 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Client context data storage. +* +*/ + +#include +#include + +#include "ximppsccontextimp.h" +#include "ximpcontexteventqueue.h" +#include "presenceinfoimp.h" +#include "presenceinfofilterimp.h" +#include "ximpoperationbase.h" +#include "ximpserviceinfoimp.h" +#include "ximpfeatureinfoimp.h" +#include "ximpoperationdefs.h" +#include "ximphostimp.h" +#include "ximpglobals.h" +#include "ximppanics.h" +#include "ximpoperationfactory.h" +#include "ximphostmanager.h" +#include "ximpcontextclientinfoimp.h" +#include "presencefilterstore.h" +#include "ximprequestcompleteeventimp.h" + +#include "ximptrace.h" + +const TInt KXIMPFeatGranularity = 5; + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// CXIMPPscContext::CXIMPHostManager() +// --------------------------------------------------------------------------- +// +CXIMPPscContext::CXIMPPscContext( TUint32 aSessionId ) +: iSessionId( aSessionId ) + { + } + + +// --------------------------------------------------------------------------- +// CXIMPPscContext::ConstructL() +// --------------------------------------------------------------------------- +// +void CXIMPPscContext::ConstructL() + { + iEventQueue = CXIMPContextEventQueue::NewL(); + iEventQueue->SetSessionIdOfQueue( iSessionId ); + iPresentityFilterStore = CPresenceFilterStore::NewL(); + iPresentityGroupFilterStore = CPresenceFilterStore::NewL(); + iGrantFilterStore = CPresenceFilterStore::NewL(); + iGrantGroupFilterStore = CPresenceFilterStore::NewL(); + } + +// --------------------------------------------------------------------------- +// CXIMPPscContext::NewL() +// --------------------------------------------------------------------------- +// +EXPORT_C CXIMPPscContext* CXIMPPscContext::NewL( TUint32 aSessionId ) + { + CXIMPPscContext* self = new( ELeave ) CXIMPPscContext( aSessionId ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + + +// --------------------------------------------------------------------------- +// CXIMPPscContext::~CXIMPPscContext() +// --------------------------------------------------------------------------- +// +CXIMPPscContext::~CXIMPPscContext() + { + if( iEventQueue ) + { + iEventQueue->StopConsuming(); + } + + delete iEventQueue; + + // destroy all cached operations + delete iCachedUnbind; + + if ( iHost ) + { + iHost->Close(); + } + + delete iOwnPif; + delete iServiceInfo; + delete iClientInfo; + delete iPresentityFilterStore; + delete iPresentityGroupFilterStore; + delete iGrantFilterStore; + delete iGrantGroupFilterStore; + delete iGrantEveryonePif; + } + +// --------------------------------------------------------------------------- +// CXIMPPscContext::EventQueue() +// --------------------------------------------------------------------------- +// +EXPORT_C CXIMPContextEventQueue& CXIMPPscContext::EventQueue() const + { + return *iEventQueue; + } + +// --------------------------------------------------------------------------- +// CXIMPPscContext::SessionId() +// --------------------------------------------------------------------------- +// +EXPORT_C TUint32 CXIMPPscContext::SessionId() const + { + return iSessionId; + } + +// --------------------------------------------------------------------------- +// CXIMPPscContext::OrderOfContexts() +// --------------------------------------------------------------------------- +// +EXPORT_C TInt CXIMPPscContext::OrderOfContexts( const CXIMPPscContext& aFirst, + const CXIMPPscContext& aSecond ) + { + TUint32 firstSessionId = aFirst.SessionId(); + TUint32 secondSessionId = aSecond.SessionId(); + if( firstSessionId < secondSessionId ) + { + return -1; + } + else if( firstSessionId == secondSessionId ) + { + return 0; + } + else + { + return 1; + } + } + +// --------------------------------------------------------------------------- +// CXIMPPscContext::PresenceInfoFilter +// --------------------------------------------------------------------------- +// +EXPORT_C CPresenceInfoFilterImp* CXIMPPscContext::PresenceInfoFilter( + MXIMPPscContext::TFilterStoreType aTypeOfFilter, + const CXIMPIdentityImp* aIdentity /*= NULL*/ ) const + { + switch ( aTypeOfFilter ) + { + case EOwnPresenceFilter: + { + return iOwnPif; + } + case EPresentityPresenceFilter: + { + return iPresentityFilterStore->FilterForIdentity( *aIdentity ); + } + case EPresentityGroupMemberPresenceFilter: + { + return iPresentityGroupFilterStore->FilterForIdentity( *aIdentity ); + } + case EGrantPresenceToEveryoneFilter: + { + return iGrantEveryonePif; + } + case EGrantPresenceToPresentityFilter: + { + return iPresentityGroupFilterStore->FilterForIdentity( *aIdentity ); + } + case EGrantPresenceToGroupMemberFilter: + { + return iPresentityGroupFilterStore->FilterForIdentity( *aIdentity ); + } + XIMP_DEFAULT_CASE_UNSUPPORTED( NXIMPPrivPanic::EInvalidFilterType ); + } + return NULL; + } + +// --------------------------------------------------------------------------- +// CXIMPPscContext::SetPresenceInfoFilterL() +// --------------------------------------------------------------------------- +// +EXPORT_C void CXIMPPscContext::SetPresenceInfoFilterL( + MXIMPPscContext::TFilterStoreType aTypeOfFilter, + CPresenceInfoFilterImp* aPif, + const CXIMPIdentityImp* aIdentity /*= NULL*/ ) + { + CPresenceFilterStore* filterStore = NULL; + switch ( aTypeOfFilter ) + { + case EOwnPresenceFilter: + { + delete iOwnPif; + iOwnPif = aPif; + break; + } + case EPresentityPresenceFilter: + { + filterStore = iPresentityFilterStore; + break; + } + case EPresentityGroupMemberPresenceFilter: + { + filterStore = iPresentityGroupFilterStore; + break; + } + case EGrantPresenceToEveryoneFilter: + { + delete iGrantEveryonePif; + iGrantEveryonePif = aPif; + break; + } + case EGrantPresenceToPresentityFilter: + { + filterStore = iPresentityGroupFilterStore; + break; + } + case EGrantPresenceToGroupMemberFilter: + { + filterStore = iPresentityGroupFilterStore; + break; + } + XIMP_DEFAULT_CASE_UNSUPPORTED( NXIMPPrivPanic::EInvalidFilterType ); + } + + if( filterStore ) + { + filterStore->Disassociate( *aIdentity ); + if( aPif ) + { + filterStore->AssociateL( *aIdentity, aPif ); + } + } + } + +// --------------------------------------------------------------------------- +// CXIMPPscContext::GetCachedUnbind() +// --------------------------------------------------------------------------- +// +EXPORT_C CXIMPOperationBase* CXIMPPscContext::GetCachedUnbind() + { + CXIMPOperationBase* retVal = iCachedUnbind; + iCachedUnbind = NULL; + return retVal; + } + +// --------------------------------------------------------------------------- +// CXIMPPscContext::SetServiceInfo() +// --------------------------------------------------------------------------- +// +EXPORT_C void CXIMPPscContext::SetServiceInfo( CXIMPServiceInfoImp* aServiceInfo ) + { + delete iServiceInfo; + iServiceInfo = aServiceInfo; + } + +// --------------------------------------------------------------------------- +// CXIMPPscContext::SetServiceInfo() +// --------------------------------------------------------------------------- +// +EXPORT_C void CXIMPPscContext::SetClientInfo( CXIMPContextClientInfoImp* aClientInfo ) + { + delete iClientInfo; + iClientInfo = aClientInfo; + } + +// --------------------------------------------------------------------------- +// CXIMPPscContext::ServiceInfo() +// --------------------------------------------------------------------------- +// +EXPORT_C CXIMPServiceInfoImp* CXIMPPscContext::ServiceInfo() const + { + return iServiceInfo; + } + +// --------------------------------------------------------------------------- +// CXIMPPscContext::DestroyCachedUnbind() +// --------------------------------------------------------------------------- +// +EXPORT_C void CXIMPPscContext::DestroyCachedUnbind() + { + if( iCachedUnbind ) + { + iEventQueue->RemoveRequestCompleteEvent( *iCachedUnbind->GetReqCompleteEvent() ); + } + delete iCachedUnbind; + iCachedUnbind = NULL; + } + +// --------------------------------------------------------------------------- +// CXIMPPscContext::AppendToOpQueueL() +// --------------------------------------------------------------------------- +// +EXPORT_C TXIMPRequestId CXIMPPscContext::AppendToOpQueueUpdateReqIdL( + CXIMPOperationBase* aOperation ) + { + iReqIdBuilder.SetSessionId( iSessionId ); + iReqIdBuilder.SetRequestId( iOperationIndex ); + TXIMPRequestId reqId = iReqIdBuilder.BuildRequestId(); + + iOperationIndex++; + aOperation->SetReqId( reqId ); + + AppendToOpQueueL( aOperation ); + return reqId; + } + +// --------------------------------------------------------------------------- +// CXIMPPscContext::AppendToOpQueueL() +// --------------------------------------------------------------------------- +// +EXPORT_C void CXIMPPscContext::AppendToOpQueueL( + CXIMPOperationBase* aOperation ) + { + __ASSERT_ALWAYS( iHost, User::Panic( NXIMPPrivPanic::KCategory, NXIMPPrivPanic::EContextHasNoHost ) ); + iHost->AddNewOperationL( *aOperation ); + } + +// --------------------------------------------------------------------------- +// CXIMPPscContext::AddNewOperationL() +// --------------------------------------------------------------------------- +// +EXPORT_C TXIMPRequestId CXIMPPscContext::AddNewOperationL( + TInt aOperation, + const TDesC8& aReqParams ) + { + iReqIdBuilder.SetSessionId( iSessionId ); + iReqIdBuilder.SetRequestId( iOperationIndex ); + TXIMPRequestId reqId = iReqIdBuilder.BuildRequestId(); + + iOperationIndex++; + // XXX should the index++ be after Pop() below? + + // check what kind of operation is offered and create the object + CXIMPOperationBase* op = + CXIMPGlobals::Instance()->OperationFactory()->CreateOperationL( aOperation ); + // we have op at this point or we've panicked + CleanupStack::PushL( op ); + op->BaseConstructL( reqId, this ); + op->ConstructL( aReqParams ); + TRACE_1( _L("New request from client \"%S\""), &ClientInfo()->ClientId().Identity() ); + + // Create unbind skeleton in advance for teardown bind. + if( NXIMPOps::EXIMPBindContext == aOperation + || NXIMPOps::EXIMPBindContext2 == aOperation ) + { + // Locate connection from adaptation + ResolveHostL(); + + CXIMPOperationBase* unbindOp = + CXIMPGlobals::Instance()->OperationFactory()->CreateOperationL( NXIMPOps::EXIMPUnbindContext ); + + iReqIdBuilder.SetRequestId( iOperationIndex ); + TXIMPRequestId unbindReq = iReqIdBuilder.BuildRequestId(); + iOperationIndex++; + + unbindOp->BaseConstructL( unbindReq, this ); + unbindOp->ConstructL( KNullDesC8 ); + iCachedUnbind = unbindOp; + iHost->AddEventL( *iCachedUnbind->GetReqCompleteEvent(), this ); + } + __ASSERT_ALWAYS( iHost, User::Panic( NXIMPPrivPanic::KCategory, NXIMPPrivPanic::EContextHasNoHost ) ); + + iHost->AddEventL( *op->GetReqCompleteEvent(), this ); + + iHost->AddNewOperationL( *op ); + CleanupStack::Pop(); // op + return reqId; + } + +// --------------------------------------------------------------------------- +// CXIMPPscContext::FeaturesForSessionLC() +// --------------------------------------------------------------------------- +// +EXPORT_C CXIMPFeatureInfoImp* CXIMPPscContext::FeaturesForSessionLC() + { + CXIMPFeatureInfoImp* feats = CXIMPFeatureInfoImp::NewLC(); + + CDesC8ArraySeg* arr = new ( ELeave ) CDesC8ArraySeg( KXIMPFeatGranularity ); + CleanupStack::PushL( arr ); + +/* if ( GetStateOfHost() == NXIMPHost::EXIMPNotConnected ) + { + // feature fetching not allowed. for feature fetching to be + // allowed there has to have been a bind operation + User::Leave( KErrNotReady ); + }*/ + + iHost->GetConnection().GetSupportedFeaturesL( *arr ); + + for( TInt i = 0; i < arr->Count(); i++ ) + { + feats->AddFeatureL( arr->MdcaPoint( i ) ); + } + CleanupStack::PopAndDestroy( arr ); + + return feats; + } + +// --------------------------------------------------------------------------- +// CXIMPPscContext::ClientInfo() +// --------------------------------------------------------------------------- +// +EXPORT_C CXIMPContextClientInfoImp* CXIMPPscContext::ClientInfo() const + { + return iClientInfo; + } + +// --------------------------------------------------------------------------- +// CXIMPPscContext::IsHostAssigned() +// --------------------------------------------------------------------------- +// +EXPORT_C TBool CXIMPPscContext::IsHostAssigned() const + { + return iHost != NULL; + } + +// --------------------------------------------------------------------------- +// CXIMPPscContext::ResolveHostForOperationL() +// --------------------------------------------------------------------------- +// +void CXIMPPscContext::ResolveHostL() + { + TRACE(_L("CXIMPPscContext::ResolveHostL() : begin" ) ); + + CXIMPHost* host = CXIMPGlobals::Instance()->HostManager()->AcquireHostForContextLC( *this ); + + TRACE_3(_L("CXIMPPscContext::ResolveHostL() : this =%d, host =%d , iHost=%d" ), this, host, iHost ); + + if( !iHost ) + { + host->RegisterSessionL( this ); + iHost = host; + CleanupStack::Pop(); //host + } + else + { + CleanupStack::PopAndDestroy(); // host + } + + TRACE(_L("CXIMPPscContext::ResolveHostL() : end" ) ); + } +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcprocessor/ximppsccontextimp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcprocessor/ximppsccontextimp.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,262 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Client context data storage. +* +*/ + +#ifndef C_XIMPPSCCONTEXT_H +#define C_XIMPPSCCONTEXT_H + + +#include "ximpbase.h" +#include "ximppsccontext.h" +#include + +#include "ximprequestidbuilder.h" + +class CXIMPContextEventQueue; +class CPresenceInfoImp; +class CPresenceInfoFilterImp; +class CXIMPOperationBase; +class CXIMPServiceInfoImp; +class CXIMPFeatureInfoImp; +class CXIMPHost; +class CXIMPContextClientInfoImp; +class CPresenceFilterStore; +class CXIMPIdentityImp; + +/** + * Client data for context. + * + * @since S60 v4.0 + */ +class CXIMPPscContext : public CObject, + public MXIMPPscContext + { +public: + + /** + * Construction + */ + IMPORT_C static CXIMPPscContext* NewL( TUint32 aSessionId ); + + /** + * Destruction + */ + virtual ~CXIMPPscContext(); + +private: + + /** + * Construction + */ + CXIMPPscContext( TUint32 aSessionId ); + + /** + * Construction + */ + void ConstructL(); + + +public: // New methods + + /** + * Access to eventqueue of context. + * return Reference to eventqueue. + */ + IMPORT_C CXIMPContextEventQueue& EventQueue() const; + + /** + * Session id of context. + * @return session id. + */ + IMPORT_C TUint32 SessionId() const; + + /** + * TLinearOrder method. + */ + IMPORT_C static TInt OrderOfContexts( const CXIMPPscContext& aFirst, + const CXIMPPscContext& aSecond ); + + /** + * Access to current presence interest. + * @param Type of filter to access. + * @param aIdentity Identity to map filter. Default NULL + * @return Presence interest. NULL if not defined. + */ + CPresenceInfoFilterImp* PresenceInfoFilter( TFilterStoreType aTypeOfFilter, + const CXIMPIdentityImp* aIdentity = NULL ) const; + + /** + * Set new presence interest filter + * @param aTypeOfFilter Type of filter to access. + * @param aPif New presence info filter to set. + * @param aIdentity Identity to map filter. Default NULL + */ + IMPORT_C void SetPresenceInfoFilterL( TFilterStoreType aTypeOfFilter, + CPresenceInfoFilterImp* aPif, + const CXIMPIdentityImp* aIdentity = NULL ); + + /** + * Ownership is transferred + */ + IMPORT_C CXIMPOperationBase* GetCachedUnbind(); + + /** + * When bind operation fails, the cached unbind + * must be destroyed. + */ + IMPORT_C void DestroyCachedUnbind(); + + /** + * Set service info + */ + IMPORT_C void SetServiceInfo( CXIMPServiceInfoImp* aServiceInfo ); + + /** + * Set service info + */ + IMPORT_C void SetClientInfo( CXIMPContextClientInfoImp* aClientInfo ); + + + /** + * Service info of context. + */ + IMPORT_C CXIMPServiceInfoImp* ServiceInfo() const; + + + /** + * Append given operation to the end of the proper operation queue. + * The queue resides in the host associated with the given context. + * @param aOperation The operation to append + * @return Request id + */ + IMPORT_C TXIMPRequestId AppendToOpQueueUpdateReqIdL( + CXIMPOperationBase* aOperation ); + IMPORT_C void AppendToOpQueueL( + CXIMPOperationBase* aOperation ); + /** + * Add new operation to be processed to the proper host. + * + * @param aOperation Enumeration describing the operation + * @param aReqParams Parameters for the operation + * @return The request id + */ + IMPORT_C TXIMPRequestId AddNewOperationL( + TInt aOperation, + const TDesC8& aReqParams ); + + /** + * Find cached features for this session + * @return The cached features + */ + IMPORT_C CXIMPFeatureInfoImp* FeaturesForSessionLC(); + + /** + * Client info of context + */ + IMPORT_C CXIMPContextClientInfoImp* ClientInfo() const; + + /** + * Check if host is assigned. + * @return ETrue if host is assigned. EFalse if not + */ + IMPORT_C TBool IsHostAssigned() const; + +private: + + /** + * Resolve host for operation + */ + void ResolveHostL(); + +private: // data + + /** + * Identifier for this session. + */ + const TUint32 iSessionId; + + /** + * Event queue for context- + */ + CXIMPContextEventQueue* iEventQueue; + + /** + * Current presence interest. + */ + CPresenceInfoFilterImp* iOwnPif; + + /** + * Owned. Identity to filter mapping for this context. + */ + CPresenceFilterStore* iPresentityFilterStore; + + /** + * Owned. Identity to filter mapping for this context. + */ + CPresenceFilterStore* iPresentityGroupFilterStore; + + /** + * Current grant everyone pif. + */ + CPresenceInfoFilterImp* iGrantEveryonePif; + + /** + * Owned. Identity to filter mapping for this context. + */ + CPresenceFilterStore* iGrantFilterStore; + + /** + * Owned. Identity to filter mapping for this context. + */ + CPresenceFilterStore* iGrantGroupFilterStore; + + /** + * Unbind operation for need cases. + */ + CXIMPOperationBase* iCachedUnbind; + + /** + * Service information structure. + * Owns. + */ + CXIMPServiceInfoImp* iServiceInfo; + + /** + * The host associated with this context. + * Owned via reference counting. + * Host has to be reference counted, since multiple contexts can own a + * reference to one host. + */ + CXIMPHost* iHost; + + /** + * Counter for the operations, used to build the request id. + */ + TInt iOperationIndex; + + /** + * Client information structure + */ + CXIMPContextClientInfoImp* iClientInfo; + + /** + * TXIMPRequestId builder + */ + TXIMPRequestIdBuilder iReqIdBuilder; + }; + + +#endif // C_XIMPPSCCONTEXT_H diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcpscserver/ximpcontextsession.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcpscserver/ximpcontextsession.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,429 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Context session. + * +*/ + +#include "ximpcontextsession.h" +#include "ximpsrvmessage.h" +#include "ximpserverdefs.h" + +#include "ximpcontexteventqueue.h" +#include "ximpcontexteventfilter.h" +#include "ximphostmanager.h" +#include "ximpglobals.h" +#include "ximppsccontextimp.h" + +#include "ximpfeatureinfoimp.h" +#include "ximpobjecthelpers.h" +#include "ximppanics.h" +#include "ximptrace.h" +#include "ximpoperationdefs.h" +#include "ximpoperationbase.h" + +#include "ximphoststates.h" + +#include +#include + +using namespace NXIMPSrv; + + + +// ============================ MEMBER FUNCTIONS ============================= + +// --------------------------------------------------------------------------- +// CXIMPContextSession::NewL() +// --------------------------------------------------------------------------- +// +CXIMPContextSession* CXIMPContextSession::NewL( TUint32 aSessionId ) + { + CXIMPContextSession* self = new( ELeave ) CXIMPContextSession(); + CleanupStack::PushL( self ); + self->ConstructL( aSessionId ); + CleanupStack::Pop( self ); + return self; + } + + +// --------------------------------------------------------------------------- +// CXIMPContextSession::~CXIMPContextSession() +// --------------------------------------------------------------------------- +// +CXIMPContextSession::~CXIMPContextSession() + { + TRACE_1( _L("CXIMPContextSession[%d]::~CXIMPContextSession()"), this ); + + delete iPreparedData; + + if( iEventListenScout ) + { + iEventListenScout->Complete( KErrCancel ); + delete iEventListenScout; + } + + iClientData->EventQueue().StopConsuming(); + + // Unbind when client has died, and unbind not send. + CXIMPOperationBase* operation = iClientData->GetCachedUnbind(); + + if( operation ) + { + TRAP_IGNORE( + { + CleanupStack::PushL( operation ); + iClientData->AppendToOpQueueL( operation ); + CleanupStack::Pop( operation ); + } ); + } + + iClientData->Close(); + } + + +// --------------------------------------------------------------------------- +// CXIMPContextSession::CXIMPContextSession() +// --------------------------------------------------------------------------- +// +CXIMPContextSession::CXIMPContextSession() + { + TRACE_1( _L("CXIMPContextSession[%d]::CXIMPContextSession()"), this ); + } + + +// ----------------------------------------------------------------------------- +// CXIMPContextSession::ConstructL() +// ----------------------------------------------------------------------------- +// +void CXIMPContextSession::ConstructL( TUint32 aSessionId ) + { + iClientData = CXIMPPscContext::NewL( aSessionId ); + } + + +// ----------------------------------------------------------------------------- +// CXIMPContextSession::TryHandleMessageL() +// From MXIMPSrvSession +// ----------------------------------------------------------------------------- +// +void CXIMPContextSession::TryHandleMessageL( MXIMPSrvMessage& aMessage ) + { + switch( aMessage.Function() ) + { + //Asynchronous context operations related + case NRequest::ECtxSsQueueOperation: + { + DoQueueOperationL( aMessage ); + break; + } + //Asynchronous context operations related + case NRequest::ECtxSsQueueBindOperation: + { + DoQueueOperationL( aMessage ); + break; + } + + //Event handling related + case NRequest::ECtxSsInstallEventFilter: + { + DoInstallEventFilterL( aMessage ); + break; + } + + case NRequest::ECtxSsSetEventListenScout: + { + DoSetEventListenScoutL( aMessage ); + break; + } + + case NRequest::ECtxSsCancelEventListenScout: + { + DoCancelEventListenScout( aMessage ); + break; + } + + case NRequest::ECtxSsFetchTopEventDataSize: + { + DoFetchTopEventDataSizeL( aMessage ); + break; + } + + case NRequest::ECtxSsFetchTopEventData: + { + DoFetchTopEventDataL( aMessage ); + break; + } + + case NRequest::ECtxSsFetchTopEventReqId: + { + DoFetchTopEventReqIdL( aMessage ); + break; + } + + case NRequest::ECtxSsDropTopEvent: + { + DoDropTopEventL( aMessage ); + break; + } + + //Synchronous context data access + case NRequest::ECtxSsPrepareContextFeatures: + { + DoPrepareContextFeaturesL( aMessage ); + break; + } + + case NRequest::ECtxSsGetPreparedData: + { + DoGetPreparedDataL( aMessage ); + break; + } + + default: + { + //Unknown request type + //Nothing to do here. + } + } + } + + +// ----------------------------------------------------------------------------- +// CXIMPContextSession::NewEventAvailable() +// From MXIMPEventQueueObserver +// ----------------------------------------------------------------------------- +// +void CXIMPContextSession::NewEventAvailable() + { + if( iEventListenScout ) + { + iEventListenScout->Complete( KErrNone ); + delete iEventListenScout; + iEventListenScout = NULL; + } + } + + +// ----------------------------------------------------------------------------- +// CXIMPContextSession::DoQueueOperationL() +// ----------------------------------------------------------------------------- +// +void CXIMPContextSession::DoQueueOperationL( + MXIMPSrvMessage& aMessage ) + { + const TInt operationType = aMessage.Int( MXIMPSrvMessage::Ep0 ); + + TPckgBuf< TXIMPRequestId > reqIdBuf; + + // We can take ready unbind from context if it exists. + CXIMPOperationBase* operation = NULL; + if( operationType == NXIMPOps::EXIMPUnbindContext ) + { + operation = iClientData->GetCachedUnbind(); + // ownership transferred + } + + if( operation ) + { + // found an unbind, so put it to the queue to be processed + CleanupStack::PushL( operation ); + iClientData->AppendToOpQueueL( operation ); + reqIdBuf() = operation->RequestId(); + CleanupStack::Pop( operation ); + } + else + { + const TInt pckSize = aMessage.GetDesLengthL( MXIMPSrvMessage::Ep1 ); + HBufC8* paramPck = HBufC8::NewLC( pckSize ); + TPtr8 paramPckPtr = paramPck->Des(); + aMessage.ReadL( MXIMPSrvMessage::Ep1, paramPckPtr ); + reqIdBuf() = iClientData->AddNewOperationL( operationType, + *paramPck ); + CleanupStack::PopAndDestroy( paramPck ); + } + + aMessage.WriteL( MXIMPSrvMessage::Ep2, reqIdBuf ); + aMessage.Complete( KErrNone ); + } + + +// ----------------------------------------------------------------------------- +// CXIMPContextSession::DoInstallEventFilterL() +// ----------------------------------------------------------------------------- +// +void CXIMPContextSession::DoInstallEventFilterL( + MXIMPSrvMessage& aMessage ) + { + const TInt pckSize = aMessage.GetDesLengthL( MXIMPSrvMessage::Ep0 ); + HBufC8* filterPck = HBufC8::NewLC( pckSize ); + TPtr8 filterPckPtr( filterPck->Des() ); + aMessage.ReadL( MXIMPSrvMessage::Ep0, filterPckPtr ); + + CXIMPContextEventFilter* newFilter = CXIMPContextEventFilter::NewLC(); + TXIMPObjectPacker< CXIMPContextEventFilter >::UnPackL( *newFilter, + *filterPck ); + + iClientData->EventQueue().SetEventFilter( *newFilter ); + CleanupStack::Pop( newFilter ); + CleanupStack::PopAndDestroy( filterPck ); + + aMessage.Complete( KErrNone ); + } + + +// ----------------------------------------------------------------------------- +// CXIMPContextSession::DoSetEventListenScoutL() +// ----------------------------------------------------------------------------- +// +void CXIMPContextSession::DoSetEventListenScoutL( + MXIMPSrvMessage& aMessage ) + { + __ASSERT_ALWAYS( !iEventListenScout, + aMessage.PanicClientAndLeaveL( + NXIMPPanic::EOnSrvAlreadyListeningEvents ) ); + + iClientData->EventQueue().StartConsuming( *this ); + + //If there is already a events in que, + //signal client right a way + if( iClientData->EventQueue().HasElements() ) + { + aMessage.Complete( KErrNone ); + } + else + { + aMessage.PlaceOwnershipHere( iEventListenScout ); + } + } + + +// ----------------------------------------------------------------------------- +// CXIMPContextSession::DoCancelEventListenScout() +// ----------------------------------------------------------------------------- +// +void CXIMPContextSession::DoCancelEventListenScout( + MXIMPSrvMessage& aMessage ) + { + if( iEventListenScout ) + { + iEventListenScout->Complete( KErrCancel ); + delete iEventListenScout; + iEventListenScout = NULL; + } + + iClientData->EventQueue().StopConsuming(); + aMessage.Complete( KErrNone ); + } + + +// ----------------------------------------------------------------------------- +// CXIMPContextSession::DoFetchTopEventDataSizeL() +// ----------------------------------------------------------------------------- +// +void CXIMPContextSession::DoFetchTopEventDataSizeL( + MXIMPSrvMessage& aMessage ) + { + iClientData->EventQueue().SelectTopEventIfNeededL(); + aMessage.Complete( iClientData->EventQueue().TopEventDataL().Size() ); + } + + +// ----------------------------------------------------------------------------- +// CXIMPContextSession::DoFetchTopEventDataL() +// ----------------------------------------------------------------------------- +// +void CXIMPContextSession::DoFetchTopEventDataL( + MXIMPSrvMessage& aMessage ) + { + iClientData->EventQueue().SelectTopEventIfNeededL(); + aMessage.WriteL( MXIMPSrvMessage::Ep0, iClientData->EventQueue().TopEventDataL() ); + aMessage.Complete( KErrNone ); + } + + +// ----------------------------------------------------------------------------- +// CXIMPContextSession::DoFetchTopEventReqIdL() +// ----------------------------------------------------------------------------- +// +void CXIMPContextSession::DoFetchTopEventReqIdL( + MXIMPSrvMessage& aMessage ) + { + TPckgBuf< TXIMPRequestId > reqIdBuf; + + iClientData->EventQueue().SelectTopEventIfNeededL(); + reqIdBuf() = iClientData->EventQueue().TopEventReqIdL(); + + aMessage.WriteL( MXIMPSrvMessage::Ep0, reqIdBuf ); + aMessage.Complete( KErrNone ); + } + + +// ----------------------------------------------------------------------------- +// CXIMPContextSession::DoDropTopEventL() +// ----------------------------------------------------------------------------- +// +void CXIMPContextSession::DoDropTopEventL( + MXIMPSrvMessage& aMessage ) + { + iClientData->EventQueue().DropTopEvent(); + aMessage.Complete( KErrNone ); + } + + +// ----------------------------------------------------------------------------- +// CXIMPContextSession::DoPrepareContextFeaturesL() +// ----------------------------------------------------------------------------- +// +void CXIMPContextSession::DoPrepareContextFeaturesL( + MXIMPSrvMessage& aMessage ) + { + __ASSERT_ALWAYS( !iPreparedData, + aMessage.PanicClientAndLeaveL( + NXIMPPanic::EOnSrvAlreadyHavingPrepearedData ) ); + + + CXIMPFeatureInfoImp* feats = iClientData->FeaturesForSessionLC(); + iPreparedData = TXIMPObjectPacker< CXIMPFeatureInfoImp >::PackL( *feats ); + CleanupStack::PopAndDestroy( feats ); + + aMessage.Complete( iPreparedData->Size() ); + } + + +// ----------------------------------------------------------------------------- +// CXIMPContextSession::DoGetPreparedDataL() +// ----------------------------------------------------------------------------- +// +void CXIMPContextSession::DoGetPreparedDataL( + MXIMPSrvMessage& aMessage ) + { + //Release the prepared data from member variable + //Buffer gets cleaned even the copying to client side fails + HBufC8* tmpBuf = iPreparedData; + iPreparedData = NULL; + CleanupStack::PushL( tmpBuf ); + + //Assert that there is a data to copy to client + __ASSERT_ALWAYS( tmpBuf, + aMessage.PanicClientAndLeaveL( + NXIMPPanic::EOnSrvNoPrepearedDataToCopy ) ); + + aMessage.WriteL( MXIMPSrvMessage::Ep0, *tmpBuf ); + + CleanupStack::PopAndDestroy( tmpBuf ); + aMessage.Complete( KErrNone ); + } + + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcpscserver/ximpcontextsession.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcpscserver/ximpcontextsession.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,95 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Context session. + * +*/ + +#ifndef XIMPCONTEXTSESSION_H +#define XIMPCONTEXTSESSION_H + + +#include "ximpsrvsession.h" +#include "ximpeventqueueobserver.h" +#include + + +class MXIMPSrvMessage; +class CXIMPPscContext; + + +/** + * Context session implementation. + */ +class CXIMPContextSession : public CBase, + public MXIMPSrvSession, + public MXIMPEventQueueObserver + { +public: // Constructors and destructors + static CXIMPContextSession* NewL( TUint32 aSessionId ); + virtual ~CXIMPContextSession(); + + +protected: // Constructors + CXIMPContextSession(); + void ConstructL( TUint32 aSessionId ); + + +public: // From MXIMPSrvSession + void TryHandleMessageL( MXIMPSrvMessage& aMessage ); + + +public: // MXIMPEventQueueObserver + void NewEventAvailable(); + + +private: // New methods + + + void DoQueueOperationL( MXIMPSrvMessage& aMessage ); + + void DoInstallEventFilterL( MXIMPSrvMessage& aMessage ); + void DoSetEventListenScoutL( MXIMPSrvMessage& aMessage ); + void DoCancelEventListenScout( MXIMPSrvMessage& aMessage ); + void DoFetchTopEventDataSizeL( MXIMPSrvMessage& aMessage ); + void DoFetchTopEventDataL( MXIMPSrvMessage& aMessage ); + void DoFetchTopEventReqIdL( MXIMPSrvMessage& aMessage ); + void DoDropTopEventL( MXIMPSrvMessage& aMessage ); + + + void DoPrepareContextFeaturesL( MXIMPSrvMessage& aMessage ); + void DoGetPreparedDataL( MXIMPSrvMessage& aMessage ); + + + +private: // Data + + /** + * + */ + MXIMPSrvMessage* iEventListenScout; + + /** + * Buffer caching the prepared data + */ + HBufC8* iPreparedData; + + /** + * Storage for client data. + */ + CXIMPPscContext* iClientData; + }; + +#endif // XIMPSESSION_H__ + + diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcpscserver/ximpserver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcpscserver/ximpserver.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,319 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework PSC server class + * +*/ + +#include "ximpserverdefs.h" +#include "ximpserver.h" +#include "ximpserversessionadapter.h" +#include "ximptrace.h" +#include "ximpglobals.h" +#include "ximpoperationfactoryimp.h" +#include + +//Include PSC server namespace +using namespace NXIMPSrv; + + + +// ============================================================== +// =============== PLATSEC POLICY CONFIGURATION ================= +// ============================================================== +static const TInt KXIMPServerPlatSecRangeCount = 3; + +static const TInt KXIMPServerPlatSecPolicyIndex0 = 0; +static const TInt KXIMPServerPlatSecPolicyIndex1 = 1; + +//Ranges for the Request values +static const TInt KXIMPServerPlatSecRanges[ KXIMPServerPlatSecRangeCount ] = + { + 0, + NRequest::ECtxSsQueueBindOperation, + NRequest::EOpCodeTop + }; + + +// Element indexes for the defined ranges +static const TUint8 KXIMPServerPlatSecElementsIndex[ KXIMPServerPlatSecRangeCount ] = + { + KXIMPServerPlatSecPolicyIndex0, + KXIMPServerPlatSecPolicyIndex1, + CPolicyServer::ENotSupported + }; + + +// Policy elements +static const CPolicyServer::TPolicyElement KXIMPServerPlatSecElements[] = + { + { + // Policy 0, KXIMPServerPlatSecPolicyIndex0 + _INIT_SECURITY_POLICY_C3( ECapabilityReadUserData, + ECapabilityWriteUserData, + ECapabilityNetworkServices ), + CPolicyServer::EFailClient + }, + { + // Policy 1, KXIMPServerPlatSecPolicyIndex1 + _INIT_SECURITY_POLICY_C4( ECapabilityReadDeviceData, + ECapabilityReadUserData, + ECapabilityWriteUserData, + ECapabilityNetworkServices ), + CPolicyServer::EFailClient + } + }; + + +// The platsec policy +static const CPolicyServer::TPolicy KXIMPServerPlatSecPolicy = + { + // Shortcut to the index into Elements,that is used to check a connection attempt + KXIMPServerPlatSecPolicyIndex0, + + // Number of ranges in the iRanges array + KXIMPServerPlatSecRangeCount, + + // A pointer to an array of ordered ranges of request numbers + KXIMPServerPlatSecRanges, + + // A pointer to an array of TUint8 values specifying + // the appropriate action to take for each range in iRanges + KXIMPServerPlatSecElementsIndex, + + // A pointer to an array of distinct policy elements + KXIMPServerPlatSecElements + }; + + + +// ----------------------------------------------------------------------------- +// CXIMPServer::ExecuteL() +// ----------------------------------------------------------------------------- +// +void CXIMPServer::ExecuteL() + { + // start scheduler + CActiveScheduler* pA = new( ELeave )CActiveScheduler; + CleanupStack::PushL( pA ); + CActiveScheduler::Install( pA ); + + // create server + CXIMPServer* server = CXIMPServer::NewLC(); + + // rename our thread properly + // first, find out the UID set by process starter + TInt uid = 0; + TInt ret = User::GetTIntParameter( NStartupParam::KProtocolUidIndex, + uid ); + User::LeaveIfError( ret ); + + // create the "!XIMPCtxSrv9bde667a" server name + HBufC* serverName = HBufC::NewLC( NName::KSymbianServer().Length() + + NStartupParam::KProtocolUidMaxLen + + 1 ); + + serverName->Des().Copy( NName::KSymbianServer ); + serverName->Des().AppendNumFixedWidth( uid, + EHex, + NStartupParam::KProtocolUidMaxLen ); + + // and set it + User::RenameThread( *serverName ); + server->StartL( *serverName ); + + CleanupStack::PopAndDestroy( serverName ); + + //Signal client that we are started + RProcess().Rendezvous( KErrNone ); + + //Execute the server + CActiveScheduler::Start(); // CSI: 3 # + + //Cleanup + CleanupStack::PopAndDestroy( server );//server + CleanupStack::PopAndDestroy( pA ); + CActiveScheduler::Install( NULL ); + } + + + +// ----------------------------------------------------------------------------- +// CXIMPServer::~CXIMPServer() +// ----------------------------------------------------------------------------- +// +CXIMPServer::~CXIMPServer() + { + CXIMPGlobals::UninstallD(); + REComSession::FinalClose(); + + #if _BullseyeCoverage + cov_write(); + #endif + } + + +// ----------------------------------------------------------------------------- +// CXIMPServer::CXIMPServer() +// ----------------------------------------------------------------------------- +// +CXIMPServer::CXIMPServer() + : CPolicyServer( CActive::EPriorityStandard, KXIMPServerPlatSecPolicy ) + { + iSessionId = 1; // start from 1. 0 reserved for host-originated operations + } + + +// ----------------------------------------------------------------------------- +// CXIMPServer::NewLC() +// ----------------------------------------------------------------------------- +// +CXIMPServer* CXIMPServer::NewLC() + { + CXIMPServer* self = new( ELeave ) CXIMPServer; + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + + +// ----------------------------------------------------------------------------- +// CXIMPServer::ConstructL() +// ----------------------------------------------------------------------------- +// +void CXIMPServer::ConstructL() + { + CXIMPOperationFactory* operationFactory = CXIMPOperationFactory::NewL(); + CleanupStack::PushL( operationFactory ); + CXIMPGlobals::InstallL( operationFactory, this ); + CleanupStack::Pop( operationFactory ); + iGlobals = CXIMPGlobals::Instance(); + } + + +// ----------------------------------------------------------------------------- +// CXIMPServer::NewSessionL() +// ----------------------------------------------------------------------------- +// +CSession2* CXIMPServer::NewSessionL( const TVersion &aVersion, + const RMessage2& /* aMessage */ ) const + { + TVersion srvVersion( NVersion::KMajor, + NVersion::KMinor, + NVersion::KBuild ); + + if( !User::QueryVersionSupported( aVersion, srvVersion ) ) + { + User::Leave( KErrNotSupported ); + } + + CXIMPServer* self = const_cast< CXIMPServer* >( this ); + self->iSessionId++; + return CXIMPServerSessionAdapter::NewL( iSessionId, + *self ); + }; + + +// ----------------------------------------------------------------------------- +// CXIMPServer::SessionCreated() +// ----------------------------------------------------------------------------- +// +void CXIMPServer::SessionCreated() + { + iSessionCount++; + } + + +// ----------------------------------------------------------------------------- +// CXIMPServer::SessionDied() +// ----------------------------------------------------------------------------- +// +void CXIMPServer::SessionDied() + { + iSessionCount--; + TryToStopScheduling(); + } + +// ----------------------------------------------------------------------------- +// CXIMPServer::AllHostsDied() +// ----------------------------------------------------------------------------- +// +void CXIMPServer::AllHostsDied() + { + // all hosts have died. + iAllHostsDied = ETrue; + TryToStopScheduling(); + } + +// ----------------------------------------------------------------------------- +// CXIMPServer::AllHostsDied() +// ----------------------------------------------------------------------------- +// +void CXIMPServer::TryToStopScheduling() + { + if( iSessionCount == 0 && iAllHostsDied ) + { + CActiveScheduler::Stop(); // CSI: 4 # + } + } + +// ----------------------------------------------------------------------------- +// CXIMPServer::TestListener() +// ----------------------------------------------------------------------------- +// +MXIMPSrvTestListener* CXIMPServer::TestListener() const + { + return iTestListener; + } + +// ----------------------------------------------------------------------------- +// CXIMPServer::RegisterTestListener() +// ----------------------------------------------------------------------------- +// +void CXIMPServer::RegisterTestListener( MXIMPSrvTestListener* aTestSession ) + { + iTestListener = aTestSession; + } + +// ----------------------------------------------------------------------------- +// E32Main() +// ENTRY POINT +// ----------------------------------------------------------------------------- +// +GLDEF_C TInt E32Main() + { + TRACE( _L("PSC Server E32Main - enter") ); + + __UHEAP_MARK; + + CTrapCleanup* tc = CTrapCleanup::New(); + if( !tc ) + { + return KErrNoMemory; + } + + User::RenameThread( NName::KMainThread ); + + TRAPD( err, CXIMPServer::ExecuteL() ); + delete tc; + + __UHEAP_MARKEND; + + TRACE_1( _L("PSC Server E32Main - exit: %d"), err ); + return err; + } + + +// END OF FILE + + diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcpscserver/ximpserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcpscserver/ximpserver.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,89 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework PSC server class + * +*/ + +#ifndef CXIMPPSCSERVER_H +#define CXIMPPSCSERVER_H + +#include "ximpsrv.h" +#include +#include "ximpglobalsobserver.h" + +#include + + +class CXIMPGlobals; +class MXIMPSrvTestListener; + + +/** + * Presence Service Connection (PSC) server implementation. + * There exists one PSC server per protocol. + */ +class CXIMPServer : public CPolicyServer, + public MXIMPSrv, + public MXIMPGlobalsObserver + { +public: // Execution and destructor + static void ExecuteL(); + virtual ~CXIMPServer(); + +public: // from MXIMPGlobalsObserver + void AllHostsDied(); + +private: // Constructors + static CXIMPServer* NewLC(); + CXIMPServer(); + void ConstructL(); + + +private: // From CPolicyServer + CSession2* NewSessionL( const TVersion& aVersion, + const RMessage2& aMessage ) const; + + +private: // From MXIMPSrv + void SessionCreated(); + void SessionDied(); + MXIMPSrvTestListener* TestListener() const; + void RegisterTestListener( MXIMPSrvTestListener* aTestSession ); + +private: // Helper + + void TryToStopScheduling(); + +private: //Data + + // OWN: Count of sessions + TInt iSessionCount; + TBool iAllHostsDied; + + + // OWN: Always increasing session id. + TUint32 iSessionId; + + // OWN: pointer to globals singleton + CXIMPGlobals* iGlobals; + + // Does not own. Pointer to test listener. + MXIMPSrvTestListener* iTestListener; + }; + +#endif // CXIMPPSCSERVER_H + + + + diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcpscserver/ximpserverdefs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcpscserver/ximpserverdefs.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,105 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Defines for XIMP Framework PSC server. + * +*/ + +#ifndef XIMPPSCSERVERDEFS_H +#define XIMPPSCSERVERDEFS_H + +#include + +/* + * ============================================================================ + * Presence Service Connection (PSC) server constants + * ============================================================================ + */ +namespace NXIMPSrv + { + /** + * PSC server version numbers + */ + namespace NVersion + { + const TInt KMajor = 1; + const TInt KMinor = 1; + const TInt KBuild = 1; + } + + + /** + * PSC server names + */ + namespace NName + { + _LIT( KExecutable, "ximpserver.exe" ); + _LIT( KMainThread, "XIMPPscSrv" ); + _LIT( KSymbianServer, "!XIMPPscSrv" ); + _LIT( KServerPattern, "*XIMP*" ); + } + + + /** + * PSC server start-up parameters + */ + namespace NStartupParam + { + //RProcess parameter slot for the protocol UID + const TInt KProtocolUidIndex = 1; + + //Maximum length for the UID string + const TInt KProtocolUidMaxLen = 8; + } + + + /** + * PSC server requests + */ + namespace NRequest + { + //Number asynchronous message slots for PSC server + const TUint KMsgSlotCount = 4; + + //PSC Server op codes + enum TOpCodes + { + EBecomeCtxSession = 1, + + ECtxSsQueueOperation, + + ECtxSsInstallEventFilter, + ECtxSsSetEventListenScout, + ECtxSsCancelEventListenScout, + ECtxSsFetchTopEventDataSize, + ECtxSsFetchTopEventData, + ECtxSsFetchTopEventReqId, + ECtxSsDropTopEvent, + + ECtxSsPrepareContextFeatures, + ECtxSsGetPreparedData, + + ECtxSsQueueBindOperation, // 12 + + EOpCodeTop + }; + } + } + + +#endif //XIMPPSCSERVERDEFS_H + + + + + diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcpscserver/ximpserversessionadapter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcpscserver/ximpserversessionadapter.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,88 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: PSC server session adapter + * +*/ + +#include "ximpserversessionadapter.h" +#include "ximpserverdefs.h" +#include "ximpsrvmessage.h" +#include "ximpcontextsession.h" +#include "ximpsrv.h" +#include + + +//Include PSC server namespace +using namespace NXIMPSrv; + + + +// ----------------------------------------------------------------------------- +// CXIMPServerSessionAdapter::NewL() +// ----------------------------------------------------------------------------- +// +CXIMPServerSessionAdapter* CXIMPServerSessionAdapter::NewL( + TUint32 aSessionId, + MXIMPSrv& aServer ) + { + CXIMPServerSessionAdapter* self = + new( ELeave ) CXIMPServerSessionAdapter( aSessionId, + aServer ); + return self; + } + + +// ----------------------------------------------------------------------------- +// CXIMPServerSessionAdapter::~CXIMPServerSessionAdapter() +// ----------------------------------------------------------------------------- +// +CXIMPServerSessionAdapter::~CXIMPServerSessionAdapter() + { + } + + +// ----------------------------------------------------------------------------- +// CXIMPServerSessionAdapter::CXIMPServerSessionAdapter() +// ----------------------------------------------------------------------------- +// +CXIMPServerSessionAdapter::CXIMPServerSessionAdapter( + TUint32 aSessionId, + MXIMPSrv& aServer ) + : CXIMPSrvSessionAdapter( aServer ), + iSessionId( aSessionId ) + { + } + + +// ----------------------------------------------------------------------------- +// CXIMPServerSessionAdapter::DoInstantiateSessionL() +// ----------------------------------------------------------------------------- +// +MXIMPSrvSession* CXIMPServerSessionAdapter::DoInstantiateSessionL( + const MXIMPSrvMessage& aMessage ) + { + switch( aMessage.Function() ) + { + case NRequest::EBecomeCtxSession: + { + return CXIMPContextSession::NewL( iSessionId ); + } + default: + { + return NULL; + } + } + } + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcpscserver/ximpserversessionadapter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcpscserver/ximpserversessionadapter.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,68 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: PSC server session adapter + * +*/ + + +#ifndef XIMPPSCSERVERSESSIONADAPTER_H +#define XIMPPSCSERVERSESSIONADAPTER_H + +#include +#include "ximpsrvsessionadapter.h" + +class MXIMPSrv; +class MXIMPSrvSession; +class MXIMPSrvMessage; + + +/** + * Session adapter for XIMP Framework PSC server. + */ +class CXIMPServerSessionAdapter : public CXIMPSrvSessionAdapter + { +public: // Constructors and destructors + static CXIMPServerSessionAdapter* NewL( TUint32 aSessionId, + MXIMPSrv& aServer ); + virtual ~CXIMPServerSessionAdapter(); + +protected: // C++ constructors + CXIMPServerSessionAdapter( TUint32 aSessionId, + MXIMPSrv& aServer ); + + +public: // From CXIMPSrvSessionAdapter + + /** + * Template method to instantiate concrete + * PSC session objects. + * + * @param aMessage The session instantiation message. + * + * @return Session implementation object or NULL if the message + * isn't valid session instantiation request. + */ + MXIMPSrvSession* DoInstantiateSessionL( const MXIMPSrvMessage& aMessage ); + + +private: // Data + + /** + * Identifier for this session. + */ + TUint32 iSessionId; + }; + +#endif // XIMPPSCSERVERSESSIONADAPTER_H + diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcrootserver/ximprootserver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcrootserver/ximprootserver.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,246 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Root server implementation + * +*/ + +#include + +#include "ximprootserver.h" +#include "ximprootserversessionadapter.h" +#include "ximprootserverdefs.h" +#include "ximptrace.h" +#include "ximpglobals.h" +#include "ximpoperationfactoryimp.h" + +//Include Root server namespace +using namespace NRootSrv; + + +// ============================================================== +// =============== PLATSEC POLICY CONFIGURATION ================= +// ============================================================== +static const TInt KXIMPRootServerPlatSecRangeCount = 2; + +//Ranges for the Request values +static const TInt KXIMPRootServerPlatSecRanges[ KXIMPRootServerPlatSecRangeCount ] = + { + 0, + Max( ( TInt )NRootSrv::NRequest::EOpCodeTop, ( TInt )NRequest::EOpCodeTop ) + }; + + +// Element indexes for the defined ranges +static const TUint8 KXIMPRootServerPlatSecElementsIndex[ KXIMPRootServerPlatSecRangeCount ] = + { + 0, + CPolicyServer::ENotSupported + }; + + +// Policy elements +static const CPolicyServer::TPolicyElement KXIMPRootServerPlatSecElements[] = + { + { + _INIT_SECURITY_POLICY_C3( ECapabilityReadUserData, + ECapabilityWriteUserData, + ECapabilityNetworkServices ), + CPolicyServer::EFailClient + } + }; + + +// The platsec policy +static const CPolicyServer::TPolicy KXIMPRootServerPlatSecPolicy = + { + // Shortcut to the index into Elements,that is used to check a connection attempt + 0, + + // Number of ranges in the iRanges array + KXIMPRootServerPlatSecRangeCount, + + // A pointer to an array of ordered ranges of request numbers + KXIMPRootServerPlatSecRanges, + + // A pointer to an array of TUint8 values specifying + // the appropriate action to take for each range in iRanges + KXIMPRootServerPlatSecElementsIndex, + + // A pointer to an array of distinct policy elements + KXIMPRootServerPlatSecElements + }; + + + +// ----------------------------------------------------------------------------- +// CXIMPRootServer::ExecuteL() +// ----------------------------------------------------------------------------- +// +void CXIMPRootServer::ExecuteL() + { + // start scheduler + CActiveScheduler* pA = new( ELeave )CActiveScheduler; + CleanupStack::PushL( pA ); + CActiveScheduler::Install( pA ); + + // create server + CXIMPRootServer* server = CXIMPRootServer::NewLC(); + server->StartL( NName::KSymbianServer ); + + //Signal client that we are started + RProcess().Rendezvous( KErrNone ); + + //Execute the server + CActiveScheduler::Start(); // CSI: 3 # + + //Cleanup + CleanupStack::PopAndDestroy( server );//server + CleanupStack::PopAndDestroy( pA ); + CActiveScheduler::Install( NULL ); + } + + +// ----------------------------------------------------------------------------- +// CXIMPRootServer::~CXIMPRootServer() +// ----------------------------------------------------------------------------- +// +CXIMPRootServer::~CXIMPRootServer() + { + CXIMPGlobals::UninstallD(); + REComSession::FinalClose(); + + #if _BullseyeCoverage + cov_write(); + #endif + } + + +// ----------------------------------------------------------------------------- +// CXIMPRootServer::CXIMPRootServer() +// ----------------------------------------------------------------------------- +// +CXIMPRootServer::CXIMPRootServer() + : CPolicyServer( CActive::EPriorityStandard, + KXIMPRootServerPlatSecPolicy ) + { + } + + +// ----------------------------------------------------------------------------- +// CXIMPRootServer::NewLC() +// ----------------------------------------------------------------------------- +// +CXIMPRootServer* CXIMPRootServer::NewLC() + { + CXIMPRootServer* self = new( ELeave ) CXIMPRootServer; + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + + +// ----------------------------------------------------------------------------- +// CXIMPRootServer::ConstructL() +// ----------------------------------------------------------------------------- +// +void CXIMPRootServer::ConstructL() + { + CXIMPOperationFactory* operationFactory = CXIMPOperationFactory::NewL(); + CleanupStack::PushL( operationFactory ); + CXIMPGlobals::InstallL( operationFactory, NULL ); + CleanupStack::Pop( operationFactory ); + iGlobals = CXIMPGlobals::Instance(); + } + + +// ----------------------------------------------------------------------------- +// CXIMPRootServer::NewSessionL() +// ----------------------------------------------------------------------------- +// +CSession2* CXIMPRootServer::NewSessionL( const TVersion &aVersion, + const RMessage2& /* aMessage */ ) const + { + TVersion srvVersion( NVersion::KMajor, + NVersion::KMinor, + NVersion::KBuild ); + + if( !User::QueryVersionSupported( aVersion, srvVersion ) ) + { + User::Leave( KErrNotSupported ); + } + + CXIMPRootServer* self = const_cast< CXIMPRootServer* >( this ); + CSession2* session = NULL; + + TRAPD( err, session = CXIMPRootServerSessionAdapter::NewL( *self ) ); + User::LeaveIfError( err ); + return session; + } + + +// ----------------------------------------------------------------------------- +// CXIMPRootServer::SessionCreated() +// ----------------------------------------------------------------------------- +// +void CXIMPRootServer::SessionCreated() + { + iSessionCount++; + } + + +// ----------------------------------------------------------------------------- +// CXIMPRootServer::SessionDied() +// ----------------------------------------------------------------------------- +// +void CXIMPRootServer::SessionDied() + { + iSessionCount--; + if( iSessionCount == 0 ) + { + CActiveScheduler::Stop(); // CSI: 4 # + } + } + +// ----------------------------------------------------------------------------- +// E32Main() +// ENTRY POINT +// ----------------------------------------------------------------------------- +// +GLDEF_C TInt E32Main() + { + TRACE( _L("Root E32Main - enter") ); + + __UHEAP_MARK; + + User::RenameThread( NName::KMainThread ); + + CTrapCleanup* tc = CTrapCleanup::New(); + if( !tc ) + { + return KErrNoMemory; + } + + TRAPD( err, CXIMPRootServer::ExecuteL() ); + delete tc; + + __UHEAP_MARKEND; + + TRACE_1( _L("Root E32Main - exit: %d"), err ); + return err; + } + + +// END OF FILE + + diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcrootserver/ximprootserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcrootserver/ximprootserver.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,76 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Root server implementation + * +*/ + +#ifndef CXIMPROOTSERVER_H +#define CXIMPROOTSERVER_H + +#include "ximpsrv.h" +#include +#include + +class CXIMPGlobals; +class MXIMPSrvTestListener; + +/** + * Presence Root server implementation. + * There exists one root server. + */ +class CXIMPRootServer : public CPolicyServer, + public MXIMPSrv + { +public: // Execution and destructor + + static void ExecuteL(); + virtual ~CXIMPRootServer(); + + +private: //Constructors + + static CXIMPRootServer* NewLC(); + CXIMPRootServer(); + void ConstructL(); + + +public: // From CPolicyServer + + CSession2* NewSessionL( const TVersion& aVersion, + const RMessage2& aMessage ) const; + + +private: // From MXIMPSrv + + void SessionCreated(); + void SessionDied(); + +private: //Data + + // OWN: Count of sessions + TInt iSessionCount; + + // OWN: pointer to globals singleton + CXIMPGlobals* iGlobals; + + // Always increasing session id counter. Stays unique per server for + // up to 2^32-1 invocations of NewSessionL. + TUint32 iSessionIdCounter; + }; + +#endif // CXIMPROOTSERVER_H + + + + diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcrootserver/ximprootserverdefs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcrootserver/ximprootserverdefs.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,79 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Defines for XIMP Framework Root server. + * +*/ + +#ifndef XIMPROOTSERVERDEFS_H +#define XIMPROOTSERVERDEFS_H + +#include + +/* + * ============================================================================ + * XIMP Framework Root server constants + * ============================================================================ + */ +namespace NRootSrv + { + /** + * Root server version numbers + */ + namespace NVersion + { + const TInt KMajor = 1; + const TInt KMinor = 1; + const TInt KBuild = 1; + } + + + /** + * Root server names + */ + namespace NName + { + _LIT( KExecutable, "ximprootserver.exe" ); + _LIT( KMainThread, "XIMPRootSrv" ); + _LIT( KSymbianServer, "!XIMPRootSrv" ); + _LIT( KServerPattern, "*XIMP*" ); + } + + /** + * Root server requests + */ + namespace NRequest + { + //Number asynchronous message slots for Root server + const TUint KMsgSlotCount = 4; + + //Root Server op codes + enum TOpCodes + { + EBecomeRootSession = 1, + + ERootSsPrepareProtocolList, + ERootSsPrepareSupportedFeatures, + ERootSsFetchServerSideData, + + EOpCodeTop + }; + } + } + +#endif //XIMPROOTSERVERDEFS_H + + + + + diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcrootserver/ximprootserversessionadapter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcrootserver/ximprootserversessionadapter.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,84 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Root server session adaptation + * +*/ + +#include "ximprootserversessionadapter.h" +#include "ximprootserverdefs.h" +#include "ximpsrvmessage.h" +#include "ximprootsession.h" +#include "ximpsrv.h" + +#include + + +//Include Root server namespace +using namespace NRootSrv; + + +// ----------------------------------------------------------------------------- +// CXIMPRootServerSessionAdapter::NewL() +// ----------------------------------------------------------------------------- +// +CXIMPRootServerSessionAdapter* + CXIMPRootServerSessionAdapter::NewL( MXIMPSrv& aServer ) + { + CXIMPRootServerSessionAdapter* self = + new( ELeave ) CXIMPRootServerSessionAdapter( aServer ); + return self; + } + + +// ----------------------------------------------------------------------------- +// CXIMPRootServerSessionAdapter::~CXIMPRootServerSessionAdapter() +// ----------------------------------------------------------------------------- +// +CXIMPRootServerSessionAdapter::~CXIMPRootServerSessionAdapter() + { + } + + +// ----------------------------------------------------------------------------- +// CXIMPRootServerSessionAdapter::CXIMPRootServerSessionAdapter() +// ----------------------------------------------------------------------------- +// +CXIMPRootServerSessionAdapter::CXIMPRootServerSessionAdapter( + MXIMPSrv& aServer ) + : CXIMPSrvSessionAdapter( aServer ) + { + } + + +// ----------------------------------------------------------------------------- +// CXIMPRootServerSessionAdapter::DoInstantiateSessionL() +// ----------------------------------------------------------------------------- +// +MXIMPSrvSession* CXIMPRootServerSessionAdapter::DoInstantiateSessionL( + const MXIMPSrvMessage& aMessage ) + { + switch( aMessage.Function() ) + { + case NRequest::EBecomeRootSession: + { + return CXIMPRootSession::NewL(); + } + default: + { + return NULL; + } + } + } + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcrootserver/ximprootserversessionadapter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcrootserver/ximprootserversessionadapter.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,60 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework Root server session adapter + * +*/ + + +#ifndef XIMPROOTSESSIONADAPTER_H +#define XIMPROOTSESSIONADAPTER_H + +#include +#include "ximpsrvsessionadapter.h" + +class MXIMPSrv; +class MXIMPSrvSession; +class MXIMPSrvMessage; + + +/** + * Session adapter for XIMP Framework Root server. + */ +class CXIMPRootServerSessionAdapter : public CXIMPSrvSessionAdapter + { +public: // Constructors and destructors + static CXIMPRootServerSessionAdapter* NewL( MXIMPSrv& aServer ); + virtual ~CXIMPRootServerSessionAdapter(); + +protected: // C++ constructors + CXIMPRootServerSessionAdapter( MXIMPSrv& aServer ); + + +public: // From CXIMPSrvSessionAdapter + + /** + * Template method to instantiate concrete + * Root session objects. + * + * @param aMessage The session instantiation message. + * + * @return Session implementation object or NULL if the message + * isn't valid session instantiation request. + */ + MXIMPSrvSession* DoInstantiateSessionL( const MXIMPSrvMessage& aMessage ); + + }; + +#endif // XIMPROOTSESSIONADAPTER_H + + diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcrootserver/ximprootsession.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcrootserver/ximprootsession.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,149 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework server root session implementation +* +*/ + +#include "ximpbase.h" +#include "ximprootsession.h" +#include "ximprootserverdefs.h" +#include "ximpglobals.h" +#include "ximppluginfactory.h" +#include "ximpfeaturemanager.h" +#include "ximpsrvmessage.h" +#include "ximptrace.h" + +#include + + +//Import NRootSrv namespace +using namespace NRootSrv; + +// ----------------------------------------------------------------------------- +// CXIMPRootSession::NewL() +// ----------------------------------------------------------------------------- +// +CXIMPRootSession* CXIMPRootSession::NewL() + { + CXIMPRootSession* self = new( ELeave ) CXIMPRootSession(); + return self; + } + + +// ----------------------------------------------------------------------------- +// CXIMPRootSession::~CXIMPRootSession() +// ----------------------------------------------------------------------------- +// +CXIMPRootSession::~CXIMPRootSession() + { + delete iBuffer; + } + + +// ----------------------------------------------------------------------------- +// CXIMPRootSession::CXIMPRootSession() +// ----------------------------------------------------------------------------- +// +CXIMPRootSession::CXIMPRootSession() + { + } + + +// ----------------------------------------------------------------------------- +// CXIMPRootSession::TryHandleMessageL() +// ----------------------------------------------------------------------------- +// +void CXIMPRootSession::TryHandleMessageL( MXIMPSrvMessage& aMessage ) + { + TBool msgNeedsToBeCompleted = ETrue; + + switch( aMessage.Function() ) + { + case NRequest::ERootSsPrepareProtocolList: + { + DoPrepareProtocolListL( aMessage ); + aMessage.Complete( iBuffer->Size() ); + msgNeedsToBeCompleted = EFalse; + break; + } + + case NRequest::ERootSsPrepareSupportedFeatures: + { + DoPrepareSupportedFeaturesL( aMessage ); + aMessage.Complete( iBuffer->Size() ); + msgNeedsToBeCompleted = EFalse; + break; + } + + case NRequest::ERootSsFetchServerSideData: + { + DoFetchServerDataL( aMessage ); + break; + } + + default: + { + // bogus message + break; + } + } + + if ( msgNeedsToBeCompleted ) + { + aMessage.Complete( KErrNone ); + } + + } + + +// ----------------------------------------------------------------------------- +// CXIMPRootSession::DoPrepareProtocolListL() +// ----------------------------------------------------------------------------- +// +void CXIMPRootSession::DoPrepareProtocolListL( + const MXIMPSrvMessage& /* aMessage */ ) + { + HBufC8* tmp = CXIMPGlobals::Instance()->PluginFactory()->GetProtocolsL(); + delete iBuffer; + iBuffer = tmp; + } + + +// ----------------------------------------------------------------------------- +// CXIMPRootSession::DoPrepareSupportedFeaturesL() +// ----------------------------------------------------------------------------- +// +void CXIMPRootSession::DoPrepareSupportedFeaturesL( + const MXIMPSrvMessage& /* aMessage */ ) + { + HBufC8* tmp = CXIMPGlobals::Instance()->FeatureManager()->GetFrameworkFeaturesL(); + delete iBuffer; + iBuffer = tmp; + } + + +// ----------------------------------------------------------------------------- +// CXIMPRootSession::DoFetchServerDataL() +// ----------------------------------------------------------------------------- +// +void CXIMPRootSession::DoFetchServerDataL( + const MXIMPSrvMessage& aMessage ) + { + aMessage.WriteL( MXIMPSrvMessage::Ep0, *iBuffer ); + delete iBuffer; + iBuffer = NULL; + } + + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcrootserver/ximprootsession.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcrootserver/ximprootsession.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,68 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework server root session + * +*/ + +#ifndef XIMPROOTSESSION_H +#define XIMPROOTSESSION_H + +#include +#include "ximpsrvsession.h" + +class MXIMPSrvMessage; + + +/** + * Root session implementation. + */ +class CXIMPRootSession : public CBase, + public MXIMPSrvSession + { +public: // Constructors and destructors + static CXIMPRootSession* NewL(); + virtual ~CXIMPRootSession(); + +protected: // C++ constructors + CXIMPRootSession(); + + +public: // From MXIMPSrvSession + + /** + * @see MXIMPSrvSession + */ + void TryHandleMessageL( MXIMPSrvMessage& aMessage ); + + + +private: + + void DoPrepareProtocolListL( const MXIMPSrvMessage& aMessage ); + void DoPrepareSupportedFeaturesL( const MXIMPSrvMessage& aMessage ); + void DoFetchServerDataL( const MXIMPSrvMessage& aMessage ); + + +private: // Data + + /** + * Common buffer for server operations + */ + HBufC8* iBuffer; + + }; + +#endif // XIMPROOTSESSION_H_ + + diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcutils/ximpobjecthelpers.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcutils/ximpobjecthelpers.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,88 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Helpers for handling objects +* +*/ + +#include "ximpobjecthelpers.h" + +// ==================== TXIMPHBuf8Packer MEMBER FUNCTIONS ==================== + +// ----------------------------------------------------------------------------- +// TXIMPHBuf8Packer::PackArrayL() +// ----------------------------------------------------------------------------- +// +EXPORT_C HBufC8* TXIMPHBuf8Packer::PackArrayL( const RPointerArray< HBufC8 >& aBufferArray ) + { + CBufFlat* packBuf = CBufFlat::NewL( KObjectBufGranurality ); + CleanupStack::PushL( packBuf ); + + RBufWriteStream ws; + ws.Open( *packBuf ); // CSI: 65 # + CleanupClosePushL( ws ); + + // Get count of objects + TInt objCount( aBufferArray.Count() ); + // write the count + ws.WriteInt32L( objCount ); + // objects + for ( TInt count(0); count < objCount; count++ ) + { + ws.WriteInt32L( aBufferArray[ count ]->Size() ); + ws.WriteL( *aBufferArray[ count ] ); + } + + ws.CommitL(); + CleanupStack::PopAndDestroy(); //ws + + HBufC8* packBufDesc = packBuf->Ptr(0).AllocL(); + CleanupStack::PopAndDestroy( packBuf ); + + return packBufDesc; + } + + +// ----------------------------------------------------------------------------- +// TXIMPHBuf8Packer::UnPackArrayL() +// ----------------------------------------------------------------------------- +// +EXPORT_C void TXIMPHBuf8Packer::UnPackArrayL( RPointerArray< HBufC8 >& aBufferArray, const TDesC8& aPack ) + { + // No reset + if ( ! aPack.Length() ) + { + // empty, don't attempt to unpack + return; + } + + RDesReadStream rs; + CleanupClosePushL( rs ); + rs.Open( aPack ); // CSI: 65 # + + // read the object count + TInt objCount( rs.ReadInt32L() ); + + for ( TInt count = 0; count < objCount; count++ ) + { + TInt length = rs.ReadInt32L(); + HBufC8* theObject = HBufC8::NewLC( length ); + TPtr8 theObjectPtr = theObject->Des(); + + rs.ReadL( theObjectPtr, length ); + aBufferArray.AppendL( theObject ); + } + CleanupStack::Pop( objCount ); // all the objects + CleanupStack::PopAndDestroy(); // rs + } +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcutils/ximppanics.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcutils/ximppanics.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,38 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework panic implementation +* +*/ + +// INCLUDE FILES +#include "ximppanics.h" + + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// NXIMPPrivPanic::Panic() +// ----------------------------------------------------------------------------- +// +EXPORT_C void NXIMPPrivPanic::Panic( TReason aReason ) + { + #ifdef __WINS__ + // User::SetJustInTime( ETrue ); + #endif // __WINS__ + + User::Panic( NXIMPPrivPanic::KCategory, aReason ); + } + + + diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcutils/ximprbufhelpers.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcutils/ximprbufhelpers.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,123 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Helpers for handling RBuf. +* +*/ + +#include "ximprbufhelpers.h" + +// ==================== XIMPRBuf16Helper MEMBER FUNCTIONS ==================== + +// ----------------------------------------------------------------------------- +// XIMPRBuf16Helper::GrowIfNeededL() +// ----------------------------------------------------------------------------- +// +EXPORT_C void XIMPRBuf16Helper::GrowIfNeededL( RBuf16& aBuf, const TInt aMaxLength ) + { + if ( aBuf.MaxLength() < aMaxLength ) + { + aBuf.ReAllocL( aMaxLength ); + } + } + + +// ----------------------------------------------------------------------------- +// XIMPRBuf16Helper::SetNewValueL() +// ----------------------------------------------------------------------------- +// +EXPORT_C void XIMPRBuf16Helper::SetNewValueL( RBuf16& aBuf, + const TDesC16& aValue ) + { + GrowIfNeededL( aBuf, aValue.Length() ); + aBuf.Copy( aValue ); + } + + +// ----------------------------------------------------------------------------- +// XIMPRBuf16Helper::ExternalizeL() +// ----------------------------------------------------------------------------- +// +EXPORT_C void XIMPRBuf16Helper::ExternalizeL( const RBuf16& aBuf, + RWriteStream& aStream ) + { + aStream.WriteInt32L( aBuf.Length() ); + aStream.WriteL( aBuf ); + } + + +// ----------------------------------------------------------------------------- +// XIMPRBuf16Helper::InternalizeL() +// ----------------------------------------------------------------------------- +// +EXPORT_C void XIMPRBuf16Helper::InternalizeL( RBuf16& aBuf, + RReadStream& aStream ) + { + TInt length = aStream.ReadInt32L(); + GrowIfNeededL( aBuf, length ); + aStream.ReadL( aBuf, length ); + } + + +// ==================== XIMPRBuf8Helper MEMBER FUNCTIONS ==================== + +// ----------------------------------------------------------------------------- +// XIMPRBuf8Helper::GrowIfNeededL() +// ----------------------------------------------------------------------------- +// +EXPORT_C void XIMPRBuf8Helper::GrowIfNeededL( RBuf8& aBuf, const TInt aMaxLength ) + { + if ( aBuf.MaxLength() < aMaxLength ) + { + aBuf.ReAllocL( aMaxLength ); + } + } + + +// ----------------------------------------------------------------------------- +// XIMPRBuf8Helper::SetNewValueL() +// ----------------------------------------------------------------------------- +// +EXPORT_C void XIMPRBuf8Helper::SetNewValueL( RBuf8& aBuf, + const TDesC8& aValue ) + { + GrowIfNeededL( aBuf, aValue.Length() ); + aBuf.Copy( aValue ); + } + + +// ----------------------------------------------------------------------------- +// XIMPRBuf8Helper::ExternalizeL() +// ----------------------------------------------------------------------------- +// +EXPORT_C void XIMPRBuf8Helper::ExternalizeL( const RBuf8& aBuf, + RWriteStream& aStream ) + { + aStream.WriteInt32L( aBuf.Length() ); + aStream.WriteL( aBuf ); + } + + +// ----------------------------------------------------------------------------- +// XIMPRBuf8Helper::InternalizeL() +// ----------------------------------------------------------------------------- +// +EXPORT_C void XIMPRBuf8Helper::InternalizeL( RBuf8& aBuf, + RReadStream& aStream ) + { + TInt length = aStream.ReadInt32L(); + GrowIfNeededL( aBuf, length ); + aStream.ReadL( aBuf, length ); + } + + diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcutils/ximprequestidbuilder.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcutils/ximprequestidbuilder.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,100 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: TXIMPRequestId builder. + * +*/ + +#include +#include "ximprequestidbuilder.h" + + +/** + * Internal request ID layout. + * This structure size must match structly to TXIMPRequestId size. + */ +struct SXIMPRequestId + { + TUint32 iSpare; + TUint32 iProtocol; + TUint32 iSession; + TUint32 iRequest; + }; + +__ASSERT_COMPILE( sizeof( TXIMPRequestId ) == sizeof( SXIMPRequestId ) ); + + +// ----------------------------------------------------------------------------- +// TXIMPRequestIdBuilder::TXIMPRequestIdBuilder() +// ----------------------------------------------------------------------------- +// +EXPORT_C TXIMPRequestIdBuilder::TXIMPRequestIdBuilder() + : iSpare( 0 ), + iProtocol( 0 ), + iSession( 0 ), + iRequest( 0 ) + { + } + + +// ----------------------------------------------------------------------------- +// TXIMPRequestIdBuilder::SetProtocolId() +// ----------------------------------------------------------------------------- +// +EXPORT_C void TXIMPRequestIdBuilder::SetProtocolId( TUint32 aProtocol ) + { + iProtocol = aProtocol; + } + + +// ----------------------------------------------------------------------------- +// TXIMPRequestIdBuilder::SetSessionId() +// ----------------------------------------------------------------------------- +// +EXPORT_C void TXIMPRequestIdBuilder::SetSessionId( TUint32 aSession ) + { + iSession = aSession; + } + + +// ----------------------------------------------------------------------------- +// TXIMPRequestIdBuilder::SetRequestId() +// ----------------------------------------------------------------------------- +// +EXPORT_C void TXIMPRequestIdBuilder::SetRequestId( TUint32 aRequest ) + { + iRequest = aRequest; + } + + +// ----------------------------------------------------------------------------- +// TXIMPRequestIdBuilder::BuildRequestId() +// ----------------------------------------------------------------------------- +// +EXPORT_C TXIMPRequestId TXIMPRequestIdBuilder::BuildRequestId() const + { + SXIMPRequestId regIdStruct; + regIdStruct.iSpare = iSpare; + regIdStruct.iProtocol = iProtocol; + regIdStruct.iSession = iSession; + regIdStruct.iRequest = iRequest; + + TXIMPRequestId regId; + Mem::Copy( ®Id, ®IdStruct, sizeof( TXIMPRequestId ) ); + + return regId; + } + + + +// END OF FILE diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcutils/ximpsrv.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcutils/ximpsrv.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,53 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Server Message interface. + * +*/ + +#ifndef MXIMPSRV_H +#define MXIMPSRV_H + +#include + +/** + * Server interface for generic server message handling. + */ +class MXIMPSrv + { +public: + + /** + * Notifies server from instantiation of new session. + */ + virtual void SessionCreated() = 0; + + /** + * Notifies server from cleanup of existing session. + */ + virtual void SessionDied() = 0; + +protected: + + /** + * Protected destructor. + * Objects can't be deleted through this interface. + */ + virtual ~MXIMPSrv() {}; + + }; + + +#endif // MXIMPSRV_H + + diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcutils/ximpsrvmessage.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcutils/ximpsrvmessage.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,141 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Server Message interface. + * +*/ + +#ifndef XIMPSRVMESSAGE_H +#define XIMPSRVMESSAGE_H + +#include "ximppanics.h" +#include + + +/** + * Server Message interface. + */ +class MXIMPSrvMessage + { +public: + + /** + * Message argument indexes. + */ + enum TParamIndex + { + Ep0 = 0, + Ep1 = 1, + Ep2 = 2, + Ep3 = 3 + }; + +public: // Methods + + /** + * Public destructor. + * Objects can be deleted through this interface. + */ + virtual ~MXIMPSrvMessage() {}; + + + /** + * Completes the client request with given reason. + * + * @param aReason The completion code. + */ + virtual void Complete( TInt aReason ) = 0; + + + /** + * Tests whether this message is completed or not. + * + * @return ETrue if the message is completed. + * Else EFalse. + */ + virtual TBool IsCompleted() const = 0; + + + /** + * Returns an integer describing the function being called. + * + * @return The function being called over IPC + */ + virtual TInt Function() const = 0; + + + /** + * Gets message argument as an integer value. + * + * @param aIndex The index value identifying the argument. + * @return The message argument. + */ + virtual TInt Int( TParamIndex aIndex ) const = 0; + + + /** + * Gets the length of a descriptor argument in the client's process, + * leaving on failure. + * + * @param aIndex The index value identifying the argument. + * @return The length of the descriptor. + */ + virtual TInt GetDesLengthL( TParamIndex aIndex ) const = 0; + + + /** + * Reads data from the specified argument into the specified + * 8-bit target descriptor, and leaving on failure. + * + * @param aIndex The index value identifying the argument. + * @param aDes The target descriptor into which the client + * data is to be written. + */ + virtual void ReadL( TParamIndex aIndex, TDes8& aDes ) const = 0; + + + /** + * Writes data from the specified source descriptor to the + * 8-bit descriptor argument, and leaving on failure. + * + * @param aIndex The index value identifying the argument. + * @param aDes The source descriptor containing the data to be written. + */ + virtual void WriteL( TParamIndex aIndex, const TDesC8& aDes ) const = 0; + + + /** + * Panics the client. + * + * @param aReason The panic code. + */ + virtual void PanicClientAndLeaveL( NXIMPPanic::TReason aReason ) const = 0; + + + /** + * Moves message ownership from previous pointer to new given one. + * (NULLifies existing pointer) + * + * @param aNewSelfPtr New self pointer where to assign object ownership. + * Only one place at time can own the message object. + */ + virtual void PlaceOwnershipHere( MXIMPSrvMessage*& aNewSelfPtr ) = 0; + }; + + +#endif // XIMPSRVMESSAGE_H + + + + + diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcutils/ximpsrvmessageimp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcutils/ximpsrvmessageimp.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,214 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Concrete server message wrapper implementation. + * +*/ + + +// INCLUDE FILES +#include "ximpsrvmessageimp.h" +#include + +// ----------------------------------------------------------------------------- +// CXIMPSrvMessageImp::NewOrNull() +// ----------------------------------------------------------------------------- +// +CXIMPSrvMessageImp* CXIMPSrvMessageImp::NewOrNull( + const RMessage2& aMessage, + MXIMPSrvMessage*& aSelfPtr, + CXIMPSrvMessageImp*& aSourcePtr ) + { + __ASSERT_ALWAYS( !aSelfPtr, + User::Panic( NXIMPPrivPanic::KCategory, + NXIMPPrivPanic::EMessageSelfPtrAlreadyOccupied ) ); + if( !aSourcePtr ) + { + aSourcePtr = new CXIMPSrvMessageImp( aMessage, aSelfPtr ); // CSI: 62 # + // Special non-leaving function + } + else + { + aSourcePtr->Init( aMessage, aSelfPtr ); + } + return aSourcePtr; + } + + +// ----------------------------------------------------------------------------- +// CXIMPSrvMessageImp::~CXIMPSrvMessageImp() +// ----------------------------------------------------------------------------- +// +CXIMPSrvMessageImp::~CXIMPSrvMessageImp() + { + //If assert below is triggered, it means + //that owned message is not completed before + //deleting the wrapper + __ASSERT_ALWAYS( iMessage.IsNull(), + User::Panic( NXIMPPrivPanic::KCategory, + NXIMPPrivPanic::EMessageStillPendingOnDestruction ) ); + + if( iSelfPtr ) + { + iSelfPtr = NULL; + } + } + + +// ----------------------------------------------------------------------------- +// CXIMPSrvMessageImp::CXIMPSrvMessageImp() +// ----------------------------------------------------------------------------- +// +CXIMPSrvMessageImp::CXIMPSrvMessageImp( const RMessage2& aMessage, + MXIMPSrvMessage*& aSelfPtr ) + : iMessage( aMessage ), + iSelfPtr( &aSelfPtr ) + { + } + +// ----------------------------------------------------------------------------- +// CXIMPSrvMessageImp::Init() +// ----------------------------------------------------------------------------- +// +void CXIMPSrvMessageImp::Init( const RMessage2& aMessage, + MXIMPSrvMessage*& aSelfPtr ) + { + iMessage = aMessage; + iSelfPtr = &aSelfPtr; + } + +// ----------------------------------------------------------------------------- +// CXIMPSrvMessageImp::Complete() +// ----------------------------------------------------------------------------- +void CXIMPSrvMessageImp::Complete( TInt aReason ) + { + if( !iMessage.IsNull() ) + { + iMessage.Complete( aReason ); + } + } + + +// ----------------------------------------------------------------------------- +// CXIMPSrvMessageImp::IsCompleted() +// ----------------------------------------------------------------------------- +TBool CXIMPSrvMessageImp::IsCompleted() const + { + return iMessage.IsNull(); + } + + +// ----------------------------------------------------------------------------- +// CXIMPSrvMessageImp::Function() +// ----------------------------------------------------------------------------- +TInt CXIMPSrvMessageImp::Function() const + { + return iMessage.Function(); + } + + +// ----------------------------------------------------------------------------- +// CXIMPSrvMessageImp::Int() +// ----------------------------------------------------------------------------- +TInt CXIMPSrvMessageImp::Int( TParamIndex aIndex ) const + { + TInt value = 0; + switch( aIndex ) + { + case Ep0: + { + value = iMessage.Int0(); + break; + } + + case Ep1: + { + value = iMessage.Int1(); + break; + } + + case Ep2: + { + value = iMessage.Int2(); + break; + } + + case Ep3: + { + value = iMessage.Int3(); + break; + } + } + + return value; + } + + +// ----------------------------------------------------------------------------- +// CXIMPSrvMessageImp::GetDesLengthL() +// ----------------------------------------------------------------------------- +TInt CXIMPSrvMessageImp::GetDesLengthL( TParamIndex aIndex ) const + { + return iMessage.GetDesLengthL( aIndex ); + } + + +// ----------------------------------------------------------------------------- +// CXIMPSrvMessageImp::ReadL() +// ----------------------------------------------------------------------------- +void CXIMPSrvMessageImp::ReadL( TParamIndex aIndex, TDes8& aDes ) const + { + return iMessage.ReadL( aIndex, aDes ); + } + + +// ----------------------------------------------------------------------------- +// CXIMPSrvMessageImp::WriteL() +// ----------------------------------------------------------------------------- +void CXIMPSrvMessageImp::WriteL( TParamIndex aIndex, const TDesC8& aDes ) const + { + return iMessage.WriteL( aIndex, aDes ); + } + + +// ----------------------------------------------------------------------------- +// CXIMPSrvMessageImp::PanicClientAndLeaveL() +// ----------------------------------------------------------------------------- +void CXIMPSrvMessageImp::PanicClientAndLeaveL( NXIMPPanic::TReason aReason ) const + { + iMessage.Panic( NXIMPPanic::KCategory, aReason ); + User::Leave( KErrCompletion ); + } + + +// ----------------------------------------------------------------------------- +// CXIMPSrvMessageImp::PlaceOwnershipHere() +// ----------------------------------------------------------------------------- +void CXIMPSrvMessageImp::PlaceOwnershipHere( MXIMPSrvMessage*& aNewSelfPtr ) + { + __ASSERT_ALWAYS( !aNewSelfPtr, + User::Panic( NXIMPPrivPanic::KCategory, + NXIMPPrivPanic::EMessageSelfPtrAlreadyOccupied ) ); + + //remove ownership from old pointer + (*iSelfPtr) = NULL; + + //Cache new owning pointer + iSelfPtr = &aNewSelfPtr; + + //And setup new owning pointer to point self + aNewSelfPtr = this; + } + + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcutils/ximpsrvmessageimp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcutils/ximpsrvmessageimp.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,88 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Concrete server message wrapper implementation. + * +*/ + +#ifndef CXIMPSRVMESSAGEIMP_H +#define CXIMPSRVMESSAGEIMP_H + +#include "ximpsrvmessage.h" +#include "ximppanics.h" +#include + +/** + * Server message wrapper implementation. + * + * @lib ximputils.dll + * @since S60 v3.2 + */ +NONSHARABLE_CLASS( CXIMPSrvMessageImp ) : public CBase, + public MXIMPSrvMessage + { +public: + + /** + * Special instantiation method.. + * + * Verifies that given self pointer ins't yet in use + * and allocates new instance. Returns NULL pointer if in OOM. + */ + static CXIMPSrvMessageImp* NewOrNull( const RMessage2& aMessage, + MXIMPSrvMessage*& aSelfPtr, + CXIMPSrvMessageImp*& aSourcePtr ); + ~CXIMPSrvMessageImp(); + + +private: + CXIMPSrvMessageImp( const RMessage2& aMessage, + MXIMPSrvMessage*& aSelfPtr ); + + void Init( const RMessage2& aMessage, + MXIMPSrvMessage*& aSelfPtr ); + + + +public: // Methods from MXIMPSrvMessage + + void Complete(TInt aReason); + TBool IsCompleted() const; + TInt Function() const; + TInt Int( TParamIndex aIndex ) const; + TInt GetDesLengthL( TParamIndex aIndex ) const; + void ReadL( TParamIndex aIndex, TDes8& aDes ) const; + void WriteL( TParamIndex aIndex, const TDesC8& aDes ) const; + void PanicClientAndLeaveL( NXIMPPanic::TReason aReason ) const; + void PlaceOwnershipHere( MXIMPSrvMessage*& aNewSelfPtr ); + +private: // Data + + + /** + * The message. + */ + RMessage2 iMessage; + + /** + * Pointer to self pointer. + */ + MXIMPSrvMessage** iSelfPtr; + + }; + + + +#endif // CXIMPSRVMESSAGEIMP_H + + diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcutils/ximpsrvsession.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcutils/ximpsrvsession.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,71 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Abstract server session interface + * +*/ + +#ifndef MXIMPSRVSESSION_H +#define MXIMPSRVSESSION_H + +#include + +class MXIMPSrvMessage; + + +/** + * Abstract server session interface + */ +class MXIMPSrvSession + { +public: + + /** + * Public destructor. + * Objects can be deleted through this interface. + */ + virtual ~MXIMPSrvSession() { }; + + + /** + * Message handling method. + * Session adapters call this to mediate message handling + * to concrete session objects. + * + * Rules for message handling: + * + * - If message is handled synchronously, handler must complete + * the message when finished with it. Handler may not cause leave + * exeptions after completing. + * + * - If message handling fails, it should be handled with a leave. + * In this case Session::ServiceError() methods take care + * of completing the message with leave code. + * + * - If handler wishes to complete the message asynchronously, + * it must take message ownership to itself by using + * MXIMPSrvMessage::PlaceOwnershipHere(). In this case handler + * is responsible both to completing and deleting the message object. + * After taking message ownership, message handler isn't anymore + * allowed to cause leave exeptions during the same message + * handling path. + * + * @param aMessage The message to handle. + */ + virtual void TryHandleMessageL( MXIMPSrvMessage& aMessage ) = 0; + }; + + +#endif // MXIMPSRVSESSION_H + + diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcutils/ximpsrvsessionadapter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcutils/ximpsrvsessionadapter.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,179 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Server session adapter base class. + * +*/ + + +// INCLUDE FILES +#include "ximpsrvsessionadapter.h" +#include "ximpsrv.h" +#include "ximpsrvsession.h" +#include "ximpsrvmessageimp.h" +#include "ximppanics.h" +#include "ximptrace.h" +#include + + +// ----------------------------------------------------------------------------- +// CXIMPSrvSessionAdapter::CXIMPSrvSessionAdapter() +// ----------------------------------------------------------------------------- +// +EXPORT_C CXIMPSrvSessionAdapter::CXIMPSrvSessionAdapter( MXIMPSrv& aServer ) + : iServer( aServer ) + { + iServer.SessionCreated(); + TRACE_1( _L("CXIMPSrvSessionAdapter[%d]::CXIMPSrvSessionAdapter()"), + this ); + } + + +// ----------------------------------------------------------------------------- +// CXIMPSrvSessionAdapter::~CXIMPSrvSessionAdapter() +// ----------------------------------------------------------------------------- +// +EXPORT_C CXIMPSrvSessionAdapter::~CXIMPSrvSessionAdapter() + { + delete iMessage; + + iServer.SessionDied(); + delete iSessionImp; + + TRACE_1( _L("CXIMPSrvSessionAdapter[%d]::~CXIMPSrvSessionAdapter()"), + this ); + #if _BullseyeCoverage + cov_write(); + #endif + } + + +// ----------------------------------------------------------------------------- +// CXIMPSrvSessionAdapter::ServiceL() +// ----------------------------------------------------------------------------- +// +EXPORT_C void CXIMPSrvSessionAdapter::ServiceL( const RMessage2& aMessage ) + { + __ASSERT_ALWAYS( !iCurrentMsg, + User::Panic( NXIMPPrivPanic::KCategory, + NXIMPPrivPanic::ECurrentMsgAlreadyExists ) ); + + //Non leaving allocation must be used here to prevent OOM leave + //to ServiceError() method, without a valid iCurrentMsg + //==> CurrentMsg absence triggers an assert in ServiceError() + iCurrentMsg = CXIMPSrvMessageImp::NewOrNull( aMessage, + ( MXIMPSrvMessage*& )iCurrentMsg, + iMessage ); + iMessage = NULL; + + //Handle the message + MXIMPSrvSession* sessionImp = DoInstantiateSessionL( *iCurrentMsg ); + + if( sessionImp ) + { + CleanupDeletePushL( sessionImp ); + + __ASSERT_ALWAYS( !iSessionImp, + iCurrentMsg->PanicClientAndLeaveL( + NXIMPPanic::EOnSrvSessionImpAlreadyExists ) ); + + iSessionImp = sessionImp; + CleanupStack::Pop(); //sessionImp; + iCurrentMsg->Complete( KErrNone ); + } + + else + { + __ASSERT_ALWAYS( iSessionImp, + iCurrentMsg->PanicClientAndLeaveL( + NXIMPPanic::EOnSrvSessionImpNotFound ) ); + + + iSessionImp->TryHandleMessageL( *iCurrentMsg ); + + + //If current message is still not-completed, inform client + //that it tried to do something unknown + __ASSERT_ALWAYS( !IsCurrentMessageValid(), + iCurrentMsg->PanicClientAndLeaveL( + NXIMPPanic::EOnSrvRequestNotUnderstood) ); + } + + iMessage = iCurrentMsg; + iCurrentMsg = NULL; + } + +// ----------------------------------------------------------------------------- +// CXIMPSrvSessionAdapter::ServiceError() +// ----------------------------------------------------------------------------- +// +EXPORT_C void CXIMPSrvSessionAdapter::ServiceError( const RMessage2& /*aMessage*/, + TInt aError ) + { + //If assert below is triggered, it means that current message ownersip + //is taken somewhere (to be completed asynchronously), but there has + //happened a leave after ownership transfer + + //The place taking message ownership has to be fixed in this case + //not to cause exeptions after ownership transfer + __ASSERT_ALWAYS( iCurrentMsg, + User::Panic( NXIMPPrivPanic::KCategory, + NXIMPPrivPanic::ECurrentMsgNotFoundInServiceError ) ); + + + //If assert below is triggered, it means that current message is already + //completed, but there has happened a leave after completion + + //The place completing message has to be fixed in this case + //not to cause exeptions after message completion + __ASSERT_ALWAYS( !iCurrentMsg->IsCompleted(), + User::Panic( NXIMPPrivPanic::KCategory, + NXIMPPrivPanic::ECurrentMsgNotValidInServiceError ) ); + + + TRACE_3( _L("CXIMPSrvSessionAdapter[%d]::ServiceError() in op[%d], code[%d]"), + this, iCurrentMsg->Function(), aError ); + + + iCurrentMsg->Complete( aError ); + delete iCurrentMsg; + iCurrentMsg = NULL; + } + + +// ----------------------------------------------------------------------------- +// CXIMPSrvSessionAdapter::Server() +// ----------------------------------------------------------------------------- +// +EXPORT_C MXIMPSrv& CXIMPSrvSessionAdapter::Server() + { + return iServer; + } + +// ----------------------------------------------------------------------------- +// CXIMPSrvSessionAdapter::IsCurrentMessageValid() +// ----------------------------------------------------------------------------- +// +TBool CXIMPSrvSessionAdapter::IsCurrentMessageValid() + { + if( iCurrentMsg && !iCurrentMsg->IsCompleted() ) + { + return ETrue; + } + + return EFalse; + } + + + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcutils/ximpsrvsessionadapter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcutils/ximpsrvsessionadapter.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,103 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Server session adapter base class. + * +*/ + + +#ifndef XIMPSRVSESSIONADAPTER_H +#define XIMPSRVSESSIONADAPTER_H + +#include + +class MXIMPSrv; +class MXIMPSrvSession; +class MXIMPSrvMessage; +class CXIMPSrvMessageImp; + + +/** + * Server session adapter base class. + * + * @lib ximputils.dll + * @since S60 v3.2 + */ +class CXIMPSrvSessionAdapter : public CSession2 + { +public: // Constructor and destructor + + IMPORT_C CXIMPSrvSessionAdapter( MXIMPSrv& aServer ); + IMPORT_C ~CXIMPSrvSessionAdapter(); + + +public: // Methods derived from CSession2 + + IMPORT_C void ServiceL( const RMessage2& aMessage ); + IMPORT_C void ServiceError( const RMessage2& aMessage, + TInt aError ); + + +public: // New template methods + + /** + * Session instantiation template method for + * derived implementations. + * + * @param aMessage The session instantiation message. + * + * @return Session implementation object or NULL if the message + * isn't valid session instantiation request. + */ + virtual MXIMPSrvSession* DoInstantiateSessionL( const MXIMPSrvMessage& aMessage ) = 0; + +protected: + + /** + * Access to server for derived implementations. + * @return Access to server object. + */ + IMPORT_C MXIMPSrv& Server(); + +private: // Helpers + + TBool IsCurrentMessageValid(); + +private: // Data + + /** + * Owning server. + * Referenced. + */ + MXIMPSrv& iServer; + + /** + * Real session implementation. + * Owned. + */ + MXIMPSrvSession* iSessionImp; + + /** + * Currently handled message. + * Does not own. + */ + CXIMPSrvMessageImp* iCurrentMsg; + + /** + * Owned. + */ + CXIMPSrvMessageImp* iMessage; + }; + +#endif // XIMPSERVERSESSIONADAPTER_H + diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcutils/ximptrace.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcutils/ximptrace.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,123 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework trace implementation +* +*/ + +// INCLUDE FILES +#include "ximptrace.h" + +#include +#include +#include + + +/** + * Handler used by trace implementation to truncate + * the string rather than panic in case of buffer overflow. + * + * @since 3.0 + */ +NONSHARABLE_CLASS( TXIMPOverflowTruncate ) : public TDes16Overflow + { + public: + void Overflow( TDes16& /*aDes*/ ) {} + }; + + + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// XIMPTrace::Trace() +// ----------------------------------------------------------------------------- +// +EXPORT_C void XIMPTrace::Trace( TRefByValue aFmt,... ) + { + TBuf< 250 > buffer; + buffer.Append( _L("[") ); + buffer.Append( RThread().Name() ); + buffer.Append( _L("] ") ); + + TXIMPOverflowTruncate overflowHandler; + + VA_LIST list; + VA_START( list, aFmt ); + buffer.AppendFormatList( aFmt, list, &overflowHandler ); + + +// #ifdef __WINS__ + RDebug::Print( _L("%S"), &buffer ); +// #endif // __WINS__ Pia +// Pia #else + + RFileLogger logger; + if( logger.Connect() == KErrNone ) + { + logger.SetDateAndTime( EFalse, ETrue ); + logger.CreateLog( KXIMPTraceLogDir, + KXIMPTraceLogFile, + EFileLoggingModeAppend ); + + logger.Write( buffer ); + logger.CloseLog(); + logger.Close(); + } + +// Pia #endif // __WINS__ + } + + + + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// TXIMPBlockTraceHandler::TXIMPBlockTraceHandler() +// ----------------------------------------------------------------------------- +// +EXPORT_C TXIMPBlockTraceHandler::TXIMPBlockTraceHandler( const TText* aBlockName ) + : iBlockName( aBlockName ), + iBlockNormalExit( EFalse ) + { + TRACE_1( _L("%S - enter"), &iBlockName ); + } + + +// ----------------------------------------------------------------------------- +// TXIMPBlockTraceHandler::~TXIMPBlockTraceHandler() +// ----------------------------------------------------------------------------- +// +EXPORT_C TXIMPBlockTraceHandler::~TXIMPBlockTraceHandler() // CSI: 82 # + { + if( !iBlockNormalExit ) + { + //Normal exit not recorded so far + //Thus report here nonlocal exit + TRACE_1( _L("%S - nonlocal exit"), &iBlockName ); + } + } + + +// ----------------------------------------------------------------------------- +// TXIMPBlockTraceHandler::NormalExit() +// ----------------------------------------------------------------------------- +// +EXPORT_C void TXIMPBlockTraceHandler::NormalExit() + { + TRACE_1( _L("%S - exit"), &iBlockName ); + iBlockNormalExit = ETrue; + } + + diff -r 000000000000 -r e6b17d312c8b ximpfw/core/srcutils/ximptrace.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/core/srcutils/ximptrace.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,155 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework trace utilities +* +*/ + +#ifndef XIMPTRACE_H__ +#define XIMPTRACE_H__ + +#include + + +// CONSTANTS +_LIT( KXIMPTraceLogDir, "ximp" ); +_LIT( KXIMPTraceLogFile, "ximp.log" ); + + + //TRACE INDIRECTION +#ifdef _DEBUG + + /** + * Trace handlers. Different statements with + * different names for handling different parameter amounts. + * + * Link against ximpdatamodel.dll to use trace + * services. + * + * Statements produce traces only in debug builds. + * In hardware debug builds traces go to file defined + * KXIMPTraceLogDir and KXIMPTraceLogFile. + */ + #define TRACE( aStatement ) XIMPTrace::Trace( aStatement ) + #define TRACE_1( aStatement, aP1 ) XIMPTrace::Trace( aStatement, aP1 ) + #define TRACE_2( aStatement, aP1, aP2 ) XIMPTrace::Trace( aStatement, aP1, aP2 ) + #define TRACE_3( aStatement, aP1, aP2, aP3 ) XIMPTrace::Trace( aStatement, aP1, aP2, aP3 ) + #define TRACE_4( aStatement, aP1, aP2, aP3, aP4 ) XIMPTrace::Trace( aStatement, aP1, aP2, aP3, aP4 ) + #define TRACE_5( aStatement, aP1, aP2, aP3, aP4, aP5 ) XIMPTrace::Trace( aStatement, aP1, aP2, aP3, aP4, aP5 ) + #define TRACE_6( aStatement, aP1, aP2, aP3, aP4, aP5, aP6 ) XIMPTrace::Trace( aStatement, aP1, aP2, aP3, aP4, aP5, aP6 ) + + + /** + * Block (and thus also function) trace handlers. These + * mark block enter, exit and also non local exit to traces. + * + * Example: + * void CSomeClass::SomeMethod() + * { + * TRACE_BLOCK_ENTER( "CSomeClass::SomeMethod" ); + * + * Do your stuff here. If there happens a leave + * or return before "TRACE_BLOCK_EXIT()" statement, + * it is marked to traces with "CSomeClass::SomeMethod - nonlocal exit" + * + * TRACE_BLOCK_EXIT(); + * } + */ + #define TRACE_BLOCK_ENTER( aBlockName ) TXIMPBlockTraceHandler __blockTraceHandler( _S( aBlockName ) ); + #define TRACE_BLOCK_EXIT() __blockTraceHandler.NormalExit(); + + + +#else //NOT _DEBUG + + #define TRACE( aStatement ) + #define TRACE_1( aStatement, aP1 ) + #define TRACE_2( aStatement, aP1, aP2 ) + #define TRACE_3( aStatement, aP1, aP2, aP3 ) + #define TRACE_4( aStatement, aP1, aP2, aP3, aP4 ) + #define TRACE_5( aStatement, aP1, aP2, aP3, aP4, aP5 ) + #define TRACE_6( aStatement, aP1, aP2, aP3, aP4, aP5, aP6 ) + #define TRACE_BLOCK_ENTER( aBlockName ) + #define TRACE_BLOCK_EXIT() + +#endif + + + +/** + * XIMP Framework trace sink. + * + * @lib ximpdatamodel.dll + * @since S60 v3.2 + */ +class XIMPTrace + { +public: + + /** + * Trace sink. + * + * @param aFmt A format list to print to trace. + */ + IMPORT_C static void Trace( TRefByValue aFmt,... ); + + + +private: //Prohibited construtor / destructor + XIMPTrace(); + ~XIMPTrace(); + }; + + + +/** + * XIMP Framework block trace handler. + * + * @lib ximpdatamodel.dll + * @since S60 v3.2 + */ +NONSHARABLE_CLASS( TXIMPBlockTraceHandler ) + { +public: + + /** + * Block trace handler constructor. + * + * @param aBlockName Block name. + */ + TXIMPBlockTraceHandler( const TText* aBlockName ); + + + /** + * Block trace handler destructor. + */ + ~TXIMPBlockTraceHandler(); + + + /** + * Marks that block has reached its normal exit. + */ + void NormalExit(); + + +private: + //Block name + const TPtrC iBlockName; + + //Normal exit marker + TBool iBlockNormalExit; +}; + + +#endif // XIMPTRACE_H__ + diff -r 000000000000 -r e6b17d312c8b ximpfw/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/group/bld.inf Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,50 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Build information file for project Presence Framework +* +*/ + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS +../rom/ximpfw.iby CORE_MW_LAYER_IBY_EXPORT_PATH(ximpfw.iby) + +PRJ_MMPFILES +../core/group/ximputils.mmp +../core/group/ximpdatamodel.mmp +../presence/group/presencedatamodel.mmp +../presence/group/presencedatamodelhook.mmp +../core/group/ximpprocessor.mmp +../presence/group/presenceoperation.mmp // ximpoperation depends on this +../core/group/ximpoperations.mmp +../core/group/ximprootserver.mmp +../core/group/ximpserver.mmp +../core/group/ximpsrvclient.mmp +../core/group/ximpmanager.mmp +../core/group/ximpecomhook.mmp +../presence/group/presencemanager.mmp +../presence/group/presenceecomhook.mmp +../presence/group/presencecacheserver.mmp +../presence/group/presencecacheclient.mmp +../presence/group/presencecacheecomhook.mmp + + +PRJ_TESTMMPFILES + + +PRJ_TESTEXPORTS + diff -r 000000000000 -r e6b17d312c8b ximpfw/group/ximpdlluids.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/group/ximpdlluids.hrh Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,65 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Presence Framework DLL uids +* +*/ + +#ifndef XIMPDLLUIDS_HRH +#define XIMPDLLUIDS_HRH + + +// ----------------------------------------------------------------------------- +// System wide UID 2:s for different dll types. +// ----------------------------------------------------------------------------- +// +#define XIMP_DLL_UID_STATIC_INTERFACE 0x1000008d +#define XIMP_DLL_UID_ECOM_PLUGIN 0x10009D8D + + +// ----------------------------------------------------------------------------- +// Common UID 3 for the XIMP Framework dlls. +// ----------------------------------------------------------------------------- +// +#define XIMP_DLL_UID_COMMON 0x10282DD8 + + +// ----------------------------------------------------------------------------- +// UID 3 for the XIMP Framework server exes. +// ----------------------------------------------------------------------------- +// +#define XIMP_EXE_UID_ROOT_SERVER 0x10282DD9 +#define XIMP_EXE_UID_PROTOCOL_CONNECTION_SERVER 0x10282DDA + + +// ----------------------------------------------------------------------------- +// ECOM implementation UID for MXIMPClient interfaces. +// ----------------------------------------------------------------------------- +// +#define XIMP_ECOM_IMPLEMENTATION_UID_CLIENT_INTERFACE 0x10282DDB +#define XIMP_ECOM_IMPLEMENTATION_UID_PRESENCE_INTERFACE 0x2000B186 +#define XIMP_ECOM_IMPLEMENTATION_UID_IM_INTERFACE 0x2000B5EA + +// ----------------------------------------------------------------------------- +// Other dll uids +// ----------------------------------------------------------------------------- +// +#define XIMP_DLL_UID_PRESENCE_HOOK 0x2000B1AE +#define XIMP_DLL_UID_PRESENCE_MANAGER 0x2000B1AF +#define XIMP_DLL_UID_IM_HOOK 0x2000B5EB +#define XIMP_DLL_UID_IM_MANAGER 0x2000B5EC + + +#endif // XIMPDLLUIDS_HRH + + diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/bwins/presencecacheclientu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/bwins/presencecacheclientu.def Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,5 @@ +EXPORTS + ?CreateReaderL@CPresenceCacheClient@@SAPAVMPresenceCacheReader@@XZ @ 1 NONAME ; class MPresenceCacheReader * CPresenceCacheClient::CreateReaderL(void) + ?CreateWriterL@CPresenceCacheClient@@SAPAVMPresenceCacheWriter@@XZ @ 2 NONAME ; class MPresenceCacheWriter * CPresenceCacheClient::CreateWriterL(void) + ?NewL@CPresenceCacheClient@@SAPAV1@XZ @ 3 NONAME ; class CPresenceCacheClient * CPresenceCacheClient::NewL(void) + diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/bwins/presencecacheecomhooku.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/bwins/presencecacheecomhooku.def Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + ?ImplementationGroupProxy@@YAPBUTImplementationProxy@@AAH@Z @ 1 NONAME ; struct TImplementationProxy const * ImplementationGroupProxy(int &) + diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/bwins/presencedatamodelhooku.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/bwins/presencedatamodelhooku.def Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + ?ImplementationGroupProxy@@YAPBUTImplementationProxy@@AAH@Z @ 1 NONAME ; struct TImplementationProxy const * ImplementationGroupProxy(int &) + diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/bwins/presencedatamodelu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/bwins/presencedatamodelu.def Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,214 @@ +EXPORTS + ??8CPresenceInfoFilterImp@@QAEHAAV0@@Z @ 1 NONAME ; int CPresenceInfoFilterImp::operator==(class CPresenceInfoFilterImp &) + ??9CPresenceInfoFilterImp@@QAEHAAV0@@Z @ 2 NONAME ; int CPresenceInfoFilterImp::operator!=(class CPresenceInfoFilterImp &) + ?AddConfiguratorL@CGroupMembersPresenceConfigurationItem@@QAEXPAVMXIMPPscContext@@@Z @ 3 NONAME ; void CGroupMembersPresenceConfigurationItem::AddConfiguratorL(class MXIMPPscContext *) + ?AddOrRenewSubscriberL@CGroupContentSubscriptionItem@@QAEXPAVMXIMPPscContext@@@Z @ 4 NONAME ; void CGroupContentSubscriptionItem::AddOrRenewSubscriberL(class MXIMPPscContext *) + ?AddSubscriberL@CPresentityGroupMembersPresenceSubscriptionItem@@QAEXPAVMXIMPPscContext@@@Z @ 5 NONAME ; void CPresentityGroupMembersPresenceSubscriptionItem::AddSubscriberL(class MXIMPPscContext *) + ?AssociateL@CPresenceFilterStore@@QAEXABVCXIMPIdentityImp@@PAVCPresenceInfoFilterImp@@@Z @ 6 NONAME ; void CPresenceFilterStore::AssociateL(class CXIMPIdentityImp const &, class CPresenceInfoFilterImp *) + ?BlindAddL@CPresenceBuddyInfoListImp@@QAEHPAVMPresenceBuddyInfo@@@Z @ 7 NONAME ; int CPresenceBuddyInfoListImp::BlindAddL(class MPresenceBuddyInfo *) + ?BlockListSubscriptionItemLC@CPresenceDataCache@@QAEAAVCBlockListSubscriptionItem@@XZ @ 8 NONAME ; class CBlockListSubscriptionItem & CPresenceDataCache::BlockListSubscriptionItemLC(void) + ?Clean@CBlockListSubscriptionItem@@QAEXXZ @ 9 NONAME ; void CBlockListSubscriptionItem::Clean(void) + ?Clean@CGrantRequestListSubscriptionItem@@QAEXXZ @ 10 NONAME ; void CGrantRequestListSubscriptionItem::Clean(void) + ?Clean@CGroupContentSubscriptionItem@@QAEXXZ @ 11 NONAME ; void CGroupContentSubscriptionItem::Clean(void) + ?Clean@CGroupListSubscriptionItem@@QAEXXZ @ 12 NONAME ; void CGroupListSubscriptionItem::Clean(void) + ?Clean@CWatcherListSubscriptionItem@@QAEXXZ @ 13 NONAME ; void CWatcherListSubscriptionItem::Clean(void) + ?CleanExpired@CPresenceDataCache@@QAEXXZ @ 14 NONAME ; void CPresenceDataCache::CleanExpired(void) + ?CleanResources@CPresenceDataCache@@QAEXAAVMXIMPPscContext@@@Z @ 15 NONAME ; void CPresenceDataCache::CleanResources(class MXIMPPscContext &) + ?CollectConfigurationPifWithoutCtxL@CGroupMembersPresenceConfigurationItem@@QAEPAVCPresenceInfoFilterImp@@PAVMXIMPPscContext@@@Z @ 16 NONAME ; class CPresenceInfoFilterImp * CGroupMembersPresenceConfigurationItem::CollectConfigurationPifWithoutCtxL(class MXIMPPscContext *) + ?CollectConfigurationPifWithoutCtxL@CPresenceConfigurationItem@@QAEPAVCPresenceInfoFilterImp@@PAVMXIMPPscContext@@@Z @ 17 NONAME ; class CPresenceInfoFilterImp * CPresenceConfigurationItem::CollectConfigurationPifWithoutCtxL(class MXIMPPscContext *) + ?CollectConfigurationPifWithoutCtxL@CPresenceToEveryoneConfigurationItem@@QAEPAVCPresenceInfoFilterImp@@PAVMXIMPPscContext@@@Z @ 18 NONAME ; class CPresenceInfoFilterImp * CPresenceToEveryoneConfigurationItem::CollectConfigurationPifWithoutCtxL(class MXIMPPscContext *) + ?CollectFilteredPresenceInfoLC@DocumentUtils@@SAPAVCPresenceInfoImp@@ABVCPresenceInfoFilterImp@@ABV2@@Z @ 19 NONAME ; class CPresenceInfoImp * DocumentUtils::CollectFilteredPresenceInfoLC(class CPresenceInfoFilterImp const &, class CPresenceInfoImp const &) + ?CollectSubscriptionPifWithoutCtxL@COwnPresenceSubscriptionItem@@QAEPAVCPresenceInfoFilterImp@@PAVMXIMPPscContext@@@Z @ 20 NONAME ; class CPresenceInfoFilterImp * COwnPresenceSubscriptionItem::CollectSubscriptionPifWithoutCtxL(class MXIMPPscContext *) + ?CollectSubscriptionPifWithoutCtxL@CPresentityGroupMembersPresenceSubscriptionItem@@QAEPAVCPresenceInfoFilterImp@@PAVMXIMPPscContext@@@Z @ 21 NONAME ; class CPresenceInfoFilterImp * CPresentityGroupMembersPresenceSubscriptionItem::CollectSubscriptionPifWithoutCtxL(class MXIMPPscContext *) + ?CollectSubscriptionPifWithoutCtxL@CPresentityPresenceSubscriptionItem@@QAEPAVCPresenceInfoFilterImp@@PAVMXIMPPscContext@@@Z @ 22 NONAME ; class CPresenceInfoFilterImp * CPresentityPresenceSubscriptionItem::CollectSubscriptionPifWithoutCtxL(class MXIMPPscContext *) + ?ConfigurationPif@CGroupMembersPresenceConfigurationItem@@QAEAAVCPresenceInfoFilterImp@@XZ @ 23 NONAME ; class CPresenceInfoFilterImp & CGroupMembersPresenceConfigurationItem::ConfigurationPif(void) + ?ConfigurationPif@CPresenceConfigurationItem@@QAEAAVCPresenceInfoFilterImp@@XZ @ 24 NONAME ; class CPresenceInfoFilterImp & CPresenceConfigurationItem::ConfigurationPif(void) + ?ConfigurationPif@CPresenceToEveryoneConfigurationItem@@QAEAAVCPresenceInfoFilterImp@@XZ @ 25 NONAME ; class CPresenceInfoFilterImp & CPresenceToEveryoneConfigurationItem::ConfigurationPif(void) + ?Contains@CPresenceInfoFilterImp@@QAEHAAV1@@Z @ 26 NONAME ; int CPresenceInfoFilterImp::Contains(class CPresenceInfoFilterImp &) + ?Disassociate@CPresenceFilterStore@@QAEXABVCXIMPIdentityImp@@@Z @ 27 NONAME ; void CPresenceFilterStore::Disassociate(class CXIMPIdentityImp const &) + ?EqualsIdentity@CPresenceBuddyInfoImp@@UBEHPBVMPresenceBuddyInfo@@@Z @ 28 NONAME ; int CPresenceBuddyInfoImp::EqualsIdentity(class MPresenceBuddyInfo const *) const + ?ExternalizeL@CPresenceBlockInfoImp@@UBEXAAVRWriteStream@@@Z @ 29 NONAME ; void CPresenceBlockInfoImp::ExternalizeL(class RWriteStream &) const + ?ExternalizeL@CPresenceBuddyInfoImp@@UBEXAAVRWriteStream@@@Z @ 30 NONAME ; void CPresenceBuddyInfoImp::ExternalizeL(class RWriteStream &) const + ?ExternalizeL@CPresenceBuddyInfoListImp@@UBEXAAVRWriteStream@@@Z @ 31 NONAME ; void CPresenceBuddyInfoListImp::ExternalizeL(class RWriteStream &) const + ?ExternalizeL@CPresenceInfoFilterImp@@UBEXAAVRWriteStream@@@Z @ 32 NONAME ; void CPresenceInfoFilterImp::ExternalizeL(class RWriteStream &) const + ?ExternalizeL@CPresenceInfoImp@@UBEXAAVRWriteStream@@@Z @ 33 NONAME ; void CPresenceInfoImp::ExternalizeL(class RWriteStream &) const + ?FilterForIdentity@CPresenceFilterStore@@QAEPAVCPresenceInfoFilterImp@@ABVCXIMPIdentityImp@@@Z @ 34 NONAME ; class CPresenceInfoFilterImp * CPresenceFilterStore::FilterForIdentity(class CXIMPIdentityImp const &) + ?FilteredInfoLC@CPresenceInfoImp@@QBEPAV1@ABVCPresenceInfoFilterImp@@@Z @ 35 NONAME ; class CPresenceInfoImp * CPresenceInfoImp::FilteredInfoLC(class CPresenceInfoFilterImp const &) const + ?GrantRequestListSubscriptionItemLC@CPresenceDataCache@@QAEAAVCGrantRequestListSubscriptionItem@@XZ @ 36 NONAME ; class CGrantRequestListSubscriptionItem & CPresenceDataCache::GrantRequestListSubscriptionItemLC(void) + ?GroupContentSubscriptionItemExists@CPresenceDataCache@@QAEHABVCXIMPIdentityImp@@@Z @ 37 NONAME ; int CPresenceDataCache::GroupContentSubscriptionItemExists(class CXIMPIdentityImp const &) + ?GroupContentSubscriptionItemLC@CPresenceDataCache@@QAEAAVCGroupContentSubscriptionItem@@ABVCXIMPIdentityImp@@@Z @ 38 NONAME ; class CGroupContentSubscriptionItem & CPresenceDataCache::GroupContentSubscriptionItemLC(class CXIMPIdentityImp const &) + ?GroupId@CGroupContentSubscriptionItem@@QBEABVCXIMPIdentityImp@@XZ @ 39 NONAME ; class CXIMPIdentityImp const & CGroupContentSubscriptionItem::GroupId(void) const + ?GroupIdLinearOrder@CPresentityGroupInfoImp@@SAHABV1@0@Z @ 40 NONAME ; int CPresentityGroupInfoImp::GroupIdLinearOrder(class CPresentityGroupInfoImp const &, class CPresentityGroupInfoImp const &) + ?GroupIdLinearOrder@CPresentityGroupMemberInfoImp@@SAHABV1@0@Z @ 41 NONAME ; int CPresentityGroupMemberInfoImp::GroupIdLinearOrder(class CPresentityGroupMemberInfoImp const &, class CPresentityGroupMemberInfoImp const &) + ?GroupIdentity@CPresentityPresenceSubscriptionItem@@QBEPBVMXIMPIdentity@@XZ @ 42 NONAME ; class MXIMPIdentity const * CPresentityPresenceSubscriptionItem::GroupIdentity(void) const + ?GroupListSubscriptionItemLC@CPresenceDataCache@@QAEAAVCGroupListSubscriptionItem@@XZ @ 43 NONAME ; class CGroupListSubscriptionItem & CPresenceDataCache::GroupListSubscriptionItemLC(void) + ?GroupMemberExistsL@CGroupContentSubscriptionItem@@QBEHAAVCPresentityGroupMemberInfoImp@@@Z @ 44 NONAME ; int CGroupContentSubscriptionItem::GroupMemberExistsL(class CPresentityGroupMemberInfoImp &) const + ?GroupMembersPresenceConfigurationItemLC@CPresenceDataCache@@QAEAAVCGroupMembersPresenceConfigurationItem@@ABVCXIMPIdentityImp@@@Z @ 45 NONAME ; class CGroupMembersPresenceConfigurationItem & CPresenceDataCache::GroupMembersPresenceConfigurationItemLC(class CXIMPIdentityImp const &) + ?IdLinearOrder@CPresenceBlockInfoImp@@SAHABV1@0@Z @ 46 NONAME ; int CPresenceBlockInfoImp::IdLinearOrder(class CPresenceBlockInfoImp const &, class CPresenceBlockInfoImp const &) + ?IdLinearOrder@CPresenceGrantRequestInfoImp@@SAHABV1@0@Z @ 47 NONAME ; int CPresenceGrantRequestInfoImp::IdLinearOrder(class CPresenceGrantRequestInfoImp const &, class CPresenceGrantRequestInfoImp const &) + ?IdLinearOrder@CPresenceWatcherInfoImp@@SAHABV1@0@Z @ 48 NONAME ; int CPresenceWatcherInfoImp::IdLinearOrder(class CPresenceWatcherInfoImp const &, class CPresenceWatcherInfoImp const &) + ?Identity@CGroupMembersPresenceConfigurationItem@@QBEABVMXIMPIdentity@@XZ @ 49 NONAME ; class MXIMPIdentity const & CGroupMembersPresenceConfigurationItem::Identity(void) const + ?Identity@CPresenceConfigurationItem@@QBEABVMXIMPIdentity@@XZ @ 50 NONAME ; class MXIMPIdentity const & CPresenceConfigurationItem::Identity(void) const + ?Identity@CPresentityGroupInfoImp@@QBEABVCXIMPIdentityImp@@XZ @ 51 NONAME ; class CXIMPIdentityImp const & CPresentityGroupInfoImp::Identity(void) const + ?Identity@CPresentityGroupMembersPresenceSubscriptionItem@@QBEABVMXIMPIdentity@@XZ @ 52 NONAME ; class MXIMPIdentity const & CPresentityGroupMembersPresenceSubscriptionItem::Identity(void) const + ?Identity@CPresentityPresenceSubscriptionItem@@QBEABVMXIMPIdentity@@XZ @ 53 NONAME ; class MXIMPIdentity const & CPresentityPresenceSubscriptionItem::Identity(void) const + ?IdentityImp@CPresenceBlockInfoImp@@QBEABVCXIMPIdentityImp@@XZ @ 54 NONAME ; class CXIMPIdentityImp const & CPresenceBlockInfoImp::IdentityImp(void) const + ?IdentityImp@CPresenceGrantRequestInfoImp@@QBEABVCXIMPIdentityImp@@XZ @ 55 NONAME ; class CXIMPIdentityImp const & CPresenceGrantRequestInfoImp::IdentityImp(void) const + ?IdentityImp@CPresenceWatcherInfoImp@@QBEABVCXIMPIdentityImp@@XZ @ 56 NONAME ; class CXIMPIdentityImp const & CPresenceWatcherInfoImp::IdentityImp(void) const + ?IdentityImp@CPresentityGroupMemberInfoImp@@QBEABVCXIMPIdentityImp@@XZ @ 57 NONAME ; class CXIMPIdentityImp const & CPresentityGroupMemberInfoImp::IdentityImp(void) const + ?IdentityOrder@CGroupContentSubscriptionItem@@SAHPBVCXIMPIdentityImp@@ABV1@@Z @ 58 NONAME ; int CGroupContentSubscriptionItem::IdentityOrder(class CXIMPIdentityImp const *, class CGroupContentSubscriptionItem const &) + ?IdentityOrder@CGroupMembersPresenceConfigurationItem@@SAHPBVCXIMPIdentityImp@@ABV1@@Z @ 59 NONAME ; int CGroupMembersPresenceConfigurationItem::IdentityOrder(class CXIMPIdentityImp const *, class CGroupMembersPresenceConfigurationItem const &) + ?IdentityOrder@CPresenceConfigurationItem@@SAHPBVCXIMPIdentityImp@@ABV1@@Z @ 60 NONAME ; int CPresenceConfigurationItem::IdentityOrder(class CXIMPIdentityImp const *, class CPresenceConfigurationItem const &) + ?IdentityOrder@CPresentityGroupMembersPresenceSubscriptionItem@@SAHPBVCXIMPIdentityImp@@ABV1@@Z @ 61 NONAME ; int CPresentityGroupMembersPresenceSubscriptionItem::IdentityOrder(class CXIMPIdentityImp const *, class CPresentityGroupMembersPresenceSubscriptionItem const &) + ?IdentityOrder@CPresentityPresenceSubscriptionItem@@SAHPBVCXIMPIdentityImp@@ABV1@@Z @ 62 NONAME ; int CPresentityPresenceSubscriptionItem::IdentityOrder(class CXIMPIdentityImp const *, class CPresentityPresenceSubscriptionItem const &) + ?InfoFilterUnionL@DocumentUtils@@SAPAVCPresenceInfoFilterImp@@AAV2@0@Z @ 63 NONAME ; class CPresenceInfoFilterImp * DocumentUtils::InfoFilterUnionL(class CPresenceInfoFilterImp &, class CPresenceInfoFilterImp &) + ?InfoFilterUnionL@DocumentUtils@@SAPAVCPresenceInfoFilterImp@@ABV?$RPointerArray@VCPresenceInfoFilterImp@@@@@Z @ 64 NONAME ; class CPresenceInfoFilterImp * DocumentUtils::InfoFilterUnionL(class RPointerArray const &) + ?InternalizeL@CDevicePresenceInfoImp@@QAEXAAVRReadStream@@@Z @ 65 NONAME ; void CDevicePresenceInfoImp::InternalizeL(class RReadStream &) + ?InternalizeL@CPersonPresenceInfoImp@@QAEXAAVRReadStream@@@Z @ 66 NONAME ; void CPersonPresenceInfoImp::InternalizeL(class RReadStream &) + ?InternalizeL@CPresenceBlockInfoImp@@QAEXAAVRReadStream@@@Z @ 67 NONAME ; void CPresenceBlockInfoImp::InternalizeL(class RReadStream &) + ?InternalizeL@CPresenceBuddyInfoImp@@QAEXAAVRReadStream@@@Z @ 68 NONAME ; void CPresenceBuddyInfoImp::InternalizeL(class RReadStream &) + ?InternalizeL@CPresenceBuddyInfoListImp@@QAEXAAVRReadStream@@@Z @ 69 NONAME ; void CPresenceBuddyInfoListImp::InternalizeL(class RReadStream &) + ?InternalizeL@CPresenceGrantRequestInfoImp@@QAEXAAVRReadStream@@@Z @ 70 NONAME ; void CPresenceGrantRequestInfoImp::InternalizeL(class RReadStream &) + ?InternalizeL@CPresenceInfoFieldCollectionImp@@QAEXAAVRReadStream@@@Z @ 71 NONAME ; void CPresenceInfoFieldCollectionImp::InternalizeL(class RReadStream &) + ?InternalizeL@CPresenceInfoFieldImp@@QAEXAAVRReadStream@@@Z @ 72 NONAME ; void CPresenceInfoFieldImp::InternalizeL(class RReadStream &) + ?InternalizeL@CPresenceInfoFieldValueBinaryImp@@QAEXAAVRReadStream@@@Z @ 73 NONAME ; void CPresenceInfoFieldValueBinaryImp::InternalizeL(class RReadStream &) + ?InternalizeL@CPresenceInfoFieldValueEnumImp@@QAEXAAVRReadStream@@@Z @ 74 NONAME ; void CPresenceInfoFieldValueEnumImp::InternalizeL(class RReadStream &) + ?InternalizeL@CPresenceInfoFieldValueTextImp@@QAEXAAVRReadStream@@@Z @ 75 NONAME ; void CPresenceInfoFieldValueTextImp::InternalizeL(class RReadStream &) + ?InternalizeL@CPresenceInfoFilterImp@@QAEXAAVRReadStream@@@Z @ 76 NONAME ; void CPresenceInfoFilterImp::InternalizeL(class RReadStream &) + ?InternalizeL@CPresenceInfoImp@@QAEXAAVRReadStream@@@Z @ 77 NONAME ; void CPresenceInfoImp::InternalizeL(class RReadStream &) + ?InternalizeL@CPresenceWatcherInfoImp@@QAEXAAVRReadStream@@@Z @ 78 NONAME ; void CPresenceWatcherInfoImp::InternalizeL(class RReadStream &) + ?InternalizeL@CPresentityGroupInfoImp@@QAEXAAVRReadStream@@@Z @ 79 NONAME ; void CPresentityGroupInfoImp::InternalizeL(class RReadStream &) + ?InternalizeL@CPresentityGroupMemberInfoImp@@QAEXAAVRReadStream@@@Z @ 80 NONAME ; void CPresentityGroupMemberInfoImp::InternalizeL(class RReadStream &) + ?InternalizeL@CServicePresenceInfoImp@@QAEXAAVRReadStream@@@Z @ 81 NONAME ; void CServicePresenceInfoImp::InternalizeL(class RReadStream &) + ?IsGroupMemberUpdatedL@CGroupContentSubscriptionItem@@QBEHAAVCPresentityGroupMemberInfoImp@@@Z @ 82 NONAME ; int CGroupContentSubscriptionItem::IsGroupMemberUpdatedL(class CPresentityGroupMemberInfoImp &) const + ?NewFromStreamLC@CDevicePresenceInfoImp@@SAPAVCXIMPApiDataObjBase@@AAVRReadStream@@@Z @ 83 NONAME ; class CXIMPApiDataObjBase * CDevicePresenceInfoImp::NewFromStreamLC(class RReadStream &) + ?NewFromStreamLC@CPersonPresenceInfoImp@@SAPAVCXIMPApiDataObjBase@@AAVRReadStream@@@Z @ 84 NONAME ; class CXIMPApiDataObjBase * CPersonPresenceInfoImp::NewFromStreamLC(class RReadStream &) + ?NewFromStreamLC@CPresenceBlockInfoImp@@SAPAVCXIMPApiDataObjBase@@AAVRReadStream@@@Z @ 85 NONAME ; class CXIMPApiDataObjBase * CPresenceBlockInfoImp::NewFromStreamLC(class RReadStream &) + ?NewFromStreamLC@CPresenceBuddyInfoImp@@SAPAVCXIMPApiDataObjBase@@AAVRReadStream@@@Z @ 86 NONAME ; class CXIMPApiDataObjBase * CPresenceBuddyInfoImp::NewFromStreamLC(class RReadStream &) + ?NewFromStreamLC@CPresenceBuddyInfoListImp@@SAPAVCXIMPApiDataObjBase@@AAVRReadStream@@@Z @ 87 NONAME ; class CXIMPApiDataObjBase * CPresenceBuddyInfoListImp::NewFromStreamLC(class RReadStream &) + ?NewFromStreamLC@CPresenceGrantRequestInfoImp@@SAPAVCXIMPApiDataObjBase@@AAVRReadStream@@@Z @ 88 NONAME ; class CXIMPApiDataObjBase * CPresenceGrantRequestInfoImp::NewFromStreamLC(class RReadStream &) + ?NewFromStreamLC@CPresenceInfoFieldCollectionImp@@SAPAVCXIMPApiDataObjBase@@AAVRReadStream@@@Z @ 89 NONAME ; class CXIMPApiDataObjBase * CPresenceInfoFieldCollectionImp::NewFromStreamLC(class RReadStream &) + ?NewFromStreamLC@CPresenceInfoFieldImp@@SAPAVCXIMPApiDataObjBase@@AAVRReadStream@@@Z @ 90 NONAME ; class CXIMPApiDataObjBase * CPresenceInfoFieldImp::NewFromStreamLC(class RReadStream &) + ?NewFromStreamLC@CPresenceInfoFieldValueBinaryImp@@SAPAVCXIMPApiDataObjBase@@AAVRReadStream@@@Z @ 91 NONAME ; class CXIMPApiDataObjBase * CPresenceInfoFieldValueBinaryImp::NewFromStreamLC(class RReadStream &) + ?NewFromStreamLC@CPresenceInfoFieldValueEnumImp@@SAPAVCXIMPApiDataObjBase@@AAVRReadStream@@@Z @ 92 NONAME ; class CXIMPApiDataObjBase * CPresenceInfoFieldValueEnumImp::NewFromStreamLC(class RReadStream &) + ?NewFromStreamLC@CPresenceInfoFieldValueTextImp@@SAPAVCXIMPApiDataObjBase@@AAVRReadStream@@@Z @ 93 NONAME ; class CXIMPApiDataObjBase * CPresenceInfoFieldValueTextImp::NewFromStreamLC(class RReadStream &) + ?NewFromStreamLC@CPresenceInfoFilterImp@@SAPAVCXIMPApiDataObjBase@@AAVRReadStream@@@Z @ 94 NONAME ; class CXIMPApiDataObjBase * CPresenceInfoFilterImp::NewFromStreamLC(class RReadStream &) + ?NewFromStreamLC@CPresenceInfoImp@@SAPAVCXIMPApiDataObjBase@@AAVRReadStream@@@Z @ 95 NONAME ; class CXIMPApiDataObjBase * CPresenceInfoImp::NewFromStreamLC(class RReadStream &) + ?NewFromStreamLC@CPresenceWatcherInfoImp@@SAPAVCXIMPApiDataObjBase@@AAVRReadStream@@@Z @ 96 NONAME ; class CXIMPApiDataObjBase * CPresenceWatcherInfoImp::NewFromStreamLC(class RReadStream &) + ?NewFromStreamLC@CPresentityGroupInfoImp@@SAPAVCXIMPApiDataObjBase@@AAVRReadStream@@@Z @ 97 NONAME ; class CXIMPApiDataObjBase * CPresentityGroupInfoImp::NewFromStreamLC(class RReadStream &) + ?NewFromStreamLC@CPresentityGroupMemberInfoImp@@SAPAVCXIMPApiDataObjBase@@AAVRReadStream@@@Z @ 98 NONAME ; class CXIMPApiDataObjBase * CPresentityGroupMemberInfoImp::NewFromStreamLC(class RReadStream &) + ?NewFromStreamLC@CServicePresenceInfoImp@@SAPAVCXIMPApiDataObjBase@@AAVRReadStream@@@Z @ 99 NONAME ; class CXIMPApiDataObjBase * CServicePresenceInfoImp::NewFromStreamLC(class RReadStream &) + ?NewL@COwnPresenceEventImp@@SAPAV1@PAVCXIMPDataSubscriptionStateImp@@@Z @ 100 NONAME ; class COwnPresenceEventImp * COwnPresenceEventImp::NewL(class CXIMPDataSubscriptionStateImp *) + ?NewL@CPresenceApiDataObjFactoryAccessor@@SAPAV1@XZ @ 101 NONAME ; class CPresenceApiDataObjFactoryAccessor * CPresenceApiDataObjFactoryAccessor::NewL(void) + ?NewL@CPresenceBlockInfoImp@@SAPAV1@XZ @ 102 NONAME ; class CPresenceBlockInfoImp * CPresenceBlockInfoImp::NewL(void) + ?NewL@CPresenceBuddyInfoImp@@SAPAV1@XZ @ 103 NONAME ; class CPresenceBuddyInfoImp * CPresenceBuddyInfoImp::NewL(void) + ?NewL@CPresenceBuddyInfoListImp@@SAPAV1@ABVTDesC16@@@Z @ 104 NONAME ; class CPresenceBuddyInfoListImp * CPresenceBuddyInfoListImp::NewL(class TDesC16 const &) + ?NewL@CPresenceDataCache@@SAPAV1@AAVMXIMPHost@@@Z @ 105 NONAME ; class CPresenceDataCache * CPresenceDataCache::NewL(class MXIMPHost &) + ?NewL@CPresenceFilterStore@@SAPAV1@XZ @ 106 NONAME ; class CPresenceFilterStore * CPresenceFilterStore::NewL(void) + ?NewL@CPresenceGrantRequestInfoImp@@SAPAV1@XZ @ 107 NONAME ; class CPresenceGrantRequestInfoImp * CPresenceGrantRequestInfoImp::NewL(void) + ?NewL@CPresenceInfoFilterImp@@SAPAV1@XZ @ 108 NONAME ; class CPresenceInfoFilterImp * CPresenceInfoFilterImp::NewL(void) + ?NewL@CPresenceInfoImp@@SAPAV1@XZ @ 109 NONAME ; class CPresenceInfoImp * CPresenceInfoImp::NewL(void) + ?NewL@CPresenceObjectFactoryImp@@SAPAV1@XZ @ 110 NONAME ; class CPresenceObjectFactoryImp * CPresenceObjectFactoryImp::NewL(void) + ?NewL@CPresenceWatcherInfoImp@@SAPAV1@XZ @ 111 NONAME ; class CPresenceWatcherInfoImp * CPresenceWatcherInfoImp::NewL(void) + ?NewL@CPresentityGroupContentEventImp@@SAPAV1@AAVCXIMPIdentityImp@@PAV?$RXIMPObjOwningPtrArray@VCPresentityGroupMemberInfoImp@@@@111PAVCXIMPDataSubscriptionStateImp@@@Z @ 112 NONAME ; class CPresentityGroupContentEventImp * CPresentityGroupContentEventImp::NewL(class CXIMPIdentityImp &, class RXIMPObjOwningPtrArray *, class RXIMPObjOwningPtrArray *, class RXIMPObjOwningPtrArray *, class RXIMPObjOwningPtrArray *, class CXIMPDataSubscriptionStateImp *) + ?NewL@CPresentityGroupInfoImp@@SAPAV1@XZ @ 113 NONAME ; class CPresentityGroupInfoImp * CPresentityGroupInfoImp::NewL(void) + ?NewL@CPresentityGroupListEventImp@@SAPAV1@PAV?$RXIMPObjOwningPtrArray@VCPresentityGroupInfoImp@@@@000PAVCXIMPDataSubscriptionStateImp@@@Z @ 114 NONAME ; class CPresentityGroupListEventImp * CPresentityGroupListEventImp::NewL(class RXIMPObjOwningPtrArray *, class RXIMPObjOwningPtrArray *, class RXIMPObjOwningPtrArray *, class RXIMPObjOwningPtrArray *, class CXIMPDataSubscriptionStateImp *) + ?NewL@CPresentityGroupMemberInfoImp@@SAPAV1@XZ @ 115 NONAME ; class CPresentityGroupMemberInfoImp * CPresentityGroupMemberInfoImp::NewL(void) + ?NewL@CPresentityPresenceEventImp@@SAPAV1@PAVCXIMPDataSubscriptionStateImp@@@Z @ 116 NONAME ; class CPresentityPresenceEventImp * CPresentityPresenceEventImp::NewL(class CXIMPDataSubscriptionStateImp *) + ?NewLC@CDevicePresenceInfoImp@@SAPAV1@XZ @ 117 NONAME ; class CDevicePresenceInfoImp * CDevicePresenceInfoImp::NewLC(void) + ?NewLC@COwnPresenceEventImp@@SAPAV1@PAVCXIMPDataSubscriptionStateImp@@@Z @ 118 NONAME ; class COwnPresenceEventImp * COwnPresenceEventImp::NewLC(class CXIMPDataSubscriptionStateImp *) + ?NewLC@CPersonPresenceInfoImp@@SAPAV1@XZ @ 119 NONAME ; class CPersonPresenceInfoImp * CPersonPresenceInfoImp::NewLC(void) + ?NewLC@CPresenceBlockInfoImp@@SAPAV1@ABVMXIMPIdentity@@ABVTDesC16@@@Z @ 120 NONAME ; class CPresenceBlockInfoImp * CPresenceBlockInfoImp::NewLC(class MXIMPIdentity const &, class TDesC16 const &) + ?NewLC@CPresenceBlockInfoImp@@SAPAV1@XZ @ 121 NONAME ; class CPresenceBlockInfoImp * CPresenceBlockInfoImp::NewLC(void) + ?NewLC@CPresenceBlockListEventImp@@SAPAV1@PAV?$RXIMPObjOwningPtrArray@VCPresenceBlockInfoImp@@@@000PAVCXIMPDataSubscriptionStateImp@@@Z @ 122 NONAME ; class CPresenceBlockListEventImp * CPresenceBlockListEventImp::NewLC(class RXIMPObjOwningPtrArray *, class RXIMPObjOwningPtrArray *, class RXIMPObjOwningPtrArray *, class RXIMPObjOwningPtrArray *, class CXIMPDataSubscriptionStateImp *) + ?NewLC@CPresenceBuddyInfoImp@@SAPAV1@XZ @ 123 NONAME ; class CPresenceBuddyInfoImp * CPresenceBuddyInfoImp::NewLC(void) + ?NewLC@CPresenceBuddyInfoListImp@@SAPAV1@ABVTDesC16@@@Z @ 124 NONAME ; class CPresenceBuddyInfoListImp * CPresenceBuddyInfoListImp::NewLC(class TDesC16 const &) + ?NewLC@CPresenceGrantRequestInfoImp@@SAPAV1@ABVMXIMPIdentity@@ABVTDesC16@@@Z @ 125 NONAME ; class CPresenceGrantRequestInfoImp * CPresenceGrantRequestInfoImp::NewLC(class MXIMPIdentity const &, class TDesC16 const &) + ?NewLC@CPresenceGrantRequestInfoImp@@SAPAV1@XZ @ 126 NONAME ; class CPresenceGrantRequestInfoImp * CPresenceGrantRequestInfoImp::NewLC(void) + ?NewLC@CPresenceGrantRequestListEventImp@@SAPAV1@PAV?$RXIMPObjOwningPtrArray@VCPresenceGrantRequestInfoImp@@@@00PAVCXIMPDataSubscriptionStateImp@@@Z @ 127 NONAME ; class CPresenceGrantRequestListEventImp * CPresenceGrantRequestListEventImp::NewLC(class RXIMPObjOwningPtrArray *, class RXIMPObjOwningPtrArray *, class RXIMPObjOwningPtrArray *, class CXIMPDataSubscriptionStateImp *) + ?NewLC@CPresenceInfoFieldCollectionImp@@SAPAV1@XZ @ 128 NONAME ; class CPresenceInfoFieldCollectionImp * CPresenceInfoFieldCollectionImp::NewLC(void) + ?NewLC@CPresenceInfoFieldImp@@SAPAV1@ABVTDesC8@@PAVCXIMPApiDataObjBase@@@Z @ 129 NONAME ; class CPresenceInfoFieldImp * CPresenceInfoFieldImp::NewLC(class TDesC8 const &, class CXIMPApiDataObjBase *) + ?NewLC@CPresenceInfoFieldImp@@SAPAV1@XZ @ 130 NONAME ; class CPresenceInfoFieldImp * CPresenceInfoFieldImp::NewLC(void) + ?NewLC@CPresenceInfoFieldValueBinaryImp@@SAPAV1@H@Z @ 131 NONAME ; class CPresenceInfoFieldValueBinaryImp * CPresenceInfoFieldValueBinaryImp::NewLC(int) + ?NewLC@CPresenceInfoFieldValueEnumImp@@SAPAV1@XZ @ 132 NONAME ; class CPresenceInfoFieldValueEnumImp * CPresenceInfoFieldValueEnumImp::NewLC(void) + ?NewLC@CPresenceInfoFieldValueTextImp@@SAPAV1@H@Z @ 133 NONAME ; class CPresenceInfoFieldValueTextImp * CPresenceInfoFieldValueTextImp::NewLC(int) + ?NewLC@CPresenceInfoFilterImp@@SAPAV1@XZ @ 134 NONAME ; class CPresenceInfoFilterImp * CPresenceInfoFilterImp::NewLC(void) + ?NewLC@CPresenceInfoImp@@SAPAV1@XZ @ 135 NONAME ; class CPresenceInfoImp * CPresenceInfoImp::NewLC(void) + ?NewLC@CPresenceWatcherInfoImp@@SAPAV1@W4TWatcherType@MPresenceWatcherInfo@@ABVMXIMPIdentity@@ABVTDesC16@@@Z @ 136 NONAME ; class CPresenceWatcherInfoImp * CPresenceWatcherInfoImp::NewLC(enum MPresenceWatcherInfo::TWatcherType, class MXIMPIdentity const &, class TDesC16 const &) + ?NewLC@CPresenceWatcherInfoImp@@SAPAV1@XZ @ 137 NONAME ; class CPresenceWatcherInfoImp * CPresenceWatcherInfoImp::NewLC(void) + ?NewLC@CPresenceWatcherListEventImp@@SAPAV1@PAV?$RXIMPObjOwningPtrArray@VCPresenceWatcherInfoImp@@@@00PAVCXIMPDataSubscriptionStateImp@@@Z @ 138 NONAME ; class CPresenceWatcherListEventImp * CPresenceWatcherListEventImp::NewLC(class RXIMPObjOwningPtrArray *, class RXIMPObjOwningPtrArray *, class RXIMPObjOwningPtrArray *, class CXIMPDataSubscriptionStateImp *) + ?NewLC@CPresentityGroupContentEventImp@@SAPAV1@AAVCXIMPIdentityImp@@PAV?$RXIMPObjOwningPtrArray@VCPresentityGroupMemberInfoImp@@@@111PAVCXIMPDataSubscriptionStateImp@@@Z @ 139 NONAME ; class CPresentityGroupContentEventImp * CPresentityGroupContentEventImp::NewLC(class CXIMPIdentityImp &, class RXIMPObjOwningPtrArray *, class RXIMPObjOwningPtrArray *, class RXIMPObjOwningPtrArray *, class RXIMPObjOwningPtrArray *, class CXIMPDataSubscriptionStateImp *) + ?NewLC@CPresentityGroupContentEventImp@@SAPAV1@AAVCXIMPIdentityImp@@PAV?$RXIMPObjOwningPtrArray@VCPresentityGroupMemberInfoImp@@@@11PAVCXIMPDataSubscriptionStateImp@@@Z @ 140 NONAME ; class CPresentityGroupContentEventImp * CPresentityGroupContentEventImp::NewLC(class CXIMPIdentityImp &, class RXIMPObjOwningPtrArray *, class RXIMPObjOwningPtrArray *, class RXIMPObjOwningPtrArray *, class CXIMPDataSubscriptionStateImp *) + ?NewLC@CPresentityGroupInfoImp@@SAPAV1@ABVMXIMPIdentity@@ABVTDesC16@@@Z @ 141 NONAME ; class CPresentityGroupInfoImp * CPresentityGroupInfoImp::NewLC(class MXIMPIdentity const &, class TDesC16 const &) + ?NewLC@CPresentityGroupInfoImp@@SAPAV1@XZ @ 142 NONAME ; class CPresentityGroupInfoImp * CPresentityGroupInfoImp::NewLC(void) + ?NewLC@CPresentityGroupListEventImp@@SAPAV1@PAV?$RXIMPObjOwningPtrArray@VCPresentityGroupInfoImp@@@@000PAVCXIMPDataSubscriptionStateImp@@@Z @ 143 NONAME ; class CPresentityGroupListEventImp * CPresentityGroupListEventImp::NewLC(class RXIMPObjOwningPtrArray *, class RXIMPObjOwningPtrArray *, class RXIMPObjOwningPtrArray *, class RXIMPObjOwningPtrArray *, class CXIMPDataSubscriptionStateImp *) + ?NewLC@CPresentityGroupListEventImp@@SAPAV1@PAV?$RXIMPObjOwningPtrArray@VCPresentityGroupInfoImp@@@@00PAVCXIMPDataSubscriptionStateImp@@@Z @ 144 NONAME ; class CPresentityGroupListEventImp * CPresentityGroupListEventImp::NewLC(class RXIMPObjOwningPtrArray *, class RXIMPObjOwningPtrArray *, class RXIMPObjOwningPtrArray *, class CXIMPDataSubscriptionStateImp *) + ?NewLC@CPresentityGroupMemberInfoImp@@SAPAV1@ABVMXIMPIdentity@@ABVTDesC16@@@Z @ 145 NONAME ; class CPresentityGroupMemberInfoImp * CPresentityGroupMemberInfoImp::NewLC(class MXIMPIdentity const &, class TDesC16 const &) + ?NewLC@CPresentityGroupMemberInfoImp@@SAPAV1@XZ @ 146 NONAME ; class CPresentityGroupMemberInfoImp * CPresentityGroupMemberInfoImp::NewLC(void) + ?NewLC@CPresentityPresenceEventImp@@SAPAV1@PAVCXIMPDataSubscriptionStateImp@@@Z @ 147 NONAME ; class CPresentityPresenceEventImp * CPresentityPresenceEventImp::NewLC(class CXIMPDataSubscriptionStateImp *) + ?NewLC@CServicePresenceInfoImp@@SAPAV1@XZ @ 148 NONAME ; class CServicePresenceInfoImp * CServicePresenceInfoImp::NewLC(void) + ?Order@CGroupContentSubscriptionItem@@SAHABV1@0@Z @ 149 NONAME ; int CGroupContentSubscriptionItem::Order(class CGroupContentSubscriptionItem const &, class CGroupContentSubscriptionItem const &) + ?Order@CGroupMembersPresenceConfigurationItem@@SAHABV1@0@Z @ 150 NONAME ; int CGroupMembersPresenceConfigurationItem::Order(class CGroupMembersPresenceConfigurationItem const &, class CGroupMembersPresenceConfigurationItem const &) + ?Order@CPresenceConfigurationItem@@SAHABV1@0@Z @ 151 NONAME ; int CPresenceConfigurationItem::Order(class CPresenceConfigurationItem const &, class CPresenceConfigurationItem const &) + ?Order@CPresentityGroupMembersPresenceSubscriptionItem@@SAHABV1@0@Z @ 152 NONAME ; int CPresentityGroupMembersPresenceSubscriptionItem::Order(class CPresentityGroupMembersPresenceSubscriptionItem const &, class CPresentityGroupMembersPresenceSubscriptionItem const &) + ?Order@CPresentityPresenceSubscriptionItem@@SAHABV1@0@Z @ 153 NONAME ; int CPresentityPresenceSubscriptionItem::Order(class CPresentityPresenceSubscriptionItem const &, class CPresentityPresenceSubscriptionItem const &) + ?OwnPresenceDataSubscriptionState@CPresenceDataCache@@QBEABVMXIMPDataSubscriptionState@@XZ @ 154 NONAME ; class MXIMPDataSubscriptionState const & CPresenceDataCache::OwnPresenceDataSubscriptionState(void) const + ?OwnPresenceSubscriptionItemLC@CPresenceDataCache@@QAEAAVCOwnPresenceSubscriptionItem@@XZ @ 155 NONAME ; class COwnPresenceSubscriptionItem & CPresenceDataCache::OwnPresenceSubscriptionItemLC(void) + ?PresenceBlockDataSubscriptionState@CPresenceDataCache@@QBEABVMXIMPDataSubscriptionState@@XZ @ 156 NONAME ; class MXIMPDataSubscriptionState const & CPresenceDataCache::PresenceBlockDataSubscriptionState(void) const + ?PresenceConfigurationItemLC@CPresenceDataCache@@QAEAAVCPresenceConfigurationItem@@ABVCXIMPIdentityImp@@@Z @ 157 NONAME ; class CPresenceConfigurationItem & CPresenceDataCache::PresenceConfigurationItemLC(class CXIMPIdentityImp const &) + ?PresenceGrantRequestDataSubscriptionState@CPresenceDataCache@@QBEABVMXIMPDataSubscriptionState@@XZ @ 158 NONAME ; class MXIMPDataSubscriptionState const & CPresenceDataCache::PresenceGrantRequestDataSubscriptionState(void) const + ?PresenceToEveryoneConfigurationItemLC@CPresenceDataCache@@QAEAAVCPresenceToEveryoneConfigurationItem@@XZ @ 159 NONAME ; class CPresenceToEveryoneConfigurationItem & CPresenceDataCache::PresenceToEveryoneConfigurationItemLC(void) + ?PresenceWatcherListDataSubscriptionState@CPresenceDataCache@@QBEABVMXIMPDataSubscriptionState@@XZ @ 160 NONAME ; class MXIMPDataSubscriptionState const & CPresenceDataCache::PresenceWatcherListDataSubscriptionState(void) const + ?PresentityGroupContentDataSubscriptionState@CPresenceDataCache@@QBEABVMXIMPDataSubscriptionState@@ABVMXIMPIdentity@@@Z @ 161 NONAME ; class MXIMPDataSubscriptionState const & CPresenceDataCache::PresentityGroupContentDataSubscriptionState(class MXIMPIdentity const &) const + ?PresentityGroupListDataSubscriptionState@CPresenceDataCache@@QBEABVMXIMPDataSubscriptionState@@XZ @ 162 NONAME ; class MXIMPDataSubscriptionState const & CPresenceDataCache::PresentityGroupListDataSubscriptionState(void) const + ?PresentityGroupMembersPresenceSubscriptionItemLC@CPresenceDataCache@@QAEAAVCPresentityGroupMembersPresenceSubscriptionItem@@ABVCXIMPIdentityImp@@@Z @ 163 NONAME ; class CPresentityGroupMembersPresenceSubscriptionItem & CPresenceDataCache::PresentityGroupMembersPresenceSubscriptionItemLC(class CXIMPIdentityImp const &) + ?PresentityPresenceDataSubscriptionState@CPresenceDataCache@@QBEABVMXIMPDataSubscriptionState@@ABVMXIMPIdentity@@@Z @ 164 NONAME ; class MXIMPDataSubscriptionState const & CPresenceDataCache::PresentityPresenceDataSubscriptionState(class MXIMPIdentity const &) const + ?PresentityPresenceSubscriptionItemLC@CPresenceDataCache@@QAEAAVCPresentityPresenceSubscriptionItem@@ABVCXIMPIdentityImp@@@Z @ 165 NONAME ; class CPresentityPresenceSubscriptionItem & CPresenceDataCache::PresentityPresenceSubscriptionItemLC(class CXIMPIdentityImp const &) + ?RemoveConfigurator@CGroupMembersPresenceConfigurationItem@@QAEXPAVMXIMPPscContext@@@Z @ 166 NONAME ; void CGroupMembersPresenceConfigurationItem::RemoveConfigurator(class MXIMPPscContext *) + ?RemoveMe@?$@VCBlockListSubscriptionItem@@@CPresenceDataCache@@CAXAAPAV1@PAV1@@Z @ 167 NONAME ; void CPresenceDataCache::RemoveMe(class CBlockListSubscriptionItem * &, class CBlockListSubscriptionItem *) + ?RemoveMe@?$@VCGrantRequestListSubscriptionItem@@@CPresenceDataCache@@CAXAAPAV1@PAV1@@Z @ 168 NONAME ; void CPresenceDataCache::RemoveMe(class CGrantRequestListSubscriptionItem * &, class CGrantRequestListSubscriptionItem *) + ?RemoveMe@?$@VCGroupListSubscriptionItem@@@CPresenceDataCache@@CAXAAPAV1@PAV1@@Z @ 169 NONAME ; void CPresenceDataCache::RemoveMe(class CGroupListSubscriptionItem * &, class CGroupListSubscriptionItem *) + ?RemoveMe@?$@VCOwnPresenceSubscriptionItem@@@CPresenceDataCache@@CAXAAPAV1@PAV1@@Z @ 170 NONAME ; void CPresenceDataCache::RemoveMe(class COwnPresenceSubscriptionItem * &, class COwnPresenceSubscriptionItem *) + ?RemoveMe@?$@VCPresenceToEveryoneConfigurationItem@@@CPresenceDataCache@@CAXAAPAV1@PAV1@@Z @ 171 NONAME ; void CPresenceDataCache::RemoveMe(class CPresenceToEveryoneConfigurationItem * &, class CPresenceToEveryoneConfigurationItem *) + ?RemoveMe@?$@VCWatcherListSubscriptionItem@@@CPresenceDataCache@@CAXAAPAV1@PAV1@@Z @ 172 NONAME ; void CPresenceDataCache::RemoveMe(class CWatcherListSubscriptionItem * &, class CWatcherListSubscriptionItem *) + ?RemoveSubscriber@CPresentityGroupMembersPresenceSubscriptionItem@@QAEXPAVMXIMPPscContext@@@Z @ 173 NONAME ; void CPresentityGroupMembersPresenceSubscriptionItem::RemoveSubscriber(class MXIMPPscContext *) + ?SetAddedListL@CGroupContentSubscriptionItem@@QAEXPAV?$RXIMPObjOwningPtrArray@VCPresentityGroupMemberInfoImp@@@@@Z @ 174 NONAME ; void CGroupContentSubscriptionItem::SetAddedListL(class RXIMPObjOwningPtrArray *) + ?SetBlockedL@CBlockListSubscriptionItem@@QAEXPAVCPresenceBlockInfoImp@@@Z @ 175 NONAME ; void CBlockListSubscriptionItem::SetBlockedL(class CPresenceBlockInfoImp *) + ?SetCanceledBlockIdL@CBlockListSubscriptionItem@@QAEXPAVCXIMPIdentityImp@@@Z @ 176 NONAME ; void CBlockListSubscriptionItem::SetCanceledBlockIdL(class CXIMPIdentityImp *) + ?SetConfigurationPif@CGroupMembersPresenceConfigurationItem@@QAEXPAVCPresenceInfoFilterImp@@@Z @ 177 NONAME ; void CGroupMembersPresenceConfigurationItem::SetConfigurationPif(class CPresenceInfoFilterImp *) + ?SetConfigurationPif@CPresenceConfigurationItem@@QAEXPAVCPresenceInfoFilterImp@@@Z @ 178 NONAME ; void CPresenceConfigurationItem::SetConfigurationPif(class CPresenceInfoFilterImp *) + ?SetConfigurationPif@CPresenceToEveryoneConfigurationItem@@QAEXPAVCPresenceInfoFilterImp@@@Z @ 179 NONAME ; void CPresenceToEveryoneConfigurationItem::SetConfigurationPif(class CPresenceInfoFilterImp *) + ?SetCreatedListL@CGroupListSubscriptionItem@@QAEXPAV?$RXIMPObjOwningPtrArray@VCPresentityGroupInfoImp@@@@@Z @ 180 NONAME ; void CGroupListSubscriptionItem::SetCreatedListL(class RXIMPObjOwningPtrArray *) + ?SetDeletedListL@CGroupListSubscriptionItem@@QAEXPAV?$RXIMPObjOwningPtrArray@VCPresentityGroupInfoImp@@@@@Z @ 181 NONAME ; void CGroupListSubscriptionItem::SetDeletedListL(class RXIMPObjOwningPtrArray *) + ?SetDisplayName@CPresenceBlockInfoImp@@QAEXPAVHBufC16@@@Z @ 182 NONAME ; void CPresenceBlockInfoImp::SetDisplayName(class HBufC16 *) + ?SetDisplayName@CPresenceGrantRequestInfoImp@@QAEXPAVHBufC16@@@Z @ 183 NONAME ; void CPresenceGrantRequestInfoImp::SetDisplayName(class HBufC16 *) + ?SetDisplayName@CPresenceWatcherInfoImp@@QAEXPAVHBufC16@@@Z @ 184 NONAME ; void CPresenceWatcherInfoImp::SetDisplayName(class HBufC16 *) + ?SetGroupIdentity@CPresentityPresenceSubscriptionItem@@QAEXPAVCXIMPIdentityImp@@@Z @ 185 NONAME ; void CPresentityPresenceSubscriptionItem::SetGroupIdentity(class CXIMPIdentityImp *) + ?SetIdentity@CGroupMembersPresenceConfigurationItem@@QAEXPAVCXIMPIdentityImp@@@Z @ 186 NONAME ; void CGroupMembersPresenceConfigurationItem::SetIdentity(class CXIMPIdentityImp *) + ?SetIdentity@CPresenceBlockInfoImp@@QAEXPAVCXIMPIdentityImp@@@Z @ 187 NONAME ; void CPresenceBlockInfoImp::SetIdentity(class CXIMPIdentityImp *) + ?SetIdentity@CPresenceConfigurationItem@@QAEXPAVCXIMPIdentityImp@@@Z @ 188 NONAME ; void CPresenceConfigurationItem::SetIdentity(class CXIMPIdentityImp *) + ?SetIdentity@CPresenceGrantRequestInfoImp@@QAEXPAVCXIMPIdentityImp@@@Z @ 189 NONAME ; void CPresenceGrantRequestInfoImp::SetIdentity(class CXIMPIdentityImp *) + ?SetIdentity@CPresenceWatcherInfoImp@@QAEXPAVCXIMPIdentityImp@@@Z @ 190 NONAME ; void CPresenceWatcherInfoImp::SetIdentity(class CXIMPIdentityImp *) + ?SetIdentity@CPresentityGroupMembersPresenceSubscriptionItem@@QAEXPAVCXIMPIdentityImp@@@Z @ 191 NONAME ; void CPresentityGroupMembersPresenceSubscriptionItem::SetIdentity(class CXIMPIdentityImp *) + ?SetIdentity@CPresentityPresenceSubscriptionItem@@QAEXPAVCXIMPIdentityImp@@@Z @ 192 NONAME ; void CPresentityPresenceSubscriptionItem::SetIdentity(class CXIMPIdentityImp *) + ?SetNewListL@CBlockListSubscriptionItem@@QAEXPAV?$RXIMPObjOwningPtrArray@VCPresenceBlockInfoImp@@@@@Z @ 193 NONAME ; void CBlockListSubscriptionItem::SetNewListL(class RXIMPObjOwningPtrArray *) + ?SetNewListL@CGrantRequestListSubscriptionItem@@QAEXPAV?$RXIMPObjOwningPtrArray@VCPresenceGrantRequestInfoImp@@@@@Z @ 194 NONAME ; void CGrantRequestListSubscriptionItem::SetNewListL(class RXIMPObjOwningPtrArray *) + ?SetNewListL@CGroupContentSubscriptionItem@@QAEXPAV?$RXIMPObjOwningPtrArray@VCPresentityGroupMemberInfoImp@@@@@Z @ 195 NONAME ; void CGroupContentSubscriptionItem::SetNewListL(class RXIMPObjOwningPtrArray *) + ?SetNewListL@CGroupListSubscriptionItem@@QAEXPAV?$RXIMPObjOwningPtrArray@VCPresentityGroupInfoImp@@@@@Z @ 196 NONAME ; void CGroupListSubscriptionItem::SetNewListL(class RXIMPObjOwningPtrArray *) + ?SetNewListL@CWatcherListSubscriptionItem@@QAEXPAV?$RXIMPObjOwningPtrArray@VCPresenceWatcherInfoImp@@@@@Z @ 197 NONAME ; void CWatcherListSubscriptionItem::SetNewListL(class RXIMPObjOwningPtrArray *) + ?SetObsoletedRequestL@CGrantRequestListSubscriptionItem@@QAEXPAVCXIMPIdentityImp@@@Z @ 198 NONAME ; void CGrantRequestListSubscriptionItem::SetObsoletedRequestL(class CXIMPIdentityImp *) + ?SetOwnObjects@CPresenceBuddyInfoListImp@@QAEXH@Z @ 199 NONAME ; void CPresenceBuddyInfoListImp::SetOwnObjects(int) + ?SetPresenceInfoL@COwnPresenceSubscriptionItem@@QAEXPAVCPresenceInfoImp@@@Z @ 200 NONAME ; void COwnPresenceSubscriptionItem::SetPresenceInfoL(class CPresenceInfoImp *) + ?SetPresenceInfoL@CPresentityGroupMembersPresenceSubscriptionItem@@QAEXPAVCPresenceInfoImp@@@Z @ 201 NONAME ; void CPresentityGroupMembersPresenceSubscriptionItem::SetPresenceInfoL(class CPresenceInfoImp *) + ?SetPresenceInfoL@CPresentityPresenceSubscriptionItem@@QAEXPAVCPresenceInfoImp@@@Z @ 202 NONAME ; void CPresentityPresenceSubscriptionItem::SetPresenceInfoL(class CPresenceInfoImp *) + ?SetReceivedRequestL@CGrantRequestListSubscriptionItem@@QAEXPAVCPresenceGrantRequestInfoImp@@@Z @ 203 NONAME ; void CGrantRequestListSubscriptionItem::SetReceivedRequestL(class CPresenceGrantRequestInfoImp *) + ?SetRemovedListL@CGroupContentSubscriptionItem@@QAEXPAV?$RXIMPObjOwningPtrArray@VCPresentityGroupMemberInfoImp@@@@@Z @ 204 NONAME ; void CGroupContentSubscriptionItem::SetRemovedListL(class RXIMPObjOwningPtrArray *) + ?SetSubscriptionPif@COwnPresenceSubscriptionItem@@QAEXPAVCPresenceInfoFilterImp@@@Z @ 205 NONAME ; void COwnPresenceSubscriptionItem::SetSubscriptionPif(class CPresenceInfoFilterImp *) + ?SetSubscriptionPif@CPresentityGroupMembersPresenceSubscriptionItem@@QAEXPAVCPresenceInfoFilterImp@@@Z @ 206 NONAME ; void CPresentityGroupMembersPresenceSubscriptionItem::SetSubscriptionPif(class CPresenceInfoFilterImp *) + ?SetSubscriptionPif@CPresentityPresenceSubscriptionItem@@QAEXPAVCPresenceInfoFilterImp@@@Z @ 207 NONAME ; void CPresentityPresenceSubscriptionItem::SetSubscriptionPif(class CPresenceInfoFilterImp *) + ?SubscriptionPif@COwnPresenceSubscriptionItem@@QAEAAVCPresenceInfoFilterImp@@XZ @ 208 NONAME ; class CPresenceInfoFilterImp & COwnPresenceSubscriptionItem::SubscriptionPif(void) + ?SubscriptionPif@CPresentityGroupMembersPresenceSubscriptionItem@@QAEAAVCPresenceInfoFilterImp@@XZ @ 209 NONAME ; class CPresenceInfoFilterImp & CPresentityGroupMembersPresenceSubscriptionItem::SubscriptionPif(void) + ?SubscriptionPif@CPresentityPresenceSubscriptionItem@@QAEAAVCPresenceInfoFilterImp@@XZ @ 210 NONAME ; class CPresenceInfoFilterImp & CPresentityPresenceSubscriptionItem::SubscriptionPif(void) + ?UnionL@CPresenceInfoFilterImp@@SAPAV1@AAV1@0@Z @ 211 NONAME ; class CPresenceInfoFilterImp * CPresenceInfoFilterImp::UnionL(class CPresenceInfoFilterImp &, class CPresenceInfoFilterImp &) + ?WatcherListSubscriptionItemLC@CPresenceDataCache@@QAEAAVCWatcherListSubscriptionItem@@XZ @ 212 NONAME ; class CWatcherListSubscriptionItem & CPresenceDataCache::WatcherListSubscriptionItemLC(void) + diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/bwins/presenceecomhookU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/bwins/presenceecomhookU.DEF Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + ?ImplementationGroupProxy@@YAPBUTImplementationProxy@@AAH@Z @ 1 NONAME ; struct TImplementationProxy const * ImplementationGroupProxy(int &) + diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/bwins/presencemanagerU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/bwins/presencemanagerU.DEF Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + ?NewL@CPresenceFeaturesImp@@SAPAV1@PAVMXIMPContext@@@Z @ 1 NONAME ; class CPresenceFeaturesImp * CPresenceFeaturesImp::NewL(class MXIMPContext *) + diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/bwins/presenceoperationu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/bwins/presenceoperationu.def Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,47 @@ +EXPORTS + ??0COperationAddPresentityGroupMember@@QAE@XZ @ 1 NONAME ; COperationAddPresentityGroupMember::COperationAddPresentityGroupMember(void) + ??0COperationBlockPresenceForPresentity@@QAE@XZ @ 2 NONAME ; COperationBlockPresenceForPresentity::COperationBlockPresenceForPresentity(void) + ??0COperationCancelPresenceBlockFromPresentity@@QAE@XZ @ 3 NONAME ; COperationCancelPresenceBlockFromPresentity::COperationCancelPresenceBlockFromPresentity(void) + ??0COperationCreatePresentityGroup@@QAE@XZ @ 4 NONAME ; COperationCreatePresentityGroup::COperationCreatePresentityGroup(void) + ??0COperationDeletePresentityGroup@@QAE@XZ @ 5 NONAME ; COperationDeletePresentityGroup::COperationDeletePresentityGroup(void) + ??0COperationGrantPresenceToEveryone@@QAE@XZ @ 6 NONAME ; COperationGrantPresenceToEveryone::COperationGrantPresenceToEveryone(void) + ??0COperationGrantPresenceToPresentity@@QAE@XZ @ 7 NONAME ; COperationGrantPresenceToPresentity::COperationGrantPresenceToPresentity(void) + ??0COperationGrantPresenceToPresentityGroupMembers@@QAE@XZ @ 8 NONAME ; COperationGrantPresenceToPresentityGroupMembers::COperationGrantPresenceToPresentityGroupMembers(void) + ??0COperationHandleOwnPresence@@QAE@XZ @ 9 NONAME ; COperationHandleOwnPresence::COperationHandleOwnPresence(void) + ??0COperationHandlePresenceBlocking@@QAE@H@Z @ 10 NONAME ; COperationHandlePresenceBlocking::COperationHandlePresenceBlocking(int) + ??0COperationHandlePresenceGrantRequests@@QAE@H@Z @ 11 NONAME ; COperationHandlePresenceGrantRequests::COperationHandlePresenceGrantRequests(int) + ??0COperationHandlePresenceWatcherList@@QAE@XZ @ 12 NONAME ; COperationHandlePresenceWatcherList::COperationHandlePresenceWatcherList(void) + ??0COperationHandlePresentityGroupContent@@QAE@XZ @ 13 NONAME ; COperationHandlePresentityGroupContent::COperationHandlePresentityGroupContent(void) + ??0COperationHandlePresentityGroupMemberAdded@@QAE@XZ @ 14 NONAME ; COperationHandlePresentityGroupMemberAdded::COperationHandlePresentityGroupMemberAdded(void) + ??0COperationHandlePresentityGroupMemberDisplayNameUpdated@@QAE@XZ @ 15 NONAME ; COperationHandlePresentityGroupMemberDisplayNameUpdated::COperationHandlePresentityGroupMemberDisplayNameUpdated(void) + ??0COperationHandlePresentityGroupMemberRemoved@@QAE@XZ @ 16 NONAME ; COperationHandlePresentityGroupMemberRemoved::COperationHandlePresentityGroupMemberRemoved(void) + ??0COperationHandlePresentityGroups@@QAE@W4TPresenceOpTypes@NPresenceOps@@@Z @ 17 NONAME ; COperationHandlePresentityGroups::COperationHandlePresentityGroups(enum NPresenceOps::TPresenceOpTypes) + ??0COperationHandlePresentityPresence@@QAE@H@Z @ 18 NONAME ; COperationHandlePresentityPresence::COperationHandlePresentityPresence(int) + ??0COperationLaunchCleaner@@QAE@XZ @ 19 NONAME ; COperationLaunchCleaner::COperationLaunchCleaner(void) + ??0COperationPublishOwnPresence@@QAE@XZ @ 20 NONAME ; COperationPublishOwnPresence::COperationPublishOwnPresence(void) + ??0COperationRemovePresentityGroupMember@@QAE@XZ @ 21 NONAME ; COperationRemovePresentityGroupMember::COperationRemovePresentityGroupMember(void) + ??0COperationSetSubscriptionData@@QAE@W4TPresenceOpTypes@NPresenceOps@@@Z @ 22 NONAME ; COperationSetSubscriptionData::COperationSetSubscriptionData(enum NPresenceOps::TPresenceOpTypes) + ??0COperationSubscribeBlockList@@QAE@XZ @ 23 NONAME ; COperationSubscribeBlockList::COperationSubscribeBlockList(void) + ??0COperationSubscribeGrantRequestList@@QAE@XZ @ 24 NONAME ; COperationSubscribeGrantRequestList::COperationSubscribeGrantRequestList(void) + ??0COperationSubscribeGroupContent@@QAE@XZ @ 25 NONAME ; COperationSubscribeGroupContent::COperationSubscribeGroupContent(void) + ??0COperationSubscribeGroupList@@QAE@XZ @ 26 NONAME ; COperationSubscribeGroupList::COperationSubscribeGroupList(void) + ??0COperationSubscribeOwnPresence@@QAE@XZ @ 27 NONAME ; COperationSubscribeOwnPresence::COperationSubscribeOwnPresence(void) + ??0COperationSubscribePresentityGroupMembersPresence@@QAE@XZ @ 28 NONAME ; COperationSubscribePresentityGroupMembersPresence::COperationSubscribePresentityGroupMembersPresence(void) + ??0COperationSubscribePresentityPresence@@QAE@XZ @ 29 NONAME ; COperationSubscribePresentityPresence::COperationSubscribePresentityPresence(void) + ??0COperationSubscribeWatcherList@@QAE@XZ @ 30 NONAME ; COperationSubscribeWatcherList::COperationSubscribeWatcherList(void) + ??0COperationSynthesiseSubscriptionEvent@@QAE@W4TSubscriptionType@0@H@Z @ 31 NONAME ; COperationSynthesiseSubscriptionEvent::COperationSynthesiseSubscriptionEvent(enum COperationSynthesiseSubscriptionEvent::TSubscriptionType, int) + ??0COperationUnsubscribeBlockList@@QAE@XZ @ 32 NONAME ; COperationUnsubscribeBlockList::COperationUnsubscribeBlockList(void) + ??0COperationUnsubscribeGrantRequestList@@QAE@XZ @ 33 NONAME ; COperationUnsubscribeGrantRequestList::COperationUnsubscribeGrantRequestList(void) + ??0COperationUnsubscribeGroupContent@@QAE@XZ @ 34 NONAME ; COperationUnsubscribeGroupContent::COperationUnsubscribeGroupContent(void) + ??0COperationUnsubscribeGroupList@@QAE@XZ @ 35 NONAME ; COperationUnsubscribeGroupList::COperationUnsubscribeGroupList(void) + ??0COperationUnsubscribeOwnPresence@@QAE@XZ @ 36 NONAME ; COperationUnsubscribeOwnPresence::COperationUnsubscribeOwnPresence(void) + ??0COperationUnsubscribePresentityGroupMembersPresence@@QAE@XZ @ 37 NONAME ; COperationUnsubscribePresentityGroupMembersPresence::COperationUnsubscribePresentityGroupMembersPresence(void) + ??0COperationUnsubscribePresentityPresence@@QAE@XZ @ 38 NONAME ; COperationUnsubscribePresentityPresence::COperationUnsubscribePresentityPresence(void) + ??0COperationUnsubscribeWatcherList@@QAE@XZ @ 39 NONAME ; COperationUnsubscribeWatcherList::COperationUnsubscribeWatcherList(void) + ??0COperationUpdatePresentityGroupDisplayName@@QAE@XZ @ 40 NONAME ; COperationUpdatePresentityGroupDisplayName::COperationUpdatePresentityGroupDisplayName(void) + ??0COperationUpdatePresentityGroupMemberDisplayName@@QAE@XZ @ 41 NONAME ; COperationUpdatePresentityGroupMemberDisplayName::COperationUpdatePresentityGroupMemberDisplayName(void) + ??0COperationWithdrawPresenceFromEveryone@@QAE@XZ @ 42 NONAME ; COperationWithdrawPresenceFromEveryone::COperationWithdrawPresenceFromEveryone(void) + ??0COperationWithdrawPresenceFromPresentity@@QAE@XZ @ 43 NONAME ; COperationWithdrawPresenceFromPresentity::COperationWithdrawPresenceFromPresentity(void) + ??0COperationWithdrawPresenceFromPresentityGroupMembers@@QAE@XZ @ 44 NONAME ; COperationWithdrawPresenceFromPresentityGroupMembers::COperationWithdrawPresenceFromPresentityGroupMembers(void) + ?NewL@CPresenceOperationFactory@@SAPAV1@XZ @ 45 NONAME ; class CPresenceOperationFactory * CPresenceOperationFactory::NewL(void) + diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/eabi/presencecacheclientu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/eabi/presencecacheclientu.def Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,7 @@ +EXPORTS + _ZN20CPresenceCacheClient13CreateReaderLEv @ 1 NONAME + _ZN20CPresenceCacheClient13CreateWriterLEv @ 2 NONAME + _ZN20CPresenceCacheClient4NewLEv @ 3 NONAME + _ZTI20CPresenceCacheClient @ 4 NONAME ; ## + _ZTV20CPresenceCacheClient @ 5 NONAME ; ## + diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/eabi/presencecacheecomhooku.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/eabi/presencecacheecomhooku.def Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + _Z24ImplementationGroupProxyRi @ 1 NONAME + diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/eabi/presencedatamodelhooku.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/eabi/presencedatamodelhooku.def Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + _Z24ImplementationGroupProxyRi @ 1 NONAME + diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/eabi/presencedatamodelu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/eabi/presencedatamodelu.def Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,247 @@ +EXPORTS + _ZN13DocumentUtils16InfoFilterUnionLER22CPresenceInfoFilterImpS1_ @ 1 NONAME + _ZN13DocumentUtils16InfoFilterUnionLERK13RPointerArrayI22CPresenceInfoFilterImpE @ 2 NONAME + _ZN13DocumentUtils29CollectFilteredPresenceInfoLCERK22CPresenceInfoFilterImpRK16CPresenceInfoImp @ 3 NONAME + _ZN16CPresenceInfoImp12InternalizeLER11RReadStream @ 4 NONAME + _ZN16CPresenceInfoImp15NewFromStreamLCER11RReadStream @ 5 NONAME + _ZN16CPresenceInfoImp4NewLEv @ 6 NONAME + _ZN16CPresenceInfoImp5NewLCEv @ 7 NONAME + _ZN18CPresenceDataCache12CleanExpiredEv @ 8 NONAME + _ZN18CPresenceDataCache14CleanResourcesER15MXIMPPscContext @ 9 NONAME + _ZN18CPresenceDataCache27BlockListSubscriptionItemLCEv @ 10 NONAME + _ZN18CPresenceDataCache27GroupListSubscriptionItemLCEv @ 11 NONAME + _ZN18CPresenceDataCache27PresenceConfigurationItemLCERK16CXIMPIdentityImp @ 12 NONAME + _ZN18CPresenceDataCache29OwnPresenceSubscriptionItemLCEv @ 13 NONAME + _ZN18CPresenceDataCache29WatcherListSubscriptionItemLCEv @ 14 NONAME + _ZN18CPresenceDataCache30GroupContentSubscriptionItemLCERK16CXIMPIdentityImp @ 15 NONAME + _ZN18CPresenceDataCache34GrantRequestListSubscriptionItemLCEv @ 16 NONAME + _ZN18CPresenceDataCache34GroupContentSubscriptionItemExistsERK16CXIMPIdentityImp @ 17 NONAME + _ZN18CPresenceDataCache36PresentityPresenceSubscriptionItemLCERK16CXIMPIdentityImp @ 18 NONAME + _ZN18CPresenceDataCache37PresenceToEveryoneConfigurationItemLCEv @ 19 NONAME + _ZN18CPresenceDataCache39GroupMembersPresenceConfigurationItemLCERK16CXIMPIdentityImp @ 20 NONAME + _ZN18CPresenceDataCache48PresentityGroupMembersPresenceSubscriptionItemLCERK16CXIMPIdentityImp @ 21 NONAME + _ZN18CPresenceDataCache4NewLER9MXIMPHost @ 22 NONAME + _ZN18CPresenceDataCache8RemoveMeI26CBlockListSubscriptionItemEEvRPT_S3_ @ 23 NONAME + _ZN18CPresenceDataCache8RemoveMeI26CGroupListSubscriptionItemEEvRPT_S3_ @ 24 NONAME + _ZN18CPresenceDataCache8RemoveMeI28COwnPresenceSubscriptionItemEEvRPT_S3_ @ 25 NONAME + _ZN18CPresenceDataCache8RemoveMeI28CWatcherListSubscriptionItemEEvRPT_S3_ @ 26 NONAME + _ZN18CPresenceDataCache8RemoveMeI33CGrantRequestListSubscriptionItemEEvRPT_S3_ @ 27 NONAME + _ZN18CPresenceDataCache8RemoveMeI36CPresenceToEveryoneConfigurationItemEEvRPT_S3_ @ 28 NONAME + _ZN20COwnPresenceEventImp4NewLEP29CXIMPDataSubscriptionStateImp @ 29 NONAME + _ZN20COwnPresenceEventImp5NewLCEP29CXIMPDataSubscriptionStateImp @ 30 NONAME + _ZN20CPresenceFilterStore10AssociateLERK16CXIMPIdentityImpP22CPresenceInfoFilterImp @ 31 NONAME + _ZN20CPresenceFilterStore12DisassociateERK16CXIMPIdentityImp @ 32 NONAME + _ZN20CPresenceFilterStore17FilterForIdentityERK16CXIMPIdentityImp @ 33 NONAME + _ZN20CPresenceFilterStore4NewLEv @ 34 NONAME + _ZN21CPresenceBlockInfoImp11SetIdentityEP16CXIMPIdentityImp @ 35 NONAME + _ZN21CPresenceBlockInfoImp12InternalizeLER11RReadStream @ 36 NONAME + _ZN21CPresenceBlockInfoImp13IdLinearOrderERKS_S1_ @ 37 NONAME + _ZN21CPresenceBlockInfoImp14SetDisplayNameEP7HBufC16 @ 38 NONAME + _ZN21CPresenceBlockInfoImp15NewFromStreamLCER11RReadStream @ 39 NONAME + _ZN21CPresenceBlockInfoImp4NewLEv @ 40 NONAME + _ZN21CPresenceBlockInfoImp5NewLCERK13MXIMPIdentityRK7TDesC16 @ 41 NONAME + _ZN21CPresenceBlockInfoImp5NewLCEv @ 42 NONAME + _ZN21CPresenceBuddyInfoImp12InternalizeLER11RReadStream @ 43 NONAME + _ZN21CPresenceBuddyInfoImp15NewFromStreamLCER11RReadStream @ 44 NONAME + _ZN21CPresenceBuddyInfoImp4NewLEv @ 45 NONAME + _ZN21CPresenceBuddyInfoImp5NewLCEv @ 46 NONAME + _ZN21CPresenceInfoFieldImp12InternalizeLER11RReadStream @ 47 NONAME + _ZN21CPresenceInfoFieldImp15NewFromStreamLCER11RReadStream @ 48 NONAME + _ZN21CPresenceInfoFieldImp5NewLCERK6TDesC8P19CXIMPApiDataObjBase @ 49 NONAME + _ZN21CPresenceInfoFieldImp5NewLCEv @ 50 NONAME + _ZN22CDevicePresenceInfoImp12InternalizeLER11RReadStream @ 51 NONAME + _ZN22CDevicePresenceInfoImp15NewFromStreamLCER11RReadStream @ 52 NONAME + _ZN22CDevicePresenceInfoImp5NewLCEv @ 53 NONAME + _ZN22CPersonPresenceInfoImp12InternalizeLER11RReadStream @ 54 NONAME + _ZN22CPersonPresenceInfoImp15NewFromStreamLCER11RReadStream @ 55 NONAME + _ZN22CPersonPresenceInfoImp5NewLCEv @ 56 NONAME + _ZN22CPresenceInfoFilterImp12InternalizeLER11RReadStream @ 57 NONAME + _ZN22CPresenceInfoFilterImp15NewFromStreamLCER11RReadStream @ 58 NONAME + _ZN22CPresenceInfoFilterImp4NewLEv @ 59 NONAME + _ZN22CPresenceInfoFilterImp5NewLCEv @ 60 NONAME + _ZN22CPresenceInfoFilterImp6UnionLERS_S0_ @ 61 NONAME + _ZN22CPresenceInfoFilterImp8ContainsERS_ @ 62 NONAME + _ZN22CPresenceInfoFilterImpeqERS_ @ 63 NONAME + _ZN22CPresenceInfoFilterImpneERS_ @ 64 NONAME + _ZN23CPresenceWatcherInfoImp11SetIdentityEP16CXIMPIdentityImp @ 65 NONAME + _ZN23CPresenceWatcherInfoImp12InternalizeLER11RReadStream @ 66 NONAME + _ZN23CPresenceWatcherInfoImp13IdLinearOrderERKS_S1_ @ 67 NONAME + _ZN23CPresenceWatcherInfoImp14SetDisplayNameEP7HBufC16 @ 68 NONAME + _ZN23CPresenceWatcherInfoImp15NewFromStreamLCER11RReadStream @ 69 NONAME + _ZN23CPresenceWatcherInfoImp4NewLEv @ 70 NONAME + _ZN23CPresenceWatcherInfoImp5NewLCEN20MPresenceWatcherInfo12TWatcherTypeERK13MXIMPIdentityRK7TDesC16 @ 71 NONAME + _ZN23CPresenceWatcherInfoImp5NewLCEv @ 72 NONAME + _ZN23CPresentityGroupInfoImp12InternalizeLER11RReadStream @ 73 NONAME + _ZN23CPresentityGroupInfoImp15NewFromStreamLCER11RReadStream @ 74 NONAME + _ZN23CPresentityGroupInfoImp18GroupIdLinearOrderERKS_S1_ @ 75 NONAME + _ZN23CPresentityGroupInfoImp4NewLEv @ 76 NONAME + _ZN23CPresentityGroupInfoImp5NewLCERK13MXIMPIdentityRK7TDesC16 @ 77 NONAME + _ZN23CPresentityGroupInfoImp5NewLCEv @ 78 NONAME + _ZN23CServicePresenceInfoImp12InternalizeLER11RReadStream @ 79 NONAME + _ZN23CServicePresenceInfoImp15NewFromStreamLCER11RReadStream @ 80 NONAME + _ZN23CServicePresenceInfoImp5NewLCEv @ 81 NONAME + _ZN25CPresenceBuddyInfoListImp12InternalizeLER11RReadStream @ 82 NONAME + _ZN25CPresenceBuddyInfoListImp13SetOwnObjectsEi @ 83 NONAME + _ZN25CPresenceBuddyInfoListImp15NewFromStreamLCER11RReadStream @ 84 NONAME + _ZN25CPresenceBuddyInfoListImp4NewLERK7TDesC16 @ 85 NONAME + _ZN25CPresenceBuddyInfoListImp5NewLCERK7TDesC16 @ 86 NONAME + _ZN25CPresenceBuddyInfoListImp9BlindAddLEP18MPresenceBuddyInfo @ 87 NONAME + _ZN25CPresenceObjectFactoryImp4NewLEv @ 88 NONAME + _ZN26CBlockListSubscriptionItem11SetBlockedLEP21CPresenceBlockInfoImp @ 89 NONAME + _ZN26CBlockListSubscriptionItem11SetNewListLEP22RXIMPObjOwningPtrArrayI21CPresenceBlockInfoImpE @ 90 NONAME + _ZN26CBlockListSubscriptionItem19SetCanceledBlockIdLEP16CXIMPIdentityImp @ 91 NONAME + _ZN26CBlockListSubscriptionItem5CleanEv @ 92 NONAME + _ZN26CGroupListSubscriptionItem11SetNewListLEP22RXIMPObjOwningPtrArrayI23CPresentityGroupInfoImpE @ 93 NONAME + _ZN26CGroupListSubscriptionItem15SetCreatedListLEP22RXIMPObjOwningPtrArrayI23CPresentityGroupInfoImpE @ 94 NONAME + _ZN26CGroupListSubscriptionItem15SetDeletedListLEP22RXIMPObjOwningPtrArrayI23CPresentityGroupInfoImpE @ 95 NONAME + _ZN26CGroupListSubscriptionItem5CleanEv @ 96 NONAME + _ZN26CPresenceBlockListEventImp5NewLCEP22RXIMPObjOwningPtrArrayI21CPresenceBlockInfoImpES3_S3_S3_P29CXIMPDataSubscriptionStateImp @ 97 NONAME + _ZN26CPresenceConfigurationItem11SetIdentityEP16CXIMPIdentityImp @ 98 NONAME + _ZN26CPresenceConfigurationItem13IdentityOrderEPK16CXIMPIdentityImpRKS_ @ 99 NONAME + _ZN26CPresenceConfigurationItem16ConfigurationPifEv @ 100 NONAME + _ZN26CPresenceConfigurationItem19SetConfigurationPifEP22CPresenceInfoFilterImp @ 101 NONAME + _ZN26CPresenceConfigurationItem34CollectConfigurationPifWithoutCtxLEP15MXIMPPscContext @ 102 NONAME + _ZN26CPresenceConfigurationItem5OrderERKS_S1_ @ 103 NONAME + _ZN27CPresentityPresenceEventImp4NewLEP29CXIMPDataSubscriptionStateImp @ 104 NONAME + _ZN27CPresentityPresenceEventImp5NewLCEP29CXIMPDataSubscriptionStateImp @ 105 NONAME + _ZN28COwnPresenceSubscriptionItem15SubscriptionPifEv @ 106 NONAME + _ZN28COwnPresenceSubscriptionItem16SetPresenceInfoLEP16CPresenceInfoImp @ 107 NONAME + _ZN28COwnPresenceSubscriptionItem18SetSubscriptionPifEP22CPresenceInfoFilterImp @ 108 NONAME + _ZN28COwnPresenceSubscriptionItem33CollectSubscriptionPifWithoutCtxLEP15MXIMPPscContext @ 109 NONAME + _ZN28CPresenceGrantRequestInfoImp11SetIdentityEP16CXIMPIdentityImp @ 110 NONAME + _ZN28CPresenceGrantRequestInfoImp12InternalizeLER11RReadStream @ 111 NONAME + _ZN28CPresenceGrantRequestInfoImp13IdLinearOrderERKS_S1_ @ 112 NONAME + _ZN28CPresenceGrantRequestInfoImp14SetDisplayNameEP7HBufC16 @ 113 NONAME + _ZN28CPresenceGrantRequestInfoImp15NewFromStreamLCER11RReadStream @ 114 NONAME + _ZN28CPresenceGrantRequestInfoImp4NewLEv @ 115 NONAME + _ZN28CPresenceGrantRequestInfoImp5NewLCERK13MXIMPIdentityRK7TDesC16 @ 116 NONAME + _ZN28CPresenceGrantRequestInfoImp5NewLCEv @ 117 NONAME + _ZN28CPresenceWatcherListEventImp5NewLCEP22RXIMPObjOwningPtrArrayI23CPresenceWatcherInfoImpES3_S3_P29CXIMPDataSubscriptionStateImp @ 118 NONAME + _ZN28CPresentityGroupListEventImp4NewLEP22RXIMPObjOwningPtrArrayI23CPresentityGroupInfoImpES3_S3_S3_P29CXIMPDataSubscriptionStateImp @ 119 NONAME + _ZN28CPresentityGroupListEventImp5NewLCEP22RXIMPObjOwningPtrArrayI23CPresentityGroupInfoImpES3_S3_P29CXIMPDataSubscriptionStateImp @ 120 NONAME + _ZN28CPresentityGroupListEventImp5NewLCEP22RXIMPObjOwningPtrArrayI23CPresentityGroupInfoImpES3_S3_S3_P29CXIMPDataSubscriptionStateImp @ 121 NONAME + _ZN28CWatcherListSubscriptionItem11SetNewListLEP22RXIMPObjOwningPtrArrayI23CPresenceWatcherInfoImpE @ 122 NONAME + _ZN28CWatcherListSubscriptionItem5CleanEv @ 123 NONAME + _ZN29CGroupContentSubscriptionItem11SetNewListLEP22RXIMPObjOwningPtrArrayI29CPresentityGroupMemberInfoImpE @ 124 NONAME + _ZN29CGroupContentSubscriptionItem13IdentityOrderEPK16CXIMPIdentityImpRKS_ @ 125 NONAME + _ZN29CGroupContentSubscriptionItem13SetAddedListLEP22RXIMPObjOwningPtrArrayI29CPresentityGroupMemberInfoImpE @ 126 NONAME + _ZN29CGroupContentSubscriptionItem15SetRemovedListLEP22RXIMPObjOwningPtrArrayI29CPresentityGroupMemberInfoImpE @ 127 NONAME + _ZN29CGroupContentSubscriptionItem21AddOrRenewSubscriberLEP15MXIMPPscContext @ 128 NONAME + _ZN29CGroupContentSubscriptionItem5CleanEv @ 129 NONAME + _ZN29CGroupContentSubscriptionItem5OrderERKS_S1_ @ 130 NONAME + _ZN29CPresentityGroupMemberInfoImp12InternalizeLER11RReadStream @ 131 NONAME + _ZN29CPresentityGroupMemberInfoImp15NewFromStreamLCER11RReadStream @ 132 NONAME + _ZN29CPresentityGroupMemberInfoImp18GroupIdLinearOrderERKS_S1_ @ 133 NONAME + _ZN29CPresentityGroupMemberInfoImp4NewLEv @ 134 NONAME + _ZN29CPresentityGroupMemberInfoImp5NewLCERK13MXIMPIdentityRK7TDesC16 @ 135 NONAME + _ZN29CPresentityGroupMemberInfoImp5NewLCEv @ 136 NONAME + _ZN30CPresenceInfoFieldValueEnumImp12InternalizeLER11RReadStream @ 137 NONAME + _ZN30CPresenceInfoFieldValueEnumImp15NewFromStreamLCER11RReadStream @ 138 NONAME + _ZN30CPresenceInfoFieldValueEnumImp5NewLCEv @ 139 NONAME + _ZN30CPresenceInfoFieldValueTextImp12InternalizeLER11RReadStream @ 140 NONAME + _ZN30CPresenceInfoFieldValueTextImp15NewFromStreamLCER11RReadStream @ 141 NONAME + _ZN30CPresenceInfoFieldValueTextImp5NewLCEi @ 142 NONAME + _ZN31CPresenceInfoFieldCollectionImp12InternalizeLER11RReadStream @ 143 NONAME + _ZN31CPresenceInfoFieldCollectionImp15NewFromStreamLCER11RReadStream @ 144 NONAME + _ZN31CPresenceInfoFieldCollectionImp5NewLCEv @ 145 NONAME + _ZN31CPresentityGroupContentEventImp4NewLER16CXIMPIdentityImpP22RXIMPObjOwningPtrArrayI29CPresentityGroupMemberInfoImpES5_S5_S5_P29CXIMPDataSubscriptionStateImp @ 146 NONAME + _ZN31CPresentityGroupContentEventImp5NewLCER16CXIMPIdentityImpP22RXIMPObjOwningPtrArrayI29CPresentityGroupMemberInfoImpES5_S5_P29CXIMPDataSubscriptionStateImp @ 147 NONAME + _ZN31CPresentityGroupContentEventImp5NewLCER16CXIMPIdentityImpP22RXIMPObjOwningPtrArrayI29CPresentityGroupMemberInfoImpES5_S5_S5_P29CXIMPDataSubscriptionStateImp @ 148 NONAME + _ZN32CPresenceInfoFieldValueBinaryImp12InternalizeLER11RReadStream @ 149 NONAME + _ZN32CPresenceInfoFieldValueBinaryImp15NewFromStreamLCER11RReadStream @ 150 NONAME + _ZN32CPresenceInfoFieldValueBinaryImp5NewLCEi @ 151 NONAME + _ZN33CGrantRequestListSubscriptionItem11SetNewListLEP22RXIMPObjOwningPtrArrayI28CPresenceGrantRequestInfoImpE @ 152 NONAME + _ZN33CGrantRequestListSubscriptionItem19SetReceivedRequestLEP28CPresenceGrantRequestInfoImp @ 153 NONAME + _ZN33CGrantRequestListSubscriptionItem20SetObsoletedRequestLEP16CXIMPIdentityImp @ 154 NONAME + _ZN33CGrantRequestListSubscriptionItem5CleanEv @ 155 NONAME + _ZN33CPresenceGrantRequestListEventImp5NewLCEP22RXIMPObjOwningPtrArrayI28CPresenceGrantRequestInfoImpES3_S3_P29CXIMPDataSubscriptionStateImp @ 156 NONAME + _ZN34CPresenceApiDataObjFactoryAccessor4NewLEv @ 157 NONAME + _ZN35CPresentityPresenceSubscriptionItem11SetIdentityEP16CXIMPIdentityImp @ 158 NONAME + _ZN35CPresentityPresenceSubscriptionItem13IdentityOrderEPK16CXIMPIdentityImpRKS_ @ 159 NONAME + _ZN35CPresentityPresenceSubscriptionItem15SubscriptionPifEv @ 160 NONAME + _ZN35CPresentityPresenceSubscriptionItem16SetGroupIdentityEP16CXIMPIdentityImp @ 161 NONAME + _ZN35CPresentityPresenceSubscriptionItem16SetPresenceInfoLEP16CPresenceInfoImp @ 162 NONAME + _ZN35CPresentityPresenceSubscriptionItem18SetSubscriptionPifEP22CPresenceInfoFilterImp @ 163 NONAME + _ZN35CPresentityPresenceSubscriptionItem33CollectSubscriptionPifWithoutCtxLEP15MXIMPPscContext @ 164 NONAME + _ZN35CPresentityPresenceSubscriptionItem5OrderERKS_S1_ @ 165 NONAME + _ZN36CPresenceToEveryoneConfigurationItem16ConfigurationPifEv @ 166 NONAME + _ZN36CPresenceToEveryoneConfigurationItem19SetConfigurationPifEP22CPresenceInfoFilterImp @ 167 NONAME + _ZN36CPresenceToEveryoneConfigurationItem34CollectConfigurationPifWithoutCtxLEP15MXIMPPscContext @ 168 NONAME + _ZN38CGroupMembersPresenceConfigurationItem11SetIdentityEP16CXIMPIdentityImp @ 169 NONAME + _ZN38CGroupMembersPresenceConfigurationItem13IdentityOrderEPK16CXIMPIdentityImpRKS_ @ 170 NONAME + _ZN38CGroupMembersPresenceConfigurationItem16AddConfiguratorLEP15MXIMPPscContext @ 171 NONAME + _ZN38CGroupMembersPresenceConfigurationItem16ConfigurationPifEv @ 172 NONAME + _ZN38CGroupMembersPresenceConfigurationItem18RemoveConfiguratorEP15MXIMPPscContext @ 173 NONAME + _ZN38CGroupMembersPresenceConfigurationItem19SetConfigurationPifEP22CPresenceInfoFilterImp @ 174 NONAME + _ZN38CGroupMembersPresenceConfigurationItem34CollectConfigurationPifWithoutCtxLEP15MXIMPPscContext @ 175 NONAME + _ZN38CGroupMembersPresenceConfigurationItem5OrderERKS_S1_ @ 176 NONAME + _ZN47CPresentityGroupMembersPresenceSubscriptionItem11SetIdentityEP16CXIMPIdentityImp @ 177 NONAME + _ZN47CPresentityGroupMembersPresenceSubscriptionItem13IdentityOrderEPK16CXIMPIdentityImpRKS_ @ 178 NONAME + _ZN47CPresentityGroupMembersPresenceSubscriptionItem14AddSubscriberLEP15MXIMPPscContext @ 179 NONAME + _ZN47CPresentityGroupMembersPresenceSubscriptionItem15SubscriptionPifEv @ 180 NONAME + _ZN47CPresentityGroupMembersPresenceSubscriptionItem16RemoveSubscriberEP15MXIMPPscContext @ 181 NONAME + _ZN47CPresentityGroupMembersPresenceSubscriptionItem16SetPresenceInfoLEP16CPresenceInfoImp @ 182 NONAME + _ZN47CPresentityGroupMembersPresenceSubscriptionItem18SetSubscriptionPifEP22CPresenceInfoFilterImp @ 183 NONAME + _ZN47CPresentityGroupMembersPresenceSubscriptionItem33CollectSubscriptionPifWithoutCtxLEP15MXIMPPscContext @ 184 NONAME + _ZN47CPresentityGroupMembersPresenceSubscriptionItem5OrderERKS_S1_ @ 185 NONAME + _ZNK16CPresenceInfoImp12ExternalizeLER12RWriteStream @ 186 NONAME + _ZNK16CPresenceInfoImp14FilteredInfoLCERK22CPresenceInfoFilterImp @ 187 NONAME + _ZNK18CPresenceDataCache32OwnPresenceDataSubscriptionStateEv @ 188 NONAME + _ZNK18CPresenceDataCache34PresenceBlockDataSubscriptionStateEv @ 189 NONAME + _ZNK18CPresenceDataCache39PresentityPresenceDataSubscriptionStateERK13MXIMPIdentity @ 190 NONAME + _ZNK18CPresenceDataCache40PresenceWatcherListDataSubscriptionStateEv @ 191 NONAME + _ZNK18CPresenceDataCache40PresentityGroupListDataSubscriptionStateEv @ 192 NONAME + _ZNK18CPresenceDataCache41PresenceGrantRequestDataSubscriptionStateEv @ 193 NONAME + _ZNK18CPresenceDataCache43PresentityGroupContentDataSubscriptionStateERK13MXIMPIdentity @ 194 NONAME + _ZNK21CPresenceBlockInfoImp11IdentityImpEv @ 195 NONAME + _ZNK21CPresenceBlockInfoImp12ExternalizeLER12RWriteStream @ 196 NONAME + _ZNK21CPresenceBuddyInfoImp12ExternalizeLER12RWriteStream @ 197 NONAME + _ZNK21CPresenceBuddyInfoImp14EqualsIdentityEPK18MPresenceBuddyInfo @ 198 NONAME + _ZNK22CPresenceInfoFilterImp12ExternalizeLER12RWriteStream @ 199 NONAME + _ZNK23CPresenceWatcherInfoImp11IdentityImpEv @ 200 NONAME + _ZNK23CPresentityGroupInfoImp8IdentityEv @ 201 NONAME + _ZNK25CPresenceBuddyInfoListImp12ExternalizeLER12RWriteStream @ 202 NONAME + _ZNK26CPresenceConfigurationItem8IdentityEv @ 203 NONAME + _ZNK28CPresenceGrantRequestInfoImp11IdentityImpEv @ 204 NONAME + _ZNK29CGroupContentSubscriptionItem18GroupMemberExistsLER29CPresentityGroupMemberInfoImp @ 205 NONAME + _ZNK29CGroupContentSubscriptionItem21IsGroupMemberUpdatedLER29CPresentityGroupMemberInfoImp @ 206 NONAME + _ZNK29CGroupContentSubscriptionItem7GroupIdEv @ 207 NONAME + _ZNK29CPresentityGroupMemberInfoImp11IdentityImpEv @ 208 NONAME + _ZNK35CPresentityPresenceSubscriptionItem13GroupIdentityEv @ 209 NONAME + _ZNK35CPresentityPresenceSubscriptionItem8IdentityEv @ 210 NONAME + _ZNK38CGroupMembersPresenceConfigurationItem8IdentityEv @ 211 NONAME + _ZNK47CPresentityGroupMembersPresenceSubscriptionItem8IdentityEv @ 212 NONAME + _ZTI18CPresenceDataCache @ 213 NONAME ; ## + _ZTI20CPresenceFilterStore @ 214 NONAME ; ## + _ZTI25CPresenceObjectFactoryImp @ 215 NONAME ; ## + _ZTI26CBlockListSubscriptionItem @ 216 NONAME ; ## + _ZTI26CGroupListSubscriptionItem @ 217 NONAME ; ## + _ZTI26CPresenceConfigurationItem @ 218 NONAME ; ## + _ZTI28COwnPresenceSubscriptionItem @ 219 NONAME ; ## + _ZTI28CWatcherListSubscriptionItem @ 220 NONAME ; ## + _ZTI29CGroupContentSubscriptionItem @ 221 NONAME ; ## + _ZTI33CGrantRequestListSubscriptionItem @ 222 NONAME ; ## + _ZTI35CPresentityPresenceSubscriptionItem @ 223 NONAME ; ## + _ZTI36CPresenceToEveryoneConfigurationItem @ 224 NONAME ; ## + _ZTI38CGroupMembersPresenceConfigurationItem @ 225 NONAME ; ## + _ZTI47CPresentityGroupMembersPresenceSubscriptionItem @ 226 NONAME ; ## + _ZTIN20CPresenceFilterStore27CPresenceFilterStoreMappingE @ 227 NONAME ; ## + _ZTIN22CPresenceInfoFilterImp12CFilterFieldE @ 228 NONAME ; ## + _ZTV18CPresenceDataCache @ 229 NONAME ; ## + _ZTV20CPresenceFilterStore @ 230 NONAME ; ## + _ZTV25CPresenceObjectFactoryImp @ 231 NONAME ; ## + _ZTV26CBlockListSubscriptionItem @ 232 NONAME ; ## + _ZTV26CGroupListSubscriptionItem @ 233 NONAME ; ## + _ZTV26CPresenceConfigurationItem @ 234 NONAME ; ## + _ZTV28COwnPresenceSubscriptionItem @ 235 NONAME ; ## + _ZTV28CWatcherListSubscriptionItem @ 236 NONAME ; ## + _ZTV29CGroupContentSubscriptionItem @ 237 NONAME ; ## + _ZTV33CGrantRequestListSubscriptionItem @ 238 NONAME ; ## + _ZTV35CPresentityPresenceSubscriptionItem @ 239 NONAME ; ## + _ZTV36CPresenceToEveryoneConfigurationItem @ 240 NONAME ; ## + _ZTV38CGroupMembersPresenceConfigurationItem @ 241 NONAME ; ## + _ZTV47CPresentityGroupMembersPresenceSubscriptionItem @ 242 NONAME ; ## + _ZTVN20CPresenceFilterStore27CPresenceFilterStoreMappingE @ 243 NONAME ; ## + _ZTVN22CPresenceInfoFilterImp12CFilterFieldE @ 244 NONAME ; ## + _ZThn4_NK21CPresenceBuddyInfoImp14EqualsIdentityEPK18MPresenceBuddyInfo @ 245 NONAME ; ## + diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/eabi/presenceecomhooku.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/eabi/presenceecomhooku.def Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + _Z24ImplementationGroupProxyRi @ 1 NONAME + diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/eabi/presencemanageru.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/eabi/presencemanageru.def Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + _ZN20CPresenceFeaturesImp4NewLEP12MXIMPContext @ 1 NONAME + diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/eabi/presenceoperationu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/eabi/presenceoperationu.def Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,181 @@ +EXPORTS + _ZN23COperationLaunchCleanerC1Ev @ 1 NONAME + _ZN23COperationLaunchCleanerC2Ev @ 2 NONAME + _ZN25CPresenceOperationFactory4NewLEv @ 3 NONAME + _ZN27COperationHandleOwnPresenceC1Ev @ 4 NONAME + _ZN27COperationHandleOwnPresenceC2Ev @ 5 NONAME + _ZN28COperationPublishOwnPresenceC1Ev @ 6 NONAME + _ZN28COperationPublishOwnPresenceC2Ev @ 7 NONAME + _ZN28COperationSubscribeBlockListC1Ev @ 8 NONAME + _ZN28COperationSubscribeBlockListC2Ev @ 9 NONAME + _ZN28COperationSubscribeGroupListC1Ev @ 10 NONAME + _ZN28COperationSubscribeGroupListC2Ev @ 11 NONAME + _ZN29COperationSetSubscriptionDataC1EN12NPresenceOps16TPresenceOpTypesE @ 12 NONAME + _ZN29COperationSetSubscriptionDataC2EN12NPresenceOps16TPresenceOpTypesE @ 13 NONAME + _ZN30COperationSubscribeOwnPresenceC1Ev @ 14 NONAME + _ZN30COperationSubscribeOwnPresenceC2Ev @ 15 NONAME + _ZN30COperationSubscribeWatcherListC1Ev @ 16 NONAME + _ZN30COperationSubscribeWatcherListC2Ev @ 17 NONAME + _ZN30COperationUnsubscribeBlockListC1Ev @ 18 NONAME + _ZN30COperationUnsubscribeBlockListC2Ev @ 19 NONAME + _ZN30COperationUnsubscribeGroupListC1Ev @ 20 NONAME + _ZN30COperationUnsubscribeGroupListC2Ev @ 21 NONAME + _ZN31COperationCreatePresentityGroupC1Ev @ 22 NONAME + _ZN31COperationCreatePresentityGroupC2Ev @ 23 NONAME + _ZN31COperationDeletePresentityGroupC1Ev @ 24 NONAME + _ZN31COperationDeletePresentityGroupC2Ev @ 25 NONAME + _ZN31COperationSubscribeGroupContentC1Ev @ 26 NONAME + _ZN31COperationSubscribeGroupContentC2Ev @ 27 NONAME + _ZN32COperationHandlePresenceBlockingC1Ei @ 28 NONAME + _ZN32COperationHandlePresenceBlockingC2Ei @ 29 NONAME + _ZN32COperationHandlePresentityGroupsC1EN12NPresenceOps16TPresenceOpTypesE @ 30 NONAME + _ZN32COperationHandlePresentityGroupsC2EN12NPresenceOps16TPresenceOpTypesE @ 31 NONAME + _ZN32COperationUnsubscribeOwnPresenceC1Ev @ 32 NONAME + _ZN32COperationUnsubscribeOwnPresenceC2Ev @ 33 NONAME + _ZN32COperationUnsubscribeWatcherListC1Ev @ 34 NONAME + _ZN32COperationUnsubscribeWatcherListC2Ev @ 35 NONAME + _ZN33COperationGrantPresenceToEveryoneC1Ev @ 36 NONAME + _ZN33COperationGrantPresenceToEveryoneC2Ev @ 37 NONAME + _ZN33COperationUnsubscribeGroupContentC1Ev @ 38 NONAME + _ZN33COperationUnsubscribeGroupContentC2Ev @ 39 NONAME + _ZN34COperationAddPresentityGroupMemberC1Ev @ 40 NONAME + _ZN34COperationAddPresentityGroupMemberC2Ev @ 41 NONAME + _ZN34COperationHandlePresentityPresenceC1Ei @ 42 NONAME + _ZN34COperationHandlePresentityPresenceC2Ei @ 43 NONAME + _ZN35COperationGrantPresenceToPresentityC1Ev @ 44 NONAME + _ZN35COperationGrantPresenceToPresentityC2Ev @ 45 NONAME + _ZN35COperationHandlePresenceWatcherListC1Ev @ 46 NONAME + _ZN35COperationHandlePresenceWatcherListC2Ev @ 47 NONAME + _ZN35COperationSubscribeGrantRequestListC1Ev @ 48 NONAME + _ZN35COperationSubscribeGrantRequestListC2Ev @ 49 NONAME + _ZN36COperationBlockPresenceForPresentityC1Ev @ 50 NONAME + _ZN36COperationBlockPresenceForPresentityC2Ev @ 51 NONAME + _ZN37COperationHandlePresenceGrantRequestsC1Ei @ 52 NONAME + _ZN37COperationHandlePresenceGrantRequestsC2Ei @ 53 NONAME + _ZN37COperationRemovePresentityGroupMemberC1Ev @ 54 NONAME + _ZN37COperationRemovePresentityGroupMemberC2Ev @ 55 NONAME + _ZN37COperationSubscribePresentityPresenceC1Ev @ 56 NONAME + _ZN37COperationSubscribePresentityPresenceC2Ev @ 57 NONAME + _ZN37COperationSynthesiseSubscriptionEventC1ENS_17TSubscriptionTypeEi @ 58 NONAME + _ZN37COperationSynthesiseSubscriptionEventC2ENS_17TSubscriptionTypeEi @ 59 NONAME + _ZN37COperationUnsubscribeGrantRequestListC1Ev @ 60 NONAME + _ZN37COperationUnsubscribeGrantRequestListC2Ev @ 61 NONAME + _ZN38COperationHandlePresentityGroupContentC1Ev @ 62 NONAME + _ZN38COperationHandlePresentityGroupContentC2Ev @ 63 NONAME + _ZN38COperationWithdrawPresenceFromEveryoneC1Ev @ 64 NONAME + _ZN38COperationWithdrawPresenceFromEveryoneC2Ev @ 65 NONAME + _ZN39COperationUnsubscribePresentityPresenceC1Ev @ 66 NONAME + _ZN39COperationUnsubscribePresentityPresenceC2Ev @ 67 NONAME + _ZN40COperationWithdrawPresenceFromPresentityC1Ev @ 68 NONAME + _ZN40COperationWithdrawPresenceFromPresentityC2Ev @ 69 NONAME + _ZN42COperationHandlePresentityGroupMemberAddedC1Ev @ 70 NONAME + _ZN42COperationHandlePresentityGroupMemberAddedC2Ev @ 71 NONAME + _ZN42COperationUpdatePresentityGroupDisplayNameC1Ev @ 72 NONAME + _ZN42COperationUpdatePresentityGroupDisplayNameC2Ev @ 73 NONAME + _ZN43COperationCancelPresenceBlockFromPresentityC1Ev @ 74 NONAME + _ZN43COperationCancelPresenceBlockFromPresentityC2Ev @ 75 NONAME + _ZN44COperationHandlePresentityGroupMemberRemovedC1Ev @ 76 NONAME + _ZN44COperationHandlePresentityGroupMemberRemovedC2Ev @ 77 NONAME + _ZN47COperationGrantPresenceToPresentityGroupMembersC1Ev @ 78 NONAME + _ZN47COperationGrantPresenceToPresentityGroupMembersC2Ev @ 79 NONAME + _ZN48COperationUpdatePresentityGroupMemberDisplayNameC1Ev @ 80 NONAME + _ZN48COperationUpdatePresentityGroupMemberDisplayNameC2Ev @ 81 NONAME + _ZN49COperationSubscribePresentityGroupMembersPresenceC1Ev @ 82 NONAME + _ZN49COperationSubscribePresentityGroupMembersPresenceC2Ev @ 83 NONAME + _ZN51COperationUnsubscribePresentityGroupMembersPresenceC1Ev @ 84 NONAME + _ZN51COperationUnsubscribePresentityGroupMembersPresenceC2Ev @ 85 NONAME + _ZN52COperationWithdrawPresenceFromPresentityGroupMembersC1Ev @ 86 NONAME + _ZN52COperationWithdrawPresenceFromPresentityGroupMembersC2Ev @ 87 NONAME + _ZN55COperationHandlePresentityGroupMemberDisplayNameUpdatedC1Ev @ 88 NONAME + _ZN55COperationHandlePresentityGroupMemberDisplayNameUpdatedC2Ev @ 89 NONAME + _ZTI23COperationLaunchCleaner @ 90 NONAME ; ## + _ZTI25CPresenceOperationFactory @ 91 NONAME ; ## + _ZTI27COperationHandleOwnPresence @ 92 NONAME ; ## + _ZTI28COperationPublishOwnPresence @ 93 NONAME ; ## + _ZTI28COperationSubscribeBlockList @ 94 NONAME ; ## + _ZTI28COperationSubscribeGroupList @ 95 NONAME ; ## + _ZTI29COperationSetSubscriptionData @ 96 NONAME ; ## + _ZTI30COperationSubscribeOwnPresence @ 97 NONAME ; ## + _ZTI30COperationSubscribeWatcherList @ 98 NONAME ; ## + _ZTI30COperationUnsubscribeBlockList @ 99 NONAME ; ## + _ZTI30COperationUnsubscribeGroupList @ 100 NONAME ; ## + _ZTI31COperationCreatePresentityGroup @ 101 NONAME ; ## + _ZTI31COperationDeletePresentityGroup @ 102 NONAME ; ## + _ZTI31COperationSubscribeGroupContent @ 103 NONAME ; ## + _ZTI32COperationHandlePresenceBlocking @ 104 NONAME ; ## + _ZTI32COperationHandlePresentityGroups @ 105 NONAME ; ## + _ZTI32COperationUnsubscribeOwnPresence @ 106 NONAME ; ## + _ZTI32COperationUnsubscribeWatcherList @ 107 NONAME ; ## + _ZTI33COperationGrantPresenceToEveryone @ 108 NONAME ; ## + _ZTI33COperationUnsubscribeGroupContent @ 109 NONAME ; ## + _ZTI34COperationAddPresentityGroupMember @ 110 NONAME ; ## + _ZTI34COperationHandlePresentityPresence @ 111 NONAME ; ## + _ZTI35COperationGrantPresenceToPresentity @ 112 NONAME ; ## + _ZTI35COperationHandlePresenceWatcherList @ 113 NONAME ; ## + _ZTI35COperationSubscribeGrantRequestList @ 114 NONAME ; ## + _ZTI36COperationBlockPresenceForPresentity @ 115 NONAME ; ## + _ZTI37COperationHandlePresenceGrantRequests @ 116 NONAME ; ## + _ZTI37COperationRemovePresentityGroupMember @ 117 NONAME ; ## + _ZTI37COperationSubscribePresentityPresence @ 118 NONAME ; ## + _ZTI37COperationSynthesiseSubscriptionEvent @ 119 NONAME ; ## + _ZTI37COperationUnsubscribeGrantRequestList @ 120 NONAME ; ## + _ZTI38COperationHandlePresentityGroupContent @ 121 NONAME ; ## + _ZTI38COperationWithdrawPresenceFromEveryone @ 122 NONAME ; ## + _ZTI39COperationUnsubscribePresentityPresence @ 123 NONAME ; ## + _ZTI40COperationWithdrawPresenceFromPresentity @ 124 NONAME ; ## + _ZTI42COperationHandlePresentityGroupMemberAdded @ 125 NONAME ; ## + _ZTI42COperationUpdatePresentityGroupDisplayName @ 126 NONAME ; ## + _ZTI43COperationCancelPresenceBlockFromPresentity @ 127 NONAME ; ## + _ZTI44COperationHandlePresentityGroupMemberRemoved @ 128 NONAME ; ## + _ZTI47COperationGrantPresenceToPresentityGroupMembers @ 129 NONAME ; ## + _ZTI48COperationUpdatePresentityGroupMemberDisplayName @ 130 NONAME ; ## + _ZTI49COperationSubscribePresentityGroupMembersPresence @ 131 NONAME ; ## + _ZTI51COperationUnsubscribePresentityGroupMembersPresence @ 132 NONAME ; ## + _ZTI52COperationWithdrawPresenceFromPresentityGroupMembers @ 133 NONAME ; ## + _ZTI55COperationHandlePresentityGroupMemberDisplayNameUpdated @ 134 NONAME ; ## + _ZTV23COperationLaunchCleaner @ 135 NONAME ; ## + _ZTV25CPresenceOperationFactory @ 136 NONAME ; ## + _ZTV27COperationHandleOwnPresence @ 137 NONAME ; ## + _ZTV28COperationPublishOwnPresence @ 138 NONAME ; ## + _ZTV28COperationSubscribeBlockList @ 139 NONAME ; ## + _ZTV28COperationSubscribeGroupList @ 140 NONAME ; ## + _ZTV29COperationSetSubscriptionData @ 141 NONAME ; ## + _ZTV30COperationSubscribeOwnPresence @ 142 NONAME ; ## + _ZTV30COperationSubscribeWatcherList @ 143 NONAME ; ## + _ZTV30COperationUnsubscribeBlockList @ 144 NONAME ; ## + _ZTV30COperationUnsubscribeGroupList @ 145 NONAME ; ## + _ZTV31COperationCreatePresentityGroup @ 146 NONAME ; ## + _ZTV31COperationDeletePresentityGroup @ 147 NONAME ; ## + _ZTV31COperationSubscribeGroupContent @ 148 NONAME ; ## + _ZTV32COperationHandlePresenceBlocking @ 149 NONAME ; ## + _ZTV32COperationHandlePresentityGroups @ 150 NONAME ; ## + _ZTV32COperationUnsubscribeOwnPresence @ 151 NONAME ; ## + _ZTV32COperationUnsubscribeWatcherList @ 152 NONAME ; ## + _ZTV33COperationGrantPresenceToEveryone @ 153 NONAME ; ## + _ZTV33COperationUnsubscribeGroupContent @ 154 NONAME ; ## + _ZTV34COperationAddPresentityGroupMember @ 155 NONAME ; ## + _ZTV34COperationHandlePresentityPresence @ 156 NONAME ; ## + _ZTV35COperationGrantPresenceToPresentity @ 157 NONAME ; ## + _ZTV35COperationHandlePresenceWatcherList @ 158 NONAME ; ## + _ZTV35COperationSubscribeGrantRequestList @ 159 NONAME ; ## + _ZTV36COperationBlockPresenceForPresentity @ 160 NONAME ; ## + _ZTV37COperationHandlePresenceGrantRequests @ 161 NONAME ; ## + _ZTV37COperationRemovePresentityGroupMember @ 162 NONAME ; ## + _ZTV37COperationSubscribePresentityPresence @ 163 NONAME ; ## + _ZTV37COperationSynthesiseSubscriptionEvent @ 164 NONAME ; ## + _ZTV37COperationUnsubscribeGrantRequestList @ 165 NONAME ; ## + _ZTV38COperationHandlePresentityGroupContent @ 166 NONAME ; ## + _ZTV38COperationWithdrawPresenceFromEveryone @ 167 NONAME ; ## + _ZTV39COperationUnsubscribePresentityPresence @ 168 NONAME ; ## + _ZTV40COperationWithdrawPresenceFromPresentity @ 169 NONAME ; ## + _ZTV42COperationHandlePresentityGroupMemberAdded @ 170 NONAME ; ## + _ZTV42COperationUpdatePresentityGroupDisplayName @ 171 NONAME ; ## + _ZTV43COperationCancelPresenceBlockFromPresentity @ 172 NONAME ; ## + _ZTV44COperationHandlePresentityGroupMemberRemoved @ 173 NONAME ; ## + _ZTV47COperationGrantPresenceToPresentityGroupMembers @ 174 NONAME ; ## + _ZTV48COperationUpdatePresentityGroupMemberDisplayName @ 175 NONAME ; ## + _ZTV49COperationSubscribePresentityGroupMembersPresence @ 176 NONAME ; ## + _ZTV51COperationUnsubscribePresentityGroupMembersPresence @ 177 NONAME ; ## + _ZTV52COperationWithdrawPresenceFromPresentityGroupMembers @ 178 NONAME ; ## + _ZTV55COperationHandlePresentityGroupMemberDisplayNameUpdated @ 179 NONAME ; ## + diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/group/bld.inf Thu Dec 17 08:54:49 2009 +0200 @@ -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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Build information file for project XIMP Framework Presence +* +*/ + + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +PRJ_MMPFILES +presencedatamodel.mmp +presencemanager.mmp + +presenceecomhook.mmp +presenceoperation.mmp +presencedatamodelhook.mmp + +presencecacheserver.mmp +presencecacheclient.mmp +presencecacheecomhook.mmp + +PRJ_TESTMMPFILES + +PRJ_TESTEXPORTS + diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/group/presencecacheclient.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/group/presencecacheclient.mmp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,62 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project definition file for Presence Cache Client +* +*/ + +#include +#include +#include "presencedlluids.hrh" + + + +TARGET presencecacheclient.dll +TARGETTYPE dll +UID XIMP_PRESENCE_DLL_UID_STATIC_INTERFACE XIMP_DLL_UID_PRESENCE_CACHE_CLIENT + +CAPABILITY CAP_GENERAL_DLL +VENDORID VID_DEFAULT + +// --------------------------------------------------------------------------- +SOURCEPATH ../srcpresencecache/presencecacheclient + +SOURCE presencecacheclient.cpp +SOURCE presencecacheclientnotification.cpp + +USERINCLUDE ../srcpresencecache/presencecacheclient +USERINCLUDE ../srcpresencecache/presencecacheserver +USERINCLUDE ../../core/srcdatamodel +USERINCLUDE ../../core/srcutils +USERINCLUDE ../srcpresencedatamodel +USERINCLUDE ../srcpresencedatamodel/presenceinfo +USERINCLUDE ../srcpresencedatamodel/presencepublishing +USERINCLUDE ../srcpresencedatamodel/presencecache + +MW_LAYER_SYSTEMINCLUDE + +LIBRARY euser.lib +LIBRARY ecom.lib +LIBRARY estor.lib // streams +LIBRARY ximputils.lib +LIBRARY presencedatamodel.lib +LIBRARY ximpdatamodel.lib + +#if defined( ARMCC ) +DEFFILE ../eabi/ +#elif defined ( WINSCW ) +deffile ../bwins/ +#endif + +// End of file + diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/group/presencecacheecomhook.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/group/presencecacheecomhook.mmp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,58 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project definition file for ECom Hook +* +*/ + +#include +#include +#include "presencedlluids.hrh" + + +TARGET presencecacheecomhook.dll +CAPABILITY CAP_ECOM_PLUGIN +TARGETTYPE PLUGIN +UID XIMP_PRESENCE_DLL_UID_ECOM_PLUGIN XIMP_DLL_UID_PRESENCE_CACHE_HOOK +VENDORID VID_DEFAULT + + +SOURCEPATH ../srcpresencecache/presencecacheecomhook +START RESOURCE presencecacheecomhook.rss +TARGET presencecacheecomhook.rsc +END + + +SOURCEPATH ../srcpresencecache/presencecacheecomhook +SOURCE presencecacheecomhook.cpp + + +USERINCLUDE ../srcpresencecache/presencecacheecomhook +USERINCLUDE ../srcpresencecache/presencecacheclient +USERINCLUDE ../srcpresencecache/presencecacheserver +USERINCLUDE ../srcpresencedatamodel +USERINCLUDE . + +MW_LAYER_SYSTEMINCLUDE + + +LIBRARY euser.lib +LIBRARY presencecacheclient.lib +LIBRARY ecom.lib + +#if defined( ARMCC ) +DEFFILE ../eabi/ +#elif defined ( WINSCW ) +deffile ../bwins/ +#endif + diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/group/presencecacheserver.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/group/presencecacheserver.mmp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,61 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project definition file for Presence Cache Server +* +*/ + +#include +#include +#include "presencedlluids.hrh" + + +TARGET presencecacheserver.exe +TARGETTYPE exe +UID XIMP_PRESENCE_DLL_UID_STATIC_INTERFACE XIMP_DLL_UID_PRESENCE_CACHE_SERVER + +CAPABILITY CAP_SERVER +VENDORID VID_DEFAULT + + +SOURCEPATH ../srcpresencecache/presencecacheserver +SOURCE presencecacheserver.cpp +SOURCE presencecachesession.cpp +SOURCE presencecachebuddystore.cpp +SOURCE presencecacheservicestore.cpp + + +USERINCLUDE ../srcpresencecache/presencecacheserver +USERINCLUDE ../srcpresencecache/presencecacheclient +USERINCLUDE ../srcpresencedatamodel/presencepublishing +USERINCLUDE ../srcpresencedatamodel/presenceinfo +USERINCLUDE ../srcpresencedatamodel +USERINCLUDE ../srcpresencedatamodel/presencecache +USERINCLUDE ../../core/srcdatamodel +USERINCLUDE ../../core/srcutils + +SYSTEMINCLUDE /epoc32/include/ecom + +MW_LAYER_SYSTEMINCLUDE + + +LIBRARY euser.lib +LIBRARY flogger.lib +LIBRARY ximputils.lib +LIBRARY estor.lib // streams +LIBRARY presencedatamodel.lib +LIBRARY ximpdatamodel.lib +LIBRARY ecom.lib + +// End of file + diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/group/presencedatamodel.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/group/presencedatamodel.mmp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,181 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project definition file for Presence Data Model +* +*/ + +#include +#include +#include "../../group/ximpdlluids.hrh" + + + +TARGET presencedatamodel.dll +TARGETTYPE dll +UID XIMP_DLL_UID_STATIC_INTERFACE XIMP_DLL_UID_COMMON + +CAPABILITY CAP_GENERAL_DLL +VENDORID VID_DEFAULT + + + + +// --------------------------------------------------------------------------- +SOURCEPATH ../srcpresencedatamodel/presentitygroups +// --------------------------------------------------------------------------- +// Subscription items +SOURCE grouplistsubscriptionitem.cpp +SOURCE groupcontentsubscriptionitem.cpp + +// API data objects +SOURCE presentitygroupinfoimp.cpp +SOURCE presentitygroupmemberinfoimp.cpp + +// API data events +SOURCE presentitygrouplisteventimp.cpp +SOURCE presentitygroupcontenteventimp.cpp + + + + +// --------------------------------------------------------------------------- +SOURCEPATH ../srcpresencedatamodel/presencewatching +// --------------------------------------------------------------------------- +// Subscription items +SOURCE presentitypresencesubscriptionitem.cpp +SOURCE presentitygroupmemberspresencesubscriptionitem.cpp + +// API data events +SOURCE presentitypresenceeventimp.cpp + + + + +// --------------------------------------------------------------------------- +SOURCEPATH ../srcpresencedatamodel/presenceauthorization +// --------------------------------------------------------------------------- +// Subscription items +SOURCE blocklistsubscriptionitem.cpp +SOURCE grantrequestlistsubscriptionitem.cpp + +// Configuration items +SOURCE presenceconfigurationitem.cpp +SOURCE presencetoeveryoneconfigurationitem.cpp +SOURCE groupmemberspresenceconfigurationitem.cpp + +// API data objects +SOURCE presenceblockinfoimp.cpp +SOURCE presencegrantrequestinfoimp.cpp + +// API data events +SOURCE presenceblocklisteventimp.cpp +SOURCE presencegrantrequestlisteventimp.cpp + + + + +// --------------------------------------------------------------------------- +SOURCEPATH ../srcpresencedatamodel/presencepublishing +// --------------------------------------------------------------------------- +// Subscription items +SOURCE ownpresencesubscriptionitem.cpp +SOURCE watcherlistsubscriptionitem.cpp + +// API data objects +SOURCE presencewatcherinfoimp.cpp + + +// API data events +SOURCE ownpresenceeventimp.cpp +SOURCE presencewatcherlisteventimp.cpp + + +// Presence information +SOURCE documentutils.cpp + + +// --------------------------------------------------------------------------- +SOURCEPATH ../srcpresencedatamodel/presenceinfo +// --------------------------------------------------------------------------- + +// presence info API +SOURCE presenceinfofieldimp.cpp +SOURCE presenceinfofieldcollectionimp.cpp +SOURCE presenceinfofieldvaluetextimp.cpp +SOURCE presenceinfofieldvaluebinaryimp.cpp +SOURCE presenceinfofieldvalueenumimp.cpp +SOURCE devicepresenceinfoimp.cpp +SOURCE personpresenceinfoimp.cpp +SOURCE servicepresenceinfoimp.cpp +SOURCE presenceinfoimp.cpp +SOURCE presenceinfofilterimp.cpp + +// --------------------------------------------------------------------------- +SOURCEPATH ../srcpresencedatamodel/presencecache +// --------------------------------------------------------------------------- + +SOURCE presencebuddyinfoimp.cpp +SOURCE presencebuddyinfolistimp.cpp + +// --------------------------------------------------------------------------- +SOURCEPATH ../srcpresencedatamodel +// --------------------------------------------------------------------------- +SOURCE presencedatacacheimp.cpp +SOURCE presenceobjectfactoryimp.cpp +// filter store +SOURCE presencefilterstore.cpp + +SOURCE presenceapidataobjfactory.cpp +SOURCE presenceeventcodec.cpp + +SOURCE presenceapidataobjfactoryaccessor.cpp + + +USERINCLUDE ../../core/srcdatamodel +USERINCLUDE ../../core/srcprocessor +USERINCLUDE ../../core/srcoperations +USERINCLUDE ../../core/srcutils + + +USERINCLUDE ../srcpresencedatamodel +USERINCLUDE ../srcpresencedatamodel/presentitygroups +USERINCLUDE ../srcpresencedatamodel/presencewatching +USERINCLUDE ../srcpresencedatamodel/presenceauthorization +USERINCLUDE ../srcpresencedatamodel/presencepublishing +USERINCLUDE ../srcpresencedatamodel/presenceinfo +USERINCLUDE ../srcpresencedatamodel/presencecache +USERINCLUDE ../group + +// TODO remove unnecessary +SYSTEMINCLUDE ../../inc/core/base +SYSTEMINCLUDE ../../inc/core/datamodel +SYSTEMINCLUDE ../../inc/core/protocolplugin +SYSTEMINCLUDE ../../inc/core/protocolpluginhost +SYSTEMINCLUDE ../../inc/presence/presencedatamodel +SYSTEMINCLUDE ../../inc/presence/presencemanagement +SYSTEMINCLUDE ../../inc/presence/presenceprotocolplugin +SYSTEMINCLUDE ../../inc/presence/presenceprotocolpluginhost +MW_LAYER_SYSTEMINCLUDE + + +LIBRARY euser.lib +LIBRARY bafl.lib +LIBRARY estor.lib +LIBRARY ximputils.lib +LIBRARY ximpdatamodel.lib +LIBRARY ecom.lib + + + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/group/presencedatamodelhook.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/group/presencedatamodelhook.mmp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,60 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project definition file for Presence Event Codec ECom Hook +* +*/ + +#include +#include +#include "presencedlluids.hrh" + + + +TARGET presencedatamodelhook.dll +CAPABILITY CAP_ECOM_PLUGIN +TARGETTYPE PLUGIN +UID XIMP_PRESENCE_DLL_UID_ECOM_PLUGIN XIMP_DLL_UID_PRESENCE_DATAMODEL_HOOK +VENDORID VID_DEFAULT + + +SOURCEPATH ../srcpresencedatamodel/presencedatamodelhook +START RESOURCE presencedatamodelhook.rss +TARGET presencedatamodelhook.rsc +END + + +SOURCEPATH ../srcpresencedatamodel/presencedatamodelhook +SOURCE presencedatamodelhook.cpp + + +USERINCLUDE . +USERINCLUDE ../srcpresencedatamodel/presencedatamodelhook +USERINCLUDE ../srcpresencedatamodel +USERINCLUDE ../../core/srcdatamodel +//USERINCLUDE ../../group + + +//SYSTEMINCLUDE ../../inc/presence/presencemanagement +MW_LAYER_SYSTEMINCLUDE + + +LIBRARY euser.lib +LIBRARY presencedatamodel.lib +LIBRARY ecom.lib + +#if defined( ARMCC ) +DEFFILE ../eabi/ +#elif defined ( WINSCW ) +deffile ../bwins/ +#endif \ No newline at end of file diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/group/presencedlluids.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/group/presencedlluids.hrh Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,62 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework Presence DLL uids +* +*/ + +#ifndef PRESENCEDLLUIDS_HRH +#define PRESENCEDLLUIDS_HRH + + +// ----------------------------------------------------------------------------- +// Common dll uids +// ----------------------------------------------------------------------------- +// +#define XIMP_PRESENCE_DLL_UID_STATIC_INTERFACE 0x1000008d +#define XIMP_PRESENCE_DLL_UID_ECOM_PLUGIN 0x10009D8D + +// ----------------------------------------------------------------------------- +// ECOM implementation UID +// ----------------------------------------------------------------------------- +// +#define XIMP_ECOM_IMPLEMENTATION_UID_PRESENCE_INTERFACE 0x2000B186 + +#define XIMP_ECOM_IMPL_UID_PRESENCE_CACHE_READER 0x2000B4EE +#define XIMP_ECOM_IMPL_UID_PRESENCE_CACHE_WRITER 0x2000B4F0 + +// Factory interface for internal data structures +#define XIMP_ECOM_IMPL_UID_PRESENCE_DATAMODEL_INTERFACE 0x2000B197 + +// ----------------------------------------------------------------------------- +// Other dll uids +// ----------------------------------------------------------------------------- +// +#define XIMP_DLL_UID_PRESENCE_HOOK 0x2000B1AE +#define XIMP_DLL_UID_PRESENCE_MANAGER 0x2000B1AF +#define XIMP_DLL_UID_PRESENCE_DATAMODEL_HOOK 0x2000B198 +#define XIMP_DLL_UID_PRESENCE_CACHE_HOOK 0x2000B4E9 +#define XIMP_DLL_UID_PRESENCE_CACHE_CLIENT 0x2000B4EA +#define XIMP_DLL_UID_PRESENCE_CACHE_SERVER 0x2000B4EB + +// Still have spare UIDs 0x2000B4EF, + +// ----------------------------------------------------------------------------- +// ECOM Interface UIDs +// ----------------------------------------------------------------------------- +// TODO: move it to the core side +#define XIMP_ECOM_IF_UID_PRESENCE_EVENT_CODEC_INTERFACE 0x2000B199 + +#endif // PRESENCEDLLUIDS_HRH + + diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/group/presenceecomhook.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/group/presenceecomhook.mmp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,60 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project definition file for ECom Hook +* +*/ + +#include +#include +#include "../../group/ximpdlluids.hrh" + + + +TARGET presenceecomhook.dll +CAPABILITY CAP_ECOM_PLUGIN +TARGETTYPE PLUGIN +UID XIMP_DLL_UID_ECOM_PLUGIN XIMP_DLL_UID_PRESENCE_HOOK +VENDORID VID_DEFAULT + + +SOURCEPATH ../srcpresencefrontend/srcecomhook +START RESOURCE presenceecomhook.rss +TARGET presenceecomhook.rsc +END + + +SOURCEPATH ../srcpresencefrontend/srcecomhook +SOURCE presenceecomhook.cpp + + +USERINCLUDE ../srcpresencefrontend/srcecomhook +USERINCLUDE ../srcpresencefrontend/srcpresencemanager +USERINCLUDE ../srcpresencedatamodel +USERINCLUDE ../../core/srcdatamodel +USERINCLUDE ../../group + + +SYSTEMINCLUDE ../../inc/presence/presencemanagement +MW_LAYER_SYSTEMINCLUDE + + +LIBRARY euser.lib +LIBRARY presencemanager.lib +LIBRARY ecom.lib + +#if defined( ARMCC ) +DEFFILE ../eabi/ +#elif defined ( WINSCW ) +deffile ../bwins/ +#endif \ No newline at end of file diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/group/presencemanager.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/group/presencemanager.mmp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,75 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project definition file for Presence Manager +* +*/ + +#include +#include +#include "../../group/ximpdlluids.hrh" + + + +TARGET presencemanager.dll +TARGETTYPE dll +UID XIMP_DLL_UID_STATIC_INTERFACE XIMP_DLL_UID_PRESENCE_MANAGER + +CAPABILITY CAP_GENERAL_DLL +VENDORID VID_DEFAULT + + +SOURCEPATH ../srcpresencefrontend/srcpresencemanager + +SOURCE presencepublishingimp.cpp +SOURCE presentitygroupsimp.cpp +SOURCE presencewatchingimp.cpp +SOURCE presenceauthorizationimp.cpp +SOURCE presencefeaturesimp.cpp + +USERINCLUDE ../../core/srcfrontend/srcmanager +USERINCLUDE ../srcpresenceoperations +USERINCLUDE ../../core/srcutils +USERINCLUDE ../../core/srcdatamodel +USERINCLUDE ../../group +USERINCLUDE ../srcpresencedatamodel +USERINCLUDE ../srcpresencedatamodel/presentitygroups +USERINCLUDE ../srcpresencedatamodel/presencewatching +USERINCLUDE ../srcpresencedatamodel/presenceauthorization +USERINCLUDE ../srcpresencedatamodel/presencepublishing + +//USERINCLUDE ../../core/inc +//SYSTEMINCLUDE ../../inc/base +//SYSTEMINCLUDE ../../inc/datamodel +SYSTEMINCLUDE ../../inc/presence/presencemanagement +SYSTEMINCLUDE ../../inc/core/management + +MW_LAYER_SYSTEMINCLUDE + + +LIBRARY euser.lib +LIBRARY ecom.lib +LIBRARY bafl.lib +LIBRARY estor.lib +LIBRARY ximputils.lib +LIBRARY ximpdatamodel.lib +LIBRARY presencedatamodel.lib +LIBRARY ximpsrvclient.lib + +#if defined( ARMCC ) +DEFFILE ../eabi/ +#elif defined ( WINSCW ) +deffile ../bwins/ +#endif + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/group/presenceoperation.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/group/presenceoperation.mmp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,183 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project definition file for Presence Operations +* +*/ + +#include +#include +#include "../../group/ximpdlluids.hrh" + + + +TARGET presenceoperation.dll +TARGETTYPE dll +UID XIMP_DLL_UID_STATIC_INTERFACE XIMP_DLL_UID_PRESENCE_MANAGER + +CAPABILITY CAP_GENERAL_DLL +VENDORID VID_DEFAULT + +// --------------------------------------------------------------------------- +SOURCEPATH ../srcpresenceoperations +// --------------------------------------------------------------------------- +SOURCE operationlaunchcleaner.cpp +SOURCE operationsynthesisesubscriptionevent.cpp +SOURCE operationsetsubscriptiondata.cpp +SOURCE presenceoperationfactoryimp.cpp + +// --------------------------------------------------------------------------- +SOURCEPATH ../srcpresenceoperations/presentitygroups +// --------------------------------------------------------------------------- + +// Client - presentity groups +SOURCE operationsubscribegrouplist.cpp +SOURCE operationunsubscribegrouplist.cpp +SOURCE operationcreatepresentitygroup.cpp +SOURCE operationdeletepresentitygroup.cpp +SOURCE operationupdatepresentitygroupdisplayname.cpp + +// Adaptation - presentity groups +SOURCE operationhandlepresentitygroups.cpp + +// Client - presentity group members +SOURCE operationsubscribegroupcontent.cpp +SOURCE operationunsubscribegroupcontent.cpp +SOURCE operationaddpresentitygroupmember.cpp +SOURCE operationremovepresentitygroupmember.cpp +SOURCE operationupdatepresentitygroupmemberdisplayname.cpp + +// Adaptation - presentity group members +SOURCE operationhandlepresentitygroupcontent.cpp +SOURCE operationhandlepresentitygroupmemberadded.cpp +SOURCE operationhandlepresentitygroupmemberremoved.cpp +SOURCE operationhandlepresentitygroupmemberdisplaynameupdated.cpp + + + + + +// --------------------------------------------------------------------------- +SOURCEPATH ../../presence/srcpresenceoperations/presencewatching +// --------------------------------------------------------------------------- + +// Client - subscribe presentity presence +SOURCE operationsubscribepresentitypresence.cpp +SOURCE operationunsubscribepresentitypresence.cpp +SOURCE operationsubscribepresentitygroupmemberspresence.cpp +SOURCE operationunsubscribepresentitygroupmemberspresence.cpp + +// Adaptation - presentity presence recepetion +SOURCE operationhandlepresentitypresence.cpp + + + + +// --------------------------------------------------------------------------- +SOURCEPATH ../srcpresenceoperations/presenceauthorization +// --------------------------------------------------------------------------- + +// Client - Presence grant request listening +SOURCE operationsubscribegrantrequestlist.cpp +SOURCE operationunsubscribegrantrequestlist.cpp + +// Adaptation - Reception of grant requests +SOURCE operationhandlepresencegrantrequests.cpp + +// Client - Granting presence +SOURCE operationgrantpresencetopresentity.cpp +SOURCE operationwithdrawpresencefrompresentity.cpp +SOURCE operationgrantpresencetopresentitygroupmembers.cpp +SOURCE operationwithdrawpresencefrompresentitygroupmembers.cpp +SOURCE operationgrantpresencetoeveryone.cpp +SOURCE operationwithdrawpresencefromeveryone.cpp + +// Client - Blocking presence +SOURCE operationsubscribeblocklist.cpp +SOURCE operationunsubscribeblocklist.cpp +SOURCE operationblockpresenceforpresentity.cpp +SOURCE operationcancelpresenceblockfrompresentity.cpp + +// Adaptation - Reception of block information +SOURCE operationhandlepresenceblocking.cpp + + + + + +// --------------------------------------------------------------------------- +SOURCEPATH ../srcpresenceoperations/presencepublishing +// --------------------------------------------------------------------------- + +// Client - Publishing own presence +SOURCE operationpublishownpresence.cpp + +// Client - Subscribing own presence +SOURCE operationsubscribeownpresence.cpp +SOURCE operationunsubscribeownpresence.cpp + +// Adaptation - Reception of own presence information +SOURCE operationhandleownpresence.cpp + +// Client - Subscribing of presence watcher list +SOURCE operationsubscribewatcherlist.cpp +SOURCE operationunsubscribewatcherlist.cpp + +// Adaptation - Reception of presence watcher list +SOURCE operationhandlepresencewatcherlist.cpp + + + + +USERINCLUDE ../../core/srcoperations +//USERINCLUDE ../srcoperations/sessionmng +USERINCLUDE ../srcpresenceoperations +USERINCLUDE ../srcpresenceoperations/presentitygroups +USERINCLUDE ../srcpresenceoperations/presencewatching +USERINCLUDE ../srcpresenceoperations/presenceauthorization +USERINCLUDE ../srcpresenceoperations/presencepublishing + +USERINCLUDE ../../core/srcdatamodel +USERINCLUDE ../srcpresenceprocessor +USERINCLUDE ../srcpresencedatamodel +USERINCLUDE ../srcpresencedatamodel/presentitygroups +USERINCLUDE ../srcpresencedatamodel/presencewatching +USERINCLUDE ../srcpresencedatamodel/presenceauthorization +USERINCLUDE ../srcpresencedatamodel/presencepublishing + + +USERINCLUDE ../../core/srcutils +USERINCLUDE ../../core/srcprocessor + +// TODO remove unnecessary +SYSTEMINCLUDE ../../inc/core/base +SYSTEMINCLUDE ../../inc/core/datamodel +SYSTEMINCLUDE ../../inc/core/protocolplugin +SYSTEMINCLUDE ../../inc/core/protocolpluginhost +SYSTEMINCLUDE ../../inc/presence/presencedatamodel +SYSTEMINCLUDE ../../inc/presence/presencemanagement +SYSTEMINCLUDE ../../inc/presence/presenceprotocolplugin +SYSTEMINCLUDE ../../inc/presence/presenceprotocolpluginhost +MW_LAYER_SYSTEMINCLUDE + + + +LIBRARY euser.lib +LIBRARY estor.lib +LIBRARY ximputils.lib +LIBRARY ximpdatamodel.lib +LIBRARY presencedatamodel.lib +LIBRARY ximpprocessor.lib + +// End of file + diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencecache/presencecacheclient/presencecacheclient.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencecache/presencecacheclient/presencecacheclient.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,733 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation for presence cache client. +* +*/ + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "presencecacheclient.h" +#include "presencecachedefs.h" +#include "ximpobjecthelpers.h" +#include "presenceinfoimp.h" +#include "personpresenceinfoimp.h" +#include "presenceinfofieldimp.h" +#include "ximpidentityimp.h" +#include "presencebuddyinfoimp.h" +#include "presencebuddyinfolistimp.h" +#include "presenceobjectfactoryimp.h" +#include "presencecacheclientnotification.h" + + +//Include Cache server namespace +using namespace NCacheSrv; + + +// ============================ MEMBER FUNCTIONS ============================= + +// --------------------------------------------------------------------------- +// CPresenceCacheClient::NewL() +// --------------------------------------------------------------------------- +// +EXPORT_C CPresenceCacheClient* CPresenceCacheClient::NewL() + { + CPresenceCacheClient* self = new( ELeave ) CPresenceCacheClient(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); + return self; + } + +// --------------------------------------------------------------------------- +// CPresenceCacheClient::CreateReaderL() +// --------------------------------------------------------------------------- +// +EXPORT_C MPresenceCacheReader* CPresenceCacheClient::CreateReaderL() + { + return NewL(); + } + +// --------------------------------------------------------------------------- +// CPresenceCacheClient::CreateWriterL() +// --------------------------------------------------------------------------- +// +EXPORT_C MPresenceCacheWriter* CPresenceCacheClient::CreateWriterL() + { + return NewL(); + } + +// --------------------------------------------------------------------------- +// CPresenceCacheClient::~CPresenceCacheClient() +// --------------------------------------------------------------------------- +// +CPresenceCacheClient::~CPresenceCacheClient() + { + delete iNotifyHandler; + Cancel(); + RSessionBase::Close(); + delete iPresObjFactory; + } + +// --------------------------------------------------------------------------- +// CPresenceCacheClient::CPresenceCacheClient() +// --------------------------------------------------------------------------- +// +CPresenceCacheClient::CPresenceCacheClient(): CActive( EPriorityStandard ), + iWriteHandler(NULL), + iReadHandler(NULL), + iAsyncReq(NRequest::ENoRequestMade) + { + + } + +// --------------------------------------------------------------------------- +// CPresenceCacheClient::ConstructL() +// --------------------------------------------------------------------------- +// +void CPresenceCacheClient::ConstructL() + { + Connect(); + CActiveScheduler::Add( this ); + iPresObjFactory = CPresenceObjectFactoryImp::NewL(); + } + +// ----------------------------------------------------------------------------- +// CPresenceCacheClient::Connect() +// Connects to the server and create a session. +// ----------------------------------------------------------------------------- +// +TInt CPresenceCacheClient::Connect() + { + TInt error = StartServer(); + + if ( KErrNone == error ) + { + error = CreateSession( NName::KSymbianServer, + Version(), + NRequest::KMsgSlotCount ); + } + return error; + } + + +// ---------------------------------------------------- +// CPresenceCacheClient::StartServer +// +// ---------------------------------------------------- +// +TInt CPresenceCacheClient::StartServer() + { + TInt result; + TRequestStatus status = KRequestPending; + + TFindServer findCacheServer( NName::KSymbianServer ); + TFullName name; + + result = findCacheServer.Next( name ); + if ( result == KErrNone ) + { + // Server already running + return KErrNone; + } + + RProcess server; + result = server.Create( NName::KExecutable, KNullDesC ); + if( result != KErrNone ) + return result; + server.Rendezvous( status ); + status != KRequestPending ? server.Kill( 0 ) : server.Resume(); + //Wait for start or death + User::WaitForRequest( status ); + result = server.ExitType() == EExitPanic ? KErrGeneral : status.Int(); + server.Close(); + + return result; + } + +// ----------------------------------------------------------------------------- +// CPresenceCacheClient::Version() +// Gets the version number. +// ----------------------------------------------------------------------------- +// +TVersion CPresenceCacheClient::Version() const + { + return( TVersion( NVersion::KMajor, + NVersion::KMinor, + NVersion::KBuild ) ); + } + + +// --------------------------------------------------------------------------- +// CPresenceCacheClient::PresenceInfoLC() +// --------------------------------------------------------------------------- +// +MPresenceInfo* CPresenceCacheClient::PresenceInfoLC(const MXIMPIdentity& aIdentity) + { + CPresenceInfoImp* presInfo(NULL); + + if(!ValidateXspId(aIdentity.Identity())) + return presInfo; + + TInt sizeOfPresInfo(0); + TPckgBuf sizePckg; + + HBufC8* myIdPack = PackIdentityLC(aIdentity); + + // Package message arguments before sending to the server + TIpcArgs args; + args.Set(1, myIdPack); + args.Set(2, &sizePckg); + + // We will get either size(+ve) or error code(+ve) after this call + TInt err = SendReceive( NRequest::EPrepReadPresenceInfoSync, args ); + sizeOfPresInfo = sizePckg(); + + CleanupStack::PopAndDestroy(myIdPack); + + if(sizeOfPresInfo && (err==KErrNone)) // If found + { + presInfo = CPresenceInfoImp::NewLC(); + HBufC8* presInfoDes = HBufC8::NewLC(sizeOfPresInfo); + TPtr8 ptrBuf( presInfoDes->Des() ); + + SendReceive( NRequest::EGetLastPreparedPacket, TIpcArgs(&ptrBuf) ); + + TXIMPObjectPacker< CPresenceInfoImp >::UnPackL( *presInfo, *presInfoDes ); + CleanupStack::PopAndDestroy(presInfoDes); + } + + return presInfo; + } + +// --------------------------------------------------------------------------- +// CPresenceCacheClient::BuddyCountInAllServices() +// --------------------------------------------------------------------------- +// +TInt CPresenceCacheClient::BuddyCountInAllServices() + { + TInt buddyCount(0); + TPckgBuf buddyCountPckg; + + // Package message arguments before sending to the server + TIpcArgs args(&buddyCountPckg); + + // This call waits for the server to complete the request before + // proceeding. + TInt err = SendReceive( NRequest::EBuddyCountInAllServices, args ); + buddyCount = buddyCountPckg(); + + return (err<0) ? err : buddyCount; + } + +// --------------------------------------------------------------------------- +// CPresenceCacheClient::BuddyCountInService() +// --------------------------------------------------------------------------- +// +TInt CPresenceCacheClient::BuddyCountInService(const TDesC& aServiceName) + { + TInt buddyCount(0); + TPckgBuf buddyCountPckg; + + // Package message arguments before sending to the server + TIpcArgs args(&buddyCountPckg); + args.Set(1, &aServiceName); + + // This call waits for the server to complete the request before + // proceeding. + TInt err = SendReceive( NRequest::EBuddyCountInService, args ); + buddyCount = buddyCountPckg(); + + return (err<0) ? err : buddyCount; + } + +// --------------------------------------------------------------------------- +// CPresenceCacheClient::ServicesCount() +// --------------------------------------------------------------------------- +// +TInt CPresenceCacheClient::ServicesCount() + { + TInt serviceCount(0); + TPckgBuf serviceCountPckg; + + // Package message arguments before sending to the server + TIpcArgs args(&serviceCountPckg); + + // This call waits for the server to complete the request before + // proceeding. + TInt err = SendReceive( NRequest::EGetServiceCount, args ); + serviceCount = serviceCountPckg(); + + return (err<0) ? err : serviceCount; + } + +// --------------------------------------------------------------------------- +// CPresenceCacheClient::ServicesLC() +// --------------------------------------------------------------------------- +// +/* Implementation is not updated because no one is using this functionality +CDesC16Array* CPresenceCacheClient::ServicesLC() + { + CDesC16Array* services(NULL); + + // This call waits for the server to complete the request before + // proceeding. + TInt size = SendReceive( NRequest::EPrepGetAllServices); + if(size>0) + { + HBufC8* servicesDes = HBufC8::NewLC(size); + TPtr8 ptrBuf( servicesDes->Des() ); + + SendReceive( NRequest::EGetAllServices, TIpcArgs(&ptrBuf) ); + + services = UnPackServicesLC(*servicesDes); + CleanupStack::Pop(services); + CleanupStack::PopAndDestroy(servicesDes); + CleanupStack::PushL(services); + } + return services; + }*/ + +// --------------------------------------------------------------------------- +// CPresenceCacheClient::AllBuddiesPresenceInService() +// --------------------------------------------------------------------------- +// +TInt CPresenceCacheClient::AllBuddiesPresenceInService(const TDesC& aServiceName, + MPresCacheReadHandler* aHandler) + { + if (IsActive()) + return KErrNotReady; + + if(!aHandler || (aServiceName.Length()==NULL) ) + return KErrArgument; + else + iReadHandler = aHandler; + + // Package message arguments before sending to the server + TIpcArgs args(&aServiceName); + + // This call is async + SendReceive( NRequest::EPrepReadAllBuddiesPresenceInService, args, iStatus ); + + iAsyncReq = NRequest::EPrepReadAllBuddiesPresenceInService; + + SetActive(); + + return KErrNone; + + } + +// --------------------------------------------------------------------------- +// CPresenceCacheClient::SubscribePresenceBuddyChangeL +// --------------------------------------------------------------------------- +// +TInt CPresenceCacheClient::SubscribePresenceBuddyChangeL( + const MXIMPIdentity& aIdentity) + { + if(!ValidateXspId(aIdentity.Identity())) + return KErrArgument; + + if ( !iNotifyClient ) + { + return KErrNotReady; + } + + if ( !iNotifyHandler ) + { + iNotifyHandler = CPresenceCacheClientNotification::NewL( *this ); + } + + TInt ret = iNotifyHandler->SubscribePresenceBuddyChangeL( aIdentity); + return ret; + } + +// --------------------------------------------------------------------------- +// CPresenceCacheClient::UnSubscribePresenceBuddyChangeL +// --------------------------------------------------------------------------- +// +void CPresenceCacheClient::UnSubscribePresenceBuddyChangeL( + const MXIMPIdentity& aIdentity) + { + if(!ValidateXspId(aIdentity.Identity())) + return; + + if ( iNotifyHandler ) + { + iNotifyHandler->UnsubscribePresenceBuddyChangeL( aIdentity); + } + } + +// --------------------------------------------------------------------------- +// CPresenceCacheClient::SetObserverForSubscribedNotifications +// --------------------------------------------------------------------------- +// +TInt CPresenceCacheClient::SetObserverForSubscribedNotifications( + MPresCacheReadHandler* aHandler) + { + if ( !aHandler ) + { + return KErrArgument; + } + iNotifyClient = aHandler; + return KErrNone; + } + + +// --------------------------------------------------------------------------- +// CPresenceCacheClient::HandlePreparedAllBuddiesPresenceL() +// --------------------------------------------------------------------------- +// +void CPresenceCacheClient::HandlePreparedAllBuddiesPresenceL(TInt aError) + { + TInt status = aError; // size comes in status + CPresenceBuddyInfoListImp* buddyInfoList(NULL); + if(status>0) // if anything found + { + buddyInfoList = CPresenceBuddyInfoListImp::NewLC(KNullDesC); + HBufC8* buddyInfosDes = HBufC8::NewLC(status); + TPtr8 ptrBuf( buddyInfosDes->Des() ); + + status = SendReceive( NRequest::EGetLastAsyncPreparedPacket, TIpcArgs(&ptrBuf) ); + + TXIMPObjectPacker< CPresenceBuddyInfoListImp >::UnPackL( *buddyInfoList, *buddyInfosDes ); + CleanupStack::PopAndDestroy(buddyInfosDes); + CleanupStack::Pop(buddyInfoList); // ownership will transfer to client + } + + if(iReadHandler) + iReadHandler->HandlePresenceReadL(status, buddyInfoList); + else if(buddyInfoList) // if failed to transfer ownership and created object + delete buddyInfoList; + } + +// --------------------------------------------------------------------------- +// CPresenceCacheClient::WritePresenceL() +// --------------------------------------------------------------------------- +// +TInt CPresenceCacheClient::WritePresenceL( + const MPresenceBuddyInfo* aPresenceBuddyInfo) + { + if(!aPresenceBuddyInfo) + return KErrArgument; + + if(!ValidateXspId(aPresenceBuddyInfo->BuddyId()->Identity())) + return KErrArgument; + + + HBufC8* presInfoPack = PackBuddyPresenceInfoLC(aPresenceBuddyInfo); + + // Package message arguments before sending to the server + TIpcArgs args(presInfoPack); + + + // This call waits for the server to complete the request before + // proceeding. + TInt err = SendReceive( NRequest::EWritePresenceInfoSync, args ); + + CleanupStack::PopAndDestroy(presInfoPack); + + return err; + + } + +// --------------------------------------------------------------------------- +// CPresenceCacheClient::DeletePresenceL() +// --------------------------------------------------------------------------- +// +TInt CPresenceCacheClient::DeletePresenceL(const MXIMPIdentity& aIdentity) + { + HBufC8* idPack = PackIdentityLC(aIdentity); + + // Package message arguments before sending to the server + TIpcArgs args(idPack); + + // This call waits for the server to complete the request before + // proceeding. + TInt err = SendReceive( NRequest::EDeletePresence, args ); + + CleanupStack::PopAndDestroy(idPack); + + return err; + } + + +// --------------------------------------------------------------------------- +// CPresenceCacheClient::CancelWrite() +// --------------------------------------------------------------------------- +// +TInt CPresenceCacheClient::CancelWrite() + { + TInt ret(KErrNotFound); + if(IsActive()) + { + Cancel(); + ret = KErrNone; + } + return ret; + } + +// --------------------------------------------------------------------------- +// CPresenceCacheClient::CancelRead() +// --------------------------------------------------------------------------- +// +TInt CPresenceCacheClient::CancelRead() + { + TInt ret(KErrNotFound); + if(IsActive()) + { + Cancel(); + ret = KErrNone; + } + return ret; + } + +// --------------------------------------------------------------------------- +// CPresenceCacheClient::DeleteService() +// --------------------------------------------------------------------------- +// +TInt CPresenceCacheClient::DeleteService(const TDesC& aServiceName) + { + return SendReceive( NRequest::EDeleteService, TIpcArgs(&aServiceName) ); + } + +// --------------------------------------------------------------------------- +// CPresenceCacheClient::PresenceObjectFactory() +// --------------------------------------------------------------------------- +// +MPresenceObjectFactory& CPresenceCacheClient::PresenceObjectFactory() const + { + return *iPresObjFactory; + } + +// --------------------------------------------------------------------------- +// CPresenceCacheClient::NewIdentityLC() +// --------------------------------------------------------------------------- +// +MXIMPIdentity* CPresenceCacheClient::NewIdentityLC() + { + return CXIMPIdentityImp::NewLC(); + } + +// --------------------------------------------------------------------------- +// CPresenceCacheClient::NewPresenceInfoLC() +// --------------------------------------------------------------------------- +// +MPresenceInfo* CPresenceCacheClient::NewPresenceInfoLC() + { + return CPresenceInfoImp::NewLC(); + } + +// --------------------------------------------------------------------------- +// CPresenceCacheClient::NewBuddyPresenceInfoLC() +// --------------------------------------------------------------------------- +// +MPresenceBuddyInfo* CPresenceCacheClient::NewBuddyPresenceInfoLC() + { + return CPresenceBuddyInfoImp::NewLC(); + } + +// --------------------------------------------------------------------------- +// CPresenceCacheClient::NewPresenceBuddyInfoListLC() +// --------------------------------------------------------------------------- +// +MPresenceBuddyInfoList* CPresenceCacheClient::NewPresenceBuddyInfoListLC( + const TDesC& aServiceName) + { + return CPresenceBuddyInfoListImp::NewLC(aServiceName); + } + +// --------------------------------------------------------------------------- +// CPresenceCacheClient::WritePresenceL() +// --------------------------------------------------------------------------- +// +TInt CPresenceCacheClient::WritePresenceL( + const MPresenceBuddyInfoList* aPresenceBuddyInfos, + MPresCacheWriteHandler* aHandler) + { + if (IsActive()) + return KErrNotReady; + if(!aPresenceBuddyInfos) + return KErrArgument; + + HBufC8* presInfoPack = PackPresenceBuddyListLC(aPresenceBuddyInfos); + + // Package message arguments before sending to the server + TIpcArgs args(presInfoPack); + args.Set(1,aPresenceBuddyInfos->Count()); + + // This is async call to server. + SendReceive( NRequest::EWritePresenceInfoAsync, args, iStatus); + + iAsyncReq = NRequest::EWritePresenceInfoAsync; + + if(aHandler) + iWriteHandler = aHandler; + + CleanupStack::PopAndDestroy(presInfoPack); + + SetActive(); + + return KErrNone; + } + +// --------------------------------------------------------------------------- +// CPresenceCacheClient::ValidateXspId() +// --------------------------------------------------------------------------- +// +TBool CPresenceCacheClient::ValidateXspId(const TDesC& aXspId) + { + TBool ret(EFalse); + _LIT(KColon, ":"); + TInt pos = aXspId.Find(KColon); + if(pos>0) // if colon found and there is something before colon, i.e. xsp id + { + ret = ETrue; + } + return ret; + } + +// --------------------------------------------------------------------------- +// CPresenceCacheClient::RunL() +// --------------------------------------------------------------------------- +// +void CPresenceCacheClient::RunL() + { + + TInt origStatus = iStatus.Int(); + switch (iAsyncReq) + { + case NRequest::EWritePresenceInfoAsync: + if(iWriteHandler) // if client had requested the call back + iWriteHandler->HandlePresenceWriteL(origStatus); + iAsyncReq = NRequest::ENoRequestMade; + break; + + case NRequest::EPrepReadAllBuddiesPresenceInService: + HandlePreparedAllBuddiesPresenceL(origStatus); + iAsyncReq = NRequest::ENoRequestMade; + break; + + case NRequest::ENoRequestMade: + default: + break; + } + } + +// --------------------------------------------------------------------------- +// CPresenceCacheClient::DoCancel() +// --------------------------------------------------------------------------- +// +void CPresenceCacheClient::DoCancel() + { + iAsyncReq = NRequest::ENoRequestMade; + iReadHandler = NULL; + iWriteHandler = NULL; + SendReceive( NRequest::ECancelAsyncOperation); + SendReceive( NRequest::ECancelWaitingForNotification); + } + +// --------------------------------------------------------------------------- +// CPresenceCacheClient::PackBuddyPresenceInfoLC() +// --------------------------------------------------------------------------- +// +HBufC8* CPresenceCacheClient::PackBuddyPresenceInfoLC( + const MPresenceBuddyInfo* aBuddyPresInfo) + { + HBufC8* pack(NULL); + if(aBuddyPresInfo) + { + const CPresenceBuddyInfoImp* pifImp = + TXIMPGetImpClassOrPanic< const CPresenceBuddyInfoImp >::From( *aBuddyPresInfo ); + + pack = TXIMPObjectPacker< const CPresenceBuddyInfoImp>::PackL( *pifImp ); + CleanupStack::PushL( pack ); + } + + return pack; + } + +// --------------------------------------------------------------------------- +// CPresenceCacheClient::PackPresenceBuddyListLC() +// --------------------------------------------------------------------------- +// +HBufC8* CPresenceCacheClient::PackPresenceBuddyListLC(const MPresenceBuddyInfoList* aList) + { + HBufC8* pack(NULL); + if(aList) + { + const CPresenceBuddyInfoListImp* pifImp = + TXIMPGetImpClassOrPanic< const CPresenceBuddyInfoListImp >::From( *aList ); + + pack = TXIMPObjectPacker< CPresenceBuddyInfoListImp>::PackL(*pifImp); + CleanupStack::PushL( pack ); + } + return pack; + } + +// --------------------------------------------------------------------------- +// CPresenceCacheClient::PackIdentityLC() +// --------------------------------------------------------------------------- +// +HBufC8* CPresenceCacheClient::PackIdentityLC(const MXIMPIdentity& aIdentity) + { + HBufC8* pack(NULL); + + const CXIMPIdentityImp* pifImp = + TXIMPGetImpClassOrPanic< const CXIMPIdentityImp >::From(aIdentity); + + pack = TXIMPObjectPacker< CXIMPIdentityImp>::PackL( *pifImp ); + CleanupStack::PushL( pack ); + + return pack; + } + +// --------------------------------------------------------------------------- +// CPresenceCacheClient::UnPackServicesLC() +// --------------------------------------------------------------------------- +// +/* +CDesCArray* CPresenceCacheClient::UnPackServicesLC(TDesC8& aServicesBuffer) + { + CArrayFixFlat* services = new (ELeave) CArrayFixFlat(1); + CleanupStack::PushL(services); + + RDesReadStream rs; + CleanupClosePushL( rs ); + rs.Open( aServicesBuffer ); // CSI: 65 # + + // read the object count + TInt objCount( rs.ReadInt32L() ); + TUid service; + + for ( TInt count = 0; count < objCount; count++ ) + { + rs>>service; + services->AppendL(service); + } + + CleanupStack::PopAndDestroy(); // rs + return services; + }*/ + +// end of file diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencecache/presencecacheclient/presencecacheclient.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencecache/presencecacheclient/presencecacheclient.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,279 @@ +/* +* Copyright (c) 2007, 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation for presence cache reader and writer. +* +*/ + +#ifndef PRESENCECACHECLIENT_H +#define PRESENCECACHECLIENT_H + +#include +#include + +#include "presencecachedefs.h" +#include "presenceapiobjbase.h" + + +class MPresenceInfo; +class MPersonPresenceInfo; +class MPresenceInfoField; +class MPresenceBuddyInfo; +class MPresCacheWriteHandler; +class MPresCacheReadHandler; +class MXIMPIdentity; +class MPresenceBuddyInfoList; +class MPresenceObjectFactory; +class CPresenceObjectFactoryImp; + +class CPresenceCacheClientNotification; + +//Include Cache server namespace +using namespace NCacheSrv; + +/** + * Implementation for presence cache reader and writer. This object is + * instantiated either by MPresenceCacheReader or MPresenceCacheWriter using ecom framework. + * Apart from implementing these two objects, this is also a Symbian OS client and + * it communicates with presence cache server. Its also an active object. + * + * @ingroup ximpprescacheapi + * @since S60 v3.2 + */ +class CPresenceCacheClient : public CActive, + public MPresenceCacheReader, + public MPresenceCacheWriter, + public RSessionBase + + { +public: + + /** The class ID. */ + enum { KClassId = PRIMP_CLSID_CPRESENCECACHECLIENT }; + + +public: + + /** + * Factory method to instantiate CPresenceCacheClient through the ECom. + * + * @return The new CPresenceCacheClient object. Object + * ownership is returned to caller. + */ + IMPORT_C static CPresenceCacheClient* NewL(); + + /** + * Factory method to instantiate CPresenceCacheClient through the ECom. + * It's returns MPresenceCacheReader + * + * @return The new CPresenceCacheClient object. Object + * ownership is returned to caller. + */ + IMPORT_C static MPresenceCacheReader* CreateReaderL(); + + /** + * Factory method to instantiate CPresenceCacheClient through the ECom. + * It's returns MPresenceCacheWriter + * + * @return The new CPresenceCacheClient object. Object + * ownership is returned to caller. + */ + IMPORT_C static MPresenceCacheWriter* CreateWriterL(); + + /** + * Public destructor. + * Objects can be deleted through this interface. + */ + virtual ~CPresenceCacheClient(); + + /** + * Start the server + * @return TInt Error code + */ + TInt StartServer(); + + /** + * Version. + * Gets the version number. + * @return The version. + */ + TVersion Version() const; + + +private: + + /** + * C++ constructor + */ + CPresenceCacheClient(); + + /** + * Symbian second phase constructor + */ + void ConstructL(); + + /** + * Connect. + * Connects to the server and create a session. + * @return Error code. + */ + TInt Connect(); + + /** + * Packs MPresenceBuddyInfo object into a buffer + * + * @param aBuddyPresInfo, MPresenceBuddyInfo + * @return HBufC8* buffer + */ + HBufC8* PackBuddyPresenceInfoLC(const MPresenceBuddyInfo* aBuddyPresInfo); + + /** + * Packs MPresenceBuddyInfoList object into a buffer + * + * @param aList, MPresenceBuddyInfoList + * @return HBufC8* buffer + */ + HBufC8* PackPresenceBuddyListLC(const MPresenceBuddyInfoList* aList); + + /** + * Packs MXIMPIdentity object into a buffer + * + * @param MXIMPIdentity, aIdentity + * @return HBufC8* buffer + */ + HBufC8* PackIdentityLC(const MXIMPIdentity& aIdentity); + + /** + * Handle asynchronous call from server that buddies presence have been prepared. + * This function does further processing and calls the client. + * + * @param aError, Error came from server. + */ + void HandlePreparedAllBuddiesPresenceL(TInt aError); + + /** + * Return true if given identity is valid xsp identity + * + * @param ETrue if valid xsp identity + */ + TBool ValidateXspId(const TDesC& aXspId); + + + /** + * Internalize the services packet from given buffer + * + * @param aServicesBuffer, services buffer recieved from server. + */ + //CDesCArray* UnPackServicesLC(TDesC8& aServicesBuffer); + + +public: //From MPresenceCacheReader and MPresenceCacheWriter + + MXIMPIdentity* NewIdentityLC(); + +public: //From MPresenceCacheReader + + + MPresenceInfo* PresenceInfoLC(const MXIMPIdentity& aIdentity); + + TInt BuddyCountInAllServices(); + + TInt BuddyCountInService(const TDesC& aServiceName); + + TInt ServicesCount(); + + //CDesCArray* ServicesLC(); + + TInt CancelRead(); + + TInt SubscribePresenceBuddyChangeL(const MXIMPIdentity& aIdentity); + + void UnSubscribePresenceBuddyChangeL(const MXIMPIdentity& aIdentity); + + +public: //From MPresenceCacheReader, Asynchronous methods + + TInt AllBuddiesPresenceInService(const TDesC& aServiceName, + MPresCacheReadHandler* aHandler); + + TInt SetObserverForSubscribedNotifications( + MPresCacheReadHandler* aHandler); + +public: //From MPresenceCacheWriter + + TInt WritePresenceL(const MPresenceBuddyInfo* aPresenceBuddyInfo); + + TInt DeleteService(const TDesC& aServiceName); + + TInt DeletePresenceL(const MXIMPIdentity& aIdentity); + + MPresenceObjectFactory& PresenceObjectFactory() const; + + MPresenceInfo* NewPresenceInfoLC(); + + MPresenceBuddyInfo* NewBuddyPresenceInfoLC(); + + MPresenceBuddyInfoList* NewPresenceBuddyInfoListLC(const TDesC& aServiceName); + + TInt CancelWrite(); + + +public: //From MPresenceCacheWriter, Asynchronous methods + + TInt WritePresenceL(const MPresenceBuddyInfoList* aPresenceBuddyInfos, + MPresCacheWriteHandler* aHandler); + +public: //Froom CActive + + void RunL(); + + void DoCancel(); + +private: // Data + + //Not Owned + MPresCacheWriteHandler* iWriteHandler; + + //Not Owned + MPresCacheReadHandler* iReadHandler; + + //To store async request status + NRequest::TOpAsyncCodes iAsyncReq; + + /** + * Object factory sub interface. + */ + CPresenceObjectFactoryImp* iPresObjFactory; + + /** + * Client who subscribed cache notifications + * NOT OWN + */ + MPresCacheReadHandler* iNotifyClient; + + /** + * Handler for subscribed cache notifications + * OWN + */ + CPresenceCacheClientNotification* iNotifyHandler; + +private: // friend classes + + friend class CPresenceCacheClientNotification; + + }; + +#endif // PRESENCECACHECLIENT_H + + + diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencecache/presencecacheclient/presencecacheclientnotification.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencecache/presencecacheclient/presencecacheclientnotification.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,213 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation for presence cache client. +* +*/ + +#include + +#include + +#include "presencecacheclientnotification.h" +#include "presencecachedefs.h" +#include "ximpobjecthelpers.h" +#include "presenceinfoimp.h" +#include "presencebuddyinfoimp.h" +#include "personpresenceinfoimp.h" + +// ============================ MEMBER FUNCTIONS ============================= + +// --------------------------------------------------------------------------- +// CPresenceCacheClientNotification::NewL +// --------------------------------------------------------------------------- +// +CPresenceCacheClientNotification* CPresenceCacheClientNotification::NewL( + CPresenceCacheClient& aClient) + { + CPresenceCacheClientNotification* self = new(ELeave)CPresenceCacheClientNotification(aClient); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); + return self; + } + +// --------------------------------------------------------------------------- +// CPresenceCacheClientNotification::~CPresenceCacheClientNotification +// --------------------------------------------------------------------------- +// +CPresenceCacheClientNotification::~CPresenceCacheClientNotification() + { + Cancel(); + } + +// --------------------------------------------------------------------------- +// CPresenceCacheClientNotification::CPresenceCacheClientNotification +// --------------------------------------------------------------------------- +// +CPresenceCacheClientNotification::CPresenceCacheClientNotification(CPresenceCacheClient& aClient) +: CActive( EPriorityStandard ), iClient( aClient ), iNotificationSubscribed( EFalse ) + { + } + +// --------------------------------------------------------------------------- +// CPresenceCacheClientNotification::ConstructL +// --------------------------------------------------------------------------- +// +void CPresenceCacheClientNotification::ConstructL() + { + CActiveScheduler::Add( this ); + } + +// --------------------------------------------------------------------------- +// CPresenceCacheClientNotification::RunL +// --------------------------------------------------------------------------- +// +void CPresenceCacheClientNotification::RunL() + { + TInt origStatus = iStatus.Int(); + + MPresCacheReadHandler* client = ClientNotifyHandler(); + + if ( origStatus ) + { + iNotificationSubscribed = EFalse; + TRAP_IGNORE( client->HandlePresenceNotificationL( origStatus, NULL )); + } + else + { + StartNotifySubscription(); + PreseneceFromServerToClientL( *client, iSizePckg() ); + } + } +// ---------------------------------------------------------- +// CPresenceCacheClientNotification::RunError +// ---------------------------------------------------------- +// +TInt CPresenceCacheClientNotification::RunError( TInt aError ) + { + if ( KErrServerTerminated == aError ) + { + // When server is terminated we notify the clienrt about that + iNotificationSubscribed = EFalse; + MPresCacheReadHandler* client = ClientNotifyHandler(); + TRAP_IGNORE( client->HandlePresenceNotificationL( aError, NULL )); + } + else + { + // StartNotifySubscription is already called. + } + return KErrNone; + } + +// --------------------------------------------------------------------------- +// CPresenceCacheClientNotification::DoCancel +// --------------------------------------------------------------------------- +// +void CPresenceCacheClientNotification::DoCancel() + { + // TODO: consider when this is safe + iClient.SendReceive( NRequest::ECancelWaitingForNotification ); + } + +// --------------------------------------------------------------------------- +// CPresenceCacheClientNotification::SubscribePresenceBuddyChangeL +// --------------------------------------------------------------------------- +// +TInt CPresenceCacheClientNotification::SubscribePresenceBuddyChangeL( + const MXIMPIdentity& aIdentity) + { + if ( !iNotificationSubscribed ) + { + StartNotifySubscription(); + } + + HBufC8* myIdPack = iClient.PackIdentityLC(aIdentity); + + // Package message arguments before sending to the server + TIpcArgs args; + args.Set(1, myIdPack); + + TInt err = iClient.SendReceive( NRequest::ESubscribeBuddyPresenceChange, args ); + CleanupStack::PopAndDestroy( myIdPack ); + + return err; + } + +// --------------------------------------------------------------------------- +// CPresenceCacheClientNotification::UnsubscribePresenceBuddyChangeL +// --------------------------------------------------------------------------- +// +void CPresenceCacheClientNotification::UnsubscribePresenceBuddyChangeL( + const MXIMPIdentity& aIdentity) + { + HBufC8* myIdPack = iClient.PackIdentityLC(aIdentity); + + // Package message arguments before sending to the server + TIpcArgs args; + args.Set(1, myIdPack); + + TInt err = iClient.SendReceive( NRequest::EUnSubscribeBuddyPresenceChange, args ); + CleanupStack::PopAndDestroy( myIdPack ); + User::LeaveIfError( err ); + } + +// --------------------------------------------------------------------------- +// CPresenceCacheClientNotification::StartNotifySubscriptionL +// --------------------------------------------------------------------------- +// +void CPresenceCacheClientNotification::StartNotifySubscription() + { + // Package message arguments before sending to the server + SetActive(); + TIpcArgs args(&iSizePckg); + iClient.SendReceive( NRequest::EWaitingForNotification, args, iStatus ); + iNotificationSubscribed = ETrue; + } + +// --------------------------------------------------------------------------- +// CPresenceCacheClientNotification::ClientNotifyHandler +// --------------------------------------------------------------------------- +// +MPresCacheReadHandler* CPresenceCacheClientNotification::ClientNotifyHandler() + { + return iClient.iNotifyClient; + } + +// --------------------------------------------------------------------------- +// CPresenceCacheClientNotification::PreseneceFromServerToClientL +// --------------------------------------------------------------------------- +// +void CPresenceCacheClientNotification::PreseneceFromServerToClientL( + MPresCacheReadHandler& aClient, TInt aSize ) + { + CPresenceBuddyInfoImp* buddyInfo(NULL); + buddyInfo = CPresenceBuddyInfoImp::NewLC(); + HBufC8* presInfoDes = HBufC8::NewLC( aSize ); + TPtr8 ptrBuf( presInfoDes->Des() ); + TInt err = iClient.SendReceive( NRequest::EGetLastNotifiedtPacket, TIpcArgs( &ptrBuf )); + if ( !err ) + { + TXIMPObjectPacker< CPresenceBuddyInfoImp >::UnPackL( *buddyInfo, *presInfoDes ); + CleanupStack::PopAndDestroy( presInfoDes ); + aClient.HandlePresenceNotificationL( KErrNone, buddyInfo ); + CleanupStack::Pop( buddyInfo ); + } + else + { + CleanupStack::PopAndDestroy( presInfoDes ); + CleanupStack::PopAndDestroy( buddyInfo ); + } + } + +// end of file diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencecache/presencecacheclient/presencecacheclientnotification.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencecache/presencecacheclient/presencecacheclientnotification.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,125 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation for presence cache reader notification handling +* +*/ + +#ifndef PRESENCECACHECLIENTNOTIFICATION_H +#define PRESENCECACHECLIENTNOTIFICATION_H + +#include "presencecacheclient.h" + +#include "presencecachedefs.h" +#include "presenceapiobjbase.h" + + +/** + * Implementation for presence cache reader notification. This object is + * instantiated by CPresenceCacheClient. This class handles client-server + * messaging for notifications. + * + * @ingroup ximpprescacheapi + * @since S60 v5.0 + */ + NONSHARABLE_CLASS( CPresenceCacheClientNotification ) : public CActive + { + +public: + + /** + * Two-phased constructor. + * @param aClient presence cache client + */ + static CPresenceCacheClientNotification* NewL( CPresenceCacheClient& aClient ); + + /** + * Destructor. + */ + virtual ~CPresenceCacheClientNotification(); + + /** + * Subscribe for given presence buddy's change in presence. + * + * @param aIdentity buddy id, in xsp format + * @return KErrNone if successful, KErrArgument if observer not set + * @leave Only in system error cases e.g. if failed to allocate memory. + */ + TInt SubscribePresenceBuddyChangeL(const MXIMPIdentity& aIdentity); + + /** + * Unsubscribe for given presence buddy's change in presence. + * + * @param aIdentity buddy id, in xsp format + * @leave Only in system error cases e.g. if failed to allocate memory. + */ + void UnsubscribePresenceBuddyChangeL(const MXIMPIdentity& aIdentity); + +private: + + /** + * C++ constructor + */ + CPresenceCacheClientNotification( CPresenceCacheClient& aClient ); + + /** + * Symbian second phase constructor + */ + void ConstructL(); + + void StartNotifySubscription(); + + /** + * Client callback handler Accesor + */ + MPresCacheReadHandler* ClientNotifyHandler(); + + /** + * Get presence from Cache server to a client observer + * @param aClient client callback observer + * @param aSize notification size + */ + void PreseneceFromServerToClientL( MPresCacheReadHandler& aClient, TInt aSize ); + + +public: //From CActive + + void RunL(); + + void DoCancel(); + + TInt RunError( TInt aError ); + +private: // Data + + /** + * presence cache client handling client-server messages + */ + CPresenceCacheClient& iClient; + + /** + * Size of presence notification for client-sever messages + */ + TPckgBuf iSizePckg; + + /** + * Whether the first notification subscription is done + */ + TBool iNotificationSubscribed; + + }; + +#endif // PRESENCECACHECLIENTNOTIFICATION_H + + + diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencecache/presencecacheecomhook/presencecacheecomhook.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencecache/presencecacheecomhook/presencecacheecomhook.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,48 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework's Presence Cache reader and writer Hook implementation. +* +*/ + + +#include "presencedlluids.hrh" +#include "presencecacheclient.h" +#include +#include + + +// --------------------------------------------------------------------------- +// Key value pair table to identify correct constructor +// function for the requested interface. +// --------------------------------------------------------------------------- +// +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY( XIMP_ECOM_IMPL_UID_PRESENCE_CACHE_READER, + CPresenceCacheClient::CreateReaderL ), + IMPLEMENTATION_PROXY_ENTRY( XIMP_ECOM_IMPL_UID_PRESENCE_CACHE_WRITER, + CPresenceCacheClient::CreateWriterL ) + }; + + +// --------------------------------------------------------------------------- +// Exported function to return the implementation proxy table +// --------------------------------------------------------------------------- +// +EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount ) + { + aTableCount = sizeof( ImplementationTable ) / sizeof( TImplementationProxy ); + return ImplementationTable; + } + diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencecache/presencecacheecomhook/presencecacheecomhook.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencecache/presencecacheecomhook/presencecacheecomhook.rss Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,70 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ECom registery info for ECom hook +* +*/ + + +#include +#include "presencedlluids.hrh" +#include + +// --------------------------------------------------------------------------- +// ECom registery info for XIMP Presence Manager ECom hook +// --------------------------------------------------------------------------- +// +RESOURCE REGISTRY_INFO theInfo + { + resource_format_version = RESOURCE_FORMAT_VERSION_2; + dll_uid = XIMP_DLL_UID_PRESENCE_CACHE_HOOK; + + // There are two interfaces which are invoking same implementation + // but with different uids to invoke different functions of CPresenceCacheClient. + interfaces = + { + // Presence Cache reader interface + INTERFACE_INFO + { + interface_uid = XIMP_ECOM_IF_UID_PRESENCE_CACHE_READER; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = XIMP_ECOM_IMPL_UID_PRESENCE_CACHE_READER; + version_no = 1; + display_name = "S60 Default XIMP CacheReader"; + default_data = XIMP_ECOM_DEFAULT_DATA_PRESENCE_INTERFACE; + opaque_data = ""; + } + }; + }, + // Presence cache writer interface + INTERFACE_INFO + { + interface_uid = XIMP_ECOM_IF_UID_PRESENCE_CACHE_WRITER; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = XIMP_ECOM_IMPL_UID_PRESENCE_CACHE_WRITER; + version_no = 1; + display_name = "S60 Default XIMP CacheWriter"; + default_data = XIMP_ECOM_DEFAULT_DATA_PRESENCE_INTERFACE; + opaque_data = ""; + } + }; + } + }; + } + diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencecache/presencecacheserver/presencecachebuddystore.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencecache/presencecacheserver/presencecachebuddystore.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,269 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Store object for single buddy in a service +* +*/ + + +#include "presencecachebuddystore.h" +#include "presencecacheservicestore.h" +#include "presencecachesession.h" +#include "presencetypehelpers.h" +#include "ximpidentityimp.h" +#include "presencebuddyinfoimp.h" + +// --------------------------------------------------------------------------- +// CPresenceCacheBuddyStore::NewLC() +// --------------------------------------------------------------------------- +// +EXPORT_C CPresenceCacheBuddyStore* CPresenceCacheBuddyStore::NewLC( + CPresenceCacheServiceStore* aServiceStore, + MXIMPIdentity* aIdentity) + { + CPresenceCacheBuddyStore* self = new( ELeave ) CPresenceCacheBuddyStore( + aServiceStore); + CleanupStack::PushL( self ); + self->ConstructL(aIdentity); + return self; + } + +// --------------------------------------------------------------------------- +// CPresenceCacheBuddyStore::NewL() +// --------------------------------------------------------------------------- +// +EXPORT_C CPresenceCacheBuddyStore* CPresenceCacheBuddyStore::NewL( + CPresenceCacheServiceStore* aServiceStore, + MXIMPIdentity* aIdentity) + { + CPresenceCacheBuddyStore* self = NewLC(aServiceStore,aIdentity); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// CPresenceCacheBuddyStore::~CPresenceCacheBuddyStore() +// --------------------------------------------------------------------------- +// +CPresenceCacheBuddyStore::~CPresenceCacheBuddyStore() + { + if (iPresenceBuddyInfo) + delete iPresenceBuddyInfo; + if(iIdentity) + delete iIdentity; + iSubscribedSessions.Close(); + } + +// --------------------------------------------------------------------------- +// CPresenceCacheBuddyStore::CPresenceCacheBuddyStore() +// --------------------------------------------------------------------------- +// +CPresenceCacheBuddyStore::CPresenceCacheBuddyStore( + CPresenceCacheServiceStore* aServiceStore):iPresenceBuddyInfo(NULL), + iServiceStore(aServiceStore) + { + } + +// --------------------------------------------------------------------------- +// CPresenceCacheBuddyStore::ConstructL() +// --------------------------------------------------------------------------- +// +void CPresenceCacheBuddyStore::ConstructL(MXIMPIdentity* aIdentity) + { + if(aIdentity) + iIdentity = TXIMPGetImpClassOrPanic< CXIMPIdentityImp >::From( *aIdentity ); + else + iIdentity = CXIMPIdentityImp::NewL(); + } + +// --------------------------------------------------------------------------- +// CPresenceCacheBuddyStore::SetPresenceBuddyInfo() +// --------------------------------------------------------------------------- +// +void CPresenceCacheBuddyStore::SetPresenceBuddyInfo(MPresenceBuddyInfo* aPresBuddyInfo) + { + if(aPresBuddyInfo) + { + if (iPresenceBuddyInfo) + delete iPresenceBuddyInfo; + iPresenceBuddyInfo = aPresBuddyInfo; + } + } + +// --------------------------------------------------------------------------- +// CPresenceCacheBuddyStore::RemovePresenceBuddyInfo() +// --------------------------------------------------------------------------- +// +void CPresenceCacheBuddyStore::RemovePresenceBuddyInfo() + { + if (iPresenceBuddyInfo) + delete iPresenceBuddyInfo; + iPresenceBuddyInfo = NULL; + } + +// --------------------------------------------------------------------------- +// CPresenceCacheBuddyStore::GetSubscribedSessions() +// --------------------------------------------------------------------------- +// +RPointerArray& CPresenceCacheBuddyStore::GetSubscribedSessions() + { + return iSubscribedSessions; + } + +// --------------------------------------------------------------------------- +// CPresenceCacheBuddyStore::AddSubscribedSession() +// --------------------------------------------------------------------------- +// +void CPresenceCacheBuddyStore::AddSubscribedSession(CPresenceCacheSession* aSession) + { + if(iSubscribedSessions.Find(aSession)<0) + iSubscribedSessions.Append(aSession); + } + +// --------------------------------------------------------------------------- +// CPresenceCacheBuddyStore::RemoveSubscribedSession() +// --------------------------------------------------------------------------- +// +void CPresenceCacheBuddyStore::RemoveSubscribedSession(CPresenceCacheSession* aSession) + { + TInt index = iSubscribedSessions.Find(aSession); + if(index>-1) + iSubscribedSessions.Remove(index); + + // delete this object if it doesnt have any presence or subscribers + if(!(iPresenceBuddyInfo || HasSubscribers())) + { + if(iServiceStore) + { + iServiceStore->RemoveBlind(this); + } + } + } + +// --------------------------------------------------------------------------- +// CPresenceCacheBuddyStore::SetBuddyId() +// --------------------------------------------------------------------------- +// +void CPresenceCacheBuddyStore::SetBuddyId(MXIMPIdentity* aIdentity) + { + if(aIdentity) + { + delete iIdentity; + iIdentity = TXIMPGetImpClassOrPanic< CXIMPIdentityImp >::From( *aIdentity ); + } + } + +// --------------------------------------------------------------------------- +// CPresenceCacheBuddyStore::ServiceName() +// --------------------------------------------------------------------------- +// +TPtrC CPresenceCacheBuddyStore::ServiceName() const + { + _LIT(KColon, ":"); + TInt pos = iIdentity->Identity().Find(KColon); + TPtrC serviceName; + if(pos>0) // if colon found and there is something before colon, i.e. xsp id + { + serviceName.Set(iIdentity->Identity().Left(pos)); + } + else + serviceName.Set(TPtrC()); + return serviceName; + } + +// --------------------------------------------------------------------------- +// CPresenceCacheBuddyStore::PresenceBuddyInfo() +// --------------------------------------------------------------------------- +// +MPresenceBuddyInfo* CPresenceCacheBuddyStore::PresenceBuddyInfo() const + { + return iPresenceBuddyInfo; + } + +// --------------------------------------------------------------------------- +// CPresenceCacheBuddyStore::BuddyId() +// --------------------------------------------------------------------------- +// +const MXIMPIdentity* CPresenceCacheBuddyStore::BuddyId() const + { + return iIdentity; + } + +// --------------------------------------------------------------------------- +// CPresenceCacheBuddyStore::EqualsIdentity() +// --------------------------------------------------------------------------- +// +TBool CPresenceCacheBuddyStore::EqualsIdentity( + const CPresenceCacheBuddyStore* aOtherInstance ) const + { + TBool ret(EFalse); + if(aOtherInstance) + { + const CXIMPIdentityImp* tmp = + TXIMPGetImpClassOrPanic< const CXIMPIdentityImp >::From( *(aOtherInstance->BuddyId())); + ret = iIdentity->EqualsContent( *tmp); + } + return ret; + } + +// --------------------------------------------------------------------------- +// CPresenceCacheBuddyStore::EqualsIdentity() +// --------------------------------------------------------------------------- +// +TBool CPresenceCacheBuddyStore::EqualsIdentity( + const MPresenceBuddyInfo* aOtherInstance ) const + { + TBool ret(EFalse); + if(aOtherInstance) + { + const CXIMPIdentityImp* tmp = + TXIMPGetImpClassOrPanic< const CXIMPIdentityImp >::From( *(aOtherInstance->BuddyId())); + ret = iIdentity->EqualsContent( *tmp); + } + return ret; + } + +// --------------------------------------------------------------------------- +// CPresenceCacheBuddyStore::EqualsIdentity() +// --------------------------------------------------------------------------- +// +TBool CPresenceCacheBuddyStore::EqualsIdentity( + const MXIMPIdentity& aOtherIdentity ) const + { + const CXIMPIdentityImp* tmp = + TXIMPGetImpClassOrPanic< const CXIMPIdentityImp >::From(aOtherIdentity); + return iIdentity->EqualsContent( *tmp); + } + +// --------------------------------------------------------------------------- +// CPresenceCacheBuddyStore::HasPresence() +// --------------------------------------------------------------------------- +// +TBool CPresenceCacheBuddyStore::HasPresence() const + { + if(iPresenceBuddyInfo) + return ETrue; + return EFalse; + } + +// --------------------------------------------------------------------------- +// CPresenceCacheBuddyStore::HasSubscribers() +// --------------------------------------------------------------------------- +// +TBool CPresenceCacheBuddyStore::HasSubscribers() const + { + if(iSubscribedSessions.Count()) + return ETrue; + return EFalse; + } + diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencecache/presencecacheserver/presencecachebuddystore.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencecache/presencecacheserver/presencecachebuddystore.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,213 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Store object for single buddy in a service +* +*/ + +#ifndef CXIMPPRESENCECACHEBUDDYSTORE_H +#define CXIMPPRESENCECACHEBUDDYSTORE_H + + +#include "presenceapiobjbase.h" +#include "ximpapiobjbase.h" + +class MPresenceBuddyInfo; +class CXIMPIdentityImp; +class CPresenceCacheSession; +class MXIMPIdentity; +class CPresenceCacheServiceStore; + +/** + * CPresenceCacheBuddyStore. Used in Presence cache for presence storage. The + * identity part is always exists in this class, subscribers and presence info + * are not guaranteed. However, if this object doesn't contain any subscribers + * or presence info, it doesnt serve its purpose and should be deleted. + * + * @lib presencecacheserver.exe + * @since S60 v3.2 + */ +class CPresenceCacheBuddyStore: public CBase + { + +public: + + /** + * Symbian constructors and c++ destructor + * + * @param aServiceStore a parent store for this object + * @param aIdentity identity for this object, must be in xsp format + */ + IMPORT_C static CPresenceCacheBuddyStore* NewLC( + CPresenceCacheServiceStore* aServiceStore, + MXIMPIdentity* aIdentity); + IMPORT_C static CPresenceCacheBuddyStore* NewL( + CPresenceCacheServiceStore* aServiceStore, + MXIMPIdentity* aIdentity); + virtual ~CPresenceCacheBuddyStore(); + +private: + + /** + * c++ constructor + * + * @param aServiceStore Parent service store for this object + */ + CPresenceCacheBuddyStore(CPresenceCacheServiceStore* aServiceStore); + + /** + * Symbian second phase constructor + * @param aIdentity, uses this identity if not NULL, otherwise creates new + */ + void ConstructL(MXIMPIdentity* aIdentity); + + +public: + + /** + * Service name of this object, taken from xsp prefix of the indentity + * + * @return TPtrC service name of this object + */ + TPtrC ServiceName() const; + + /** + * Sets the presnece info to this object. Takes ownership. It deletes + * any old presence info. Calling this function multiple times with + * different presence infos doesnt harm. + * + * @param aPresBuddyInfo buddy presence info to be set to this object + */ + void SetPresenceBuddyInfo(MPresenceBuddyInfo* aPresBuddyInfo); + + /** + * Removes presence info from this object and set it to NULL. + */ + void RemovePresenceBuddyInfo(); + + /** + * Get the subscribed sessions pointer array. The array contains all those + * sessions which are currently subscribed to receive changes in this object. + * + * @return reference to RPointerArray + */ + RPointerArray& GetSubscribedSessions(); + + /** + * Add session to the list of subscribed sessions. It does not take ownership. + * ignores if session is already there. + * + * @param aSession to add in subscribed list + */ + void AddSubscribedSession(CPresenceCacheSession* aSession); + + /** + * Remove session to the list of subscribed sessions. It does not take ownership. + * ignores if session is not found. + * + * @param aSession to remove from subscribed list + */ + void RemoveSubscribedSession(CPresenceCacheSession* aSession); + + /** + * Sets the identity to this object. Takes ownership. It deletes + * any old identity if present. Identity must be in xsp format. + * + * @param aIdentity identity to be set to this object + */ + void SetBuddyId(MXIMPIdentity* aIdentity); + + /** + * Gets presence info from this object. + * + * @return pointer to MPresenceBuddyInfo + */ + MPresenceBuddyInfo* PresenceBuddyInfo() const; + + /** + * Gets identity from this object. + * + * @return constant pointer to MXIMPIdentity + */ + const MXIMPIdentity* BuddyId() const; + + /** + * Matches this object's identity with that of given object. Return True if + * matches. + * + * @param aOtherInstance other CPresenceCacheBuddyStore + * @return ETrue if identity matches. + */ + TBool EqualsIdentity( + const CPresenceCacheBuddyStore* aOtherInstance ) const; + + /** + * Matches this object's identity with that of given object. Return True if + * matches. + * + * @param aOtherInstance MPresenceBuddyInfo object + * @return ETrue if identity matches. + */ + TBool EqualsIdentity( + const MPresenceBuddyInfo* aOtherInstance ) const; + + /** + * Matches this object's identity with that of given identity. Return True if + * matches. + * + * @param aOtherIdentity other identity object + * @return ETrue if identity matches. + */ + TBool EqualsIdentity( + const MXIMPIdentity& aOtherIdentity ) const; + + /** + * Finds whether this object has any presence info. + * + * @return ETrue if this object contains any presence info. + */ + TBool HasPresence() const; + + /** + * Finds whether this object has any subscribers. + * + * @return ETrue if this object has any subscriber(s). + */ + TBool HasSubscribers() const; + +private: // data + + /** + * OWN: Contains presence info or NULL + */ + MPresenceBuddyInfo* iPresenceBuddyInfo; + + /** + * OWN: Contains identity + */ + CXIMPIdentityImp* iIdentity; + + /** + *OWN: Sessions which are subscribed to receive change in this buddy's presence + */ + RPointerArray iSubscribedSessions; + + /** + *Not Owned: Pointer to this object's service store + */ + CPresenceCacheServiceStore* iServiceStore; + + }; + + +#endif // CXIMPPRESENCECACHEBUDDYSTORE_H diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencecache/presencecacheserver/presencecachedefs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencecache/presencecacheserver/presencecachedefs.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,119 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Defines for Presence Cache. + * +*/ + +#ifndef PRESENCECACHEDEFS_H +#define PRESENCECACHEDEFS_H + +#include + +/* + * ============================================================================ + * Presence cache constants + * ============================================================================ + */ +namespace NCacheSrv + { + /** + * Cache server version numbers + */ + namespace NVersion + { + const TInt KMajor = 1; + const TInt KMinor = 1; + const TInt KBuild = 1; + } + + namespace DataBase + { + const TInt KBuddyIdMaxLen = 100; + + } + + + /** + * Cache server names + */ + namespace NName + { + _LIT( KExecutable, "presencecacheserver.exe" ); + _LIT( KMainThread, "PrCacheSrv" ); + _LIT( KSymbianServer, "!XIMPCacheSrv" ); + _LIT( KServerPattern, "*XIMP*" ); + } + + /** + * Cache server requests + */ + namespace NRequest + { + //Number asynchronous message slots for Cache server + const TUint KMsgSlotCount = 4; + + //Presence cache op synch. codes + enum TOpSyncCodes + { + EPrepReadPresenceInfoSync = 1, + EGetLastPreparedPacket, + EGetLastAsyncPreparedPacket, + EBuddyCountInAllServices, + EBuddyCountInService, + EDeleteService, + EDeletePresence, + //EPrepGetAllServices, + //EGetAllServices, + EGetServiceCount, + EWritePresenceInfoSync, + + //Subscription/Notification + ESubscribeBuddyPresenceChange, // 0:aService.iUid, 1:myIdPack + EUnSubscribeBuddyPresenceChange,// 0:aService.iUid, 1:myIdPack + EGetLastNotifiedtPacket, // 0:&ptrBuf + + }; //See the starting count in TOpAsyncCodes before adding here + //Total number should be less than that here + + //Presence cache op asynch. codes + enum TOpAsyncCodes + { + ENoRequestMade = 21, + EWritePresenceInfoAsync, + ECancelAsyncOperation, + EPrepReadAllBuddiesPresenceInService, + EPrepReadAllGivenBuddiesPresence, + + //Subscription/Notification related + EWaitingForNotification, // 0:&sizePckg + ECancelWaitingForNotification // + + }; + } + + /** + * Other constants + */ + namespace NConstants + { + //Number buddy infos write in each cycle of runl + const TUint KMaxWriteEachCycle = 5; + const TUint KMaxReadEachCycle = 5; + const TUint KMaxServicesCount = 10; + const TUint KGranularity = 10; + } + + } + +#endif //PRESENCECACHEDEFS_H diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencecache/presencecacheserver/presencecacheserver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencecache/presencecacheserver/presencecacheserver.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,246 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation for Presence Cache Server +* +*/ + + +// INCLUDE FILES +#include +#include +#include +#include + +#include "presencecacheservicestore.h" +#include "presencecacheserver.h" +#include "presencecachesession.h" +#include "presencecachedefs.h" +#include "ximptrace.h" + +//Include Cache server namespace +using namespace NCacheSrv; + + +// ----------------------------------------------------------------------------- +// CPresenceCacheServer::NewLC() +// ----------------------------------------------------------------------------- +// +CPresenceCacheServer* CPresenceCacheServer::NewLC() + { + CPresenceCacheServer* self = new( ELeave ) CPresenceCacheServer(EPriorityNormal); + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + +// ----------------------------------------------------------------------------- +// CPresenceCacheServer::~CPresenceCacheServer() +// ----------------------------------------------------------------------------- +// +CPresenceCacheServer::~CPresenceCacheServer() + { + DoCancel(); + TInt count = iPresenceCache.Count(); + for (TInt i=0;i( this ); + CSession2* session = NULL; + + session = CPresenceCacheSession::NewL( *self ); + TRACE( _L("CPresenceCacheServer::NewSessionL - end")); + return session; + } + +// ----------------------------------------------------------------------------- +// CPresenceCacheServer::ExecuteL() +// ----------------------------------------------------------------------------- +// +void CPresenceCacheServer::ExecuteL() + { + TRACE( _L("CPresenceCacheServer::ExecuteL - enter")); + // start scheduler + CActiveScheduler* pA = new( ELeave )CActiveScheduler; + CleanupStack::PushL( pA ); + CActiveScheduler::Install( pA ); + + // create server + CPresenceCacheServer* server = CPresenceCacheServer::NewLC(); + server->StartL( NName::KSymbianServer ); + + //Signal client that we are started + RProcess().Rendezvous( KErrNone ); + + //Execute the server + CActiveScheduler::Start(); // CSI: 3 # + + //Cleanup + CleanupStack::PopAndDestroy( server );//server + CleanupStack::PopAndDestroy( pA ); + CActiveScheduler::Install( NULL ); + TRACE( _L("CPresenceCacheServer::ExecuteL - end")); + } + +// ----------------------------------------------------------------------------- +// E32Main() +// Provides the API for the operating system to start the executable. +// Returns the address of the function to be called. +// ----------------------------------------------------------------------------- +// +GLDEF_C TInt E32Main() + { + TRACE( _L("Cache E32Main - enter") ); + + __UHEAP_MARK; + + User::RenameThread( NName::KMainThread ); + + CTrapCleanup* tc = CTrapCleanup::New(); + if( !tc ) + { + return KErrNoMemory; + } + + TRAPD( err, CPresenceCacheServer::ExecuteL() ); + delete tc; + + __UHEAP_MARKEND; + + TRACE_1( _L("Cache E32Main - exit: %d"), err ); + return err; + } + +// ----------------------------------------------------------------------------- +// CShutdown::RunL() +// ----------------------------------------------------------------------------- +// +void CShutdown::RunL() + { + CActiveScheduler::Stop(); + } + +inline CShutdown::CShutdown() + :CTimer(-1) + {CActiveScheduler::Add(this);} +inline void CShutdown::ConstructL() + {CTimer::ConstructL();} +inline void CShutdown::Start() + {After(KMyShutdownDelay);} + +// End of File + diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencecache/presencecacheserver/presencecacheserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencecache/presencecacheserver/presencecacheserver.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,149 @@ +/* +* Copyright (c) 2007, 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Header file for Presence Cache Server +* +*/ + + +#ifndef PRESENCECACHESERVER_H +#define PRESENCECACHESERVER_H + +// INCLUDE FILES +#include + +class CPresenceCacheServiceStore; +class CPresenceCacheSession; + + +/** + * Shutdown timer class, to help us in delayed shutdown. + * @ingroup ximpprescacheserver + * @since S60 v3.2 + */ +class CShutdown : public CTimer + { + enum {KMyShutdownDelay=0x200000}; // approx 2s +public: + inline CShutdown(); + inline void ConstructL(); + inline void Start(); +private: + //Initiate server exit when the timer expires + void RunL(); + }; + + +/** + * Presence cache server class. + * @ingroup ximpprescacheserver + * @since S60 v3.2 + */ +class CPresenceCacheServer : public CServer2 + { + public : // Constructors and destructors + + /** + * NewLC. + * Two-phased constructor. + * @return Pointer to created CPresenceCacheServer object. + */ + static CPresenceCacheServer* NewLC(); + + /** + * ~CPresenceCacheServer. + * Execution and Destruction. + */ + virtual ~CPresenceCacheServer(); + static void ExecuteL(); + + public: // New functions + + /** + * IncrementSessions. + * Increments the count of the active sessions for this server. + */ + void IncrementSessions(); + + /** + * DecrementSessions. + * Decrements the count of the active sessions for this server. + * If no more sessions are in use the server terminates. + */ + void DecrementSessions(); + + /** + * Finds whether given session is alive or not. + * + * @param aSession to look for. + * @return ETrue if session is still alive + */ + TBool SessionExists(CPresenceCacheSession* aSession); + + + protected: // Functions from base classes + + // From CActive + TInt RunError( TInt aError ); + + private: // Constructors and destructors + + /** + * CPresenceCacheServer. + * C++ default constructor. + * @param aPriority priority for this thread. + */ + CPresenceCacheServer( TInt aPriority ); + + /** + * ConstructL. + * 2nd phase constructor. + */ + void ConstructL(); + + private: // Functions from base classes + + /** + * From CServer, NewSessionL. + * Creates a cache server session. + * @param aVersion The client version. + * @param aMessage Message from client. + * @return Pointer to new session. + */ + CSession2* NewSessionL( const TVersion& aVersion, + const RMessage2& aMessage ) const; + + private: // Data + + /** + * iSessionCount, the number of session owned by this server. + */ + TInt iSessionCount; + + + CShutdown iShutdown; + + public: // testing only + + /** + * OWN: Main Presence cache on server side. Used by all sessions. + */ + RPointerArray iPresenceCache; + + }; + + +#endif // PRESENCECACHESERVER_H + +// End of File + diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencecache/presencecacheserver/presencecacheservicestore.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencecache/presencecacheserver/presencecacheservicestore.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,320 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: The cache stores a single array of this type. +* +*/ + + +#include +#include +#include + +#include "presencecacheservicestore.h" +#include "presencecachebuddystore.h" +#include "ximpidentityimp.h" +#include "ximptrace.h" + +// --------------------------------------------------------------------------- +// CPresenceCacheServiceStore::NewLC() +// --------------------------------------------------------------------------- +// +EXPORT_C CPresenceCacheServiceStore* CPresenceCacheServiceStore::NewLC() + { + CPresenceCacheServiceStore* self = new( ELeave ) CPresenceCacheServiceStore; + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + +// --------------------------------------------------------------------------- +// CPresenceCacheServiceStore::NewL() +// --------------------------------------------------------------------------- +// +EXPORT_C CPresenceCacheServiceStore* CPresenceCacheServiceStore::NewL() + { + CPresenceCacheServiceStore* self = NewLC(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// CPresenceCacheServiceStore::~CPresenceCacheServiceStore() +// --------------------------------------------------------------------------- +// +CPresenceCacheServiceStore::~CPresenceCacheServiceStore() + { + TInt count = iBuddyStoreCollection.Count(); + for (TInt i=0;i& CPresenceCacheServiceStore::GetObjectCollection() + { + return iBuddyStoreCollection; + } + +// --------------------------------------------------------------------------- +// CPresenceCacheServiceStore::ServiceName() +// --------------------------------------------------------------------------- +// +TPtrC CPresenceCacheServiceStore::ServiceName() const + { + return *iServiceName; + } + +// --------------------------------------------------------------------------- +// CPresenceCacheServiceStore::Count() +// --------------------------------------------------------------------------- +// +TInt CPresenceCacheServiceStore::Count() const + { + return iBuddyStoreCollection.Count(); + } + +// --------------------------------------------------------------------------- +// CPresenceCacheServiceStore::PresenceCount() +// --------------------------------------------------------------------------- +// +TInt CPresenceCacheServiceStore::PresenceCount() const + { + return iPresenceCount; + } + +// --------------------------------------------------------------------------- +// CPresenceCacheServiceStore::AddBlind() +// --------------------------------------------------------------------------- +// +TInt CPresenceCacheServiceStore::AddBlind(CPresenceCacheBuddyStore* aBuddyStore) + { + TRACE( _L("CPresenceCacheServiceStore::AddBlind - begin") ); + TRACE_1( _L("______identity: %S"), &(aBuddyStore->BuddyId()->Identity())); + + if(!aBuddyStore) + return KErrArgument; + + iBuddyStoreCollection.Append(aBuddyStore); + + // now update the presence count + if(aBuddyStore->HasPresence()) + { + iPresenceCount++; + } + + TRACE( _L("CPresenceCacheServiceStore::AddBlind - return")); + return KErrNone; + } + + +// --------------------------------------------------------------------------- +// CPresenceCacheServiceStore::AddOrReplacePresenceL() +// --------------------------------------------------------------------------- +// +CPresenceCacheBuddyStore* CPresenceCacheServiceStore::AddOrReplacePresenceL + (MPresenceBuddyInfo* aBuddyPresInfo) + { + TRACE( _L("CPresenceCacheServiceStore::AddOrReplacePresence - begin") ); + TRACE_1( _L("______identity: %S"), &(aBuddyPresInfo->BuddyId()->Identity())); + + + CPresenceCacheBuddyStore* newBuddyStore(NULL); + if(!aBuddyPresInfo) + return newBuddyStore; + + TBool oldPresExists(EFalse); + + TInt count = iBuddyStoreCollection.Count(); + for(TInt i=0;iEqualsIdentity(aBuddyPresInfo) ) + { + oldPresExists = (iBuddyStoreCollection[i])->HasPresence(); + iBuddyStoreCollection[i]->SetPresenceBuddyInfo(aBuddyPresInfo); + newBuddyStore = iBuddyStoreCollection[i]; + TRACE( _L("_________Match found") ); + break; + } + } + + //if not edited, we need to add a new buddy store + if(!newBuddyStore) + { + MXIMPIdentity* id = CXIMPIdentityImp::NewLC(aBuddyPresInfo->BuddyId()->Identity()); + newBuddyStore = CPresenceCacheBuddyStore::NewLC(this,id); + newBuddyStore->SetPresenceBuddyInfo(aBuddyPresInfo); + iBuddyStoreCollection.Append(newBuddyStore); + CleanupStack::Pop(newBuddyStore); //newBuddyStore + CleanupStack::Pop(1); //id + } + + // new presence is certainly added, check whether it was existed + if(!oldPresExists) + { + iPresenceCount++; + } + + TRACE( _L("CPresenceCacheServiceStore::AddOrReplacePresence - return")); + return newBuddyStore; + } + + +// --------------------------------------------------------------------------- +// CPresenceCacheServiceStore::RemoveBlind() +// --------------------------------------------------------------------------- +// +void CPresenceCacheServiceStore::RemoveBlind(CPresenceCacheBuddyStore* aPresenceBuddyInfo) + { + TInt index = iBuddyStoreCollection.Find(aPresenceBuddyInfo); + if(index>-1) + { + delete iBuddyStoreCollection[index]; + iBuddyStoreCollection.Remove(index); + } + } + +// --------------------------------------------------------------------------- +// CPresenceCacheServiceStore::FindAndRemove() +// --------------------------------------------------------------------------- +// +CPresenceCacheBuddyStore* CPresenceCacheServiceStore::FindAndRemove + (const MXIMPIdentity& aIdentity, TInt& aErr) + { + TRACE( _L("CPresenceCacheServiceStore::FindAndRemove - begin") ); + TRACE_1( _L("______identity: %S"), &(aIdentity.Identity())); + TBool oldPresExists(EFalse); + CPresenceCacheBuddyStore* buddyStore(NULL); + aErr = KErrNotFound; + + TInt count = iBuddyStoreCollection.Count(); + for(TInt i=0;iEqualsIdentity(aIdentity) ) + { + oldPresExists = (iBuddyStoreCollection[i])->HasPresence(); + + //only delete presence if there are subscribers + if((iBuddyStoreCollection[i])->HasSubscribers()) + { + (iBuddyStoreCollection[i])->SetPresenceBuddyInfo(NULL); + buddyStore = iBuddyStoreCollection[i]; + } + else //if there are no subscribers remove the whole package + { + delete iBuddyStoreCollection[i]; + iBuddyStoreCollection.Remove(i); + } + break; + } + } + + // update presence info counts + if(oldPresExists) + { + iPresenceCount--; + aErr = KErrNone; + } + + TRACE_1( _L("CPresenceCacheServiceStore::FindAndRemove - buddyStore=%d"),buddyStore ); + return buddyStore; + } + +// --------------------------------------------------------------------------- +// CPresenceCacheServiceStore::FindAndGet() +// --------------------------------------------------------------------------- +// +CPresenceCacheBuddyStore* CPresenceCacheServiceStore::FindAndGet( + const MXIMPIdentity& aIdentity) const + { + TRACE( _L("CPresenceCacheServiceStore::FindAndGet - begin") ); + TRACE_1( _L("______identity: %S"), &(aIdentity.Identity())); + CPresenceCacheBuddyStore* buddyStore(NULL); + + TInt count = iBuddyStoreCollection.Count(); + for(TInt i=0;iEqualsIdentity(aIdentity)) + { + buddyStore = iBuddyStoreCollection[i]; + break; + } + } + TRACE_1( _L("CPresenceCacheServiceStore::FindAndGet - buddyStore=%d"),buddyStore ); + return buddyStore; + } + +// --------------------------------------------------------------------------- +// CPresenceCacheServiceStore::RemoveAllPresences() +// --------------------------------------------------------------------------- +// +void CPresenceCacheServiceStore::RemoveAllPresences() + { + TRACE( _L("CPresenceCacheServiceStore::RemoveAllPresences - begin") ); + + TInt count = iBuddyStoreCollection.Count(); + TRACE_1( _L("______store collection count: %d"), count); + for(TInt i=0;iRemovePresenceBuddyInfo(); + //if it doesnt have subscribers delete this whole object + if(!(iBuddyStoreCollection[i]->HasSubscribers())) + { + delete iBuddyStoreCollection[i]; + iBuddyStoreCollection.Remove(i); + count--; + i--; + } + } + iPresenceCount = 0; + TRACE(_L("CPresenceCacheServiceStore::RemoveAllPresences - end")); + } + +// eof diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencecache/presencecacheserver/presencecacheservicestore.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencecache/presencecacheserver/presencecacheservicestore.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,183 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: The cache stores a single array of this type. +* +*/ + +#ifndef CXIMPPRESENCECACHESERVICESTORE_H +#define CXIMPPRESENCECACHESERVICESTORE_H + +class MXIMPIdentity; +class MPresenceBuddyInfo; +class CPresenceCacheBuddyStore; + +/** + * This class is used in presence cache store. The presence server has an array + * of this object, each object represents the buddies in a specific service name. + * This class contains an array of CPresenceCacheBuddyStore. The objects are + * identified by their Identities. + * + * @lib presencecacheserver.exe + * @since S60 v3.2 + */ +class CPresenceCacheServiceStore: public CBase + { + +public: + + /** + * Symbian constructors and c++ destructor + */ + IMPORT_C static CPresenceCacheServiceStore* NewLC(); + IMPORT_C static CPresenceCacheServiceStore* NewL(); + virtual ~CPresenceCacheServiceStore(); + +private: + + /** + * c++ constructor + */ + CPresenceCacheServiceStore(); + + /** + * Symbian second phase constructor + */ + void ConstructL(); + +public: + + /** + * Get the buddy stores pointer array contained by this object. + * Those stores are owned by this object. + * + * @return reference to RPointerArray + */ + RPointerArray& GetObjectCollection(); + + + /** + * Service name of this object + * + * @return TPtrC service name of this object + */ + TPtrC ServiceName() const; + + + /** + * Sets service name of this object + * + * @param aServiceName service name for this object + */ + void SetServiceNameL(TDesC& aServiceName); + + + /** + * Count of buddy stores in this object. + * + * @return TInt number of buddy stores in this object + */ + TInt Count() const; + + + /** + * Count of those buddy stores who has presence info. + * + * @return TInt number of buddy stores who has presence info + */ + TInt PresenceCount() const; + + + /** + * Adds a buddy store object, without checking whether it exists or not. + * Identity of the given store must be set. + * It takes ownership of given buddy store. + * + * @param aPresenceBuddyInfo buddy store to add or replace. + * @return TInt an error code + */ + TInt AddBlind(CPresenceCacheBuddyStore* aPresenceBuddyInfo); + + /** + * Removes a buddy store object blindly. Unlike the other addition and removal + * functions this will not modify the iPresenceCount. This will also not delete + * the provided object. It's caller's responsiblity to delete it. + * + * @param aPresenceBuddyInfo buddy store to be removed + */ + void RemoveBlind(CPresenceCacheBuddyStore* aPresenceBuddyInfo); + + /** + * Adds of replaces a buddies presence info. If the buddy is found, then only + * presence info is updated, leaving subscribed sessions untouched. It is + * recommended to use when an update to an already existing buddy receives. + * It takes ownership of given presence info. + * + * @param aBuddyPresInfo buddy presence info to add or replace. + * @return pointer to newly created or existing CPresenceCacheBuddyStore + */ + CPresenceCacheBuddyStore* AddOrReplacePresenceL(MPresenceBuddyInfo* aBuddyPresInfo); + + + /** + * Finds removed the buddy store with given identity. If the buddy does not + * contain any subscribed sessions, this function removes the whole buddy store. + * But if there are subscribed sessions to this buddy, then it only removes + * presence from that buddy. + * + * @param aIdentity identity of the given buddy to be searched. + * @param aErr the error code is returned here. + * @return pointer to removed CPresenceCacheBuddyStore, returns NULL if the + * buddy store is completely removed, or not found. + */ + CPresenceCacheBuddyStore* FindAndRemove(const MXIMPIdentity& aIdentity, TInt& aErr); + + /** + * Finds and get the buddy store with given identity. + * + * @param aIdentity identity of the given buddy to be searched. + * @return pointer to found CPresenceCacheBuddyStore, returns NULL if the + * buddy store is not found. + */ + CPresenceCacheBuddyStore* FindAndGet(const MXIMPIdentity& aIdentity) const; + + /** + * Removes presence info from all buddy stores contained in this object. + * Notice that those buddy stores which doesnt have any subscribed sessions, + * would be completely removed. + */ + void RemoveAllPresences(); + +private: // data + + + /** + * Array of owned CPresenceCacheBuddyStore pointers + */ + RPointerArray< CPresenceCacheBuddyStore> iBuddyStoreCollection; + + /** + * OWN: Service name for this object + */ + HBufC* iServiceName; + + /** + * OWN: Count of buddy stores which contain valid presence info, because there + * can be objects whose presences are NULL + */ + TInt iPresenceCount; + + }; + + +#endif // CXIMPPRESENCECACHESERVICESTORE_H diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencecache/presencecacheserver/presencecachesession.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencecache/presencecacheserver/presencecachesession.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,1156 @@ +/* +* Copyright (c) 2007, 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Impementation for Presence Cache Server session +* +*/ + + +// INCLUDE FILES +#include +#include +#include +#include +#include + +#include "presencecachesession.h" +#include "presencecacheserver.h" +#include "ximptrace.h" +#include "ximpobjecthelpers.h" +#include "presenceinfoimp.h" +#include "presencebuddyinfolistimp.h" +#include "presencebuddyinfoimp.h" +#include "ximpidentityimp.h" + +#include "presencecacheservicestore.h" +#include "presencecachebuddystore.h" + +//Include Cache server namespace +using namespace NCacheSrv; + + +// --------------------------------------------------------------------------- +// CPresenceCacheSession::NewL() +// --------------------------------------------------------------------------- +// +CPresenceCacheSession* CPresenceCacheSession::NewL( CPresenceCacheServer& aServer ) + { + CPresenceCacheSession* self = CPresenceCacheSession::NewLC( aServer ); + CleanupStack::Pop(self); + return self; + } + +// --------------------------------------------------------------------------- +// CPresenceCacheSession::NewLC() +// --------------------------------------------------------------------------- +// +CPresenceCacheSession* CPresenceCacheSession::NewLC( CPresenceCacheServer& aServer ) + { + CPresenceCacheSession* self = new ( ELeave ) CPresenceCacheSession( aServer ); + CleanupStack::PushL(self); + self->ConstructL(); + return self; + } + +// --------------------------------------------------------------------------- +// CPresenceCacheSession::~CPresenceCacheSession() +// --------------------------------------------------------------------------- +// +CPresenceCacheSession::~CPresenceCacheSession() + { + if(iDataPack) + delete iDataPack; + if(iDataPackAsync) + delete iDataPackAsync; + if(iDataPackNotifier) + delete iDataPackNotifier; + if(iBuddypresInfoList) + delete iBuddypresInfoList; + if(iActiveHelper) + delete iActiveHelper; + iServer.DecrementSessions(); + RemoveMySubscriptions(); // remove all subscriptions subscribed by this session + iSubscribedStores.Close(); + TRACE_1( _L("CPresenceCacheSession[%d]::~CPresenceCacheSession()"), this ); + } + + +// --------------------------------------------------------------------------- +// CPresenceCacheSession::ServiceL() +// --------------------------------------------------------------------------- +// +void CPresenceCacheSession::ServiceL( const RMessage2& aMessage ) + { + switch ( aMessage.Function() ) + { + case NRequest::EPrepReadPresenceInfoSync: + HandlePrepReadPresenceInfoSyncL(aMessage); + break; + + case NRequest::EGetLastPreparedPacket: + HandleGetLastPreparedPacketL(aMessage); + break; + + case NRequest::EGetLastAsyncPreparedPacket: + HandleGetLastPreparedAsyncPacketL(aMessage); + break; + + case NRequest::EBuddyCountInAllServices: + HandleBuddyCountInAllServices(aMessage); + break; + + case NRequest::EBuddyCountInService: + HandleBuddyCountInService(aMessage); + break; + + case NRequest::EGetServiceCount: + HandleGetServiceCount(aMessage); + break; + + case NRequest::EDeleteService: + HandleDeleteService(aMessage); + break; + + case NRequest::EDeletePresence: + HandleDeletePresence(aMessage); + break; + + case NRequest::ECancelAsyncOperation: + HandleCancel(aMessage); + break; + + case NRequest::EWritePresenceInfoSync: + HandleWritePresenceInfoSyncL(aMessage); + break; + + case NRequest::EWritePresenceInfoAsync: + HandleWritePresenceInfoAsyncL(aMessage); + break; + + case NRequest::EPrepReadAllBuddiesPresenceInService: + HandlePrepReadAllBuddiesPresenceInService(aMessage); + break; + + case NRequest::ESubscribeBuddyPresenceChange:// 0:aService.iUid, 1:myIdPack + HandleSubscribeBuddyPresenceChange(aMessage); + break; + + case NRequest::EUnSubscribeBuddyPresenceChange: // 0:aService.iUid, 1:myIdPack + HandleUnSubscribeBuddyPresenceChange(aMessage); + break; + + case NRequest::EGetLastNotifiedtPacket: // 0:&ptrBuf + HandleGetLastNotifiedtPacketL(aMessage); + break; + + case NRequest::EWaitingForNotification: // 0:&sizePckg + HandleWaitingForNotification(aMessage); + break; + + case NRequest::ECancelWaitingForNotification: + HandleCancelWaitingForNotification(aMessage); + break; + + default: + TRACE( _L("CPresenceCacheSession::ServiceL - default")); + aMessage.Complete(KErrArgument); + break; + } + } + +// --------------------------------------------------------------------------- +// CPresenceCacheSession::HandlePrepReadPresenceInfoSyncL() +// --------------------------------------------------------------------------- +// +void CPresenceCacheSession::HandlePrepReadPresenceInfoSyncL( const RMessage2& aMessage ) + { + TRACE( _L("CPresenceCacheSession::HandlePrepReadPresenceInfoSyncL - begin")); + + TInt sizeOfReturnPacket(NULL); + + // unpacking identity + const TInt pckSize = aMessage.GetDesLengthL(1); + HBufC8* idPack = HBufC8::NewLC( pckSize ); + TPtr8 paramPckPtr = idPack->Des(); + aMessage.ReadL( 1, paramPckPtr ); + CXIMPIdentityImp* identity = CXIMPIdentityImp::NewLC(); + TXIMPObjectPacker< CXIMPIdentityImp >::UnPackL(*identity, *idPack); + + TPtrC serviceName = GetServiceName(identity->Identity()); + + // now processing + TInt serviceCount = iServer.iPresenceCache.Count(); + MPresenceBuddyInfo* buddyPresenceInfo(NULL); + CPresenceCacheBuddyStore* buddyStore(NULL); + + TRACE_1( _L("_______serviceCount[%d]"), serviceCount); + + for(TInt i=0; iServiceName()) + { + buddyStore = (iServer.iPresenceCache[i])->FindAndGet(*identity); + if(buddyStore) + buddyPresenceInfo = buddyStore->PresenceBuddyInfo(); + break; + } + } + + CleanupStack::PopAndDestroy(identity); + CleanupStack::PopAndDestroy(idPack); + + TInt err = KErrNotFound; + + TRACE_1( _L("_______buddyPresenceInfo[%d]"), buddyPresenceInfo); + if(buddyPresenceInfo) // if found + { + const CPresenceInfoImp* presInfo = + TXIMPGetImpClassOrPanic< const CPresenceInfoImp >::From(*(buddyPresenceInfo->PresenceInfo())); + if(iDataPack) + delete iDataPack; iDataPack=NULL; + iDataPack = PackPresenceInfoLC(*presInfo); + CleanupStack::Pop(iDataPack); + sizeOfReturnPacket = (iDataPack->Des()).Size(); + err = KErrNone; + } + + TPckgBuf p(sizeOfReturnPacket); + aMessage.WriteL(2,p); + aMessage.Complete(err); + TRACE( _L("CPresenceCacheSession::HandlePrepReadPresenceInfoSyncL - end")); + } + +// --------------------------------------------------------------------------- +// CPresenceCacheSession::HandleGetLastPreparedPacketL() +// --------------------------------------------------------------------------- +// +void CPresenceCacheSession::HandleGetLastPreparedPacketL( const RMessage2& aMessage ) + { + TRACE( _L("CPresenceCacheSession::HandleGetLastPreparedPacketL() - begin")); + if(iDataPack) + aMessage.WriteL(0, *(iDataPack)); + aMessage.Complete(KErrNone); + } + +// --------------------------------------------------------------------------- +// CPresenceCacheSession::HandleGetLastPreparedAsyncPacketL() +// --------------------------------------------------------------------------- +// +void CPresenceCacheSession::HandleGetLastPreparedAsyncPacketL( const RMessage2& aMessage ) + { + if(iDataPackAsync) + aMessage.WriteL(0, *(iDataPackAsync)); + aMessage.Complete(KErrNone); + } + +// --------------------------------------------------------------------------- +// CPresenceCacheSession::HandleWritePresenceInfoSyncL() +// --------------------------------------------------------------------------- +// +void CPresenceCacheSession::HandleWritePresenceInfoSyncL(const RMessage2& aMessage ) + { + TRACE( _L("CPresenceCacheSession::HandleWritePresenceInfoSyncL - begin")); + TInt err(KErrNone); + const TInt pckSize = aMessage.GetDesLengthL(0); + if(iDataPack) + delete iDataPack; iDataPack=NULL; + iDataPack = HBufC8::NewL( pckSize ); + TPtr8 paramPckPtr = iDataPack->Des(); + aMessage.ReadL( 0, paramPckPtr ); + + CPresenceBuddyInfoImp* buddypresenceInfo = CPresenceBuddyInfoImp::NewLC(); + + + TXIMPObjectPacker< CPresenceBuddyInfoImp >::UnPackL(*buddypresenceInfo, *iDataPack); + + err = TryWriteBuddyToCacheL(buddypresenceInfo); + + if(err==KErrNone) //ownership transferred + CleanupStack::Pop(buddypresenceInfo); + else + CleanupStack::PopAndDestroy(buddypresenceInfo); + aMessage.Complete(err); + TRACE( _L("CPresenceCacheSession::HandleWritePresenceInfoSyncL - end")); + } + +// --------------------------------------------------------------------------- +// CPresenceCacheSession::HandlePrepReadAllBuddiesPresenceInService() +// --------------------------------------------------------------------------- +// +void CPresenceCacheSession::HandlePrepReadAllBuddiesPresenceInService + (const RMessage2& aMessage ) + { + if(iActiveHelper->IsActive()) + aMessage.Complete(KErrServerBusy); + else + { + iMessage = aMessage; + + iAsyncReq = NRequest::EPrepReadAllBuddiesPresenceInService; + iActiveHelper->Start(); + } + } + +// --------------------------------------------------------------------------- +// CPresenceCacheSession::ReadAllBuddiesPresenceInServiceL() +// --------------------------------------------------------------------------- +// +void CPresenceCacheSession::ReadAllBuddiesPresenceInServiceL() + { + const TInt pckSize = iMessage.GetDesLengthL(0); + HBufC* serviceName = HBufC16::NewLC( pckSize ); + TPtr16 paramPckPtr = serviceName->Des(); + iMessage.ReadL( 0, paramPckPtr ); + + TInt serviceCount = iServer.iPresenceCache.Count(); + CPresenceCacheServiceStore* serviceStore(NULL); + CPresenceBuddyInfoListImp* buddyPresenceInfoList(NULL); + CPresenceCacheBuddyStore* buddyStore(NULL); + MPresenceBuddyInfo* presBuddyInfo(NULL); + TInt presCount(0); + TInt count(0); + + for(TInt i=0; iDes() == serviceStore->ServiceName()) + { + presCount = serviceStore->PresenceCount(); + // if it has presences + if(presCount) + { + buddyPresenceInfoList = CPresenceBuddyInfoListImp::NewLC(*serviceName); + buddyPresenceInfoList->SetOwnObjects(EFalse); + count = serviceStore->Count(); + for(TInt j=0; jGetObjectCollection()[j]; + presBuddyInfo = buddyStore->PresenceBuddyInfo(); + if(presBuddyInfo) + buddyPresenceInfoList->BlindAddL(presBuddyInfo); + } + } + break; + } + } + + TInt size(KErrNotFound); // this may also indicate error to client if negative + if(buddyPresenceInfoList) // if found + { + if(iDataPackAsync) + delete iDataPackAsync; iDataPackAsync = NULL; + iDataPackAsync = TXIMPObjectPacker< CPresenceBuddyInfoListImp>::PackL( *buddyPresenceInfoList); + size = (iDataPackAsync->Des()).Size(); + CleanupStack::PopAndDestroy(buddyPresenceInfoList); + } + + CleanupStack::PopAndDestroy(serviceName); + iAsyncReq = NRequest::ENoRequestMade; + iMessage.Complete(size); + } + + +// --------------------------------------------------------------------------- +// CPresenceCacheSession::TryWriteBuddyToCache() +// --------------------------------------------------------------------------- +// +TInt CPresenceCacheSession::TryWriteBuddyToCacheL(MPresenceBuddyInfo* aBuddyPresInfo) + { + if(!aBuddyPresInfo) + return KErrArgument; + + TPtrC serviceName = GetServiceName(aBuddyPresInfo->BuddyId()->Identity()); + TInt serviceCount = iServer.iPresenceCache.Count(); + CPresenceCacheBuddyStore* buddyStore(NULL); + + for(TInt i=0; iServiceName()) + { + buddyStore = (iServer.iPresenceCache[i])->AddOrReplacePresenceL(aBuddyPresInfo); + break; + } + } + if(!buddyStore) // if not written + { + CPresenceCacheServiceStore* newServiceStore = CPresenceCacheServiceStore::NewLC(); + newServiceStore->SetServiceNameL(serviceName); + buddyStore = newServiceStore->AddOrReplacePresenceL(aBuddyPresInfo); + (iServer.iPresenceCache).Append(newServiceStore); //ownership transferred + CleanupStack::Pop(newServiceStore); + } + + if(buddyStore) // inform to subscribers + NotifyAllSubscribersL(buddyStore); + + return buddyStore ? KErrNone : KErrGeneral; + } + + +// --------------------------------------------------------------------------- +// CPresenceCacheSession::HandleCancel() +// --------------------------------------------------------------------------- +// +void CPresenceCacheSession::HandleCancel(const RMessage2& aMessage ) + { + if (iActiveHelper->IsActive()) + iActiveHelper->Cancel(); //see also iActiveHelper->DoCancel() + aMessage.Complete(KErrNotFound); + } + +// --------------------------------------------------------------------------- +// CPresenceCacheSession::HandleBuddyCountInAllServices() +// --------------------------------------------------------------------------- +// +void CPresenceCacheSession::HandleBuddyCountInAllServices(const RMessage2& aMessage ) + { + TRACE( _L("CPresenceCacheSession::HandleBuddyCountInAllServices - begin")); + TInt count(NULL); + TInt serviceCount = iServer.iPresenceCache.Count(); + + for(TInt i=0; iPresenceCount()); + } + + TPckgBuf p(count); + aMessage.WriteL(0,p); + aMessage.Complete(KErrNone); + TRACE( _L("CPresenceCacheSession::HandleBuddyCountInAllServices - end")); + } + +// --------------------------------------------------------------------------- +// CPresenceCacheSession::HandleBuddyCountInService() +// --------------------------------------------------------------------------- +// +void CPresenceCacheSession::HandleBuddyCountInService(const RMessage2& aMessage ) + { + TInt count(NULL); + + const TInt pckSize = aMessage.GetDesLengthL(1); + HBufC* serviceName = HBufC16::NewLC( pckSize ); + TPtr16 paramPckPtr = serviceName->Des(); + aMessage.ReadL( 1, paramPckPtr ); + + TInt serviceCount = iServer.iPresenceCache.Count(); + TInt err(KErrNotFound); + + for(TInt i=0; iDes() == (iServer.iPresenceCache[i])->ServiceName()) + { + count = ((iServer.iPresenceCache[i])->PresenceCount()); + err = KErrNone; + break; + } + } + + CleanupStack::PopAndDestroy(serviceName); + TPckgBuf p(count); + aMessage.WriteL(0,p); + aMessage.Complete(err); + } + +// --------------------------------------------------------------------------- +// CPresenceCacheSession::HandleDeleteService() +// --------------------------------------------------------------------------- +// +void CPresenceCacheSession::HandleDeleteService(const RMessage2& aMessage ) + { + TRACE( _L("CPresenceCacheSession::HandleDeleteService - begin")); + TInt err(KErrNotFound); + + const TInt pckSize = aMessage.GetDesLengthL(0); + HBufC* serviceName = HBufC16::NewLC( pckSize ); + TPtr16 paramPckPtr = serviceName->Des(); + aMessage.ReadL( 0, paramPckPtr ); + + TInt serviceCount = iServer.iPresenceCache.Count(); + TInt buddyCount(NULL); + + TRACE_1( _L("_______serviceCount[%d]"), serviceCount); + for(TInt i=0; iDes() == (iServer.iPresenceCache[i])->ServiceName()) + { + (iServer.iPresenceCache[i])->RemoveAllPresences(); + buddyCount = (iServer.iPresenceCache[i])->GetObjectCollection().Count(); + TRACE_1( _L("_______buddyCountAfter[%d]"), buddyCount); + + //if there are no buddies left in this service delete this whole service + if(buddyCount==0) + { + delete iServer.iPresenceCache[i]; + iServer.iPresenceCache.Remove(i); + } + + //inform all subscribers + for(TInt j=0;jGetObjectCollection()[j]); + } + err = KErrNone; + break; + } + } + CleanupStack::PopAndDestroy(serviceName); + aMessage.Complete(err); + TRACE( _L("CPresenceCacheSession::HandleDeleteService - end")); + } + +// --------------------------------------------------------------------------- +// CPresenceCacheSession::HandleDeletePresence() +// --------------------------------------------------------------------------- +// +void CPresenceCacheSession::HandleDeletePresence(const RMessage2& aMessage ) + { + const TInt pckSize = aMessage.GetDesLengthL(0); + HBufC8* idPack = HBufC8::NewLC( pckSize ); + TPtr8 paramPckPtr = idPack->Des(); + aMessage.ReadL( 0, paramPckPtr ); + TInt err(KErrNotFound); + TInt buddyCount(NULL); + + CXIMPIdentityImp* identity = CXIMPIdentityImp::NewLC(); + + TXIMPObjectPacker< CXIMPIdentityImp >::UnPackL(*identity, *idPack); + + TPtrC serviceName = GetServiceName(identity->Identity()); + + TInt serviceCount = iServer.iPresenceCache.Count(); + + CPresenceCacheBuddyStore* buddyStore(NULL); + for(TInt i=0; iServiceName()) == serviceName) + { + buddyStore = (iServer.iPresenceCache[i])->FindAndRemove(*identity,err); + + buddyCount = (iServer.iPresenceCache[i])->GetObjectCollection().Count(); + TRACE_1( _L("_______buddyCountAfter[%d]"), buddyCount); + + //if there are no buddies left in this service delete this whole service + if(buddyCount==0) + { + delete iServer.iPresenceCache[i]; + iServer.iPresenceCache.Remove(i); + } + break; + } + } + + CleanupStack::PopAndDestroy(identity); + CleanupStack::PopAndDestroy(idPack); + aMessage.Complete(err); + + if(buddyStore) // if subscribers + NotifyAllSubscribersL(buddyStore); + } + + +// --------------------------------------------------------------------------- +// CPresenceCacheSession::HandleGetServiceCount() +// --------------------------------------------------------------------------- +// +void CPresenceCacheSession::HandleGetServiceCount(const RMessage2& aMessage ) + { + // iLastServiceCount is also used for mem aloc by client before calling + // GetAllServices + TInt serviceCount = iServer.iPresenceCache.Count(); + iLastServiceCount = 0; + TRACE_1( _L("CPresenceCacheSession::HandleGetServiceCount realcount[%d]- end"),serviceCount); + for(TInt i=0;iPresenceCount()) + iLastServiceCount++; + } + + TPckgBuf p(iLastServiceCount); + aMessage.WriteL(0,p); + aMessage.Complete(KErrNone); + } + +// --------------------------------------------------------------------------- +// CPresenceCacheSession::HandleGetAllServicesL() +// --------------------------------------------------------------------------- +// +/* +void CPresenceCacheSession::HandleGetAllServicesL(const RMessage2& aMessage ) + { + TInt serviceCount = iServer.iPresenceCache.Count(); + TInt size(NULL); + + if(serviceCount) + { + CArrayFixFlat* services = new (ELeave) CArrayFixFlat(1); + CleanupStack::PushL(services); + + for(TInt i=0; iPresenceCount()) + services->AppendL((iServer.iPresenceCache[i])->Service()); + } + + if (iDataPack) + { + delete iDataPack; iDataPack = NULL; + } + iDataPack = PackServicesL(services); + CleanupStack::PopAndDestroy(services); + size = (iDataPack->Des()).Size(); + } + aMessage.Complete(size); + }*/ + +// --------------------------------------------------------------------------- +// CPresenceCacheSession::HandleWritePresenceInfoAsyncL() +// --------------------------------------------------------------------------- +// +void CPresenceCacheSession::HandleWritePresenceInfoAsyncL(const RMessage2& aMessage ) + { + if(iActiveHelper->IsActive()) + { + aMessage.Complete(KErrServerBusy); + return; + } + iMessage = aMessage; + + const TInt pckSize = aMessage.GetDesLengthL(0); + if(iDataPackAsync) + delete iDataPackAsync; iDataPackAsync = NULL; + iDataPackAsync = HBufC8::NewL( pckSize ); + TPtr8 paramPckPtr = iDataPackAsync->Des(); + aMessage.ReadL( 0, paramPckPtr ); + + if(iBuddypresInfoList) + delete iBuddypresInfoList; iBuddypresInfoList = NULL; + iBuddypresInfoList = CPresenceBuddyInfoListImp::NewLC(KNullDesC); + CleanupStack::Pop(iBuddypresInfoList); + + TXIMPObjectPacker< CPresenceBuddyInfoListImp >::UnPackL(*iBuddypresInfoList, *iDataPackAsync); + + iAsyncReq = NRequest::EWritePresenceInfoAsync; + iActiveHelper->Start(); + return; + } + +// --------------------------------------------------------------------------- +// CPresenceCacheSession::WritePresenceInfoAsyncL() +// --------------------------------------------------------------------------- +// +void CPresenceCacheSession::WritePresenceInfoAsyncL() + { + TInt err(KErrNone); + TInt thisTimeWrites(0); + if(!iBuddypresInfoList) // return if this function is wrongly called + return; + + // This routine reads data from iBuddypresInfoList and tries to write + // data to cache on each runl cycle. It writes either KMaxWriteEachCycle + // times, or upto data is finnished. After data is written KMaxWriteEachCycle + // times and still more data is left, it makes this class active so that this + // function is again called on next RunL. + while(iBuddypresInfoList->Count()) + { + err = TryWriteBuddyToCacheL((iBuddypresInfoList->GetObjectCollection())[0]); + if(err==KErrNone) // if no erroe then pop the object from list + (iBuddypresInfoList->GetObjectCollection()).Remove(0); + else + break; // break in case of error + thisTimeWrites++; + if(thisTimeWrites == NConstants::KMaxWriteEachCycle) // this times writes are over + { + if(iActiveHelper->IsActive())// unusual condition + { + err = KErrGeneral; + break; + } + iActiveHelper->Start(); + return; // set for next time writing. + } + } + // if we able to come out of while loop either writing is complete or + // there was some error while writing, in both cases finnish writing + iAsyncReq = NRequest::ENoRequestMade; + iMessage.Complete(err); + return; + } + +// --------------------------------------------------------------------------- +// CPresenceCacheSession::HandleSubscribeBuddyPresenceChange() +// --------------------------------------------------------------------------- +// +void CPresenceCacheSession::HandleSubscribeBuddyPresenceChange + (const RMessage2& aMessage ) + { + TRACE( _L("CPresenceCacheSession::HandleSubscribeBuddyPresenceChange - begin")); + + // Extract info from message + const TInt pckSize = aMessage.GetDesLengthL(1); + HBufC8* idPack = HBufC8::NewLC( pckSize ); + TPtr8 paramPckPtr = idPack->Des(); + aMessage.ReadL( 1, paramPckPtr ); + + CXIMPIdentityImp* identity = CXIMPIdentityImp::NewLC(); + + TXIMPObjectPacker< CXIMPIdentityImp >::UnPackL(*identity, *idPack); + + TPtrC serviceName = GetServiceName(identity->Identity()); + + CPresenceCacheBuddyStore* buddyStore(NULL); + CPresenceCacheServiceStore* serviceStore(NULL); + + TInt err(KErrGeneral); // there must not be error in this handler + // but just for debug purpose + + + // now processing + TInt serviceCount = iServer.iPresenceCache.Count(); + + + TRACE_1( _L("_______serviceCount[%d]"), serviceCount); + + for(TInt i=0; iServiceName()) + { + serviceStore = iServer.iPresenceCache[i]; + buddyStore = (iServer.iPresenceCache[i])->FindAndGet(*identity); + break; + } + } + + if(!buddyStore) // if buddy was not found, create and add it + { + if(!serviceStore) //if service was also not found, create it + { + serviceStore = CPresenceCacheServiceStore::NewLC(); + serviceStore->SetServiceNameL(serviceName); + (iServer.iPresenceCache).Append(serviceStore); //ownership transferred + CleanupStack::Pop(serviceStore); + } + buddyStore = CPresenceCacheBuddyStore::NewLC(serviceStore,identity); + err = serviceStore->AddBlind(buddyStore); //ownership transferred + CleanupStack::Pop(buddyStore); + CleanupStack::Pop(identity); + } + else + CleanupStack::PopAndDestroy(identity); // since in this case ownership wasnt tranferred + + CleanupStack::PopAndDestroy(idPack); + + TRACE_1( _L("buddyStore[%d]"), buddyStore); + if(buddyStore) // must be there, just for double check + { + buddyStore->AddSubscribedSession(this); + if(iSubscribedStores.Find(buddyStore) < 0) //if session not already there + iSubscribedStores.Append(buddyStore); + err = KErrNone; + } + + aMessage.Complete(err); // there shouldnt be any errors + TRACE( _L("CPresenceCacheSession::HandleSubscribeBuddyPresenceChange - end")); + } + +// --------------------------------------------------------------------------- +// CPresenceCacheSession::HandleUnSubscribeBuddyPresenceChange() +// --------------------------------------------------------------------------- +// +void CPresenceCacheSession::HandleUnSubscribeBuddyPresenceChange + (const RMessage2& aMessage ) + { + TRACE( _L("CPresenceCacheSession::HandleUnSubscribeBuddyPresenceChange - begin")); + + // Extract info from message + const TInt pckSize = aMessage.GetDesLengthL(1); + HBufC8* idPack = HBufC8::NewLC( pckSize ); + TPtr8 paramPckPtr = idPack->Des(); + aMessage.ReadL( 1, paramPckPtr ); + TInt err(KErrNotFound); + + CXIMPIdentityImp* identity = CXIMPIdentityImp::NewLC(); + + TXIMPObjectPacker< CXIMPIdentityImp >::UnPackL(*identity, *idPack); + + TPtrC serviceName = GetServiceName(identity->Identity()); + + + // now processing + TInt serviceCount = iServer.iPresenceCache.Count(); + CPresenceCacheBuddyStore* buddyStore(NULL); + + TRACE_1( _L("_______serviceCount[%d]"), serviceCount); + + for(TInt i=0; iServiceName()) + { + buddyStore = (iServer.iPresenceCache[i])->FindAndGet(*identity); + break; + } + } + + CleanupStack::PopAndDestroy(identity); + CleanupStack::PopAndDestroy(idPack); + + TRACE_1( _L("buddyStore[%d]"), buddyStore); + if(buddyStore) // if found + { + buddyStore->RemoveSubscribedSession(this); + iSubscribedStores.Remove(iSubscribedStores.Find(buddyStore)); + err = KErrNone; + } + + aMessage.Complete(err); + TRACE_1( _L("CPresenceCacheSession::HandleUnSubscribeBuddyPresenceChange (%d) - end"),err); + } + +// --------------------------------------------------------------------------- +// CPresenceCacheSession::HandleGetLastNotifiedtPacketL() +// --------------------------------------------------------------------------- +// +void CPresenceCacheSession::HandleGetLastNotifiedtPacketL(const RMessage2& aMessage ) + { + TRACE( _L("CPresenceCacheSession::HandleGetLastNotifiedtPacketL() - begin")); + if(iDataPackNotifier) + aMessage.WriteL(0, *(iDataPackNotifier)); + aMessage.Complete(KErrNone); + } + +// --------------------------------------------------------------------------- +// CPresenceCacheSession::HandleWaitingForNotification() +// --------------------------------------------------------------------------- +// +void CPresenceCacheSession::HandleWaitingForNotification(const RMessage2& aMessage ) + { + iMessageForNoti = aMessage; + } + +// --------------------------------------------------------------------------- +// CPresenceCacheSession::HandleCancelWaitingForNotification() +// --------------------------------------------------------------------------- +// +void CPresenceCacheSession::HandleCancelWaitingForNotification + (const RMessage2& aMessage ) + { + aMessage.Complete(KErrNone); + if(!iMessageForNoti.IsNull()) + iMessageForNoti.Complete(KErrCancel); + } + +// --------------------------------------------------------------------------- +// CPresenceCacheSession::NotifyPresenceChangeL() +// --------------------------------------------------------------------------- +// +void CPresenceCacheSession::NotifyPresenceChangeL( + const CPresenceBuddyInfoImp* aPresenceBuddyInfo) + { + TRACE( _L("CPresenceCacheSession::NotifyPresenceChangeL() - begin")); + TInt sizeOfReturnPacket(NULL); + if(aPresenceBuddyInfo && (!iMessageForNoti.IsNull())) // if pointers are valid + { + if(iDataPackNotifier) + delete iDataPackNotifier; iDataPackNotifier=NULL; + iDataPackNotifier = PackBuddyPresenceInfoLC(aPresenceBuddyInfo); + CleanupStack::Pop(iDataPackNotifier); + sizeOfReturnPacket = (iDataPackNotifier->Des()).Size(); + TPckgBuf p(sizeOfReturnPacket); + iMessageForNoti.WriteL(0,p); + iMessageForNoti.Complete(KErrNone); + TRACE( _L("_______message was valid")); + } + TRACE( _L("CPresenceCacheSession::NotifyPresenceChangeL - end")); + } + +// --------------------------------------------------------------------------- +// CPresenceCacheSession::NotifyAllSubscribersL() +// --------------------------------------------------------------------------- +// +void CPresenceCacheSession::NotifyAllSubscribersL + (CPresenceCacheBuddyStore* aBuddyStore) + { + TRACE( _L("CPresenceCacheSession::NotifyAllSubscribers() - begin")); + if(!aBuddyStore) + return; + TInt subsCount = aBuddyStore->GetSubscribedSessions().Count(); + TRACE_1( _L("_______total subscribed sessions[%d]"), subsCount); + TBool ownBuddyInfo(EFalse); + const CPresenceBuddyInfoImp* buddyInfo; + + if(subsCount) // start processing if there are subscribers + { + //if presence has been deleted we need to identity and service id in the packed + //which will be sent to clients + if(!(aBuddyStore->PresenceBuddyInfo())) + { + CPresenceBuddyInfoImp* buddyInfoTemp = CPresenceBuddyInfoImp::NewLC(); + MXIMPIdentity* id = CXIMPIdentityImp::NewLC(aBuddyStore->BuddyId()->Identity()); + buddyInfoTemp->SetBuddyId(id); + CleanupStack::Pop(1); //id + ownBuddyInfo = ETrue; + buddyInfo = buddyInfoTemp; + } + else + { + buddyInfo = + TXIMPGetImpClassOrPanic< const CPresenceBuddyInfoImp >::From( *(aBuddyStore->PresenceBuddyInfo()) ); + } + + CPresenceCacheSession* session(NULL); + for(TInt i=0;iGetSubscribedSessions()[i]; + if(iServer.SessionExists(session)) + { + TRACE_1( _L("_______valid session notified[%d]"), session); + session->NotifyPresenceChangeL(buddyInfo); + } + else + { + aBuddyStore->RemoveSubscribedSession(session); + subsCount--;//substract this removed session from total count + i--; + TRACE_1( _L("_______invalid session removed[%d]"), session); + } + } + } + + if(ownBuddyInfo) + CleanupStack::PopAndDestroy(1); //buddyInfoTemp + TRACE( _L("CPresenceCacheSession::NotifyAllSubscribers() - end")); + } + +// --------------------------------------------------------------------------- +// CPresenceCacheSession::GetServiceName() +// --------------------------------------------------------------------------- +// +TPtrC CPresenceCacheSession::GetServiceName(const TDesC& aXspId) + { + _LIT(KColon, ":"); + TInt pos = aXspId.Find(KColon); + TPtrC serviceName; + if(pos>0) // if colon found and there is something before colon, i.e. xsp id + { + serviceName.Set(aXspId.Left(pos)); + } + else + serviceName.Set(TPtrC()); + return serviceName; + } + +// --------------------------------------------------------------------------- +// CPresenceCacheSession::Cancel() +// --------------------------------------------------------------------------- +// +void CPresenceCacheSession::Cancel() + { + if (iAsyncReq != NRequest::ENoRequestMade) + { + iMessage.Complete(KErrCancel); + iAsyncReq = NRequest::ENoRequestMade; + } + return; + } + +// --------------------------------------------------------------------------- +// CPresenceCacheSession::PackPresenceDocLC() +// --------------------------------------------------------------------------- +// +HBufC8* CPresenceCacheSession::PackPresenceInfoLC(const MPresenceInfo& aPresInfo) + { + const CPresenceInfoImp* tmp = + TXIMPGetImpClassOrPanic< const CPresenceInfoImp >::From(aPresInfo); + HBufC8* pack = TXIMPObjectPacker< CPresenceInfoImp>::PackL( *tmp); + CleanupStack::PushL( pack ); + + return pack; + } + +// --------------------------------------------------------------------------- +// CPresenceCacheSession::PackBuddyPresenceInfoLC() +// --------------------------------------------------------------------------- +// +HBufC8* CPresenceCacheSession::PackBuddyPresenceInfoLC( + const CPresenceBuddyInfoImp* aBuddyPresInfo) + { + HBufC8* pack(NULL); + if(aBuddyPresInfo) + { + //const CPresenceBuddyInfoImp* pifImp = + // TXIMPGetImpClassOrPanic< const CPresenceBuddyInfoImp >::From( *aBuddyPresInfo ); + + pack = TXIMPObjectPacker< const CPresenceBuddyInfoImp>::PackL( *aBuddyPresInfo ); + CleanupStack::PushL( pack ); + } + + return pack; + } + + +// --------------------------------------------------------------------------- +// CPresenceCacheSession::PackServicesL() +// --------------------------------------------------------------------------- +// +/* +HBufC8* CPresenceCacheSession::PackServicesL(CArrayFixFlat* aArray ) + { + CBufFlat* packBuf = CBufFlat::NewL( NConstants::KGranularity ); + CleanupStack::PushL( packBuf ); + + RBufWriteStream ws; + ws.Open( *packBuf ); // CSI: 65 # + CleanupClosePushL( ws ); + + // Get count of objects + TInt objCount = aArray->Count(); + // write the count + ws.WriteInt32L( objCount ); + // objects + for ( TInt count(0); count < objCount; count++ ) + { + ws<<(aArray->At(count)); + } + + ws.CommitL(); + CleanupStack::PopAndDestroy(); //ws + + HBufC8* packBufDesc = packBuf->Ptr(0).AllocL(); + CleanupStack::PopAndDestroy( packBuf ); + + return packBufDesc; + }*/ + +// --------------------------------------------------------------------------- +// CPresenceCacheSession::CPresenceCacheSession() +// --------------------------------------------------------------------------- +// +CPresenceCacheSession::CPresenceCacheSession( CPresenceCacheServer& aServer ) + : iServer( aServer ), + iLastServiceCount(0) + { + TRACE( _L("CPresenceCacheSession::CPresenceCacheSession()")); + } + +// --------------------------------------------------------------------------- +// CPresenceCacheSession::ConstructL() +// --------------------------------------------------------------------------- +// +void CPresenceCacheSession::ConstructL() + { + iActiveHelper = CCacheSessionActiveHelper::NewL(this); + iServer.IncrementSessions(); + return; + } + +// --------------------------------------------------------------------------- +// CPresenceCacheSession::RemoveMySubscriptions() +// --------------------------------------------------------------------------- +// +void CPresenceCacheSession::RemoveMySubscriptions() + { + TInt count = iSubscribedStores.Count(); + for(TInt i=0;iRemoveSubscribedSession(this); + } + } + + +// --------------------------------------------------------------------------- +// CCacheSessionActiveHelper::NewL() +// --------------------------------------------------------------------------- +// +CCacheSessionActiveHelper* CCacheSessionActiveHelper::NewL + (CPresenceCacheSession* aSession ) + { + CCacheSessionActiveHelper* self = new(ELeave) CCacheSessionActiveHelper(aSession); + CleanupStack::PushL( self ); + self->ConstructL( ); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// CCacheSessionActiveHelper::~CCacheSessionActiveHelper() +// --------------------------------------------------------------------------- +// +CCacheSessionActiveHelper::~CCacheSessionActiveHelper( ) + { + Cancel(); + } + +// --------------------------------------------------------------------------- +// CCacheSessionActiveHelper::Start() +// --------------------------------------------------------------------------- +// +void CCacheSessionActiveHelper::Start() + { + TRequestStatus* status = &iStatus; + User::RequestComplete(status,KErrNone); + SetActive(); + } + +// --------------------------------------------------------------------------- +// CCacheSessionActiveHelper::CCacheSessionActiveHelper() +// --------------------------------------------------------------------------- +// +CCacheSessionActiveHelper::CCacheSessionActiveHelper(CPresenceCacheSession* aSession ) + : CActive(EPriorityStandard) + { + iCacheSession = aSession; + } + +// --------------------------------------------------------------------------- +// CCacheSessionActiveHelper::RunL() +// --------------------------------------------------------------------------- +// +void CCacheSessionActiveHelper::RunL() + { + switch (iCacheSession->iAsyncReq) + { + case NRequest::EWritePresenceInfoAsync: + iCacheSession->WritePresenceInfoAsyncL(); + break; + + case NRequest::EPrepReadAllBuddiesPresenceInService: + iCacheSession->ReadAllBuddiesPresenceInServiceL(); + break; + + case NRequest::ENoRequestMade: + default: + break; + } + } + +// --------------------------------------------------------------------------- +// CCacheSessionActiveHelper::DoCancel() +// --------------------------------------------------------------------------- +// +void CCacheSessionActiveHelper::DoCancel() + { + iCacheSession->Cancel(); + } + +// --------------------------------------------------------------------------- +// CCacheSessionActiveHelper::ConstructL() +// --------------------------------------------------------------------------- +// +void CCacheSessionActiveHelper::ConstructL() + { + CActiveScheduler::Add(this); + } + + +// End of File diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencecache/presencecacheserver/presencecachesession.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencecache/presencecacheserver/presencecachesession.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,341 @@ +/* +* Copyright (c) 2007, 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Header file for Presence Cache Server session +* +*/ + + +#ifndef PRESENCECACHESESSION_H +#define PRESENCECACHESESSION_H + +// INCLUDE FILES +#include + +#include "presencecachedefs.h" + +/** + * Presence cache server session class. + * @ingroup ximpprescacheserver + * @since S60 v3.2 + */ +// FORWARD DECLARATIONS +class CPresenceCacheServer; +class MPresenceInfo; +class MPresenceBuddyInfo; +class CPresenceBuddyInfoListImp; +class CPresenceBuddyInfoImp; +class CCacheSessionActiveHelper; +class CPresenceCacheBuddyStore; + +//Include Cache server namespace +using namespace NCacheSrv; + +class CPresenceCacheSession : public CSession2 + { + friend class CCacheSessionActiveHelper; + public: // Constructors and destructors + + /** + * Two-phased constructor. + * @param aServer The server. + * @return Pointer to created CPresenceCacheSession object. + */ + static CPresenceCacheSession* NewL( CPresenceCacheServer& aServer ); + + /** + * Two-phased constructor. + * @param aServer The server. + * @return Pointer to created CPresenceCacheSession object. + */ + static CPresenceCacheSession* NewLC( CPresenceCacheServer& aServer ); + + /** + * ~CPresenceCacheSession. + * Destructor. + */ + virtual ~CPresenceCacheSession(); + + public: // Functions from base classes + + /** + * From CSession + */ + void ServiceL( const RMessage2& aMessage ); + + public: // own + + /** + * This is called by some other session to inform this session that given + * buddy's presence has been changed. The informing session first make + * sure that this session has subscribed for the changes in given buddy. + * + *@param pointer to CPresenceBuddyInfoImp, ownership doesnt transfer. + */ + void NotifyPresenceChangeL(const CPresenceBuddyInfoImp* aPresenceBuddyInfo); + + private: // Constructors and destructors + + /** + * C++ default constructor. + * @param aServer The server. + */ + CPresenceCacheSession( CPresenceCacheServer& aServer ); + + /** + * Construct. + * 2nd phase constructor + */ + void ConstructL(); + + private: // New methods + + /** + * Packs PresenceInfo object into a data packet. + * @param aPresInfo PresenceInfo object. + * @return HBufC* data packet. + */ + HBufC8* PackPresenceInfoLC(const MPresenceInfo& aPresInfo); + + /** + * Cancels the async request, this is called by docancel of active helper + */ + void Cancel(); + + /** + * Tries writing given buddy to presence cache + * @param aBuddyPresInfo object to write. + * @return TInt error code + */ + TInt TryWriteBuddyToCacheL(MPresenceBuddyInfo* aBuddyPresInfo); + + /** + * Packs services array + * + * @param CArrayFixFlat aArray + * @return packed object + */ + //HBufC8* PackServicesL(CArrayFixFlat* aArray ); + + /** + * Removes all subscriptions stored by this session in iSubscribedStores + */ + void RemoveMySubscriptions(); + + /** + * Notify to subscribers in given buddy store's presence change. This method + * goes through all subscribed sessions and call their NotifyPresenceChangeL + * methods. Ownership of store is not transferred. + * + * @param aBuddyStore pointer to changed CPresenceCacheBuddyStore + */ + void NotifyAllSubscribersL(CPresenceCacheBuddyStore* aBuddyStore); + + /** + * Pack buddy's presence info into descriptor. + * + * @param aBuddyPresInfo buddy's presence info, ownership doesnt transfer + * @param HBufC8* packed presence info + */ + HBufC8* PackBuddyPresenceInfoLC( + const CPresenceBuddyInfoImp* aBuddyPresInfo); + + + private: // New Massage processors, these are called to process messages. + void HandlePrepReadPresenceInfoSyncL(const RMessage2& aMessage ); + + void HandleWritePresenceInfoSyncL(const RMessage2& aMessage ); + + void HandleGetLastPreparedPacketL( const RMessage2& aMessage ); + + void HandleGetLastPreparedAsyncPacketL( const RMessage2& aMessage ); + + void HandleBuddyCountInAllServices(const RMessage2& aMessage ); + + void HandleBuddyCountInService(const RMessage2& aMessage ); + + void HandleWritePresenceInfoAsyncL(const RMessage2& aMessage ); + + void HandlePrepReadAllBuddiesPresenceInService(const RMessage2& aMessage ); + + //void HandleGetAllServicesL(const RMessage2& aMessage ); + + void HandleGetServiceCount(const RMessage2& aMessage ); + + void HandleDeleteService(const RMessage2& aMessage ); + + void HandleCancel(const RMessage2& aMessage ); + + void HandleDeletePresence(const RMessage2& aMessage ); + + + // subscribe notification related + void HandleSubscribeBuddyPresenceChange(const RMessage2& aMessage ); + + void HandleUnSubscribeBuddyPresenceChange(const RMessage2& aMessage ); + + void HandleGetLastNotifiedtPacketL(const RMessage2& aMessage ); + + void HandleWaitingForNotification(const RMessage2& aMessage ); + + void HandleCancelWaitingForNotification(const RMessage2& aMessage ); + + + private: + + /** + * Writes Presence info async. to cache, its called on each runl cycle + * and it takes data to write from member data holders. + */ + void WritePresenceInfoAsyncL(); + + /** + * Reads all buddies presence info in given service. It takes data from + * stored message. + */ + void ReadAllBuddiesPresenceInServiceL(); + + /** + * Get Service name from given xsp id + * + * @param aXspId xsp id e.g. ovi:xyz@nokia.com + * @return ServiceName returned here + */ + TPtrC GetServiceName(const TDesC& aXspId); + + + private: // Data + + /** + * iMessage, the message exchange data with the server. + */ + RMessage2 iMessage; + + /** + * iMessage, the message holder for notification wating. + * This is always pending when some client subscribe for notifications. + */ + RMessage2 iMessageForNoti; + + /** + * iServer, reference to the server. + */ + CPresenceCacheServer& iServer; + + /** + * Own: used for sync messages + */ + HBufC8* iDataPack; + + /** + * Own: used for async messages + */ + HBufC8* iDataPackAsync; + + /** + * Own: used for subscribe notify message + */ + HBufC8* iDataPackNotifier; + + /** + * Own: used for ansync requests + */ + NRequest::TOpAsyncCodes iAsyncReq; + + /** + *Own + */ + CPresenceBuddyInfoListImp* iBuddypresInfoList; + + /** + * + */ + TInt iLastServiceCount; + + + /** + *Own + */ + CCacheSessionActiveHelper* iActiveHelper; + + /** + * Pointers not owned. + */ + RPointerArray iSubscribedStores; + + }; + +/** +* This class is used by CPresenceCacheSession for dividing long running async. +* tasks into smaller units. The CPresenceCacheSession itself was not made +* active, since that results in c++ ambiguousness problems in CPresenceCacheSession +* because of inheriting twice from CBase. +* +* @since S60 v3.2 +*/ +class CCacheSessionActiveHelper : public CActive + { + public: // public functions + + /** + * Default 1st phase factory method. + * Creates an instance of CCacheSessionActiveHelper + * + * @return created instance of the CCacheSessionActiveHelper + */ + static CCacheSessionActiveHelper* NewL(CPresenceCacheSession* aSession ); + + /** + * Destructor + */ + ~CCacheSessionActiveHelper( ); + + /** + * Active object start + */ + void Start(); + + private: // private functions + + /** + * Constructor + */ + CCacheSessionActiveHelper(CPresenceCacheSession* aSession); + + /** + * Active object RunL + */ + void RunL(); + + /** + * Active object DoCancel + */ + void DoCancel(); + + /** + * ConstructL + */ + void ConstructL(); + + + /** + * pointer to CPresenceCacheSession doesnt own + */ + CPresenceCacheSession* iCacheSession; + + }; + +#endif // PRESENCECACHESESSION_H + +// End of File + diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencedatamodel/apidataobjfactory.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencedatamodel/apidataobjfactory.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,46 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: API data object factory +* +*/ + + + +#ifndef M_APIOBJFACTORY_H +#define M_APIOBJFACTORY_H + +#include + +class CXIMPApiDataObjBase; + + +/** + * ?one_line_short_description + * + * ?more_complete_description + * + * @lib ?library + * @since S60 v4.0 + */ +class MApiDataObjFactory + { +public: + + virtual CXIMPApiDataObjBase* NewFromStreamLC( TInt32 aDataObjInterfaceId, + RReadStream& aStream ) = 0; + + }; + +#endif // M_APIOBJFACTORY_H + diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencedatamodel/presenceapidataobjfactory.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencedatamodel/presenceapidataobjfactory.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,154 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Base class for API implementations. +* +*/ + +#include "presenceapidataobjfactory.h" +#include "ximpapidataobjbase.h" + +#include +//#include + + +// ============================ MEMBER FUNCTIONS ============================= + + +// --------------------------------------------------------------------------- +// CPresenceEventCodec::NewL() +// --------------------------------------------------------------------------- +// +CPresenceApiDataObjFactory* CPresenceApiDataObjFactory::NewL() + { + CPresenceApiDataObjFactory* self = new( ELeave ) CPresenceApiDataObjFactory() ; + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); + return self; + } + + +// --------------------------------------------------------------------------- +// CPresenceEventCodec::ConstructL() +// --------------------------------------------------------------------------- +// +void CPresenceApiDataObjFactory::ConstructL() + { + } + + +/** + * Method to instantiate new data object object + * of requested type and construct it from the stream. + * + * @param aDataObjInterfaceId + * @return Data object constructor function. + */ +CXIMPApiDataObjBase* CPresenceApiDataObjFactory::NewFromStreamLC( + TInt32 aDataObjInterfaceId, + RReadStream& aStream ) + { + return NewDataObjectFromStreamLC( aDataObjInterfaceId, aStream ); + } + +// --------------------------------------------------------------------------- +// CPresenceApiDataObjFactory::CPresenceApiDataObjFactory() +// --------------------------------------------------------------------------- +// +CPresenceApiDataObjFactory::CPresenceApiDataObjFactory() + { + } + +// --------------------------------------------------------------------------- +// CPresenceApiDataObjFactory::~CPresenceApiDataObjFactory() +// --------------------------------------------------------------------------- +// +CPresenceApiDataObjFactory::~CPresenceApiDataObjFactory() + { + } + + +// --------------------------------------------------------------------------- +// PresenceApiDataObjFactory::InternalizeL +// --------------------------------------------------------------------------- +// +void CPresenceApiDataObjFactory::InternalizeL( + RReadStream& aStream, + RPresenceReqParamArray& aArray ) + { + TInt32 arrLen = aStream.ReadInt32L(); + + for ( TInt i = 0; i < arrLen; i++ ) + { + SPresenceReqParam param; + param.iParamType = aStream.ReadInt32L(); + CXIMPApiDataObjBase* dataObject = NewDataObjectFromStreamLC( param.iParamType, aStream ); + param.iParam = dataObject; + aArray.AppendL( param ); + CleanupStack::Pop( dataObject ); + } + } + +// --------------------------------------------------------------------------- +// PresenceApiDataObjFactory::ExternalizeL +// --------------------------------------------------------------------------- +// +void CPresenceApiDataObjFactory::ExternalizeL( + RWriteStream& aWs, + const RPresenceReqParamArray& aArray ) + { + // write array length + aWs.WriteInt32L( aArray.Count() ); + + for ( TInt i = 0; i < aArray.Count(); i++ ) + { + // trust the type within the param struct + aWs.WriteInt32L( aArray[ i ].iParamType ); + + // write the actual object + CXIMPApiDataObjBase* theBase = aArray[ i ].iParam; + theBase->ExternalizeL( aWs ); + } + + aWs.CommitL(); + } + +// --------------------------------------------------------------------------- +// PresenceApiDataObjFactory::InternalizeLC +// --------------------------------------------------------------------------- +// +CXIMPApiDataObjBase* CPresenceApiDataObjFactory::InternalizeLC( + RReadStream& aStream ) + { + TInt32 objType = aStream.ReadInt32L(); + CXIMPApiDataObjBase* dataObject = NewDataObjectFromStreamLC( objType, aStream ); + return dataObject; + } + +// --------------------------------------------------------------------------- +// PresenceApiDataObjFactory::ExternalizeL +// --------------------------------------------------------------------------- +// +void CPresenceApiDataObjFactory::ExternalizeL( + RWriteStream& aWs, + const CXIMPApiDataObjBase& aDataObj ) + { + aWs.WriteInt32L( aDataObj.Base().GetInterfaceId() ); + aDataObj.ExternalizeL( aWs ); + aWs.CommitL(); + } + + +// End of file + diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencedatamodel/presenceapidataobjfactory.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencedatamodel/presenceapidataobjfactory.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,125 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Codec to pack and unpack data objects. +* +*/ + +#ifndef PRESENCEAPIDATAOBJFACTORY_H +#define PRESENCEAPIDATAOBJFACTORY_H + +#include +#include "presencetypehelpers.h" +#include "ximpapidataobjbase.h" + +// internal interface for the factory +#include "apidataobjfactory.h" + +class RReadStream; +class RWriteStream; + + +/** + * Codec to pack and unpack data object arrays. + * + * @lib ximpdatamodel.dll + * @since S60 v3.2 + */ +NONSHARABLE_CLASS( CPresenceApiDataObjFactory ) : public CBase, + public MApiDataObjFactory + { +public: + + static CPresenceApiDataObjFactory* NewL(); + + // From base class + CXIMPApiDataObjBase* NewFromStreamLC( TInt32 aDataObjInterfaceId, + RReadStream& aStream ); + /** + * Unpacks a request parameter array from a + * descriptor back to array format. + * @param aDataObjArrayData The packed array + * @param aArray The array which to fill + */ + static void InternalizeL( + RReadStream& aStream, + RPresenceReqParamArray& aArray + ); + + /** + * Packs a given request parameter array into + * a stream. + * @param aWs The stream to pack into + * @param aArray The array to pack + */ + static void ExternalizeL( + RWriteStream& aWs, + const RPresenceReqParamArray& aArray + ); + + /** + * Internalize a CXIMPApiDataObjBase-derived object + * from the given stream, ownership is returned to the caller. + * @param aStream The stream + * @return The object instance + */ + static CXIMPApiDataObjBase* InternalizeLC( + RReadStream& aStream ); + + /** + * Externalize a CXIMPApiDataObjBase-derived object + * to the given stream. + * @param aWs The write stream + * @param aDataObj The data object + */ + static void ExternalizeL( + RWriteStream& aWs, + const CXIMPApiDataObjBase& aDataObj ); + + + /* + * Packs a given array into a stream. + * @param aStream The stream + * @param aArray The array + */ + template< class INFOIMP> + static inline void InternalizeL( + RReadStream& aStream, + RPointerArray& aArray + ); + + /** + * Unpacks an array of info fields back to array format. + * @param aWs The stream + * @param aArray The array which to fill + */ + template< class INFOIMP > + static inline void ExternalizeL( + RWriteStream& aWs, + const RPointerArray& aArray + ); + + + ~CPresenceApiDataObjFactory(); +private: + + CPresenceApiDataObjFactory(); + + void ConstructL(); + + }; + +// template methods need inline implementation +#include "presenceapidataobjfactory.inl" + +#endif // PRESENCEAPIDATAOBJFACTORY_H diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencedatamodel/presenceapidataobjfactory.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencedatamodel/presenceapidataobjfactory.inl Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,209 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Inline methods for codec to pack and unpack data objects. +* +*/ + + +#include + +#include "presencetypehelpers.h" +#include "presenceobjectfactory.h" +#include "ximpapidataobjbase.h" +//#include "ximpidentityimp.h" +#include "presentitygroupmemberinfoimp.h" +#include "presentitygroupinfoimp.h" +//#include "ximpfeatureinfoimp.h" +//#include "ximpcontextclientinfoimp.h" +#include "presencegrantrequestinfoimp.h" +#include "presencewatcherinfoimp.h" +//#include "ximpprotocolinfoimp.h" +//#include "ximpserviceinfoimp.h" +//#include "ximpstatusimp.h" +#include "presenceinfofieldimp.h" +#include "presenceinfofieldvaluetextimp.h" +#include "presenceinfofieldvaluebinaryimp.h" +#include "presenceinfofieldvalueenumimp.h" +#include "servicepresenceinfoimp.h" +#include "devicepresenceinfoimp.h" + +//DATA TYPES + + +// ============================ MEMBER FUNCTIONS ============================= + +/** + * Type definition for exact API data object constructor signature. + */ +typedef CXIMPApiDataObjBase* (*TApiDataObjConstructor)( RReadStream& ); + + + +/** + * Structure for mapping data object interface IDs to + * to corect API data object constructors. + */ +struct SApiDataObjConstructorMap + { + //Interface id + TInt32 iInterfaceId; + + //Function pointer to data object interface implementation + TApiDataObjConstructor iConstructorPtr; + } ; + + + +/** + * Helper macro to initialise KApiDataObjConstructorTable members. + * + * Macro forces that each data object implementation class to have static + * NewFromStreamLC() member function to instantiate the object. + * + * See TApiDataObjConstructor type definition for exact constructor + * signature. + */ +#define CONSTRUCTOR_ENTRY( TheImplementedIf, TheClass ) \ + { TheImplementedIf::KInterfaceId, TheClass::NewFromStreamLC } \ + +/** + * Constructor function mapping for data object interface implementations. + * + * When new data object types are implemented, add them here. + */ +const SApiDataObjConstructorMap KApiDataObjConstructorTable[] = + { + CONSTRUCTOR_ENTRY( MPresentityGroupMemberInfo, CPresentityGroupMemberInfoImp ), + CONSTRUCTOR_ENTRY( MPresentityGroupInfo, CPresentityGroupInfoImp ), + CONSTRUCTOR_ENTRY( MPresenceGrantRequestInfo, CPresenceGrantRequestInfoImp ), + CONSTRUCTOR_ENTRY( MPresenceWatcherInfo, CPresenceWatcherInfoImp ), + CONSTRUCTOR_ENTRY( MPresenceInfoField, CPresenceInfoFieldImp ), + CONSTRUCTOR_ENTRY( MPresenceInfoFieldValueText, CPresenceInfoFieldValueTextImp ), + CONSTRUCTOR_ENTRY( MPresenceInfoFieldValueBinary, CPresenceInfoFieldValueBinaryImp ), + CONSTRUCTOR_ENTRY( MPresenceInfoFieldValueEnum, CPresenceInfoFieldValueEnumImp ), + CONSTRUCTOR_ENTRY( MDevicePresenceInfo, CDevicePresenceInfoImp ), + CONSTRUCTOR_ENTRY( MServicePresenceInfo, CServicePresenceInfoImp ) + }; + + +/** + * Count of constructor mappings. + */ +const TInt KApiDataObjConstructorCount = sizeof( KApiDataObjConstructorTable ) + / sizeof( SApiDataObjConstructorMap ); + + + +// ============================ HELPER FUNCTIONS ============================= + + +namespace { + + /** + * Helper function to locate constructor function for + * data object interface ID. + * + * @param aDataObjInterfaceId The data object interface ID. + * @return Data object constructor function. + */ + TApiDataObjConstructor ConstructorForInterface( TInt32 aDataObjInterfaceId ) + { + //Locate correct constructor + for( TInt ix = 0; ix < KApiDataObjConstructorCount; ix++ ) + { + const SApiDataObjConstructorMap map = KApiDataObjConstructorTable[ ix ]; + if( map.iInterfaceId == aDataObjInterfaceId ) + { + return map.iConstructorPtr; + } + } + + + //If assertion below fails, check that data object implementation + //class implementing requested data object interface (aDataObjInterfaceId) + //is registered to KApiDataObjConstructorTable + __ASSERT_DEBUG( EFalse, + User::Panic( _L("PresenceObjectFactory"), KErrUnknown ) ); + + return NULL; + } + + /** + * Helper function to instantiate new data object object + * of requested type and construct it from the stream. + * + * @param aDataObjInterfaceId + * @return Data object constructor function. + */ + CXIMPApiDataObjBase* NewDataObjectFromStreamLC( TInt32 aDataObjInterfaceId, + RReadStream& aStream ) + { + TApiDataObjConstructor newFromStreamLC = NULL; + + //Locate correct constructor for interface ID + newFromStreamLC = ConstructorForInterface( aDataObjInterfaceId ); + + //Instantiate the object + CXIMPApiDataObjBase* dataObject = newFromStreamLC( aStream ); + + return dataObject; + } + +} // namespace + +// --------------------------------------------------------------------------- +// PresenceApiDataObjFactory::InternalizeL +// --------------------------------------------------------------------------- +// +template< class INFOIMP > +inline void CPresenceApiDataObjFactory::InternalizeL( + RReadStream& aStream, + RPointerArray& aArray ) + { + TInt32 arrLen = aStream.ReadInt32L(); + + for ( TInt i = 0; i < arrLen; i++ ) + { + TInt paramType = aStream.ReadInt32L(); + INFOIMP* infoObj = ( INFOIMP* ) NewDataObjectFromStreamLC( paramType, aStream ); + aArray.AppendL( infoObj ); + CleanupStack::Pop( infoObj ); + } + } + +// --------------------------------------------------------------------------- +// PresenceApiDataObjFactory::ExternalizeL +// --------------------------------------------------------------------------- +// +template +inline void CPresenceApiDataObjFactory::ExternalizeL( + RWriteStream& aWs, + const RPointerArray& aArray ) + { + aWs.WriteInt32L( aArray.Count() ); // array length + + for ( TInt i = 0; i < aArray.Count(); i++ ) + { + INFOIMP* infoField = aArray[ i ]; + + // write the type + aWs.WriteInt32L( infoField->Base().GetInterfaceId() ); + + // write the actual object + infoField->ExternalizeL( aWs ); + } + + aWs.CommitL(); + } + diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencedatamodel/presenceapidataobjfactoryaccessor.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencedatamodel/presenceapidataobjfactoryaccessor.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,100 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Base class for API implementations. +* +*/ + +#include "presenceapidataobjfactoryaccessor.h" +#include "presenceeventcodec.h" +#include "presenceapidataobjfactory.h" + +//DATA TYPES + + +// ============================ MEMBER FUNCTIONS ============================= + +// --------------------------------------------------------------------------- +// CPresenceApiDataObjFactoryAccessor::NewL() +// --------------------------------------------------------------------------- +// +EXPORT_C CPresenceApiDataObjFactoryAccessor* CPresenceApiDataObjFactoryAccessor::NewL() + { + CPresenceApiDataObjFactoryAccessor* self = new( ELeave ) CPresenceApiDataObjFactoryAccessor() ; + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); + return self; + } + + +// --------------------------------------------------------------------------- +// CPresenceApiDataObjFactoryAccessor::ConstructL() +// --------------------------------------------------------------------------- +// +void CPresenceApiDataObjFactoryAccessor::ConstructL() + { + // FIXME: would be probably better to have the Event Codec and other factories as singleton + iPresenceEventCodec = CPresenceEventCodec::NewL(); + + iPresenceApiDataObjFactory = CPresenceApiDataObjFactory::NewL(); + } + + +// --------------------------------------------------------------------------- +// CPresenceApiDataObjFactoryAccessor::CPresenceApiDataObjFactoryAccessor() +// --------------------------------------------------------------------------- +// +CPresenceApiDataObjFactoryAccessor::CPresenceApiDataObjFactoryAccessor() + { + } + +// --------------------------------------------------------------------------- +// CPresenceApiDataObjFactoryAccessor::~CPresenceApiDataObjFactoryAccessor() +// --------------------------------------------------------------------------- +// +CPresenceApiDataObjFactoryAccessor::~CPresenceApiDataObjFactoryAccessor() + { + delete iPresenceEventCodec; + delete iPresenceApiDataObjFactory; + } + + +// --------------------------------------------------------------------------- +// CPresenceApiDataObjFactoryAccessor::EventCodec() +// --------------------------------------------------------------------------- +// +MEventCodec& CPresenceApiDataObjFactoryAccessor::EventCodec() + { + return *iPresenceEventCodec; + } + +// --------------------------------------------------------------------------- +// CPresenceApiDataObjFactoryAccessor::ApiDataObjFactory() +// --------------------------------------------------------------------------- +// +MApiDataObjFactory& CPresenceApiDataObjFactoryAccessor::ApiDataObjFactory() + { + return *iPresenceApiDataObjFactory; + } + + + +// End of file + + + + + + + diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencedatamodel/presenceapidataobjfactoryaccessor.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencedatamodel/presenceapidataobjfactoryaccessor.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,66 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Codec to pack and unpack data objects. +* +*/ + +#ifndef PRESENCEAPIDATAOBJFACTORYACCESSOR_H +#define PRESENCEAPIDATAOBJFACTORYACCESSOR_H + +#include "apidataobjfactoryaccessor.h" + +class MEventCodec; +class CPresenceEventCodec; +class MApiDataObjFactory; +class CPresenceApiDataObjFactory; + +/** + * Class to access the different object factories in the datamodel + * + * @lib ximpdatamodel.dll + * @since S60 v3.2 + */ +NONSHARABLE_CLASS( CPresenceApiDataObjFactoryAccessor ) : public MApiDataObjFactoryAccessor + { +public: + IMPORT_C static CPresenceApiDataObjFactoryAccessor* NewL(); + + MApiDataObjFactory& ApiDataObjFactory(); + + MEventCodec& EventCodec(); + + ~CPresenceApiDataObjFactoryAccessor(); + +private: + + CPresenceApiDataObjFactoryAccessor(); + void ConstructL(); + +//data +private: + // Own + CPresenceEventCodec* iPresenceEventCodec; + + // Own + CPresenceApiDataObjFactory* iPresenceApiDataObjFactory; + + }; + +#endif // PRESENCEAPIDATAOBJFACTORYACCESSOR_H + + + + + + diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencedatamodel/presenceapiobjbase.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencedatamodel/presenceapiobjbase.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,87 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Base class for XIMP API implementations. +* +*/ + +#ifndef PRESENCEAPIOBJBASE_H +#define PRESENCEAPIOBJBASE_H + + +/** + * Presence plugin class implementation UIDs. + * + * These do not have to be "real" Symbian UIDs, but such ID's, + * that they do not overlap with XIMP or Presence Plugin API interface IDs. + */ + +// 90xx - ximp related +// 91xx - presence related +// 92xx - instant messaging related + +// Presence plugin events +#define PRIMP_CLSID_CPRESENTITYEVENTIMP 9100 +#define PRIMP_CLSID_COWNPRESENCEEVENTIMP 9101 +#define PRIMP_CLSID_CPRESENCEGRANTREQUESTLISTEVENTIMP 9102 +#define PRIMP_CLSID_CPRESENTITYGROUPLISTEVENTIMP 9103 +#define PRIMP_CLSID_CPRESENTITYPRESENCEEVENTIMP 9104 +#define PRIMP_CLSID_CPRESENCEBLOCKLISTEVENTIMP 9105 +#define PRIMP_CLSID_CPRESENTITYGROUPCONTENTEVENTIMP 9106 +#define PRIMP_CLSID_CPRESENCEWATCHERLISTEVENTIMP 9107 +#define PRIMP_CLSID_CPRESENCEGRANTREQUESTINFOIMP 9108 + + +// Presence datamodel classes +#define PRIMP_CLSID_CPRESENCEINFOIMP 9110 +#define PRIMP_CLSID_CPRESENCEINFOFILTERIMP 9111 +#define PRIMP_CLSID_CPRESENCEBLOCKINFOIMP 9112 +#define PRIMP_CLSID_CPRESENTITYGROUPINFOIMP 9113 +#define PRIMP_CLSID_CPRESENTITYGROUPMEMBERINFOIMP 9114 +#define PRIMP_CLSID_CPRESENCEWATCHERINFOIMP 9115 +#define PRIMP_CLSID_CPRESENCEINFOFIELDIMP 9116 +#define PRIMP_CLSID_CPRESENCEINFOFIELDVALUETEXTIMP 9117 +#define PRIMP_CLSID_CPRESENCEINFOFIELDVALUEBINARYIMP 9118 +#define PRIMP_CLSID_CPRESENCEINFOFIELDVALUEENUMIMP 9119 +#define PRIMP_CLSID_CDEVICEPRESENCEINFOIMP 9120 +#define PRIMP_CLSID_CPERSONPRESENCEINFOIMP 9121 +#define PRIMP_CLSID_CSERVICEPRESENCEINFOIMP 9122 +#define PRIMP_CLSID_CPRESENCEINFOFIELDCOLLECTIONIMP 9123 +#define PRIMP_CLSID_CPRESENCEDATACACHE 9124 + + +// Presence plugin host environment classes +#define PRIMP_CLSID_CPROTOCOLPRESENTITYGROUPSDATAHOST 9130 +#define PRIMP_CLSID_CPROTOCOLPRESENCEPUBLISHINGDATAHOST 9131 +#define PRIMP_CLSID_CPROTOCOLPRESENCEWATCHINGDATAHOST 9132 +#define PRIMP_CLSID_CPROTOCOLPRESENCEAUTHORIZATIONDATAHOST 9133 +#define PRIMP_CLSID_CPROTOCOLPRESENCEDATAHOSTIMP 9134 + + +// Presence Management classes +#define PRIMP_CLSID_CPRESENCEPUBLISHINGIMP 9140 +#define PRIMP_CLSID_CPRESENTITYGROUPSIMP 9141 +#define PRIMP_CLSID_CPRESENCEWATCHINGIMP 9142 +#define PRIMP_CLSID_CPRESENCEAUTHORIZATIONIMP 9143 +#define PRIMP_CLSID_CPRESENCEFEATURESIMP 9144 +#define PRIMP_CLSID_CPRESENCEOBJECTFACTORYIMP 9145 + +// Presence Cache classes +#define PRIMP_CLSID_CXIMPPRESENCEBUDDYINFOIMP 9150 +#define PRIMP_CLSID_CXIMPPRESENCEBUDDYINFOLIST 9151 +#define PRIMP_CLSID_CPRESENCECACHECLIENT 9152 + + + + +#endif // PRESENCEAPIOBJBASE_H diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencedatamodel/presenceauthorization/blocklistsubscriptionitem.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencedatamodel/presenceauthorization/blocklistsubscriptionitem.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,269 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Presence Service Connection presence block list subscription implementation. +* +*/ + + +#include + +#include "blocklistsubscriptionitem.h" +#include "presenceinfofilterimp.h" +#include "ximpitemparent.h" +#include "ximppanics.h" +#include "ximppsccontext.h" +#include "documentutils.h" +#include "ximpobjecthelpers.h" +#include "presencetypehelpers.h" +#include "presenceblockinfoimp.h" +#include "presenceblocklisteventimp.h" +#include "ximpidentityimp.h" +#include "ximpdatasubscriptionstateimp.h" + +#include "ximptrace.h" + +// --------------------------------------------------------------------------- +// CBlockListSubscriptionItem::CBlockListSubscriptionItem() +// --------------------------------------------------------------------------- +// +CBlockListSubscriptionItem::CBlockListSubscriptionItem( MXIMPItemParentBase& aParent ) +: CXIMPSubscriptionItemBase( aParent ) + { + } + + +// --------------------------------------------------------------------------- +// CBlockListSubscriptionItem::ConstructL() +// --------------------------------------------------------------------------- +// +void CBlockListSubscriptionItem::ConstructL() + { + BaseConstructL(); + // empty lists must always exist + iCurrent = new ( ELeave) RPrBlockInfoImpArray; + iAdded = new ( ELeave ) RPrBlockInfoImpArray; + iRemoved = new ( ELeave ) RPrBlockInfoImpArray; + iUpdated = new ( ELeave ) RPrBlockInfoImpArray; + } + + +// --------------------------------------------------------------------------- +// CBlockListSubscriptionItem::NewL() +// --------------------------------------------------------------------------- +// +CBlockListSubscriptionItem* CBlockListSubscriptionItem::NewLC( MXIMPItemParentBase& aParent ) + { + CBlockListSubscriptionItem* self = new( ELeave ) CBlockListSubscriptionItem( aParent ); + CleanupClosePushL( *self ); + self->ConstructL(); + return self; + } + + +// --------------------------------------------------------------------------- +// CBlockListSubscriptionItem::~CBlockListSubscriptionItem() +// --------------------------------------------------------------------------- +// +CBlockListSubscriptionItem::~CBlockListSubscriptionItem() + { + MXIMPItemParent* presCache = static_cast(iParent.GetInterface(PRESENCE_ITEM_PARENT)); + presCache->RemoveMe( this ); + + if( iCurrent ) + { + iCurrent->Close(); + } + delete iCurrent; + + Clean(); + // just in case + delete iAdded; + delete iRemoved; + delete iUpdated; + } + +// --------------------------------------------------------------------------- +// From MXIMPSubscriptionItem class. +// CBlockListSubscriptionItem::SynthesiseSubscriptionEventTo() +// --------------------------------------------------------------------------- +// +void CBlockListSubscriptionItem::SynthesiseSubscriptionEventToL( + MXIMPPscContext* aContext, TBool aForceEvent ) + { + TRACE_1( _L("CBlockListSubscriptionItem::SynthesiseSubscriptionEventTo() aForce=%d"), aForceEvent ); + CXIMPDataSubscriptionStateImp* status = StatusLC( aContext ); // << status + + if( status->DataState() == MXIMPDataSubscriptionState::EDataAvailable || aForceEvent ) + { + CleanupStack::Pop( status ); // >> status + CPresenceBlockListEventImp* newEvent = CPresenceBlockListEventImp::NewLC( + iAdded, + aForceEvent ? iCurrent : NULL, + iRemoved, + iUpdated, + status + ); + MXIMPItemParent* presCache = static_cast(iParent.GetInterface(PRESENCE_ITEM_PARENT)); + presCache->AddEventL( *newEvent, aContext ); + CleanupStack::PopAndDestroy(); // >>> newEvent + } + else + { + CleanupStack::PopAndDestroy(); // >>> status + } + } + + +// --------------------------------------------------------------------------- +// CBlockListSubscriptionItem::SetNewListL() +// --------------------------------------------------------------------------- +// +EXPORT_C void CBlockListSubscriptionItem::SetNewListL( + RPrBlockInfoImpArray* aList ) + { + TRACE_1( _L("CBlockListSubscriptionItem::SetNewListL aList Count=%d"), aList->Count() ); + RPrBlockInfoImpArray* tmp = aList; + CleanupDeletePushL( tmp ); + + TLinearOrder + linearOrder( CPresenceBlockInfoImp::IdLinearOrder ); + + for ( TInt i = 0; i < tmp->Count(); i++ ) + { + // compare against current pending list + CPresenceBlockInfoImp* info = (*tmp)[ i ]; + TInt pos = iCurrent->FindInOrder( info, linearOrder ); + + if ( pos == KErrNotFound ) + { + // not found in current list + // so must be a fresh watcher + iAdded->InsertInOrderL( info, linearOrder ); + } + else + { + // found in current list, so it must be an updated list name + ////iUpdated->InsertInOrderL( info, linearOrder ); + CPresenceBlockInfoImp* infoClone = NULL; + infoClone = TXIMPObjectCloner< CPresenceBlockInfoImp >::CloneLC( *info ); + iUpdated->AppendL( infoClone ); // ownership is transferrred + CleanupStack::Pop( infoClone ); + + // remove it from the iCurrent list, + // so it won't get on the iRemoved after this loop + delete (*iCurrent)[ pos ]; + iCurrent->Remove( pos ); + } + } + + // what's left in iCurrent contains the removed ones. + delete iRemoved; + iRemoved = iCurrent; + + // the given list becomes the new current list + iCurrent = tmp; + CleanupStack::Pop( tmp ); + iSubscriptionState->SetDataStateL( MXIMPDataSubscriptionState::EDataAvailable ); + } + + +// --------------------------------------------------------------------------- +// CBlockListSubscriptionItem::SetBlockedL() +// --------------------------------------------------------------------------- +// +EXPORT_C void CBlockListSubscriptionItem::SetBlockedL( + CPresenceBlockInfoImp* aReq ) + { + TRACE( _L("CBlockListSubscriptionItem::SetBlockedL") ); + TLinearOrder + linearOrder( CPresenceBlockInfoImp::IdLinearOrder ); + + // compare against current list + TInt pos = iCurrent->FindInOrder( aReq, linearOrder ); + + if ( pos == KErrNotFound ) + { + // not found in current list + // so must be a fresh watcher + iAdded->InsertInOrderL( aReq, linearOrder ); + // and also to the pending + iCurrent->InsertInOrderL( aReq, linearOrder ); + // This looks like we take ownership two times, but the way we act + // only iCurrent really owns it. + // See the comments Clean() for more about this + + iSubscriptionState->SetDataStateL( MXIMPDataSubscriptionState::EDataAvailable ); + } + else + { + // The request already exists in the pending list. + // Ignore and delete the the object + delete aReq; + } + } + +// --------------------------------------------------------------------------- +// CBlockListSubscriptionItem::SetCanceledBlockIdL() +// --------------------------------------------------------------------------- +// +EXPORT_C void CBlockListSubscriptionItem::SetCanceledBlockIdL( + CXIMPIdentityImp* aRemoved ) + { + TRACE( _L("CBlockListSubscriptionItem::SetCanceledBlockIdL") ); + for ( TInt i = 0; i < iCurrent->Count(); i++ ) + { + + if ( aRemoved->Compare( (*iCurrent)[ i ]->IdentityImp() ) == 0 ) + { + iRemoved->AppendL( (*iCurrent)[ i ] ); + iCurrent->Remove( i ); + break; + } + } + + + delete aRemoved; + } + +// --------------------------------------------------------------------------- +// CBlockListSubscriptionItem::Clean() +// --------------------------------------------------------------------------- +// +EXPORT_C void CBlockListSubscriptionItem::Clean() + { + TRACE( _L("CBlockListSubscriptionItem::Clean") ); + // empty the lists. + // the lists must stay valid for use + + // iAdded is a collection from the pending list. + // Do not delete items. + // iRemoved and iUpdated hold items. Delete those. + + + iAdded->Reset(); + iRemoved->Close(); + iUpdated->Close(); + } + +// --------------------------------------------------------------------------- +// From CXIMPSubscriptionItemBase class. +// CBlockListSubscriptionItem::CleanExpired() +// --------------------------------------------------------------------------- +// +void CBlockListSubscriptionItem::CleanExpired() + { + + } + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencedatamodel/presenceauthorization/blocklistsubscriptionitem.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencedatamodel/presenceauthorization/blocklistsubscriptionitem.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,143 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Presence Service Connection presence block list subscription implementation. +* +*/ + +#ifndef CPSCBLOCKLISTSUBSCRIPTIONITEM_H +#define CPSCBLOCKLISTSUBSCRIPTIONITEM_H + +#include +#include "presenceinfoimp.h" +#include "ximpsubscriptionitem.h" +#include "presencetypehelpers.h" +#include "ximpsubscriptionitembase.h" + +class MXIMPItemParentBase; +class MXIMPPscContext; +class CDesC16Array; +class CPresenceGrantRequestInfoImp; + +/** + * PSC group list subscription implementation + * + * @since S60 v3.2 + */ +class CBlockListSubscriptionItem : public CXIMPSubscriptionItemBase + { + +public: // Construction and destruction + + /** + * Construction + * @param aParent. Parent has to be informed when this object is deleted by RemoveMe method. + */ + static CBlockListSubscriptionItem* NewLC( MXIMPItemParentBase& aParent ); + + /** + * Destruction + * - Remember to inform parent about delete. + */ + ~CBlockListSubscriptionItem(); + +private: // Construction and destruction + + /** + * Construction + * @param aParent. Parent has to be informed when this object is deleted by RemoveMe method. + */ + CBlockListSubscriptionItem( MXIMPItemParentBase& aParent ); + + /** + * Construction + */ + void ConstructL(); + +public: // New methods + + /** + * Resolves deltas from new list and replaces old current. + * Ownership is transferred! + * @param aList New blocklist. + */ + IMPORT_C void SetNewListL( RPrBlockInfoImpArray* aList ); + + /** + * Add new blocked object to current. + * Ownership is transferred! + * @param aReq Information of new blocked item. + */ + IMPORT_C void SetBlockedL( CPresenceBlockInfoImp* aReq ); + + /** + * Cancels block from identity + * Ownership is transferred! + * @param aRemoved Identity of item not blocked anymore. + */ + IMPORT_C void SetCanceledBlockIdL( CXIMPIdentityImp* aRemoved ); + + /** + * Remove the temporary lists. + */ + IMPORT_C void Clean(); + +public: // From MXIMPSubscriptionItem + + /** + * @see MXIMPSubscriptionItem + */ + void SynthesiseSubscriptionEventToL( MXIMPPscContext* aContext, TBool aForceEvent ); + +private: // From CXIMPSubscriptionItemBase + + /** + * @see CXIMPSubscriptionItemBase + */ + void CleanExpired(); + + +private: // Data + + /** + * Current list of groups. + * Owned. + */ + RPrBlockInfoImpArray* iAdded; + + /** + * List of created groups (new since last update). + * Owned. + */ + RPrBlockInfoImpArray* iCurrent; + + /** + * List of deleted groups (removed since last update). + * Owned. + */ + RPrBlockInfoImpArray* iRemoved; + + /** + * List of updated groups (removed since last update). + * Owned. + */ + RPrBlockInfoImpArray* iUpdated; + + }; + + +/* ======================================================================== */ + + + +#endif // CPSCBLOCKLISTSUBSCRIPTIONITEM_H diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencedatamodel/presenceauthorization/grantrequestlistsubscriptionitem.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencedatamodel/presenceauthorization/grantrequestlistsubscriptionitem.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,259 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Presence Service Connection presence watcher list subscription implementation. +* +*/ + + +#include + +#include "grantrequestlistsubscriptionitem.h" +#include "presenceinfofilterimp.h" +#include "ximpitemparent.h" +#include "ximppanics.h" +#include "ximppsccontext.h" +#include "documentutils.h" +#include "ximpobjecthelpers.h" +#include "presencetypehelpers.h" +#include "presencegrantrequestinfoimp.h" +#include "presencegrantrequestlisteventimp.h" +#include "ximpidentityimp.h" +#include "ximpdatasubscriptionstateimp.h" + +#include "ximptrace.h" + + +// --------------------------------------------------------------------------- +// CGrantRequestListSubscriptionItem::CGrantRequestListSubscriptionItem() +// --------------------------------------------------------------------------- +// +CGrantRequestListSubscriptionItem::CGrantRequestListSubscriptionItem( MXIMPItemParentBase& aParent ) +: CXIMPSubscriptionItemBase( aParent ) + { + } + + +// --------------------------------------------------------------------------- +// CGrantRequestListSubscriptionItem::ConstructL() +// --------------------------------------------------------------------------- +// +void CGrantRequestListSubscriptionItem::ConstructL() + { + BaseConstructL(); + // empty lists must always exist + iPending = new ( ELeave) RPrGrntReqInfoImpArray; + iNewRequests = new ( ELeave ) RPrGrntReqInfoImpArray; + iObsoleted = new ( ELeave ) RPrGrntReqInfoImpArray; + } + + +// --------------------------------------------------------------------------- +// CGrantRequestListSubscriptionItem::NewL() +// --------------------------------------------------------------------------- +// +CGrantRequestListSubscriptionItem* CGrantRequestListSubscriptionItem::NewLC( MXIMPItemParentBase& aParent ) + { + CGrantRequestListSubscriptionItem* self = new( ELeave ) CGrantRequestListSubscriptionItem( aParent ); + CleanupClosePushL( *self ); + self->ConstructL(); + return self; + } + + +// --------------------------------------------------------------------------- +// CGrantRequestListSubscriptionItem::~CGrantRequestListSubscriptionItem() +// --------------------------------------------------------------------------- +// +CGrantRequestListSubscriptionItem::~CGrantRequestListSubscriptionItem() + { + MXIMPItemParent* presCache = static_cast(iParent.GetInterface(PRESENCE_ITEM_PARENT)); + presCache->RemoveMe( this ); + + + if( iPending ) + { + iPending->Close(); + } + delete iPending; + + Clean(); + // just in case + delete iNewRequests; + delete iObsoleted; + } + +// --------------------------------------------------------------------------- +// From MXIMPSubscriptionItem class. +// CGrantRequestListSubscriptionItem::SynthesiseSubscriptionEventTo() +// --------------------------------------------------------------------------- +// +void CGrantRequestListSubscriptionItem::SynthesiseSubscriptionEventToL( + MXIMPPscContext* aContext, TBool aForceEvent ) + { + TRACE_1( _L("CGrantRequestListSubscriptionItem::SynthesiseSubscriptionEventTo() aForce=%d"), aForceEvent ); + CXIMPDataSubscriptionStateImp* status = StatusLC( aContext ); // << status + + if( status->DataState() == MXIMPDataSubscriptionState::EDataAvailable || aForceEvent ) + { + CleanupStack::Pop( status ); // >> status + CPresenceGrantRequestListEventImp* newEvent = CPresenceGrantRequestListEventImp::NewLC( + iNewRequests, + aForceEvent ? iPending : NULL, + iObsoleted, + status ); + + MXIMPItemParent* presCache = static_cast(iParent.GetInterface(PRESENCE_ITEM_PARENT)); + presCache->AddEventL( *newEvent, aContext ); + CleanupStack::PopAndDestroy(); // >>> newEvent + } + else + { + CleanupStack::PopAndDestroy(); // >>> status + } + } + + +// --------------------------------------------------------------------------- +// CGrantRequestListSubscriptionItem::SetNewListL() +// --------------------------------------------------------------------------- +// +EXPORT_C void CGrantRequestListSubscriptionItem::SetNewListL( + RPrGrntReqInfoImpArray* aList ) + { + TRACE_1( _L("CGrantRequestListSubscriptionItem::SetNewListL aList Count=%d"), aList->Count() ); + RPrGrntReqInfoImpArray* tmp = aList; + CleanupDeletePushL( tmp ); + + TLinearOrder + linearOrder( CPresenceGrantRequestInfoImp::IdLinearOrder ); + + for ( TInt i = 0; i < tmp->Count(); i++ ) + { + // compare against current pending list + CPresenceGrantRequestInfoImp* info = (*tmp)[ i ]; + TInt pos = iPending->FindInOrder( info, linearOrder ); + + if ( pos == KErrNotFound ) + { + // not found in current list + // so must be a fresh watcher + iNewRequests->InsertInOrderL( info, linearOrder ); + } + else + { + // otherwise remove it from the iPending list, + // so it won't get on the iObsoleted after this loop + delete (*iPending)[ pos ]; + iPending->Remove( pos ); + } + } + + // what's left in iPending contains the obsoleted ones. + delete iObsoleted; + iObsoleted = iPending; + + // the given list becomes the new pending list + iPending = tmp; + CleanupStack::Pop( tmp ); + iSubscriptionState->SetDataStateL( MXIMPDataSubscriptionState::EDataAvailable ); + } + + +// --------------------------------------------------------------------------- +// CGrantRequestListSubscriptionItem::SetReceivedRequestL() +// --------------------------------------------------------------------------- +// +EXPORT_C void CGrantRequestListSubscriptionItem::SetReceivedRequestL( + CPresenceGrantRequestInfoImp* aReq ) + { + TRACE( _L("CGrantRequestListSubscriptionItem::SetReceivedRequestL") ); + TLinearOrder + linearOrder( CPresenceGrantRequestInfoImp::IdLinearOrder ); + + // compare against current list + TInt pos = iPending->FindInOrder( aReq, linearOrder ); + + if ( pos == KErrNotFound ) + { + // not found in current list + // so must be a fresh watcher + iNewRequests->InsertInOrderL( aReq, linearOrder ); + // and also to the pending + iPending->InsertInOrderL( aReq, linearOrder ); + // This looks like we take ownership two times, but the way we act + // only iPending really owns it. + // See the comments Clean() for more about this + + iSubscriptionState->SetDataStateL( MXIMPDataSubscriptionState::EDataAvailable ); + } + else + { + // The request already exists in the pending list. + // Ignore and delete the the object + delete aReq; + } + } + +// --------------------------------------------------------------------------- +// CGrantRequestListSubscriptionItem::SetObsoletedRequestL() +// --------------------------------------------------------------------------- +// +EXPORT_C void CGrantRequestListSubscriptionItem::SetObsoletedRequestL( + CXIMPIdentityImp* aObsoleted ) + { + TRACE( _L("CGrantRequestListSubscriptionItem::SetObsoletedRequestL") ); + for ( TInt i = 0; i < iPending->Count(); i++ ) + { + if ( aObsoleted->Compare( (*iPending)[ i ]->IdentityImp() ) == 0 ) + { + iObsoleted->AppendL( (*iPending)[ i ] ); + iPending->Remove( i ); + break; + } + } + + + delete aObsoleted; + } + +// --------------------------------------------------------------------------- +// CGrantRequestListSubscriptionItem::Clean() +// --------------------------------------------------------------------------- +// +EXPORT_C void CGrantRequestListSubscriptionItem::Clean() + { + TRACE( _L("CGrantRequestListSubscriptionItem::Clean") ); + // empty the lists. + // the lists must stay valid for use + + // iNewRequests is a collection from the pending list. + // Do not delete items. + // iObsoleted is only place for items. Delete those. + + + iNewRequests->Reset(); + iObsoleted->Close(); + } + +// --------------------------------------------------------------------------- +// From CXIMPSubscriptionItemBase class. +// CGrantRequestListSubscriptionItem::CleanExpired() +// --------------------------------------------------------------------------- +// +void CGrantRequestListSubscriptionItem::CleanExpired() + { + + } + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencedatamodel/presenceauthorization/grantrequestlistsubscriptionitem.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencedatamodel/presenceauthorization/grantrequestlistsubscriptionitem.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,136 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Presence Service Connection group list subscription implementation. +* +*/ + +#ifndef CPSCGRANTREQUESTLISTSUBSCRIPTIONITEM_H +#define CPSCGRANTREQUESTLISTSUBSCRIPTIONITEM_H + +#include +#include "presenceinfoimp.h" +#include "ximpsubscriptionitem.h" +#include "presencetypehelpers.h" +#include "ximpsubscriptionitembase.h" + +class MXIMPItemParentBase; +class MXIMPPscContext; +class CDesC16Array; +class CPresenceGrantRequestInfoImp; + +/** + * PSC group list subscription implementation + * + * @since S60 v3.2 + */ +class CGrantRequestListSubscriptionItem : public CXIMPSubscriptionItemBase + { + +public: // Construction and destruction + + /** + * Construction + * @param aParent. Parent has to be informed when this object is deleted by RemoveMe method. + */ + static CGrantRequestListSubscriptionItem* NewLC( MXIMPItemParentBase& aParent ); + + /** + * Destruction + * - Remember to inform parent about delete. + */ + ~CGrantRequestListSubscriptionItem(); + +private: // Construction and destruction + + /** + * Construction + * @param aParent. Parent has to be informed when this object is deleted by RemoveMe method. + */ + CGrantRequestListSubscriptionItem( MXIMPItemParentBase& aParent ); + + /** + * Construction + */ + void ConstructL(); + +public: // New methods + + /** + * Resolve deltas and replace old current with new list. + * Ownership is transferred! + * @param aList New current list. + */ + IMPORT_C void SetNewListL( RPrGrntReqInfoImpArray* aList ); + + /** + * New received request to current. + * Ownership is transferred! + * @param aReq New grant request. + */ + IMPORT_C void SetReceivedRequestL( CPresenceGrantRequestInfoImp* aReq ); + + /** + * Remove identity from current list. + * Ownership is transferred! + * @param aObsoleted Obsolated grant request. + */ + IMPORT_C void SetObsoletedRequestL( CXIMPIdentityImp* aObsoleted ); + + /** + * Remove the temporary lists. + */ + IMPORT_C void Clean(); + +public: // From MXIMPSubscriptionItem + + /** + * @see MXIMPSubscriptionItem + */ + void SynthesiseSubscriptionEventToL( MXIMPPscContext* aContext, TBool aForceEvent ); + +private: // From CXIMPSubscriptionItemBase + + /** + * @see CXIMPSubscriptionItemBase + */ + void CleanExpired(); + +private: // Data + + /** + * Current list of groups. + * Owned. + */ + RPrGrntReqInfoImpArray* iNewRequests; + + /** + * List of created groups (new since last update). + * Owned. + */ + RPrGrntReqInfoImpArray* iPending; + + /** + * List of deleted groups (removed since last update). + * Owned. + */ + RPrGrntReqInfoImpArray* iObsoleted; + + }; + + +/* ======================================================================== */ + + + +#endif // CPSCGRANTREQUESTLISTSUBSCRIPTIONITEM_H diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencedatamodel/presenceauthorization/groupcontenteventobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencedatamodel/presenceauthorization/groupcontenteventobserver.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,50 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Event observer interface for group content subscription. +* +*/ + +#ifndef MGROUPCONTENTEVENTOBSERVER_H +#define MGROUPCONTENTEVENTOBSERVER_H + +#include "presencetypehelpers.h" + +/** + * Event observer interface for group content changes. + * + * @since S60 v3.2 + */ +class MGroupContentEventObserver + { +public: // Interface + + /** + * Handle event of added and removed items. + */ + virtual void HandleChangeL( RPrGrpMemInfoImpArray& aAdded, RPrGrpMemInfoImpArray& aRemoved ) = 0; + virtual void HandleSynthesiseL( RPrGrpMemInfoImpArray& aAdded ) = 0; + +protected: // Destruction + + /** + * Object cannot be deleted through this interface + */ + virtual ~MGroupContentEventObserver(){} + }; + +/* ======================================================================== */ + + + +#endif // MGROUPCONTENTEVENTOBSERVER_H diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencedatamodel/presenceauthorization/groupmemberspresenceconfigurationitem.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencedatamodel/presenceauthorization/groupmemberspresenceconfigurationitem.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,338 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Group members presence configuration item +* +*/ + + +#include "groupmemberspresenceconfigurationitem.h" +#include "groupcontentsubscriptionitem.h" +#include "presenceinfofilterimp.h" +#include "ximpitemparent.h" +#include "ximppanics.h" +#include "ximppsccontext.h" +#include "documentutils.h" // Perhaps this should be renamed +#include "presentitypresenceeventimp.h" +#include "presentitygroupmemberinfoimp.h" +#include "ximpidentityimp.h" + +#include "ximptrace.h" + +// --------------------------------------------------------------------------- +// CGroupMembersPresenceConfigurationItem::CGroupMembersPresenceConfigurationItem() +// --------------------------------------------------------------------------- +// +CGroupMembersPresenceConfigurationItem::CGroupMembersPresenceConfigurationItem( MXIMPItemParentBase& aParent, CGroupContentSubscriptionItem& aContentItem ) +: CXIMPConfigurationItemBase( aParent ), iContentItem( aContentItem ) + { + } + + +// --------------------------------------------------------------------------- +// CGroupMembersPresenceConfigurationItem::ConstructL() +// --------------------------------------------------------------------------- +// +void CGroupMembersPresenceConfigurationItem::ConstructL() + { + BaseConstructL(); + iContentItem.RegisterEventObserverL( this ); + } + + +// --------------------------------------------------------------------------- +// CGroupMembersPresenceConfigurationItem::NewLC() +// --------------------------------------------------------------------------- +// +CGroupMembersPresenceConfigurationItem* + CGroupMembersPresenceConfigurationItem::NewLC( MXIMPItemParentBase& aParent, + CGroupContentSubscriptionItem& aContentItem ) + { + CGroupMembersPresenceConfigurationItem* self = + new( ELeave ) CGroupMembersPresenceConfigurationItem( aParent, aContentItem ); + CleanupClosePushL( *self ); + self->ConstructL(); + return self; + } + + +// --------------------------------------------------------------------------- +// CGroupMembersPresenceConfigurationItem::~CGroupMembersPresenceConfigurationItem() +// --------------------------------------------------------------------------- +// +CGroupMembersPresenceConfigurationItem::~CGroupMembersPresenceConfigurationItem() + { + MXIMPItemParent* presCache = static_cast(iParent.GetInterface(PRESENCE_ITEM_PARENT)); + presCache->RemoveMe( this ); + + + delete iIdentity; + + delete iPif; + iContentItem.UnregisterEventObserver( this ); + } + +// --------------------------------------------------------------------------- +// CGroupMembersPresenceConfigurationItem::ConfigurationPif() +// --------------------------------------------------------------------------- +// +EXPORT_C CPresenceInfoFilterImp& + CGroupMembersPresenceConfigurationItem::ConfigurationPif() + { + TRACE(_L("CGroupMembersPresenceConfigurationItem::ConfigurationPif" ) ); + __ASSERT_ALWAYS( iPif, User::Panic( NXIMPPrivPanic::KCategory, + NXIMPPrivPanic::EOwnPresencePifNotSet ) ); + return *iPif; + } + +// --------------------------------------------------------------------------- +// CGroupMembersPresenceConfigurationItem::SetConfigurationPif() +// --------------------------------------------------------------------------- +// +EXPORT_C void CGroupMembersPresenceConfigurationItem::SetConfigurationPif( + CPresenceInfoFilterImp* aPif ) + { + TRACE(_L("CGroupMembersPresenceConfigurationItem::SetConfigurationPif" ) ); + if ( !aPif ) + { + TRACE(_L("CGroupMembersPresenceConfigurationItem::SetConfigurationPif aPif NULL" ) ); + } + delete iPif; + iPif = aPif; + } + +// --------------------------------------------------------------------------- +// CGroupMembersPresenceConfigurationItem::CollectSubscriptionPifWithoutCtxL() +// --------------------------------------------------------------------------- +// +EXPORT_C CPresenceInfoFilterImp* + CGroupMembersPresenceConfigurationItem::CollectConfigurationPifWithoutCtxL( + MXIMPPscContext* aContext ) + { + TRACE(_L("CGroupMembersPresenceConfigurationItem::CollectConfigurationPifWithoutCtxL" ) ); + RPointerArray< CPresenceInfoFilterImp > arrayOfPifs; + CleanupClosePushL( arrayOfPifs ); + + TInt count = iConfigContexts.Count(); + for( TInt a = 0; a < count; ++a ) + { + if( iConfigContexts[ a ] != aContext ) + { + CPresenceInfoFilterImp* filter = iConfigContexts[ a ]->PresenceInfoFilter( + MXIMPPscContext::EGrantPresenceToGroupMemberFilter, iIdentity ); + if ( filter ) + { + arrayOfPifs.AppendL( filter ); + } + } + } + CPresenceInfoFilterImp* pifWithoutCtx = DocumentUtils::InfoFilterUnionL( arrayOfPifs ); + CleanupStack::PopAndDestroy(); // arrayOfPifs + TRACE(_L("CGroupMembersPresenceConfigurationItem::CollectConfigurationPifWithoutCtxL done" ) ); + return pifWithoutCtx; + } + +// --------------------------------------------------------------------------- +// CGroupMembersPresenceConfigurationItem::Order() +// --------------------------------------------------------------------------- +// +EXPORT_C TInt CGroupMembersPresenceConfigurationItem::Order( + const CGroupMembersPresenceConfigurationItem& aA, + const CGroupMembersPresenceConfigurationItem& aB ) + { + return IdentityOrder( aA.iIdentity, aB ); + } +// --------------------------------------------------------------------------- +// CGroupMembersPresenceConfigurationItem::Order() +// --------------------------------------------------------------------------- +// +EXPORT_C TInt CGroupMembersPresenceConfigurationItem::IdentityOrder( + const CXIMPIdentityImp* aA, + const CGroupMembersPresenceConfigurationItem& aB ) + { + return aA->Compare( *aB.iIdentity ); + } + +// --------------------------------------------------------------------------- +// CGroupMembersPresenceConfigurationItem::Identity() +// --------------------------------------------------------------------------- +// +EXPORT_C const MXIMPIdentity& CGroupMembersPresenceConfigurationItem::Identity() const + { + return *iIdentity; + } + +// --------------------------------------------------------------------------- +// CGroupMembersPresenceConfigurationItem::SetIdentity() +// --------------------------------------------------------------------------- +// +EXPORT_C void CGroupMembersPresenceConfigurationItem::SetIdentity( + CXIMPIdentityImp* aIdentity ) + { + delete iIdentity; + iIdentity = aIdentity; + } + +// --------------------------------------------------------------------------- +// From class MXIMPSubscriptionItem. +// CGroupMembersPresenceConfigurationItem::SynthesiseSubscriptionEventTo() +// --------------------------------------------------------------------------- +// +void CGroupMembersPresenceConfigurationItem::SynthesiseSubscriptionEventToL( + MXIMPPscContext* aContext, + TBool aForceEvent ) + { + TRACE_1( _L("CGroupMembersPresenceConfigurationItem::SynthesiseSubscriptionEventTo() aForce=%d"), aForceEvent ); + // Synthesise event to all members + TInt count = iContentItem.MemberCount(); + MXIMPItemParent* presCache = static_cast(iParent.GetInterface(PRESENCE_ITEM_PARENT)); + for( TInt a = 0; a < count; ++a ) + { + CPresentityGroupMemberInfoImp& memberInfo = iContentItem.MemberAt( a ); + const CXIMPIdentityImp& identity = memberInfo.IdentityImp(); + + presCache->SynthesisePresentityPresenceSubscriptionEventToL( identity, aContext, aForceEvent ); + } + TRACE(_L("CGroupMembersPresenceConfigurationItem::SynthesiseSubscriptionEventTo done" ) ); + } + + +// --------------------------------------------------------------------------- +// CGroupMembersPresenceConfigurationItem::ActivateSubscriberL() +// --------------------------------------------------------------------------- +// +void CGroupMembersPresenceConfigurationItem::ActivateSubscriberL( MXIMPPscContext* aContext ) + { + TRACE_1( _L("CGroupMembersPresenceConfigurationItem::ActivateSubscriberL() aContext=%d"), aContext ); + CXIMPSubscriptionItemBase::ActivateSubscriberL( aContext ); + + // Subscribe presentity presence items. + TInt count = iContentItem.MemberCount(); + TRACE_1( _L("CGroupMembersPresenceConfigurationItem::ActivateSubscriberL( MXIMPPscContext* aContext ) : iContentItem.MemberCount = %d"), count ); + MXIMPItemParent* presCache = static_cast(iParent.GetInterface(PRESENCE_ITEM_PARENT)); + for( TInt a = 0; a < count; ++a ) + { + TRACE_1( _L("CGroupMembersPresenceConfigurationItem::ActivateSubscriberL( MXIMPPscContext* aContext ) : a = %d"), a ); + + CPresentityGroupMemberInfoImp& memberInfo = iContentItem.MemberAt( a ); + const CXIMPIdentityImp& identity = memberInfo.IdentityImp(); + TInt error ( KErrNone ); + TRAP( error, presCache->ActivatePresentityPresenceSubscriberL( identity, this );) + TRACE_1( _L("CGroupMembersPresenceConfigurationItem::ActivateSubscriberL( MXIMPPscContext* aContext ) : iParent.ActivatePresentityPresenceSubscriberL : error = %d"), error ); + + } + } + + +// --------------------------------------------------------------------------- +// CGroupMembersPresenceConfigurationItem::CleanExpired() +// --------------------------------------------------------------------------- +// +void CGroupMembersPresenceConfigurationItem::CleanExpired() + { + + } + +// --------------------------------------------------------------------------- +// CGroupMembersPresenceConfigurationItem::AddConfiguratorL() +// --------------------------------------------------------------------------- +// +EXPORT_C void CGroupMembersPresenceConfigurationItem::AddConfiguratorL( MXIMPPscContext* aContext ) + { + CXIMPConfigurationItemBase::AddConfiguratorL( aContext ); + + MXIMPItemParent* presCache = static_cast(iParent.GetInterface(PRESENCE_ITEM_PARENT)); + // Subscribe presentity presence items. + TInt count = iContentItem.MemberCount(); + for( TInt a = 0; a < count; ++a ) + { + CPresentityGroupMemberInfoImp& memberInfo = iContentItem.MemberAt( a ); + const CXIMPIdentityImp& identity = memberInfo.IdentityImp(); + + presCache->AddPresenceConfiguratorL( identity, this ); + } + } + + +// --------------------------------------------------------------------------- +// CGroupMembersPresenceConfigurationItem::RemoveConfigurator() +// --------------------------------------------------------------------------- +// +EXPORT_C void CGroupMembersPresenceConfigurationItem::RemoveConfigurator( MXIMPPscContext* aContext ) + { + MXIMPItemParent* presCache = static_cast(iParent.GetInterface(PRESENCE_ITEM_PARENT)); + // Subscribe presentity presence items. + TInt count = iContentItem.MemberCount(); + for( TInt a = 0; a < count; ++a ) + { + CPresentityGroupMemberInfoImp& memberInfo = iContentItem.MemberAt( a ); + const CXIMPIdentityImp& identity = memberInfo.IdentityImp(); + + presCache->RemovePresenceConfigurator( identity, this ); + } + CXIMPConfigurationItemBase::RemoveConfigurator( aContext ); + } + + +// --------------------------------------------------------------------------- +// CGroupMembersPresenceConfigurationItem::HandleEventL() +// --------------------------------------------------------------------------- +// +void CGroupMembersPresenceConfigurationItem::HandleChangeL( + RPrGrpMemInfoImpArray& aAdded, RPrGrpMemInfoImpArray& aRemoved ) + { + TRACE(_L("CGroupMembersPresenceConfigurationItem::ConfigurationPif" ) ); + MXIMPItemParent* presCache = static_cast(iParent.GetInterface(PRESENCE_ITEM_PARENT)); + TInt count = aAdded.Count(); + for( TInt a = 0; a < count; ++a ) + { + CPresentityGroupMemberInfoImp& memberInfo = *aAdded[ a ]; + const CXIMPIdentityImp& identity = memberInfo.IdentityImp(); + + presCache->AddPresenceConfiguratorL( identity, this ); + } + count = aRemoved.Count(); + for( TInt a = 0; a < count; ++a ) + { + CPresentityGroupMemberInfoImp& memberInfo = *aRemoved[ a ]; + const CXIMPIdentityImp& identity = memberInfo.IdentityImp(); + + presCache->RemovePresenceConfigurator( identity, this ); + } + } + +// --------------------------------------------------------------------------- +// CGroupMembersPresenceConfigurationItem::HandleEventL() +// --------------------------------------------------------------------------- +// +void CGroupMembersPresenceConfigurationItem::HandleSynthesiseL( + RPrGrpMemInfoImpArray& aTarget ) + { + TRACE(_L("CGroupMembersPresenceConfigurationItem::ConfigurationPif" ) ); + TInt count = aTarget.Count(); + MXIMPItemParent* presCache = static_cast(iParent.GetInterface(PRESENCE_ITEM_PARENT)); + for( TInt a = 0; a < count; ++a ) + { + CPresentityGroupMemberInfoImp& memberInfo = *aTarget[ a ]; + const CXIMPIdentityImp& identity = memberInfo.IdentityImp(); + + presCache->ActivatePresentityPresenceSubscriberL( identity, this ); + TInt contextCount = iContexts.Count(); + for( TInt b = 0; b < contextCount; ++b ) + { + presCache->SynthesisePresentityPresenceSubscriptionEventToL( identity, iContexts[ a ], EFalse ); + } + } + } + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencedatamodel/presenceauthorization/groupmemberspresenceconfigurationitem.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencedatamodel/presenceauthorization/groupmemberspresenceconfigurationitem.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,182 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Group members presence configuration item +* +*/ + +#ifndef CPSCGROUPMEMBERSPRESENCECONFIGURATIONITEM_H +#define CPSCGROUPMEMBERSPRESENCECONFIGURATIONITEM_H + +#include +#include "presenceinfoimp.h" +#include "ximpconfigurationitembase.h" +#include "groupcontenteventobserver.h" + +class MXIMPItemParentBase; +class MXIMPPscContext; +class CPresenceInfoFilterImp; +class MXIMPIdentity; +class CXIMPIdentityImp; +class CGroupContentSubscriptionItem; + +/** + * Group members presence configuration item + * + * @since S60 v3.2 + */ +class CGroupMembersPresenceConfigurationItem : public CXIMPConfigurationItemBase, + public MGroupContentEventObserver + { +public: // Construction and destruction + + /** + * Construction + * @param aParent. Parent has to be informed when this object is deleted by RemoveMe method. + */ + static CGroupMembersPresenceConfigurationItem* NewLC( MXIMPItemParentBase& aParent, + CGroupContentSubscriptionItem& aContentItem ); + + /** + * Destruction + * - Remember to inform parent about delete. + */ + ~CGroupMembersPresenceConfigurationItem(); + +private: // Construction and destruction + + /** + * Construction + * @param aParent. Parent has to be informed when this object is deleted by RemoveMe method. + */ + CGroupMembersPresenceConfigurationItem( MXIMPItemParentBase& aParent, + CGroupContentSubscriptionItem& aContentItem ); + + /** + * Construction + */ + void ConstructL(); + +public: // New methods + + + /** + * Current presence information filter. + * @return Current presence information filter. + */ + IMPORT_C CPresenceInfoFilterImp& ConfigurationPif(); + + /** + * Set current presence information filter. Overwrites existing one. + * Ownership is transferred to callee. + * @param aPif Current presence information filter. + */ + IMPORT_C void SetConfigurationPif( CPresenceInfoFilterImp* aPif ); + + /** + * Collect aggregated presence information filter without given context. + * @param aContext. Exluded context from aggregated pif. + * @return Aggregated pif without exluded context. + */ + IMPORT_C CPresenceInfoFilterImp* CollectConfigurationPifWithoutCtxL( + MXIMPPscContext* aContext ); + + /** + * For ordering items. + * @param aA Key item for ordering. + * @param aB Item to compare + * @return -1 if aB is greater than aA + * 0 if they are same + * 1 if aA if greater than aB. + */ + IMPORT_C static TInt Order( const CGroupMembersPresenceConfigurationItem& aA, + const CGroupMembersPresenceConfigurationItem& aB ); + /** + * For ordering items using identity as key. + * @param aA Key identity for ordering. + * @param aB Item to compare + * @return -1 if aB is greater than aA + * 0 if they are same + * 1 if aA if greater than aB. + */ + IMPORT_C static TInt IdentityOrder( const CXIMPIdentityImp* aA, + const CGroupMembersPresenceConfigurationItem& aB ); + /** + * Identity of item. + * @return Identity of item. + */ + IMPORT_C const MXIMPIdentity& Identity() const; + + /** + * Set identity for item + * @param aIdentity. New identity for item. Ownership is transferred. + */ + IMPORT_C void SetIdentity( CXIMPIdentityImp* aIdentity ); + +public: // From MXIMPSubscriptionItem + + /** + * @see MXIMPSubscriptionItem + */ + void SynthesiseSubscriptionEventToL( MXIMPPscContext* aContext, TBool aForceEvent ); + void ActivateSubscriberL( MXIMPPscContext* aContext ); + +private: // From CXIMPSubscriptionItemBase + + /** + * @see CXIMPSubscriptionItemBase + */ + void CleanExpired(); + +public: // From CXIMPConfigurationItemBase + + /** + * @see CXIMPConfigurationItemBase + */ + IMPORT_C void AddConfiguratorL( MXIMPPscContext* aContext ); + IMPORT_C void RemoveConfigurator( MXIMPPscContext* aContext ); + +private: // From MGroupContentSubscriptionEventObserver + + /** + * @see MGroupContentSubscriptionEventObserver + */ + void HandleChangeL( RPrGrpMemInfoImpArray& aAdded, RPrGrpMemInfoImpArray& aRemoved ); + void HandleSynthesiseL( RPrGrpMemInfoImpArray& aAdded ); + +private: // Data + + /** + * Current presence information filter. + * Own + */ + CPresenceInfoFilterImp* iPif; + + /** + * Identity of item. + * Own + */ + CXIMPIdentityImp* iIdentity; + + /** + * Owns reference to content item. Use close for delete. + */ + CGroupContentSubscriptionItem& iContentItem; + }; + + +/* ======================================================================== */ + + + +#endif // CPSCGROUPMEMBERSPRESENCECONFIGURATIONITEM_H diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencedatamodel/presenceauthorization/presenceblockinfoimp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencedatamodel/presenceauthorization/presenceblockinfoimp.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,259 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MPresenceBlockInfo API object implementation. +* +*/ + +#include "presenceblockinfoimp.h" +#include "ximpidentityimp.h" +#include "ximprbufhelpers.h" +#include "ximpobjecthelpers.h" + + +// ============================ MEMBER FUNCTIONS ============================= + +// --------------------------------------------------------------------------- +// CPresenceBlockInfoImp::NewLC() +// --------------------------------------------------------------------------- +// +EXPORT_C CPresenceBlockInfoImp* CPresenceBlockInfoImp::NewLC( + const MXIMPIdentity& aIdentity, + const TDesC16& aDisplayName ) + { + CPresenceBlockInfoImp* self = new( ELeave ) CPresenceBlockInfoImp; + CleanupStack::PushL( self ); + self->ConstructL( aIdentity, aDisplayName ); + return self; + } + +// --------------------------------------------------------------------------- +// CPresenceBlockInfoImp::NewLC() +// --------------------------------------------------------------------------- +// +EXPORT_C CPresenceBlockInfoImp* CPresenceBlockInfoImp::NewLC() + { + CPresenceBlockInfoImp* self = new( ELeave ) CPresenceBlockInfoImp; + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + + +// --------------------------------------------------------------------------- +// CPresenceBlockInfoImp::NewL() +// --------------------------------------------------------------------------- +// +EXPORT_C CPresenceBlockInfoImp* CPresenceBlockInfoImp::NewL() + { + CPresenceBlockInfoImp* self = NewLC(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// CXIMPFeatureInfoImp::NewFromStreamLC() +// --------------------------------------------------------------------------- +// +XIMPIMP_IMPLEMENT_DATAOBJ_NEWFROMSTREAM( CPresenceBlockInfoImp ) + +// --------------------------------------------------------------------------- +// Implement supported interface access. +// --------------------------------------------------------------------------- +// +XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CPresenceBlockInfoImp, + MPresenceBlockInfo ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + +XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CPresenceBlockInfoImp, + MPresenceBlockInfo ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + + +// --------------------------------------------------------------------------- +// CPresenceBlockInfoImp::~CPresenceBlockInfoImp() +// --------------------------------------------------------------------------- +// +CPresenceBlockInfoImp::~CPresenceBlockInfoImp() + { + iDisplayName.Close(); + delete iIdentity; + } + +// --------------------------------------------------------------------------- +// CPresenceBlockInfoImp::CPresenceBlockInfoImp() +// --------------------------------------------------------------------------- +// +CPresenceBlockInfoImp::CPresenceBlockInfoImp() + { + } + + +// --------------------------------------------------------------------------- +// CPresenceBlockInfoImp::ConstructL() +// --------------------------------------------------------------------------- +// +void CPresenceBlockInfoImp::ConstructL() + { + iDisplayName.CreateL( 0 ); + iIdentity = CXIMPIdentityImp::NewL(); + } + +// --------------------------------------------------------------------------- +// CPresenceBlockInfoImp::ConstructL() +// --------------------------------------------------------------------------- +// +void CPresenceBlockInfoImp::ConstructL( + const MXIMPIdentity& aIdentity, + const TDesC16& aDisplayName ) + { + const CXIMPIdentityImp* sourceIdentity = + TXIMPGetImpClassOrPanic< const CXIMPIdentityImp>::From( aIdentity ); + + iIdentity = TXIMPObjectCloner< CXIMPIdentityImp >::CloneL( *sourceIdentity ); + iDisplayName.CreateL( aDisplayName ); + } + +// --------------------------------------------------------------------------- +// CPresenceBlockInfoImp::ExternalizeL() +// --------------------------------------------------------------------------- +// +EXPORT_C void CPresenceBlockInfoImp::ExternalizeL( RWriteStream& aStream ) const + { + iIdentity->ExternalizeL( aStream ); + XIMPRBuf16Helper::ExternalizeL( iDisplayName, aStream ); + } + +// --------------------------------------------------------------------------- +// CPresenceBlockInfoImp::InternalizeL() +// --------------------------------------------------------------------------- +// +EXPORT_C void CPresenceBlockInfoImp::InternalizeL( RReadStream& aStream ) + { + iIdentity->InternalizeL( aStream ); + XIMPRBuf16Helper::InternalizeL( iDisplayName, aStream ); + } + +// --------------------------------------------------------------------------- +// From MPresenceBlockInfo class. +// CPresenceBlockInfoImp::BlockedEntityId() +// --------------------------------------------------------------------------- +// +const MXIMPIdentity& CPresenceBlockInfoImp::BlockedEntityId() const + { + return *iIdentity; + } + + +// --------------------------------------------------------------------------- +// From MPresenceBlockInfo class. +// CPresenceBlockInfoImp::BlockedEntityDisplayName() +// --------------------------------------------------------------------------- +// +const TDesC16& CPresenceBlockInfoImp::BlockedEntityDisplayName() const + { + return iDisplayName; + } + + +// --------------------------------------------------------------------------- +// From MPresenceBlockInfo class. +// CPresenceBlockInfoImp::SetBlockedEntityIdL() +// --------------------------------------------------------------------------- +// +void CPresenceBlockInfoImp::SetBlockedEntityIdL( + MXIMPIdentity* aIdentity ) + { + CXIMPIdentityImp* identityImp = + TXIMPGetImpClassOrPanic< CXIMPIdentityImp>::From( *aIdentity ); + + delete iIdentity; + iIdentity = identityImp; + } + + +// --------------------------------------------------------------------------- +// From MPresenceBlockInfo class. +// CPresenceBlockInfoImp::SetBlockedEntityDisplayNameL() +// --------------------------------------------------------------------------- +// +void CPresenceBlockInfoImp::SetBlockedEntityDisplayNameL( + const TDesC16& aDisplayName ) + { + HBufC16* displayNameBuf = aDisplayName.AllocL(); + iDisplayName.Close(); + iDisplayName.Assign( displayNameBuf ); + } + + +// --------------------------------------------------------------------------- +// CPresenceBlockInfoImp::EqualsContent() +// --------------------------------------------------------------------------- +// +TBool CPresenceBlockInfoImp::EqualsContent( const CXIMPApiDataObjBase& aOtherInstance ) const + { + const CPresenceBlockInfoImp* tmp = + TXIMPGetImpClassOrPanic< const CPresenceBlockInfoImp >::From( aOtherInstance.Base() ); + + TBool same = ETrue; + TBool x; + + x = ( iIdentity->Compare( *tmp->iIdentity ) == 0 ); + same &= x; + + x = ( iDisplayName.Compare( tmp->iDisplayName ) == 0 ); + same &= x; + + return same; + } + +// --------------------------------------------------------------------------- +// CPresenceBlockInfoImp::SetIdentityL() +// --------------------------------------------------------------------------- +// +EXPORT_C void CPresenceBlockInfoImp::SetIdentity( CXIMPIdentityImp* aIdentity ) + { + delete iIdentity; + iIdentity = aIdentity; + } + +// --------------------------------------------------------------------------- +// CPresenceBlockInfoImp::SetDisplayName() +// --------------------------------------------------------------------------- +// +EXPORT_C void CPresenceBlockInfoImp::SetDisplayName( HBufC16* aDisplayName ) + { + iDisplayName.Close(); + iDisplayName.Assign( aDisplayName ); + } + +// --------------------------------------------------------------------------- +// CPresenceBlockInfoImp::IdLinearOrder() +// --------------------------------------------------------------------------- +// +EXPORT_C TInt CPresenceBlockInfoImp::IdLinearOrder( + const CPresenceBlockInfoImp& aA, + const CPresenceBlockInfoImp& aB ) + { + return aA.IdentityImp().Compare( aB.IdentityImp() ); + } +// --------------------------------------------------------------------------- +// CPresenceBlockInfoImp::IdentityImp() +// --------------------------------------------------------------------------- +// +EXPORT_C const CXIMPIdentityImp& CPresenceBlockInfoImp::IdentityImp() const + { + return *iIdentity; + } + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencedatamodel/presenceauthorization/presenceblockinfoimp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencedatamodel/presenceauthorization/presenceblockinfoimp.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,127 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MPresenceBlockInfo API object implementation. +* +*/ + +#ifndef CPRESENCEBLOCKINFOIMP_H +#define CPRESENCEBLOCKINFOIMP_H + +#include "ximpapidataobjbase.h" +#include "presenceapiobjbase.h" +#include +#include + +class CXIMPIdentityImp; + +/** + * MPresenceBlockInfo API object implementation. + * + * @lib ximpdatamodel.dll + * @since S60 v3.2 + */ +NONSHARABLE_CLASS( CPresenceBlockInfoImp ): public CXIMPApiDataObjBase, + public MPresenceBlockInfo + { + public: + /** The class ID. */ + enum { KClassId = PRIMP_CLSID_CPRESENCEBLOCKINFOIMP }; + +public: + + IMPORT_C static CPresenceBlockInfoImp* NewLC( + const MXIMPIdentity& aIdentity, + const TDesC16& aDisplayName ); + IMPORT_C static CPresenceBlockInfoImp* NewLC(); + IMPORT_C static CPresenceBlockInfoImp* NewL(); + virtual ~CPresenceBlockInfoImp(); + +private: + + CPresenceBlockInfoImp(); + void ConstructL(); + void ConstructL( const MXIMPIdentity& aIdentity, + const TDesC16& aDisplayName ); + +public: // From MXIMPBase + + /** + * Implementation of MXIMPBase interface methods + * @see MXIMPBase + */ + XIMPIMP_DECLARE_IF_BASE_METHODS + +public: // From MPresenceBlockInfo + + const MXIMPIdentity& BlockedEntityId() const; + const TDesC16& BlockedEntityDisplayName() const; + void SetBlockedEntityIdL( MXIMPIdentity* aIdentity ); + void SetBlockedEntityDisplayNameL( const TDesC16& aDisplayName ); + + +public: // From CXIMPApiDataObjBase + + /** + * @see CXIMPApiDataObjBase + */ + XIMPIMP_DECLARE_DATAOBJ_BASE_METHODS + +public: // New functions + + /** + * Internalizes object data from given stream. + * @param aStream Stream to read. + */ + IMPORT_C void InternalizeL( RReadStream& aStream ); + + /** + * Set identity + */ + IMPORT_C void SetIdentity( CXIMPIdentityImp* aIdentity ); + + /** + * Set display name + */ + IMPORT_C void SetDisplayName( HBufC16* aDisplayName ); + + /** + * TLinearOrder for ordering based on stored group id, + * when this class is used within an RPointerArray or derivatives. + */ + IMPORT_C static TInt IdLinearOrder( + const CPresenceBlockInfoImp& aA, + const CPresenceBlockInfoImp& aB ); + + /** + * Access to identity object + * @return Identity + */ + IMPORT_C const CXIMPIdentityImp& IdentityImp() const; + +private: // data + + /** + * Identity + */ + CXIMPIdentityImp* iIdentity; + + /** + * Displayname + */ + RBuf16 iDisplayName; + + }; + + +#endif // CPRESENCEBLOCKINFOIMP_H diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencedatamodel/presenceauthorization/presenceblocklisteventimp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencedatamodel/presenceauthorization/presenceblocklisteventimp.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,349 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Presence block list event implementation. + * +*/ + +#include "presenceblocklisteventimp.h" +#include "presenceblockinfoimp.h" +#include "ximpobjecthelpers.h" +#include "ximpidentityimp.h" +#include "ximpdatasubscriptionstateimp.h" +#include + + +// --------------------------------------------------------------------------- +// CPresenceBlockListEventImp::NewLC() +// --------------------------------------------------------------------------- +// +EXPORT_C CPresenceBlockListEventImp* CPresenceBlockListEventImp::NewLC( + RPrBlockInfoImpArray* aAdded, + RPrBlockInfoImpArray* aPending, + RPrBlockInfoImpArray* aRemoved, + RPrBlockInfoImpArray* aUpdated, + CXIMPDataSubscriptionStateImp* aState + ) + { + CPresenceBlockListEventImp* self = new( ELeave ) CPresenceBlockListEventImp(); + CleanupStack::PushL( self ); + self->ConstructL( aAdded, aPending, aRemoved, aUpdated, aState ); + return self; + } + +// --------------------------------------------------------------------------- +// CPresenceBlockListEventImp::NewFromStreamLC() +// --------------------------------------------------------------------------- +// +CXIMPApiEventBase* CPresenceBlockListEventImp::NewFromStreamLC( RReadStream& aStream ) + { + CPresenceBlockListEventImp* self = new( ELeave ) CPresenceBlockListEventImp; + CleanupStack::PushL( self ); + self->ConstructL( aStream ); + return self; + } + +// --------------------------------------------------------------------------- +// CPresenceBlockListEventImp::~CPresenceBlockListEventImp() +// --------------------------------------------------------------------------- +// +CPresenceBlockListEventImp::~CPresenceBlockListEventImp() + { + if( iConstructedFromStream ) + { + delete iAdded; + delete iCurrent; + delete iRemoved; + delete iUpdated; + iCurrent = NULL; // Must be null for next branch. + } + + if( iOwnsCurrent ) + { + delete iCurrent; + } + + delete iSubscriptionState; + } + + +// --------------------------------------------------------------------------- +// CPresenceBlockListEventImp::CPresenceBlockListEventImp() +// --------------------------------------------------------------------------- +// +CPresenceBlockListEventImp::CPresenceBlockListEventImp() + { + } + + +// --------------------------------------------------------------------------- +// CPresenceBlockListEventImp::ConstructL() +// --------------------------------------------------------------------------- +// +void CPresenceBlockListEventImp::ConstructL( + RPrBlockInfoImpArray* aAdded, + RPrBlockInfoImpArray* aPending, + RPrBlockInfoImpArray* aRemoved, + RPrBlockInfoImpArray* aUpdated, + CXIMPDataSubscriptionStateImp* aState ) + { + iAdded = aAdded; + if( aPending ) + { + iCurrent = aPending; + } + else + { + iCurrent = new ( ELeave ) RPrBlockInfoImpArray; + iOwnsCurrent = ETrue; + } + iRemoved = aRemoved; + iUpdated = aUpdated; + iSubscriptionState = aState; + } + +// --------------------------------------------------------------------------- +// CPresenceBlockListEventImp::ConstructL() +// --------------------------------------------------------------------------- +// +void CPresenceBlockListEventImp::ConstructL( RReadStream& aStream ) + { + iConstructedFromStream = ETrue; + + iAdded = new ( ELeave ) RPrBlockInfoImpArray; + iCurrent = new ( ELeave ) RPrBlockInfoImpArray; + iRemoved = new ( ELeave ) RPrBlockInfoImpArray; + iUpdated = new ( ELeave ) RPrBlockInfoImpArray; + iSubscriptionState = CXIMPDataSubscriptionStateImp::NewL(); + + FillArrayFromStreamL( *iAdded, aStream ); + FillArrayFromStreamL( *iCurrent, aStream ); + FillArrayFromStreamL( *iRemoved, aStream ); + FillArrayFromStreamL( *iUpdated, aStream ); + + iSubscriptionState->InternalizeL( aStream ); + } + +// --------------------------------------------------------------------------- +// Implement supported interface access. +// --------------------------------------------------------------------------- +// +XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CPresenceBlockListEventImp, + MPresenceBlockListEvent ) + XIMPIMP_IF_BASE_GET_CLASS( CXIMPApiEventBase, this ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + + +XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CPresenceBlockListEventImp, + MPresenceBlockListEvent ) + XIMPIMP_IF_BASE_GET_CONST_CLASS( CXIMPApiEventBase, this ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + + + +// --------------------------------------------------------------------------- +// Implement methods from base event interface and base event class +// --------------------------------------------------------------------------- +// +XIMPIMP_IMPLEMENT_EVENT_BASE_METHODS( CPresenceBlockListEventImp, + MPresenceBlockListEvent ) + + +// --------------------------------------------------------------------------- +// CPresenceBlockListEventImp::EqualsContent() +// --------------------------------------------------------------------------- +// +TBool CPresenceBlockListEventImp::EqualsContent( + const CXIMPApiEventBase& aOtherInstance ) const + { + const CPresenceBlockListEventImp* tmp = + TXIMPGetImpClassOrPanic< const CPresenceBlockListEventImp>::From( + aOtherInstance.Base() ); + TBool same = ETrue; + TBool x = TXIMPEqualsContent< CPresenceBlockInfoImp >::Array( *iAdded, *( tmp->iAdded ) ); + same &= x; + + x = TXIMPEqualsContent< CPresenceBlockInfoImp >::Array( *iCurrent, *( tmp->iCurrent ) ); + same &= x; + + x = TXIMPEqualsContent< CPresenceBlockInfoImp >::Array( *iRemoved, *( tmp->iRemoved ) ); + same &= x; + + x = TXIMPEqualsContent< CPresenceBlockInfoImp >::Array( *iUpdated, *( tmp->iUpdated ) ); + same &= x; + + x = iSubscriptionState->EqualsContent( *tmp->iSubscriptionState ); + same &= x; + + return same; + } + +// --------------------------------------------------------------------------- +// From class CXIMPApiEventBase. +// CPresenceBlockListEventImp::ExternalizeL() +// --------------------------------------------------------------------------- +// +void CPresenceBlockListEventImp::ExternalizeL( RWriteStream& aStream ) const + { + WriteArrayToStreamL( *iAdded, aStream ); + WriteArrayToStreamL( *iCurrent, aStream ); + WriteArrayToStreamL( *iRemoved, aStream ); + WriteArrayToStreamL( *iUpdated, aStream ); + iSubscriptionState->ExternalizeL( aStream ); + } + + +// --------------------------------------------------------------------------- +// From MPresenceBlockListEvent class. +// CPresenceBlockListEventImp::NewBlocksCount() +// --------------------------------------------------------------------------- +// +TInt CPresenceBlockListEventImp::NewBlocksCount() const + { + return iAdded->Count(); + } + + +// --------------------------------------------------------------------------- +// From MPresenceBlockListEvent class. +// CPresenceBlockListEventImp::NewBlock() +// --------------------------------------------------------------------------- +// +const MPresenceBlockInfo& + CPresenceBlockListEventImp::NewBlock( TInt aIndex ) const + { + return *(*iAdded)[ aIndex ]; + } + +// --------------------------------------------------------------------------- +// From MPresenceBlockListEvent class. +// CPresenceBlockListEventImp::UpdatedBlocksCount() +// --------------------------------------------------------------------------- +// +TInt CPresenceBlockListEventImp::UpdatedBlocksCount() const + { + return iUpdated->Count(); + } + + +// --------------------------------------------------------------------------- +// From MPresenceBlockListEvent class. +// CPresenceBlockListEventImp::UpdatedBlock() +// --------------------------------------------------------------------------- +// +const MPresenceBlockInfo& + CPresenceBlockListEventImp::UpdatedBlock( TInt aIndex ) const + { + return *(*iUpdated)[ aIndex ]; + } + + +// --------------------------------------------------------------------------- +// From MPresenceBlockListEvent class. +// CPresenceBlockListEventImp::DisappearedBlocksCount() +// --------------------------------------------------------------------------- +// +TInt CPresenceBlockListEventImp::DisappearedBlocksCount() const + { + return iRemoved->Count(); + } + + +// --------------------------------------------------------------------------- +// From MPresenceBlockListEvent class. +// CPresenceBlockListEventImp::DisappearedBlock() +// --------------------------------------------------------------------------- +// +const MPresenceBlockInfo& + CPresenceBlockListEventImp::DisappearedBlock( TInt aIndex ) const + { + return *(*iRemoved)[ aIndex ]; + } + + +// --------------------------------------------------------------------------- +// From MPresenceBlockListEvent class. +// CPresenceBlockListEventImp::CurrentBlocksCount() +// --------------------------------------------------------------------------- +// +TInt CPresenceBlockListEventImp::CurrentBlocksCount() const + { + return iCurrent->Count(); + } + +// --------------------------------------------------------------------------- +// From MPresenceBlockListEvent class. +// CPresenceBlockListEventImp::CurrentBlock() +// --------------------------------------------------------------------------- +// +const MPresenceBlockInfo& + CPresenceBlockListEventImp::CurrentBlock( TInt aIndex ) const + { + return *(*iCurrent)[ aIndex ]; + } + + +// --------------------------------------------------------------------------- +// From class MPresenceBlockListEvent. +// CPresenceBlockListEventImp::DataSubscriptionState() +// --------------------------------------------------------------------------- +// +const MXIMPDataSubscriptionState& + CPresenceBlockListEventImp::DataSubscriptionState() const + { + return *iSubscriptionState; + } + + +// --------------------------------------------------------------------------- +// CPresenceBlockListEventImp::WriteArrayToStreamL() +// --------------------------------------------------------------------------- +// +void CPresenceBlockListEventImp::WriteArrayToStreamL( + RPrBlockInfoImpArray& aArray, RWriteStream& aStream ) const + { + TInt count = aArray.Count(); + aStream.WriteInt32L( count ); + { + for( TInt a = 0; a < count; ++a ) + { + aArray[ a ]->ExternalizeL( aStream ); + } + } + } + + + +// --------------------------------------------------------------------------- +// CPresenceBlockListEventImp::FillArrayFromStreamL +// --------------------------------------------------------------------------- +// +void CPresenceBlockListEventImp::FillArrayFromStreamL( + RPrBlockInfoImpArray& aArray, + RReadStream& aStream ) + { + TInt count = aStream.ReadInt32L(); + for( TInt a = 0; a < count; ++a ) + { + // the stream MUST be in order (since it was externalized by this class) + CPresenceBlockInfoImp* newInfo = CPresenceBlockInfoImp::NewLC(); + newInfo->InternalizeL( aStream ); + aArray.AppendL( newInfo ); + CleanupStack::Pop(); // newInfo + } + } + + + +// End of file + diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencedatamodel/presenceauthorization/presenceblocklisteventimp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencedatamodel/presenceauthorization/presenceblocklisteventimp.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,161 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MPresenceBlockListEvent API object implementation. + * +*/ + +#ifndef CPRESENCEBLOCKLISTEVENTIMP_H +#define CPRESENCEBLOCKLISTEVENTIMP_H + +#include "ximpapieventbase.h" +#include "presencetypehelpers.h" +#include + + +class RReadStream; +class CPresenceBlockInfoImp; +class CXIMPIdentityImp; +class CXIMPDataSubscriptionStateImp; + +/** + * MPresenceBlockListEvent API object implementation. + * + * @lib ximpdatamodel.dll + * @since S60 v3.2 + */ +NONSHARABLE_CLASS( CPresenceBlockListEventImp ): public CXIMPApiEventBase, + public MPresenceBlockListEvent + { +public: + /** The class ID. */ + enum { KClassId = PRIMP_CLSID_CPRESENCEBLOCKLISTEVENTIMP }; + +public: + /** + * Exported instantiation method for initializing + * new event object. + */ + IMPORT_C static CPresenceBlockListEventImp* NewLC( + RPrBlockInfoImpArray* aAdded, + RPrBlockInfoImpArray* aPending, + RPrBlockInfoImpArray* aRemoved, + RPrBlockInfoImpArray* aUpdated, + CXIMPDataSubscriptionStateImp* aState + ); + + /** + * Instantiation method for event automation. + * Method signature must be exactly this to work + * with event delivery automation system. + * + * Event implementation must be registered to + * XIMPEventCodec KXIMPEventConstructorTable. + */ + static CXIMPApiEventBase* NewFromStreamLC( RReadStream& aStream ); + + virtual ~CPresenceBlockListEventImp(); + +private: + CPresenceBlockListEventImp(); + + void ConstructL( + RPrBlockInfoImpArray* aAdded, + RPrBlockInfoImpArray* aPending, + RPrBlockInfoImpArray* aRemoved, + RPrBlockInfoImpArray* aUpdated, + CXIMPDataSubscriptionStateImp* aState + ); + + void ConstructL( RReadStream& aStream ); + + /** + * Helper for externalize. + */ + void WriteArrayToStreamL( RPrBlockInfoImpArray& aArray, + RWriteStream& aStream ) const; + + + /** + * Helper for internalize + */ + void FillArrayFromStreamL( RPrBlockInfoImpArray& aArray, + RReadStream& aStream ); + +public: // From API base interfaces + + /** + * Implementation of MXIMPBase interface methods + * @see MXIMPBase + */ + XIMPIMP_DECLARE_IF_BASE_METHODS + + + /** + * Implementation of MXIMPEventBase interface and + * CXIMPApiEventBase methods + * + * @see MXIMPEventBase + * @see CXIMPApiEventBase + */ + XIMPIMP_DECLARE_EVENT_BASE_METHODS + + +public: // From MPresenceBlockListEvent + + TInt NewBlocksCount() const; + const MPresenceBlockInfo& NewBlock( TInt aIndex ) const; + + + TInt UpdatedBlocksCount() const; + const MPresenceBlockInfo& UpdatedBlock( TInt aIndex ) const; + + + TInt DisappearedBlocksCount() const; + const MPresenceBlockInfo& DisappearedBlock( TInt aIndex ) const; + + + TInt CurrentBlocksCount() const; + const MPresenceBlockInfo& CurrentBlock( TInt aIndex ) const; + + const MXIMPDataSubscriptionState& DataSubscriptionState() const; + +private: // data + + /** + * ETrue if constructed from stream. + */ + TBool iConstructedFromStream; + + /** + * Group informations. + * Owns if constructed from stream. Otherwise does not own. + */ + RPrBlockInfoImpArray* iAdded; + RPrBlockInfoImpArray* iCurrent; + RPrBlockInfoImpArray* iRemoved; + RPrBlockInfoImpArray* iUpdated; + + /** + * Subscription state + */ + CXIMPDataSubscriptionStateImp* iSubscriptionState; + + /** + * Current array owner status + */ + TBool iOwnsCurrent; + }; + + +#endif // CPRESENCEBLOCKLISTEVENTIMP_H diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencedatamodel/presenceauthorization/presenceconfigurationitem.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencedatamodel/presenceauthorization/presenceconfigurationitem.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,205 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Presence configuration item +* +*/ + + +#include "presenceconfigurationitem.h" +#include "ximpitemparent.h" +#include "ximpidentityimp.h" +#include "presenceinfofilterimp.h" +#include "ximppanics.h" +#include "ximppsccontext.h" +#include "documentutils.h" +#include "presentitypresenceeventimp.h" +#include "ximpobjecthelpers.h" + +#include "ximptrace.h" + +// --------------------------------------------------------------------------- +// CPresenceConfigurationItem::CPresenceConfigurationItem() +// --------------------------------------------------------------------------- +// +CPresenceConfigurationItem::CPresenceConfigurationItem( MXIMPItemParentBase& aParent ) +: CXIMPConfigurationItemBase( aParent ) + { + } + + +// --------------------------------------------------------------------------- +// CPresenceConfigurationItem::ConstructL() +// --------------------------------------------------------------------------- +// +void CPresenceConfigurationItem::ConstructL( const CXIMPIdentityImp& aIdentity ) + { + CXIMPConfigurationItemBase::BaseConstructL(); + + iIdentity = TXIMPObjectCloner< CXIMPIdentityImp >::CloneL( aIdentity ); + } + + +// --------------------------------------------------------------------------- +// CPresenceConfigurationItem::NewLC() +// --------------------------------------------------------------------------- +// +CPresenceConfigurationItem* + CPresenceConfigurationItem::NewLC( MXIMPItemParentBase& aParent, const CXIMPIdentityImp& aIdentity ) + { + CPresenceConfigurationItem* self = + new( ELeave ) CPresenceConfigurationItem( aParent ); + CleanupClosePushL( *self ); + self->ConstructL( aIdentity ); + return self; + } + + +// --------------------------------------------------------------------------- +// CPresenceConfigurationItem::~CPresenceConfigurationItem() +// --------------------------------------------------------------------------- +// +CPresenceConfigurationItem::~CPresenceConfigurationItem() + { + MXIMPItemParent* presCache = static_cast(iParent.GetInterface(PRESENCE_ITEM_PARENT)); + presCache->RemoveMe( this ); + + delete iIdentity; + delete iPif; + } + +// --------------------------------------------------------------------------- +// CPresenceConfigurationItem::ConfigurationPif() +// --------------------------------------------------------------------------- +// +EXPORT_C CPresenceInfoFilterImp& + CPresenceConfigurationItem::ConfigurationPif() + { + TRACE(_L("CPresenceConfigurationItem::ConfigurationPif" ) ); + __ASSERT_ALWAYS( iPif, User::Panic( NXIMPPrivPanic::KCategory, + NXIMPPrivPanic::EOwnPresencePifNotSet ) ); + return *iPif; + } + +// --------------------------------------------------------------------------- +// CPresenceConfigurationItem::SetSubscriptionPif() +// --------------------------------------------------------------------------- +// +EXPORT_C void CPresenceConfigurationItem::SetConfigurationPif( + CPresenceInfoFilterImp* aPif ) + { + TRACE(_L("CPresenceConfigurationItem::SetConfigurationPif" ) ); + if ( !aPif ) + { + TRACE(_L("CPresenceConfigurationItem::SetConfigurationPif aPif NULL" ) ); + } + delete iPif; + iPif = aPif; + } + +// --------------------------------------------------------------------------- +// CPresenceConfigurationItem::CollectSubscriptionPifWithoutCtxL() +// --------------------------------------------------------------------------- +// +EXPORT_C CPresenceInfoFilterImp* + CPresenceConfigurationItem::CollectConfigurationPifWithoutCtxL( + MXIMPPscContext* aContext ) + { + TRACE(_L("CPresenceConfigurationItem::CollectSubscriptionPifWithoutCtxL" ) ); + RPointerArray< CPresenceInfoFilterImp > arrayOfPifs; + CleanupClosePushL( arrayOfPifs ); + + TInt count = iConfigContexts.Count(); + for( TInt a = 0; a < count; ++a ) + { + if( iConfigContexts[ a ] != aContext ) + { + CPresenceInfoFilterImp* filter = iConfigContexts[ a ]->PresenceInfoFilter( + MXIMPPscContext::EGrantPresenceToPresentityFilter, iIdentity ); + if ( filter ) + { + arrayOfPifs.AppendL( filter ); + } + } + } + CPresenceInfoFilterImp* pifWithoutCtx = DocumentUtils::InfoFilterUnionL( arrayOfPifs ); + CleanupStack::PopAndDestroy(); // arrayOfPifs + return pifWithoutCtx; + } + + +// --------------------------------------------------------------------------- +// CPresenceConfigurationItem::Identity() +// --------------------------------------------------------------------------- +// +EXPORT_C const MXIMPIdentity& CPresenceConfigurationItem::Identity() const + { + return *iIdentity; + } + +// --------------------------------------------------------------------------- +// CPresenceConfigurationItem::SetIdentity() +// --------------------------------------------------------------------------- +// +EXPORT_C void CPresenceConfigurationItem::SetIdentity( + CXIMPIdentityImp* aIdentity ) + { + delete iIdentity; + iIdentity = aIdentity; + } + +// --------------------------------------------------------------------------- +// CPresenceConfigurationItem::Order() +// --------------------------------------------------------------------------- +// +EXPORT_C TInt CPresenceConfigurationItem::Order( + const CPresenceConfigurationItem& aA, + const CPresenceConfigurationItem& aB ) + { + return IdentityOrder( aA.iIdentity, aB ); + } +// --------------------------------------------------------------------------- +// CPresenceConfigurationItem::Order() +// --------------------------------------------------------------------------- +// +EXPORT_C TInt CPresenceConfigurationItem::IdentityOrder( + const CXIMPIdentityImp* aA, + const CPresenceConfigurationItem& aB ) + { + return aA->Compare( *aB.iIdentity ); + } + +// --------------------------------------------------------------------------- +// From class MXIMPSubscriptionItem. +// CPresenceConfigurationItem::SynthesiseSubscriptionEventTo() +// --------------------------------------------------------------------------- +// +void CPresenceConfigurationItem::SynthesiseSubscriptionEventToL( + MXIMPPscContext* aContext, + TBool aForceEvent ) + { + TRACE_1( _L("CPresenceConfigurationItem::SynthesiseSubscriptionEventTo() aForce=%d"), aForceEvent ); + XIMP_UNUSED_FORMAL_PARAM( aContext ); + XIMP_UNUSED_FORMAL_PARAM( aForceEvent ); + } + +// --------------------------------------------------------------------------- +// CPresenceConfigurationItem::CleanExpired() +// --------------------------------------------------------------------------- +// +void CPresenceConfigurationItem::CleanExpired() + { + + } + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencedatamodel/presenceauthorization/presenceconfigurationitem.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencedatamodel/presenceauthorization/presenceconfigurationitem.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,133 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Presence configuration item +* +*/ + +#ifndef CPSCPRESENCECONFIGURATIONITEM_H +#define CPSCPRESENCECONFIGURATIONITEM_H + +#include +#include "ximpconfigurationitembase.h" + +class CPresenceInfoFilterImp; +class MXIMPIdentity; +class CXIMPIdentityImp; + +/** + * Presence configuration item + * + * @since S60 v3.2 + */ +class CPresenceConfigurationItem : public CXIMPConfigurationItemBase + { +public: // Construction and destruction + + /** + * Construction + * @param aParent. Parent has to be informed when this object is deleted by RemoveMe method. + */ + static CPresenceConfigurationItem* NewLC( MXIMPItemParentBase& aParent, const CXIMPIdentityImp& aIdentity ); + + /** + * Destruction + * - Remember to inform parent about delete. + */ + ~CPresenceConfigurationItem(); + +private: // Construction and destruction + + /** + * Construction + * @param aParent. Parent has to be informed when this object is deleted by RemoveMe method. + */ + CPresenceConfigurationItem( MXIMPItemParentBase& aParent ); + + /** + * Construction + */ + void ConstructL( const CXIMPIdentityImp& aIdentity ); + +public: // New methods + + /** + * Current presence information filter. + * @return Current presence information filter. + */ + IMPORT_C CPresenceInfoFilterImp& ConfigurationPif(); + + /** + * Set current presence information filter. Overwrites existing one. + * Ownership is transferred to callee. + * @param aPif Current presence information filter. + */ + IMPORT_C void SetConfigurationPif( CPresenceInfoFilterImp* aPif ); + + /** + * Collect aggregated presence information filter without given context. + * @param aContext. Exluded context from aggregated pif. + * @return Aggregated pif without exluded context. + */ + IMPORT_C CPresenceInfoFilterImp* CollectConfigurationPifWithoutCtxL( + MXIMPPscContext* aContext ); + + IMPORT_C const MXIMPIdentity& Identity() const; + + IMPORT_C void SetIdentity( CXIMPIdentityImp* aIdentity ); + + /** + * For ordering items. + */ + IMPORT_C static TInt Order( const CPresenceConfigurationItem& aA, + const CPresenceConfigurationItem& aB ); + IMPORT_C static TInt IdentityOrder( const CXIMPIdentityImp* aA, + const CPresenceConfigurationItem& aB ); + + +public: // From MXIMPSubscriptionItem + + /** + * @see MXIMPSubscriptionItem + */ + void SynthesiseSubscriptionEventToL( MXIMPPscContext* aContext, TBool aForceEvent ); + +public: // From MXIMPConfigurationItem + +private: // From CXIMPSubscriptionItemBase + + /** + * @see CXIMPSubscriptionItemBase + */ + void CleanExpired(); + +private: // Data + + /** + * Current presence information filter. + */ + CPresenceInfoFilterImp* iPif; + + /** + * Identity of item + * Own + */ + CXIMPIdentityImp* iIdentity; + }; + + +/* ======================================================================== */ + + + +#endif // CPSCPRESENCECONFIGURATIONITEM_H diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencedatamodel/presenceauthorization/presencegrantrequestinfoimp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencedatamodel/presenceauthorization/presencegrantrequestinfoimp.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,261 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MPresenceGrantRequestInfo API object implementation. +* +*/ + + +#include "presencegrantrequestinfoimp.h" +#include "ximpidentityimp.h" +#include "ximprbufhelpers.h" +#include "ximpobjecthelpers.h" + +// ============================ MEMBER FUNCTIONS ============================= + +// --------------------------------------------------------------------------- +// CPresenceGrantRequestInfoImp::NewLC() +// --------------------------------------------------------------------------- +// +EXPORT_C CPresenceGrantRequestInfoImp* CPresenceGrantRequestInfoImp::NewLC( + const MXIMPIdentity& aIdentity, + const TDesC16& aDisplayName ) + { + CPresenceGrantRequestInfoImp* self = new( ELeave ) CPresenceGrantRequestInfoImp; + CleanupStack::PushL( self ); + self->ConstructL( aIdentity, aDisplayName ); + return self; + } + +// --------------------------------------------------------------------------- +// CPresenceGrantRequestInfoImp::NewLC() +// --------------------------------------------------------------------------- +// +EXPORT_C CPresenceGrantRequestInfoImp* CPresenceGrantRequestInfoImp::NewLC() + { + CPresenceGrantRequestInfoImp* self = new( ELeave ) CPresenceGrantRequestInfoImp; + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + + +// --------------------------------------------------------------------------- +// CPresenceGrantRequestInfoImp::NewL() +// --------------------------------------------------------------------------- +// +EXPORT_C CPresenceGrantRequestInfoImp* CPresenceGrantRequestInfoImp::NewL() + { + CPresenceGrantRequestInfoImp* self = NewLC(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// CPresenceGrantRequestfoImp::NewFromStreamLC() +// --------------------------------------------------------------------------- +// +XIMPIMP_IMPLEMENT_DATAOBJ_NEWFROMSTREAM( CPresenceGrantRequestInfoImp ) + +// --------------------------------------------------------------------------- +// Implement supported interface access. +// --------------------------------------------------------------------------- +// +XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CPresenceGrantRequestInfoImp, + MPresenceGrantRequestInfo ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + +XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CPresenceGrantRequestInfoImp, + MPresenceGrantRequestInfo ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + + +// --------------------------------------------------------------------------- +// CPresenceGrantRequestInfoImp::~CPresenceGrantRequestInfoImp() +// --------------------------------------------------------------------------- +// +CPresenceGrantRequestInfoImp::~CPresenceGrantRequestInfoImp() + { + iDisplayName.Close(); + delete iIdentity; + } + +// --------------------------------------------------------------------------- +// CPresenceGrantRequestInfoImp::CPresenceGrantRequestInfoImp() +// --------------------------------------------------------------------------- +// +CPresenceGrantRequestInfoImp::CPresenceGrantRequestInfoImp() + { + } + + +// --------------------------------------------------------------------------- +// CPresenceGrantRequestInfoImp::ConstructL() +// --------------------------------------------------------------------------- +// +void CPresenceGrantRequestInfoImp::ConstructL() + { + iDisplayName.CreateL( 0 ); + iIdentity = CXIMPIdentityImp::NewLC(); + CleanupStack::Pop( iIdentity ); + } + +// --------------------------------------------------------------------------- +// CPresenceGrantRequestInfoImp::ConstructL() +// --------------------------------------------------------------------------- +// +void CPresenceGrantRequestInfoImp::ConstructL( + const MXIMPIdentity& aIdentity, + const TDesC16& aDisplayName ) + { + const CXIMPIdentityImp* sourceIdentity = static_cast< const CXIMPIdentityImp* >( &aIdentity ); + iIdentity = TXIMPObjectCloner< CXIMPIdentityImp >::CloneL( *sourceIdentity ); + iDisplayName.CreateL( aDisplayName ); + } + +// --------------------------------------------------------------------------- +// CPresenceGrantRequestInfoImp::ExternalizeL() +// --------------------------------------------------------------------------- +// +void CPresenceGrantRequestInfoImp::ExternalizeL( RWriteStream& aStream ) const + { + iIdentity->ExternalizeL( aStream ); + XIMPRBuf16Helper::ExternalizeL( iDisplayName, aStream ); + } + +// --------------------------------------------------------------------------- +// CPresenceGrantRequestInfoImp::InternalizeL() +// --------------------------------------------------------------------------- +// +EXPORT_C void CPresenceGrantRequestInfoImp::InternalizeL( RReadStream& aStream ) + { + iIdentity->InternalizeL( aStream ); + XIMPRBuf16Helper::InternalizeL( iDisplayName, aStream ); + } + +// --------------------------------------------------------------------------- +// From MPresenceGrantRequestInfo class. +// CPresenceGrantRequestInfoImp::RequestorId() +// --------------------------------------------------------------------------- +// + +const MXIMPIdentity& CPresenceGrantRequestInfoImp::RequestorId() const + { + return *iIdentity; + } + +// --------------------------------------------------------------------------- +// From MPresenceGrantRequestInfo class. +// CPresenceGrantRequestInfoImp::RequestorDisplayName() +// --------------------------------------------------------------------------- +// +const TDesC16& CPresenceGrantRequestInfoImp::RequestorDisplayName() const + { + return iDisplayName; + } + +// --------------------------------------------------------------------------- +// From MPresenceGrantRequestInfo class. +// CPresenceGrantRequestInfoImp::SetRequestorIdL() +// --------------------------------------------------------------------------- +// +void CPresenceGrantRequestInfoImp::SetRequestorIdL( + MXIMPIdentity* aIdentity ) + { + CXIMPIdentityImp* identityImp = + TXIMPGetImpClassOrPanic< CXIMPIdentityImp>::From( *aIdentity ); + + delete iIdentity; + iIdentity = identityImp; + } + + +// --------------------------------------------------------------------------- +// From MPresenceGrantRequestInfo class. +// CPresenceGrantRequestInfoImp:: +// --------------------------------------------------------------------------- +// +void CPresenceGrantRequestInfoImp::SetRequestorDisplayNameL( + const TDesC16& aDisplayName ) + { + HBufC16* displayNameBuf = aDisplayName.AllocL(); + iDisplayName.Close(); + iDisplayName.Assign( displayNameBuf ); + } + + +// --------------------------------------------------------------------------- +// CPresenceGrantRequestInfoImp::SetIdentityL() +// --------------------------------------------------------------------------- +// +EXPORT_C void CPresenceGrantRequestInfoImp::SetIdentity( CXIMPIdentityImp* aIdentity ) + { + delete iIdentity; + iIdentity = aIdentity; + } + +// --------------------------------------------------------------------------- +// CPresenceGrantRequestInfoImp::SetDisplayName() +// --------------------------------------------------------------------------- +// +EXPORT_C void CPresenceGrantRequestInfoImp::SetDisplayName( HBufC16* aDisplayName ) + { + iDisplayName.Close(); + iDisplayName.Assign( aDisplayName ); + } + +// --------------------------------------------------------------------------- +// CPresenceGrantRequestInfoImp::IdLinearOrder() +// --------------------------------------------------------------------------- +// +EXPORT_C TInt CPresenceGrantRequestInfoImp::IdLinearOrder( + const CPresenceGrantRequestInfoImp& aA, + const CPresenceGrantRequestInfoImp& aB ) + { + return aA.IdentityImp().Compare( aB.IdentityImp() ); + } +// --------------------------------------------------------------------------- +// CPresenceGrantRequestInfoImp::IdentityImp() +// --------------------------------------------------------------------------- +// +EXPORT_C const CXIMPIdentityImp& CPresenceGrantRequestInfoImp::IdentityImp() const + { + return *iIdentity; + } + + +// --------------------------------------------------------------------------- +// CPresenceGrantRequestInfoImp::EqualsContent() +// --------------------------------------------------------------------------- +// +TBool CPresenceGrantRequestInfoImp::EqualsContent( + const CXIMPApiDataObjBase& aOtherInstance ) const + { + const CPresenceGrantRequestInfoImp* tmp = + TXIMPGetImpClassOrPanic< const CPresenceGrantRequestInfoImp >::From( + aOtherInstance.Base() ); + + TBool same = ETrue; + TBool x; + x = iIdentity->EqualsContent( *( tmp->iIdentity ) ); + same &= x; + + x = 0 == iDisplayName.Compare( tmp->iDisplayName ); + same &= x; + + // add more comparisons in a similar way... + + return same; + } + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencedatamodel/presenceauthorization/presencegrantrequestinfoimp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencedatamodel/presenceauthorization/presencegrantrequestinfoimp.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,135 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MPresentityGroupInfo API object implementation. +* +*/ + +#ifndef CPRESENCEGRANTREQUESTINFOIMP_H +#define CPRESENCEGRANTREQUESTINFOIMP_H + +#include +#include + +#include "ximpapidataobjbase.h" +#include "presenceapiobjbase.h" +#include + + +class CXIMPIdentityImp; + +/** + * MPresenceInfo API object implementation. + * + * @lib ximpdatamodel.dll + * @since S60 v3.2 + */ +NONSHARABLE_CLASS( CPresenceGrantRequestInfoImp ): public CXIMPApiDataObjBase, + public MPresenceGrantRequestInfo + { + public: + /** The class ID. */ + enum { KClassId = PRIMP_CLSID_CPRESENCEGRANTREQUESTINFOIMP }; + +public: + + IMPORT_C static CPresenceGrantRequestInfoImp* NewLC( + const MXIMPIdentity& aIdentity, + const TDesC16& aDisplayName ); + IMPORT_C static CPresenceGrantRequestInfoImp* NewLC(); + IMPORT_C static CPresenceGrantRequestInfoImp* NewL(); + virtual ~CPresenceGrantRequestInfoImp(); + +private: + + CPresenceGrantRequestInfoImp(); + void ConstructL(); + void ConstructL( const MXIMPIdentity& aIdentity, + const TDesC16& aDisplayName ); + + /** + * @see CXIMPApiDataObjBase + */ + XIMPIMP_DECLARE_DATAOBJ_BASE_PRIV_METHODS + +public: // From MXIMPBase + + /** + * Implementation of MXIMPBase interface methods + * @see MXIMPBase + */ + XIMPIMP_DECLARE_IF_BASE_METHODS + + /** + * @see CXIMPApiDataObjBase + */ + XIMPIMP_DECLARE_DATAOBJ_BASE_METHODS + + +public: // From MPresenceGrantRequestInfo + + const MXIMPIdentity& RequestorId() const; + const TDesC16& RequestorDisplayName() const; + void SetRequestorIdL( MXIMPIdentity* aIdentity ); + void SetRequestorDisplayNameL( const TDesC16& aDisplayName ); + + + +public: // New functions + + /** + * Internalizes object data from given stream. + * @param aStream Stream to read. + */ + IMPORT_C void InternalizeL( RReadStream& aStream ); + + /** + * Set identity + */ + IMPORT_C void SetIdentity( CXIMPIdentityImp* aIdentity ); + + /** + * Set identity + */ + IMPORT_C void SetDisplayName( HBufC16* aDisplayName ); + + /** + * TLinearOrder for ordering based on stored group id, + * when this class is used within an RPointerArray or derivatives. + */ + IMPORT_C static TInt IdLinearOrder( + const CPresenceGrantRequestInfoImp& aA, + const CPresenceGrantRequestInfoImp& aB ); + + /** + * Access to identity object + * @return Identity + */ + IMPORT_C const CXIMPIdentityImp& IdentityImp() const; + +private: // data + + /** + * Identity + */ + CXIMPIdentityImp* iIdentity; + + /** + * Displayname + */ + RBuf16 iDisplayName; + + }; + + +#endif // CPRESENCEGRANTREQUESTINFOIMP_H diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencedatamodel/presenceauthorization/presencegrantrequestlisteventimp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencedatamodel/presenceauthorization/presencegrantrequestlisteventimp.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,312 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Presence watcher list event implementation. + * +*/ + +#include "presencegrantrequestlisteventimp.h" +#include "presencegrantrequestinfoimp.h" +#include "ximpobjecthelpers.h" +#include "ximpidentityimp.h" +#include "ximpdatasubscriptionstateimp.h" +#include + + +// --------------------------------------------------------------------------- +// CPresenceGrantRequestListEventImp::NewLC() +// --------------------------------------------------------------------------- +// +EXPORT_C CPresenceGrantRequestListEventImp* CPresenceGrantRequestListEventImp::NewLC( + RPrGrntReqInfoImpArray* aNew, + RPrGrntReqInfoImpArray* aPending, + RPrGrntReqInfoImpArray* aObsoleted, + CXIMPDataSubscriptionStateImp* aState + ) + { + CPresenceGrantRequestListEventImp* self = new( ELeave ) CPresenceGrantRequestListEventImp(); + CleanupStack::PushL( self ); + self->ConstructL( aNew, aPending, aObsoleted, aState ); + return self; + } + +// --------------------------------------------------------------------------- +// CPresenceGrantRequestListEventImp::NewFromStreamLC() +// --------------------------------------------------------------------------- +// +CXIMPApiEventBase* CPresenceGrantRequestListEventImp::NewFromStreamLC( RReadStream& aStream ) + { + CPresenceGrantRequestListEventImp* self = new( ELeave ) CPresenceGrantRequestListEventImp; + CleanupStack::PushL( self ); + self->ConstructL( aStream ); + return self; + } + +// --------------------------------------------------------------------------- +// CPresenceGrantRequestListEventImp::~CPresenceGrantRequestListEventImp() +// --------------------------------------------------------------------------- +// +CPresenceGrantRequestListEventImp::~CPresenceGrantRequestListEventImp() + { + if( iConstructedFromStream ) + { + delete iNewRequests; + delete iPending; + delete iObsoleted; + iPending = NULL; + } + if( iOwnsPending ) + { + delete iPending; + } + + delete iSubscriptionState; + } + + +// --------------------------------------------------------------------------- +// CPresenceGrantRequestListEventImp::CPresenceGrantRequestListEventImp() +// --------------------------------------------------------------------------- +// +CPresenceGrantRequestListEventImp::CPresenceGrantRequestListEventImp() + { + } + + +// --------------------------------------------------------------------------- +// CPresenceGrantRequestListEventImp::ConstructL() +// --------------------------------------------------------------------------- +// +void CPresenceGrantRequestListEventImp::ConstructL( + RPrGrntReqInfoImpArray* aNew, + RPrGrntReqInfoImpArray* aPending, + RPrGrntReqInfoImpArray* aObsoleted, + CXIMPDataSubscriptionStateImp* aState ) + { + iNewRequests = aNew; + if( aPending ) + { + iPending = aPending; + } + else + { + iPending = new ( ELeave ) RPrGrntReqInfoImpArray; + iOwnsPending = ETrue; + } + iObsoleted = aObsoleted; + iSubscriptionState = aState; + } + +// --------------------------------------------------------------------------- +// CPresenceGrantRequestListEventImp::ConstructL() +// --------------------------------------------------------------------------- +// +void CPresenceGrantRequestListEventImp::ConstructL( RReadStream& aStream ) + { + iConstructedFromStream = ETrue; + + iNewRequests = new ( ELeave ) RPrGrntReqInfoImpArray; + iPending = new ( ELeave ) RPrGrntReqInfoImpArray; + iObsoleted = new ( ELeave ) RPrGrntReqInfoImpArray; + iSubscriptionState = CXIMPDataSubscriptionStateImp::NewL(); + + FillArrayFromStreamL( *iNewRequests, aStream ); + FillArrayFromStreamL( *iPending, aStream ); + FillArrayFromStreamL( *iObsoleted, aStream ); + iSubscriptionState->InternalizeL( aStream ); + } + +// --------------------------------------------------------------------------- +// Implement supported interface access. +// --------------------------------------------------------------------------- +// +XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CPresenceGrantRequestListEventImp, + MPresenceGrantRequestListEvent ) + XIMPIMP_IF_BASE_GET_CLASS( CXIMPApiEventBase, this ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + + +XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CPresenceGrantRequestListEventImp, + MPresenceGrantRequestListEvent ) + XIMPIMP_IF_BASE_GET_CONST_CLASS( CXIMPApiEventBase, this ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + +// --------------------------------------------------------------------------- +// Implement methods from base event interface and base event class +// --------------------------------------------------------------------------- +// +XIMPIMP_IMPLEMENT_EVENT_BASE_METHODS( CPresenceGrantRequestListEventImp, + MPresenceGrantRequestListEvent ) + +// --------------------------------------------------------------------------- +// CPresenceGrantRequestListEventImp::EqualsContent() +// --------------------------------------------------------------------------- +// +TBool CPresenceGrantRequestListEventImp::EqualsContent( + const CXIMPApiEventBase& aOtherInstance ) const + { + const CPresenceGrantRequestListEventImp* tmp = + TXIMPGetImpClassOrPanic< const CPresenceGrantRequestListEventImp >::From( + aOtherInstance.Base() ); + + TBool same = ETrue; + TBool x = TXIMPEqualsContent< CPresenceGrantRequestInfoImp >::Array( *iNewRequests, *( tmp->iNewRequests ) ); + same &= x; + + x = TXIMPEqualsContent< CPresenceGrantRequestInfoImp >::Array( *iPending, *( tmp->iPending ) ); + same &= x; + + x = TXIMPEqualsContent< CPresenceGrantRequestInfoImp >::Array( *iObsoleted, *( tmp->iObsoleted ) ); + same &= x; + + x = iSubscriptionState->EqualsContent( *tmp->iSubscriptionState ); + same &= x; + + return same; + } + +// --------------------------------------------------------------------------- +// From class CXIMPApiEventBase. +// CPresenceGrantRequestListEventImp::ExternalizeL() +// --------------------------------------------------------------------------- +// +void CPresenceGrantRequestListEventImp::ExternalizeL( RWriteStream& aStream ) const + { + WriteArrayToStreamL( *iNewRequests, aStream ); + WriteArrayToStreamL( *iPending, aStream ); + WriteArrayToStreamL( *iObsoleted, aStream ); + iSubscriptionState->ExternalizeL( aStream ); + } + + + +// --------------------------------------------------------------------------- +// From MPresenceGrantRequestListEvent class. +// CPresenceGrantRequestListEventImp::NewRequestsCount() +// --------------------------------------------------------------------------- +// +TInt CPresenceGrantRequestListEventImp::NewRequestsCount() const + { + return iNewRequests->Count(); + } + +// --------------------------------------------------------------------------- +// From MPresenceGrantRequestListEvent class. +// CPresenceGrantRequestListEventImp::NewRequest() +// --------------------------------------------------------------------------- +// +const MPresenceGrantRequestInfo& + CPresenceGrantRequestListEventImp::NewRequest( TInt aIndex ) const + { + return *(*iNewRequests)[ aIndex ]; + } + + +// --------------------------------------------------------------------------- +// From MPresenceGrantRequestListEvent class. +// CPresenceGrantRequestListEventImp::DisappearedRequestsCount() +// --------------------------------------------------------------------------- +// +TInt CPresenceGrantRequestListEventImp::DisappearedRequestsCount() const + { + return iObsoleted->Count(); + } + +// --------------------------------------------------------------------------- +// From MPresenceGrantRequestListEvent class. +// CPresenceGrantRequestListEventImp::DisappearedRequest() +// --------------------------------------------------------------------------- +// +const MPresenceGrantRequestInfo& + CPresenceGrantRequestListEventImp::DisappearedRequest( TInt aIndex ) const + { + return *(*iObsoleted)[ aIndex ]; + } + + +// --------------------------------------------------------------------------- +// From MPresenceGrantRequestListEvent class. +// CPresenceGrantRequestListEventImp::CurrentRequestsCount() +// --------------------------------------------------------------------------- +// +TInt CPresenceGrantRequestListEventImp::CurrentRequestsCount() const + { + return iPending->Count(); + } + +// --------------------------------------------------------------------------- +// From MPresenceGrantRequestListEvent class. +// CPresenceGrantRequestListEventImp::CurrentRequest() +// --------------------------------------------------------------------------- +// +const MPresenceGrantRequestInfo& + CPresenceGrantRequestListEventImp::CurrentRequest( TInt aIndex ) const + { + return *(*iPending)[ aIndex ]; + } + + + + + +// --------------------------------------------------------------------------- +// From class MPresenceGrantRequestListEvent. +// CPresenceGrantRequestListEventImp::DataSubscriptionState() +// --------------------------------------------------------------------------- +// +const MXIMPDataSubscriptionState& + CPresenceGrantRequestListEventImp::DataSubscriptionState() const + { + return *iSubscriptionState; + } + + +// --------------------------------------------------------------------------- +// CPresenceGrantRequestListEventImp::WriteArrayToStreamL() +// --------------------------------------------------------------------------- +// +void CPresenceGrantRequestListEventImp::WriteArrayToStreamL( + RPrGrntReqInfoImpArray& aArray, RWriteStream& aStream ) const + { + TInt count = aArray.Count(); + aStream.WriteInt32L( count ); + { + for( TInt a = 0; a < count; ++a ) + { + aArray[ a ]->ExternalizeL( aStream ); + } + } + } + + +// --------------------------------------------------------------------------- +// CPresenceGrantRequestListEventImp::FillArrayFromStreamL +// --------------------------------------------------------------------------- +// +void CPresenceGrantRequestListEventImp::FillArrayFromStreamL( + RPrGrntReqInfoImpArray& aArray, + RReadStream& aStream ) + { + TInt count = aStream.ReadInt32L(); + for( TInt a = 0; a < count; ++a ) + { + // the stream MUST be in order (since it was externalized by this class) + CPresenceGrantRequestInfoImp* newInfo = CPresenceGrantRequestInfoImp::NewLC(); + newInfo->InternalizeL( aStream ); + aArray.AppendL( newInfo ); + CleanupStack::Pop(); // newInfo + } + } + +// End of file + diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencedatamodel/presenceauthorization/presencegrantrequestlisteventimp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencedatamodel/presenceauthorization/presencegrantrequestlisteventimp.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,152 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MPresenceGrantRequestList API object implementation. + * +*/ + +#ifndef CPRESENCEGRANTREQUESTLISTEVENTIMP_H +#define CPRESENCEGRANTREQUESTLISTEVENTIMP_H + +#include +#include "ximpapieventbase.h" +#include "presencetypehelpers.h" + +class RReadStream; +class CPresenceGrantRequestInfoImp; +class CXIMPIdentityImp; +class CXIMPDataSubscriptionStateImp; + +/** + * MPresenceGrantRequestList API object implementation. + * + * @lib ximpdatamodel.dll + * @since S60 v3.2 + */ +NONSHARABLE_CLASS( CPresenceGrantRequestListEventImp ): public CXIMPApiEventBase, + public MPresenceGrantRequestListEvent + { +public: + /** The class ID. */ + enum { KClassId = PRIMP_CLSID_CPRESENCEGRANTREQUESTLISTEVENTIMP }; + +public: + /** + * Exported instantiation method for initializing + * new event object. + */ + IMPORT_C static CPresenceGrantRequestListEventImp* NewLC( + RPrGrntReqInfoImpArray* aNew, + RPrGrntReqInfoImpArray* aPending, + RPrGrntReqInfoImpArray* aObsoleted, + CXIMPDataSubscriptionStateImp* aState + ); + + /** + * Instantiation method for event automation. + * Method signature must be exactly this to work + * with event delivery automation system. + * + * Event implementation must be registered to + * XIMPEventCodec KXIMPEventConstructorTable. + */ + static CXIMPApiEventBase* NewFromStreamLC( RReadStream& aStream ); + + virtual ~CPresenceGrantRequestListEventImp(); + + +private: + CPresenceGrantRequestListEventImp(); + + void ConstructL( + RPrGrntReqInfoImpArray* aNew, + RPrGrntReqInfoImpArray* aPending, + RPrGrntReqInfoImpArray* aObsoleted, + CXIMPDataSubscriptionStateImp* aState + ); + + void ConstructL( RReadStream& aStream ); + + /** + * Helper for externalize. + */ + void WriteArrayToStreamL( RPrGrntReqInfoImpArray& aArray, + RWriteStream& aStream ) const; + + /** + * Helper for internalize + */ + void FillArrayFromStreamL( RPrGrntReqInfoImpArray& aArray, + RReadStream& aStream ); + +public: // From API base interfaces + + /** + * Implementation of MXIMPBase interface methods + * @see MXIMPBase + */ + XIMPIMP_DECLARE_IF_BASE_METHODS + + + /** + * Implementation of MXIMPEventBase interface and + * CXIMPApiEventBase methods + * + * @see MXIMPEventBase + * @see CXIMPApiEventBase + */ + XIMPIMP_DECLARE_EVENT_BASE_METHODS + + +public: // From MPresenceGrantRequestListEvent + + + TInt NewRequestsCount() const; + const MPresenceGrantRequestInfo& NewRequest( TInt aIndex ) const; + + TInt DisappearedRequestsCount() const; + const MPresenceGrantRequestInfo& DisappearedRequest( TInt aIndex ) const; + + TInt CurrentRequestsCount() const; + const MPresenceGrantRequestInfo& CurrentRequest( TInt aIndex ) const; + + const MXIMPDataSubscriptionState& DataSubscriptionState() const; + +private: // data + + /** + * ETrue if constructed from stream. + */ + TBool iConstructedFromStream; + + /** + * Group informations. + * Owns if constructed from stream. Otherwise does not own. + */ + RPrGrntReqInfoImpArray* iNewRequests; + RPrGrntReqInfoImpArray* iPending; + RPrGrntReqInfoImpArray* iObsoleted; + + /** + * Pending array own status + */ + TBool iOwnsPending; + + /** + * Subscription state + */ + CXIMPDataSubscriptionStateImp* iSubscriptionState; + }; + + +#endif // CPRESENCEGRANTREQUESTLISTEVENTIMP_H diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencedatamodel/presenceauthorization/presencetoeveryoneconfigurationitem.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencedatamodel/presenceauthorization/presencetoeveryoneconfigurationitem.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,158 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Presence to everyone configuration item +* +*/ + + +#include "presencetoeveryoneconfigurationitem.h" +#include "ximpitemparent.h" +#include "presenceinfofilterimp.h" +#include "ximppanics.h" +#include "ximppsccontext.h" +#include "documentutils.h" +#include "presentitypresenceeventimp.h" + +#include "ximptrace.h" + +// --------------------------------------------------------------------------- +// CPresenceToEveryoneConfigurationItem::CPresenceToEveryoneConfigurationItem() +// --------------------------------------------------------------------------- +// +CPresenceToEveryoneConfigurationItem::CPresenceToEveryoneConfigurationItem( MXIMPItemParentBase& aParent ) +: CXIMPConfigurationItemBase( aParent ) + { + } + + +// --------------------------------------------------------------------------- +// CPresenceToEveryoneConfigurationItem::ConstructL() +// --------------------------------------------------------------------------- +// +void CPresenceToEveryoneConfigurationItem::ConstructL() + { + CXIMPConfigurationItemBase::BaseConstructL(); + } + + +// --------------------------------------------------------------------------- +// CPresenceToEveryoneConfigurationItem::NewLC() +// --------------------------------------------------------------------------- +// +CPresenceToEveryoneConfigurationItem* + CPresenceToEveryoneConfigurationItem::NewLC( MXIMPItemParentBase& aParent ) + { + CPresenceToEveryoneConfigurationItem* self = + new( ELeave ) CPresenceToEveryoneConfigurationItem( aParent ); + CleanupClosePushL( *self ); + self->ConstructL(); + return self; + } + + +// --------------------------------------------------------------------------- +// CPresenceToEveryoneConfigurationItem::~CPresenceToEveryoneConfigurationItem() +// --------------------------------------------------------------------------- +// +CPresenceToEveryoneConfigurationItem::~CPresenceToEveryoneConfigurationItem() + { + MXIMPItemParent* presCache = static_cast(iParent.GetInterface(PRESENCE_ITEM_PARENT)); + presCache->RemoveMe( this ); + + delete iPif; + } + +// --------------------------------------------------------------------------- +// CPresenceToEveryoneConfigurationItem::ConfigurationPif() +// --------------------------------------------------------------------------- +// +EXPORT_C CPresenceInfoFilterImp& + CPresenceToEveryoneConfigurationItem::ConfigurationPif() + { + TRACE(_L("CPresenceToEveryoneConfigurationItem::ConfigurationPif" ) ); + __ASSERT_ALWAYS( iPif, User::Panic( NXIMPPrivPanic::KCategory, + NXIMPPrivPanic::EOwnPresencePifNotSet ) ); + return *iPif; + } + +// --------------------------------------------------------------------------- +// CPresenceToEveryoneConfigurationItem::SetSubscriptionPif() +// --------------------------------------------------------------------------- +// +EXPORT_C void CPresenceToEveryoneConfigurationItem::SetConfigurationPif( + CPresenceInfoFilterImp* aPif ) + { + TRACE(_L("CPresenceToEveryoneConfigurationItem::SetConfigurationPif" ) ); + if ( !aPif ) + { + TRACE(_L("CPresenceToEveryoneConfigurationItem::SetConfigurationPif aPif NULL" ) ); + } + delete iPif; + iPif = aPif; + } + +// --------------------------------------------------------------------------- +// CPresenceToEveryoneConfigurationItem::CollectSubscriptionPifWithoutCtxL() +// --------------------------------------------------------------------------- +// +EXPORT_C CPresenceInfoFilterImp* + CPresenceToEveryoneConfigurationItem::CollectConfigurationPifWithoutCtxL( + MXIMPPscContext* aContext ) + { + TRACE(_L("CPresenceToEveryoneConfigurationItem::CollectConfigurationPifWithoutCtxL" ) ); + RPointerArray< CPresenceInfoFilterImp > arrayOfPifs; + CleanupClosePushL( arrayOfPifs ); + + TInt count = iConfigContexts.Count(); + for( TInt a = 0; a < count; ++a ) + { + if( iConfigContexts[ a ] != aContext ) + { + CPresenceInfoFilterImp* filter = iConfigContexts[ a ]->PresenceInfoFilter( + MXIMPPscContext::EGrantPresenceToEveryoneFilter ); + if ( filter ) + { + arrayOfPifs.AppendL( filter ); + } + } + } + CPresenceInfoFilterImp* pifWithoutCtx = DocumentUtils::InfoFilterUnionL( arrayOfPifs ); + CleanupStack::PopAndDestroy(); // arrayOfPifs + return pifWithoutCtx; + } + +// --------------------------------------------------------------------------- +// From class MXIMPSubscriptionItem. +// CPresenceToEveryoneConfigurationItem::SynthesiseSubscriptionEventTo() +// --------------------------------------------------------------------------- +// +void CPresenceToEveryoneConfigurationItem::SynthesiseSubscriptionEventToL( + MXIMPPscContext* aContext, + TBool aForceEvent ) + { + TRACE_1( _L("CPresenceToEveryoneConfigurationItem::SynthesiseSubscriptionEventTo() aForce=%d"), aForceEvent ); + XIMP_UNUSED_FORMAL_PARAM( aContext ); + XIMP_UNUSED_FORMAL_PARAM( aForceEvent ); + } + +// --------------------------------------------------------------------------- +// CPresenceToEveryoneConfigurationItem::CleanExpired() +// --------------------------------------------------------------------------- +// +void CPresenceToEveryoneConfigurationItem::CleanExpired() + { + + } + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencedatamodel/presenceauthorization/presencetoeveryoneconfigurationitem.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencedatamodel/presenceauthorization/presencetoeveryoneconfigurationitem.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,113 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Presence to everyone configuration item +* +*/ + +#ifndef CPSCPRESENCETOEVERYONECONFIGURATIONITEM_H +#define CPSCPRESENCETOEVERYONECONFIGURATIONITEM_H + +#include +#include "ximpconfigurationitembase.h" + +class CPresenceInfoFilterImp; + +/** + * Presence to everyone configuration item + * + * @since S60 v3.2 + */ +class CPresenceToEveryoneConfigurationItem : public CXIMPConfigurationItemBase + { +public: // Construction and destruction + + /** + * Construction + * @param aParent. Parent has to be informed when this object is deleted by RemoveMe method. + */ + static CPresenceToEveryoneConfigurationItem* NewLC( MXIMPItemParentBase& aParent ); + + /** + * Destruction + * - Remember to inform parent about delete. + */ + ~CPresenceToEveryoneConfigurationItem(); + +private: // Construction and destruction + + /** + * Construction + * @param aParent. Parent has to be informed when this object is deleted by RemoveMe method. + */ + CPresenceToEveryoneConfigurationItem( MXIMPItemParentBase& aParent ); + + /** + * Construction + */ + void ConstructL(); + +public: // New methods + + /** + * Current presence information filter. + * @return Current presence information filter. + */ + IMPORT_C CPresenceInfoFilterImp& ConfigurationPif(); + + /** + * Set current presence information filter. Overwrites existing one. + * Ownership is transferred to callee. + * @param aPif Current presence information filter. + */ + IMPORT_C void SetConfigurationPif( CPresenceInfoFilterImp* aPif ); + + /** + * Collect aggregated presence information filter without given context. + * @param aContext. Exluded context from aggregated pif. + * @return Aggregated pif without exluded context. + */ + IMPORT_C CPresenceInfoFilterImp* CollectConfigurationPifWithoutCtxL( + MXIMPPscContext* aContext ); + + +public: // From MXIMPSubscriptionItem + + /** + * @see MXIMPSubscriptionItem + */ + void SynthesiseSubscriptionEventToL( MXIMPPscContext* aContext, TBool aForceEvent ); + +public: // From MXIMPConfigurationItem + +private: // From CXIMPSubscriptionItemBase + + /** + * @see CXIMPSubscriptionItemBase + */ + void CleanExpired(); + +private: // Data + + /** + * Current presence information filter. + */ + CPresenceInfoFilterImp* iPif; + }; + + +/* ======================================================================== */ + + + +#endif // CPSCPRESENCETOEVERYONECONFIGURATIONITEM_H diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencedatamodel/presencecache/presencebuddyinfoimp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencedatamodel/presencecache/presencebuddyinfoimp.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,270 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: CPresenceBuddyInfoImp object implementation. +* +*/ + + +#include +#include +#include +#include + +#include "ximpidentityimp.h" +#include "presencebuddyinfoimp.h" +#include "presenceinfoimp.h" +#include "personpresenceinfoimp.h" + + +// --------------------------------------------------------------------------- +// CPresenceBuddyInfoImp::NewLC() +// --------------------------------------------------------------------------- +// +EXPORT_C CPresenceBuddyInfoImp* CPresenceBuddyInfoImp::NewLC() + { + CPresenceBuddyInfoImp* self = new( ELeave ) CPresenceBuddyInfoImp; + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + +// --------------------------------------------------------------------------- +// CPresenceBuddyInfoImp::NewL() +// --------------------------------------------------------------------------- +// +EXPORT_C CPresenceBuddyInfoImp* CPresenceBuddyInfoImp::NewL() + { + CPresenceBuddyInfoImp* self = NewLC(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// CPresenceBuddyInfoImp::~CPresenceBuddyInfoImp() +// --------------------------------------------------------------------------- +// +CPresenceBuddyInfoImp::~CPresenceBuddyInfoImp() + { + if (iPresenceInfo) + delete iPresenceInfo; + if(iIdentity) + delete iIdentity; + } + +// --------------------------------------------------------------------------- +// CPresenceBuddyInfoImp::CPresenceBuddyInfoImp() +// --------------------------------------------------------------------------- +// +CPresenceBuddyInfoImp::CPresenceBuddyInfoImp() + { + } + +// --------------------------------------------------------------------------- +// CPresenceBuddyInfoImp::ConstructL() +// --------------------------------------------------------------------------- +// +void CPresenceBuddyInfoImp::ConstructL() + { + iPresenceInfo = CPresenceInfoImp::NewL(); + iIdentity = CXIMPIdentityImp::NewL(); + } + +// --------------------------------------------------------------------------- +// CPresenceBuddyInfoImp::Set() +// --------------------------------------------------------------------------- +// +TInt CPresenceBuddyInfoImp::Set( MXIMPIdentity* aIdentity, + MPresenceInfo* aPresenceInfo) + { + TInt err(KErrArgument); + + if(aIdentity && aPresenceInfo) // Check whether data is valid + { + delete iIdentity; + iIdentity = TXIMPGetImpClassOrPanic< CXIMPIdentityImp >::From( *aIdentity ); + + delete iPresenceInfo; + iPresenceInfo = NULL; + iPresenceInfo = + TXIMPGetImpClassOrPanic< CPresenceInfoImp >::From( *aPresenceInfo ); + + err = KErrNone; + } + + return err; + } + +// --------------------------------------------------------------------------- +// CPresenceBuddyInfoImp::SetPresenceInfo() +// --------------------------------------------------------------------------- +// +TInt CPresenceBuddyInfoImp::SetPresenceInfo(MPresenceInfo* aPresenceInfo) + { + TInt err(KErrArgument); + if(aPresenceInfo) + { + delete iPresenceInfo; + iPresenceInfo = NULL; + iPresenceInfo = + TXIMPGetImpClassOrPanic< CPresenceInfoImp >::From( *aPresenceInfo ); + err = KErrNone; + } + + return err; + } + +// --------------------------------------------------------------------------- +// CPresenceBuddyInfoImp::SetBuddyId() +// --------------------------------------------------------------------------- +// +TInt CPresenceBuddyInfoImp::SetBuddyId(MXIMPIdentity* aIdentity) + { + TInt err(KErrArgument); + + if(aIdentity) + { + delete iIdentity; + iIdentity = TXIMPGetImpClassOrPanic< CXIMPIdentityImp >::From( *aIdentity ); + err = KErrNone; + } + + return err; + } + +// --------------------------------------------------------------------------- +// CPresenceBuddyInfoImp::SetPersonPresenceL() +// --------------------------------------------------------------------------- +// +TInt CPresenceBuddyInfoImp::SetPersonPresenceL( + MPersonPresenceInfo* aPersonPresenceInfo) + { + TInt err(KErrArgument); + if(aPersonPresenceInfo) + { + iPresenceInfo->SetPersonPresenceL(aPersonPresenceInfo); + err = KErrNone; + } + + return err; + } + +// --------------------------------------------------------------------------- +// CPresenceBuddyInfoImp::PresenceInfo() +// --------------------------------------------------------------------------- +// +const MPresenceInfo* CPresenceBuddyInfoImp::PresenceInfo() const + { + return iPresenceInfo; + } + +// --------------------------------------------------------------------------- +// CPresenceBuddyInfoImp::BuddyUserId() +// --------------------------------------------------------------------------- +// +const MXIMPIdentity* CPresenceBuddyInfoImp::BuddyId() const + { + return iIdentity; + } + +// --------------------------------------------------------------------------- +// CPresenceBuddyInfoImp::EqualsIdentity() +// --------------------------------------------------------------------------- +// +EXPORT_C TBool CPresenceBuddyInfoImp::EqualsIdentity( + const MPresenceBuddyInfo* aOtherInstance ) const + { + TBool ret(EFalse); + if(aOtherInstance) + { + const CXIMPIdentityImp* tmp = + TXIMPGetImpClassOrPanic< const CXIMPIdentityImp >::From( *(aOtherInstance->BuddyId())); + ret = iIdentity->EqualsContent( *tmp); + } + return ret; + } + +// --------------------------------------------------------------------------- +// CPresenceBuddyInfoImp::NewFromStreamLC() +// --------------------------------------------------------------------------- +// +XIMPIMP_IMPLEMENT_DATAOBJ_NEWFROMSTREAM( CPresenceBuddyInfoImp ) + + +// --------------------------------------------------------------------------- +// Implement supported interface access. +// --------------------------------------------------------------------------- +// +XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CPresenceBuddyInfoImp, + MPresenceBuddyInfo ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + + +XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CPresenceBuddyInfoImp, + MPresenceBuddyInfo ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + +// --------------------------------------------------------------------------- +// CPresenceBuddyInfoImp::EqualsContent() +// --------------------------------------------------------------------------- +// +TBool CPresenceBuddyInfoImp::EqualsContent( + const CXIMPApiDataObjBase& aOtherInstance ) const + { + const CPresenceBuddyInfoImp* tmp = + TXIMPGetImpClassOrPanic< const CPresenceBuddyInfoImp >::From( aOtherInstance.Base() ); + + TBool same = ETrue; + TBool x = iPresenceInfo->EqualsContent( *tmp->iPresenceInfo ); + same &= x; + + x = iIdentity->EqualsContent( *tmp->iIdentity ); + same &= x; + + return same; + } + +// --------------------------------------------------------------------------- +// CPresenceBuddyInfoImp::ExternalizeL() +// --------------------------------------------------------------------------- +// +EXPORT_C void CPresenceBuddyInfoImp::ExternalizeL( RWriteStream& aStream ) const + { + iPresenceInfo->ExternalizeL( aStream ); + iIdentity->ExternalizeL( aStream ); + } + + +// --------------------------------------------------------------------------- +// CPresenceBuddyInfoImp::InternalizeL() +// --------------------------------------------------------------------------- +// +EXPORT_C void CPresenceBuddyInfoImp::InternalizeL( RReadStream& aStream ) + { + CPresenceInfoImp* tmp = CPresenceInfoImp::NewLC(); + tmp->InternalizeL( aStream ); + if (iPresenceInfo) + delete iPresenceInfo; + iPresenceInfo = NULL; + iPresenceInfo = tmp; + CleanupStack::Pop( tmp ); + + CXIMPIdentityImp* tmp1 = CXIMPIdentityImp::NewLC(); + tmp1->InternalizeL( aStream ); + if (iIdentity) + delete iIdentity; + iIdentity = tmp1; + CleanupStack::Pop( tmp1 ); + + + } diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencedatamodel/presencecache/presencebuddyinfoimp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencedatamodel/presencecache/presencebuddyinfoimp.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,122 @@ +/* +* Copyright (c) 2007, 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MPresenceBuddyInfo API object implementation. +* +*/ + +#ifndef CXIMPPRESENCEBUDDYINFOIMP_H +#define CXIMPPRESENCEBUDDYINFOIMP_H + +#include + +#include "presenceapiobjbase.h" +#include "presencetypehelpers.h" +#include "ximpapiobjbase.h" + +class CPresenceInfoImp; +class MPresenceInfo; +class CXIMPIdentityImp; + +/** + * MPresenceBuddyInfo API object implementation. + * + * @lib ximpdatamodel.dll + * @since S60 v3.2 + */ +NONSHARABLE_CLASS( CPresenceBuddyInfoImp ): public CXIMPApiDataObjBase, + public MPresenceBuddyInfo + { + public: + /** The class ID. */ + enum { KClassId = PRIMP_CLSID_CXIMPPRESENCEBUDDYINFOIMP }; + + +public: + + /** + * Symbian constructors and c++ destructor + */ + IMPORT_C static CPresenceBuddyInfoImp* NewLC(); + IMPORT_C static CPresenceBuddyInfoImp* NewL(); + virtual ~CPresenceBuddyInfoImp(); + +private: + + /** + * c++ constructor + */ + CPresenceBuddyInfoImp(); + + /** + * Symbian second phase constructor + */ + void ConstructL(); + +public: // From MXIMPBase + + /** + * Implementation of MXIMPBase interface methods + * @see MXIMPBase + */ + XIMPIMP_DECLARE_IF_BASE_METHODS + +public: // From CXIMPApiDataObjBase + + /** + * @see CXIMPApiDataObjBase + */ + XIMPIMP_DECLARE_DATAOBJ_BASE_METHODS + +public: // From MPresenceBuddyInfo + + TInt Set( MXIMPIdentity* aIdentity, + MPresenceInfo* aPresenceInfo); + TInt SetPresenceInfo(MPresenceInfo* aPresenceInfo); + + TInt SetBuddyId(MXIMPIdentity* aIdentity); + + TInt SetPersonPresenceL(MPersonPresenceInfo* aPersonPresenceInfo); + + const MPresenceInfo* PresenceInfo() const; + + const MXIMPIdentity* BuddyId() const; + + TBool EqualsIdentity( + const MPresenceBuddyInfo* aOtherInstance ) const; + +public: // New functions + + /** + * Internalizes object data from given stream. + * @param aStream Stream to read. + */ + IMPORT_C void InternalizeL( RReadStream& aStream ); + +private: // data + + + /** + * OWN: + */ + CPresenceInfoImp* iPresenceInfo; + + /** + * OWN: + */ + CXIMPIdentityImp* iIdentity; + + }; + + +#endif // CXIMPPRESENCEBUDDYINFOIMP_H diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencedatamodel/presencecache/presencebuddyinfolistimp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencedatamodel/presencecache/presencebuddyinfolistimp.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,317 @@ +/* +* Copyright (c) 2007, 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: CPresenceBuddyInfoListImp object implementation. +* +*/ + + +#include +#include +#include + +#include "presencebuddyinfolistimp.h" +#include "presencebuddyinfoimp.h" +#include "ximpidentityimp.h" +#include "ximptrace.h" +#include "ximprbufhelpers.h" + +_LIT(KColon, ":"); + +// --------------------------------------------------------------------------- +// CPresenceBuddyInfoListImp::NewLC() +// --------------------------------------------------------------------------- +// +EXPORT_C CPresenceBuddyInfoListImp* CPresenceBuddyInfoListImp::NewLC( + const TDesC& aServiceName) + { + CPresenceBuddyInfoListImp* self = new( ELeave ) CPresenceBuddyInfoListImp; + CleanupStack::PushL( self ); + self->ConstructL(aServiceName); + return self; + } + +// --------------------------------------------------------------------------- +// CPresenceBuddyInfoListImp::NewL() +// --------------------------------------------------------------------------- +// +EXPORT_C CPresenceBuddyInfoListImp* CPresenceBuddyInfoListImp::NewL( + const TDesC& aServiceName) + { + CPresenceBuddyInfoListImp* self = NewLC(aServiceName); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// CPresenceBuddyInfoListImp::~CPresenceBuddyInfoListImp() +// --------------------------------------------------------------------------- +// +CPresenceBuddyInfoListImp::~CPresenceBuddyInfoListImp() + { + if(iOwnDataObjects) + { + TInt count = iBuddyCollection.Count(); + for (TInt i=0;i& CPresenceBuddyInfoListImp::GetObjectCollection() + { + return iBuddyCollection; + } + +// --------------------------------------------------------------------------- +// CPresenceBuddyInfoListImp::ServiceName() +// --------------------------------------------------------------------------- +// +TPtrC CPresenceBuddyInfoListImp::ServiceName() const + { + return iService; + } + +// --------------------------------------------------------------------------- +// CPresenceBuddyInfoListImp::Count() +// --------------------------------------------------------------------------- +// +TInt CPresenceBuddyInfoListImp::Count() const + { + return iBuddyCollection.Count(); + } + +// --------------------------------------------------------------------------- +// CPresenceBuddyInfoListImp::AddOrReplace() +// --------------------------------------------------------------------------- +// +TInt CPresenceBuddyInfoListImp::AddOrReplace( + MPresenceBuddyInfo* aPresenceBuddyInfo) + { + TRACE( _L("CPresenceBuddyInfoListImp::AddOrReplace - begin") ); + TRACE_1( _L("______identity: %S"), &(aPresenceBuddyInfo->BuddyId()->Identity())); + if(!aPresenceBuddyInfo) + return KErrArgument; + + if ( (ServiceName() != KNullDesC) && + (ExtractService( aPresenceBuddyInfo->BuddyId()->Identity()).Compare( ServiceName()) )) + { + return KErrArgument; + } + TInt count = iBuddyCollection.Count(); + for(TInt i=0;iEqualsIdentity(aPresenceBuddyInfo))) + { + delete iBuddyCollection[i]; + iBuddyCollection.Remove(i); + TRACE( _L("_________Match found") ); + break; + } + } + iBuddyCollection.Append(aPresenceBuddyInfo); + TRACE( _L("CPresenceBuddyInfoListImp::AddOrReplace - return")); + return KErrNone; + } + +// --------------------------------------------------------------------------- +// CPresenceBuddyInfoListImp::FindAndRemove() +// --------------------------------------------------------------------------- +// +TInt CPresenceBuddyInfoListImp::FindAndRemove(const MXIMPIdentity& aIdentity) + { + TRACE( _L("CPresenceBuddyInfoListImp::FindAndRemove - begin") ); + TRACE_1( _L("______identity: %S"), &(aIdentity.Identity())); + TInt err(KErrNotFound); + TInt count = iBuddyCollection.Count(); + for(TInt i=0;iBuddyId()->Identity())== aIdentity.Identity() ) + { + delete iBuddyCollection[i]; + iBuddyCollection.Remove(i); + err = KErrNone; + break; + } + } + TRACE_1( _L("CPresenceBuddyInfoListImp::FindAndRemove - err=%d"),err ); + return err; + } + +// --------------------------------------------------------------------------- +// CPresenceBuddyInfoListImp::FindAndGet() +// --------------------------------------------------------------------------- +// +MPresenceBuddyInfo* CPresenceBuddyInfoListImp::FindAndGet( + const MXIMPIdentity& aIdentity) const + { + TRACE( _L("CPresenceBuddyInfoListImp::FindAndGet - begin") ); + TRACE_1( _L("______identity: %S"), &(aIdentity.Identity())); + MPresenceBuddyInfo* buddyPresInfo(NULL); + + TInt count = iBuddyCollection.Count(); + for(TInt i=0;iBuddyId()->Identity())== aIdentity.Identity() ) + { + buddyPresInfo = iBuddyCollection[i]; + break; + } + } + TRACE_1( _L("CPresenceBuddyInfoListImp::FindAndGet - buddyPresInfo=%d"),buddyPresInfo ); + return buddyPresInfo; + } + +// --------------------------------------------------------------------------- +// CPresenceBuddyInfoListImp::NewFromStreamLC() +// --------------------------------------------------------------------------- +// +XIMPIMP_IMPLEMENT_DATAOBJ_NEWFROMSTREAM( CPresenceBuddyInfoListImp ) + + +// --------------------------------------------------------------------------- +// Implement supported interface access. +// --------------------------------------------------------------------------- +// +XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CPresenceBuddyInfoListImp, + MPresenceBuddyInfoList ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + + +XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CPresenceBuddyInfoListImp, + MPresenceBuddyInfoList ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + +// --------------------------------------------------------------------------- +// CPresenceBuddyInfoListImp::ExternalizeL() +// --------------------------------------------------------------------------- +// +EXPORT_C void CPresenceBuddyInfoListImp::ExternalizeL( RWriteStream& aStream ) const + { + TUint32 count = iBuddyCollection.Count(); + CPresenceBuddyInfoImp* tmp(NULL); + + aStream.WriteInt32L(count); + for (TInt i=0;i::From( *(iBuddyCollection[i])); + tmp->ExternalizeL( aStream ); + } + + XIMPRBuf16Helper::ExternalizeL( iService, aStream ); + } + +// --------------------------------------------------------------------------- +// CPresenceBuddyInfoListImp::InternalizeL() +// --------------------------------------------------------------------------- +// +EXPORT_C void CPresenceBuddyInfoListImp::InternalizeL( RReadStream& aStream ) + { + TUint32 internalizeCount = aStream.ReadInt32L(); + CPresenceBuddyInfoImp* tmp(NULL); + for (TInt i=0;iInternalizeL( aStream ); + iBuddyCollection.Append(tmp); + CleanupStack::Pop( tmp ); + } + XIMPRBuf16Helper::InternalizeL( iService, aStream ); + } + +// --------------------------------------------------------------------------- +// CPresenceBuddyInfoListImp::EqualsContent() +// --------------------------------------------------------------------------- +// +TBool CPresenceBuddyInfoListImp::EqualsContent( + const CXIMPApiDataObjBase& /*aOtherInstance*/ ) const + { + //Not implemented + return EFalse; + } + +// --------------------------------------------------------------------------- +// CPresenceBuddyInfoListImp::BlindAddL() +// --------------------------------------------------------------------------- +// +EXPORT_C TInt CPresenceBuddyInfoListImp::BlindAddL( + MPresenceBuddyInfo* aPresenceBuddyInfo) + { + if(!aPresenceBuddyInfo) + return KErrArgument; + iBuddyCollection.Append(aPresenceBuddyInfo); + return KErrNone; + } + +// -------------------------------------------------------------------------- +// CPresenceBuddyInfoListImp::ExtractService +// -------------------------------------------------------------------------- +// +TPtrC CPresenceBuddyInfoListImp::ExtractService( const TDesC& aXspId ) + { + TInt pos = aXspId.Find(KColon); + if ( pos >= 0) + { + // ok input + return aXspId.Left(pos); + } + else + { + // return something in illegal input case + return aXspId; + } + } + +// eof diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencedatamodel/presencecache/presencebuddyinfolistimp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencedatamodel/presencecache/presencebuddyinfolistimp.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,142 @@ +/* +* Copyright (c) 2007, 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MPresenceBuddyInfoList implementation. +* +*/ + +#ifndef CXIMPPRESENCEBUDDYINFOLISTIMP_H +#define CXIMPPRESENCEBUDDYINFOLISTIMP_H + +#include +#include + +#include "presenceapiobjbase.h" +#include "presencetypehelpers.h" +#include "ximpapidataobjbase.h" + +class MXIMPIdentity; +class MPresenceBuddyInfo; + +/** + * MPresenceBuddyInfoList API object implementation. By default the this + * list owns the MPresenceBuddyInfo objects. + * If the pointer array doesn't needed to own the objects, simply call + * SetOwnObjects(EFalse) method before delete. + * + * @lib ximpdatamodel.dll + * @since S60 v3.2 + */ +NONSHARABLE_CLASS( CPresenceBuddyInfoListImp ): public CXIMPApiDataObjBase, + public MPresenceBuddyInfoList + { + public: + /** The class ID. */ + enum { KClassId = PRIMP_CLSID_CXIMPPRESENCEBUDDYINFOLIST }; + + +public: + + //if aServiceName is KNullDesC then multiple services buddies are allowed + IMPORT_C static CPresenceBuddyInfoListImp* NewLC(const TDesC& aServiceName); + IMPORT_C static CPresenceBuddyInfoListImp* NewL(const TDesC& aServiceName); + virtual ~CPresenceBuddyInfoListImp(); + +private: + + CPresenceBuddyInfoListImp(); + void ConstructL(const TDesC& aServiceName); + void ConstructL(); // to use with internalize + +public: // From MXIMPBase + + /** + * Implementation of MXIMPBase interface methods + * @see MXIMPBase + */ + XIMPIMP_DECLARE_IF_BASE_METHODS + +public: // From CXIMPApiDataObjBase + + /** + * @see CXIMPApiDataObjBase + */ + XIMPIMP_DECLARE_DATAOBJ_BASE_METHODS + +public: // From MPresenceBuddyInfoList + + RPointerArray& GetObjectCollection(); + + TPtrC ServiceName() const; + + TInt Count() const; + + TInt AddOrReplace(MPresenceBuddyInfo* aPresenceBuddyInfo); + + TInt FindAndRemove(const MXIMPIdentity& aIdentity); + + MPresenceBuddyInfo* FindAndGet(const MXIMPIdentity& aIdentity) const; + +public: // New functions + + /** + * Internalizes object data from given stream. Must call + * SetCountForInternalize before calling this function. + * @param aStream Stream to read. + */ + IMPORT_C void InternalizeL( RReadStream& aStream ); + + /** + * Add buddy presence info object in this collection. Without any + * check for duplicates. Takes ownership. + * @param aPresenceBuddyInfo object to add. + */ + IMPORT_C TInt BlindAddL(MPresenceBuddyInfo* aPresenceBuddyInfo); + + /** + * Set to own/disown objects. Call this function with EFalse to + * set this list not to own objects. + */ + IMPORT_C void SetOwnObjects(TBool aOwnObjects); + +private: + + /** + * Extract service name from XspId + * @param aXspId XspId URI + * @return service name + */ + TPtrC ExtractService( const TDesC& aXspId ); + +private: // data + + + /** + * OWN if iOwnDataObjects is true. + */ + RPointerArray< MPresenceBuddyInfo> iBuddyCollection; + + /** + * OWN: + */ + RBuf16 iService; + + /** + *OWN + */ + TBool iOwnDataObjects; + + }; + + +#endif // CXIMPPRESENCEBUDDYINFOLISTIMP_H diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencedatamodel/presencedatacacheimp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencedatamodel/presencedatacacheimp.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,908 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Presence Service Connection data cache implementation. + * +*/ + + +#include +#include + +#include "presencedatacacheimp.h" +#include "ximpidentityimp.h" +#include "presenceinfoimp.h" +#include "presencewatcherinfoimp.h" +#include "watcherlistsubscriptionitem.h" +#include "ximpobjecthelpers.h" +#include "ownpresenceeventimp.h" +#include "ownpresencesubscriptionitem.h" +#include "grouplistsubscriptionitem.h" +#include "groupcontentsubscriptionitem.h" +#include "presentitypresencesubscriptionitem.h" +#include "presentitygroupmemberspresencesubscriptionitem.h" +#include "presentitygroupinfoimp.h" +#include "presentitygroupmemberinfoimp.h" +#include "presencegrantrequestinfoimp.h" +#include "grantrequestlistsubscriptionitem.h" +#include "ximphost.h" +#include "ximppsccontext.h" +#include "ximpoperationdefs.h" +#include "presenceconfigurationitem.h" +#include "presencetoeveryoneconfigurationitem.h" +#include "groupmemberspresenceconfigurationitem.h" +#include "blocklistsubscriptionitem.h" +#include "presenceblockinfoimp.h" +#include "presencefilterstore.h" +//#include "presencecacheclient.h" + +#include "ximpapieventbase.h" +#include + +#include "ximptrace.h" + + +// --------------------------------------------------------------------------- +// CPresenceDataCache::CPresenceDataCache() +// --------------------------------------------------------------------------- +// +CPresenceDataCache::CPresenceDataCache( MXIMPHost& aHost ) +:iHost( aHost ) + { + } + + +// --------------------------------------------------------------------------- +// CPresenceDataCache::ConstructL() +// --------------------------------------------------------------------------- +// +void CPresenceDataCache::ConstructL() + { + iEmptySubscriptionState = CXIMPDataSubscriptionStateImp::NewL(); + iExtPresenceCache = MPresenceCacheWriter::NewL(); + } + + +// --------------------------------------------------------------------------- +// CPresenceDataCache::NewL() +// --------------------------------------------------------------------------- +// +EXPORT_C CPresenceDataCache* CPresenceDataCache::NewL( MXIMPHost& aHost ) + { + CPresenceDataCache* self = new( ELeave ) CPresenceDataCache( aHost ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + + +// --------------------------------------------------------------------------- +// CPresenceDataCache::~CPresenceDataCache() +// --------------------------------------------------------------------------- +// +CPresenceDataCache::~CPresenceDataCache() + { + + TInt count = iExpiringSubscriptionItems.Count(); + for( TInt a = 0; a < count; ++a ) + { + iExpiringSubscriptionItems[ a ]->ForceClose(); + } + + if( iOwnSubscriptionItem ) + { + iOwnSubscriptionItem->ForceClose(); + } + if( iGroupListSubscriptionItem ) + { + iGroupListSubscriptionItem->ForceClose(); + } + + count = iGroupContentSubscriptionItems.Count(); + for( TInt a = 0; a < count; ++a ) + { + iGroupContentSubscriptionItems[ a ]->ForceClose(); + } + + count = iPresentityPresenceSubscriptionItems.Count(); + for( TInt a = 0; a < count; ++a ) + { + iPresentityPresenceSubscriptionItems[ a ]->ForceClose(); + } + + if ( iWatcherListSubscriptionItem ) + { + iWatcherListSubscriptionItem->ForceClose(); + } + if ( iGrantRequestListSubscriptionItem ) + { + iGrantRequestListSubscriptionItem->ForceClose(); + } + if ( iBlockListSubscriptionItem ) + { + iBlockListSubscriptionItem->ForceClose(); + } + if( iPresenceToEveryoneConfigurationItem ) + { + iPresenceToEveryoneConfigurationItem->ForceClose(); + } + + count = iGroupMembersPresenceSubscriptionItems.Count(); + for( TInt a = 0; a < count; ++a ) + { + iGroupMembersPresenceSubscriptionItems[ a ]->ForceClose(); + } + count = iPresenceConfigurationItems.Count(); + for( TInt a = 0; a < count; ++a ) + { + iPresenceConfigurationItems[ a ]->ForceClose(); + } + count = iGroupMembersPresenceConfigurationItems.Count(); + for( TInt a = 0; a < count; ++a ) + { + iGroupMembersPresenceConfigurationItems[ a ]->ForceClose(); + } + + iGroupContentSubscriptionItems.Close(); + iPresentityPresenceSubscriptionItems.Close(); + iExpiringSubscriptionItems.Close(); + iGroupMembersPresenceSubscriptionItems.Close(); + iPresenceConfigurationItems.Close(); + iGroupMembersPresenceConfigurationItems.Close(); + + delete iEmptySubscriptionState; + delete iExtPresenceCache; + } + +// --------------------------------------------------------------------------- +// CPresenceDataCache::RemoveMe +// --------------------------------------------------------------------------- +// +template< class Type > +EXPORT_C void CPresenceDataCache::RemoveMe( Type*& aItem, Type* aChild ) + { + if( aChild == aItem ) + { + aItem = NULL; + } + } + + +// --------------------------------------------------------------------------- +// CPresenceDataCache::RemoveMeFromArray +// --------------------------------------------------------------------------- +// +template< class Type > +void CPresenceDataCache::RemoveMeFromArray( RPointerArray< Type >& aItemArray, Type* aChild ) + { + TInt itemCount( aItemArray.Count() ); + for ( TInt i( 0 ); i < itemCount; i++ ) + { + if ( aChild == aItemArray[ i ] ) + { + aItemArray.Remove( i ); + break; + } + } + } + + + +// --------------------------------------------------------------------------- +// CPresenceDataCache::RemoveMe +// --------------------------------------------------------------------------- +// +void CPresenceDataCache::RemoveMe( COwnPresenceSubscriptionItem* aChild ) + { + RemoveMe< COwnPresenceSubscriptionItem >( iOwnSubscriptionItem, aChild ); + } + +// --------------------------------------------------------------------------- +// CPresenceDataCache::RemoveMe +// --------------------------------------------------------------------------- +// +void CPresenceDataCache::RemoveMe( CGroupListSubscriptionItem* aChild ) + { + RemoveMe< CGroupListSubscriptionItem >( iGroupListSubscriptionItem, aChild ); + } + +// --------------------------------------------------------------------------- +// CPresenceDataCache::RemoveMe +// --------------------------------------------------------------------------- +// +void CPresenceDataCache::RemoveMe( CGroupContentSubscriptionItem* aChild ) + { + RemoveMeFromArray< CGroupContentSubscriptionItem >( + iGroupContentSubscriptionItems, aChild ); + } + +// --------------------------------------------------------------------------- +// CPresenceDataCache::RemoveMe +// --------------------------------------------------------------------------- +// +void CPresenceDataCache::RemoveMe( CPresentityPresenceSubscriptionItem* aChild ) + { + RemoveMeFromArray< CPresentityPresenceSubscriptionItem >( + iPresentityPresenceSubscriptionItems, aChild ); + } + + +// --------------------------------------------------------------------------- +// CPresenceDataCache::RemoveMe +// --------------------------------------------------------------------------- +// +void CPresenceDataCache::RemoveMe( CWatcherListSubscriptionItem* aChild ) + { + RemoveMe< CWatcherListSubscriptionItem >( iWatcherListSubscriptionItem, aChild ); + } + +// --------------------------------------------------------------------------- +// CPresenceDataCache::RemoveMe +// --------------------------------------------------------------------------- +// +void CPresenceDataCache::RemoveMe( CPresenceConfigurationItem* aChild ) + { + RemoveMeFromArray< CPresenceConfigurationItem >( + iPresenceConfigurationItems, aChild ); + } + +// --------------------------------------------------------------------------- +// CPresenceDataCache::RemoveMe +// --------------------------------------------------------------------------- +// +void CPresenceDataCache::RemoveMe( CPresenceToEveryoneConfigurationItem* aChild ) + { + RemoveMe< CPresenceToEveryoneConfigurationItem >( iPresenceToEveryoneConfigurationItem, aChild ); + } + + +// --------------------------------------------------------------------------- +// CPresenceDataCache::RemoveMe +// --------------------------------------------------------------------------- +// +void CPresenceDataCache::RemoveMe( CGroupMembersPresenceConfigurationItem* aChild ) + { + RemoveMeFromArray< CGroupMembersPresenceConfigurationItem >( + iGroupMembersPresenceConfigurationItems, aChild ); + } + + +// --------------------------------------------------------------------------- +// CPresenceDataCache::RemoveMe +// --------------------------------------------------------------------------- +// +void CPresenceDataCache::RemoveMe( CPresentityGroupMembersPresenceSubscriptionItem* aChild ) + { + RemoveMeFromArray< CPresentityGroupMembersPresenceSubscriptionItem >( + iGroupMembersPresenceSubscriptionItems, aChild ); + } + +// --------------------------------------------------------------------------- +// CPresenceDataCache::RemoveMe +// --------------------------------------------------------------------------- +// +void CPresenceDataCache::RemoveMe( CGrantRequestListSubscriptionItem* aChild ) + { + RemoveMe< CGrantRequestListSubscriptionItem >( iGrantRequestListSubscriptionItem, aChild ); + } + +// --------------------------------------------------------------------------- +// CPresenceDataCache::RemoveMe +// --------------------------------------------------------------------------- +// +void CPresenceDataCache::RemoveMe( CBlockListSubscriptionItem* aChild ) + { + RemoveMe< CBlockListSubscriptionItem >( iBlockListSubscriptionItem, aChild ); + } + + +// --------------------------------------------------------------------------- +// CPresenceDataCache::AddEventL +// --------------------------------------------------------------------------- +// +void CPresenceDataCache::AddEventL( CXIMPApiEventBase& aEvent, MXIMPPscContext* aContext ) + { + iHost.AddEventL( aEvent, aContext ); + } + +// --------------------------------------------------------------------------- +// CPresenceDataCache::RegisterExpiringItemL +// --------------------------------------------------------------------------- +// +void CPresenceDataCache::RegisterExpiringItemL( CXIMPSubscriptionItemBase* aExpireItem ) + { + TInt index = iExpiringSubscriptionItems.Find( aExpireItem ); + if( index == KErrNotFound ) + { + iExpiringSubscriptionItems.AppendL( aExpireItem ); + User::LeaveIfError( aExpireItem->Open() ); + } + } + +// --------------------------------------------------------------------------- +// CPresenceDataCache::UnregisterExpiringItemL +// --------------------------------------------------------------------------- +// +void CPresenceDataCache::UnregisterExpiringItem( CXIMPSubscriptionItemBase* aExpireItem ) + { + TInt index = iExpiringSubscriptionItems.Find( aExpireItem ); + if( index != KErrNotFound ) + { + iExpiringSubscriptionItems[ index ]->Close(); + iExpiringSubscriptionItems.Remove( index ); + } + } + +// --------------------------------------------------------------------------- +// CPresenceDataCache::AddPresentityPresenceSubscriberL +// --------------------------------------------------------------------------- +// +void CPresenceDataCache::AddPresentityPresenceSubscriberL( const CXIMPIdentityImp& aIdentity, + CXIMPSubscriptionItemBase* aItem, + CXIMPIdentityImp* aGroup ) + { + TRACE(_L("CPresenceDataCache::AddPresentityPresenceSubscriberL() - begin" ) ); + + CPresentityPresenceSubscriptionItem& presentityItem = + PresentityPresenceSubscriptionItemLC( aIdentity ); + + presentityItem.SetGroupIdentity( aGroup ); + + TInt error( KErrNone ); + TRAP( error, presentityItem.AddSubscriberL( aItem ); ); + TRACE_1( _L("CPresenceDataCache::AddPresentityPresenceSubscriberL() - presentityItem.AddSubscriberL( aItem ) = %d"), error ); + + CleanupStack::PopAndDestroy(); // presentityItem + + TRACE(_L("CPresenceDataCache::AddPresentityPresenceSubscriberL() - end" ) ); + } + +// --------------------------------------------------------------------------- +// CPresenceDataCache::RemovePresentityPresenceSubscriberL +// --------------------------------------------------------------------------- +// +void CPresenceDataCache::RemovePresentityPresenceSubscriber( const CXIMPIdentityImp& aIdentity, + CXIMPSubscriptionItemBase* aItem ) + { + // PresentityPresenceSubscriptionItemLC does not leave if item already exists. It just + // finds it. If item exists it does not matter if alloc fails or not because there will not + // be any subscribers in that case. This one is safe to ignore. + TRAP_IGNORE( + CPresentityPresenceSubscriptionItem& presentityItem = + PresentityPresenceSubscriptionItemLC( aIdentity ); + presentityItem.RemoveSubscriber( aItem ); + CleanupStack::PopAndDestroy(); // presentityItem + ) + } + +// --------------------------------------------------------------------------- +// CPresenceDataCache::AddPresentityPresenceConfiguratorL +// --------------------------------------------------------------------------- +// +void CPresenceDataCache::AddPresenceConfiguratorL( const CXIMPIdentityImp& aIdentity, + CXIMPConfigurationItemBase* aItem ) + { + CPresenceConfigurationItem& configItem = PresenceConfigurationItemLC( aIdentity ); + configItem.AddConfiguratorL( aItem ); + CleanupStack::PopAndDestroy(); // configItem + } + +// --------------------------------------------------------------------------- +// CPresenceDataCache::RemovePresentityPresenceConfigurator +// --------------------------------------------------------------------------- +// +void CPresenceDataCache::RemovePresenceConfigurator( const CXIMPIdentityImp& aIdentity, + CXIMPConfigurationItemBase* aItem ) + { + // PresentityPresenceSubscriptionItemLC does not leave if item already exists. It just + // finds it. If item exists it does not matter if alloc fails or not because there will not + // be any subscribers in that case. This one is safe to ignore. + TRAP_IGNORE( + CPresenceConfigurationItem& configItem = PresenceConfigurationItemLC( aIdentity ); + configItem.RemoveSubscriber( aItem ); + CleanupStack::PopAndDestroy(); // configItem + ) + } + + +// --------------------------------------------------------------------------- +// CPresenceDataCache::ActivatePresentityPresenceSubscriberL +// --------------------------------------------------------------------------- +// +void CPresenceDataCache::ActivatePresentityPresenceSubscriberL( const CXIMPIdentityImp& aIdentity, + CXIMPSubscriptionItemBase* aItem ) + { + CPresentityPresenceSubscriptionItem& presentityItem = + PresentityPresenceSubscriptionItemLC( aIdentity ); + presentityItem.ActivateSubscriberL( aItem ); + CleanupStack::PopAndDestroy(); // presentityItem + } + +// --------------------------------------------------------------------------- +// CPresenceDataCache::SynthesisePresentityPresenceSubscriptionEventToL +// --------------------------------------------------------------------------- +// +void CPresenceDataCache::SynthesisePresentityPresenceSubscriptionEventToL( + const CXIMPIdentityImp& aIdentity, + MXIMPPscContext* aContext, + TBool aForceEvent ) + { + CPresentityPresenceSubscriptionItem& presentityItem = + PresentityPresenceSubscriptionItemLC( aIdentity ); + presentityItem.SynthesiseSubscriptionEventToL( aContext, aForceEvent ); + CleanupStack::PopAndDestroy(); // presentityItem + } + +// --------------------------------------------------------------------------- +// CPresenceDataCache::ItemLC +// --------------------------------------------------------------------------- +// +template< class Type > +Type& CPresenceDataCache::ItemLC( Type*& aItem ) + { + if( !aItem ) + { + aItem = Type::NewLC( *this ); + } + else + { + User::LeaveIfError( aItem->Open() ); + CleanupClosePushL( *aItem ); + } + return *aItem; + } + +// --------------------------------------------------------------------------- +// CPresenceDataCache::ArrayItemLC +// --------------------------------------------------------------------------- +// +template< class Type > +Type& CPresenceDataCache::ArrayItemLC( RPointerArray< Type >& aItemArray, const CXIMPIdentityImp& aIdentity ) + { + // Search for the subscription + TInt pos = aItemArray.FindInOrder( aIdentity, Type::IdentityOrder ); + if( pos == KErrNotFound ) + { + // Create a new subscription item. + // Shared ownership of item. Item will inform this instance when it is deleted. + Type* newItem = Type::NewLC( *this, aIdentity ); + + TLinearOrder< Type > linearOrder( Type::Order ); + aItemArray.InsertInOrder( newItem, linearOrder ); + return *newItem; + } + else // Found + { + // Get the existing found item + Type* item = aItemArray[ pos ]; + // Increase reference count for the existing + User::LeaveIfError( item->Open() ); + CleanupClosePushL( *item ); + return *item; + } + } + +// --------------------------------------------------------------------------- +// CPresenceDataCache::ArrayItemLC +// --------------------------------------------------------------------------- +// +template< class Type, class ContentType > +Type& CPresenceDataCache::ArrayItemLC( RPointerArray< Type >& aItemArray, + RPointerArray< ContentType>& aContentArray, + const CXIMPIdentityImp& aIdentity ) + { + // Search for the subscription + TInt pos = aItemArray.FindInOrder( aIdentity, Type::IdentityOrder ); + if( pos == KErrNotFound ) + { + ContentType& contentItem = ArrayItemLC< ContentType >( aContentArray, aIdentity ); + + // Create a new subscription item. + // Shared ownership of item. Item will inform this instance when it is deleted. + Type* newItem = Type::NewLC( *this, contentItem ); + CleanupStack::Pop(); // newItem + CleanupStack::PopAndDestroy(); // contentItem NewItem has taken reference to ownership of contentItem + CleanupClosePushL( *newItem ); // back to stack + CXIMPIdentityImp* identity = TXIMPObjectCloner< CXIMPIdentityImp >::CloneL( aIdentity ); + // Set the identity + newItem->SetIdentity( identity ); // Ownership is transferred to callee. + + TLinearOrder< Type > linearOrder( Type::Order ); + aItemArray.InsertInOrderL( newItem, linearOrder ); + return *newItem; + } + else // Found + { + // Get the existing found item + Type* item = aItemArray[ pos ]; + // Increase reference count for the existing + User::LeaveIfError( item->Open() ); + CleanupClosePushL( *item ); + return *item; + } + } + + +// --------------------------------------------------------------------------- +// CPresenceDataCache::OwnPresenceSubscriptionItemLC +// --------------------------------------------------------------------------- +// +EXPORT_C COwnPresenceSubscriptionItem& CPresenceDataCache::OwnPresenceSubscriptionItemLC() + { + return ItemLC< COwnPresenceSubscriptionItem >( iOwnSubscriptionItem ); + } + +// --------------------------------------------------------------------------- +// CPresenceDataCache::GroupListSubscriptionItemLC +// --------------------------------------------------------------------------- +// +EXPORT_C CGroupListSubscriptionItem& CPresenceDataCache::GroupListSubscriptionItemLC() + { + return ItemLC< CGroupListSubscriptionItem >( iGroupListSubscriptionItem ); + } + +// --------------------------------------------------------------------------- +// CPresenceDataCache::WatcherListSubscriptionItemLC() +// --------------------------------------------------------------------------- +// +EXPORT_C CWatcherListSubscriptionItem& CPresenceDataCache::WatcherListSubscriptionItemLC() + { + return ItemLC< CWatcherListSubscriptionItem >( iWatcherListSubscriptionItem ); + } + + +// --------------------------------------------------------------------------- +// CPresenceDataCache::GrantRequestListSubscriptionItemLC() +// --------------------------------------------------------------------------- +// +EXPORT_C CGrantRequestListSubscriptionItem& + CPresenceDataCache::GrantRequestListSubscriptionItemLC() + { + return ItemLC< CGrantRequestListSubscriptionItem >( iGrantRequestListSubscriptionItem ); + } + +// --------------------------------------------------------------------------- +// CPresenceDataCache::BlockListSubscriptionItemLC() +// --------------------------------------------------------------------------- +// +EXPORT_C CBlockListSubscriptionItem& + CPresenceDataCache::BlockListSubscriptionItemLC() + { + return ItemLC< CBlockListSubscriptionItem >( iBlockListSubscriptionItem ); + } + +// --------------------------------------------------------------------------- +// CPresenceDataCache::GroupContentSubscriptionItemLC +// --------------------------------------------------------------------------- +// +EXPORT_C CGroupContentSubscriptionItem& CPresenceDataCache::GroupContentSubscriptionItemLC( + const CXIMPIdentityImp& aGroupId ) + { + return ArrayItemLC< CGroupContentSubscriptionItem >( iGroupContentSubscriptionItems, aGroupId ); + } + +// --------------------------------------------------------------------------- +// CPresenceDataCache::GroupContentSubscriptionItemExistsL +// --------------------------------------------------------------------------- +// +EXPORT_C TBool CPresenceDataCache::GroupContentSubscriptionItemExists( + const CXIMPIdentityImp& aGroupId ) + { + // Search for the subscription + return iGroupContentSubscriptionItems.FindInOrder( + aGroupId, CGroupContentSubscriptionItem::IdentityOrder ) != KErrNotFound; + } + +// --------------------------------------------------------------------------- +// CPresenceDataCache::PresentityPresenceSubscriptionItemLC +// --------------------------------------------------------------------------- +// +EXPORT_C CPresentityPresenceSubscriptionItem& + CPresenceDataCache::PresentityPresenceSubscriptionItemLC( + const CXIMPIdentityImp& aIdentity ) + { + return ArrayItemLC( iPresentityPresenceSubscriptionItems, + aIdentity ); + } + +// --------------------------------------------------------------------------- +// CPresenceDataCache::PresentityGroupMembersPresenceSubscriptionItemLC +// --------------------------------------------------------------------------- +// +EXPORT_C CPresentityGroupMembersPresenceSubscriptionItem& + CPresenceDataCache::PresentityGroupMembersPresenceSubscriptionItemLC( + const CXIMPIdentityImp& aIdentity ) + { + return ArrayItemLC< CPresentityGroupMembersPresenceSubscriptionItem, + CGroupContentSubscriptionItem >( iGroupMembersPresenceSubscriptionItems, + iGroupContentSubscriptionItems, + aIdentity ); + } + +// --------------------------------------------------------------------------- +// CPresenceDataCache::PresenceConfigurationItemLC +// --------------------------------------------------------------------------- +// +EXPORT_C CPresenceConfigurationItem& CPresenceDataCache::PresenceConfigurationItemLC( + const CXIMPIdentityImp& aIdentity ) + { + return ArrayItemLC< CPresenceConfigurationItem >( iPresenceConfigurationItems, aIdentity ); + } + +// --------------------------------------------------------------------------- +// CPresenceDataCache::PresenceToEveryoneConfigurationItemLC +// --------------------------------------------------------------------------- +// +EXPORT_C CPresenceToEveryoneConfigurationItem& + CPresenceDataCache::PresenceToEveryoneConfigurationItemLC() + { + return ItemLC< CPresenceToEveryoneConfigurationItem >( iPresenceToEveryoneConfigurationItem ); + } + +// --------------------------------------------------------------------------- +// CPresenceDataCache::PresenceConfigurationItemLC +// --------------------------------------------------------------------------- +// +EXPORT_C CGroupMembersPresenceConfigurationItem& + CPresenceDataCache::GroupMembersPresenceConfigurationItemLC( const CXIMPIdentityImp& aGroupId ) + { + return ArrayItemLC< CGroupMembersPresenceConfigurationItem, + CGroupContentSubscriptionItem >( iGroupMembersPresenceConfigurationItems, + iGroupContentSubscriptionItems, + aGroupId ); + } + +// --------------------------------------------------------------------------- +// CPresenceDataCache::CleanResources +// --------------------------------------------------------------------------- +// +EXPORT_C void CPresenceDataCache::CleanResources( MXIMPPscContext& aContext ) + { + TRACE(_L("CPresenceDataCache::CleanResources()" ) ); + if( iOwnSubscriptionItem ) + { + iOwnSubscriptionItem->RemoveSubscriber( &aContext ); + } + if( iGroupListSubscriptionItem ) + { + iGroupListSubscriptionItem->RemoveSubscriber( &aContext ); + } + + // Groupmember items have to be cleaned before contentitems. + TInt count = iGroupMembersPresenceSubscriptionItems.Count(); + for( TInt a = 0; a < count; ++a ) + { + iGroupMembersPresenceSubscriptionItems[ 0 ]->RemoveSubscriber( &aContext ); + } + count = iGroupMembersPresenceConfigurationItems.Count(); + for( TInt a = 0; a < count; ++a ) + { + iGroupMembersPresenceConfigurationItems[ 0 ]->RemoveConfigurator( &aContext ); + } + + count = iPresentityPresenceSubscriptionItems.Count(); + for( TInt a = 0; a < count; ++a ) + { + iPresentityPresenceSubscriptionItems[ 0 ]->RemoveSubscriber( &aContext ); + } + + count = iGroupContentSubscriptionItems.Count(); + for( TInt a = 0; a < count; ++a ) + { + iGroupContentSubscriptionItems[ 0 ]->RemoveSubscriber( &aContext ); + } + + if( iWatcherListSubscriptionItem ) + { + iWatcherListSubscriptionItem->RemoveSubscriber( &aContext ); + } + + if( iGrantRequestListSubscriptionItem ) + { + iGrantRequestListSubscriptionItem->RemoveSubscriber( &aContext ); + } + + count = iGroupMembersPresenceSubscriptionItems.Count(); + for( TInt a = 0; a < count; ++a ) + { + iGroupMembersPresenceSubscriptionItems[ 0 ]->RemoveSubscriber( &aContext ); + } + + if( iBlockListSubscriptionItem ) + { + iBlockListSubscriptionItem->RemoveSubscriber( &aContext ); + } + + count = iExpiringSubscriptionItems.Count(); + for( TInt a = 0; a < count; ++a ) + { + iExpiringSubscriptionItems[ 0 ]->RemoveSubscriber( &aContext ); + } + + count = iPresenceConfigurationItems.Count(); + for( TInt a = 0; a < count; ++a ) + { + iPresenceConfigurationItems[ 0 ]->RemoveConfigurator( &aContext ); + } + + if( iPresenceToEveryoneConfigurationItem ) + { + iPresenceToEveryoneConfigurationItem->RemoveConfigurator( &aContext ); + } + TRACE(_L("CPresenceDataCache::CleanResources done()" ) ); + } + +// --------------------------------------------------------------------------- +// CPresenceDataCache::CleanExpired +// --------------------------------------------------------------------------- +// +EXPORT_C void CPresenceDataCache::CleanExpired() + { + TRACE(_L("CPresenceDataCache::CleanExpired()" ) ); + // Clean those which were expired. + TInt count = iExpiringSubscriptionItems.Count(); + for( TInt a = count - 1; a >= 0; --a ) + { + if( iExpiringSubscriptionItems[ a ]->CleanIfExpired() ) + { + iExpiringSubscriptionItems[ a ]->Close(); + iExpiringSubscriptionItems.Remove( a ); + } + } + } + +// --------------------------------------------------------------------------- +// CPresenceDataCache::PackGroupIdLC +// --------------------------------------------------------------------------- +// +HBufC8* CPresenceDataCache::PackGroupIdLC( const MXIMPIdentity& aGroupId ) + { + const CXIMPIdentityImp* groupId = + TXIMPGetImpClassOrPanic< const CXIMPIdentityImp >::From( aGroupId ); + + HBufC8* packedGroupId = TXIMPObjectPacker< const CXIMPIdentityImp >::PackL( *groupId ); + CleanupStack::PushL( packedGroupId ); + return packedGroupId; + } + +// --------------------------------------------------------------------------- +// CPresenceDataCache::DataSubscriptionState +// --------------------------------------------------------------------------- +// +template< class Type > +const MXIMPDataSubscriptionState& CPresenceDataCache::DataSubscriptionState( Type* aItem ) const + { + if( aItem ) + { + return aItem->DataSubscriptionState(); + } + return *iEmptySubscriptionState; + } + +// --------------------------------------------------------------------------- +// CPresenceDataCache::DataSubscriptionState +// --------------------------------------------------------------------------- +// +template< class Type > +const MXIMPDataSubscriptionState& CPresenceDataCache::DataSubscriptionState( + const RPointerArray< Type >& aItemArray, const MXIMPIdentity& aIdentity ) const + { + const CXIMPIdentityImp* identity = + TXIMPGetImpClassOrPanic< const CXIMPIdentityImp >::From( aIdentity ); + TInt index = aItemArray.FindInOrder( *identity, Type::IdentityOrder ); + if( index >=0 ) + { + return aItemArray[ index ]->DataSubscriptionState(); + } + return *iEmptySubscriptionState; + } + + +// --------------------------------------------------------------------------- +// CPresenceDataCache::OwnPresenceDataSubscriptionState +// --------------------------------------------------------------------------- +// +EXPORT_C const MXIMPDataSubscriptionState& CPresenceDataCache::OwnPresenceDataSubscriptionState() const + { + return DataSubscriptionState< COwnPresenceSubscriptionItem >( iOwnSubscriptionItem ); + } + +// --------------------------------------------------------------------------- +// CPresenceDataCache::PresentityGroupDataSubscriptionState +// --------------------------------------------------------------------------- +// +EXPORT_C const MXIMPDataSubscriptionState& CPresenceDataCache::PresentityGroupListDataSubscriptionState() const + { + return DataSubscriptionState< CGroupListSubscriptionItem >( iGroupListSubscriptionItem ); + } + +// --------------------------------------------------------------------------- +// CPresenceDataCache::PresentityGroupMemberDataSubscriptionState +// --------------------------------------------------------------------------- +// +EXPORT_C const MXIMPDataSubscriptionState& CPresenceDataCache::PresentityGroupContentDataSubscriptionState( + const MXIMPIdentity& aGroupId ) const + { + return DataSubscriptionState< CGroupContentSubscriptionItem >( iGroupContentSubscriptionItems, + aGroupId ); + } + +// --------------------------------------------------------------------------- +// CPresenceDataCache::PresentityPresenceDataSubscriptionState +// --------------------------------------------------------------------------- +// +EXPORT_C const MXIMPDataSubscriptionState& CPresenceDataCache::PresentityPresenceDataSubscriptionState( + const MXIMPIdentity& aPresentityId ) const + { + return DataSubscriptionState< CPresentityPresenceSubscriptionItem >( iPresentityPresenceSubscriptionItems, + aPresentityId ); + } + +// --------------------------------------------------------------------------- +// CPresenceDataCache::PresenceWatcherListDataSubscriptionState +// --------------------------------------------------------------------------- +// +EXPORT_C const MXIMPDataSubscriptionState& CPresenceDataCache::PresenceWatcherListDataSubscriptionState() const + { + return DataSubscriptionState< CWatcherListSubscriptionItem >( iWatcherListSubscriptionItem ); + } + +// --------------------------------------------------------------------------- +// CPresenceDataCache::PresenceBlockDataSubscriptionState +// --------------------------------------------------------------------------- +// +EXPORT_C const MXIMPDataSubscriptionState& CPresenceDataCache::PresenceBlockDataSubscriptionState() const + { + return DataSubscriptionState< CBlockListSubscriptionItem >( iBlockListSubscriptionItem ); + } + +// --------------------------------------------------------------------------- +// CPresenceDataCache::PresenceGrantRequestDataSubscriptionState +// --------------------------------------------------------------------------- +// +EXPORT_C const MXIMPDataSubscriptionState& CPresenceDataCache::PresenceGrantRequestDataSubscriptionState() const + { + return DataSubscriptionState< CGrantRequestListSubscriptionItem >( iGrantRequestListSubscriptionItem ); + } + +// --------------------------------------------------------------------------- +// CPresenceDataCache::ProtocolID +// --------------------------------------------------------------------------- +// +TInt32 CPresenceDataCache::ProtocolUID() + { + return iHost.ProtocolUID(); + } + +// --------------------------------------------------------------------------- +// CPresenceDataCache::ProtocolID +// --------------------------------------------------------------------------- +// +MPresenceCacheWriter* CPresenceDataCache::ExternalCache() + { + return iExtPresenceCache; + } + +TAny* CPresenceDataCache::GetInterface(TInt aInterfaceId) + { + if(aInterfaceId != PRESENCE_ITEM_PARENT) + { + User::Panic( _L("CXIMPPresenceCache"), KErrExtensionNotSupported ); + } + + return static_cast(this) ; + + } + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencedatamodel/presencedatacacheimp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencedatamodel/presencedatacacheimp.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,279 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Presence Service Connection data cache implementation. +* +*/ + +#ifndef CPRESENCEDATACACHEIMP_H +#define CPRESENCEDATACACHEIMP_H + +#include "ximpapiobjbase.h" +#include "presenceapiobjbase.h" +#include "ximpitemparent.h" +#include "presencetypehelpers.h" +#include "ximpoperationdefs.h" +#include "ximpapieventbase.h" + +class MXIMPHost; +class COwnPresenceSubscriptionItem; +class CPresentityPresenceSubscriptionItem; +class CGroupContentSubscriptionItem; +class CWatcherListSubscriptionItem; +class MPresentityGroupInfo; +class CXIMPIdentityImp; +class MXIMPPscContext; +class CXIMPSubscriptionItemBase; +class MPresenceWatcherInfo; +class MXIMPStatus; +class MPresenceBlockInfo; +class CBlockListSubscriptionItem; +class MXIMPIdentity; +class MPresenceInfo; +class MXIMPDataSubscriptionState; +class CXIMPDataSubscriptionStateImp; +class MPresenceCacheWriter; + +//class CXIMPApiEventBase; +/** + * PSC Presence Data Cache implementation. + * + * @since S60 v3.2 + */ +class CPresenceDataCache : public CBase, + public MXIMPItemParent + { +public: // Definitions + + /** The class ID. */ + enum { KClassId = PRIMP_CLSID_CPRESENCEDATACACHE }; + +public: // Construction and destruction + + /** + * Construction + */ + IMPORT_C static CPresenceDataCache* NewL( MXIMPHost& aHost ); + + /** + * Destruction + */ + virtual ~CPresenceDataCache(); + +private: + + CPresenceDataCache( MXIMPHost& aHost ); + void ConstructL(); + +private: //MXIMPItemParentBase + TAny* GetInterface(TInt aInterfaceId) ; + // Expiring items + void RegisterExpiringItemL( CXIMPSubscriptionItemBase* aExpireItem ); + void UnregisterExpiringItem( CXIMPSubscriptionItemBase* aExpireItem ); + + +private: // From MXIMPItemParent + + /** + * @see MXIMPItemParent + */ + // Subscription items + + void RemoveMe( COwnPresenceSubscriptionItem* aChild ); + void RemoveMe( CGroupListSubscriptionItem* aChild ); + void RemoveMe( CGroupContentSubscriptionItem* aChild ); + void RemoveMe( CPresentityPresenceSubscriptionItem* aChild ); + void RemoveMe( CWatcherListSubscriptionItem* aChild ); + void RemoveMe( CPresentityGroupMembersPresenceSubscriptionItem* aChild ); + void RemoveMe( CGrantRequestListSubscriptionItem* aChild ); + void RemoveMe( CBlockListSubscriptionItem* aChild ); + + void AddPresentityPresenceSubscriberL( const CXIMPIdentityImp& aIdentity, CXIMPSubscriptionItemBase* aItem, CXIMPIdentityImp* aGroup = NULL ); + void RemovePresentityPresenceSubscriber( const CXIMPIdentityImp& aIdentity, CXIMPSubscriptionItemBase* aItem ); + void ActivatePresentityPresenceSubscriberL( const CXIMPIdentityImp& aIdentity, CXIMPSubscriptionItemBase* aItem ); + void SynthesisePresentityPresenceSubscriptionEventToL( const CXIMPIdentityImp& aIdentity, MXIMPPscContext* aContext, TBool aForceEvent ); + + // Configuration items + void RemoveMe( CPresenceConfigurationItem* aChild ); + void RemoveMe( CPresenceToEveryoneConfigurationItem* aChild ); + void RemoveMe( CGroupMembersPresenceConfigurationItem* aChild ); + + void AddPresenceConfiguratorL( const CXIMPIdentityImp& aIdentity, CXIMPConfigurationItemBase* aItem ); + void RemovePresenceConfigurator( const CXIMPIdentityImp& aIdentity, CXIMPConfigurationItemBase* aItem ); + + + // Other methods + void AddEventL( CXIMPApiEventBase& aEvent, MXIMPPscContext* aContext ); + + TInt32 ProtocolUID( ); + + MPresenceCacheWriter* ExternalCache(); + +public: // New methods + + /** + * - If OwnPresenceSubscriptionItem is not found, data cache + * initializes new one and returns ownership to caller + * - If OwnPresenceSubscriptionItem is found, data cache increases + * refcount by one, and returns the old object + */ + IMPORT_C COwnPresenceSubscriptionItem& OwnPresenceSubscriptionItemLC(); + IMPORT_C CGroupListSubscriptionItem& GroupListSubscriptionItemLC(); + IMPORT_C CWatcherListSubscriptionItem& WatcherListSubscriptionItemLC(); + IMPORT_C CGrantRequestListSubscriptionItem& GrantRequestListSubscriptionItemLC(); + IMPORT_C CBlockListSubscriptionItem& BlockListSubscriptionItemLC(); + IMPORT_C CGroupContentSubscriptionItem& GroupContentSubscriptionItemLC( + const CXIMPIdentityImp& aGroupId ); + IMPORT_C CPresentityPresenceSubscriptionItem& PresentityPresenceSubscriptionItemLC( + const CXIMPIdentityImp& aIdentity ); + IMPORT_C CPresentityGroupMembersPresenceSubscriptionItem& + PresentityGroupMembersPresenceSubscriptionItemLC( const CXIMPIdentityImp& aIdentity ); + + IMPORT_C CPresenceConfigurationItem& PresenceConfigurationItemLC( const CXIMPIdentityImp& aIdentity ); + IMPORT_C CPresenceToEveryoneConfigurationItem& PresenceToEveryoneConfigurationItemLC(); + IMPORT_C CGroupMembersPresenceConfigurationItem& GroupMembersPresenceConfigurationItemLC( + const CXIMPIdentityImp& aGroupId ); + + + /** + * Checks if group content subscription item with given group id is found. + */ + IMPORT_C TBool GroupContentSubscriptionItemExists( const CXIMPIdentityImp& aGroupId ); + + /** + * Clean resources concerning context. + */ + IMPORT_C void CleanResources( MXIMPPscContext& aContext ); + + /** + * + */ + IMPORT_C void CleanExpired(); + + /** + * Helper method to pack group id. + * @param aGroupId The group id to be packed. + * @return HBufC8 containing the packed group id. + */ + HBufC8* PackGroupIdLC( const MXIMPIdentity& aGroupId ); + + IMPORT_C const MXIMPDataSubscriptionState& OwnPresenceDataSubscriptionState() const; + IMPORT_C const MXIMPDataSubscriptionState& PresentityGroupListDataSubscriptionState() const; + IMPORT_C const MXIMPDataSubscriptionState& PresentityGroupContentDataSubscriptionState( + const MXIMPIdentity& aGroupId ) const; + IMPORT_C const MXIMPDataSubscriptionState& PresentityPresenceDataSubscriptionState( + const MXIMPIdentity& aPresentityId ) const; + IMPORT_C const MXIMPDataSubscriptionState& PresenceWatcherListDataSubscriptionState() const; + IMPORT_C const MXIMPDataSubscriptionState& PresenceBlockDataSubscriptionState() const; + IMPORT_C const MXIMPDataSubscriptionState& PresenceGrantRequestDataSubscriptionState() const; + +private: // Helper methods + + /** + * Template method for removeMe when one subscription item is target. + * @param aItem Reference to subscription item pointer to remove. + * @param Pointer of item to remove. + */ + template< class Type > + IMPORT_C static void RemoveMe( Type*& aItem, Type* aChild ); + + /** + * Template method for removeme if target subscription item is in array. + * @param aItemArray Array of subscription items where aChild should exists. + * @param Pointer of item to remove. + */ + template< class Type > + void RemoveMeFromArray( RPointerArray< Type >& aItemArray, Type* aChild ); + + /** + * Templated item instance creation. If item is not found it is created. + * @param aItem Reference to pointer where new item should be saved. + * @return Reference to item created. + */ + template< class Type > + Type& ItemLC( Type*& aItem ); + + /** + * Templated item instance creation. If item is not found it is created. + * @param aItemArray Array of items where new item should be created. + * @param aIdentity. Key for finding item or for creating the new one. + * @return Reference to item created. + */ + template< class Type > + Type& ArrayItemLC( RPointerArray< Type >& aItemArray, const CXIMPIdentityImp& aIdentity ); + + /** + * Templated item instance creation. If item is not found it is created. + * @param aItemArray Array of items where new item should be created. + * @param aContentArray. Content array for passing to new created item. + * @param aIdentity. Key for finding item or for creating the new one. + * @return Reference to item created. + */ + template< class Type, class ContentType > + Type& ArrayItemLC( RPointerArray< Type >& aItemArray, + RPointerArray< ContentType >& aContentArray, + const CXIMPIdentityImp& aIdentity ); + + /** + * Get data subscription state for item. + * @param aItem Item which data subscription state should be found. + * @return Data subscription state. + */ + template< class Type > + const MXIMPDataSubscriptionState& DataSubscriptionState( Type* aItem ) const; + + /** + * Get data subscription state for item. + * @param aItemArray Item array where item should be found. + * @aIdentity Key for finding right item. + * @return Data subscription state. + */ + template< class Type > + const MXIMPDataSubscriptionState& DataSubscriptionState( const RPointerArray< Type >& aItemArray, + const MXIMPIdentity& aIdentity ) const; + +private: // Data + + /** + * Access to host. + */ + MXIMPHost& iHost; + + /** + * Does not own. Removed when RemoveMe called. + */ + COwnPresenceSubscriptionItem* iOwnSubscriptionItem; + CGroupListSubscriptionItem* iGroupListSubscriptionItem; + RPointerArray< CGroupContentSubscriptionItem > iGroupContentSubscriptionItems; + RPointerArray< CPresentityPresenceSubscriptionItem > iPresentityPresenceSubscriptionItems; + CWatcherListSubscriptionItem* iWatcherListSubscriptionItem; + CGrantRequestListSubscriptionItem* iGrantRequestListSubscriptionItem; + RPointerArray< CPresentityGroupMembersPresenceSubscriptionItem > iGroupMembersPresenceSubscriptionItems; + CBlockListSubscriptionItem* iBlockListSubscriptionItem; + + RPointerArray< CXIMPSubscriptionItemBase > iExpiringSubscriptionItems; + + RPointerArray< CPresenceConfigurationItem > iPresenceConfigurationItems; + CPresenceToEveryoneConfigurationItem* iPresenceToEveryoneConfigurationItem; + RPointerArray< CGroupMembersPresenceConfigurationItem > iGroupMembersPresenceConfigurationItems; + + /** + * Empty subscription state to pass adaptation exists request is subscription item does not exists. + */ + CXIMPDataSubscriptionStateImp* iEmptySubscriptionState; + + MPresenceCacheWriter *iExtPresenceCache; +/* ======================================================================== */ + + }; +#endif // CPRESENCEDATACACHEIMP_H diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencedatamodel/presencedatamodelhook/presencedatamodelhook.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencedatamodel/presencedatamodelhook/presencedatamodelhook.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,46 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework's Presence Data Model Hook implementation. +* +*/ + + +#include "presencedlluids.hrh" +#include "presenceapidataobjfactoryaccessor.h" +#include +#include + + +// --------------------------------------------------------------------------- +// Key value pair table to identify correct constructor +// function for the requested interface. +// --------------------------------------------------------------------------- +// +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY( XIMP_ECOM_IMPL_UID_PRESENCE_DATAMODEL_INTERFACE, + CPresenceApiDataObjFactoryAccessor::NewL ) + }; + + +// --------------------------------------------------------------------------- +// Exported function to return the implementation proxy table +// --------------------------------------------------------------------------- +// +EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount ) + { + aTableCount = sizeof( ImplementationTable ) / sizeof( TImplementationProxy ); + return ImplementationTable; + } + diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencedatamodel/presencedatamodelhook/presencedatamodelhook.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencedatamodel/presencedatamodelhook/presencedatamodelhook.rss Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,51 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ECom registery info for ECom hook +* +*/ + + +#include +#include "../../group/presencedlluids.hrh" +#include + +// --------------------------------------------------------------------------- +// ECom registery info for XIMP Presence Manager ECom hook +// --------------------------------------------------------------------------- +// +RESOURCE REGISTRY_INFO theInfo + { + resource_format_version = RESOURCE_FORMAT_VERSION_2; + dll_uid = XIMP_DLL_UID_PRESENCE_DATAMODEL_HOOK; + + interfaces = + { + INTERFACE_INFO + { + interface_uid = XIMP_ECOM_IF_UID_PRESENCE_EVENT_CODEC_INTERFACE; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = XIMP_ECOM_IMPL_UID_PRESENCE_DATAMODEL_INTERFACE; + version_no = 1; + display_name = "S60 Default XIMP"; + default_data = XIMP_ECOM_DEFAULT_DATA_PRESENCE_EVENT_CODEC; + opaque_data = ""; + } + }; + } + }; + } + diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencedatamodel/presenceeventcodec.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencedatamodel/presenceeventcodec.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,285 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Base class for API implementations. +* +*/ + +#include "presenceeventcodec.h" +//#include "ximprequestcompleteeventimp.h" +//#include "ximpcontextstateeventimp.h" +#include "presentitygrouplisteventimp.h" +#include "ownpresenceeventimp.h" +#include "presentitypresenceeventimp.h" +#include "presentitygroupcontenteventimp.h" +#include "presencewatcherlisteventimp.h" +#include "presencegrantrequestlisteventimp.h" +#include "presenceblocklisteventimp.h" + +#include "ximpapieventbase.h" +#include +#include + +//DATA TYPES + + +/** + * Type definition for exact API event constructor signature. + */ +typedef CXIMPApiEventBase* (*TApiEventConstructor)( RReadStream& ); + + + +/** + * Structure for mapping event interface IDs to + * to corect API event constructors. + */ +struct SApiEventConstructorMap + { + //Interface id + TInt32 iInterfaceId; + + //Function pointer to event interface implementation + TApiEventConstructor iConstructorPtr; + } ; + + + +/** + * Helper macro to initialise KApiEventConstructorTable members. + * + * Macro forces that each event implementation class to have static + * NewFromStreamLC() memeber function to instantiate the object. + * + * See TApiEventConstructor type definition for exact constructor + * signature. + */ +#define CONSTRUCTOR_ENTRY( TheImplementedIf, TheClass ) \ + { TheImplementedIf::KInterfaceId, TheClass::NewFromStreamLC } \ + + + +/** + * Constructor function mapping for event interface implementations. + * + * When new event types are implemented, add them here. + */ +const SApiEventConstructorMap KApiEventConstructorTable[] = + { +// CONSTRUCTOR_ENTRY( MXIMPRequestCompleteEvent, CXIMPRequestCompleteEventImp ), +// CONSTRUCTOR_ENTRY( MXIMPContextStateEvent, CXIMPContextStateEventImp ), + CONSTRUCTOR_ENTRY( MPresentityGroupListEvent, CPresentityGroupListEventImp ), + CONSTRUCTOR_ENTRY( MOwnPresenceEvent, COwnPresenceEventImp ), + CONSTRUCTOR_ENTRY( MPresentityPresenceEvent, CPresentityPresenceEventImp ), + CONSTRUCTOR_ENTRY( MPresentityGroupContentEvent, CPresentityGroupContentEventImp ), + CONSTRUCTOR_ENTRY( MPresenceWatcherListEvent, CPresenceWatcherListEventImp ), + CONSTRUCTOR_ENTRY( MPresenceGrantRequestListEvent, CPresenceGrantRequestListEventImp ), + CONSTRUCTOR_ENTRY( MPresenceBlockListEvent, CPresenceBlockListEventImp ) + }; + + +/** + * Count of constructor mappings. + */ +const TInt KApiEventConstructorCount = sizeof( KApiEventConstructorTable ) + / sizeof( SApiEventConstructorMap ); + + + +// ============================ HELPER FUNCTIONS ============================= + + +/** + * Helper function to locate constructor function for + * event interface ID. + * + * @param aEventInterfaceId The event interface ID. + * @return Event object constructor function. + */ +TApiEventConstructor ConstructorForInterface( TInt32 aEventInterfaceId ) + { + //Locate correct constructor + for( TInt ix = 0; ix < KApiEventConstructorCount; ix++ ) + { + const SApiEventConstructorMap map = KApiEventConstructorTable[ ix ]; + if( map.iInterfaceId == aEventInterfaceId ) + { + return map.iConstructorPtr; + } + } + + + //If assertion below fails, check that event implementation + //class implementing requested event interface (aEventInterfaceId) + //is registered to KApiEventConstructorTable +// __ASSERT_DEBUG( EFalse, +// User::Panic( _L("PresenceEventCodec"), KErrUnknown ) ); + + return NULL; + } + + +/** + * Helper function to instantiate new event object + * of requested type and construct it from the stream. + * + * @param aEventInterfaceId + * @return Event object constructor function. + */ +CXIMPApiEventBase* NewEventObjectFromStreamLC( TInt32 aEventInterfaceId, + RReadStream& aStream ) + { + TApiEventConstructor newFromStreamLC = NULL; + + //Locate correct constructor for interface ID + newFromStreamLC = ConstructorForInterface( aEventInterfaceId ); + if( ! newFromStreamLC ) + { + return NULL; + } + //Instantiate the object + CXIMPApiEventBase* eventObject = newFromStreamLC( aStream ); + + + return eventObject; + } + + + +// ============================ MEMBER FUNCTIONS ============================= + + +// --------------------------------------------------------------------------- +// CPresenceEventCodec::NewL() +// --------------------------------------------------------------------------- +// +CPresenceEventCodec* CPresenceEventCodec::NewL() + { + CPresenceEventCodec* self = new( ELeave ) CPresenceEventCodec() ; + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); + return self; + } + + +// --------------------------------------------------------------------------- +// CPresenceEventCodec::ConstructL() +// --------------------------------------------------------------------------- +// +void CPresenceEventCodec::ConstructL() + { + } + + +// --------------------------------------------------------------------------- +// CPresenceEventCodec::CPresenceEventCodec() +// --------------------------------------------------------------------------- +// +CPresenceEventCodec::CPresenceEventCodec() + { + } + +// --------------------------------------------------------------------------- +// CPresenceEventCodec::~CPresenceEventCodec() +// --------------------------------------------------------------------------- +// +CPresenceEventCodec::~CPresenceEventCodec() + { + } + +// --------------------------------------------------------------------------- +// CPresenceEventCodec::PackL() +// --------------------------------------------------------------------------- +// +HBufC8* CPresenceEventCodec::PackL( CXIMPApiEventBase& aEventObj, + TInt32& aTypeOfEvent ) + { + CBufFlat* buffer = CBufFlat::NewL( 10 ); // initial granularity to 10 + CleanupStack::PushL( buffer ); + + RBufWriteStream ws; + CleanupClosePushL( ws ); + ws.Open( *buffer ); // CSI: 65 # + + //Ask real event type through the event base interface + TInt32 eventIfId = aEventObj.Base().GetInterfaceId(); + + //And write both event type and data + ws.WriteInt32L( eventIfId ); + aEventObj.ExternalizeL( ws ); + ws.CommitL(); + CleanupStack::PopAndDestroy(); //ws + + HBufC8* heapBuf = buffer->Ptr( 0 ).AllocL(); + + CleanupStack::PopAndDestroy( buffer ); + + + aTypeOfEvent = eventIfId; + return heapBuf; + } + + +// --------------------------------------------------------------------------- +// CPresenceEventCodec::PackL() +// --------------------------------------------------------------------------- +// +void CPresenceEventCodec::PackL( CXIMPApiEventBase& aEventObj, + TInt32& aTypeOfEvent, + CBufFlat* aBuffer ) + { + RBufWriteStream ws; + CleanupClosePushL( ws ); + ws.Open( *aBuffer ); // CSI: 65 # + + //Ask real event type through the event base interface + TInt32 eventIfId = aEventObj.Base().GetInterfaceId(); + + //And write both event type and data + ws.WriteInt32L( eventIfId ); + aEventObj.ExternalizeL( ws ); + ws.CommitL(); + CleanupStack::PopAndDestroy(); //ws + + aTypeOfEvent = eventIfId; + } + + +// --------------------------------------------------------------------------- +// CPresenceEventCodec::UnPackL() +// --------------------------------------------------------------------------- +// +CXIMPApiEventBase* CPresenceEventCodec::UnPackL( const TDesC8& aEventData, + TInt32& aTypeOfEvent ) + { + RDesReadStream rs; + rs.Open( aEventData ); // CSI: 65 # + CleanupClosePushL( rs ); + + TInt32 eventIfId = rs.ReadInt32L(); + CXIMPApiEventBase* eventObject = NewEventObjectFromStreamLC( eventIfId, rs ); + if(eventObject) + { + CleanupStack::Pop(); //eventObject + } + CleanupStack::PopAndDestroy(); // rs + + + aTypeOfEvent = eventIfId; + return eventObject; + } + + +// End of file + diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencedatamodel/presenceeventcodec.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencedatamodel/presenceeventcodec.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,81 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Codec to pack and unpack event objects. +* +*/ + +#ifndef PRESENCEEVENTCODEC_H +#define PRESENCEEVENTCODEC_H + +#include + +#include "eventcodec.h" +//#include "ximpapieventbase.h" +class CXIMPApiEventBase; +class RReadStream; + + +/** + * Codec to pack and unpack event objects. + * + * @lib ximpdatamodel.dll + * @since S60 v3.2 + */ +NONSHARABLE_CLASS( CPresenceEventCodec ): public MEventCodec + { +public: + + static CPresenceEventCodec* NewL(); + + ~CPresenceEventCodec(); + + + /** + * + * + * + * @param + * + * @return + * + */ + HBufC8* PackL( CXIMPApiEventBase& aEventObj, + TInt32& aTypeOfEvent ); + void PackL( CXIMPApiEventBase& aEventObj, + TInt32& aTypeOfEvent, + CBufFlat* aBuffer ); + + /** + * + * + * + * @param + * + * @return + * + */ + CXIMPApiEventBase* UnPackL( const TDesC8& aEventData, + TInt32& aTypeOfEvent ); +protected: + void ConstructL(); + +private: + + CPresenceEventCodec(); + + + }; + + +#endif // PRESENCEEVENTCODEC_H diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencedatamodel/presencefilterstore.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencedatamodel/presencefilterstore.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,232 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework store for filters +* +*/ + + +#include "presencefilterstore.h" +#include "ximpidentityimp.h" +#include "presenceinfofilterimp.h" +#include "ximpobjecthelpers.h" + +// ======== LOCAL FUNCTIONS ======== + +// ============================ HELPER CLASS ============================= + +// --------------------------------------------------------------------------- +// CPresenceFilterStoreMapping::NewL +// --------------------------------------------------------------------------- +// +CPresenceFilterStore::CPresenceFilterStoreMapping* +CPresenceFilterStore::CPresenceFilterStoreMapping::NewL() + { + CPresenceFilterStoreMapping* self = new ( ELeave ) + CPresenceFilterStoreMapping(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// CPresenceFilterStoreMapping::ConstructL +// --------------------------------------------------------------------------- +// +void CPresenceFilterStore::CPresenceFilterStoreMapping::ConstructL() + { + } + +// --------------------------------------------------------------------------- +// CPresenceFilterStoreMapping::CPresenceFilterStoreMapping +// --------------------------------------------------------------------------- +// +CPresenceFilterStore::CPresenceFilterStoreMapping::CPresenceFilterStoreMapping() + { + } + +// --------------------------------------------------------------------------- +// CPresenceFilterStoreMapping::~CPresenceFilterStoreMapping +// --------------------------------------------------------------------------- +// +CPresenceFilterStore::CPresenceFilterStoreMapping::~CPresenceFilterStoreMapping() + { + delete iIdentity; + delete iFilter; + } + +// --------------------------------------------------------------------------- +// CPresenceFilterStoreMapping::Identity +// --------------------------------------------------------------------------- +// +CXIMPIdentityImp& CPresenceFilterStore::CPresenceFilterStoreMapping::Identity() + { + return *iIdentity; + } + +// --------------------------------------------------------------------------- +// CPresenceFilterStoreMapping::Filter +// --------------------------------------------------------------------------- +// +CPresenceInfoFilterImp& CPresenceFilterStore::CPresenceFilterStoreMapping::Filter() + { + return *iFilter; + } + +// --------------------------------------------------------------------------- +// CPresenceFilterStoreMapping::SetPresenceInfoFilter +// --------------------------------------------------------------------------- +// +void CPresenceFilterStore::CPresenceFilterStoreMapping::SetPresenceInfoFilter( CPresenceInfoFilterImp* aFilter ) + { + iFilter = aFilter; + } + +// --------------------------------------------------------------------------- +// CPresenceFilterStoreMapping::SetIdentity +// --------------------------------------------------------------------------- +// +void CPresenceFilterStore::CPresenceFilterStoreMapping::SetIdentity( CXIMPIdentityImp* aIdentity ) + { + iIdentity = aIdentity; + } + +// --------------------------------------------------------------------------- +// CPresenceFilterStoreMapping::OrderOfMappings() +// --------------------------------------------------------------------------- +// +TInt CPresenceFilterStore::CPresenceFilterStoreMapping::OrderOfMappings( + const CPresenceFilterStoreMapping& aFirst, + const CPresenceFilterStoreMapping& aSecond ) + { + return OrderOfMappingsByIdentity( aFirst.iIdentity, aSecond ); + } + + +// --------------------------------------------------------------------------- +// CPresenceFilterStoreMapping::OrderOfMappings() +// --------------------------------------------------------------------------- +// +TInt CPresenceFilterStore::CPresenceFilterStoreMapping::OrderOfMappingsByIdentity( + const CXIMPIdentityImp* aKey, + const CPresenceFilterStoreMapping& aSecond ) + { + return aKey->Compare( *aSecond.iIdentity ); + } + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// CPresenceFilterStore::CPresenceFilterStore() +// --------------------------------------------------------------------------- +// +CPresenceFilterStore::CPresenceFilterStore() + { + } + + +// --------------------------------------------------------------------------- +// CPresenceFilterStore::ConstructL() +// --------------------------------------------------------------------------- +// +void CPresenceFilterStore::ConstructL() + { + } + + +// --------------------------------------------------------------------------- +// CPresenceFilterStore::NewL() +// --------------------------------------------------------------------------- +// +EXPORT_C CPresenceFilterStore* CPresenceFilterStore::NewL() + { + CPresenceFilterStore* self = new( ELeave ) CPresenceFilterStore; + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + + +// --------------------------------------------------------------------------- +// CPresenceFilterStore::~CPresenceFilterStore() +// --------------------------------------------------------------------------- +// +CPresenceFilterStore::~CPresenceFilterStore() + { + iMappings.ResetAndDestroy(); + } + + +// --------------------------------------------------------------------------- +// CPresenceFilterStore::AssociateL() +// --------------------------------------------------------------------------- +// +EXPORT_C void CPresenceFilterStore::AssociateL( + const CXIMPIdentityImp& aIdentity, + CPresenceInfoFilterImp* aFilter ) + { + TLinearOrder< CPresenceFilterStore::CPresenceFilterStoreMapping > order( CPresenceFilterStore::CPresenceFilterStoreMapping::OrderOfMappings ); + + if ( FilterForIdentity( aIdentity ) ) + { + User::Leave( KErrAlreadyExists ); + } + + CXIMPIdentityImp* identity = TXIMPObjectCloner< CXIMPIdentityImp >::CloneL( aIdentity ); + CleanupStack::PushL( identity ); + CPresenceFilterStoreMapping* mapping = CPresenceFilterStoreMapping::NewL(); + mapping->SetIdentity( identity ); + CleanupStack::Pop( identity ); + CleanupStack::PushL( mapping ); + iMappings.InsertInOrderL( mapping, order ); + CleanupStack::Pop( mapping ); + mapping->SetPresenceInfoFilter( aFilter ); + } + +// --------------------------------------------------------------------------- +// CPresenceFilterStore::DisassociateL() +// --------------------------------------------------------------------------- +// +EXPORT_C void CPresenceFilterStore::Disassociate( const CXIMPIdentityImp& aIdentity ) + { + TInt index = iMappings.FindInOrder( aIdentity, CPresenceFilterStoreMapping::OrderOfMappingsByIdentity ); + if( index >= 0 ) + { + CPresenceFilterStoreMapping* removed = iMappings[ index ]; + iMappings.Remove( index ); + delete removed; + removed = NULL; + } + } + +// --------------------------------------------------------------------------- +// CPresenceFilterStore::FilterForIdentityL() +// --------------------------------------------------------------------------- +// +EXPORT_C CPresenceInfoFilterImp* CPresenceFilterStore::FilterForIdentity( + const CXIMPIdentityImp& aIdentity ) + { + TInt index = iMappings.FindInOrder( aIdentity, CPresenceFilterStoreMapping::OrderOfMappingsByIdentity ); + + if( index < 0 ) + { + return NULL; + } + + CPresenceFilterStoreMapping* entry = iMappings[ index ]; + return (entry->iFilter); + } + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencedatamodel/presencefilterstore.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencedatamodel/presencefilterstore.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,153 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework store for filters +* +*/ + + +#ifndef C_PRESENCEFILTERSTORE_H +#define C_PRESENCEFILTERSTORE_H + +#include "ximpbase.h" +#include + +class CXIMPIdentityImp; +class CPresenceInfoFilterImp; + +/** + * Filter store. + * Defines a one-to-one mapping of an identity to a presence filter. + * + * @since S60 v4.0 + */ +class CPresenceFilterStore : public CBase + { + private: // helper class + + class CPresenceFilterStoreMapping : public CBase + { + public: + + /** + * Takes ownership. + * @param aIdentity The identity + * @param aFilter The filter. + */ + static CPresenceFilterStoreMapping* NewL(); + + ~CPresenceFilterStoreMapping(); + + /** + * @return The identity + */ + CXIMPIdentityImp& Identity(); + + /** + * @return The filter + */ + CPresenceInfoFilterImp& Filter(); + + static TInt OrderOfMappings( + const CPresenceFilterStoreMapping& aFirst, + const CPresenceFilterStoreMapping& aSecond ); + + static TInt OrderOfMappingsByIdentity( + const CXIMPIdentityImp* aFirst, + const CPresenceFilterStoreMapping& aSecond ); + + /** + * Set filter to mapping. + */ + void SetPresenceInfoFilter( CPresenceInfoFilterImp* aFilter ); + void SetIdentity( CXIMPIdentityImp* aIdentity ); + + private: + + CPresenceFilterStoreMapping(); + + void ConstructL(); + + public: + // owns: the identity + CXIMPIdentityImp* iIdentity; + + // owns: the filter + CPresenceInfoFilterImp* iFilter; + }; + +public: + + /** + * Construction + */ + IMPORT_C static CPresenceFilterStore* NewL(); + + /** + * Destruction + */ + virtual ~CPresenceFilterStore(); + +private: + + /** + * Construction + */ + CPresenceFilterStore(); + + /** + * Construction + */ + void ConstructL(); + + +public: // New methods + + /** + * Associate identity with filter + * @param aIdentity The identity + * @param aFilter The filter. Ownership is transferred to callee + * @leave KErrAlreadyExists if the association exists + */ + IMPORT_C void AssociateL( + const CXIMPIdentityImp& aIdentity, + CPresenceInfoFilterImp* aFilter ); + + /** + * Remove association. + * @param aIdentity The identity + * @param aFilter The filter + * @leave KErrNotFound if the association does not exist + */ + IMPORT_C void Disassociate( const CXIMPIdentityImp& aIdentity ); + + /** + * Find the filter associated with the given identity. + * @param aIdentity The identity + * @return The filter + * @leave KErrNotFound if the association does not exist + */ + IMPORT_C CPresenceInfoFilterImp* FilterForIdentity( const CXIMPIdentityImp& aIdentity ); + +private: // helpers + +private: // data + + /** + * Array of mappings. Items are owned + */ + RXIMPObjOwningPtrArray< CPresenceFilterStoreMapping > iMappings; + }; + + +#endif // C_PRESENCEFILTERSTORE_H diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencedatamodel/presenceinfo/devicepresenceinfoimp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencedatamodel/presenceinfo/devicepresenceinfoimp.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,204 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of MDevicePresenceInfo object. +* +*/ + + +#include "presenceinfofield.h" +#include "devicepresenceinfoimp.h" +#include "presenceinfofieldcollectionimp.h" +#include "ximprbufhelpers.h" +#include "presenceinfofilterimp.h" + +// ============================ MEMBER FUNCTIONS ============================= + +// --------------------------------------------------------------------------- +// CDevicePresenceInfoImp::NewLC() +// --------------------------------------------------------------------------- +// +EXPORT_C CDevicePresenceInfoImp* CDevicePresenceInfoImp::NewLC() + { + CDevicePresenceInfoImp* self = new( ELeave ) CDevicePresenceInfoImp; + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + +// --------------------------------------------------------------------------- +// CDevicePresenceInfoImp::NewFromStreamLC() +// --------------------------------------------------------------------------- +// +XIMPIMP_IMPLEMENT_DATAOBJ_NEWFROMSTREAM( CDevicePresenceInfoImp ) + + +// --------------------------------------------------------------------------- +// Implement supported interface access. +// --------------------------------------------------------------------------- +// +XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CDevicePresenceInfoImp, + MDevicePresenceInfo ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + +XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CDevicePresenceInfoImp, + MDevicePresenceInfo ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + +// --------------------------------------------------------------------------- +// CDevicePresenceInfoImp::~CDevicePresenceInfoImp() +// --------------------------------------------------------------------------- +// +CDevicePresenceInfoImp::~CDevicePresenceInfoImp() + { + delete iFields; + iDeviceName.Close(); + } + + +// --------------------------------------------------------------------------- +// CDevicePresenceInfoImp::CDevicePresenceInfoImp() +// --------------------------------------------------------------------------- +// +CDevicePresenceInfoImp::CDevicePresenceInfoImp() + { + } + + +// --------------------------------------------------------------------------- +// CDevicePresenceInfoImp::ConstructL() +// --------------------------------------------------------------------------- +// +void CDevicePresenceInfoImp::ConstructL() + { + iFields = CPresenceInfoFieldCollectionImp::NewLC(); + CleanupStack::Pop( iFields ); + + iDeviceName.CreateL( 0 ); + } + +// --------------------------------------------------------------------------- +// CDevicePresenceInfoImp::ExternalizeL() +// --------------------------------------------------------------------------- +// +void CDevicePresenceInfoImp::ExternalizeL( RWriteStream& aStream ) const + { + XIMPRBuf8Helper::ExternalizeL( iDeviceName, aStream ); + iFields->ExternalizeL( aStream ); + } + + +// --------------------------------------------------------------------------- +// CDevicePresenceInfoImp::InternalizeL() +// --------------------------------------------------------------------------- +// +EXPORT_C void CDevicePresenceInfoImp::InternalizeL( RReadStream& aStream ) + { + XIMPRBuf8Helper::InternalizeL( iDeviceName, aStream ); + + // we only have a parameterless ConstructL which creates the fields structure... + CXIMPApiDataObjBase* tmp = CPresenceInfoFieldCollectionImp::NewFromStreamLC( aStream ); + CPresenceInfoFieldCollectionImp* fields = + TXIMPGetImpClassOrPanic< CPresenceInfoFieldCollectionImp >::From( tmp->Base() ); + delete iFields; + iFields = fields; + CleanupStack::Pop( tmp ); + } + + +// --------------------------------------------------------------------------- +// CDevicePresenceInfoImp::EqualsContent() +// --------------------------------------------------------------------------- +// +TBool CDevicePresenceInfoImp::EqualsContent( + const CXIMPApiDataObjBase& aOtherInstance ) const + { + const CDevicePresenceInfoImp* tmp = + TXIMPGetImpClassOrPanic< const CDevicePresenceInfoImp >::From( + aOtherInstance.Base() ); + + TBool same = ETrue; + TBool x; + x = iFields->EqualsContent( *( tmp->iFields ) ); + same &= x; + + return same; + } + +// --------------------------------------------------------------------------- +// From MDevicePresenceInfo class. +// CDevicePresenceInfoImp::DeviceName() +// --------------------------------------------------------------------------- +// +const TPtrC8 CDevicePresenceInfoImp::DeviceName() const + { + return iDeviceName; + } + +// --------------------------------------------------------------------------- +// From MDevicePresenceInfo class. +// CDevicePresenceInfoImp::SetDeviceNameL() +// --------------------------------------------------------------------------- +// +void CDevicePresenceInfoImp::SetDeviceNameL( const TDesC8& aDeviceName ) + { + HBufC8* tmp = aDeviceName.AllocL(); + iDeviceName.Close(); + iDeviceName.Assign( tmp ); + } + + +// --------------------------------------------------------------------------- +// From MDevicePresenceInfo class. +// CDevicePresenceInfoImp::Fields() +// --------------------------------------------------------------------------- +// +const MPresenceInfoFieldCollection& CDevicePresenceInfoImp::Fields() const + { + return *iFields; + } + + +// --------------------------------------------------------------------------- +// From MDevicePresenceInfo class. +// CDevicePresenceInfoImp::Fields() +// --------------------------------------------------------------------------- +// +MPresenceInfoFieldCollection& CDevicePresenceInfoImp::Fields() + { + return *iFields; + } + +// --------------------------------------------------------------------------- +// CDevicePresenceInfoImp::FilterWithL() +// --------------------------------------------------------------------------- +// +void CDevicePresenceInfoImp::FilterWithL( const CPresenceInfoFilterImp& aFilter ) + { + TInt count = iFields->FieldCount(); + + // must traverse backwards when removing + for ( TInt i = count-1; i >= 0; i-- ) + { + if ( ! aFilter.MatchDeviceFilterL( + iDeviceName, + iFields->FieldAt( i ).FieldType() ) ) + { + // no match, so remove the field + // the filter tells us which ones to ACCEPT + iFields->RemoveField( i ); + } + } + } + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencedatamodel/presenceinfo/devicepresenceinfoimp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencedatamodel/presenceinfo/devicepresenceinfoimp.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,116 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of MDevicePresenceInfo object. +* +*/ + +#ifndef CDEVICEPRESENCEINFOIMP_H +#define CDEVICEPRESENCEINFOIMP_H + +#include +#include +#include +#include +#include "ximpapidataobjbase.h" +#include "presenceapiobjbase.h" + + +class CPresenceInfoFieldCollectionImp; +class CPresenceInfoFilterImp; + +/** + * Implementation of MDevicePresenceInfo object. + * + * @since S60 v3.2 + */ +NONSHARABLE_CLASS( CDevicePresenceInfoImp ): public CXIMPApiDataObjBase, + public MDevicePresenceInfo + { + public: + + /** The class ID. */ + enum { KClassId = PRIMP_CLSID_CDEVICEPRESENCEINFOIMP }; + +public: + + IMPORT_C static CDevicePresenceInfoImp* NewLC(); + + virtual ~CDevicePresenceInfoImp(); + +private: + + CDevicePresenceInfoImp(); + void ConstructL(); + + /** + * @see CXIMPApiDataObjBase + */ + XIMPIMP_DECLARE_DATAOBJ_BASE_PRIV_METHODS + + +public: // From MXIMPBase + + /** + * Implementation of MXIMPBase interface methods + * @see MXIMPBase + */ + XIMPIMP_DECLARE_IF_BASE_METHODS + + /** + * @see CXIMPApiDataObjBase + */ + XIMPIMP_DECLARE_DATAOBJ_BASE_METHODS + + +public: // New functions + + /** + * Internalizes object data from given stream. + * @param aStream Stream to read. + */ + IMPORT_C void InternalizeL( RReadStream& aStream ); + + + +public: // from MDevicePresenceInfo + + /** + * @see MDevicePresenceInfo + */ + const TPtrC8 DeviceName() const; + void SetDeviceNameL( const TDesC8& aDeviceName ); + const MPresenceInfoFieldCollection& Fields() const; + MPresenceInfoFieldCollection& Fields(); + +public: // new methods + + /** + * Remove from this info field implementation the fields which do not match + * the given filter. + * @param aFilter The filter implementation + */ + void FilterWithL( const CPresenceInfoFilterImp& aFilter ); + +private: // data + + CPresenceInfoFieldCollectionImp* iFields; + + RBuf8 iDeviceName; + }; + + +#endif // CDEVICEPRESENCEINFOIMP_H + + + diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencedatamodel/presenceinfo/personpresenceinfoimp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencedatamodel/presenceinfo/personpresenceinfoimp.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,166 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of MPersonPresenceInfo object. +* +*/ + + +#include "presenceinfofield.h" +#include "personpresenceinfoimp.h" +#include "presenceinfofieldcollectionimp.h" +#include "presenceinfofilterimp.h" + +// ============================ MEMBER FUNCTIONS ============================= + +// --------------------------------------------------------------------------- +// CPersonPresenceInfoImp::NewLC() +// --------------------------------------------------------------------------- +// +EXPORT_C CPersonPresenceInfoImp* CPersonPresenceInfoImp::NewLC() + { + CPersonPresenceInfoImp* self = new( ELeave ) CPersonPresenceInfoImp; + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + +// --------------------------------------------------------------------------- +// CPersonPresenceInfoImp::NewFromStreamLC() +// --------------------------------------------------------------------------- +// +XIMPIMP_IMPLEMENT_DATAOBJ_NEWFROMSTREAM( CPersonPresenceInfoImp ) + +// --------------------------------------------------------------------------- +// Implement supported interface access. +// --------------------------------------------------------------------------- +// +XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CPersonPresenceInfoImp, + MPersonPresenceInfo ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() +XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CPersonPresenceInfoImp, + MPersonPresenceInfo ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + +// --------------------------------------------------------------------------- +// CPersonPresenceInfoImp::~CPersonPresenceInfoImp() +// --------------------------------------------------------------------------- +// +CPersonPresenceInfoImp::~CPersonPresenceInfoImp() + { + delete iFields; + } + +// --------------------------------------------------------------------------- +// CPersonPresenceInfoImp::CPersonPresenceInfoImp() +// --------------------------------------------------------------------------- +// +CPersonPresenceInfoImp::CPersonPresenceInfoImp() + { + } + +// --------------------------------------------------------------------------- +// CPersonPresenceInfoImp::ConstructL() +// --------------------------------------------------------------------------- +// +void CPersonPresenceInfoImp::ConstructL() + { + iFields = CPresenceInfoFieldCollectionImp::NewLC(); // CSI: 49 # + CleanupStack::Pop( iFields ); + } + +// --------------------------------------------------------------------------- +// CPersonPresenceInfoImp::ExternalizeL() +// --------------------------------------------------------------------------- +// +void CPersonPresenceInfoImp::ExternalizeL( RWriteStream& aStream ) const + { + iFields->ExternalizeL( aStream ); + } + +// --------------------------------------------------------------------------- +// CPersonPresenceInfoImp::InternalizeL() +// --------------------------------------------------------------------------- +// +EXPORT_C void CPersonPresenceInfoImp::InternalizeL( RReadStream& aStream ) + { + // we only have a parameterless ConstructL which creates the fields structure... + CXIMPApiDataObjBase* tmp = CPresenceInfoFieldCollectionImp::NewFromStreamLC( aStream ); + CPresenceInfoFieldCollectionImp* fields = + TXIMPGetImpClassOrPanic< CPresenceInfoFieldCollectionImp >::From( tmp->Base() ); + delete iFields; + iFields = fields; + CleanupStack::Pop( tmp ); + } + +// --------------------------------------------------------------------------- +// CPersonPresenceInfoImp::EqualsContent() +// --------------------------------------------------------------------------- +// +TBool CPersonPresenceInfoImp::EqualsContent( + const CXIMPApiDataObjBase& aOtherInstance ) const + { + const CPersonPresenceInfoImp* tmp = + TXIMPGetImpClassOrPanic< const CPersonPresenceInfoImp >::From( + aOtherInstance.Base() ); + + TBool same = ETrue; + TBool x; + x = iFields->EqualsContent( *( tmp->iFields ) ); + same &= x; + + return same; + } + + +// --------------------------------------------------------------------------- +// From MPersonPresenceInfo class. +// CPersonPresenceInfoImp::Fields() +// --------------------------------------------------------------------------- +// +const MPresenceInfoFieldCollection& CPersonPresenceInfoImp::Fields() const + { + return *iFields; + } + +// --------------------------------------------------------------------------- +// From MPersonPresenceInfo class. +// CPersonPresenceInfoImp::Fields() +// --------------------------------------------------------------------------- +// +MPresenceInfoFieldCollection& CPersonPresenceInfoImp::Fields() + { + return *iFields; + } + +// --------------------------------------------------------------------------- +// CPersonPresenceInfoImp::FilterWithL() +// --------------------------------------------------------------------------- +// +void CPersonPresenceInfoImp::FilterWithL( const CPresenceInfoFilterImp& aFilter ) + { + TInt count = iFields->FieldCount(); + + // must traverse backwards when removing + for ( TInt i = count-1; i >= 0; i-- ) + { + if ( ! aFilter.MatchPersonFilter( iFields->FieldAt( i ).FieldType() ) ) + { + // no match, so remove the field + // the filter tells us which ones to ACCEPT + iFields->RemoveField( i ); + } + } + } + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencedatamodel/presenceinfo/personpresenceinfoimp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencedatamodel/presenceinfo/personpresenceinfoimp.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,110 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of MPersonPresenceInfo object. +* +*/ + +#ifndef CPERSONPRESENCEINFOIMP_H +#define CPERSONPRESENCEINFOIMP_H + +#include +#include +#include +#include +#include "ximpapidataobjbase.h" +#include "presenceapiobjbase.h" + + +class CPresenceInfoFieldCollectionImp; +class CPresenceInfoFilterImp; + +/** + * Implementation of MPersonPresenceInfo object. + * + * @since S60 v3.2 + */ +NONSHARABLE_CLASS( CPersonPresenceInfoImp ): public CXIMPApiDataObjBase, + public MPersonPresenceInfo + { + public: + + /** The class ID. */ + enum { KClassId = PRIMP_CLSID_CPERSONPRESENCEINFOIMP }; + +public: + + IMPORT_C static CPersonPresenceInfoImp* NewLC(); + + virtual ~CPersonPresenceInfoImp(); + +private: + + CPersonPresenceInfoImp(); + void ConstructL(); + + /** + * @see CXIMPApiDataObjBase + */ + XIMPIMP_DECLARE_DATAOBJ_BASE_PRIV_METHODS + +public: // From MXIMPBase + + /** + * Implementation of MXIMPBase interface methods + * @see MXIMPBase + */ + XIMPIMP_DECLARE_IF_BASE_METHODS + + /** + * @see CXIMPApiDataObjBase + */ + XIMPIMP_DECLARE_DATAOBJ_BASE_METHODS + +public: // New functions + + /** + * Internalizes object data from given stream. + * @param aStream Stream to read. + */ + IMPORT_C void InternalizeL( RReadStream& aStream ); + + +public: // from MPersonPresenceInfo + + /** + * @see MPersonPresenceInfo + */ + const MPresenceInfoFieldCollection& Fields() const; + MPresenceInfoFieldCollection& Fields(); + +public: // new methods + + /** + * Remove from this info field implementation the fields which do not match + * the given filter. + * @param aFilter The filter implementation + */ + void FilterWithL( const CPresenceInfoFilterImp& aFilter ); + +private: // data + + // owned + CPresenceInfoFieldCollectionImp* iFields; + }; + + +#endif // CPERSONPRESENCEINFOIMP_H + + + diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencedatamodel/presenceinfo/presenceinfofieldcollectionimp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencedatamodel/presenceinfo/presenceinfofieldcollectionimp.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,270 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MPresenceInfoFieldValueText API object implementation. + * +*/ + + +#include "presenceinfofield.h" +#include "presenceinfofieldimp.h" +#include "presenceinfofieldcollectionimp.h" +#include "presenceapidataobjfactory.h" +#include "ximprbufhelpers.h" +#include "ximpobjecthelpers.h" +#include "presencetypehelpers.h" + +// ============================ MEMBER FUNCTIONS ============================= + +// --------------------------------------------------------------------------- +// CPresenceInfoFieldCollectionImp::NewLC() +// --------------------------------------------------------------------------- +// +EXPORT_C CPresenceInfoFieldCollectionImp* CPresenceInfoFieldCollectionImp::NewLC() + { + CPresenceInfoFieldCollectionImp* self = new ( ELeave ) CPresenceInfoFieldCollectionImp(); + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + +// --------------------------------------------------------------------------- +// CPresenceInfoFieldCollectionImp::~CPresenceInfoFieldCollectionImp() +// --------------------------------------------------------------------------- +// +CPresenceInfoFieldCollectionImp::~CPresenceInfoFieldCollectionImp() + { + iFields.Close(); + } + +// --------------------------------------------------------------------------- +// CPresenceInfoFieldCollectionImp::CPresenceInfoFieldCollectionImp() +// --------------------------------------------------------------------------- +// +CPresenceInfoFieldCollectionImp::CPresenceInfoFieldCollectionImp() + { + // nothing + } + +// --------------------------------------------------------------------------- +// CPresenceInfoFieldCollectionImp::ConstructL() +// --------------------------------------------------------------------------- +// +void CPresenceInfoFieldCollectionImp::ConstructL() + { + } + +// --------------------------------------------------------------------------- +// CPresenceInfoFieldCollectionImp::NewFromStreamLC() +// --------------------------------------------------------------------------- +// +XIMPIMP_IMPLEMENT_DATAOBJ_NEWFROMSTREAM( CPresenceInfoFieldCollectionImp ) + +// --------------------------------------------------------------------------- +// Implement supported interface access. +// --------------------------------------------------------------------------- +// +XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CPresenceInfoFieldCollectionImp, MPresenceInfoFieldCollection ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() +XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CPresenceInfoFieldCollectionImp, MPresenceInfoFieldCollection ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + + +// --------------------------------------------------------------------------- +// CPresenceInfoFieldCollectionImp::ExternalizeL() +// --------------------------------------------------------------------------- +// +void CPresenceInfoFieldCollectionImp::ExternalizeL( RWriteStream& aStream ) const + { + CPresenceApiDataObjFactory::ExternalizeL< CPresenceInfoFieldImp > + ( aStream, iFields ); + } + +// --------------------------------------------------------------------------- +// CPresenceInfoFieldCollectionImp::InternalizeL() +// --------------------------------------------------------------------------- +// +EXPORT_C void CPresenceInfoFieldCollectionImp::InternalizeL( RReadStream& aStream ) + { + iFields.ResetAndDestroy(); + CPresenceApiDataObjFactory::InternalizeL< CPresenceInfoFieldImp > + ( aStream, iFields ); + } + +// --------------------------------------------------------------------------- +// CPresenceInfoFieldCollectionImp::EqualsContent() +// --------------------------------------------------------------------------- +// +TBool CPresenceInfoFieldCollectionImp::EqualsContent( + const CXIMPApiDataObjBase& aOtherInstance ) const + { + const CPresenceInfoFieldCollectionImp* tmp = + TXIMPGetImpClassOrPanic< const CPresenceInfoFieldCollectionImp >::From( + aOtherInstance.Base() ); + + TBool same = ETrue; + TBool x; + + x = TXIMPEqualsContent< CPresenceInfoFieldImp >::Array( iFields, tmp->iFields ); + same &= x; + + return same; + } + +// --------------------------------------------------------------------------- +// CPresenceInfoFieldCollectionImp::FieldCount() +// --------------------------------------------------------------------------- +// +TInt CPresenceInfoFieldCollectionImp::FieldCount() const + { + return iFields.Count(); + } + +// --------------------------------------------------------------------------- +// CPresenceInfoFieldCollectionImp::FieldAt() +// --------------------------------------------------------------------------- +// +const MPresenceInfoField& CPresenceInfoFieldCollectionImp::FieldAt( + TInt aIndex ) const + { + CPresenceInfoFieldImp* obj = iFields[ aIndex ]; + MPresenceInfoField* infoField = ( MPresenceInfoField* ) + obj->Base().GetInterface( MPresenceInfoField::KInterfaceId, + MXIMPBase::EPanicIfUnknown ); + return *infoField; + } + +// --------------------------------------------------------------------------- +// CPresenceInfoFieldCollectionImp::LookupFieldByFieldType() +// --------------------------------------------------------------------------- +// +void CPresenceInfoFieldCollectionImp::LookupFieldByFieldType( + MPresenceInfoField*& aPresenceInfoField, + const TDesC8& aMatch ) const + { + TInt start = FindIndexOfObj( aPresenceInfoField ); + start = start == KErrNotFound ? 0 : start; + + aPresenceInfoField = NULL; + + // now find the object with name + for ( TInt i = start; i < iFields.Count(); i++ ) + { + CPresenceInfoFieldImp* field = iFields[ i ]; + + if ( KErrNotFound != field->FieldType().MatchF( aMatch ) ) + { + // got a match with correct name + aPresenceInfoField = &(*field); + return; + } + } + + return; + } + +// --------------------------------------------------------------------------- +// CPresenceInfoFieldCollectionImp::DeleteFieldByFieldType() +// --------------------------------------------------------------------------- +// +TInt CPresenceInfoFieldCollectionImp::DeleteFieldByFieldType( + const TDesC8& aMatch ) + { + TInt deleted(KErrNotFound); + // now find the object with name + for ( TInt i = 0; i < iFields.Count(); i++ ) + { + CPresenceInfoFieldImp* field = iFields[ i ]; + + if ( KErrNotFound != field->FieldType().MatchF( aMatch ) ) + { + // got a match with correct name + iFields.Remove( i ); + delete field; + deleted = KErrNone; + } + } + + return deleted; + } + +// --------------------------------------------------------------------------- +// CPresenceInfoFieldCollectionImp::AddOrReplaceFieldL() +// --------------------------------------------------------------------------- +// +void CPresenceInfoFieldCollectionImp::AddOrReplaceFieldL( + MPresenceInfoField* aPresenceInfoField ) + { + User::LeaveIfError( aPresenceInfoField == NULL ? KErrArgument : KErrNone ); + + TInt pos = FindIndexOfObj( aPresenceInfoField ); + CPresenceInfoFieldImp* obj = TXIMPGetImpClassOrPanic< CPresenceInfoFieldImp >::From( *aPresenceInfoField ); + + if ( KErrNotFound == pos ) + { + // not found, so just append + iFields.AppendL( obj ); + } + else + { + // found it, so replace the one at "pos" + CPresenceInfoFieldImp* old = iFields[ pos ]; + iFields.Remove( pos ); + iFields.Insert( obj, pos ); + delete old; + old = NULL; + } + } + + + +// --------------------------------------------------------------------------- +// CPresenceInfoFieldCollectionImp::FindIndexOfObj() +// --------------------------------------------------------------------------- +// +TInt CPresenceInfoFieldCollectionImp::FindIndexOfObj( MPresenceInfoField*& aObject ) const + { + TInt start = KErrNotFound; + + // naive lookup, least recently used (from beginning to the end). + // find starting position + if ( aObject != NULL ) + { + TBool found = EFalse; + for ( TInt i = 0; ( i < iFields.Count()-1 ) && ( ! found ); i++ ) + { + CPresenceInfoFieldImp* gotObj = TXIMPGetImpClassOrPanic< CPresenceInfoFieldImp >::From( *aObject ); + CPresenceInfoFieldImp* obj = iFields[ i ]; + if ( &(gotObj->Base()) == &(obj->Base()) ) + { + found = ETrue; + start = i; + } + } + } + + return start; + } + +// --------------------------------------------------------------------------- +// CPresenceInfoFieldCollectionImp::RemoveFieldL +// --------------------------------------------------------------------------- +// +void CPresenceInfoFieldCollectionImp::RemoveField( TInt aIndex ) + { + CPresenceInfoFieldImp* field = iFields[ aIndex ]; + iFields.Remove( aIndex ); + delete field; + } + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencedatamodel/presenceinfo/presenceinfofieldcollectionimp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencedatamodel/presenceinfo/presenceinfofieldcollectionimp.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,149 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of presence info field collection. + * +*/ + + +#ifndef CPRESENCEINFOFIELDCOLLECTIONIMP_H +#define CPRESENCEINFOFIELDCOLLECTIONIMP_H + +#include +#include // RWriteStream, RReadStream +#include +#include +#include "ximpapidataobjbase.h" +#include "presenceapiobjbase.h" +#include "presencetypehelpers.h" +#include "presenceinfofieldcollection.h" + +class MPresenceInfoField; +class CPresenceInfoFilterImp; + +/** + * Implementation of presence info field collection. + * + * + * + * + * @ingroup ximpdatamodelapi + * @since S60 v3.2 + */ +NONSHARABLE_CLASS( CPresenceInfoFieldCollectionImp ): public CXIMPApiDataObjBase, + public MPresenceInfoFieldCollection + { +public: + + /** The class ID. */ + enum { KClassId = PRIMP_CLSID_CPRESENCEINFOFIELDCOLLECTIONIMP }; + +public: + + IMPORT_C static CPresenceInfoFieldCollectionImp* NewLC(); + + virtual ~CPresenceInfoFieldCollectionImp(); + +private: + + CPresenceInfoFieldCollectionImp(); + + void ConstructL(); + + /** + * @see CXIMPApiDataObjBase + */ + XIMPIMP_DECLARE_DATAOBJ_BASE_PRIV_METHODS + +public: // From MXIMPBase + + /** + * Implementation of MXIMPBase interface methods + * @see MXIMPBase + */ + XIMPIMP_DECLARE_IF_BASE_METHODS + + /** + * @see CXIMPApiDataObjBase + */ + XIMPIMP_DECLARE_DATAOBJ_BASE_METHODS + +public: // New functions + + /** + * Internalizes object data from given stream. + * @param aStream Stream to read. + */ + IMPORT_C void InternalizeL( RReadStream& aStream ); + + +public: // from MPresenceInfoFieldCollection + + /** + * @see MPresenceInfoFieldCollection + */ + TInt FieldCount() const; + + /** + * @see MPresenceInfoFieldCollection + */ + const MPresenceInfoField& FieldAt( + TInt aIndex ) const; + + /** + * @see MPresenceInfoFieldCollection + */ + void LookupFieldByFieldType( + MPresenceInfoField*& aPresenceInfoField, + const TDesC8& aMatch ) const; + + /** + * @see MPresenceInfoFieldCollection + */ + TInt DeleteFieldByFieldType(const TDesC8& aMatch ); + + /** + * @see MPresenceInfoFieldCollection + */ + void AddOrReplaceFieldL( + MPresenceInfoField* aPresenceInfoField ); + +public: // new methods + + /** + * Remove from this field collection the field + * at the given index. + */ + void RemoveField( TInt aIndex ); + +private: // helpers + + /** + * Find index, starting at the given object. + * @return KErrNotFound if not found + * @return Otherwise returns the index of given object + */ + TInt FindIndexOfObj( MPresenceInfoField*& aObject ) const; + +private: // data + + /** + * OWN: The fields stored in this collection + */ + RPrInfoFieldArray iFields; + }; + +#endif // CPRESENCEINFOFIELDCOLLECTIONIMP_H + + + diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencedatamodel/presenceinfo/presenceinfofieldimp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencedatamodel/presenceinfo/presenceinfofieldimp.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,218 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MPresenceInfoField API object implementation. +* +*/ + + +#include "ximpbase.h" +#include "ximpapidataobjbase.h" +#include "presenceinfofield.h" +#include "presenceinfofieldimp.h" +#include "ximpidentityimp.h" +#include "ximprbufhelpers.h" +#include "ximpobjecthelpers.h" +#include "presenceapidataobjfactory.h" + +// ============================ MEMBER FUNCTIONS ============================= + +// --------------------------------------------------------------------------- +// CPresenceInfoFieldImp::NewLC() +// --------------------------------------------------------------------------- +// +EXPORT_C CPresenceInfoFieldImp* CPresenceInfoFieldImp::NewLC( + const TDesC8& aFieldName, + CXIMPApiDataObjBase* aFieldValue ) + { + CPresenceInfoFieldImp* self = new( ELeave ) CPresenceInfoFieldImp; + CleanupStack::PushL( self ); + self->ConstructL( aFieldName, aFieldValue ); + return self; + } + +// --------------------------------------------------------------------------- +// CPresenceInfoFieldImp::NewLC() +// --------------------------------------------------------------------------- +// +EXPORT_C CPresenceInfoFieldImp* CPresenceInfoFieldImp::NewLC() + { + CPresenceInfoFieldImp* self = new( ELeave ) CPresenceInfoFieldImp; + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + +// --------------------------------------------------------------------------- +// CPresenceInfoFieldImp::NewFromStreamLC() +// --------------------------------------------------------------------------- +// +XIMPIMP_IMPLEMENT_DATAOBJ_NEWFROMSTREAM( CPresenceInfoFieldImp ) + +// --------------------------------------------------------------------------- +// Implement supported interface access. +// --------------------------------------------------------------------------- +// +XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CPresenceInfoFieldImp, MPresenceInfoField ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() +XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CPresenceInfoFieldImp, MPresenceInfoField ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + +// --------------------------------------------------------------------------- +// CPresenceInfoFieldImp::~CPresenceInfoFieldImp() +// --------------------------------------------------------------------------- +// +CPresenceInfoFieldImp::~CPresenceInfoFieldImp() + { + iFieldName.Close(); + delete iFieldValue; + } + +// --------------------------------------------------------------------------- +// CPresenceInfoFieldImp::CPresenceInfoFieldImp() +// --------------------------------------------------------------------------- +// +CPresenceInfoFieldImp::CPresenceInfoFieldImp() + { + } + + +// --------------------------------------------------------------------------- +// CPresenceInfoFieldImp::ConstructL() +// --------------------------------------------------------------------------- +// +void CPresenceInfoFieldImp::ConstructL( const TDesC8& aFieldName, + CXIMPApiDataObjBase* aFieldValue ) + { + // if you give NULL you shall suffer + User::LeaveIfError( aFieldValue == NULL ? KErrArgument : KErrNone ); + + iFieldValue = aFieldValue; + iFieldName.CreateL( aFieldName ); + } + +// --------------------------------------------------------------------------- +// CPresenceInfoFieldImp::ConstructL() +// --------------------------------------------------------------------------- +// +void CPresenceInfoFieldImp::ConstructL() + { + iFieldName.CreateL( 0 ); + } + +// --------------------------------------------------------------------------- +// CPresenceInfoFieldImp::ExternalizeL() +// --------------------------------------------------------------------------- +// +void CPresenceInfoFieldImp::ExternalizeL( RWriteStream& aStream ) const + { + XIMPRBuf8Helper::ExternalizeL( iFieldName, aStream ); + CPresenceApiDataObjFactory::ExternalizeL( aStream, *iFieldValue ); + } + +// --------------------------------------------------------------------------- +// CPresenceInfoFieldImp::InternalizeL() +// --------------------------------------------------------------------------- +// +EXPORT_C void CPresenceInfoFieldImp::InternalizeL( RReadStream& aStream ) + { + XIMPRBuf8Helper::InternalizeL( iFieldName, aStream ); + + CXIMPApiDataObjBase* tmp = CPresenceApiDataObjFactory::InternalizeLC( aStream ); + delete iFieldValue; + iFieldValue = tmp; + CleanupStack::Pop( tmp ); + } + +// --------------------------------------------------------------------------- +// CPresenceInfoFieldImp::EqualsContent() +// --------------------------------------------------------------------------- +// +TBool CPresenceInfoFieldImp::EqualsContent( + const CXIMPApiDataObjBase& aOtherInstance ) const + { + const CPresenceInfoFieldImp* tmp = + TXIMPGetImpClassOrPanic< const CPresenceInfoFieldImp >::From( + aOtherInstance.Base() ); + + TBool same = ETrue; + TBool x; + x = 0 == iFieldName.Compare( tmp->iFieldName ); + same &= x; + + x = iFieldValue->EqualsContent( *( tmp->iFieldValue ) ); + same &= x; + return same; + } + + +// --------------------------------------------------------------------------- +// From MPresenceInfoField class. +// CPresenceInfoFieldImp::FieldType() +// --------------------------------------------------------------------------- +// +const TDesC8& CPresenceInfoFieldImp::FieldType() const + { + return iFieldName; + } + + +// --------------------------------------------------------------------------- +// From MPresenceInfoField class. +// CPresenceInfoFieldImp::FieldValue() +// --------------------------------------------------------------------------- +// +const MXIMPBase& CPresenceInfoFieldImp::FieldValue() const + { + return iFieldValue->Base(); + } + + +// --------------------------------------------------------------------------- +// From MPresenceInfoField class. +// CPresenceInfoFieldImp::FieldValue() +// --------------------------------------------------------------------------- +// +MXIMPBase& CPresenceInfoFieldImp::FieldValue() + { + return iFieldValue->Base(); + } + +// --------------------------------------------------------------------------- +// From MPresenceInfoField class. +// CPresenceInfoFieldImp::SetFieldValue +// --------------------------------------------------------------------------- +// +void CPresenceInfoFieldImp::SetFieldValue( MXIMPBase* aFieldValue ) + { + CXIMPApiDataObjBase* tmp = + TXIMPGetImpClassOrPanic< CXIMPApiDataObjBase >::From( + *aFieldValue ); + + delete iFieldValue; + iFieldValue = tmp; + } + +// --------------------------------------------------------------------------- +// From MPresenceInfoField class. +// CPresenceInfoFieldImp::SetFieldTypeL +// --------------------------------------------------------------------------- +// +void CPresenceInfoFieldImp::SetFieldTypeL( const TDesC8& aFieldType ) + { + HBufC8* newValue = aFieldType.AllocL(); + iFieldName.Close(); + iFieldName.Assign( newValue ); + } + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencedatamodel/presenceinfo/presenceinfofieldimp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencedatamodel/presenceinfo/presenceinfofieldimp.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,112 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of presence info field object. +* +*/ + +#ifndef CPRESENCEINFOFIELDIMP_H +#define CPRESENCEINFOFIELDIMP_H + +#include +#include // RWriteStream, RReadStream +#include +#include +#include "ximpapidataobjbase.h" +#include "presenceapiobjbase.h" +#include "presenceinfofield.h" + +/** + * Implementation of presence info field object. + * + * + * @since S60 v3.2 + */ +NONSHARABLE_CLASS( CPresenceInfoFieldImp ): public CXIMPApiDataObjBase, + public MPresenceInfoField + { + public: + + /** The class ID. */ + enum { KClassId = PRIMP_CLSID_CPRESENCEINFOFIELDIMP }; + +public: + + IMPORT_C static CPresenceInfoFieldImp* NewLC( const TDesC8& aFieldName, + CXIMPApiDataObjBase* aFieldValue ); + + IMPORT_C static CPresenceInfoFieldImp* NewLC(); + + virtual ~CPresenceInfoFieldImp(); + +private: + + CPresenceInfoFieldImp(); + + void ConstructL( const TDesC8& aFieldName, + CXIMPApiDataObjBase* aFieldValue ); + + void ConstructL(); + + /** + * @see CXIMPApiDataObjBase + */ + XIMPIMP_DECLARE_DATAOBJ_BASE_PRIV_METHODS + +public: // From MXIMPBase + + /** + * Implementation of MXIMPBase interface methods + * @see MXIMPBase + */ + XIMPIMP_DECLARE_IF_BASE_METHODS + + /** + * @see CXIMPApiDataObjBase + */ + XIMPIMP_DECLARE_DATAOBJ_BASE_METHODS + +public: // New functions + + /** + * Internalizes object data from given stream. + * @param aStream Stream to read. + */ + IMPORT_C void InternalizeL( RReadStream& aStream ); + + +public: // from MPresenceInfoField + + /** + * @see MPresenceInfoField + */ + const TDesC8& FieldType() const; + const MXIMPBase& FieldValue() const; + MXIMPBase& FieldValue(); + void SetFieldValue( MXIMPBase* aFieldValue ); + void SetFieldTypeL( const TDesC8& aFieldType ); + +private: // data + + // owned. name of the field + RBuf8 iFieldName; + + // owned. the actual field. + CXIMPApiDataObjBase* iFieldValue; + }; + + +#endif // CPRESENCEINFOFIELDIMP_H + + + diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencedatamodel/presenceinfo/presenceinfofieldvaluebinaryimp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencedatamodel/presenceinfo/presenceinfofieldvaluebinaryimp.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,198 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MPresenceInfoFieldValueText API object implementation. + * +*/ + + +#include "presenceinfofieldvaluebinaryimp.h" +#include "presenceinfofieldvaluebinary.h" +#include "ximprbufhelpers.h" +#include "ximpobjecthelpers.h" + +// ============================ MEMBER FUNCTIONS ============================= + +// --------------------------------------------------------------------------- +// CPresenceInfoFieldValueBinaryImp::NewLC() +// --------------------------------------------------------------------------- +// +EXPORT_C CPresenceInfoFieldValueBinaryImp* CPresenceInfoFieldValueBinaryImp::NewLC( + TInt aMaxLength /* = NPresenceInfo::KPrValueLengthUnlimited */ + ) + { + CPresenceInfoFieldValueBinaryImp* self = new ( ELeave ) CPresenceInfoFieldValueBinaryImp( aMaxLength ); + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + +// --------------------------------------------------------------------------- +// CPresenceInfoFieldValueBinaryImp::NewFromStreamLC() +// --------------------------------------------------------------------------- +// +XIMPIMP_IMPLEMENT_DATAOBJ_NEWFROMSTREAM( CPresenceInfoFieldValueBinaryImp ) + +// --------------------------------------------------------------------------- +// Implement supported interface access. +// --------------------------------------------------------------------------- +// +XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CPresenceInfoFieldValueBinaryImp, MPresenceInfoFieldValueBinary ) + XIMPIMP_IF_BASE_GET_CLASS( CXIMPApiDataObjBase, this ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() +XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CPresenceInfoFieldValueBinaryImp, MPresenceInfoFieldValueBinary ) + XIMPIMP_IF_BASE_GET_CONST_CLASS( CXIMPApiDataObjBase, this ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + +// --------------------------------------------------------------------------- +// CPresenceInfoFieldValueBinaryImp::~CPresenceInfoFieldValueBinaryImp() +// --------------------------------------------------------------------------- +// +CPresenceInfoFieldValueBinaryImp::~CPresenceInfoFieldValueBinaryImp() + { + iValue.Close(); + iMimeType.Close(); + } + +// --------------------------------------------------------------------------- +// CPresenceInfoFieldValueBinaryImp::CPresenceInfoFieldValueBinaryImp() +// --------------------------------------------------------------------------- +// +CPresenceInfoFieldValueBinaryImp::CPresenceInfoFieldValueBinaryImp( + TInt aMaxLength ) + { + iMaxLength = aMaxLength; + } + +// --------------------------------------------------------------------------- +// CPresenceInfoFieldValueBinaryImp::CPresenceInfoFieldValueBinaryImp() +// --------------------------------------------------------------------------- +// +CPresenceInfoFieldValueBinaryImp::CPresenceInfoFieldValueBinaryImp() + { + // nothing + } + +// --------------------------------------------------------------------------- +// CPresenceInfoFieldValueBinaryImp::ConstructL() +// --------------------------------------------------------------------------- +// +void CPresenceInfoFieldValueBinaryImp::ConstructL() + { + // always allocate a 0-length here, then in the setter enforce + // the maximal length + iValue.CreateL( 0 ); + iMimeType.CreateL( 0 ); + } + +// --------------------------------------------------------------------------- +// CPresenceInfoFieldValueBinaryImp::ExternalizeL() +// --------------------------------------------------------------------------- +// +void CPresenceInfoFieldValueBinaryImp::ExternalizeL( RWriteStream& aStream ) const + { + XIMPRBuf8Helper::ExternalizeL( iValue, aStream ); + XIMPRBuf8Helper::ExternalizeL( iMimeType, aStream ); + aStream.WriteInt32L( iMaxLength ); + } + +// --------------------------------------------------------------------------- +// CPresenceInfoFieldValueBinaryImp::InternalizeL() +// --------------------------------------------------------------------------- +// +EXPORT_C void CPresenceInfoFieldValueBinaryImp::InternalizeL( RReadStream& aStream ) + { + XIMPRBuf8Helper::InternalizeL( iValue, aStream ); + XIMPRBuf8Helper::InternalizeL( iMimeType, aStream ); + iMaxLength = aStream.ReadInt32L(); + } + +// --------------------------------------------------------------------------- +// CPresenceInfoFieldValueBinaryImp::EqualsContent() +// --------------------------------------------------------------------------- +// +TBool CPresenceInfoFieldValueBinaryImp::EqualsContent( + const CXIMPApiDataObjBase& aOtherInstance ) const + { + const CPresenceInfoFieldValueBinaryImp* tmp = + TXIMPGetImpClassOrPanic< const CPresenceInfoFieldValueBinaryImp >::From( + aOtherInstance.Base() ); + + TBool same = ETrue; + TBool x; + x = 0 == iValue.Compare( tmp->iValue ); + same &= x; + + x = 0 == iMimeType.Compare( tmp->iMimeType ); + same &= x; + + x = iMaxLength == tmp->iMaxLength; + same &= x; + + return same; + } + +// --------------------------------------------------------------------------- +// CPresenceInfoFieldValueBinaryImp::MaxLength() +// --------------------------------------------------------------------------- +// +TInt CPresenceInfoFieldValueBinaryImp::MaxLength() const + { + return iMaxLength; + } + +// --------------------------------------------------------------------------- +// CPresenceInfoFieldValueBinaryImp::BinaryValue() +// --------------------------------------------------------------------------- +// +TPtrC8 CPresenceInfoFieldValueBinaryImp::BinaryValue() const + { + return iValue; + } + +// --------------------------------------------------------------------------- +// CPresenceInfoFieldValueBinaryImp::MimeType() +// --------------------------------------------------------------------------- +// +const TPtrC8 CPresenceInfoFieldValueBinaryImp::MimeType() const + { + return iMimeType; + } + +// --------------------------------------------------------------------------- +// CPresenceInfoFieldValueBinaryImp::SetBinaryValueL() +// --------------------------------------------------------------------------- +// +void CPresenceInfoFieldValueBinaryImp::SetBinaryValueL( const TDesC8& aValue ) + { + // maximal length might be enforced + User::LeaveIfError( ( iMaxLength != NPresenceInfo::KValueLengthUnlimited ) && + ( iMaxLength < aValue.Length() ) ? KErrOverflow : KErrNone ); + + HBufC8* tmp = aValue.AllocL(); + iValue.Close(); + iValue.Assign( tmp ); + } + +// --------------------------------------------------------------------------- +// CPresenceInfoFieldValueBinaryImp::SetMimeTypeL +// --------------------------------------------------------------------------- +// +void CPresenceInfoFieldValueBinaryImp::SetMimeTypeL( const TDesC8& aValue ) + { + HBufC8* tmp = aValue.AllocL(); + iMimeType.Close(); + iMimeType.Assign( tmp ); + } + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencedatamodel/presenceinfo/presenceinfofieldvaluebinaryimp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencedatamodel/presenceinfo/presenceinfofieldvaluebinaryimp.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,136 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of presence info field binary value object. +* +*/ + +#ifndef CPRESENCEINFOFIELDVALUEBINARYIMP_H +#define CPRESENCEINFOFIELDVALUEBINARYIMP_H + +#include +#include // RWriteStream, RReadStream +#include +#include +#include "presenceinfo.h" +#include "ximpapidataobjbase.h" +#include "presenceinfofieldvaluebinary.h" +#include "presenceapiobjbase.h" + +/** + * Implementation of presence info field binary value object. + * + * + * + * + * @ingroup ximpdatamodelapi + * @since S60 v3.2 + */ +NONSHARABLE_CLASS( CPresenceInfoFieldValueBinaryImp ): public CXIMPApiDataObjBase, + public MPresenceInfoFieldValueBinary + { +public: + + /** The class ID. */ + enum { KClassId = PRIMP_CLSID_CPRESENCEINFOFIELDVALUEBINARYIMP }; + +public: + + /** + * @param aMaxLength NPresenceInfo::KPrValueLengthUnlimited to not enforce + * length limits + */ + IMPORT_C static CPresenceInfoFieldValueBinaryImp* NewLC( + TInt aMaxLength = NPresenceInfo::KValueLengthUnlimited ); + + virtual ~CPresenceInfoFieldValueBinaryImp(); + +private: + + CPresenceInfoFieldValueBinaryImp( TInt aMaxLength ); + CPresenceInfoFieldValueBinaryImp(); + + void ConstructL(); + + /** + * @see CXIMPApiDataObjBase + */ + XIMPIMP_DECLARE_DATAOBJ_BASE_PRIV_METHODS + +public: // From MXIMPBase + + /** + * Implementation of MXIMPBase interface methods + * @see MXIMPBase + */ + XIMPIMP_DECLARE_IF_BASE_METHODS + + /** + * @see CXIMPApiDataObjBase + */ + XIMPIMP_DECLARE_DATAOBJ_BASE_METHODS + +public: // New functions + + /** + * Internalizes object data from given stream. + * @param aStream Stream to read. + */ + IMPORT_C void InternalizeL( RReadStream& aStream ); + + +public: // from MPresenceInfoFieldValueBinary + + /** + * @see MPresenceInfoFieldValueBinary + */ + TInt MaxLength() const; + + /** + * @see MPresenceInfoFieldValueBinary + */ + TPtrC8 BinaryValue() const; + + /** + * @see MPresenceInfoFieldValueBinary + */ + const TPtrC8 MimeType() const; + + /** + * @see MPresenceInfoFieldValueBinary + */ + void SetBinaryValueL( + const TDesC8& aValue ); + + /** + * @see MPresenceInfoFieldValueBinary + */ + void SetMimeTypeL( + const TDesC8& aMimeType ); + +private: // data + + // owned. field value + RBuf8 iValue; + + // owned. mime type + RBuf8 iMimeType; + + // maximum length of field value + TInt iMaxLength; + }; + +#endif // CPRESENCEINFOFIELDVALUEBINARYIMP_H + + + diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencedatamodel/presenceinfo/presenceinfofieldvalueenumimp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencedatamodel/presenceinfo/presenceinfofieldvalueenumimp.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,179 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MPresenceInfoFieldValueEnum API object implementation. + * +*/ + + +#include "presenceinfofieldvalueenumimp.h" +#include "presenceinfofieldvalueenum.h" +#include "ximprbufhelpers.h" +#include "ximpobjecthelpers.h" + +// ============================ MEMBER FUNCTIONS ============================= + +// --------------------------------------------------------------------------- +// CPresenceInfoFieldValueEnumImp::NewLC() +// --------------------------------------------------------------------------- +// +EXPORT_C CPresenceInfoFieldValueEnumImp* CPresenceInfoFieldValueEnumImp::NewLC() + { + CPresenceInfoFieldValueEnumImp* self = new ( ELeave ) CPresenceInfoFieldValueEnumImp(); + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + +// --------------------------------------------------------------------------- +// CPresenceInfoFieldValueEnumImp::NewFromStreamLC() +// --------------------------------------------------------------------------- +// +XIMPIMP_IMPLEMENT_DATAOBJ_NEWFROMSTREAM( CPresenceInfoFieldValueEnumImp ) + +// --------------------------------------------------------------------------- +// Implement supported interface access. +// --------------------------------------------------------------------------- +// +XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CPresenceInfoFieldValueEnumImp, MPresenceInfoFieldValueEnum ) + XIMPIMP_IF_BASE_GET_CLASS( CXIMPApiDataObjBase, this ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() +XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CPresenceInfoFieldValueEnumImp, MPresenceInfoFieldValueEnum ) + XIMPIMP_IF_BASE_GET_CONST_CLASS( CXIMPApiDataObjBase, this ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + +// --------------------------------------------------------------------------- +// CPresenceInfoFieldValueEnumImp::~CPresenceInfoFieldValueEnumImp() +// --------------------------------------------------------------------------- +// +CPresenceInfoFieldValueEnumImp::~CPresenceInfoFieldValueEnumImp() + { + // nothing + } + +// --------------------------------------------------------------------------- +// CPresenceInfoFieldValueEnumImp::CPresenceInfoFieldValueEnumImp() +// --------------------------------------------------------------------------- +// +CPresenceInfoFieldValueEnumImp::CPresenceInfoFieldValueEnumImp() + { + // nothing + iMaxValue = KMaxTInt32; + iMinValue = KMinTInt32; + } + +// --------------------------------------------------------------------------- +// CPresenceInfoFieldValueEnumImp::ConstructL() +// --------------------------------------------------------------------------- +// +void CPresenceInfoFieldValueEnumImp::ConstructL() + { + // nothing + } + +// --------------------------------------------------------------------------- +// CPresenceInfoFieldValueEnumImp::ExternalizeL() +// --------------------------------------------------------------------------- +// +void CPresenceInfoFieldValueEnumImp::ExternalizeL( RWriteStream& aStream ) const + { + aStream.WriteInt32L( iMaxValue ); + aStream.WriteInt32L( iMinValue ); + aStream.WriteInt32L( iValue ); + } + +// --------------------------------------------------------------------------- +// CPresenceInfoFieldValueEnumImp::InternalizeL() +// --------------------------------------------------------------------------- +// +EXPORT_C void CPresenceInfoFieldValueEnumImp::InternalizeL( RReadStream& aStream ) + { + iMaxValue = aStream.ReadInt32L(); + iMinValue = aStream.ReadInt32L(); + iValue = aStream.ReadInt32L(); + } + +// --------------------------------------------------------------------------- +// CPresenceInfoFieldValueEnumImp::EqualsContent() +// --------------------------------------------------------------------------- +// +TBool CPresenceInfoFieldValueEnumImp::EqualsContent( + const CXIMPApiDataObjBase& aOtherInstance ) const + { + const CPresenceInfoFieldValueEnumImp* tmp = + TXIMPGetImpClassOrPanic< const CPresenceInfoFieldValueEnumImp >::From( + aOtherInstance.Base() ); + + TBool same = ETrue; + TBool x = iMaxValue == tmp->iMaxValue; + same &= x; + + x = iMinValue == tmp->iMinValue; + same &= x; + + x = iValue == tmp->iValue; + same &= x; + + return same; + } + +// --------------------------------------------------------------------------- +// CPresenceInfoFieldValueEnumImp::MinValue() +// --------------------------------------------------------------------------- +// +TInt CPresenceInfoFieldValueEnumImp::MinValue() const + { + return iMinValue; + } + +// --------------------------------------------------------------------------- +// CPresenceInfoFieldValueEnumImp::MaxValue() +// --------------------------------------------------------------------------- +// +TInt CPresenceInfoFieldValueEnumImp::MaxValue() const + { + return iMaxValue; + } + +// --------------------------------------------------------------------------- +// CPresenceInfoFieldValueEnumImp::Value() +// --------------------------------------------------------------------------- +// +TInt CPresenceInfoFieldValueEnumImp::Value() const + { + return iValue; + } + +// --------------------------------------------------------------------------- +// CPresenceInfoFieldValueEnumImp::SetValueL +// --------------------------------------------------------------------------- +// +void CPresenceInfoFieldValueEnumImp::SetValueL( TInt aValue ) + { + User::LeaveIfError( aValue > iMaxValue ? KErrOverflow : KErrNone ); + User::LeaveIfError( aValue < iMinValue ? KErrUnderflow : KErrNone ); + + iValue = aValue; + } + +// --------------------------------------------------------------------------- +// CPresenceInfoFieldValueEnumImp::SetLimits +// --------------------------------------------------------------------------- +// +void CPresenceInfoFieldValueEnumImp::SetLimits( TInt aMin, TInt aMax ) + { + iMinValue = aMin; + iMaxValue = aMax; + } + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencedatamodel/presenceinfo/presenceinfofieldvalueenumimp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencedatamodel/presenceinfo/presenceinfofieldvalueenumimp.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,116 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of presence info field enum value object. +* +*/ + +#ifndef CPRESENCEINFOFIELDVALUEENUMIMP_H +#define CPRESENCEINFOFIELDVALUEENUMIMP_H + +#include +#include // RWriteStream, RReadStream +#include +#include +#include "ximpapidataobjbase.h" +#include "presenceapiobjbase.h" +#include "presenceinfofieldvalueenum.h" + + +/** + * Implementation of presence info field enum value object. + * + * + * + * + * @ingroup ximpdatamodelapi + * @since S60 v3.2 + */ +NONSHARABLE_CLASS( CPresenceInfoFieldValueEnumImp ): public CXIMPApiDataObjBase, + public MPresenceInfoFieldValueEnum + { +public: + + /** The class ID. */ + enum { KClassId = PRIMP_CLSID_CPRESENCEINFOFIELDVALUEENUMIMP }; + +public: + + /** + * @param aMaxLength KXIMPFieldValueLengthUnlimited to not enforce + * length limits + */ + IMPORT_C static CPresenceInfoFieldValueEnumImp* NewLC(); + + virtual ~CPresenceInfoFieldValueEnumImp(); + +private: + + CPresenceInfoFieldValueEnumImp(); + + void ConstructL(); + + /** + * @see CXIMPApiDataObjBase + */ + XIMPIMP_DECLARE_DATAOBJ_BASE_PRIV_METHODS + +public: // From MXIMPBase + + /** + * Implementation of MXIMPBase interface methods + * @see MXIMPBase + */ + XIMPIMP_DECLARE_IF_BASE_METHODS + + /** + * @see CXIMPApiDataObjBase + */ + XIMPIMP_DECLARE_DATAOBJ_BASE_METHODS + +public: // New functions + + /** + * Internalizes object data from given stream. + * @param aStream Stream to read. + */ + IMPORT_C void InternalizeL( RReadStream& aStream ); + + +public: // from MPresenceInfoFieldValueEnum + + /** + * @see MPresenceInfoFieldValueEnum + */ + TInt MinValue() const; + TInt MaxValue() const; + TInt Value() const; + void SetValueL( TInt aValue ); + void SetLimits( TInt aMin, TInt aMax ); + +private: // data + + // maximum allowed value + TInt iMaxValue; + + // minimum allowed value + TInt iMinValue; + + // actual value + TInt iValue; + }; + +#endif // CPRESENCEINFOFIELDVALUEENUMIMP_H + + + diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencedatamodel/presenceinfo/presenceinfofieldvaluetextimp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencedatamodel/presenceinfo/presenceinfofieldvaluetextimp.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,172 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MPresenceInfoFieldValueText API object implementation. + * +*/ + + +#include "presenceinfofieldvaluetextimp.h" +#include "presenceinfofieldvaluetext.h" +#include "ximprbufhelpers.h" +#include "ximpobjecthelpers.h" +#include "presenceinfo.h" + +// ============================ MEMBER FUNCTIONS ============================= + +// --------------------------------------------------------------------------- +// CPresenceInfoFieldValueTextImp::NewLC() +// --------------------------------------------------------------------------- +// +EXPORT_C CPresenceInfoFieldValueTextImp* CPresenceInfoFieldValueTextImp::NewLC( + TInt aMaxLength /* = NPresenceInfo::KValueLengthUnlimited */ + ) + { + CPresenceInfoFieldValueTextImp* self = new ( ELeave ) CPresenceInfoFieldValueTextImp( aMaxLength ); + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + +// --------------------------------------------------------------------------- +// CPresenceInfoFieldValueTextImp::NewFromStreamLC() +// --------------------------------------------------------------------------- +// +XIMPIMP_IMPLEMENT_DATAOBJ_NEWFROMSTREAM( CPresenceInfoFieldValueTextImp ) + +// --------------------------------------------------------------------------- +// Implement supported interface access. +// --------------------------------------------------------------------------- +// +XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CPresenceInfoFieldValueTextImp, MPresenceInfoFieldValueText ) + XIMPIMP_IF_BASE_GET_CLASS( CXIMPApiDataObjBase, this ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() +XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CPresenceInfoFieldValueTextImp, MPresenceInfoFieldValueText ) + XIMPIMP_IF_BASE_GET_CONST_CLASS( CXIMPApiDataObjBase, this ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + +// --------------------------------------------------------------------------- +// CPresenceInfoFieldValueTextImp::~CPresenceInfoFieldValueTextImp() +// --------------------------------------------------------------------------- +// +CPresenceInfoFieldValueTextImp::~CPresenceInfoFieldValueTextImp() + { + iFieldValue.Close(); + } + +// --------------------------------------------------------------------------- +// CPresenceInfoFieldValueTextImp::CPresenceInfoFieldValueTextImp() +// --------------------------------------------------------------------------- +// +CPresenceInfoFieldValueTextImp::CPresenceInfoFieldValueTextImp( + TInt aMaxLength ) + { + iMaxLength = aMaxLength; + } + +// --------------------------------------------------------------------------- +// CPresenceInfoFieldValueTextImp::CPresenceInfoFieldValueTextImp() +// --------------------------------------------------------------------------- +// +CPresenceInfoFieldValueTextImp::CPresenceInfoFieldValueTextImp() + { + // nothing + } + +// --------------------------------------------------------------------------- +// CPresenceInfoFieldValueTextImp::ConstructL() +// --------------------------------------------------------------------------- +// +void CPresenceInfoFieldValueTextImp::ConstructL() + { + // always allocate a 0-length here, then in the setter enforce + // the maximal length + iFieldValue.CreateL( 0 ); + } + +// --------------------------------------------------------------------------- +// CPresenceInfoFieldValueTextImp::ExternalizeL() +// --------------------------------------------------------------------------- +// +void CPresenceInfoFieldValueTextImp::ExternalizeL( RWriteStream& aStream ) const + { + XIMPRBuf16Helper::ExternalizeL( iFieldValue, aStream ); + aStream.WriteInt32L( iMaxLength ); + } + +// --------------------------------------------------------------------------- +// CPresenceInfoFieldValueTextImp::InternalizeL() +// --------------------------------------------------------------------------- +// +EXPORT_C void CPresenceInfoFieldValueTextImp::InternalizeL( RReadStream& aStream ) + { + XIMPRBuf16Helper::InternalizeL( iFieldValue, aStream ); + iMaxLength = aStream.ReadInt32L(); + } + +// --------------------------------------------------------------------------- +// CPresenceInfoFieldValueTextImp::EqualsContent() +// --------------------------------------------------------------------------- +// +TBool CPresenceInfoFieldValueTextImp::EqualsContent( + const CXIMPApiDataObjBase& aOtherInstance ) const + { + const CPresenceInfoFieldValueTextImp* tmp = + TXIMPGetImpClassOrPanic< const CPresenceInfoFieldValueTextImp >::From( + aOtherInstance.Base() ); + + TBool same = ETrue; + TBool x; + x = 0 == iFieldValue.Compare( tmp->iFieldValue ); + same &= x; + + x = iMaxLength == tmp->iMaxLength; + same &= x; + + return same; + } + +// --------------------------------------------------------------------------- +// CPresenceInfoFieldValueTextImp::MaxLength() +// --------------------------------------------------------------------------- +// +TInt CPresenceInfoFieldValueTextImp::MaxLength() const + { + return iMaxLength; + } + +// --------------------------------------------------------------------------- +// CPresenceInfoFieldValueTextImp::TextValue() +// --------------------------------------------------------------------------- +// +TPtrC CPresenceInfoFieldValueTextImp::TextValue() const + { + return iFieldValue; + } + +// --------------------------------------------------------------------------- +// CPresenceInfoFieldValueTextImp::SetTextValueL() +// --------------------------------------------------------------------------- +// +void CPresenceInfoFieldValueTextImp::SetTextValueL( const TDesC& aValue ) + { + // maximal length might be enforced + User::LeaveIfError( ( iMaxLength != NPresenceInfo::KValueLengthUnlimited ) + && ( iMaxLength < aValue.Length() ) ? KErrOverflow : KErrNone ); + + HBufC16* tmp = aValue.AllocL(); + iFieldValue.Close(); + iFieldValue.Assign( tmp ); + } + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencedatamodel/presenceinfo/presenceinfofieldvaluetextimp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencedatamodel/presenceinfo/presenceinfofieldvaluetextimp.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,122 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of presence info field text value object. +* +*/ + +#ifndef CPRESENCEINFOFIELDVALUETEXTIMP_H +#define CPRESENCEINFOFIELDVALUETEXTIMP_H + +#include +#include // RWriteStream, RReadStream +#include +#include +#include "presenceinfo.h" +#include "ximpapidataobjbase.h" +#include "presenceapiobjbase.h" +#include "presenceinfofieldvaluetext.h" + + +/** + * Implementation of presence info field text value object. + * + * + * + * + * @ingroup ximpdatamodelapi + * @since S60 v3.2 + */ +NONSHARABLE_CLASS( CPresenceInfoFieldValueTextImp ): public CXIMPApiDataObjBase, + public MPresenceInfoFieldValueText + { +public: + + /** The class ID. */ + enum { KClassId = PRIMP_CLSID_CPRESENCEINFOFIELDVALUETEXTIMP }; + +public: + + /** + * @param aMaxLength NPresenceInfo::KPrValueLengthUnlimited to not enforce + * length limits + */ + IMPORT_C static CPresenceInfoFieldValueTextImp* NewLC( + TInt aMaxLength = NPresenceInfo::KValueLengthUnlimited ); + + virtual ~CPresenceInfoFieldValueTextImp(); + +private: + + CPresenceInfoFieldValueTextImp( TInt aMaxLength ); + CPresenceInfoFieldValueTextImp(); + + void ConstructL(); + + /** + * @see CXIMPApiDataObjBase + */ + XIMPIMP_DECLARE_DATAOBJ_BASE_PRIV_METHODS + +public: // From MXIMPBase + + /** + * Implementation of MXIMPBase interface methods + * @see MXIMPBase + */ + XIMPIMP_DECLARE_IF_BASE_METHODS + + /** + * @see CXIMPApiDataObjBase + */ + XIMPIMP_DECLARE_DATAOBJ_BASE_METHODS + +public: // New functions + + /** + * Internalizes object data from given stream. + * @param aStream Stream to read. + */ + IMPORT_C void InternalizeL( RReadStream& aStream ); + + +public: // from MPresenceInfoFieldValueText + + /** + * @see MPresenceInfoFieldValueText + */ + TInt MaxLength() const; + + /** + * @see MPresenceInfoFieldValueText + */ + TPtrC TextValue() const; + + /** + * @see MPresenceInfoFieldValueText + */ + void SetTextValueL( const TDesC& aValue ); + +private: // data + + // owned. field value + RBuf16 iFieldValue; + + // maximum length of field value + TInt iMaxLength; + }; + +#endif // CPRESENCEINFOFIELDVALUETEXTIMP_H + + + diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencedatamodel/presenceinfo/presenceinfofilterimp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencedatamodel/presenceinfo/presenceinfofilterimp.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,810 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MPresenceDocument API object implementation. +* +*/ + + +#include "presenceinfofilterimp.h" +#include "ximprbufhelpers.h" +#include "ximpobjecthelpers.h" +#include "presenceinfo.h" +#include "badesca.h" + +const TInt KFilterGranularity = 3; +const TInt KFieldGranularity = 3; + +using namespace NPresenceInfo; + +// ============================ LOCAL FUNCTIONS ============================== + +// ============================ HELPER CLASS ================================= + +// --------------------------------------------------------------------------- +// CFilterField::NewL +// --------------------------------------------------------------------------- +// +CPresenceInfoFilterImp::CFilterField* +CPresenceInfoFilterImp::CFilterField::NewL( + const TDesC8& aInfoName ) + { + CFilterField* self = new ( ELeave ) CFilterField(); + CleanupStack::PushL( self ); + self->ConstructL( aInfoName ); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// CFilterField::NewLC +// --------------------------------------------------------------------------- +// +CPresenceInfoFilterImp::CFilterField* +CPresenceInfoFilterImp::CFilterField::NewLC() + { + CFilterField* self = new ( ELeave ) CFilterField(); + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + +// --------------------------------------------------------------------------- +// CFilterField::ConstructL +// --------------------------------------------------------------------------- +// +void CPresenceInfoFilterImp::CFilterField::ConstructL( + const TDesC8& aInfoName ) + { + HBufC8* tmp = aInfoName.AllocL(); + iInfoName.Assign( tmp ); + + iFieldNames = new ( ELeave ) CDesC8ArraySeg( KFieldGranularity ); + } + +// --------------------------------------------------------------------------- +// CFilterField::ConstructL +// --------------------------------------------------------------------------- +// +void CPresenceInfoFilterImp::CFilterField::ConstructL() + { + iInfoName.CreateL( 0 ); + iFieldNames = new ( ELeave ) CDesC8ArraySeg( KFieldGranularity ); + } + +// --------------------------------------------------------------------------- +// CFilterField::CFilterField +// --------------------------------------------------------------------------- +// +CPresenceInfoFilterImp::CFilterField::CFilterField() + { + } + +// --------------------------------------------------------------------------- +// CFilterField::~CFilterField +// --------------------------------------------------------------------------- +// +CPresenceInfoFilterImp::CFilterField::~CFilterField() + { + iInfoName.Close(); + delete iFieldNames; + } + +// --------------------------------------------------------------------------- +// CFilterField::InfoName +// --------------------------------------------------------------------------- +// +const TDesC8& CPresenceInfoFilterImp::CFilterField::InfoName() + { + return iInfoName; + } + +// --------------------------------------------------------------------------- +// CFilterField::AddFieldNameL +// --------------------------------------------------------------------------- +// +void CPresenceInfoFilterImp::CFilterField::AddFieldNameL( + const TDesC8& aFieldName ) + { + iFieldNames->InsertIsqL( aFieldName ); + } + +// --------------------------------------------------------------------------- +// CFilterField::OrderOfFields() +// --------------------------------------------------------------------------- +// +TInt CPresenceInfoFilterImp::CFilterField::OrderOfFields( + const CFilterField& aFirst, + const CFilterField& aSecond ) + { + // order is based on the info name + return aFirst.iInfoName.Compare( aSecond.iInfoName ); + } + +// --------------------------------------------------------------------------- +// CFilterField::OrderOfFieldsByName() +// --------------------------------------------------------------------------- +// +TInt CPresenceInfoFilterImp::CFilterField::OrderOfFieldsByName( + const TDesC8* aName, + const CFilterField& aSecond ) + { + return aName->Compare( aSecond.iInfoName ); + } + +// --------------------------------------------------------------------------- +// CFilterField::ExternalizeL +// --------------------------------------------------------------------------- +// +void CPresenceInfoFilterImp::CFilterField::ExternalizeL( + RWriteStream& aStream ) const + { + XIMPRBuf8Helper::ExternalizeL( iInfoName, aStream ); + + aStream.WriteInt32L( iFieldNames->Count() ); + + for ( TInt i = 0; i < iFieldNames->Count(); i++ ) + { + TPtrC8 p = iFieldNames->MdcaPoint( i ); + aStream.WriteInt32L( p.Length() ); + aStream.WriteL( p ); + } + } + +// --------------------------------------------------------------------------- +// CFilterField::InternalizeL +// --------------------------------------------------------------------------- +// +void CPresenceInfoFilterImp::CFilterField::InternalizeL( + RReadStream& aStream ) + { + XIMPRBuf8Helper::InternalizeL( iInfoName, aStream ); + + TInt count = aStream.ReadInt32L(); + for ( TInt i = 0; i < count; i++ ) + { + TInt length = aStream.ReadInt32L(); + HBufC8* buf = HBufC8::NewLC( length ); + + TPtr8 des = TPtr8( buf->Des() ); + aStream.ReadL( des, length ); + iFieldNames->InsertIsqL( *buf ); + + CleanupStack::PopAndDestroy( buf ); + } + } + +// --------------------------------------------------------------------------- +// CFilterField::MergeL +// --------------------------------------------------------------------------- +// +void CPresenceInfoFilterImp::CFilterField::MergeL( CFilterField& aOtherField ) + { + // merge algorithm: + // add all field names from given filter field, ignoring duplicates + + for ( TInt i = 0; i < iFieldNames->Count(); i++ ) + { + TInt pos = 0; + TInt ret = iFieldNames->FindIsq( aOtherField.iFieldNames->MdcaPoint( i ), pos ); + + if ( 0 != ret ) + { + iFieldNames->InsertIsqL( aOtherField.iFieldNames->MdcaPoint( i ) ); + } + } + } + +// --------------------------------------------------------------------------- +// CFilterField::operator== +// --------------------------------------------------------------------------- +// +TBool CPresenceInfoFilterImp::CFilterField::operator==( const CFilterField& aSource ) + { + if( iInfoName.Compare( aSource.iInfoName ) != 0 ) + { + return EFalse; + } + TInt count = iFieldNames->Count(); + if( count != aSource.iFieldNames->Count() ) + { + return EFalse; + } + + for ( TInt i = 0; i < count; i++ ) + { + if( iFieldNames->MdcaPoint( i ).Compare( aSource.iFieldNames->MdcaPoint( i ) ) != 0 ) + { + return EFalse; + } + } + return ETrue; + } + +// --------------------------------------------------------------------------- +// CFilterField::operator!= +// --------------------------------------------------------------------------- +// +TBool CPresenceInfoFilterImp::CFilterField::operator!=( const CFilterField& aSource ) + { + return !( *this == aSource ); + } + +// ============================ MEMBER FUNCTIONS ============================= + +// --------------------------------------------------------------------------- +// CPresenceInfoFilterImp::NewLC() +// --------------------------------------------------------------------------- +// +EXPORT_C CPresenceInfoFilterImp* CPresenceInfoFilterImp::NewLC() + { + CPresenceInfoFilterImp* self = new( ELeave ) CPresenceInfoFilterImp; + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + +// --------------------------------------------------------------------------- +// CPresenceInfoFilterImp::NewL() +// --------------------------------------------------------------------------- +// +EXPORT_C CPresenceInfoFilterImp* CPresenceInfoFilterImp::NewL() + { + CPresenceInfoFilterImp* self = NewLC(); + CleanupStack::Pop( self ); + return self; + } +// --------------------------------------------------------------------------- +// CPresenceInfoImp::NewFromStreamLC() +// --------------------------------------------------------------------------- +// +XIMPIMP_IMPLEMENT_DATAOBJ_NEWFROMSTREAM( CPresenceInfoFilterImp ) + +// --------------------------------------------------------------------------- +// Implement supported interface access. +// --------------------------------------------------------------------------- +// +XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CPresenceInfoFilterImp, + MPresenceInfoFilter ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + + +XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CPresenceInfoFilterImp, + MPresenceInfoFilter ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + +// --------------------------------------------------------------------------- +// CPresenceInfoFilterImp::EqualsContent() +// --------------------------------------------------------------------------- +// +TBool CPresenceInfoFilterImp::EqualsContent( + const CXIMPApiDataObjBase& aOtherInstance ) const + { + const CPresenceInfoFilterImp* tmp = + TXIMPGetImpClassOrPanic< const CPresenceInfoFilterImp >::From( aOtherInstance.Base() ); + + TInt count = iPersonFilter->Count(); + if( count != tmp->iPersonFilter->Count() ) + { + return EFalse; + } + + for ( TInt i = 0; i < count; i++ ) + { + if( iPersonFilter->MdcaPoint( i ).Compare( tmp->iPersonFilter->MdcaPoint( i ) ) != 0 ) + { + return EFalse; + } + } + + count = iServiceFilter.Count(); + if( count != tmp->iServiceFilter.Count() ) + { + return EFalse; + } + + for( TInt a = 0; a < count; ++a ) + { + if( iServiceFilter[ a ] != tmp->iServiceFilter[ a ] ) + { + return EFalse; + } + } + + count = iDeviceFilter.Count(); + if( count != tmp->iDeviceFilter.Count() ) + { + return EFalse; + } + + for( TInt a = 0; a < count; ++a ) + { + if( iDeviceFilter[ a ] != tmp->iDeviceFilter[ a ] ) + { + return EFalse; + } + } + return ETrue; + } + +// --------------------------------------------------------------------------- +// CPresenceInfoFilterImp::CPresenceInfoFilterImp() +// --------------------------------------------------------------------------- +// +CPresenceInfoFilterImp::CPresenceInfoFilterImp() + { + } + + +// --------------------------------------------------------------------------- +// CPresenceInfoFilterImp::~CPresenceInfoFilterImp() +// --------------------------------------------------------------------------- +// +CPresenceInfoFilterImp::~CPresenceInfoFilterImp() + { + delete iPersonFilter; + iServiceFilter.ResetAndDestroy(); + iDeviceFilter.ResetAndDestroy(); + } + + + +// --------------------------------------------------------------------------- +// CPresenceInfoFilterImp::ConstructL() +// --------------------------------------------------------------------------- +// +void CPresenceInfoFilterImp::ConstructL() + { + iPersonFilter = new ( ELeave ) CDesC8ArraySeg( KFilterGranularity ); + } + +// --------------------------------------------------------------------------- +// CPresenceInfoFilterImp::ExternalizeArrayL() +// --------------------------------------------------------------------------- +// +void CPresenceInfoFilterImp::ExternalizeArrayL( + const CDesC8ArraySeg* aArray, RWriteStream& aStream ) const + { + aStream.WriteInt32L( aArray->Count() ); + + for ( TInt i = 0; i < aArray->Count(); i++ ) + { + TPtrC8 p = aArray->MdcaPoint( i ); + aStream.WriteInt32L( p.Length() ); + aStream.WriteL( p ); + } + } + +// --------------------------------------------------------------------------- +// CPresenceInfoFilterImp::ExternalizeFieldSetL +// --------------------------------------------------------------------------- +// +void CPresenceInfoFilterImp::ExternalizeFieldSetL( + const RXIMPObjOwningPtrArray& aFieldSet, + RWriteStream& aStream + ) const + { + TInt count = aFieldSet.Count(); + + aStream.WriteInt32L( count ); + for ( TInt i = 0; i < count; i++ ) + { + CFilterField* field = aFieldSet[ i ]; + field->ExternalizeL( aStream ); + } + } + +// --------------------------------------------------------------------------- +// CPresenceInfoFilterImp::InternalizeFieldSetL +// --------------------------------------------------------------------------- +// +void CPresenceInfoFilterImp::InternalizeFieldSetL( + RXIMPObjOwningPtrArray& aFieldSet, + RReadStream& aStream + ) + { + TInt count = aStream.ReadInt32L(); + + for ( TInt i = 0; i < count; i++ ) + { + CFilterField* field = CFilterField::NewLC(); + field->InternalizeL( aStream ); + aFieldSet.AppendL( field ); + CleanupStack::Pop( field ); + } + } + +// --------------------------------------------------------------------------- +// CPresenceInfoFilterImp::ExternalizeL() +// --------------------------------------------------------------------------- +// +EXPORT_C void CPresenceInfoFilterImp::ExternalizeL( RWriteStream& aStream ) const + { + ExternalizeArrayL( iPersonFilter, aStream ); + ExternalizeFieldSetL( iServiceFilter, aStream ); + ExternalizeFieldSetL( iDeviceFilter, aStream ); + } + +// --------------------------------------------------------------------------- +// CPresenceInfoFilterImp::InternalizeArrayL() +// --------------------------------------------------------------------------- +// +void CPresenceInfoFilterImp::InternalizeArrayL( + CDesC8ArraySeg* aArray, RReadStream& aStream ) + { + TInt count = aStream.ReadInt32L(); + for ( TInt i = 0; i < count; i++ ) + { + TInt length = aStream.ReadInt32L(); + + HBufC8* buf = HBufC8::NewLC( length ); + + TPtr8 des = TPtr8( buf->Des() ); + aStream.ReadL( des, length ); + aArray->InsertIsqL( des ); + + CleanupStack::PopAndDestroy( buf ); + } + } + + +// --------------------------------------------------------------------------- +// CPresenceInfoFilterImp::InternalizeL() +// --------------------------------------------------------------------------- +// +EXPORT_C void CPresenceInfoFilterImp::InternalizeL( RReadStream& aStream ) + { + InternalizeArrayL( iPersonFilter, aStream ); + InternalizeFieldSetL( iServiceFilter, aStream ); + InternalizeFieldSetL( iDeviceFilter, aStream ); + } + +// --------------------------------------------------------------------------- +// CPresenceInfoFilterImp::ContainsPersonFilter +// --------------------------------------------------------------------------- +// +TBool CPresenceInfoFilterImp::ContainsPersonFilter( + CDesC8ArraySeg* aA, + CDesC8ArraySeg* aCompare + ) + { + TInt count = aCompare->Count(); + if ( count >= aA->Count() ) + { + // impossible to be contained + return EFalse; + } + + for ( TInt i = 0; i < count; i++ ) + { + // all person filter strings in aCompare MUST be found in this class + TInt pos = 0; + if( 0 != aA->FindIsq( aCompare->MdcaPoint( i ), pos ) ) + { + // element not contained within "this", so whole filter not contained + return EFalse; + } + } + + return ETrue; + } + +// --------------------------------------------------------------------------- +// CPresenceInfoFilterImp::ContainsFilterFields +// --------------------------------------------------------------------------- +// +TBool CPresenceInfoFilterImp::ContainsFilterFields( + RXIMPObjOwningPtrArray& aA, + RXIMPObjOwningPtrArray& aCompare + ) + { + // check all filter fields + TInt count = aCompare.Count(); + if ( count >= aA.Count() ) + { + // impossible for "aCompare" to be contained, has more fields + return EFalse; + } + + for( TInt i = 0; i < count; i++ ) + { + // all filters in aCompare MUST be found in this class. + // first check for the named filter field class + TInt pos = 0; + pos = aA.FindInOrder( + aCompare[ i ]->InfoName(), + CFilterField::OrderOfFieldsByName ); + + if ( KErrNotFound == pos ) + { + // element not contained within "aA", so whole filter not contained + return EFalse; + } + + // now the subfields in the filter field class + TInt countFields = aCompare[ i ]->iFieldNames->MdcaCount(); + if ( countFields >= aA[ pos ]->iFieldNames->MdcaCount() ) + { + // impossible to be contained + return EFalse; + } + + for ( TInt j = 0; j < countFields; j++ ) + { + TInt dummyPos = 0; + if ( aA[ pos ]->iFieldNames->FindIsq( aCompare[ i ]->iFieldNames->MdcaPoint( j ), dummyPos ) ) + { + // field not contained within "aA", so whole + // filter not contained + return EFalse; + } + } + } + + return ETrue; + } + +// --------------------------------------------------------------------------- +// CPresenceInfoFilterImp::Contains +// --------------------------------------------------------------------------- +// +EXPORT_C TBool CPresenceInfoFilterImp::Contains( CPresenceInfoFilterImp& aCompare ) + { + // walk through all filters in aCompare, + // if a filter is NOT found in this class --> not contained + // if all filters are found in this class --> contained + + // person filter + if ( ! ContainsPersonFilter( iPersonFilter, aCompare.iPersonFilter ) ) + { + return EFalse; + } + + // service filter + if ( ! ContainsFilterFields( iServiceFilter, aCompare.iServiceFilter ) ) + { + return EFalse; + } + + // device filter + if ( ! ContainsFilterFields( iDeviceFilter, aCompare.iDeviceFilter ) ) + { + return EFalse; + } + + return ETrue; + } + +// --------------------------------------------------------------------------- +// CPresenceInfoFilterImp::operator== +// --------------------------------------------------------------------------- +// +EXPORT_C TBool CPresenceInfoFilterImp::operator==( CPresenceInfoFilterImp& aSource ) + { + return EqualsContent( aSource ); + } + +// --------------------------------------------------------------------------- +// CPresenceInfoFilterImp::operator!= +// --------------------------------------------------------------------------- +// +EXPORT_C TBool CPresenceInfoFilterImp::operator!=( CPresenceInfoFilterImp& aSource ) + { + return !EqualsContent( aSource ); + } + + +// --------------------------------------------------------------------------- +// CPresenceInfoFilterImp::AcceptPersonFilterL +// --------------------------------------------------------------------------- +// +void CPresenceInfoFilterImp::AcceptPersonFilterL( const TDesC8& aFieldName ) + { + if ( !aFieldName.Compare( NPresenceInfo::NFieldType::KAcceptAll ) ) + { + iPersonFilter->InsertIsqL( NPresenceInfo::NFieldType::KStatusMessage ); + iPersonFilter->InsertIsqL( NPresenceInfo::NFieldType::KAvatar ); + iPersonFilter->InsertIsqL( NPresenceInfo::NFieldType::KAvailability ); + } + else + { + iPersonFilter->InsertIsqL( aFieldName ); + } + } + +// --------------------------------------------------------------------------- +// CPresenceInfoFilterImp::AcceptFilterL +// --------------------------------------------------------------------------- +// +void CPresenceInfoFilterImp::AcceptFilterL( + RXIMPObjOwningPtrArray< CFilterField >& aFieldSet, + const TDesC8& aInfoName, + const TDesC8& aFieldName ) + { + TLinearOrder< CPresenceInfoFilterImp::CFilterField > order( + CPresenceInfoFilterImp::CFilterField::OrderOfFields ); + + CFilterField* field = CFilterField::NewL( aInfoName ); + CleanupStack::PushL( field ); + field->iFieldNames->InsertIsqL( aFieldName ); + aFieldSet.InsertInOrderL( field, order ); + CleanupStack::Pop( field ); + } + +// --------------------------------------------------------------------------- +// CPresenceInfoFilterImp::AcceptServiceFilterL +// --------------------------------------------------------------------------- +// +void CPresenceInfoFilterImp::AcceptServiceFilterL( + const TDesC8& aServiceName, + const TDesC8& aFieldName ) + { + AcceptFilterL( iServiceFilter, aServiceName, aFieldName ); + } + +// --------------------------------------------------------------------------- +// CPresenceInfoFilterImp::AcceptDeviceFilterL +// --------------------------------------------------------------------------- +// +void CPresenceInfoFilterImp::AcceptDeviceFilterL( + const TDesC8& aDeviceName, + const TDesC8& aFieldName ) + { + AcceptFilterL( iDeviceFilter, aDeviceName, aFieldName ); + } + +// --------------------------------------------------------------------------- +// CPresenceInfoFilterImp::MatchPersonFilter +// --------------------------------------------------------------------------- +// +TBool CPresenceInfoFilterImp::MatchPersonFilter( + const TDesC8& aFieldName ) const + { + TBool found = EFalse; + for ( TInt i = 0; i < iPersonFilter->Count() && ! found; i++ ) + { + if ( KErrNotFound != ( iPersonFilter->MdcaPoint( i ).Match( aFieldName ) ) ) + { + // found it + return ETrue; + } + } + + return EFalse; + } + +// --------------------------------------------------------------------------- +// CPresenceInfoFilterImp::MatchFilterL +// --------------------------------------------------------------------------- +// +TBool CPresenceInfoFilterImp::MatchFilterL( + const RXIMPObjOwningPtrArray< CFilterField >& aFieldSet, + const TDesC8& aInfoName, + const TDesC8& aFieldName ) const + { + CFilterField* candidate = CFilterField::NewL( aInfoName ); + CleanupStack::PushL( candidate ); + + TBool foundMatch = EFalse; + + // walk through all fields. slow algo! use a hash to index the field set. + for ( TInt j = 0; j < aFieldSet.Count(); j++ ) + { + // now, go through all fields in service filter which match + // the candidate + CFilterField* field = aFieldSet[ j ]; + + if ( KErrNotFound != aInfoName.Match( field->iInfoName ) ) + { + // field name matches, so try to find the types + + for ( TInt i = 0; i < field->iFieldNames->Count(); i++ ) + { + TBool found = ( KErrNotFound != aFieldName.Match( field->iFieldNames->MdcaPoint( i ) ) ) + ? ETrue : EFalse; + foundMatch |= found; + } + } + } + CleanupStack::PopAndDestroy( candidate ); + + return foundMatch; + } + +// --------------------------------------------------------------------------- +// CPresenceInfoFilterImp::MatchServiceFilter +// --------------------------------------------------------------------------- +// +TBool CPresenceInfoFilterImp::MatchServiceFilterL( + const TDesC8& aServiceName, + const TDesC8& aFieldName ) const + { + return MatchFilterL( iServiceFilter, aServiceName, aFieldName ); + } + +// --------------------------------------------------------------------------- +// CPresenceInfoFilterImp::MatchDeviceFilterL +// --------------------------------------------------------------------------- +// +TBool CPresenceInfoFilterImp::MatchDeviceFilterL( + const TDesC8& aDeviceName, + const TDesC8& aFieldName ) const + { + return MatchFilterL( iDeviceFilter, aDeviceName, aFieldName ); + } + +// --------------------------------------------------------------------------- +// CPresenceInfoFilterImp::UnionL +// --------------------------------------------------------------------------- +// +EXPORT_C CPresenceInfoFilterImp* CPresenceInfoFilterImp::UnionL( + CPresenceInfoFilterImp& aFirst, + CPresenceInfoFilterImp& aSecond ) + { + CPresenceInfoFilterImp* cloned = TXIMPObjectCloner< CPresenceInfoFilterImp >::CloneLC( aFirst ); + + // union of the person filters - must not add duplicates + for ( TInt i = 0; i < aSecond.iPersonFilter->Count(); i++ ) + { + TInt pos = 0; + TInt ret = cloned->iPersonFilter->FindIsq( aSecond.iPersonFilter->MdcaPoint( i ), pos ); + + if ( 0 != ret ) + { + cloned->iPersonFilter->InsertIsqL( aSecond.iPersonFilter->MdcaPoint( i ) ); + } + } + + // union of service fields + aFirst.UnionOfFieldsL( aSecond.iServiceFilter, cloned->iServiceFilter ); + + // union of device fields + aFirst.UnionOfFieldsL( aSecond.iDeviceFilter, cloned->iDeviceFilter ); + + CleanupStack::Pop( cloned ); + return cloned; + } + +// --------------------------------------------------------------------------- +// CPresenceInfoFilterImp::UnionOfFieldsL +// --------------------------------------------------------------------------- +// +void CPresenceInfoFilterImp::UnionOfFieldsL( + RXIMPObjOwningPtrArray< CFilterField>& aSource, + RXIMPObjOwningPtrArray< CFilterField>& aTarget ) + { + TLinearOrder< CPresenceInfoFilterImp::CFilterField > order( + CPresenceInfoFilterImp::CFilterField::OrderOfFields ); + + for ( TInt i = 0; i < aSource.Count(); i++ ) + { + CFilterField* field = aSource[ i ]; + + // if the field name exists in the target, merge the fields + TInt pos = aTarget.FindInOrder( field, order ); + if ( pos == KErrNotFound ) + { + // not found, insert the non-found one as a copy + CFilterField* newField = TXIMPObjectCloner< CFilterField >::CloneLC( *field ); + aTarget.InsertInOrder( newField, order ); + CleanupStack::Pop( newField ); + } + else + { + // found one, merge them to the cloned one + aTarget[ pos ]->MergeL( *field ); + } + } + } + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencedatamodel/presenceinfo/presenceinfoimp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencedatamodel/presenceinfo/presenceinfoimp.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,354 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MPresenceDocument API object implementation. +* +*/ + +#include "presenceinfoimp.h" +#include "personpresenceinfoimp.h" +#include "servicepresenceinfoimp.h" +#include "devicepresenceinfoimp.h" +#include "presenceapidataobjfactory.h" +#include "presencetypehelpers.h" +#include "ximpobjecthelpers.h" +#include "presenceinfofilterimp.h" + +// ============================ MEMBER FUNCTIONS ============================= + +// --------------------------------------------------------------------------- +// CPresenceInfoImp::NewLC() +// --------------------------------------------------------------------------- +// +EXPORT_C CPresenceInfoImp* CPresenceInfoImp::NewLC() + { + CPresenceInfoImp* self = new( ELeave ) CPresenceInfoImp; + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + + +// --------------------------------------------------------------------------- +// CPresenceInfoImp::NewL() +// --------------------------------------------------------------------------- +// +EXPORT_C CPresenceInfoImp* CPresenceInfoImp::NewL() + { + CPresenceInfoImp* self = NewLC(); + CleanupStack::Pop( self ); + return self; + } + + +// --------------------------------------------------------------------------- +// CPresenceInfoImp::~CPresenceInfoImp() +// --------------------------------------------------------------------------- +// +CPresenceInfoImp::~CPresenceInfoImp() + { + delete iPersonPresence; + iServicePresences.ResetAndDestroy(); + iDevicePresences.ResetAndDestroy(); + } + +// --------------------------------------------------------------------------- +// CPresenceInfoImp::CPresenceInfoImp() +// --------------------------------------------------------------------------- +// +CPresenceInfoImp::CPresenceInfoImp() + { + } + + +// --------------------------------------------------------------------------- +// CPresenceInfoImp::ConstructL() +// --------------------------------------------------------------------------- +// +void CPresenceInfoImp::ConstructL() + { + iPersonPresence = CPersonPresenceInfoImp::NewLC(); + CleanupStack::Pop( iPersonPresence ); + } + +// --------------------------------------------------------------------------- +// CPresenceInfoImp::NewFromStreamLC() +// --------------------------------------------------------------------------- +// +XIMPIMP_IMPLEMENT_DATAOBJ_NEWFROMSTREAM( CPresenceInfoImp ) + + +// --------------------------------------------------------------------------- +// Implement supported interface access. +// --------------------------------------------------------------------------- +// +XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CPresenceInfoImp, + MPresenceInfo ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + + +XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CPresenceInfoImp, + MPresenceInfo ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + +// --------------------------------------------------------------------------- +// CPresenceInfoImp::EqualsContent() +// --------------------------------------------------------------------------- +// +TBool CPresenceInfoImp::EqualsContent( + const CXIMPApiDataObjBase& aOtherInstance ) const + { + const CPresenceInfoImp* tmp = + TXIMPGetImpClassOrPanic< const CPresenceInfoImp >::From( aOtherInstance.Base() ); + + TBool same = ETrue; + TBool x = iPersonPresence->EqualsContent( *tmp->iPersonPresence ); + same &= x; + + x = TXIMPEqualsContent< CServicePresenceInfoImp >::Array( iServicePresences, tmp->iServicePresences ); + same &= x; + + x = TXIMPEqualsContent< CDevicePresenceInfoImp >::Array( iDevicePresences, tmp->iDevicePresences ); + same &= x; + + return same; + } + +// --------------------------------------------------------------------------- +// CPresenceInfoImp::ExternalizeL() +// --------------------------------------------------------------------------- +// +EXPORT_C void CPresenceInfoImp::ExternalizeL( RWriteStream& aStream ) const + { + iPersonPresence->ExternalizeL( aStream ); + + CPresenceApiDataObjFactory::ExternalizeL< CServicePresenceInfoImp > + ( aStream, iServicePresences ); + + CPresenceApiDataObjFactory::ExternalizeL< CDevicePresenceInfoImp > + ( aStream, iDevicePresences ); + } + + +// --------------------------------------------------------------------------- +// CPresenceInfoImp::InternalizeL() +// --------------------------------------------------------------------------- +// +EXPORT_C void CPresenceInfoImp::InternalizeL( RReadStream& aStream ) + { + CPersonPresenceInfoImp* tmp = CPersonPresenceInfoImp::NewLC(); + tmp->InternalizeL( aStream ); + delete iPersonPresence; + iPersonPresence = tmp; + CleanupStack::Pop( tmp ); + + iServicePresences.ResetAndDestroy(); + CPresenceApiDataObjFactory::InternalizeL< CServicePresenceInfoImp > + ( aStream, iServicePresences ); + + iDevicePresences.ResetAndDestroy(); + CPresenceApiDataObjFactory::InternalizeL< CDevicePresenceInfoImp > + ( aStream, iDevicePresences ); + } + + +// --------------------------------------------------------------------------- +// From MPresenceInfo class. +// CPresenceInfoImp::PersonPresence() +// --------------------------------------------------------------------------- +// +const MPersonPresenceInfo* CPresenceInfoImp::PersonPresence() const + { + return iPersonPresence; + } + +// --------------------------------------------------------------------------- +// From MPresenceInfo class. +// CPresenceInfoImp::PersonPresence() +// --------------------------------------------------------------------------- +// +MPersonPresenceInfo* CPresenceInfoImp::PersonPresence() + { + return iPersonPresence; + } + + +// --------------------------------------------------------------------------- +// From MPresenceInfo class. +// CPresenceInfoImp::SetPersonPresenceL() +// --------------------------------------------------------------------------- +// +void CPresenceInfoImp::SetPersonPresenceL( + MPersonPresenceInfo* aPersonPresence ) + { + User::LeaveIfError( aPersonPresence == NULL ? KErrArgument : KErrNone ); + + CPersonPresenceInfoImp* personPresenceImp = + TXIMPGetImpClassOrPanic< CPersonPresenceInfoImp >::From( *aPersonPresence ); + + delete iPersonPresence; + iPersonPresence = personPresenceImp; + } + + +// --------------------------------------------------------------------------- +// From MPresenceInfo class. +// CPresenceInfoImp::ServicePresenceCount() +// --------------------------------------------------------------------------- +// +TInt CPresenceInfoImp::ServicePresenceCount() const + { + return iServicePresences.Count(); + } + + +// --------------------------------------------------------------------------- +// From MPresenceInfo class. +// CPresenceInfoImp::ServicePresenceAt() +// --------------------------------------------------------------------------- +// +const MServicePresenceInfo& CPresenceInfoImp::ServicePresenceAt( + TInt aIndex ) const + { + return *iServicePresences[ aIndex ]; + } + + +// --------------------------------------------------------------------------- +// From MPresenceInfo class. +// CPresenceInfoImp::LookupServicePresenceByServiceType() +// --------------------------------------------------------------------------- +// +void CPresenceInfoImp::LookupServicePresenceByServiceType( + MServicePresenceInfo*& aServicePresence, + const TDesC8& aMatch ) const + { + TInt start = KErrNotFound; + + // search from start + if ( aServicePresence ) + { + TBool found = EFalse; + for ( TInt i = 0; ( i < iServicePresences.Count() ) && ( ! found ); i++ ) + { + CXIMPApiDataObjBase* gotObj = TXIMPGetImpClassOrPanic< CXIMPApiDataObjBase >::From( *aServicePresence ); + CXIMPApiDataObjBase* obj = iServicePresences[ i ]; + if ( &(gotObj->Base()) == &(obj->Base()) ) + { + found = ETrue; + start = i; + } + } + } + + start = start == KErrNotFound ? 0 : start; + aServicePresence = NULL; + + for ( TInt i = start; i < iServicePresences.Count(); i++ ) + { + CServicePresenceInfoImp* srvInfo = iServicePresences[ i ]; + + if ( KErrNotFound != srvInfo->ServiceType().MatchF( aMatch ) ) + { + // found match, return it + aServicePresence = srvInfo; + return; + } + } + } + + +// --------------------------------------------------------------------------- +// From MPresenceInfo class. +// CPresenceInfoImp::AddServicePresenceL() +// --------------------------------------------------------------------------- +// +void CPresenceInfoImp::AddServicePresenceL( + MServicePresenceInfo* aServicePresence ) + { + User::LeaveIfError( aServicePresence == NULL ? KErrArgument : KErrNone ); + + CServicePresenceInfoImp* servicePresenceImp = + TXIMPGetImpClassOrPanic< CServicePresenceInfoImp >::From( *aServicePresence ); + + iServicePresences.AppendL( servicePresenceImp ); + } + + +// --------------------------------------------------------------------------- +// From MPresenceInfo class. +// CPresenceInfoImp::DevicePresenceCount() +// --------------------------------------------------------------------------- +// +TInt CPresenceInfoImp::DevicePresenceCount() const + { + return iDevicePresences.Count(); + } + + +// --------------------------------------------------------------------------- +// From MPresenceInfo class. +// CPresenceInfoImp::DevicePresenceAt() +// --------------------------------------------------------------------------- +// +const MDevicePresenceInfo& CPresenceInfoImp::DevicePresenceAt( + TInt aIndex ) const + { + return *iDevicePresences[ aIndex ]; + } + + +// --------------------------------------------------------------------------- +// From MPresenceInfo class. +// CPresenceInfoImp::AddDevicePresenceL() +// --------------------------------------------------------------------------- +// +void CPresenceInfoImp::AddDevicePresenceL( + MDevicePresenceInfo* aDevicePresence ) + { + User::LeaveIfError( aDevicePresence == NULL ? KErrArgument : KErrNone ); + + CDevicePresenceInfoImp* devicePresenceImp = + TXIMPGetImpClassOrPanic< CDevicePresenceInfoImp >::From( *aDevicePresence ); + + iDevicePresences.AppendL( devicePresenceImp ); + } + +// --------------------------------------------------------------------------- +// CPresenceInfoImp::FilteredInfoLC() +// --------------------------------------------------------------------------- +// +EXPORT_C CPresenceInfoImp* CPresenceInfoImp::FilteredInfoLC( + const CPresenceInfoFilterImp& aFilter ) const + { + CPresenceInfoImp* info = TXIMPObjectCloner< CPresenceInfoImp >::CloneLC( *this ); + + // the info imps know how to filter themselves + info->iPersonPresence->FilterWithL( aFilter ); + + for ( TInt i = 0; i < iServicePresences.Count(); i++ ) + { + info->iServicePresences[ i ]->FilterWithL( aFilter ); + } + + for ( TInt i = 0; i < iDevicePresences.Count(); i++ ) + { + info->iDevicePresences[ i ]->FilterWithL( aFilter ); + } + + return info; + } + + +// End of file + diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencedatamodel/presenceinfo/servicepresenceinfoimp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencedatamodel/presenceinfo/servicepresenceinfoimp.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,201 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of MServicePresenceInfo object. +* +*/ + + +#include "presenceinfofield.h" +#include "servicepresenceinfoimp.h" +#include "presenceinfofieldcollectionimp.h" +#include "ximprbufhelpers.h" +#include "presenceinfofilterimp.h" + +// ============================ MEMBER FUNCTIONS ============================= + +// --------------------------------------------------------------------------- +// CServicePresenceInfoImp::NewLC() +// --------------------------------------------------------------------------- +// +EXPORT_C CServicePresenceInfoImp* CServicePresenceInfoImp::NewLC() + { + CServicePresenceInfoImp* self = new( ELeave ) CServicePresenceInfoImp; + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + +// --------------------------------------------------------------------------- +// CServicePresenceInfoImp::NewFromStreamLC() +// --------------------------------------------------------------------------- +// +XIMPIMP_IMPLEMENT_DATAOBJ_NEWFROMSTREAM( CServicePresenceInfoImp ) + +// --------------------------------------------------------------------------- +// Implement supported interface access. +// --------------------------------------------------------------------------- +// +XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CServicePresenceInfoImp, + MServicePresenceInfo ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() +XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CServicePresenceInfoImp, + MServicePresenceInfo ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + +// --------------------------------------------------------------------------- +// CServicePresenceInfoImp::~CServicePresenceInfoImp() +// --------------------------------------------------------------------------- +// +CServicePresenceInfoImp::~CServicePresenceInfoImp() + { + delete iFields; + iServiceType.Close(); + } + +// --------------------------------------------------------------------------- +// CServicePresenceInfoImp::CServicePresenceInfoImp() +// --------------------------------------------------------------------------- +// +CServicePresenceInfoImp::CServicePresenceInfoImp() + { + } + +// --------------------------------------------------------------------------- +// CServicePresenceInfoImp::ConstructL() +// --------------------------------------------------------------------------- +// +void CServicePresenceInfoImp::ConstructL() + { + iFields = CPresenceInfoFieldCollectionImp::NewLC(); + CleanupStack::Pop( iFields ); + + iServiceType.CreateL( 0 ); + } + +// --------------------------------------------------------------------------- +// CServicePresenceInfoImp::ExternalizeL() +// --------------------------------------------------------------------------- +// +void CServicePresenceInfoImp::ExternalizeL( RWriteStream& aStream ) const + { + XIMPRBuf8Helper::ExternalizeL( iServiceType, aStream ); + iFields->ExternalizeL( aStream ); + } + +// --------------------------------------------------------------------------- +// CServicePresenceInfoImp::InternalizeL() +// --------------------------------------------------------------------------- +// +EXPORT_C void CServicePresenceInfoImp::InternalizeL( RReadStream& aStream ) + { + XIMPRBuf8Helper::InternalizeL( iServiceType, aStream ); + + // we only have a parameterless ConstructL which creates the fields structure... + CXIMPApiDataObjBase* tmp = CPresenceInfoFieldCollectionImp::NewFromStreamLC( aStream ); + CPresenceInfoFieldCollectionImp* fields = + TXIMPGetImpClassOrPanic< CPresenceInfoFieldCollectionImp >::From( tmp->Base() ); + delete iFields; + iFields = fields; + CleanupStack::Pop( tmp ); + } + +// --------------------------------------------------------------------------- +// CServicePresenceInfoImp::EqualsContent() +// --------------------------------------------------------------------------- +// +TBool CServicePresenceInfoImp::EqualsContent( + const CXIMPApiDataObjBase& aOtherInstance ) const + { + const CServicePresenceInfoImp* tmp = + TXIMPGetImpClassOrPanic< const CServicePresenceInfoImp >::From( + aOtherInstance.Base() ); + + TBool same = ETrue; + TBool x; + + x = iFields->EqualsContent( *( tmp->iFields ) ); + same &= x; + + return same; + } + + +// --------------------------------------------------------------------------- +// From MServicePresenceInfo class. +// CServicePresenceInfoImp::ServiceType() +// --------------------------------------------------------------------------- +// +const TPtrC8 CServicePresenceInfoImp::ServiceType() const + { + return iServiceType; + } + +// --------------------------------------------------------------------------- +// From MServicePresenceInfo class. +// CServicePresenceInfoImp::SetServiceTypeL() +// --------------------------------------------------------------------------- +// +void CServicePresenceInfoImp::SetServiceTypeL( const TDesC8& aServiceType ) + { + HBufC8* tmp = aServiceType.AllocL(); + iServiceType.Close(); + iServiceType.Assign( tmp ); + } + + +// --------------------------------------------------------------------------- +// From MServicePresenceInfo class. +// CServicePresenceInfoImp::Fields() +// --------------------------------------------------------------------------- +// +const MPresenceInfoFieldCollection& CServicePresenceInfoImp::Fields() const + { + return *iFields; + } + + +// --------------------------------------------------------------------------- +// From MServicePresenceInfo class. +// CServicePresenceInfoImp::Fields() +// --------------------------------------------------------------------------- +// +MPresenceInfoFieldCollection& CServicePresenceInfoImp::Fields() + { + return *iFields; + } + +// --------------------------------------------------------------------------- +// CServicePresenceInfoImp::FilterWithL() +// --------------------------------------------------------------------------- +// +void CServicePresenceInfoImp::FilterWithL( const CPresenceInfoFilterImp& aFilter ) + { + TInt count = iFields->FieldCount(); + + // must traverse backwards when removing + for ( TInt i = count-1; i >= 0; i-- ) + { + if ( ! aFilter.MatchServiceFilterL( + iServiceType, + iFields->FieldAt( i ).FieldType() ) ) + { + // no match, so remove the field + // the filter tells us which ones to ACCEPT + iFields->RemoveField( i ); + } + } + } + + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencedatamodel/presenceinfo/servicepresenceinfoimp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencedatamodel/presenceinfo/servicepresenceinfoimp.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,116 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of MServicePresenceInfo object. + * +*/ + + +#ifndef CSERVICEPRESENCEINFOIMP_H +#define CSERVICEPRESENCEINFOIMP_H + +#include +#include +#include +#include +#include "ximpapidataobjbase.h" +#include "presenceapiobjbase.h" + +class CPresenceInfoFieldCollectionImp; +class CPresenceInfoFilterImp; + +/** + * Implementation of MServicePresenceInfo object. + * + * + * @since S60 v3.2 + */ +NONSHARABLE_CLASS( CServicePresenceInfoImp ): public CXIMPApiDataObjBase, + public MServicePresenceInfo + { + public: + + /** The class ID. */ + enum { KClassId = PRIMP_CLSID_CPERSONPRESENCEINFOIMP }; + +public: + + IMPORT_C static CServicePresenceInfoImp* NewLC(); + + virtual ~CServicePresenceInfoImp(); + +private: + + CServicePresenceInfoImp(); + void ConstructL(); + + /** + * @see CXIMPApiDataObjBase + */ + XIMPIMP_DECLARE_DATAOBJ_BASE_PRIV_METHODS + +public: // From MXIMPBase + + /** + * Implementation of MXIMPBase interface methods + * @see MXIMPBase + */ + XIMPIMP_DECLARE_IF_BASE_METHODS + + /** + * @see CXIMPApiDataObjBase + */ + XIMPIMP_DECLARE_DATAOBJ_BASE_METHODS + +public: // New functions + + /** + * Internalizes object data from given stream. + * @param aStream Stream to read. + */ + IMPORT_C void InternalizeL( RReadStream& aStream ); + + +public: // from MServicePresenceInfo + + /** + * @see MServicePresenceInfo + */ + const TPtrC8 ServiceType() const; + void SetServiceTypeL( const TDesC8& aServiceType ); + const MPresenceInfoFieldCollection& Fields() const; + MPresenceInfoFieldCollection& Fields(); + +public: // new methods + + /** + * Remove from this info field implementation the fields which do not match + * the given filter. + * @param aFilter The filter implementation + */ + void FilterWithL( const CPresenceInfoFilterImp& aFilter ); + +private: // data + + // owned + CPresenceInfoFieldCollectionImp* iFields; + + RBuf8 iServiceType; + + }; + + +#endif // CSERVICEPRESENCEINFOIMP_H + + + diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencedatamodel/presenceobjectfactoryimp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencedatamodel/presenceobjectfactoryimp.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,217 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of MPresenceManagement + * +*/ + +#include "presenceobjectfactoryimp.h" +#include "presenceinfoimp.h" +#include "presenceinfofilterimp.h" +#include "ximpstatusimp.h" +#include "ximprestrictedobjectcollectionimp.h" +#include "ximpobjectcollectionimp.h" +#include "ximpidentityimp.h" +#include "presentitygroupinfoimp.h" +#include "presentitygroupmemberinfoimp.h" +#include "presencewatcherinfoimp.h" +#include "presencegrantrequestinfoimp.h" +#include "ximpdatasubscriptionstateimp.h" +#include "personpresenceinfoimp.h" +#include "servicepresenceinfoimp.h" +#include "devicepresenceinfoimp.h" +#include "presenceinfofieldimp.h" +#include "presenceinfofieldvalueenumimp.h" +#include "presenceinfofieldvaluetextimp.h" +#include "presenceinfofieldvaluebinaryimp.h" +#include "presenceblockinfoimp.h" + +// ============================ MEMBER FUNCTIONS ============================= + +// --------------------------------------------------------------------------- +// CPresenceObjectFactoryImp::NewL() +// --------------------------------------------------------------------------- +// +EXPORT_C CPresenceObjectFactoryImp* CPresenceObjectFactoryImp::NewL() + { + CPresenceObjectFactoryImp* self = new( ELeave ) CPresenceObjectFactoryImp; + return self; + } + +// --------------------------------------------------------------------------- +// Implement supported interface access. +// --------------------------------------------------------------------------- +// +XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CPresenceObjectFactoryImp, + MPresenceObjectFactory ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + + +XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CPresenceObjectFactoryImp, + MPresenceObjectFactory ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + +// --------------------------------------------------------------------------- +// CPresenceObjectFactoryImp::~CPresenceObjectFactoryImp() +// --------------------------------------------------------------------------- +// +CPresenceObjectFactoryImp::~CPresenceObjectFactoryImp() + { + #if _BullseyeCoverage + cov_write(); + #endif + } + + +// --------------------------------------------------------------------------- +// CPresenceObjectFactoryImp::CPresenceObjectFactoryImp() +// --------------------------------------------------------------------------- +// +CPresenceObjectFactoryImp::CPresenceObjectFactoryImp() + { + } + +// --------------------------------------------------------------------------- +// CPresenceObjectFactoryImp::NewPresentityGroupInfoLC() +// --------------------------------------------------------------------------- +// +MPresentityGroupInfo* CPresenceObjectFactoryImp::NewPresentityGroupInfoLC() + { + return CPresentityGroupInfoImp::NewLC(); + } + + +// --------------------------------------------------------------------------- +// CPresenceObjectFactoryImp::NewPresentityGroupMemberInfoLC() +// --------------------------------------------------------------------------- +// +MPresentityGroupMemberInfo* + CPresenceObjectFactoryImp::NewPresentityGroupMemberInfoLC() + { + return CPresentityGroupMemberInfoImp::NewLC(); + } + + +// --------------------------------------------------------------------------- +// CPresenceObjectFactoryImp::NewPresenceWatcherInfoLC() +// --------------------------------------------------------------------------- +// +MPresenceWatcherInfo* CPresenceObjectFactoryImp::NewPresenceWatcherInfoLC() + { + return CPresenceWatcherInfoImp::NewLC(); + } + + +// --------------------------------------------------------------------------- +// CPresenceObjectFactoryImp::NewPresenceGrantRequestInfoLC() +// --------------------------------------------------------------------------- +// +MPresenceGrantRequestInfo* + CPresenceObjectFactoryImp::NewPresenceGrantRequestInfoLC() + { + return CPresenceGrantRequestInfoImp::NewLC(); + } + + +// --------------------------------------------------------------------------- +// CPresenceObjectFactoryImp::NewPresenceInfoLC() +// --------------------------------------------------------------------------- +// +MPresenceInfo* CPresenceObjectFactoryImp::NewPresenceInfoLC() + { + return CPresenceInfoImp::NewLC(); + } + + +// --------------------------------------------------------------------------- +// CPresenceObjectFactoryImp::NewPresenceInfoFilterLC() +// --------------------------------------------------------------------------- +// +MPresenceInfoFilter* CPresenceObjectFactoryImp::NewPresenceInfoFilterLC() + { + return CPresenceInfoFilterImp::NewLC(); + } + +// --------------------------------------------------------------------------- +// CPresenceObjectFactoryImp::NewPresenceInfoFieldLC() +// --------------------------------------------------------------------------- +// +MPresenceInfoField* CPresenceObjectFactoryImp::NewInfoFieldLC() + { + return CPresenceInfoFieldImp::NewLC(); + } + +// --------------------------------------------------------------------------- +// CPresenceObjectFactoryImp::NewPersonPresenceInfoLC() +// --------------------------------------------------------------------------- +// +MPersonPresenceInfo* CPresenceObjectFactoryImp::NewPersonPresenceInfoLC() + { + return CPersonPresenceInfoImp::NewLC(); + } + +// --------------------------------------------------------------------------- +// CPresenceObjectFactoryImp::NewServicePresenceInfoLC() +// --------------------------------------------------------------------------- +// +MServicePresenceInfo* CPresenceObjectFactoryImp::NewServicePresenceInfoLC() + { + return CServicePresenceInfoImp::NewLC(); + } + +// --------------------------------------------------------------------------- +// CPresenceObjectFactoryImp::NewDevicePresenceInfoLC() +// --------------------------------------------------------------------------- +// +MDevicePresenceInfo* CPresenceObjectFactoryImp::NewDevicePresenceInfoLC() + { + return CDevicePresenceInfoImp::NewLC(); + } + +// --------------------------------------------------------------------------- +// CPresenceObjectFactoryImp::NewEnumInfoFieldLC() +// --------------------------------------------------------------------------- +// +MPresenceInfoFieldValueEnum* CPresenceObjectFactoryImp::NewEnumInfoFieldLC() + { + return CPresenceInfoFieldValueEnumImp::NewLC(); + } + +// --------------------------------------------------------------------------- +// CPresenceObjectFactoryImp::NewTextInfoFieldLC() +// --------------------------------------------------------------------------- +// +MPresenceInfoFieldValueText* CPresenceObjectFactoryImp::NewTextInfoFieldLC() + { + return CPresenceInfoFieldValueTextImp::NewLC(); + } + +// --------------------------------------------------------------------------- +// CPresenceObjectFactoryImp::NewBinaryInfoFieldLC() +// --------------------------------------------------------------------------- +// +MPresenceInfoFieldValueBinary* CPresenceObjectFactoryImp::NewBinaryInfoFieldLC() + { + return CPresenceInfoFieldValueBinaryImp::NewLC(); + } + +// --------------------------------------------------------------------------- +// CPresenceObjectFactoryImp::NewPresenceBlockInfoLC() +// --------------------------------------------------------------------------- +// +MPresenceBlockInfo* CPresenceObjectFactoryImp::NewPresenceBlockInfoLC() + { + return CPresenceBlockInfoImp::NewLC(); + } + + diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencedatamodel/presenceobjectfactoryimp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencedatamodel/presenceobjectfactoryimp.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,81 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of MPresenceObjectFactory + * +*/ + +#ifndef CPRESENCEOBJECTFACTORYIMP_H +#define CPRESENCEOBJECTFACTORYIMP_H + +#include +#include "ximpapiobjbase.h" +#include "presenceapiobjbase.h" + + + + +/** + * MPresenceObjectFactory API object implementation. + * + * @lib presencemanager.dll + * @since S60 v3.2 + */ +class CPresenceObjectFactoryImp: public CXIMPApiObjBase, + public MPresenceObjectFactory + { + public: + /** The class ID. */ + enum { KClassId = PRIMP_CLSID_CPRESENCEOBJECTFACTORYIMP }; + + +public: + + IMPORT_C static CPresenceObjectFactoryImp* NewL(); + ~CPresenceObjectFactoryImp(); + +private: + CPresenceObjectFactoryImp(); + + + +public: // From MXIMPBase + + /** + * Implementation of MXIMPBase interface methods + * @see MXIMPBase + */ + XIMPIMP_DECLARE_IF_BASE_METHODS + + +public: //From MPresenceObjectFactory + + + MPresentityGroupInfo* NewPresentityGroupInfoLC(); + MPresentityGroupMemberInfo* NewPresentityGroupMemberInfoLC(); + MPresenceWatcherInfo* NewPresenceWatcherInfoLC(); + MPresenceGrantRequestInfo* NewPresenceGrantRequestInfoLC(); + MPresenceInfo* NewPresenceInfoLC(); + MPresenceInfoFilter* NewPresenceInfoFilterLC(); + MPersonPresenceInfo* NewPersonPresenceInfoLC(); + MServicePresenceInfo* NewServicePresenceInfoLC(); + MDevicePresenceInfo* NewDevicePresenceInfoLC(); + MPresenceInfoField* NewInfoFieldLC(); + MPresenceInfoFieldValueEnum* NewEnumInfoFieldLC(); + MPresenceInfoFieldValueText* NewTextInfoFieldLC(); + MPresenceInfoFieldValueBinary* NewBinaryInfoFieldLC(); + MPresenceBlockInfo* NewPresenceBlockInfoLC(); + }; + + +#endif // CPRESENCEOBJECTFACTORYIMP_H diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencedatamodel/presencepublishing/documentutils.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencedatamodel/presencepublishing/documentutils.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,94 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Document utils +* +*/ + +#include "documentutils.h" +#include "presenceinfoimp.h" +#include "presenceinfofilterimp.h" +#include "ximpobjecthelpers.h" + + +// ============================ MEMBER FUNCTIONS ============================= + +// --------------------------------------------------------------------------- +// DocumentUtils::InfoFilterUnionL() +// --------------------------------------------------------------------------- +// +EXPORT_C CPresenceInfoFilterImp* DocumentUtils::InfoFilterUnionL( + CPresenceInfoFilterImp& aSource1, + CPresenceInfoFilterImp& aSource2 ) + { + RPointerArray< CPresenceInfoFilterImp > array; + CleanupClosePushL( array ); + array.AppendL( &aSource1 ); + array.AppendL( &aSource2 ); + CPresenceInfoFilterImp* retVal = InfoFilterUnionL( array ); + CleanupStack::PopAndDestroy(); // array + return retVal; + } + + +// --------------------------------------------------------------------------- +// DocumentUtils::DocumentUnionL() +// --------------------------------------------------------------------------- +// +EXPORT_C CPresenceInfoFilterImp* DocumentUtils::InfoFilterUnionL( + const RPointerArray< CPresenceInfoFilterImp >& aSources ) + { + CPresenceInfoFilterImp* target = NULL; + TInt countOfSources = aSources.Count(); + if( countOfSources == 0 ) // No sources to combine. + { + target = CPresenceInfoFilterImp::NewLC(); + CleanupStack::Pop(); // target + return target; + } + + // Create a new one instead of cloning the first to avoid possible duplicates. + // Algorithm is: given filters a,b,c: + // new = empty. + // new = union(new,a) + // new = union(new,b) + // new = union(new,c) + // result in new. + + target = CPresenceInfoFilterImp::NewL(); + + for ( TInt i = 0; i < aSources.Count(); i++ ) + { + CleanupStack::PushL( target ); + + CPresenceInfoFilterImp* filter = aSources[ i ]; + CPresenceInfoFilterImp* tmp = CPresenceInfoFilterImp::UnionL( *target, *filter ); + + CleanupStack::PopAndDestroy( target ); + + target = tmp; + } + + return target; + } + + +EXPORT_C CPresenceInfoImp* DocumentUtils::CollectFilteredPresenceInfoLC( + const CPresenceInfoFilterImp& aPif, + const CPresenceInfoImp& aSource ) + { + CPresenceInfoImp* newInfo = aSource.FilteredInfoLC( aPif ); + return newInfo; + } + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencedatamodel/presencepublishing/documentutils.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencedatamodel/presencepublishing/documentutils.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,68 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Document utils +* +*/ + +#ifndef CDOCUMENTUTILS_H +#define CDOCUMENTUTILS_H + +#include + +class CPresenceInfoImp; +class CPresenceInfoFilterImp; + +/** + * Document utils + * + * @lib ximpdatamodel.dll + * @since S60 v3.2 + */ +class DocumentUtils + { + +public: + + /** + * Create union of two source info filters. + * @param aSource1 First source filter + * @param aSource2 Second source filter + * @return New created filter. Ownership is transferred to caller. + */ + IMPORT_C static CPresenceInfoFilterImp* InfoFilterUnionL( + CPresenceInfoFilterImp& aSource1, + CPresenceInfoFilterImp& aSource2 ); + /** + * Create union of filters + * @param aSources Array of sources for union. + * @return New created filter. Ownership is transferred to caller. + */ + IMPORT_C static CPresenceInfoFilterImp* InfoFilterUnionL( + const RPointerArray< CPresenceInfoFilterImp >& aSources ); + + /** + * + */ + IMPORT_C static CPresenceInfoImp* CollectFilteredPresenceInfoLC( + const CPresenceInfoFilterImp& aPif, + const CPresenceInfoImp& aSource ); +private: + + + }; + + +#endif // CDOCUMENTUTILS_H + + diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencedatamodel/presencepublishing/ownpresenceeventimp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencedatamodel/presencepublishing/ownpresenceeventimp.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,206 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MOwnPresenceEvent API object implementation. + * +*/ + +#include "ownpresenceeventimp.h" +#include "presenceinfoimp.h" +#include "ximpobjecthelpers.h" +#include "ximpdatasubscriptionstateimp.h" +#include + + +// --------------------------------------------------------------------------- +// COwnPresenceEventImp::NewLC() +// --------------------------------------------------------------------------- +// +EXPORT_C COwnPresenceEventImp* COwnPresenceEventImp::NewLC( + CXIMPDataSubscriptionStateImp* aState ) + { + COwnPresenceEventImp* self = new( ELeave ) COwnPresenceEventImp(); + CleanupStack::PushL( self ); + self->ConstructL( aState ); + return self; + } + +// --------------------------------------------------------------------------- +// COwnPresenceEventImp::NewL() +// --------------------------------------------------------------------------- +// +EXPORT_C COwnPresenceEventImp* COwnPresenceEventImp::NewL( + CXIMPDataSubscriptionStateImp* aState ) + { + COwnPresenceEventImp* self = NewLC( aState ); + CleanupStack::Pop( self ); + return self; + } + + +// --------------------------------------------------------------------------- +// COwnPresenceEventImp::NewFromStreamLC() +// --------------------------------------------------------------------------- +// +CXIMPApiEventBase* COwnPresenceEventImp::NewFromStreamLC( RReadStream& aStream ) + { + COwnPresenceEventImp* self = new( ELeave ) COwnPresenceEventImp; + CleanupStack::PushL( self ); + self->ConstructL( aStream ); + return self; + } + +// --------------------------------------------------------------------------- +// COwnPresenceEventImp::~COwnPresenceEventImp() +// --------------------------------------------------------------------------- +// +COwnPresenceEventImp::~COwnPresenceEventImp() + { + delete iPresenceInfo; + delete iSubscriptionState; + } + + +// --------------------------------------------------------------------------- +// COwnPresenceEventImp::COwnPresenceEventImp() +// --------------------------------------------------------------------------- +// +COwnPresenceEventImp::COwnPresenceEventImp() + { + } + +// --------------------------------------------------------------------------- +// COwnPresenceEventImp::ConstructL() +// --------------------------------------------------------------------------- +// +void COwnPresenceEventImp::ConstructL( CXIMPDataSubscriptionStateImp* aState ) + { + iSubscriptionState = aState; + iPresenceInfo = CPresenceInfoImp::NewL(); + } + +// --------------------------------------------------------------------------- +// COwnPresenceEventImp::ConstructL() +// --------------------------------------------------------------------------- +// +void COwnPresenceEventImp::ConstructL( RReadStream& aStream ) + { + iSubscriptionState = CXIMPDataSubscriptionStateImp::NewL(); + iPresenceInfo = CPresenceInfoImp::NewL(); + InternalizeL( aStream ); + } + +// --------------------------------------------------------------------------- +// Implement supported interface access. +// --------------------------------------------------------------------------- +// +XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( COwnPresenceEventImp, + MOwnPresenceEvent ) + XIMPIMP_IF_BASE_GET_CLASS( CXIMPApiEventBase, this ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + + +XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( COwnPresenceEventImp, + MOwnPresenceEvent ) + XIMPIMP_IF_BASE_GET_CONST_CLASS( CXIMPApiEventBase, this ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + + + +// --------------------------------------------------------------------------- +// Implement methods from base event interface and base event class +// --------------------------------------------------------------------------- +// +XIMPIMP_IMPLEMENT_EVENT_BASE_METHODS( COwnPresenceEventImp, + MOwnPresenceEvent ) + +// --------------------------------------------------------------------------- +// COwnPresenceEventImp::EqualsContent() +// --------------------------------------------------------------------------- +// +TBool COwnPresenceEventImp::EqualsContent( + const CXIMPApiEventBase& aOtherInstance ) const + { + const COwnPresenceEventImp* tmp = + TXIMPGetImpClassOrPanic< const COwnPresenceEventImp>::From( aOtherInstance.Base() ); + + + TBool same = ETrue; + + TBool x = iPresenceInfo->EqualsContent( *tmp->iPresenceInfo ); + same &= x; + + x = iSubscriptionState->EqualsContent( *tmp->iSubscriptionState ); + same &= x; + + return same; + } + +// --------------------------------------------------------------------------- +// From class CXIMPApiEventBase. +// COwnPresenceEventImp::ExternalizeL() +// --------------------------------------------------------------------------- +// +void COwnPresenceEventImp::ExternalizeL( RWriteStream& aStream ) const + { + iPresenceInfo->ExternalizeL( aStream ); + iSubscriptionState->ExternalizeL( aStream ); + } + + +// --------------------------------------------------------------------------- +// COwnPresenceEventImp::InternalizeL() +// --------------------------------------------------------------------------- +// +void COwnPresenceEventImp::InternalizeL( RReadStream& aStream ) + { + iPresenceInfo->InternalizeL( aStream ); + iSubscriptionState->InternalizeL( aStream ); + } + + +// --------------------------------------------------------------------------- +// From class MOwnPresenceEvent. +// COwnPresenceEventImp::Status() +// --------------------------------------------------------------------------- +// +const MXIMPDataSubscriptionState& + COwnPresenceEventImp::DataSubscriptionState() const + { + return *iSubscriptionState; + } + + +// --------------------------------------------------------------------------- +// From class MOwnPresenceEvent. +// COwnPresenceEventImp::SubscribedPresence() +// --------------------------------------------------------------------------- +// +const MPresenceInfo& + COwnPresenceEventImp::SubscribedPresence() const + { + return *iPresenceInfo; + } + +// --------------------------------------------------------------------------- +// COwnPresenceEventImp::SetPresenceInfo +// --------------------------------------------------------------------------- +// +void COwnPresenceEventImp::SetPresenceInfo( CPresenceInfoImp* aInfoImp ) + { + delete iPresenceInfo; + iPresenceInfo = aInfoImp; + } + +// End of file + diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencedatamodel/presencepublishing/ownpresenceeventimp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencedatamodel/presencepublishing/ownpresenceeventimp.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,128 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MOwnPresenceEvent API object implementation. + * +*/ + +#ifndef COWNPRESENCEEVENTIMP_H +#define COWNPRESENCEEVENTIMP_H + +#include +#include "ximpapieventbase.h" +#include "presenceinfo.h" +#include "ximpdatasubscriptionstateimp.h" +#include "presenceapiobjbase.h" + + +class RReadStream; +class CPresenceInfoImp; +class CXIMPDataSubscriptionStateImp; + +/** + * MOwnPresenceEvent API object implementation. + * + * @lib ximpdatamodel.dll + * @since S60 v3.2 + */ +NONSHARABLE_CLASS( COwnPresenceEventImp ): public CXIMPApiEventBase, + public MOwnPresenceEvent + { +public: + /** The class ID. */ + enum { KClassId = PRIMP_CLSID_COWNPRESENCEEVENTIMP }; + +public: + /** + * Exported instantiation method for initializing + * new event object. + */ + IMPORT_C static COwnPresenceEventImp* NewLC( + CXIMPDataSubscriptionStateImp* aState ); + IMPORT_C static COwnPresenceEventImp* NewL( + CXIMPDataSubscriptionStateImp* aState ); + + + /** + * Instantiation method for event automation. + * Method signature must be exactly this to work + * with event delivery automation system. + * + * Event implementation must be registered to + * XIMPEventCodec KXIMPEventConstructorTable. + */ + static CXIMPApiEventBase* NewFromStreamLC( RReadStream& aStream ); + + virtual ~COwnPresenceEventImp(); + + +private: + COwnPresenceEventImp(); + void ConstructL( CXIMPDataSubscriptionStateImp* aState ); + void ConstructL( RReadStream& aStream ); + +public: // From API base interfaces + + /** + * Implementation of MXIMPBase interface methods + * @see MXIMPBase + */ + XIMPIMP_DECLARE_IF_BASE_METHODS + + + /** + * Implementation of MXIMPEventBase interface and + * CXIMPApiEventBase methods + * + * @see MXIMPEventBase + * @see CXIMPApiEventBase + */ + XIMPIMP_DECLARE_EVENT_BASE_METHODS + + void InternalizeL( RReadStream& aStream ); + + +public: // From MOwnPresenceEvent + + /** + * Implementation of MOwnPresenceEvent interface methods + * @see MOwnPresenceEvent + */ + const MPresenceInfo& SubscribedPresence() const; + const MXIMPDataSubscriptionState& DataSubscriptionState() const; + +public: // new methods + + /** + * Set new presence info. + * Ownership transferred. + * @param aInfoImp The info imp + */ + void SetPresenceInfo( CPresenceInfoImp* aInfoImp ); + +private: // data + + /** + * Presence Document + * Own. + */ + CPresenceInfoImp* iPresenceInfo; + + /** + * + */ + CXIMPDataSubscriptionStateImp* iSubscriptionState; + }; + + +#endif // COWNPRESENCEEVENTIMP_H diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencedatamodel/presencepublishing/ownpresencesubscriptionitem.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencedatamodel/presencepublishing/ownpresencesubscriptionitem.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,188 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Presence Service Connection own presence subscription implementation. +* +*/ + + +#include "ownpresencesubscriptionitem.h" +#include "presenceinfofilterimp.h" +#include "ximpitemparent.h" +#include "ximppanics.h" +#include "ximppsccontext.h" +#include "documentutils.h" +#include "ownpresenceeventimp.h" + +#include "ximptrace.h" + +// --------------------------------------------------------------------------- +// COwnPresenceSubscriptionItem::COwnPresenceSubscriptionItem() +// --------------------------------------------------------------------------- +// +COwnPresenceSubscriptionItem::COwnPresenceSubscriptionItem( MXIMPItemParentBase& aParent ) +: CXIMPSubscriptionItemBase( aParent ) + { + } + + +// --------------------------------------------------------------------------- +// COwnPresenceSubscriptionItem::ConstructL() +// --------------------------------------------------------------------------- +// +void COwnPresenceSubscriptionItem::ConstructL() + { + BaseConstructL(); + } + + +// --------------------------------------------------------------------------- +// COwnPresenceSubscriptionItem::NewL() +// --------------------------------------------------------------------------- +// +COwnPresenceSubscriptionItem* COwnPresenceSubscriptionItem::NewLC( MXIMPItemParentBase& aParent ) + { + COwnPresenceSubscriptionItem* self = new( ELeave ) COwnPresenceSubscriptionItem( aParent ); + CleanupClosePushL( *self ); + self->ConstructL(); + return self; + } + + +// --------------------------------------------------------------------------- +// CXIMPHost::~CXIMPHost() +// --------------------------------------------------------------------------- +// +COwnPresenceSubscriptionItem::~COwnPresenceSubscriptionItem() + { + MXIMPItemParent* presCache = static_cast(iParent.GetInterface(PRESENCE_ITEM_PARENT)); + presCache->RemoveMe( this ); + + delete iPif; + delete iPresenceInfo; + } + +// --------------------------------------------------------------------------- +// COwnPresenceSubscriptionItem::SubscriptionPif() +// --------------------------------------------------------------------------- +// +EXPORT_C CPresenceInfoFilterImp& COwnPresenceSubscriptionItem::SubscriptionPif() + { + TRACE(_L("COwnPresenceSubscriptionItem::SubscriptionPif" ) ); + __ASSERT_ALWAYS( iPif, User::Panic( NXIMPPrivPanic::KCategory, + NXIMPPrivPanic::EOwnPresencePifNotSet ) ); + return *iPif; + } +// --------------------------------------------------------------------------- +// COwnPresenceSubscriptionItem::SynthesiseSubscriptionEventToL() +// --------------------------------------------------------------------------- +// +void COwnPresenceSubscriptionItem::SynthesiseSubscriptionEventToL( + MXIMPPscContext* aContext, TBool aForceEvent ) + { + TRACE_1( _L("COwnPresenceSubscriptionItem::SynthesiseSubscriptionEventTo() aForce=%d"), aForceEvent ); + CXIMPDataSubscriptionStateImp* status = StatusLC( aContext ); + + COwnPresenceEventImp* newEvent = NULL; + if( status->DataState() == MXIMPDataSubscriptionState::EDataAvailable ) + { + __ASSERT_ALWAYS( iPresenceInfo, User::Panic( NXIMPPrivPanic::KCategory, + NXIMPPrivPanic::EOwnPresencePresenceInfoDoesNotExist ) ); + + CPresenceInfoImp* filteredPresenceInfo = DocumentUtils::CollectFilteredPresenceInfoLC( + *( aContext->PresenceInfoFilter( MXIMPPscContext::EOwnPresenceFilter ) ), *iPresenceInfo ); + + newEvent = COwnPresenceEventImp::NewL( status ); // CSI: 35 # Event is put to cleanupstack in next branch. + newEvent->SetPresenceInfo( filteredPresenceInfo ); + CleanupStack::Pop( filteredPresenceInfo ); + } + else if( aForceEvent ) + { + newEvent = COwnPresenceEventImp::NewL( status ); // CSI: 35 # Event is put to cleanupstack in next branch. + } + + if( newEvent ) + { + CleanupStack::Pop(); //status + CleanupStack::PushL( newEvent ); + MXIMPItemParent* presCache = static_cast(iParent.GetInterface(PRESENCE_ITEM_PARENT)); + presCache->AddEventL( *newEvent, aContext ); + } + CleanupStack::PopAndDestroy(); //status || newEvent depending on branch + } + +// --------------------------------------------------------------------------- +// COwnPresenceSubscriptionItem::SetSubscriptionPif() +// --------------------------------------------------------------------------- +// +EXPORT_C void COwnPresenceSubscriptionItem::SetSubscriptionPif( CPresenceInfoFilterImp* aPif ) + { + TRACE(_L("COwnPresenceSubscriptionItem::SetSubscriptionPif" ) ); + delete iPif; + iPif = aPif; + } + +// --------------------------------------------------------------------------- +// COwnPresenceSubscriptionItem::CollectSubscriptionPifWithoutCtxL() +// --------------------------------------------------------------------------- +// +EXPORT_C CPresenceInfoFilterImp* + COwnPresenceSubscriptionItem::CollectSubscriptionPifWithoutCtxL( + MXIMPPscContext* aContext ) + { + TRACE(_L("COwnPresenceSubscriptionItem::CollectSubscriptionPifWithoutCtxL" ) ); + RPointerArray< CPresenceInfoFilterImp > arrayOfPifs; + CleanupClosePushL( arrayOfPifs ); + + TInt count = iContexts.Count(); + for( TInt a = 0; a < count; ++a ) + { + if( iContexts[ a ] != aContext ) + { + CPresenceInfoFilterImp* filter = iContexts[ a ]->PresenceInfoFilter( + MXIMPPscContext::EOwnPresenceFilter ); + if ( filter ) + { + arrayOfPifs.AppendL( filter ); + } + } + } + CPresenceInfoFilterImp* pifWithoutCtx = DocumentUtils::InfoFilterUnionL( arrayOfPifs ); + CleanupStack::PopAndDestroy(); // arrayOfPifs + return pifWithoutCtx; + } + + +// --------------------------------------------------------------------------- +// COwnPresenceSubscriptionItem::SetPresenceInfoL() +// --------------------------------------------------------------------------- +// +EXPORT_C void COwnPresenceSubscriptionItem::SetPresenceInfoL( + CPresenceInfoImp* aPresenceInfo ) + { + TRACE(_L("COwnPresenceSubscriptionItem::SetPresenceInfoL" ) ); + delete iPresenceInfo; + iPresenceInfo = aPresenceInfo; + iSubscriptionState->SetDataStateL( MXIMPDataSubscriptionState::EDataAvailable ); + } + +// --------------------------------------------------------------------------- +// COwnPresenceSubscriptionItem::CleanExpired() +// --------------------------------------------------------------------------- +// +void COwnPresenceSubscriptionItem::CleanExpired() + { + + } + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencedatamodel/presencepublishing/ownpresencesubscriptionitem.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencedatamodel/presencepublishing/ownpresencesubscriptionitem.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,129 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Presence Service Connection own presence subscription implementation. +* +*/ + +#ifndef CPSCOWNPRESENCESUBSCRIPTIONITEM_H +#define CPSCOWNPRESENCESUBSCRIPTIONITEM_H + +#include +#include "presenceinfoimp.h" +#include "ximpsubscriptionitem.h" +#include "ximpsubscriptionitembase.h" + +class MXIMPItemParentBase; +class MXIMPPscContext; +class CPresenceInfoFilterImp; +class COwnPresenceEventImp; + +/** + * PSC own presence subscription implementation + * + * @since S60 v3.2 + */ +class COwnPresenceSubscriptionItem : public CXIMPSubscriptionItemBase + { + +public: // Construction and destruction + + /** + * Construction + * @param aParent. Parent has to be informed when this object is deleted by RemoveMe method. + */ + static COwnPresenceSubscriptionItem* NewLC( MXIMPItemParentBase& aParent ); + + /** + * Destruction + * - Remember to inform parent about delete. + */ + virtual ~COwnPresenceSubscriptionItem(); + +private: // Construction and destruction + + /** + * Construction + * @param aParent. Parent has to be informed when this object is deleted by RemoveMe method. + */ + COwnPresenceSubscriptionItem( MXIMPItemParentBase& aParent ); + + /** + * Construction + */ + void ConstructL(); + +public: // New methods + + /** + * Current presence information filter. + * @return Current presence information filter. + */ + IMPORT_C CPresenceInfoFilterImp& SubscriptionPif(); + + /** + * Set current presence information filter. Overwrites existing one. + * Ownership is transferred to callee. + * @param aPif Current presence information filter. + */ + IMPORT_C void SetSubscriptionPif( CPresenceInfoFilterImp* aPif ); + + /** + * Collect aggregated presence information filter wihtout given context. + * @param aContext. Exluded context from aggregated pif. + * @return Aggregated pif without exluded context. + */ + IMPORT_C CPresenceInfoFilterImp* CollectSubscriptionPifWithoutCtxL( + MXIMPPscContext* aContext ); + + /** + * Set presence information. Overwrites existing one. + * @param aPresenceInfo. New presence information. + */ + IMPORT_C void SetPresenceInfoL( CPresenceInfoImp* aPresenceInfo ); + +public: // From MXIMPSubscriptionItem + + /** + * Synthesise own presence information to given context. + * Presence information is filtered with context pif. + * @param aContext. Target context for own presence information. + */ + void SynthesiseSubscriptionEventToL( MXIMPPscContext* aContext, TBool aForceEvent ); + +private: // From CXIMPSubscriptionItemBase + + /** + * @see CXIMPSubscriptionItemBase + */ + void CleanExpired(); + +private: // Data + + /** + * Current presence information filter. + */ + CPresenceInfoFilterImp* iPif; + + /** + * Current presence info + */ + CPresenceInfoImp* iPresenceInfo; + }; + + +/* ======================================================================== */ + + + +#endif // CPSCOWNPRESENCESUBSCRIPTIONITEM_H diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencedatamodel/presencepublishing/presenceinfofilterimp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencedatamodel/presencepublishing/presenceinfofilterimp.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,301 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MPresenceInfoFilter API object implementation. +* +*/ + +#ifndef CPRESENCEINFOFILTERIMP_H +#define CPRESENCEINFOFILTERIMP_H + +#include "ximpapidataobjbase.h" +#include "presenceapiobjbase.h" +#include +#include + +class CDesC8ArraySeg; + +/** + * MPresenceInfoFilter API object implementation. + * + * @lib ximpdatamodel.dll + * @since S60 v3.2 + */ +NONSHARABLE_CLASS( CPresenceInfoFilterImp ): public CXIMPApiDataObjBase, + public MPresenceInfoFilter + { + private: + + /** + * Container class to do 1:many infoname -> fieldname mappings. + */ + class CFilterField : public CBase + { + public: + + /** + * @param aInfoName The name of info associated + * with this filter + */ + static CFilterField* NewL( + const TDesC8& aFieldName ); + + static CFilterField* NewLC(); + + ~CFilterField(); + + /** + * @return The info name + */ + const TDesC8& InfoName(); + + /** + * Add a field name + * @param aFieldName The name of field + */ + void AddFieldNameL( const TDesC8& aFieldName ); + + static TInt OrderOfFields( + const CFilterField& aFirst, + const CFilterField& aSecond ); + + static TInt OrderOfFieldsByName( + const TDesC8* aName, + const CFilterField& aSecond ); + + void ExternalizeL( RWriteStream& aStream ) const; + void InternalizeL( RReadStream& aStream ); + + /** + * Merge the contents of given filter field into this filter field. + * The field name of the fields must match! Otherwise this routine + * is meaningless. + */ + void MergeL( CFilterField& aOtherField ); + + /** + * Check if source is same as this + * @param aSource Source for check + * @return ETrue if objects are same + */ + TBool operator==( const CFilterField& aSource ); + TBool operator!=( const CFilterField& aSource ); + + private: + + CFilterField(); + void ConstructL( const TDesC8& aInfoName ); + void ConstructL(); + + public: + // owns, accepted info name + RBuf8 iInfoName; + + // owns: accepted field names + CDesC8ArraySeg* iFieldNames; + }; + + + public: + + /** The class ID. */ + enum { KClassId = PRIMP_CLSID_CPRESENCEINFOFILTERIMP }; + + +public: + + IMPORT_C static CPresenceInfoFilterImp* NewLC(); + IMPORT_C static CPresenceInfoFilterImp* NewL(); + virtual ~CPresenceInfoFilterImp(); + +private: + + CPresenceInfoFilterImp(); + void ConstructL(); + +public: // From MXIMPBase + + /** + * Implementation of MXIMPBase interface methods + * @see MXIMPBase + */ + XIMPIMP_DECLARE_IF_BASE_METHODS + +public: // From CXIMPApiDataObjBase + + /** + * @see CXIMPApiDataObjBase + */ + XIMPIMP_DECLARE_DATAOBJ_BASE_METHODS + + +public: // From MPresenceInfoFilter + + /** + * @see MPresenceInfoFilter + */ + void AcceptPersonFilterL( const TDesC8& aFieldName ); + + void AcceptServiceFilterL( + const TDesC8& aServiceName, + const TDesC8& aFieldName ); + + void AcceptDeviceFilterL( + const TDesC8& aDeviceName, + const TDesC8& aFieldName ); + + TBool MatchPersonFilter( const TDesC8& aFieldName ) const; + + TBool MatchServiceFilterL( + const TDesC8& aServiceName, + const TDesC8& aFieldName ) const; + + TBool MatchDeviceFilterL( + const TDesC8& aDeviceName, + const TDesC8& aFieldName ) const; + +public: // Internal versions of api + +public: // New functions + /** + * Internalizes object data from given stream. + * @param aStream Stream to read. + */ + IMPORT_C void InternalizeL( RReadStream& aStream ); + + /** + * Compares this filter to the given filter in a set-theoretic + * sense, whether aSource is a proper subset of this class. + * @param aCompare The filter to compare with + * @return ETrue if the given filter is a proper subset of this filter + */ + IMPORT_C TBool Contains( CPresenceInfoFilterImp& aCompare ); + + /** + * Compares this filter to the given filter + * @param aSource The filter to compare with + * @return ETrue if the given filter is same + */ + IMPORT_C TBool operator==( CPresenceInfoFilterImp& aSource ); + + /** + * Compares this filter to the given filter + * @param aSource The filter to compare with + * @return ETrue if the given filter is not same + */ + IMPORT_C TBool operator!=( CPresenceInfoFilterImp& aSource ); + + /** + * Create a new filter which is the union of "first" filter and the + * "second" filter. + * @param aFirst The first filter to use + * @param aSecond The second filter to use + * @return A new filter which is the union, ownership transferred + */ + IMPORT_C static CPresenceInfoFilterImp* UnionL( + CPresenceInfoFilterImp& aFirst, + CPresenceInfoFilterImp& aSecond ); + +private: // Helper functions + + /** + * Check if the collection of one-to-many filter infoname to fieldnames + * mappings accepts the given filter parameters. + * @param aFieldSet The field set to use + * @param aInfoName The info name string with wildcards (*, ?) + * @param aFieldName The field name string with wildcards (*, ?) + * @return ETrue if there was a match + */ + TBool MatchFilterL( + const RXIMPObjOwningPtrArray< CFilterField >& aFieldSet, + const TDesC8& aInfoName, + const TDesC8& aFieldName ) const; + + /** + * Externalize given array. + */ + void ExternalizeArrayL( + const CDesC8ArraySeg* aArray, RWriteStream& aStream ) const; + + /** + * Internalize given array. + */ + void InternalizeArrayL( + CDesC8ArraySeg* aArray, RReadStream& aStream ); + + /** + * Externalize a field set. + */ + void ExternalizeFieldSetL( + const RXIMPObjOwningPtrArray& aFieldSet, + RWriteStream& aStream ) const; + + /** + * Internalize a field set. + */ + void InternalizeFieldSetL( + RXIMPObjOwningPtrArray& aFieldSet, + RReadStream& aStream ); + + /** + * Helper for adding a filter field to the filter field + * set. + * @param aFieldSet the set into which to add + * @param aServiceType The service type + * @param aFieldType The field type + */ + void AcceptFilterL( + RXIMPObjOwningPtrArray< CFilterField >& aFieldSet, + const TDesC8& aServiceType, + const TDesC8& aFieldType ); + + /** + * Create an union of the given field sets. + * @aSource Source for union + * @aTarget Target for union + */ + void UnionOfFieldsL( + RXIMPObjOwningPtrArray< CFilterField>& aSource, + RXIMPObjOwningPtrArray< CFilterField>& aTarget ); + + /** + * @return ETrue iff aCompare is a proper subset of aA, i.e. it's contained fully, + * based on person filter fields + */ + TBool ContainsPersonFilter( + CDesC8ArraySeg* aA, + CDesC8ArraySeg* aCompare ); + + /** + * @return ETrue iff aCompare is a proper subset of aA, i.e. it's contained fully, + * based on filter field array comparison + */ + TBool ContainsFilterFields( + RXIMPObjOwningPtrArray& aA, + RXIMPObjOwningPtrArray& aCompare + ); + +private: // data + + // owned + CDesC8ArraySeg* iPersonFilter; + + // owned, set of fields + RXIMPObjOwningPtrArray iServiceFilter; + + // owned, set of fields + RXIMPObjOwningPtrArray iDeviceFilter; + }; + + +#endif // CPRESENCEINFOFILTERIMP_H diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencedatamodel/presencepublishing/presenceinfoimp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencedatamodel/presencepublishing/presenceinfoimp.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,129 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MPresenceInfo API object implementation. +* +*/ + +#ifndef CPRESENCEINFOIMP_H +#define CPRESENCEINFOIMP_H + +#include "ximpapidataobjbase.h" +#include "presenceapiobjbase.h" +#include +#include +#include "presencetypehelpers.h" + +class CPersonPresenceInfoImp; +class CServicePresenceInfoImp; +class CDevicePresenceInfoImp; +class CPresenceInfoFilterImp; + + +/** + * MPresenceInfo API object implementation. + * + * @lib ximpdatamodel.dll + * @since S60 v3.2 + */ +NONSHARABLE_CLASS( CPresenceInfoImp ): public CXIMPApiDataObjBase, + public MPresenceInfo + { + public: + /** The class ID. */ + enum { KClassId = PRIMP_CLSID_CPRESENCEINFOIMP }; + + +public: + + IMPORT_C static CPresenceInfoImp* NewLC(); + IMPORT_C static CPresenceInfoImp* NewL(); + virtual ~CPresenceInfoImp(); + +private: + + CPresenceInfoImp(); + void ConstructL(); + +public: // From MXIMPBase + + /** + * Implementation of MXIMPBase interface methods + * @see MXIMPBase + */ + XIMPIMP_DECLARE_IF_BASE_METHODS + +public: // From CXIMPApiDataObjBase + + /** + * @see CXIMPApiDataObjBase + */ + XIMPIMP_DECLARE_DATAOBJ_BASE_METHODS + +public: // From MPresenceInfo + + const MPersonPresenceInfo* PersonPresence() const; + MPersonPresenceInfo* PersonPresence(); + void SetPersonPresenceL( MPersonPresenceInfo* aPersonPresence ); + + TInt ServicePresenceCount() const; + const MServicePresenceInfo& ServicePresenceAt( TInt aIndex ) const; + void LookupServicePresenceByServiceType( MServicePresenceInfo*& aServicePresence, + const TDesC8& aMatch ) const; + void AddServicePresenceL( MServicePresenceInfo* aServicePresence ); + + TInt DevicePresenceCount() const; + const MDevicePresenceInfo& DevicePresenceAt( TInt aIndex ) const; + void AddDevicePresenceL( MDevicePresenceInfo* aDevicePresence ); + +public: // New functions + + /** + * Internalizes object data from given stream. + * @param aStream Stream to read. + */ + IMPORT_C void InternalizeL( RReadStream& aStream ); + + /** + * Creates and returns a filtered copy of this class, according + * to the given filter. + * Ownership transferred. + * @param aFilter The filter to use + * @return New filtered info imp instance + */ + IMPORT_C CPresenceInfoImp* FilteredInfoLC( + const CPresenceInfoFilterImp& aFilter + ) const; + +private: // data + + + /** + * OWN: + */ + CPersonPresenceInfoImp* iPersonPresence; + + /** + * OWN: + */ + RPrServicePrInfoArray iServicePresences; + + /** + * OWN: + */ + RPrDevicePrInfoArray iDevicePresences; + + }; + + +#endif // CPRESENCEINFOIMP_H diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencedatamodel/presencepublishing/presencewatcherinfoimp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencedatamodel/presencepublishing/presencewatcherinfoimp.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,297 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MPresenceWatcherInfo API object implementation. +* +*/ + + +#include "presencewatcherinfoimp.h" +#include "ximpidentityimp.h" +#include "ximprbufhelpers.h" +#include "ximpobjecthelpers.h" + +// ============================ MEMBER FUNCTIONS ============================= + +// --------------------------------------------------------------------------- +// CPresenceWatcherInfoImp::NewLC() +// --------------------------------------------------------------------------- +// +EXPORT_C CPresenceWatcherInfoImp* CPresenceWatcherInfoImp::NewLC( + const MPresenceWatcherInfo::TWatcherType aType, + const MXIMPIdentity& aIdentity, + const TDesC16& aDisplayName ) + { + CPresenceWatcherInfoImp* self = new( ELeave ) CPresenceWatcherInfoImp; + CleanupStack::PushL( self ); + self->ConstructL( aType, aIdentity, aDisplayName ); + return self; + } + +// --------------------------------------------------------------------------- +// CPresenceWatcherInfoImp::NewLC() +// --------------------------------------------------------------------------- +// +EXPORT_C CPresenceWatcherInfoImp* CPresenceWatcherInfoImp::NewLC() + { + CPresenceWatcherInfoImp* self = new( ELeave ) CPresenceWatcherInfoImp; + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + + +// --------------------------------------------------------------------------- +// CPresenceWatcherInfoImp::NewL() +// --------------------------------------------------------------------------- +// +EXPORT_C CPresenceWatcherInfoImp* CPresenceWatcherInfoImp::NewL() + { + CPresenceWatcherInfoImp* self = NewLC(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// CPresenceWatcherInfoImp::NewFromStreamLC() +// --------------------------------------------------------------------------- +// +XIMPIMP_IMPLEMENT_DATAOBJ_NEWFROMSTREAM( CPresenceWatcherInfoImp ) + + +// --------------------------------------------------------------------------- +// Implement supported interface access. +// --------------------------------------------------------------------------- +// +XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CPresenceWatcherInfoImp, + MPresenceWatcherInfo ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + + +XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CPresenceWatcherInfoImp, + MPresenceWatcherInfo ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + +// --------------------------------------------------------------------------- +// CPresenceWatcherInfoImp::~CPresenceWatcherInfoImp() +// --------------------------------------------------------------------------- +// +CPresenceWatcherInfoImp::~CPresenceWatcherInfoImp() + { + iDisplayName.Close(); + delete iIdentity; + } + +// --------------------------------------------------------------------------- +// CPresenceWatcherInfoImp::CPresenceWatcherInfoImp() +// --------------------------------------------------------------------------- +// +CPresenceWatcherInfoImp::CPresenceWatcherInfoImp() + { + } + + +// --------------------------------------------------------------------------- +// CPresenceWatcherInfoImp::ConstructL() +// --------------------------------------------------------------------------- +// +void CPresenceWatcherInfoImp::ConstructL() + { + iDisplayName.CreateL( 0 ); + iIdentity = CXIMPIdentityImp::NewLC(); + CleanupStack::Pop( iIdentity ); + } + +// --------------------------------------------------------------------------- +// CPresenceWatcherInfoImp::ConstructL() +// --------------------------------------------------------------------------- +// +void CPresenceWatcherInfoImp::ConstructL( + const MPresenceWatcherInfo::TWatcherType aType, + const MXIMPIdentity& aIdentity, + const TDesC16& aDisplayName ) + { + iType = aType; + + const CXIMPIdentityImp* sourceIdentity = + TXIMPGetImpClassOrPanic< const CXIMPIdentityImp >::From( aIdentity ); + iIdentity = TXIMPObjectCloner< CXIMPIdentityImp >::CloneL( *sourceIdentity ); + + iDisplayName.CreateL( aDisplayName ); + } + +// --------------------------------------------------------------------------- +// CPresenceWatcherInfoImp::ExternalizeL() +// --------------------------------------------------------------------------- +// +void CPresenceWatcherInfoImp::ExternalizeL( RWriteStream& aStream ) const + { + aStream.WriteInt32L( iType ); + iIdentity->ExternalizeL( aStream ); + XIMPRBuf16Helper::ExternalizeL( iDisplayName, aStream ); + } + +// --------------------------------------------------------------------------- +// CPresenceWatcherInfoImp::InternalizeL() +// --------------------------------------------------------------------------- +// +EXPORT_C void CPresenceWatcherInfoImp::InternalizeL( RReadStream& aStream ) + { + iType = ( MPresenceWatcherInfo::TWatcherType ) aStream.ReadInt32L(); + iIdentity->InternalizeL( aStream ); + XIMPRBuf16Helper::InternalizeL( iDisplayName, aStream ); + } + +// --------------------------------------------------------------------------- +// From MPresenceWatcherInfo class. +// CPresenceWatcherInfoImp::WatcherId() +// --------------------------------------------------------------------------- +// +const MXIMPIdentity& CPresenceWatcherInfoImp::WatcherId() const + { + return *iIdentity; + } + +// --------------------------------------------------------------------------- +// From MPresenceWatcherInfo class. +// CPresenceWatcherInfoImp::WatcherDisplayName() +// --------------------------------------------------------------------------- +// +const TDesC16& CPresenceWatcherInfoImp::WatcherDisplayName() const + { + return iDisplayName; + } + + + +// --------------------------------------------------------------------------- +// From MPresenceWatcherInfo class. +// CPresenceWatcherInfoImp::WatcherType() +// --------------------------------------------------------------------------- +// +MPresenceWatcherInfo::TWatcherType CPresenceWatcherInfoImp::WatcherType() const + { + return iType; + } + + +// --------------------------------------------------------------------------- +// From MPresenceWatcherInfo class. +// CPresenceWatcherInfoImp::SetWatcherIdL() +// --------------------------------------------------------------------------- +// +void CPresenceWatcherInfoImp::SetWatcherIdL( MXIMPIdentity* aIdentity ) + { + User::LeaveIfError( aIdentity == NULL ? KErrArgument : KErrNone ); + + CXIMPIdentityImp* identityImp = + TXIMPGetImpClassOrPanic< CXIMPIdentityImp>::From( *aIdentity ); + + delete iIdentity; + iIdentity = identityImp; + } + + +// --------------------------------------------------------------------------- +// From MPresenceWatcherInfo class. +// CPresenceWatcherInfoImp::SetWatcherDisplayNameL() +// --------------------------------------------------------------------------- +// +void CPresenceWatcherInfoImp::SetWatcherDisplayNameL( + const TDesC16& aDisplayName ) + { + HBufC16* displayNameBuf = aDisplayName.AllocL(); + iDisplayName.Close(); + iDisplayName.Assign( displayNameBuf ); + } + + +// --------------------------------------------------------------------------- +// From MPresenceWatcherInfo class. +// CPresenceWatcherInfoImp::SetWatcherTypeL() +// --------------------------------------------------------------------------- +// +void CPresenceWatcherInfoImp::SetWatcherTypeL( + MPresenceWatcherInfo::TWatcherType aType ) + { + iType = aType; + } + + +// --------------------------------------------------------------------------- +// CPresenceWatcherInfoImp::SetIdentityL() +// --------------------------------------------------------------------------- +// +EXPORT_C void CPresenceWatcherInfoImp::SetIdentity( CXIMPIdentityImp* aIdentity ) + { + delete iIdentity; + iIdentity = aIdentity; + } + +// --------------------------------------------------------------------------- +// CPresenceWatcherInfoImp::SetIdentityL() +// --------------------------------------------------------------------------- +// +EXPORT_C void CPresenceWatcherInfoImp::SetDisplayName( HBufC16* aDisplayName ) + { + iDisplayName.Close(); + iDisplayName.Assign( aDisplayName ); + } + +// --------------------------------------------------------------------------- +// CPresenceWatcherInfoImp::GroupIdLinearOrder() +// --------------------------------------------------------------------------- +// +EXPORT_C TInt CPresenceWatcherInfoImp::IdLinearOrder( + const CPresenceWatcherInfoImp& aA, + const CPresenceWatcherInfoImp& aB ) + { + return aA.IdentityImp().Compare( aB.IdentityImp() ); + } +// --------------------------------------------------------------------------- +// CPresenceWatcherInfoImp::Identity() +// --------------------------------------------------------------------------- +// +EXPORT_C const CXIMPIdentityImp& CPresenceWatcherInfoImp::IdentityImp() const + { + return *iIdentity; + } + +// --------------------------------------------------------------------------- +// CPresenceWatcherInfoImp::EqualsContent() +// --------------------------------------------------------------------------- +// +TBool CPresenceWatcherInfoImp::EqualsContent( + const CXIMPApiDataObjBase& aOtherInstance ) const + { + const CPresenceWatcherInfoImp* tmp = + TXIMPGetImpClassOrPanic< const CPresenceWatcherInfoImp >::From( + aOtherInstance.Base() ); + + TBool same = ETrue; + TBool x; + x = iIdentity->EqualsContent( *( tmp->iIdentity ) ); + same &= x; + + x = 0 == iDisplayName.Compare( tmp->iDisplayName ); + same &= x; + + x = iType == iType; + same &= x; + + // add more comparisons in a similar way... + + return same; + } + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencedatamodel/presencepublishing/presencewatcherinfoimp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencedatamodel/presencepublishing/presencewatcherinfoimp.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,143 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MPresentityGroupInfo API object implementation. +* +*/ + +#ifndef CPRESENTITYWATCHERINFOIMP_H +#define CPRESENTITYWATCHERINFOIMP_H + +#include +#include +#include +#include "ximpapidataobjbase.h" +#include "presenceapiobjbase.h" + + +class CXIMPIdentityImp; + +/** + * MPresenceInfo API object implementation. + * + * @lib ximpdatamodel.dll + * @since S60 v3.2 + */ +NONSHARABLE_CLASS( CPresenceWatcherInfoImp ): public CXIMPApiDataObjBase, + public MPresenceWatcherInfo + { + public: + /** The class ID. */ + enum { KClassId = PRIMP_CLSID_CPRESENCEWATCHERINFOIMP }; + +public: + + IMPORT_C static CPresenceWatcherInfoImp* NewLC( + const MPresenceWatcherInfo::TWatcherType aType, + const MXIMPIdentity& aIdentity, + const TDesC16& aDisplayName ); + IMPORT_C static CPresenceWatcherInfoImp* NewLC(); + IMPORT_C static CPresenceWatcherInfoImp* NewL(); + virtual ~CPresenceWatcherInfoImp(); + +private: + + CPresenceWatcherInfoImp(); + void ConstructL(); + void ConstructL( const MPresenceWatcherInfo::TWatcherType aType, + const MXIMPIdentity& aIdentity, + const TDesC16& aDisplayName ); + + /** + * @see CXIMPApiDataObjBase + */ + XIMPIMP_DECLARE_DATAOBJ_BASE_PRIV_METHODS + +public: // From MXIMPBase + + /** + * Implementation of MXIMPBase interface methods + * @see MXIMPBase + */ + XIMPIMP_DECLARE_IF_BASE_METHODS + + /** + * @see CXIMPApiDataObjBase + */ + XIMPIMP_DECLARE_DATAOBJ_BASE_METHODS + +public: // From MPresenceWatcherInfo + + const MXIMPIdentity& WatcherId() const; + const TDesC16& WatcherDisplayName() const; + MPresenceWatcherInfo::TWatcherType WatcherType() const; + void SetWatcherIdL( MXIMPIdentity* aIdentity ); + void SetWatcherDisplayNameL( const TDesC16& aDisplayName ); + void SetWatcherTypeL( MPresenceWatcherInfo::TWatcherType aType ); + + + + +public: // New functions + + /** + * Internalizes object data from given stream. + * @param aStream Stream to read. + */ + IMPORT_C void InternalizeL( RReadStream& aStream ); + + /** + * Set identity + */ + IMPORT_C void SetIdentity( CXIMPIdentityImp* aIdentity ); + + /** + * Set identity + */ + IMPORT_C void SetDisplayName( HBufC16* aDisplayName ); + + /** + * TLinearOrder for ordering based on stored group id, + * when this class is used within an RPointerArray or derivatives. + */ + IMPORT_C static TInt IdLinearOrder( + const CPresenceWatcherInfoImp& aA, + const CPresenceWatcherInfoImp& aB ); + + /** + * Access to identity object + * @return Identity + */ + IMPORT_C const CXIMPIdentityImp& IdentityImp() const; + +private: // data + + /** + * Identity + */ + CXIMPIdentityImp* iIdentity; + + /** + * Displayname + */ + RBuf16 iDisplayName; + + /** + * Watcher type + */ + MPresenceWatcherInfo::TWatcherType iType; + + }; + + +#endif // CPRESENTITYWATCHERINFOIMP_H diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencedatamodel/presencepublishing/presencewatcherlisteventimp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencedatamodel/presencepublishing/presencewatcherlisteventimp.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,313 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Presence watcher list event implementation. + * +*/ + +#include "presencewatcherlisteventimp.h" +#include "presencewatcherinfoimp.h" +#include "ximpobjecthelpers.h" +#include "ximpidentityimp.h" +#include "ximpdatasubscriptionstateimp.h" +#include + + +// --------------------------------------------------------------------------- +// CPresenceWatcherListEventImp::NewLC() +// --------------------------------------------------------------------------- +// +EXPORT_C CPresenceWatcherListEventImp* CPresenceWatcherListEventImp::NewLC( + RPrWatLstInfoImpArray* aNew, + RPrWatLstInfoImpArray* aCurrent, + RPrWatLstInfoImpArray* aDisappeared, + CXIMPDataSubscriptionStateImp* aState + ) + { + CPresenceWatcherListEventImp* self = new( ELeave ) CPresenceWatcherListEventImp(); + CleanupStack::PushL( self ); + self->ConstructL( aNew, aCurrent, aDisappeared, aState ); + return self; + } + +// --------------------------------------------------------------------------- +// CPresenceWatcherListEventImp::NewFromStreamLC() +// --------------------------------------------------------------------------- +// +CXIMPApiEventBase* CPresenceWatcherListEventImp::NewFromStreamLC( RReadStream& aStream ) + { + CPresenceWatcherListEventImp* self = new( ELeave ) CPresenceWatcherListEventImp; + CleanupStack::PushL( self ); + self->ConstructL( aStream ); + return self; + } + +// --------------------------------------------------------------------------- +// CPresenceWatcherListEventImp::~CPresenceWatcherListEventImp() +// --------------------------------------------------------------------------- +// +CPresenceWatcherListEventImp::~CPresenceWatcherListEventImp() + { + if( iConstructedFromStream ) + { + delete iNewWatchers; + delete iCurrent; + delete iDisappeared; + iCurrent = NULL; + } + if( iOwnsCurrent ) + { + delete iCurrent; + } + + delete iSubscriptionState; + } + + +// --------------------------------------------------------------------------- +// CPresenceWatcherListEventImp::CPresenceWatcherListEventImp() +// --------------------------------------------------------------------------- +// +CPresenceWatcherListEventImp::CPresenceWatcherListEventImp() + { + } + + +// --------------------------------------------------------------------------- +// CPresenceWatcherListEventImp::ConstructL() +// --------------------------------------------------------------------------- +// +void CPresenceWatcherListEventImp::ConstructL( + RPrWatLstInfoImpArray* aNew, + RPrWatLstInfoImpArray* aCurrent, + RPrWatLstInfoImpArray* aDisappeared, + CXIMPDataSubscriptionStateImp* aState ) + { + iNewWatchers = aNew; + if( iCurrent ) + { + iCurrent = aCurrent; + } + else + { + iCurrent = new ( ELeave ) RPrWatLstInfoImpArray; + iOwnsCurrent = ETrue; + } + iDisappeared = aDisappeared; + iSubscriptionState = aState; + } + +// --------------------------------------------------------------------------- +// CPresenceWatcherListEventImp::ConstructL() +// --------------------------------------------------------------------------- +// +void CPresenceWatcherListEventImp::ConstructL( RReadStream& aStream ) + { + iConstructedFromStream = ETrue; + + iNewWatchers = new ( ELeave ) RPrWatLstInfoImpArray; + iCurrent = new ( ELeave ) RPrWatLstInfoImpArray; + iDisappeared = new ( ELeave ) RPrWatLstInfoImpArray; + iSubscriptionState = CXIMPDataSubscriptionStateImp::NewL(); + + FillArrayFromStreamL( *iNewWatchers, aStream ); + FillArrayFromStreamL( *iCurrent, aStream ); + FillArrayFromStreamL( *iDisappeared, aStream ); + + iSubscriptionState->InternalizeL( aStream ); + } + +// --------------------------------------------------------------------------- +// Implement supported interface access. +// --------------------------------------------------------------------------- +// +XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CPresenceWatcherListEventImp, + MPresenceWatcherListEvent ) + XIMPIMP_IF_BASE_GET_CLASS( CXIMPApiEventBase, this ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + +XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CPresenceWatcherListEventImp, + MPresenceWatcherListEvent ) + XIMPIMP_IF_BASE_GET_CONST_CLASS( CXIMPApiEventBase, this ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + + + +// --------------------------------------------------------------------------- +// Implement methods from base event interface and base event class +// --------------------------------------------------------------------------- +// +XIMPIMP_IMPLEMENT_EVENT_BASE_METHODS( CPresenceWatcherListEventImp, + MPresenceWatcherListEvent ) + +// --------------------------------------------------------------------------- +// CPresenceWatcherListEventImp::EqualsContent() +// --------------------------------------------------------------------------- +// +TBool CPresenceWatcherListEventImp::EqualsContent( + const CXIMPApiEventBase& aOtherInstance ) const + { + const CPresenceWatcherListEventImp* tmp = + TXIMPGetImpClassOrPanic< const CPresenceWatcherListEventImp >::From( + aOtherInstance.Base() ); + TBool same = ETrue; + TBool x = TXIMPEqualsContent< CPresenceWatcherInfoImp >::Array( *iNewWatchers, *( tmp->iNewWatchers ) ); + same &= x; + + x = TXIMPEqualsContent< CPresenceWatcherInfoImp >::Array( *iCurrent, *( tmp->iCurrent ) ); + same &= x; + + x = TXIMPEqualsContent< CPresenceWatcherInfoImp >::Array( *iDisappeared, *( tmp->iDisappeared ) ); + same &= x; + + x = iSubscriptionState->EqualsContent( *tmp->iSubscriptionState ); + same &= x; + + return same; + } + +// --------------------------------------------------------------------------- +// From class CXIMPApiEventBase. +// CPresenceWatcherListEventImp::ExternalizeL() +// --------------------------------------------------------------------------- +// +void CPresenceWatcherListEventImp::ExternalizeL( RWriteStream& aStream ) const + { + WriteArrayToStreamL( *iNewWatchers, aStream ); + WriteArrayToStreamL( *iCurrent, aStream ); + WriteArrayToStreamL( *iDisappeared, aStream ); + iSubscriptionState->ExternalizeL( aStream ); + } + + +// --------------------------------------------------------------------------- +// From MPresenceWatcherListEvent class. +// CPresenceWatcherListEventImp::NewWatchersCount() +// --------------------------------------------------------------------------- +// +TInt CPresenceWatcherListEventImp::NewWatchersCount() const + { + return iNewWatchers->Count(); + } + +// --------------------------------------------------------------------------- +// From MPresenceWatcherListEvent class. +// CPresenceWatcherListEventImp::NewWatcher() +// --------------------------------------------------------------------------- +// +const MPresenceWatcherInfo& + CPresenceWatcherListEventImp::NewWatcher( TInt aIndex ) const + { + return *(*iNewWatchers)[ aIndex ]; + } + +// --------------------------------------------------------------------------- +// From MPresenceWatcherListEvent class. +// CPresenceWatcherListEventImp::DisappearedWatchersCount() +// --------------------------------------------------------------------------- +// +TInt CPresenceWatcherListEventImp::DisappearedWatchersCount() const + { + return iDisappeared->Count(); + } + +// --------------------------------------------------------------------------- +// From MPresenceWatcherListEvent class. +// CPresenceWatcherListEventImp::DisappearedWatcher() +// --------------------------------------------------------------------------- +// +const MPresenceWatcherInfo& + CPresenceWatcherListEventImp::DisappearedWatcher( TInt aIndex ) const + { + return *(*iDisappeared)[ aIndex ]; + } + + +// --------------------------------------------------------------------------- +// From MPresenceWatcherListEvent class. +// CPresenceWatcherListEventImp::CurrentWatchersCount() +// --------------------------------------------------------------------------- +// +TInt CPresenceWatcherListEventImp::CurrentWatchersCount() const + { + return iCurrent->Count(); + } + +// --------------------------------------------------------------------------- +// From MPresenceWatcherListEvent class. +// CPresenceWatcherListEventImp::CurrentWatcher() +// --------------------------------------------------------------------------- +// +const MPresenceWatcherInfo& + CPresenceWatcherListEventImp::CurrentWatcher( TInt aIndex ) const + { + return *(*iCurrent)[ aIndex ]; + } + + + + + + +// --------------------------------------------------------------------------- +// From class MPresenceWatcherListEvent. +// CPresenceWatcherListEventImp::DataSubscriptionState() +// --------------------------------------------------------------------------- +// +const MXIMPDataSubscriptionState& + CPresenceWatcherListEventImp::DataSubscriptionState() const + { + return *iSubscriptionState; + } + + +// --------------------------------------------------------------------------- +// CPresenceWatcherListEventImp::WriteArrayToStreamL() +// --------------------------------------------------------------------------- +// +void CPresenceWatcherListEventImp::WriteArrayToStreamL( + RPrWatLstInfoImpArray& aArray, RWriteStream& aStream ) const + { + TInt count = aArray.Count(); + aStream.WriteInt32L( count ); + { + for( TInt a = 0; a < count; ++a ) + { + aArray[ a ]->ExternalizeL( aStream ); + } + } + } + + +// --------------------------------------------------------------------------- +// CPresenceWatcherListEventImp::FillArrayFromStreamL +// --------------------------------------------------------------------------- +// +void CPresenceWatcherListEventImp::FillArrayFromStreamL( + RPrWatLstInfoImpArray& aArray, + RReadStream& aStream ) + { + TInt count = aStream.ReadInt32L(); + for( TInt a = 0; a < count; ++a ) + { + // the stream MUST be in order (since it was externalized by this class) + CPresenceWatcherInfoImp* newInfo = CPresenceWatcherInfoImp::NewLC(); + newInfo->InternalizeL( aStream ); + aArray.AppendL( newInfo ); + CleanupStack::Pop(); // newInfo + } + } + + +// End of file + diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencedatamodel/presencepublishing/presencewatcherlisteventimp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencedatamodel/presencepublishing/presencewatcherlisteventimp.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,152 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MPresentityGroupList API object implementation. + * +*/ + +#ifndef CPRESENCEWATCHERLISTEVENTIMP_H +#define CPRESENCEWATCHERLISTEVENTIMP_H + +#include +#include "ximpapieventbase.h" +#include "presencetypehelpers.h" + +class RReadStream; +class CPresenceWatcherInfoImp; +class CXIMPIdentityImp; +class CXIMPDataSubscriptionStateImp; + +/** + * MOwnPresenceEvent API object implementation. + * + * @lib ximpdatamodel.dll + * @since S60 v3.2 + */ +NONSHARABLE_CLASS( CPresenceWatcherListEventImp ): public CXIMPApiEventBase, + public MPresenceWatcherListEvent + { +public: + /** The class ID. */ + enum { KClassId = PRIMP_CLSID_CPRESENCEWATCHERLISTEVENTIMP }; + +public: + /** + * Exported instantiation method for initializing + * new event object. + */ + IMPORT_C static CPresenceWatcherListEventImp* NewLC( + RPrWatLstInfoImpArray* aNew, + RPrWatLstInfoImpArray* aCurrent, + RPrWatLstInfoImpArray* aDisappeared, + CXIMPDataSubscriptionStateImp* aState + ); + + /** + * Instantiation method for event automation. + * Method signature must be exactly this to work + * with event delivery automation system. + * + * Event implementation must be registered to + * XIMPEventCodec KXIMPEventConstructorTable. + */ + static CXIMPApiEventBase* NewFromStreamLC( RReadStream& aStream ); + + virtual ~CPresenceWatcherListEventImp(); + +private: + CPresenceWatcherListEventImp(); + + void ConstructL( + RPrWatLstInfoImpArray* aNew, + RPrWatLstInfoImpArray* aCurrent, + RPrWatLstInfoImpArray* aDisappeared, + CXIMPDataSubscriptionStateImp* aState + ); + + void ConstructL( RReadStream& aStream ); + + /** + * Helper for externalize. + */ + void WriteArrayToStreamL( RPrWatLstInfoImpArray& aArray, + RWriteStream& aStream ) const; + + /** + * Helper for internalize + */ + void FillArrayFromStreamL( RPrWatLstInfoImpArray& aArray, + RReadStream& aStream ); + + +public: // From API base interfaces + + /** + * Implementation of MXIMPBase interface methods + * @see MXIMPBase + */ + XIMPIMP_DECLARE_IF_BASE_METHODS + + + /** + * Implementation of MXIMPEventBase interface and + * CXIMPApiEventBase methods + * + * @see MXIMPEventBase + * @see CXIMPApiEventBase + */ + XIMPIMP_DECLARE_EVENT_BASE_METHODS + + +public: // From MPresenceWatcherListEvent + + TInt NewWatchersCount() const; + const MPresenceWatcherInfo& NewWatcher( TInt aIndex ) const; + + TInt DisappearedWatchersCount() const; + const MPresenceWatcherInfo& DisappearedWatcher( TInt aIndex ) const; + + TInt CurrentWatchersCount() const; + const MPresenceWatcherInfo& CurrentWatcher( TInt aIndex ) const; + + + const MXIMPDataSubscriptionState& DataSubscriptionState() const; + +private: // data + + /** + * ETrue if constructed from stream. + */ + TBool iConstructedFromStream; + + /** + * Group informations. + * Owns if constructed from stream. Otherwise does not own. + */ + RPrWatLstInfoImpArray* iNewWatchers; + RPrWatLstInfoImpArray* iCurrent; + RPrWatLstInfoImpArray* iDisappeared; + + /** + * Current array owning status + */ + TBool iOwnsCurrent; + + /** + * Subscription state + */ + CXIMPDataSubscriptionStateImp* iSubscriptionState; + }; + + +#endif // CPRESENCEWATCHERLISTEVENTIMP_H diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencedatamodel/presencepublishing/watcherlistsubscriptionitem.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencedatamodel/presencepublishing/watcherlistsubscriptionitem.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,200 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Presence Service Connection presence watcher list subscription implementation. +* +*/ + + +#include + +#include "watcherlistsubscriptionitem.h" +#include "presenceinfofilterimp.h" +#include "ximpitemparent.h" +#include "ximppanics.h" +#include "ximppsccontext.h" +#include "documentutils.h" +#include "presencewatcherlisteventimp.h" +#include "ximpobjecthelpers.h" +#include "presencetypehelpers.h" +#include "presencewatcherinfoimp.h" +#include "ximpidentityimp.h" +#include "ximpdatasubscriptionstateimp.h" + +#include "ximptrace.h" + +// --------------------------------------------------------------------------- +// CWatcherListSubscriptionItem::CWatcherListSubscriptionItem() +// --------------------------------------------------------------------------- +// +CWatcherListSubscriptionItem::CWatcherListSubscriptionItem( MXIMPItemParentBase& aParent ) +: CXIMPSubscriptionItemBase( aParent ) + { + } + + +// --------------------------------------------------------------------------- +// CWatcherListSubscriptionItem::ConstructL() +// --------------------------------------------------------------------------- +// +void CWatcherListSubscriptionItem::ConstructL() + { + BaseConstructL(); + // empty lists must always exist + iCurrentList = new ( ELeave) RPrWatLstInfoImpArray; + iNewWatchers = new ( ELeave ) RPrWatLstInfoImpArray; + iDisappeared = new ( ELeave ) RPrWatLstInfoImpArray; + } + + +// --------------------------------------------------------------------------- +// CWatcherListSubscriptionItem::NewL() +// --------------------------------------------------------------------------- +// +CWatcherListSubscriptionItem* CWatcherListSubscriptionItem::NewLC( MXIMPItemParentBase& aParent ) + { + CWatcherListSubscriptionItem* self = new( ELeave ) CWatcherListSubscriptionItem( aParent ); + CleanupClosePushL( *self ); + self->ConstructL(); + return self; + } + + +// --------------------------------------------------------------------------- +// CWatcherListSubscriptionItem::~CWatcherListSubscriptionItem() +// --------------------------------------------------------------------------- +// +CWatcherListSubscriptionItem::~CWatcherListSubscriptionItem() + { + MXIMPItemParent* presCache = static_cast(iParent.GetInterface(PRESENCE_ITEM_PARENT)); + presCache->RemoveMe( this ); + + + if( iCurrentList ) + { + iCurrentList->Close(); + } + delete iCurrentList; + + Clean(); + // just in case + delete iNewWatchers; + delete iDisappeared; + } + +// --------------------------------------------------------------------------- +// From MXIMPSubscriptionItem class. +// CWatcherListSubscriptionItem::SynthesiseSubscriptionEventTo() +// --------------------------------------------------------------------------- +// +void CWatcherListSubscriptionItem::SynthesiseSubscriptionEventToL( + MXIMPPscContext* aContext, TBool aForceEvent ) + { + TRACE_1( _L("CWatcherListSubscriptionItem::SynthesiseSubscriptionEventTo() aForce=%d"), aForceEvent ); + CXIMPDataSubscriptionStateImp* status = StatusLC( aContext ); /// << status + + if( status->DataState() == MXIMPDataSubscriptionState::EDataAvailable || aForceEvent ) + { + CleanupStack::Pop( status ); // >> status + CPresenceWatcherListEventImp* newEvent = CPresenceWatcherListEventImp::NewLC( + iNewWatchers, + aForceEvent ? iCurrentList : NULL, + iDisappeared, + status ); + + MXIMPItemParent* presCache = static_cast(iParent.GetInterface(PRESENCE_ITEM_PARENT)); + presCache->AddEventL( *newEvent, aContext ); + CleanupStack::PopAndDestroy(); // >>> newEvent + } + else + { + CleanupStack::PopAndDestroy(); // >>> status + } + } + + +// --------------------------------------------------------------------------- +// CWatcherListSubscriptionItem::SetNewListL() +// --------------------------------------------------------------------------- +// +EXPORT_C void CWatcherListSubscriptionItem::SetNewListL( + RPrWatLstInfoImpArray* aList ) + { + TRACE_1( _L("CWatcherListSubscriptionItem::SetNewListL aList Count=%d"), aList->Count() ); + RPrWatLstInfoImpArray* tmp = aList; + CleanupDeletePushL( tmp ); + + TLinearOrder + linearOrder( CPresenceWatcherInfoImp::IdLinearOrder ); + + for ( TInt i = 0; i < tmp->Count(); i++ ) + { + // compare against current list + CPresenceWatcherInfoImp* info = (*tmp)[ i ]; + TInt pos = iCurrentList->FindInOrder( info, linearOrder ); + + if ( pos == KErrNotFound ) + { + // not found in current list + // so must be a fresh watcher + iNewWatchers->InsertInOrderL( info, linearOrder ); + } + else + { + delete (*iCurrentList)[ pos ]; + iCurrentList->Remove( pos ); + + // we must remove the found ones from iCurrentList, + // otherwise we will not know what was left. and finding out + // the deleted items will be difficult. + } + } + + // what's left in iCurrentList contains the deleted ones. + delete iDisappeared; + iDisappeared = iCurrentList; + + // the given list becomes the new list + iCurrentList = tmp; + CleanupStack::Pop( tmp ); + iSubscriptionState->SetDataStateL( MXIMPDataSubscriptionState::EDataAvailable ); + } + +// --------------------------------------------------------------------------- +// CWatcherListSubscriptionItem::Clean() +// --------------------------------------------------------------------------- +// +EXPORT_C void CWatcherListSubscriptionItem::Clean() + { + TRACE( _L("CWatcherListSubscriptionItem::Clean") ); + // empty the lists. + // the lists must stay valid for use + + // iNewWatchers and iUpdated are collection from currentlist. Do not delete items. + // iDisappeared is only place for items. Delete those. + + iNewWatchers->Reset(); + iDisappeared->Close(); + } + +// --------------------------------------------------------------------------- +// From CXIMPSubscriptionItemBase class. +// CWatcherListSubscriptionItem::CleanExpired() +// --------------------------------------------------------------------------- +// +void CWatcherListSubscriptionItem::CleanExpired() + { + + } + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencedatamodel/presencepublishing/watcherlistsubscriptionitem.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencedatamodel/presencepublishing/watcherlistsubscriptionitem.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,122 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Presence Service Connection group list subscription implementation. +* +*/ + +#ifndef CPSCWATCHERLISTSUBSCRIPTIONITEM_H +#define CPSCWATCHERLISTSUBSCRIPTIONITEM_H + +#include +#include "presenceinfoimp.h" +#include "ximpsubscriptionitem.h" +#include "presencetypehelpers.h" +#include "ximpsubscriptionitembase.h" + +class MXIMPItemParentBase; +class MXIMPPscContext; +class CDesC16Array; +class CPresenceWatcherInfoImp; + +/** + * PSC group list subscription implementation + * + * @since S60 v3.2 + */ +class CWatcherListSubscriptionItem : public CXIMPSubscriptionItemBase + { + +public: // Construction and destruction + + /** + * Construction + * @param aParent. Parent has to be informed when this object is deleted by RemoveMe method. + */ + static CWatcherListSubscriptionItem* NewLC( MXIMPItemParentBase& aParent ); + + /** + * Destruction + * - Remember to inform parent about delete. + */ + ~CWatcherListSubscriptionItem(); + +private: // Construction and destruction + + /** + * Construction + * @param aParent. Parent has to be informed when this object is deleted by RemoveMe method. + */ + CWatcherListSubscriptionItem( MXIMPItemParentBase& aParent ); + + /** + * Construction + */ + void ConstructL(); + +public: // New methods + + /** + * Resolve deltas and replace old current with new list. + * @param aList New current list. + */ + IMPORT_C void SetNewListL( RPrWatLstInfoImpArray* aList ); + + /** + * Remove the temporary lists. + */ + IMPORT_C void Clean(); + +public: // From MXIMPSubscriptionItem + + /** + * @see MXIMPSubscriptionItem + */ + void SynthesiseSubscriptionEventToL( MXIMPPscContext* aContext, TBool aForceEvent ); + +private: // From CXIMPSubscriptionItemBase + + /** + * @see CXIMPSubscriptionItemBase + */ + void CleanExpired(); + + +private: // Data + + /** + * Current list of groups. + * Owned. + */ + RPrWatLstInfoImpArray* iCurrentList; + + /** + * List of created groups (new since last update). + * Owned. + */ + RPrWatLstInfoImpArray* iNewWatchers; + + /** + * List of deleted groups (removed since last update). + * Owned. + */ + RPrWatLstInfoImpArray* iDisappeared; + + }; + + +/* ======================================================================== */ + + + +#endif // CPSCWATCHERLISTSUBSCRIPTIONITEM_H diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencedatamodel/presencetypehelpers.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencedatamodel/presencetypehelpers.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,67 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Typedef helpers for really long typenames. + * +*/ + +#ifndef PRESENCETYPEHELPERS_H +#define PRESENCETYPEHELPERS_H + +#include "ximpapiobjbase.h" +#include "presenceapiobjbase.h" +#include + +class CPresentityGroupInfoImp; +class CPresentityGroupMemberInfoImp; +class CPresenceWatcherInfoImp; +class CXIMPIdentityImp; +class CPresenceGrantRequestInfoImp; +class CXIMPApiDataObjBase; +class CPresenceBlockInfoImp; +class CPresenceInfoFieldImp; +class CServicePresenceInfoImp; +class CDevicePresenceInfoImp; + +// Key for opening up the typedefs: +// +// R(Xyz)Array = RXIMPObjOwningPtrArray +// Pr = Presentity +// GrpInfo = GroupInfo +// GrpMemInfo = GroupMemberInfo +// WatLstInfo = WatcherListInfo +// +// When adding new types, follow these conventions. +// + +typedef RXIMPObjOwningPtrArray RPrGrpInfoImpArray; +typedef RXIMPObjOwningPtrArray RPrGrpMemInfoImpArray; +typedef RXIMPObjOwningPtrArray RPrWatLstInfoImpArray; +typedef RXIMPObjOwningPtrArray RPrIdImpArray; +typedef RXIMPObjOwningPtrArray RPrGrntReqInfoImpArray; +typedef RXIMPObjOwningPtrArray RPrBlockInfoImpArray; +typedef RXIMPObjOwningPtrArray RPrInfoFieldArray; +typedef RXIMPObjOwningPtrArray RPrServicePrInfoArray; +typedef RXIMPObjOwningPtrArray RPrDevicePrInfoArray; + +struct SPresenceReqParam + { + CXIMPApiDataObjBase* iParam; + TInt iParamType; + }; + +typedef RArray RPresenceReqParamArray; + +#endif // PRESENCETYPEHELPERS_H + + diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencedatamodel/presencewatching/presentitygroupmemberspresencesubscriptionitem.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencedatamodel/presencewatching/presentitygroupmemberspresencesubscriptionitem.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,363 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Presence Service Connection group list subscription implementation. +* +*/ + + +#include "presentitygroupmemberspresencesubscriptionitem.h" +#include "groupcontentsubscriptionitem.h" +#include "presenceinfofilterimp.h" +#include "ximpitemparent.h" +#include "ximppanics.h" +#include "ximppsccontext.h" +#include "documentutils.h" // Perhaps this should be renamed +#include "presentitypresenceeventimp.h" +#include "presentitygroupmemberinfoimp.h" +#include "ximpidentityimp.h" + +#include "ximptrace.h" + +// --------------------------------------------------------------------------- +// CPresentityGroupMembersPresenceSubscriptionItem::CPresentityGroupMembersPresenceSubscriptionItem() +// --------------------------------------------------------------------------- +// +CPresentityGroupMembersPresenceSubscriptionItem::CPresentityGroupMembersPresenceSubscriptionItem( MXIMPItemParentBase& aParent, CGroupContentSubscriptionItem& aContentItem ) +: CXIMPSubscriptionItemBase( aParent ), iContentItem( aContentItem ) + { + } + + +// --------------------------------------------------------------------------- +// CPresentityGroupMembersPresenceSubscriptionItem::ConstructL() +// --------------------------------------------------------------------------- +// +void CPresentityGroupMembersPresenceSubscriptionItem::ConstructL() + { + BaseConstructL(); + iContentItem.RegisterEventObserverL( this ); + } + + +// --------------------------------------------------------------------------- +// CPresentityGroupMembersPresenceSubscriptionItem::NewLC() +// --------------------------------------------------------------------------- +// +CPresentityGroupMembersPresenceSubscriptionItem* + CPresentityGroupMembersPresenceSubscriptionItem::NewLC( MXIMPItemParentBase& aParent, + CGroupContentSubscriptionItem& aContentItem ) + { + CleanupClosePushL( aContentItem ); + CPresentityGroupMembersPresenceSubscriptionItem* self = + new( ELeave ) CPresentityGroupMembersPresenceSubscriptionItem( aParent, aContentItem ); + CleanupStack::Pop(); //aContentItem + CleanupClosePushL( *self ); + self->ConstructL(); + return self; + } + + +// --------------------------------------------------------------------------- +// CPresentityGroupMembersPresenceSubscriptionItem::~CPresentityGroupMembersPresenceSubscriptionItem() +// --------------------------------------------------------------------------- +// +CPresentityGroupMembersPresenceSubscriptionItem::~CPresentityGroupMembersPresenceSubscriptionItem() + { + MXIMPItemParent* presCache = static_cast(iParent.GetInterface(PRESENCE_ITEM_PARENT)); + presCache->RemoveMe( this ); + + + delete iIdentity; + delete iPresenceInfo; + + delete iPif; + iContentItem.UnregisterEventObserver( this ); + } + +// --------------------------------------------------------------------------- +// CPresentityGroupMembersPresenceSubscriptionItem::SubscriptionPif() +// --------------------------------------------------------------------------- +// +EXPORT_C CPresenceInfoFilterImp& + CPresentityGroupMembersPresenceSubscriptionItem::SubscriptionPif() + { + TRACE(_L("CPresentityGroupMembersPresenceSubscriptionItem::SubscriptionPif" ) ); + __ASSERT_ALWAYS( iPif, User::Panic( NXIMPPrivPanic::KCategory, + NXIMPPrivPanic::EOwnPresencePifNotSet ) ); + return *iPif; + } + +// --------------------------------------------------------------------------- +// CPresentityGroupMembersPresenceSubscriptionItem::SetSubscriptionPif() +// --------------------------------------------------------------------------- +// +EXPORT_C void CPresentityGroupMembersPresenceSubscriptionItem::SetSubscriptionPif( + CPresenceInfoFilterImp* aPif ) + { + TRACE(_L("CPresentityGroupMembersPresenceSubscriptionItem::SetSubscriptionPif" ) ); + delete iPif; + iPif = aPif; + } + +// --------------------------------------------------------------------------- +// CPresentityGroupMembersPresenceSubscriptionItem::CollectSubscriptionPifWithoutCtxL() +// --------------------------------------------------------------------------- +// +EXPORT_C CPresenceInfoFilterImp* + CPresentityGroupMembersPresenceSubscriptionItem::CollectSubscriptionPifWithoutCtxL( + MXIMPPscContext* aContext ) + { + TRACE(_L("CPresentityGroupMembersPresenceSubscriptionItem::CollectSubscriptionPifWithoutCtxL" ) ); + RPointerArray< CPresenceInfoFilterImp > arrayOfPifs; + CleanupClosePushL( arrayOfPifs ); + + TInt count = iContexts.Count(); + for( TInt a = 0; a < count; ++a ) + { + if( iContexts[ a ] != aContext ) + { + CPresenceInfoFilterImp* filter = iContexts[ a ]->PresenceInfoFilter( + MXIMPPscContext::EPresentityGroupMemberPresenceFilter, iIdentity ); + if ( filter ) + { + arrayOfPifs.AppendL( filter ); + } + } + } + CPresenceInfoFilterImp* pifWithoutCtx = DocumentUtils::InfoFilterUnionL( arrayOfPifs ); + CleanupStack::PopAndDestroy(); // arrayOfPifs + TRACE(_L("CPresentityGroupMembersPresenceSubscriptionItem::CollectSubscriptionPifWithoutCtxL done" ) ); + return pifWithoutCtx; + } + +// --------------------------------------------------------------------------- +// CPresentityGroupMembersPresenceSubscriptionItem::SetPresenceInfoL() +// --------------------------------------------------------------------------- +// +EXPORT_C void CPresentityGroupMembersPresenceSubscriptionItem::SetPresenceInfoL( + CPresenceInfoImp* aPresenceInfo ) + { + TRACE(_L("CPresentityGroupMembersPresenceSubscriptionItem::SetPresenceInfoL" ) ); + delete iPresenceInfo; + iPresenceInfo = aPresenceInfo; + iSubscriptionState->SetDataStateL( MXIMPDataSubscriptionState::EDataAvailable ); + } + +// --------------------------------------------------------------------------- +// CPresentityGroupMembersPresenceSubscriptionItem::Order() +// --------------------------------------------------------------------------- +// +EXPORT_C TInt CPresentityGroupMembersPresenceSubscriptionItem::Order( + const CPresentityGroupMembersPresenceSubscriptionItem& aA, + const CPresentityGroupMembersPresenceSubscriptionItem& aB ) + { + return IdentityOrder( aA.iIdentity, aB ); + } +// --------------------------------------------------------------------------- +// CPresentityGroupMembersPresenceSubscriptionItem::Order() +// --------------------------------------------------------------------------- +// +EXPORT_C TInt CPresentityGroupMembersPresenceSubscriptionItem::IdentityOrder( + const CXIMPIdentityImp* aA, + const CPresentityGroupMembersPresenceSubscriptionItem& aB ) + { + return aA->Compare( *aB.iIdentity ); + } + +// --------------------------------------------------------------------------- +// CPresentityGroupMembersPresenceSubscriptionItem::Identity() +// --------------------------------------------------------------------------- +// +EXPORT_C const MXIMPIdentity& CPresentityGroupMembersPresenceSubscriptionItem::Identity() const + { + return *iIdentity; + } + +// --------------------------------------------------------------------------- +// CPresentityGroupMembersPresenceSubscriptionItem::SetIdentity() +// --------------------------------------------------------------------------- +// +EXPORT_C void CPresentityGroupMembersPresenceSubscriptionItem::SetIdentity( + CXIMPIdentityImp* aIdentity ) + { + delete iIdentity; + iIdentity = aIdentity; + } + +// --------------------------------------------------------------------------- +// From class MXIMPSubscriptionItem. +// CPresentityGroupMembersPresenceSubscriptionItem::SynthesiseSubscriptionEventTo() +// --------------------------------------------------------------------------- +// +void CPresentityGroupMembersPresenceSubscriptionItem::SynthesiseSubscriptionEventToL( + MXIMPPscContext* aContext, + TBool aForceEvent ) + { + TRACE_1( _L("CPresentityGroupMembersPresenceSubscriptionItem::SynthesiseSubscriptionEventTo() aForce=%d"), aForceEvent ); + // Synthesise event to all members + TInt count = iContentItem.MemberCount(); + TRACE_1( _L("CPresentityGroupMembersPresenceSubscriptionItem::SynthesiseSubscriptionEventTo() iContentItem.MemberCount=%d"), count ); + + MXIMPItemParent* presCache = static_cast(iParent.GetInterface(PRESENCE_ITEM_PARENT)); + for( TInt a = 0; a < count; ++a ) + { + CPresentityGroupMemberInfoImp& memberInfo = iContentItem.MemberAt( a ); + const CXIMPIdentityImp& identity = memberInfo.IdentityImp(); + + presCache->SynthesisePresentityPresenceSubscriptionEventToL( identity, aContext, aForceEvent ); + } + } + + +// --------------------------------------------------------------------------- +// CPresentityGroupMembersPresenceSubscriptionItem::ActivateSubscriberL() +// --------------------------------------------------------------------------- +// +void CPresentityGroupMembersPresenceSubscriptionItem::ActivateSubscriberL( MXIMPPscContext* aContext ) + { + TRACE_1( _L("CPresentityGroupMembersPresenceSubscriptionItem::ActivateSubscriberL(aContext ) : aContext = %d"), aContext ); + + CXIMPSubscriptionItemBase::ActivateSubscriberL( aContext ); + + // Subscribe presentity presence items. + TInt count = iContentItem.MemberCount(); + TRACE_1( _L("CPresentityGroupMembersPresenceSubscriptionItem::ActivateSubscriberL(aContext ) : iContentItem.MemberCount = %d"), count ); + MXIMPItemParent* presCache = static_cast(iParent.GetInterface(PRESENCE_ITEM_PARENT)); + for( TInt a = 0; a < count; ++a ) + { + TRACE_1( _L("CPresentityGroupMembersPresenceSubscriptionItem::ActivateSubscriberL(aContext ) : a = %d"), a ); + CPresentityGroupMemberInfoImp& memberInfo = iContentItem.MemberAt( a ); + const CXIMPIdentityImp& identity = memberInfo.IdentityImp(); + TInt error ( KErrNone ); + TRAP( error , presCache->ActivatePresentityPresenceSubscriberL( identity, this );); + TRACE_1( _L("CPresentityGroupMembersPresenceSubscriptionItem::ActivateSubscriberL( aContext ) i...eSubscriberL = %d"), error ); + } + } + + +// --------------------------------------------------------------------------- +// CPresentityGroupMembersPresenceSubscriptionItem::CleanExpired() +// --------------------------------------------------------------------------- +// +void CPresentityGroupMembersPresenceSubscriptionItem::CleanExpired() + { + + } + +// --------------------------------------------------------------------------- +// CPresentityGroupMembersPresenceSubscriptionItem::AddSubscriberL() +// --------------------------------------------------------------------------- +// +EXPORT_C void CPresentityGroupMembersPresenceSubscriptionItem::AddSubscriberL( MXIMPPscContext* aContext ) + { + TRACE_1( _L("CPresentityGroupMembersPresenceSubscriptionItem::AddSubscriberL( MXIMPPscContext* aContext ) : aContext = %d"), aContext ); + + CXIMPSubscriptionItemBase::AddSubscriberL( aContext ); + + // Subscribe presentity presence items. + TInt count = iContentItem.MemberCount(); + TRACE_1( _L("CPresentityGroupMembersPresenceSubscriptionItem::AddSubscriberL( MXIMPPscContext* aContext ) : iContentItem.MemberCount = %d"), count ); + MXIMPItemParent* presCache = static_cast(iParent.GetInterface(PRESENCE_ITEM_PARENT)); + for( TInt a = 0; a < count; ++a ) + { + TRACE_1( _L("CPresentityGroupMembersPresenceSubscriptionItem::AddSubscriberL( MXIMPPscContext* aContext ) : a = %d"), a ); + + CPresentityGroupMemberInfoImp& memberInfo = iContentItem.MemberAt( a ); + const CXIMPIdentityImp& identity = memberInfo.IdentityImp(); + TInt error ( KErrNone ); + TRAP( error , presCache->AddPresentityPresenceSubscriberL( identity, this, iIdentity );); + TRACE_1( _L("CPresentityGroupMembersPresenceSubscriptionItem::AddSubscriberL( MXIMPPscContext* aContext ) : TRAPD( error , iParent.AddPresentityPresenceSubscriberL = %d"), error ); + + } + } + + +// --------------------------------------------------------------------------- +// CPresentityGroupMembersPresenceSubscriptionItem::RemoveSubscriber() +// --------------------------------------------------------------------------- +// +EXPORT_C void CPresentityGroupMembersPresenceSubscriptionItem::RemoveSubscriber( MXIMPPscContext* aContext ) + { + TRACE_1( _L("CPresentityGroupMembersPresenceSubscriptionItem::RemoveSubscriber( MXIMPPscContext* aContext ) : aContext = %d"), aContext ); + + // Subscribe presentity presence items. + TInt count = iContentItem.MemberCount(); + TRACE_1( _L("CPresentityGroupMembersPresenceSubscriptionItem::RemoveSubscriber( MXIMPPscContext* aContext ) : iContentItem.MemberCount = %d"), count ); + MXIMPItemParent* presCache = static_cast(iParent.GetInterface(PRESENCE_ITEM_PARENT)); + for( TInt a = 0; a < count; ++a ) + { + TRACE_1( _L("CPresentityGroupMembersPresenceSubscriptionItem::RemoveSubscriber( MXIMPPscContext* aContext ) : a = %d"), a ); + + CPresentityGroupMemberInfoImp& memberInfo = iContentItem.MemberAt( a ); + const CXIMPIdentityImp& identity = memberInfo.IdentityImp(); + + presCache->RemovePresentityPresenceSubscriber( identity, this ); + } + + TRACE( _L("CPresentityGroupMembersPresenceSubscriptionItem::RemoveSubscriber( MXIMPPscContext* aContext ) : CXIMPSubscriptionItemBase::RemoveSubscriber( aContext )") ); + CXIMPSubscriptionItemBase::RemoveSubscriber( aContext ); + } + +// --------------------------------------------------------------------------- +// CPresentityGroupMembersPresenceSubscriptionItem::HandleChangeL() +// --------------------------------------------------------------------------- +// +void CPresentityGroupMembersPresenceSubscriptionItem::HandleChangeL( + RPrGrpMemInfoImpArray& aAdded, RPrGrpMemInfoImpArray& aRemoved ) + { + TRACE_2( _L("CPresentityGroupMembersPresenceSubscriptionItem::HandleChangeL aAdded =%d aRemoved=%d"), aAdded.Count(), aRemoved.Count() ); + TInt count = aAdded.Count(); + MXIMPItemParent* presCache = static_cast(iParent.GetInterface(PRESENCE_ITEM_PARENT)); + for( TInt a = 0; a < count; ++a ) + { + CPresentityGroupMemberInfoImp& memberInfo = *aAdded[ a ]; + const CXIMPIdentityImp& identity = memberInfo.IdentityImp(); + + presCache->AddPresentityPresenceSubscriberL( identity, this, iIdentity ); + } + count = aRemoved.Count(); + for( TInt a = 0; a < count; ++a ) + { + CPresentityGroupMemberInfoImp& memberInfo = *aRemoved[ a ]; + const CXIMPIdentityImp& identity = memberInfo.IdentityImp(); + + presCache->RemovePresentityPresenceSubscriber( identity, this ); + } + } + +// --------------------------------------------------------------------------- +// CPresentityGroupMembersPresenceSubscriptionItem::HandleSynthesiseL() +// --------------------------------------------------------------------------- +// +void CPresentityGroupMembersPresenceSubscriptionItem::HandleSynthesiseL( + RPrGrpMemInfoImpArray& aTarget ) + { + TInt count = aTarget.Count(); + TRACE_1( _L("CPresentityGroupMembersPresenceSubscriptionItem::HandleSynthesiseL aTarget=%d"), aTarget.Count() ); + MXIMPItemParent* presCache = static_cast(iParent.GetInterface(PRESENCE_ITEM_PARENT)); + for( TInt a = 0; a < count; ++a ) + { + CPresentityGroupMemberInfoImp& memberInfo = *aTarget[ a ]; + const CXIMPIdentityImp& identity = memberInfo.IdentityImp(); + + presCache->ActivatePresentityPresenceSubscriberL( identity, this ); + TInt contextCount = iContexts.Count(); + for( TInt b = 0; b < contextCount; ++b ) + { + presCache->SynthesisePresentityPresenceSubscriptionEventToL( identity, iContexts[ a ], EFalse ); + } + } + } + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencedatamodel/presencewatching/presentitygroupmemberspresencesubscriptionitem.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencedatamodel/presencewatching/presentitygroupmemberspresencesubscriptionitem.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,209 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Presence Service Connection presentity presence subscription implementation. +* +*/ + +#ifndef CPSCPRESENTITYGROUPMEMBERSPRESENCESUBSCRIPTIONITEM_H +#define CPSCPRESENTITYGROUPMEMBERSPRESENCESUBSCRIPTIONITEM_H + +#include +#include "presenceinfoimp.h" +#include "ximpsubscriptionitembase.h" +#include "groupcontenteventobserver.h" + +class MXIMPItemParent; +class MXIMPPscContext; +class CPresenceInfoFilterImp; +class MXIMPIdentity; +class CXIMPIdentityImp; +class CGroupContentSubscriptionItem; + + +/** + * PSC group list subscription implementation + * + * @since S60 v3.2 + */ +class CPresentityGroupMembersPresenceSubscriptionItem : public CXIMPSubscriptionItemBase, + public MGroupContentEventObserver + { +public: // Construction and destruction + + /** + * Construction + * @param aParent. Parent has to be informed when this object is deleted by RemoveMe method. + */ + static CPresentityGroupMembersPresenceSubscriptionItem* NewLC( MXIMPItemParentBase& aParent, + CGroupContentSubscriptionItem& aContentItem ); + + /** + * Destruction + * - Remember to inform parent about delete. + */ + ~CPresentityGroupMembersPresenceSubscriptionItem(); + +private: // Construction and destruction + + /** + * Construction + * @param aParent. Parent has to be informed when this object is deleted by RemoveMe method. + */ + CPresentityGroupMembersPresenceSubscriptionItem( MXIMPItemParentBase& aParent, + CGroupContentSubscriptionItem& aContentItem ); + + /** + * Construction + */ + void ConstructL(); + +public: // New methods + + + /** + * Current presence information filter. + * @return Current presence information filter. + */ + IMPORT_C CPresenceInfoFilterImp& SubscriptionPif(); + + /** + * Set current presence information filter. Overwrites existing one. + * Ownership is transferred to callee. + * @param aPif Current presence information filter. + */ + IMPORT_C void SetSubscriptionPif( CPresenceInfoFilterImp* aPif ); + + /** + * Collect aggregated presence information filter without given context. + * @param aContext. Exluded context from aggregated pif. + * @return Aggregated pif without exluded context. + */ + IMPORT_C CPresenceInfoFilterImp* CollectSubscriptionPifWithoutCtxL( + MXIMPPscContext* aContext ); + + /** + * Set presence information. Overwrites existing one. + * @param aPresenceInfo. New presence information. + */ + IMPORT_C void SetPresenceInfoL( CPresenceInfoImp* aPresenceInfo ); + + + /** + * For ordering items. + * @param aA Key item for ordering. + * @param aB Item to compare + * @return -1 if aB is greater than aA + * 0 if they are same + * 1 if aA if greater than aB. + */ + IMPORT_C static TInt Order( const CPresentityGroupMembersPresenceSubscriptionItem& aA, + const CPresentityGroupMembersPresenceSubscriptionItem& aB ); + + /** + * For ordering items using identity as key. + * @param aA Key identity for ordering. + * @param aB Item to compare + * @return -1 if aB is greater than aA + * 0 if they are same + * 1 if aA if greater than aB. + */ + IMPORT_C static TInt IdentityOrder( const CXIMPIdentityImp* aA, + const CPresentityGroupMembersPresenceSubscriptionItem& aB ); + + /** + * Identity of item. + * @return Identity of item. + */ + IMPORT_C const MXIMPIdentity& Identity() const; + + /** + * Set identity for item + * @param aIdentity. New identity for item. Ownership is transferred. + */ + IMPORT_C void SetIdentity( CXIMPIdentityImp* aIdentity ); + +public: // From MXIMPSubscriptionItem + + /** + * @see MXIMPSubscriptionItem + */ + void SynthesiseSubscriptionEventToL( MXIMPPscContext* aContext, TBool aForceEvent ); + + /** + * @see MXIMPSubscriptionItem + */ + void ActivateSubscriberL( MXIMPPscContext* aContext ); + +private: // From CXIMPSubscriptionItemBase + + /** + * @see CXIMPSubscriptionItemBase + */ + void CleanExpired(); + +public: // From CXIMPSubscriptionItemBase + + /** + * @see CXIMPSubscriptionItemBase + */ + IMPORT_C void AddSubscriberL( MXIMPPscContext* aContext ); + + /** + * @see CXIMPSubscriptionItemBase + */ + IMPORT_C void RemoveSubscriber( MXIMPPscContext* aContext ); + +private: // From MGroupContentSubscriptionEventObserver + + /** + * @see MGroupContentSubscriptionEventObserver + */ + void HandleChangeL( RPrGrpMemInfoImpArray& aAdded, RPrGrpMemInfoImpArray& aRemoved ); + + /** + * @see MGroupContentSubscriptionEventObserver + */ + void HandleSynthesiseL( RPrGrpMemInfoImpArray& aAdded ); + +private: // Data + + /** + * Current presence information filter. + */ + CPresenceInfoFilterImp* iPif; + + /** + * Current presence info for item + * Own + */ + CPresenceInfoImp* iPresenceInfo; + + /** + * Identity of item. + * Own + */ + CXIMPIdentityImp* iIdentity; + + /** + * Owns reference to content item. Use close for delete. + */ + CGroupContentSubscriptionItem& iContentItem; + }; + + +/* ======================================================================== */ + + + +#endif // CPSCPRESENTITYGROUPMEMBERSPRESENCESUBSCRIPTIONITEM_H diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencedatamodel/presencewatching/presentitypresenceeventimp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencedatamodel/presencewatching/presentitypresenceeventimp.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,238 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MPresentityPresenceEvent API object implementation. + * +*/ + +#include "presentitypresenceeventimp.h" +#include "presenceinfoimp.h" +#include "ximpidentityimp.h" +#include "ximpdatasubscriptionstateimp.h" +#include "ximpobjecthelpers.h" +#include + + + +// --------------------------------------------------------------------------- +// CPresentityPresenceEventImp::NewLC() +// --------------------------------------------------------------------------- +// +EXPORT_C CPresentityPresenceEventImp* CPresentityPresenceEventImp::NewLC( + CXIMPDataSubscriptionStateImp* aState ) + { + CPresentityPresenceEventImp* self = new( ELeave ) CPresentityPresenceEventImp(); + CleanupStack::PushL( self ); + self->ConstructL( aState ); + return self; + } + +// --------------------------------------------------------------------------- +// CPresentityPresenceEventImp::NewL() +// --------------------------------------------------------------------------- +// +EXPORT_C CPresentityPresenceEventImp* CPresentityPresenceEventImp::NewL( + CXIMPDataSubscriptionStateImp* aState ) + { + CPresentityPresenceEventImp* self = NewLC( aState ); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// CPresentityPresenceEventImp::NewFromStreamLC() +// --------------------------------------------------------------------------- +// +CXIMPApiEventBase* CPresentityPresenceEventImp::NewFromStreamLC( RReadStream& aStream ) + { + CPresentityPresenceEventImp* self = new( ELeave ) CPresentityPresenceEventImp; + CleanupStack::PushL( self ); + self->ConstructL( aStream ); + return self; + } + +// --------------------------------------------------------------------------- +// CPresentityPresenceEventImp::~CPresentityPresenceEventImp() +// --------------------------------------------------------------------------- +// +CPresentityPresenceEventImp::~CPresentityPresenceEventImp() + { + delete iPresentityIdentity; + delete iSubscriptionState; + delete iPresenceInfo; + } + + +// --------------------------------------------------------------------------- +// CPresentityPresenceEventImp::CPresentityPresenceEventImp() +// --------------------------------------------------------------------------- +// +CPresentityPresenceEventImp::CPresentityPresenceEventImp() + { + } + + +// --------------------------------------------------------------------------- +// CPresentityPresenceEventImp::ConstructL() +// --------------------------------------------------------------------------- +// +void CPresentityPresenceEventImp::ConstructL( CXIMPDataSubscriptionStateImp* aState ) + { + iPresentityIdentity = CXIMPIdentityImp::NewL(); + iPresenceInfo = CPresenceInfoImp::NewL(); + + iSubscriptionState = aState; + } + +// --------------------------------------------------------------------------- +// CPresentityGroupContentEventImp::ConstructL() +// --------------------------------------------------------------------------- +// +void CPresentityPresenceEventImp::ConstructL( RReadStream& aStream ) + { + iPresentityIdentity = CXIMPIdentityImp::NewL(); + iPresenceInfo = CPresenceInfoImp::NewL(); + iSubscriptionState = CXIMPDataSubscriptionStateImp::NewL(); + InternalizeL( aStream ); + } + +// --------------------------------------------------------------------------- +// Implement supported interface access. +// --------------------------------------------------------------------------- +// +XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CPresentityPresenceEventImp, + MPresentityPresenceEvent ) + XIMPIMP_IF_BASE_GET_CLASS( CXIMPApiEventBase, this ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + +XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CPresentityPresenceEventImp, + MPresentityPresenceEvent ) + XIMPIMP_IF_BASE_GET_CONST_CLASS( CXIMPApiEventBase, this ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + + + +// --------------------------------------------------------------------------- +// Implement methods from base event interface and base event class +// --------------------------------------------------------------------------- +// +XIMPIMP_IMPLEMENT_EVENT_BASE_METHODS( CPresentityPresenceEventImp, + MPresentityPresenceEvent ) + +// --------------------------------------------------------------------------- +// CPresentityPresenceEventImp::EqualsContent +// --------------------------------------------------------------------------- +// +TBool CPresentityPresenceEventImp::EqualsContent( + const CXIMPApiEventBase& aOtherInstance ) const + { + const CPresentityPresenceEventImp* tmp = + TXIMPGetImpClassOrPanic< const CPresentityPresenceEventImp >::From( + aOtherInstance.Base() ); + TBool same = ETrue; + TBool x = iPresentityIdentity->EqualsContent( *tmp->iPresentityIdentity ); + same &= x; + + x = iSubscriptionState->EqualsContent( *tmp->iSubscriptionState ); + same &= x; + + x = iPresenceInfo->EqualsContent( *tmp->iPresenceInfo ); + same &= x; + + return same; + } + +// --------------------------------------------------------------------------- +// From class CXIMPApiEventBase +// CPresentityPresenceEventImp::ExternalizeL +// --------------------------------------------------------------------------- +// +void CPresentityPresenceEventImp::ExternalizeL( RWriteStream& aStream ) const + { + iPresentityIdentity->ExternalizeL( aStream ); + iSubscriptionState->ExternalizeL( aStream ); + iPresenceInfo->ExternalizeL( aStream ); + } + + + +// --------------------------------------------------------------------------- +// CPresentityPresenceEventImp::InternalizeL() +// --------------------------------------------------------------------------- +// +void CPresentityPresenceEventImp::InternalizeL( RReadStream& aStream ) + { + iPresentityIdentity->InternalizeL( aStream ); + iSubscriptionState->InternalizeL( aStream ); + iPresenceInfo->InternalizeL( aStream ); + } + + +// --------------------------------------------------------------------------- +// From class MPresentityPresenceEvent. +// CPresentityPresenceEventImp::PresentityId() +// --------------------------------------------------------------------------- +// +const MXIMPIdentity& CPresentityPresenceEventImp::PresentityId() const + { + return *iPresentityIdentity; + } + + +// --------------------------------------------------------------------------- +// From class MPresentityPresenceEvent. +// CPresentityPresenceEventImp::SubscribedPresence() +// --------------------------------------------------------------------------- +// +const MPresenceInfo& + CPresentityPresenceEventImp::SubscribedPresence() const + { + return *iPresenceInfo; + } + + +// --------------------------------------------------------------------------- +// From class MPresentityPresenceEvent. +// COwnPresenceEventImp::Status() +// --------------------------------------------------------------------------- +// +const MXIMPDataSubscriptionState& + CPresentityPresenceEventImp::DataSubscriptionState() const + { + return *iSubscriptionState; + } + +// --------------------------------------------------------------------------- +// COwnPresenceEventImp::SetPresenceInfo +// --------------------------------------------------------------------------- +// +void CPresentityPresenceEventImp::SetPresenceInfo( CPresenceInfoImp* aInfoImp ) + { + delete iPresenceInfo; + iPresenceInfo = aInfoImp; + } + +// --------------------------------------------------------------------------- +// COwnPresenceEventImp::SetIdentityL() +// --------------------------------------------------------------------------- +// +void CPresentityPresenceEventImp::SetIdentityL( const CXIMPIdentityImp& aIdentity ) + { + CXIMPIdentityImp* id = TXIMPObjectCloner< CXIMPIdentityImp >::CloneL( aIdentity ); + delete iPresentityIdentity; + iPresentityIdentity = id; + } + + +// End of file + diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencedatamodel/presencewatching/presentitypresenceeventimp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencedatamodel/presencewatching/presentitypresenceeventimp.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,148 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MPresentityPresenceEvent API object implementation. + * +*/ + +#ifndef CPRESENTIYPRESENCEEVENT_H +#define CPRESENTIYPRESENCEEVENT_H + +#include "ximpapieventbase.h" +#include +#include "ximpdatasubscriptionstateimp.h" +#include "presenceinfo.h" +#include "presenceapiobjbase.h" + +class RReadStream; +class CXIMPIdentityImp; +class CPresenceInfoImp; +class CXIMPDataSubscriptionStateImp; + + +/** + * MPresentityPresenceEvent API object implementation. + * + * @lib ximpdatamodel.dll + * @since S60 v3.2 + */ +NONSHARABLE_CLASS( CPresentityPresenceEventImp ): public CXIMPApiEventBase, + public MPresentityPresenceEvent + { +public: + /** The class ID. */ + enum { KClassId = PRIMP_CLSID_CPRESENTITYPRESENCEEVENTIMP }; + +public: + /** + * Exported instantiation method for initializing + * new event object. + */ + IMPORT_C static CPresentityPresenceEventImp* NewLC( + CXIMPDataSubscriptionStateImp* aState ); + IMPORT_C static CPresentityPresenceEventImp* NewL( + CXIMPDataSubscriptionStateImp* aState ); + + + /** + * Instantiation method for event automation. + * Method signature must be exactly this to work + * with event delivery automation system. + * + * Event implementation must be registered to + * XIMPEventCodec KXIMPEventConstructorTable. + */ + static CXIMPApiEventBase* NewFromStreamLC( RReadStream& aStream ); + + virtual ~CPresentityPresenceEventImp(); + + +private: + CPresentityPresenceEventImp(); + void ConstructL( CXIMPDataSubscriptionStateImp* aState ); + void ConstructL( RReadStream& aStream ); + +public: // From API base interfaces + + /** + * Implementation of MXIMPBase interface methods + * @see MXIMPBase + */ + XIMPIMP_DECLARE_IF_BASE_METHODS + + + /** + * Implementation of MXIMPEventBase interface and + * CXIMPApiEventBase methods + * + * @see MXIMPEventBase + * @see CXIMPApiEventBase + */ + XIMPIMP_DECLARE_EVENT_BASE_METHODS + + + void InternalizeL( RReadStream& aStream ); + + +public: // From MPresentityPresenceEvent + + /** + * Implementation of MPresentityPresenceEvent interface methods + * @see MPresentityPresenceEvent + */ + const MXIMPIdentity& PresentityId() const; + const MPresenceInfo& SubscribedPresence() const; + const MXIMPDataSubscriptionState& DataSubscriptionState() const; + +public: // new methods + + /** + * Set new presence info. + * Ownership transferred. + * @param aInfoImp The info imp + */ + void SetPresenceInfo( CPresenceInfoImp* aInfoImp ); + + /** + * Set identity. + * Copy is made. + * @param aIdentity The identity + */ + void SetIdentityL( const CXIMPIdentityImp& aIdentity ); + +private: // data + + /** + * Presentity + * Own. + */ + CXIMPIdentityImp* iPresentityIdentity; + + + /** + * + */ + CXIMPDataSubscriptionStateImp* iSubscriptionState; + + + /** + * Presence Info + * Own. + */ + CPresenceInfoImp* iPresenceInfo; + + + }; + + +#endif // CPRESENTIYPRESENCEEVENT_H diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencedatamodel/presencewatching/presentitypresencesubscriptionitem.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencedatamodel/presencewatching/presentitypresencesubscriptionitem.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,361 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Presence Service Connection group list subscription implementation. +* +*/ + + +#include "presentitypresencesubscriptionitem.h" +#include "presenceinfofilterimp.h" +#include "ximpitemparent.h" +#include "ximppanics.h" +#include "ximppsccontext.h" +#include "documentutils.h" +#include "presentitypresenceeventimp.h" +#include "ximpdatasubscriptionstateimp.h" +#include "ximpidentityimp.h" +#include "ximpobjecthelpers.h" +#include +#include + +#include "ximptrace.h" + +// --------------------------------------------------------------------------- +// CPresentityPresenceSubscriptionItem::CPresentityPresenceSubscriptionItem() +// --------------------------------------------------------------------------- +// +CPresentityPresenceSubscriptionItem::CPresentityPresenceSubscriptionItem( MXIMPItemParentBase& aParent ) +: CXIMPSubscriptionItemBase( aParent ) + { + } + + +// --------------------------------------------------------------------------- +// CPresentityPresenceSubscriptionItem::ConstructL() +// --------------------------------------------------------------------------- +// +void CPresentityPresenceSubscriptionItem::ConstructL( const CXIMPIdentityImp& aIdentity ) + { + BaseConstructL(); + + iIdentity = TXIMPObjectCloner< CXIMPIdentityImp >::CloneL( aIdentity ); + } + + +// --------------------------------------------------------------------------- +// CPresentityPresenceSubscriptionItem::NewLC() +// --------------------------------------------------------------------------- +// +CPresentityPresenceSubscriptionItem* + CPresentityPresenceSubscriptionItem::NewLC( MXIMPItemParentBase& aParent, const CXIMPIdentityImp& aIdentity ) + { + CPresentityPresenceSubscriptionItem* self = + new( ELeave ) CPresentityPresenceSubscriptionItem( aParent ); + CleanupClosePushL( *self ); + self->ConstructL( aIdentity ); + return self; + } + + +// --------------------------------------------------------------------------- +// CPresentityPresenceSubscriptionItem::~CPresentityPresenceSubscriptionItem() +// --------------------------------------------------------------------------- +// +CPresentityPresenceSubscriptionItem::~CPresentityPresenceSubscriptionItem() + { + // Remove it also from the external cache + MXIMPItemParent* presCache = static_cast(iParent.GetInterface(PRESENCE_ITEM_PARENT)); + if(presCache) + { + MPresenceCacheWriter* extCache = presCache->ExternalCache(); + if(extCache && iIdentity) + TRAP_IGNORE( extCache->DeletePresenceL( *iIdentity ) ); + presCache->RemoveMe( this ); + } + delete iIdentity; + delete iPresenceInfo; + delete iPif; + } + +// --------------------------------------------------------------------------- +// CPresentityPresenceSubscriptionItem::SubscriptionPif() +// --------------------------------------------------------------------------- +// +EXPORT_C CPresenceInfoFilterImp& + CPresentityPresenceSubscriptionItem::SubscriptionPif() + { + TRACE(_L("CPresentityPresenceSubscriptionItem::SubscriptionPif" ) ); + // assert removed + return *iPif; + } + +// --------------------------------------------------------------------------- +// CPresentityPresenceSubscriptionItem::SetSubscriptionPif() +// --------------------------------------------------------------------------- +// +EXPORT_C void CPresentityPresenceSubscriptionItem::SetSubscriptionPif( + CPresenceInfoFilterImp* aPif ) + { + TRACE(_L("CPresentityPresenceSubscriptionItem::SetSubscriptionPif" ) ); + if ( !aPif ) + { + TRACE(_L("CPresentityPresenceSubscriptionItem::SetSubscriptionPif aPif NULL" ) ); + } + delete iPif; + iPif = aPif; + } + +// --------------------------------------------------------------------------- +// CPresentityPresenceSubscriptionItem::CollectSubscriptionPifWithoutCtxL() +// --------------------------------------------------------------------------- +// +EXPORT_C CPresenceInfoFilterImp* + CPresentityPresenceSubscriptionItem::CollectSubscriptionPifWithoutCtxL( + MXIMPPscContext* aContext ) + { + TRACE(_L("CPresentityPresenceSubscriptionItem::CollectSubscriptionPifWithoutCtxL" ) ); + RPointerArray< CPresenceInfoFilterImp > arrayOfPifs; + CleanupClosePushL( arrayOfPifs ); + + TInt count = iContexts.Count(); + for( TInt a = 0; a < count; ++a ) + { + if( iContexts[ a ] != aContext ) + { + CPresenceInfoFilterImp* filter = iContexts[ a ]->PresenceInfoFilter( + MXIMPPscContext::EPresentityPresenceFilter, iIdentity ); + if ( filter ) + { + arrayOfPifs.AppendL( filter ); + } + } + } + CPresenceInfoFilterImp* pifWithoutCtx = DocumentUtils::InfoFilterUnionL( arrayOfPifs ); + CleanupStack::PopAndDestroy(); // arrayOfPifs + return pifWithoutCtx; + } + +// --------------------------------------------------------------------------- +// CPresentityPresenceSubscriptionItem::SetPresenceInfoL() +// --------------------------------------------------------------------------- +// +EXPORT_C void CPresentityPresenceSubscriptionItem::SetPresenceInfoL( + CPresenceInfoImp* aPresenceInfo ) + { + TRACE(_L("CPresentityPresenceSubscriptionItem::SetPresenceInfoL" ) ); + delete iPresenceInfo; + iPresenceInfo = aPresenceInfo; + iSubscriptionState->SetDataStateL( MXIMPDataSubscriptionState::EDataAvailable ); + + // Now let's update the external presence cache + MXIMPItemParent* presCache = static_cast(iParent.GetInterface(PRESENCE_ITEM_PARENT)); + MPresenceCacheWriter* extCache = presCache->ExternalCache(); + MPresenceBuddyInfo* buddyPresence = extCache->NewBuddyPresenceInfoLC(); + + // we need to clonce the parameters since the ownership is transfered + CXIMPIdentityImp* identity = TXIMPObjectCloner::CloneL(*iIdentity); + buddyPresence->SetBuddyId( identity ); + + CPresenceInfoImp* presenceInfo = TXIMPObjectCloner::CloneL(*iPresenceInfo); + buddyPresence->SetPresenceInfo( presenceInfo ); + + // No harm to do this, because the internal cache is still working + // we just lose the external update + TRAP_IGNORE( extCache->WritePresenceL( buddyPresence ) ); + + CleanupStack::PopAndDestroy( 1 ); // buddyPresence + + } + +// --------------------------------------------------------------------------- +// CPresentityPresenceSubscriptionItem::Order() +// --------------------------------------------------------------------------- +// +EXPORT_C TInt CPresentityPresenceSubscriptionItem::Order( + const CPresentityPresenceSubscriptionItem& aA, + const CPresentityPresenceSubscriptionItem& aB ) + { + return IdentityOrder( aA.iIdentity, aB ); + } +// --------------------------------------------------------------------------- +// CPresentityPresenceSubscriptionItem::Order() +// --------------------------------------------------------------------------- +// +EXPORT_C TInt CPresentityPresenceSubscriptionItem::IdentityOrder( + const CXIMPIdentityImp* aA, + const CPresentityPresenceSubscriptionItem& aB ) + { + return aA->Compare( *aB.iIdentity ); + } + + +// --------------------------------------------------------------------------- +// CPresentityPresenceSubscriptionItem::Identity() +// --------------------------------------------------------------------------- +// +EXPORT_C const MXIMPIdentity& CPresentityPresenceSubscriptionItem::Identity() const + { + return *iIdentity; + } + +// --------------------------------------------------------------------------- +// CPresentityPresenceSubscriptionItem::GroupIdentity() +// --------------------------------------------------------------------------- +// +EXPORT_C const MXIMPIdentity* CPresentityPresenceSubscriptionItem::GroupIdentity() const + { + return iGroupIdentity; + } + +// --------------------------------------------------------------------------- +// CPresentityPresenceSubscriptionItem::SetIdentity() +// --------------------------------------------------------------------------- +// +EXPORT_C void CPresentityPresenceSubscriptionItem::SetIdentity( + CXIMPIdentityImp* aIdentity ) + { + delete iIdentity; + iIdentity = aIdentity; + } + + +// --------------------------------------------------------------------------- +// CPresentityPresenceSubscriptionItem::SetGroupIdentity() +// --------------------------------------------------------------------------- +// +EXPORT_C void CPresentityPresenceSubscriptionItem::SetGroupIdentity( + CXIMPIdentityImp* aGroup ) + { + delete iGroupIdentity; + iGroupIdentity = aGroup; + } + +// --------------------------------------------------------------------------- +// From class MXIMPSubscriptionItem. +// CPresentityPresenceSubscriptionItem::SynthesiseSubscriptionEventTo() +// --------------------------------------------------------------------------- +// +void CPresentityPresenceSubscriptionItem::SynthesiseSubscriptionEventToL( + MXIMPPscContext* aContext, + TBool aForceEvent ) + { + TRACE_1( _L("CPresentityPresenceSubscriptionItem::SynthesiseSubscriptionEventTo() aForce=%d"), aForceEvent ); + CXIMPDataSubscriptionStateImp* status = StatusLC( aContext ); // << status + + CPresentityPresenceEventImp* newEvent = NULL; + if( status->DataState() == MXIMPDataSubscriptionState::EDataAvailable ) + { + TRACE(_L("CPresentityPresenceSubscriptionItem::SynthesiseSubscriptionEventToL 2" ) ); + __ASSERT_ALWAYS( iPresenceInfo, User::Panic( NXIMPPrivPanic::KCategory, + NXIMPPrivPanic::EPresentityPresencePresenceInfoDoesNotExist ) ); + TRACE(_L("CPresentityPresenceSubscriptionItem::SynthesiseSubscriptionEventToL 3" ) ); + // ERIK TODO: Logic is the following: + // 1 - Find all the groups where the iIdentity belongs to + // 2 - Collect the filters from those groups + // 3 - collect the filter from the individual subscription item also own + // 4 - make a union of the filters + + CPresenceInfoFilterImp* groupPif = NULL; + if ( iGroupIdentity ) + { + groupPif = aContext->PresenceInfoFilter( MXIMPPscContext::EPresentityGroupMemberPresenceFilter, iGroupIdentity ); + if ( !iPif ) + { + TRACE(_L("CPresentityPresenceSubscriptionItem::SynthesiseSubscriptionEventToL ownPif found" ) ); + iPif = TXIMPObjectCloner< CPresenceInfoFilterImp >::CloneLC( *groupPif ); + CleanupStack::Pop(); + } + } + TRACE(_L("CPresentityPresenceSubscriptionItem::SynthesiseSubscriptionEventToL 4_0" ) ); + CPresenceInfoFilterImp* ownPif = aContext->PresenceInfoFilter( MXIMPPscContext::EOwnPresenceFilter, iIdentity ); + TRACE(_L("CPresentityPresenceSubscriptionItem::SynthesiseSubscriptionEventToL 4_1" ) ); + CPresenceInfoFilterImp* presentityPif = aContext->PresenceInfoFilter( MXIMPPscContext::EPresentityPresenceFilter, iIdentity ); + TRACE(_L("CPresentityPresenceSubscriptionItem::SynthesiseSubscriptionEventToL 4_2" ) ); + RPointerArray< CPresenceInfoFilterImp > arrayOfPifs; // << arrayOfPifs + CleanupClosePushL( arrayOfPifs ); + + if ( groupPif ) + { + TRACE(_L("CPresentityPresenceSubscriptionItem::SynthesiseSubscriptionEventToL groupPif found" ) ); + arrayOfPifs.AppendL( groupPif ); + if ( !iPif ) + { + TRACE(_L("CPresentityPresenceSubscriptionItem::SynthesiseSubscriptionEventToL iPif created" ) ); + SetSubscriptionPif( groupPif ); + //iPif = TXIMPObjectCloner< CPresenceInfoFilterImp >::CloneLC( groupPif ); + //CleanupStack::Pop(); + } + } + if ( ownPif ) + { + TRACE(_L("CPresentityPresenceSubscriptionItem::SynthesiseSubscriptionEventToL ownPif found" ) ); + arrayOfPifs.AppendL( ownPif ); + } + if ( presentityPif ) + { + TRACE(_L("CPresentityPresenceSubscriptionItem::SynthesiseSubscriptionEventToL presentityPif found" ) ); + arrayOfPifs.AppendL( presentityPif ); + } + TRACE(_L("CPresentityPresenceSubscriptionItem::SynthesiseSubscriptionEventToL 4_3" ) ); + CPresenceInfoFilterImp* unionPif = NULL; + unionPif = DocumentUtils::InfoFilterUnionL( arrayOfPifs ); + if ( unionPif ) + { + TRACE(_L("CPresentityPresenceSubscriptionItem::SynthesiseSubscriptionEventToL unionPif found" ) ); + } + CleanupStack::PopAndDestroy(); // >>> arrayOfPifs + CleanupStack::PushL( unionPif ); // << unionPif + + TRACE(_L("CPresentityPresenceSubscriptionItem::SynthesiseSubscriptionEventToL 5" ) ); + CPresenceInfoImp* filteredPresenceInfo = + DocumentUtils::CollectFilteredPresenceInfoLC( + *unionPif, + *iPresenceInfo ); // << filteredPresenceInfo + + CleanupStack::Pop( filteredPresenceInfo ); // >> filteredPresenceInfo + CleanupStack::PopAndDestroy( unionPif ); // >>> unionPif + CleanupStack::PushL( filteredPresenceInfo ); // << filteredPresenceInfo + TRACE(_L("CPresentityPresenceSubscriptionItem::SynthesiseSubscriptionEventToL 6" ) ); + newEvent = CPresentityPresenceEventImp::NewL( status ); // CSI: 35 # Event is put to cleanupstack in next branch. + newEvent->SetPresenceInfo( filteredPresenceInfo ); + CleanupStack::Pop( filteredPresenceInfo ); // >> filteredPresenceInfo + CleanupStack::Pop( status ); // >> status + newEvent->SetIdentityL( *iIdentity ); + } + else if( aForceEvent ) + { + newEvent = CPresentityPresenceEventImp::NewL( status ); // CSI: 35 # Event is put to cleanupstack in next branch. + CleanupStack::Pop( status ); + newEvent->SetIdentityL( *iIdentity ); + } + + if( newEvent ) + { + CleanupStack::PushL( newEvent ); + MXIMPItemParent* presCache = static_cast(iParent.GetInterface(PRESENCE_ITEM_PARENT)); + presCache->AddEventL( *newEvent, aContext ); + } + CleanupStack::PopAndDestroy(); //status || newEvent depending on branch + } + +// --------------------------------------------------------------------------- +// CPresentityPresenceSubscriptionItem::CleanExpired() +// --------------------------------------------------------------------------- +// +void CPresentityPresenceSubscriptionItem::CleanExpired() + { + + } + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencedatamodel/presencewatching/presentitypresencesubscriptionitem.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencedatamodel/presencewatching/presentitypresencesubscriptionitem.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,189 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Presence Service Connection presentity presence subscription implementation. +* +*/ + +#ifndef CPSCPRESENTITYPRESENCESUBSCRIPTIONITEM_H +#define CPSCPRESENTITYPRESENCESUBSCRIPTIONITEM_H + +#include +#include "presenceinfoimp.h" +#include "ximpsubscriptionitembase.h" + +class MXIMPItemParentBase; +class MXIMPPscContext; +class CPresenceInfoFilterImp; +class MXIMPIdentity; +class CXIMPIdentityImp; + + +/** + * PSC group list subscription implementation + * + * @since S60 v3.2 + */ +class CPresentityPresenceSubscriptionItem : public CXIMPSubscriptionItemBase + { +public: // Construction and destruction + + /** + * Construction + * @param aParent. Parent has to be informed when this object is deleted by RemoveMe method. + */ + static CPresentityPresenceSubscriptionItem* NewLC( MXIMPItemParentBase& aParent, + const CXIMPIdentityImp& aIdentity ); + /** + * Destruction + * - Remember to inform parent about delete. + */ + ~CPresentityPresenceSubscriptionItem(); + +private: // Construction and destruction + + /** + * Construction + * @param aParent. Parent has to be informed when this object is deleted by RemoveMe method. + */ + CPresentityPresenceSubscriptionItem( MXIMPItemParentBase& aParent ); + + /** + * Construction + */ + void ConstructL( const CXIMPIdentityImp& aIdentity ); + +public: // New methods + + + /** + * Current presence information filter. + * @return Current presence information filter. + */ + IMPORT_C CPresenceInfoFilterImp& SubscriptionPif(); + + /** + * Set current presence information filter. Overwrites existing one. + * Ownership is transferred to callee. + * @param aPif Current presence information filter. + */ + IMPORT_C void SetSubscriptionPif( CPresenceInfoFilterImp* aPif ); + + /** + * Collect aggregated presence information filter without given context. + * @param aContext. Exluded context from aggregated pif. + * @return Aggregated pif without exluded context. + */ + IMPORT_C CPresenceInfoFilterImp* CollectSubscriptionPifWithoutCtxL( + MXIMPPscContext* aContext ); + + /** + * Set presence information. Overwrites existing one. + * @param aPresenceInfo. New presence information. + */ + IMPORT_C void SetPresenceInfoL( CPresenceInfoImp* aPresenceInfo ); + + + /** + * For ordering items. + * @param aA Key item for ordering. + * @param aB Item to compare + * @return -1 if aB is greater than aA + * 0 if they are same + * 1 if aA if greater than aB. + */ + IMPORT_C static TInt Order( const CPresentityPresenceSubscriptionItem& aA, + const CPresentityPresenceSubscriptionItem& aB ); + + /** + * For ordering items using identity as key. + * @param aA Key identity for ordering. + * @param aB Item to compare + * @return -1 if aB is greater than aA + * 0 if they are same + * 1 if aA if greater than aB. + */ + IMPORT_C static TInt IdentityOrder( const CXIMPIdentityImp* aA, + const CPresentityPresenceSubscriptionItem& aB ); + /** + * Identity of item. + * @return Identity of item. + */ + IMPORT_C const MXIMPIdentity& Identity() const; + + /** + * Group Identity of item. + * @return the Group identity of item. + */ + IMPORT_C const MXIMPIdentity* GroupIdentity() const; + + /** + * Set identity for item + * @param aIdentity. New identity for item. Ownership is transferred.(??) + */ + IMPORT_C void SetIdentity( CXIMPIdentityImp* aIdentity ); + + /** + * Set group identity for item + * @param aGroup. New identity for item. Ownership is transferred. + */ + IMPORT_C void SetGroupIdentity( CXIMPIdentityImp* aGroup ); + + +public: // From MXIMPSubscriptionItem + + /** + * @see MXIMPSubscriptionItem + */ + void SynthesiseSubscriptionEventToL( MXIMPPscContext* aContext, TBool aForceEvent ); + +private: // From CXIMPSubscriptionItemBase + + /** + * @see CXIMPSubscriptionItemBase + */ + void CleanExpired(); + +private: // Data + + /** + * Current presence information filter. + */ + CPresenceInfoFilterImp* iPif; + + /** + * Current presence info for item + * Own + */ + CPresenceInfoImp* iPresenceInfo; + + /** + * Identity of item + * Own + */ + CXIMPIdentityImp* iIdentity; + + /** + * Identity of group item + * TODO: must be an array + * own + */ + CXIMPIdentityImp* iGroupIdentity; + }; + + +/* ======================================================================== */ + + + +#endif // CPSCPRESENTITYPRESENCESUBSCRIPTIONITEM_H diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencedatamodel/presentitygroups/groupcontentsubscriptionitem.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencedatamodel/presentitygroups/groupcontentsubscriptionitem.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,545 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Presence Service Connection group member subscription implementation. +* +*/ + + +#include + +#include "groupcontentsubscriptionitem.h" +#include "presenceinfofilterimp.h" +#include "ximpitemparent.h" +#include "ximppanics.h" +#include "ximppsccontext.h" +#include "documentutils.h" +#include "presentitygroupcontenteventimp.h" +#include "presencetypehelpers.h" +#include "ximpobjecthelpers.h" +#include "presentitygroupmemberinfoimp.h" +#include "ximpidentityimp.h" +#include "groupcontenteventobserver.h" + +#include "ximptrace.h" +// --------------------------------------------------------------------------- +// CGroupContentSubscriptionItem::CGroupContentSubscriptionItem() +// --------------------------------------------------------------------------- +// +CGroupContentSubscriptionItem::CGroupContentSubscriptionItem( MXIMPItemParentBase& aParent ) +: CXIMPSubscriptionItemBase( aParent ) + { + } + + +// --------------------------------------------------------------------------- +// CGroupContentSubscriptionItem::ConstructL() +// --------------------------------------------------------------------------- +// +void CGroupContentSubscriptionItem::ConstructL( const CXIMPIdentityImp& aGroupId ) + { + BaseConstructL(); + + iGroupId = TXIMPObjectCloner< CXIMPIdentityImp >::CloneL( aGroupId ); + + // empty lists must always exist + iCurrentMembers = new ( ELeave) RPrGrpMemInfoImpArray; + + iAdded = new ( ELeave ) RPrGrpMemInfoImpArray; + iUpdated = new ( ELeave ) RPrGrpMemInfoImpArray; + iRemoved = new ( ELeave ) RPrGrpMemInfoImpArray; + } + + +// --------------------------------------------------------------------------- +// CGroupContentSubscriptionItem::NewLC() +// --------------------------------------------------------------------------- +// +CGroupContentSubscriptionItem* + CGroupContentSubscriptionItem::NewLC( MXIMPItemParentBase& aParent, + const CXIMPIdentityImp& aGroupId ) + { + CGroupContentSubscriptionItem* self = + new( ELeave ) CGroupContentSubscriptionItem( aParent ); + CleanupClosePushL( *self ); + self->ConstructL( aGroupId ); + return self; + } + + +// --------------------------------------------------------------------------- +// CGroupContentSubscriptionItem::~CGroupContentSubscriptionItem() +// --------------------------------------------------------------------------- +// +CGroupContentSubscriptionItem::~CGroupContentSubscriptionItem() + { + MXIMPItemParent* presCache = static_cast(iParent.GetInterface(PRESENCE_ITEM_PARENT)); + presCache->RemoveMe( this ); + + + if ( iCurrentMembers ) + { + iCurrentMembers->Close(); + } + delete iCurrentMembers; + + Clean(); + delete iAdded; + delete iUpdated; + delete iRemoved; + + delete iGroupId; + + iEventObservers.Close(); + } + + +// --------------------------------------------------------------------------- +// CGroupContentSubscriptionItem::AddOrRenewSubscriberL() +// --------------------------------------------------------------------------- +// +EXPORT_C void CGroupContentSubscriptionItem::AddOrRenewSubscriberL( + MXIMPPscContext* aContext ) + { + TInt index = iContexts.Find( aContext ); + if( index == KErrNotFound ) + { + iContexts.AppendL( aContext ); + User::LeaveIfError( Open() ); + } + } + +// --------------------------------------------------------------------------- +// CGroupContentSubscriptionItem::GroupId() +// --------------------------------------------------------------------------- +// +EXPORT_C const CXIMPIdentityImp& CGroupContentSubscriptionItem::GroupId() const + { + return *iGroupId; + } + +// --------------------------------------------------------------------------- +// CGroupContentSubscriptionItem::Order() +// --------------------------------------------------------------------------- +// +EXPORT_C TInt CGroupContentSubscriptionItem::Order( + const CGroupContentSubscriptionItem& aA, + const CGroupContentSubscriptionItem& aB ) + { + return IdentityOrder( aA.iGroupId, aB ); + } +// --------------------------------------------------------------------------- +// CPresentityPresenceSubscriptionItem::Order() +// --------------------------------------------------------------------------- +// +EXPORT_C TInt CGroupContentSubscriptionItem::IdentityOrder( + const CXIMPIdentityImp* aA, + const CGroupContentSubscriptionItem& aB ) + { + return aA->Compare( *aB.iGroupId ); + } + +// --------------------------------------------------------------------------- +// From MXIMPSubscriptionItem class. +// CGroupContentSubscriptionItem::SynthesiseSubscriptionEventTo() +// --------------------------------------------------------------------------- +// +void CGroupContentSubscriptionItem::SynthesiseSubscriptionEventToL( + MXIMPPscContext* aContext, TBool aForceEvent ) + { + TRACE_1( _L("CGroupContentSubscriptionItem::SynthesiseSubscriptionEventTo() aForce=%d"), aForceEvent ); + CXIMPDataSubscriptionStateImp* status = StatusLC( aContext ); + + if( status->DataState() == MXIMPDataSubscriptionState::EDataAvailable || aForceEvent ) + { + CPresentityGroupContentEventImp* newEvent = + CPresentityGroupContentEventImp::NewL( *iGroupId, + iAdded, + iUpdated, + iRemoved, + aForceEvent ? iCurrentMembers : NULL, + status + ); + CleanupStack::Pop(); //status + CleanupStack::PushL( newEvent ); + MXIMPItemParent* presCache = static_cast(iParent.GetInterface(PRESENCE_ITEM_PARENT)); + presCache->AddEventL( *newEvent, aContext ); + } + CleanupStack::PopAndDestroy(); // status || newEvent. Depending on branch. + } + +// --------------------------------------------------------------------------- +// CGroupContentSubscriptionItem::SynthesiseSubscriptionEventToAllCtxsL() +// --------------------------------------------------------------------------- +// +void CGroupContentSubscriptionItem::SynthesiseSubscriptionEventToAllCtxsL() +{ + +TRACE_1( _L("CGroupContentSubscriptionItem::SynthesiseSubscriptionEventToAllCtxsL() iEventObservers.Count()=%d"), iEventObservers.Count() ); +TRACE_1( _L("CGroupContentSubscriptionItem::SynthesiseSubscriptionEventToAllCtxsL() iAdded->Count()=%d"), iAdded->Count() ); +TRACE_1( _L("CGroupContentSubscriptionItem::SynthesiseSubscriptionEventToAllCtxsL() iUpdated->Count()=%d"), iUpdated->Count() ); +TRACE_1( _L("CGroupContentSubscriptionItem::SynthesiseSubscriptionEventToAllCtxsL() iRemoved->Count()=%d"), iRemoved->Count() ); + + TInt count = iEventObservers.Count(); + if( count && iAdded->Count() ) + { + for( TInt a = 0; a < count; ++a ) + { + TRACE_1( _L("CGroupContentSubscriptionItem::SynthesiseSubscriptionEventToAllCtxsL() observer = iEventObservers[ a ] =%d"), a ); + MGroupContentEventObserver* observer = iEventObservers[ a ]; + TInt error ( KErrNone ); + TRAP( error, observer->HandleSynthesiseL( *iAdded );); + TRACE_1( _L("CGroupContentSubscriptionItem::SynthesiseSubscriptionEventToAllCtxsL() TRAPD( error, observer->HandleSynthesiseL =%d"), error ); + } + } + + TRACE( _L("CGroupContentSubscriptionItem::SynthesiseSubscriptionEventToAllCtxsL - Call to CXIMPSubscriptionItemBase::SynthesiseSubscriptionEventToAllCtxsL Now ") ); + CXIMPSubscriptionItemBase::SynthesiseSubscriptionEventToAllCtxsL(); +} + +// --------------------------------------------------------------------------- +// CGroupContentSubscriptionItem::SetNewListL() +// --------------------------------------------------------------------------- +// +EXPORT_C void CGroupContentSubscriptionItem::SetNewListL( + RPrGrpMemInfoImpArray* aMemberList ) + { + TRACE_1( _L("CGroupContentSubscriptionItem::SetNewListL() aMemberList Count=%d"), aMemberList->Count() ); + // we will eventually take ownership to this + RPrGrpMemInfoImpArray* tmp = aMemberList; + CleanupStack::PushL( tmp ); + + // the list is already sorted. when a copy was made in datacacheimp, the + // InsertInOrder method was used + + // The below algorithm has complexity of (roughly): + // - aMemberList length M + // - iCurrentMembers final length N + // + // Final complexity: + // M*( 1 // indexed accessor + // + logN // find (ordered) + // + logN // insert in order (find+insert) + // + O(1) // delete + // + O(1) // remove + // ) + O(1) // updating iRemoved and iCurrentMembers + // = M(2logN+3) + 2MlogN+3M = O(cMlogM). + // + // Should be fast enough. The complexity is not fully accurate because + // array size grows as we insert into it. + // + TLinearOrder + linearOrder( CPresentityGroupMemberInfoImp::GroupIdLinearOrder ); + + for ( TInt i = 0; i < tmp->Count(); i++ ) + { + // compare against current list + CPresentityGroupMemberInfoImp* info = (*tmp)[ i ]; + TInt pos = iCurrentMembers->FindInOrder( info, linearOrder ); + + if ( pos == KErrNotFound ) + { + // not found in current list + // so must be a fresh created list name + iAdded->InsertInOrderL( info, linearOrder ); + } + else + { + // found in current list, so it must be an updated list name + iUpdated->InsertInOrderL( info, linearOrder ); + + delete (*iCurrentMembers)[ pos ]; + iCurrentMembers->Remove( pos ); + + // we must remove the found ones from iCurrentMembers, + // otherwise we will not know what was left. and finding out + // the removed items will be difficult. + } + } + + // what's left in iCurrentMembers contains the deleted ones. + delete iRemoved; + iRemoved = iCurrentMembers; + + // the given list becomes the new list + iCurrentMembers = tmp; + CleanupStack::Pop( tmp ); + iSubscriptionState->SetDataStateL( MXIMPDataSubscriptionState::EDataAvailable ); + InformObserversL(); + } + + +// --------------------------------------------------------------------------- +// CGroupContentSubscriptionItem::SetAddedListL() +// --------------------------------------------------------------------------- +// +EXPORT_C void CGroupContentSubscriptionItem::SetAddedListL( + RPrGrpMemInfoImpArray* aMemberList ) + { + TRACE_1( _L("CGroupContentSubscriptionItem::SetAddedListL() aMemberList Count=%d"), aMemberList->Count() ); + // we took ownership to the given list + RPrGrpMemInfoImpArray* tmp = aMemberList; + CleanupDeletePushL( tmp ); + + // see also SetNewListL. + + // the list is already sorted. when a copy was made in datacacheimp, the + // InsertInOrder method was used + TLinearOrder + linearOrder( CPresentityGroupMemberInfoImp::GroupIdLinearOrder ); + + // update the list of created and updated groups + for ( TInt i = 0; i < tmp->Count(); i++ ) + { + // compare against current list + CPresentityGroupMemberInfoImp* info = (*tmp)[ i ]; + TInt pos = iCurrentMembers->FindInOrder( info, linearOrder ); + + if ( pos == KErrNotFound ) + { + // not found in current list + // so must be a fresh created list name. + // this cannot come when the HandleDisplayNameUpdatedListL method + // is called. + iCurrentMembers->InsertInOrderL( info, linearOrder ); + ( *tmp )[ i ] = NULL; + iAdded->InsertInOrderL( info, linearOrder ); + } + else + { + // This can be checked if really had changed if needed. Now + // we trust server that changes are reasonable. + + // change the display name of the updated group in the current list + (*iCurrentMembers)[ pos ]->SetGroupMemberDisplayNameL( info->GroupMemberDisplayName() ); + + // found in current list, so it must be an updated list name + iUpdated->InsertInOrderL( (*iCurrentMembers)[ pos ], linearOrder ); + } + } + + // current list may get updated display name to the existing elements, + // otherwise the list is unchanged. list of deleted groups stays empty. + // updated and created lists were updated. the input parameter list can be + // deleted + CleanupStack::PopAndDestroy( tmp ); + iSubscriptionState->SetDataStateL( MXIMPDataSubscriptionState::EDataAvailable ); + + InformObserversL(); + } + +// --------------------------------------------------------------------------- +// CGroupContentSubscriptionItem::SetRemovedListL() +// --------------------------------------------------------------------------- +// +EXPORT_C void CGroupContentSubscriptionItem::SetRemovedListL( + RPrGrpMemInfoImpArray* aMemberList ) + { + TRACE_1( _L("CGroupContentSubscriptionItem::SetRemovedListL() aMemberList Count=%d"), aMemberList->Count() ); + // we will eventually take ownership to this + RPrGrpMemInfoImpArray* tmp = aMemberList; + CleanupStack::PushL( tmp ); + + // see also SetNewListL. + + // the list is already sorted. when a copy was made in datacacheimp, the + // InsertInOrder method was used + TLinearOrder + linearOrder( CPresentityGroupMemberInfoImp::GroupIdLinearOrder ); + + // remove the deleted ones from the current list + for ( TInt i = 0; i < tmp->Count(); i++ ) + { + // compare against current list + CPresentityGroupMemberInfoImp* info = (*tmp)[ i ]; + TInt pos = iCurrentMembers->FindInOrder( info, linearOrder ); + + // found in current list, so it must be a deleted list name + if ( pos != KErrNotFound ) + { + // remove from current list + delete (*iCurrentMembers)[ pos ]; + iCurrentMembers->Remove( pos ); + } + } + + // the given list becomes the new list of + // removed ones + delete iRemoved; + iRemoved = tmp; + CleanupStack::Pop( tmp ); + iSubscriptionState->SetDataStateL( MXIMPDataSubscriptionState::EDataAvailable ); + InformObserversL(); + } + +// --------------------------------------------------------------------------- +// CGroupContentSubscriptionItem::Clean() +// --------------------------------------------------------------------------- +// +EXPORT_C void CGroupContentSubscriptionItem::Clean() + { + TRACE( _L("CGroupContentSubscriptionItem::Clean") ); + // empty the lists. + // the lists must stay valid for use + + // iAdded and iUpdated are collection from currentlist. Do not delete items. + // iRemoved is only place for items. Delete those. + + iAdded->Reset(); + iUpdated->Reset(); + iRemoved->Close(); + } + + +// --------------------------------------------------------------------------- +// CGroupContentSubscriptionItem::GroupMemberExistsL() +// --------------------------------------------------------------------------- +// +EXPORT_C TBool CGroupContentSubscriptionItem::GroupMemberExistsL( + CPresentityGroupMemberInfoImp& aMemberInfo ) const + { + TBool found( EFalse ); + + CPresentityGroupMemberInfoImp* memberInfo = + TXIMPObjectCloner< CPresentityGroupMemberInfoImp >::CloneL( aMemberInfo ); + CleanupStack::PushL( memberInfo ); + + + TLinearOrder + linearOrder( CPresentityGroupMemberInfoImp::GroupIdLinearOrder ); + TInt pos = iCurrentMembers->FindInOrder( memberInfo, linearOrder ); + if ( pos != KErrNotFound ) + { + found = ETrue; + } + + CleanupStack::PopAndDestroy( memberInfo ); + TRACE_1( _L("CGroupContentSubscriptionItem::GroupMemberExistsL() returns=%d"), found ); + return found; + } + +// --------------------------------------------------------------------------- +// CGroupContentSubscriptionItem::IsGroupMemberUpdatedL() +// --------------------------------------------------------------------------- +// +EXPORT_C TBool CGroupContentSubscriptionItem::IsGroupMemberUpdatedL( + CPresentityGroupMemberInfoImp& aMemberInfo ) const + { + TBool updated( EFalse ); + + if ( !GroupMemberExistsL( aMemberInfo ) ) + { + return updated; + } + + CPresentityGroupMemberInfoImp* memberInfo = + TXIMPObjectCloner< CPresentityGroupMemberInfoImp >::CloneL( aMemberInfo ); + CleanupStack::PushL( memberInfo ); + + + TLinearOrder + linearOrder( CPresentityGroupMemberInfoImp::GroupIdLinearOrder ); + TInt pos = iCurrentMembers->FindInOrder( memberInfo, linearOrder ); + // it exists, otherwise we would've returned after GroupMemberExistsL call + + CPresentityGroupMemberInfoImp* foundMember = (*iCurrentMembers)[ pos ]; + // Compare identity and displayname + if ( memberInfo->GroupMemberId().Identity().Compare( + foundMember->GroupMemberId().Identity() ) != 0 + || + memberInfo->GroupMemberDisplayName().Compare( + foundMember->GroupMemberDisplayName() ) != 0 ) + { + updated = ETrue; + } + + CleanupStack::PopAndDestroy( memberInfo ); + TRACE_1( _L("CGroupContentSubscriptionItem::IsGroupMemberUpdatedL() returns=%d"), updated ); + return updated; + } + +// --------------------------------------------------------------------------- +// CGroupContentSubscriptionItem::MemberCount() +// --------------------------------------------------------------------------- +// +TInt CGroupContentSubscriptionItem::MemberCount() const + { + TRACE_1( _L("CGroupContentSubscriptionItem::MemberCount() returns=%d"), iCurrentMembers->Count() ); + return iCurrentMembers->Count(); + } + +// --------------------------------------------------------------------------- +// CGroupContentSubscriptionItem::MemberAt() +// --------------------------------------------------------------------------- +// +CPresentityGroupMemberInfoImp& CGroupContentSubscriptionItem::MemberAt( TInt aIndex ) + { + return *( *iCurrentMembers )[ aIndex ]; + } + +// --------------------------------------------------------------------------- +// CGroupContentSubscriptionItem::RegisterEventObserverL() +// --------------------------------------------------------------------------- +// +void CGroupContentSubscriptionItem::RegisterEventObserverL( + MGroupContentEventObserver* aEventObserver ) + { + TInt indexOfObserver = iEventObservers.Find( aEventObserver ); + if( indexOfObserver == KErrNotFound ) + { + iEventObservers.AppendL( aEventObserver ); + User::LeaveIfError( Open() ); + } + } + +// --------------------------------------------------------------------------- +// CGroupContentSubscriptionItem::UnregisterEventObserver() +// --------------------------------------------------------------------------- +// +void CGroupContentSubscriptionItem::UnregisterEventObserver( + MGroupContentEventObserver* aEventObserver ) + { + TInt indexOfObserver = iEventObservers.Find( aEventObserver ); + if( indexOfObserver != KErrNotFound ) + { + iEventObservers.Remove( indexOfObserver ); + Close(); + } + } + +// --------------------------------------------------------------------------- +// CGroupContentSubscriptionItem::CleanExpired() +// --------------------------------------------------------------------------- +// +void CGroupContentSubscriptionItem::CleanExpired() + { + } + +// --------------------------------------------------------------------------- +// CGroupContentSubscriptionItem::InformObserversL() +// --------------------------------------------------------------------------- +// +void CGroupContentSubscriptionItem::InformObserversL() + { + TInt count = iEventObservers.Count(); + if( count && ( iAdded->Count() || iRemoved->Count() ) ) + { + for( TInt a = 0; a < count; ++a ) + { + MGroupContentEventObserver* observer = iEventObservers[ a ]; + observer->HandleChangeL( *iAdded, *iRemoved ); + } + } + } + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencedatamodel/presentitygroups/groupcontentsubscriptionitem.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencedatamodel/presentitygroups/groupcontentsubscriptionitem.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,239 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Presence Service Connection group member subscription implementation. +* +*/ + +#ifndef CPSCGROUPCONTENTSUBSCRIPTIONITEM_H +#define CPSCGROUPCONTENTSUBSCRIPTIONITEM_H + +#include +#include "presenceinfoimp.h" +#include "ximpsubscriptionitembase.h" +#include "presencetypehelpers.h" + +class MXIMPItemParentBase; +class MXIMPPscContext; +class CDesC16Array; +class MXIMPIdentity; +class CXIMPIdentityImp; +class MGroupContentEventObserver; + +/** + * PSC group list subscription implementation + * + * @since S60 v3.2 + */ +class CGroupContentSubscriptionItem : public CXIMPSubscriptionItemBase + { + +public: // Construction and destruction + + /** + * Construction + * @param aParent. Parent has to be informed when this object is deleted by RemoveMe method. + */ + static CGroupContentSubscriptionItem* NewLC( MXIMPItemParentBase& aParent, + const CXIMPIdentityImp& aGroupId ); + + /** + * Destruction + * - Remember to inform parent about delete. + */ + virtual ~CGroupContentSubscriptionItem(); + +private: // Construction and destruction + + /** + * Construction + * @param aParent. Parent has to be informed when this object is deleted by RemoveMe method. + */ + CGroupContentSubscriptionItem( MXIMPItemParentBase& aParent ); + + /** + * Construction + */ + void ConstructL( const CXIMPIdentityImp& aGroupId ); + +public: // New methods + + /** + * Add subscriber for group content if it hasn't subscribed already. + * @param aContext. Context to be added. + */ + IMPORT_C void AddOrRenewSubscriberL( MXIMPPscContext* aContext ); + + /** + * Set the new list of members. Will create and set + * the temporary lists for added, removed and updated lists. + * Ownership is transferred! + * @param aMemberList The list of groups + */ + IMPORT_C void SetNewListL( RPrGrpMemInfoImpArray* aMemberList ); + + /** + * Set the added list of members. + * Ownership is transferred! + * @param aMemberList The list of groups + */ + IMPORT_C void SetAddedListL( RPrGrpMemInfoImpArray* aMemberList ); + + /** + * Set the removed list of members. Will set + * other lists accordingly. + * Ownership is transferred! + * @param aMemberList The list of groups + */ + IMPORT_C void SetRemovedListL( RPrGrpMemInfoImpArray* aMemberList ); + + /** + * Used as method for TLinearOrder when ordering items. + * @param aA First object for ordering. + * @param aB Second object for ordering. + * @return Order of params like compare function( -1 0 1 ) + */ + IMPORT_C static TInt Order( const CGroupContentSubscriptionItem& aA, + const CGroupContentSubscriptionItem& aB ); + + /** + * Used as method for TLinearOrder when ordering items. + * @param aA First object used as key for ordering. + * @param aB Second object for ordering. + * @return Order of params like compare function( -1 0 1 ) + */ + IMPORT_C static TInt IdentityOrder( const CXIMPIdentityImp* aA, + const CGroupContentSubscriptionItem& aB ); + + /** + * Access to group id. + * @return Group id. + */ + IMPORT_C const CXIMPIdentityImp& GroupId() const; + + /** + * Remove the temporary lists. + */ + IMPORT_C void Clean(); + + /** + * Check if group member exists. + * @param aMemberInfo Group member to check + * @return ETrue if group member exists. EFalse if not. + */ + IMPORT_C TBool GroupMemberExistsL( CPresentityGroupMemberInfoImp& aMemberInfo ) const; + + /** + * Check if group member is updated. + * @param aMemberInfo Group member to check + * @return ETrue if group member updated. EFalse if not. + */ + IMPORT_C TBool IsGroupMemberUpdatedL( CPresentityGroupMemberInfoImp& aMemberInfo ) const; + +public: // Methods for accessing array of current members + + /** + * Count of current members + * @return Count of current members + */ + TInt MemberCount() const; + + /** + * Access member in index. + * @param aIndex. Index of group member info to get. + * @return Group member info from index. + */ + CPresentityGroupMemberInfoImp& MemberAt( TInt aIndex ); + + /** + * Register event observer + * @param aEvent Observer New observer to observe events. + */ + void RegisterEventObserverL( MGroupContentEventObserver* aEventObserver ); + + /** + * Unregister event observer + * @param aEventObserver Canceling observer. + */ + void UnregisterEventObserver( MGroupContentEventObserver* aEventObserver ); + +public: // From MXIMPSubscriptionItem + + /** + * @see MXIMPSubscriptionItem + */ + void SynthesiseSubscriptionEventToL( MXIMPPscContext* aContext, TBool aForceEvent ); + + /** + * @see MXIMPSubscriptionItem + */ + void SynthesiseSubscriptionEventToAllCtxsL(); + +private: // From CXIMPSubscriptionItemBase + + /** + * @see CXIMPSubscriptionItemBase + */ + void CleanExpired(); + +private: // Helper methods + + /** + * Inform observer about change. + */ + void InformObserversL(); + +private: // Data + + /** + * Group identity + * Own. + */ + CXIMPIdentityImp* iGroupId; + + /** + * Current members. + * Own. + */ + RPrGrpMemInfoImpArray* iCurrentMembers; + + /** + * List of added members (new since last update). + * Own. + */ + RPrGrpMemInfoImpArray* iAdded; + + /** + * List of removed members (removed since last update). + * Own. + */ + RPrGrpMemInfoImpArray* iRemoved; + + /** + * List of updated members (same as in last update). + * Own. + */ + RPrGrpMemInfoImpArray* iUpdated; + + /** + * Event observers of subscription item. + */ + RPointerArray< MGroupContentEventObserver > iEventObservers; + }; + + +/* ======================================================================== */ + + + +#endif // CPSCGROUPCONTENTSUBSCRIPTIONITEM_H diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencedatamodel/presentitygroups/grouplistsubscriptionitem.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencedatamodel/presentitygroups/grouplistsubscriptionitem.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,320 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Presence Service Connection group list subscription implementation. +* +*/ + + +#include + +#include "grouplistsubscriptionitem.h" +#include "presenceinfofilterimp.h" +#include "ximpitemparent.h" +#include "ximppanics.h" +#include "ximppsccontext.h" +#include "documentutils.h" +#include "presentitygrouplisteventimp.h" +#include "presencetypehelpers.h" +#include "presentitygroupinfoimp.h" +//#include "ximpapieventbase.h" + +#include "ximptrace.h" +// --------------------------------------------------------------------------- +// CGroupListSubscriptionItem::CGroupListSubscriptionItem() +// --------------------------------------------------------------------------- +// +CGroupListSubscriptionItem::CGroupListSubscriptionItem( MXIMPItemParentBase& aParent ) +: CXIMPSubscriptionItemBase( aParent ) + { + } + + +// --------------------------------------------------------------------------- +// CGroupListSubscriptionItem::ConstructL() +// --------------------------------------------------------------------------- +// +void CGroupListSubscriptionItem::ConstructL() + { + BaseConstructL(); + // empty lists must always exist + iCurrentList = new ( ELeave) RPrGrpInfoImpArray; + + iCreated = new ( ELeave ) RPrGrpInfoImpArray; + iUpdated = new ( ELeave ) RPrGrpInfoImpArray; + iDeleted = new ( ELeave ) RPrGrpInfoImpArray; + } + + +// --------------------------------------------------------------------------- +// CGroupListSubscriptionItem::NewL() +// --------------------------------------------------------------------------- +// +CGroupListSubscriptionItem* CGroupListSubscriptionItem::NewLC( MXIMPItemParentBase& aParent ) + { + CGroupListSubscriptionItem* self = new( ELeave ) CGroupListSubscriptionItem( aParent ); + CleanupClosePushL( *self ); + self->ConstructL(); + return self; + } + + +// --------------------------------------------------------------------------- +// CGroupListSubscriptionItem::~CGroupListSubscriptionItem() +// --------------------------------------------------------------------------- +// +CGroupListSubscriptionItem::~CGroupListSubscriptionItem() + { + MXIMPItemParent* presCache = static_cast(iParent.GetInterface(PRESENCE_ITEM_PARENT)); + presCache->RemoveMe( this ); + + if( iCurrentList ) + { + iCurrentList->Close(); + } + delete iCurrentList; + + Clean(); + // just in case + delete iCreated; + delete iDeleted; + delete iUpdated; + } + +// --------------------------------------------------------------------------- +// CGroupListSubscriptionItem::SynthesiseSubscriptionEventTo() +// --------------------------------------------------------------------------- +// +void CGroupListSubscriptionItem::SynthesiseSubscriptionEventToL( + MXIMPPscContext* aContext, TBool aForceEvent ) + { + TRACE_1( _L("CGroupListSubscriptionItem::SynthesiseSubscriptionEventTo() aForce=%d"), aForceEvent ); + CXIMPDataSubscriptionStateImp* status = StatusLC( aContext ); + + if( status->DataState() == MXIMPDataSubscriptionState::EDataAvailable || aForceEvent ) + { + CPresentityGroupListEventImp* newEvent = CPresentityGroupListEventImp::NewL( + iCreated, + iUpdated, + iDeleted, + aForceEvent ? iCurrentList : NULL, + status + ); + CleanupStack::Pop( status ); + CleanupStack::PushL( newEvent ); + + MXIMPItemParent* presCache = static_cast(iParent.GetInterface(PRESENCE_ITEM_PARENT)); + presCache->AddEventL( *newEvent, aContext ); + + } + CleanupStack::PopAndDestroy(); //status || newEvent. Depending on branch. + } + + +// --------------------------------------------------------------------------- +// CGroupListSubscriptionItem::SetNewListL +// --------------------------------------------------------------------------- +// +EXPORT_C void CGroupListSubscriptionItem::SetNewListL( + RPrGrpInfoImpArray* aGroupList ) + { + TRACE_1( _L("CGroupListSubscriptionItem::SetNewListL() aGroupList Count=%d"), aGroupList->Count() ); + // we will eventually take ownership to this + RPrGrpInfoImpArray* tmp = aGroupList; + CleanupDeletePushL( tmp ); + + // the list is already sorted. when a copy was made in datacacheimp, the + // InsertInOrder method was used + + // The below algorithm has complexity of (roughly): + // - aGroupList length M + // - iCurrentList final length N + // + // Final complexity: + // M*( 1 // indexed accessor + // + logN // find (ordered) + // + logN // insert in order (find+insert) + // + O(1) // delete + // + O(1) // remove + // ) + O(1) // updating iDeleted and iCurrentList + // = M(2logN+3) + 2MlogN+3M = O(cMlogM). + // + // Should be fast enough. The complexity is not fully accurate because + // array size grows as we insert into it. + // + TLinearOrder + linearOrder( CPresentityGroupInfoImp::GroupIdLinearOrder ); + + for ( TInt i = 0; i < tmp->Count(); i++ ) + { + // compare against current list + CPresentityGroupInfoImp* info = (*tmp)[ i ]; + TInt pos = iCurrentList->FindInOrder( info, linearOrder ); + + if ( pos == KErrNotFound ) + { + // not found in current list + // so must be a fresh created list name + iCreated->InsertInOrderL( info, linearOrder ); + } + else + { + // found in current list, so it must be an updated list name + iUpdated->InsertInOrderL( info, linearOrder ); + + delete (*iCurrentList)[ pos ]; + iCurrentList->Remove( pos ); + + // we must remove the found ones from iCurrentList, + // otherwise we will not know what was left. and finding out + // the deleted items will be difficult. + } + } + + // what's left in iCurrentList contains the deleted ones. + delete iDeleted; + iDeleted = iCurrentList; + + // the given list becomes the new list + iCurrentList = tmp; + CleanupStack::Pop( tmp ); + iSubscriptionState->SetDataStateL( MXIMPDataSubscriptionState::EDataAvailable ); + } + +// --------------------------------------------------------------------------- +// CGroupListSubscriptionItem::SetCreatedListL +// --------------------------------------------------------------------------- +// +EXPORT_C void CGroupListSubscriptionItem::SetCreatedListL( + RPrGrpInfoImpArray* aGroupList ) + { + TRACE_1( _L("CGroupListSubscriptionItem::SetCreatedListL() aGroupList Count=%d"), aGroupList->Count() ); + // we took ownership to the given list + RPrGrpInfoImpArray* tmp = aGroupList; + CleanupDeletePushL( tmp ); + + // see also SetNewListL. + + // the list is already sorted. when a copy was made in datacacheimp, the + // InsertInOrder method was used + TLinearOrder + linearOrder( CPresentityGroupInfoImp::GroupIdLinearOrder ); + + // update the list of created and updated groups + for ( TInt i = 0; i < tmp->Count(); i++ ) + { + // compare against current list + CPresentityGroupInfoImp* info = (*tmp)[ i ]; + TInt pos = iCurrentList->FindInOrder( info, linearOrder ); + + if ( pos == KErrNotFound ) + { + // not found in current list + // so must be a fresh created list name. + // this cannot come when the HandleDisplayNameUpdatedListL method + // is called. + iCurrentList->InsertInOrderL( info, linearOrder ); + ( *tmp )[ i ] = NULL; + iCreated->InsertInOrderL( info, linearOrder ); + } + else + { + // This can be checked if really had changed if needed. Now + // we trust server that changes are reasonable. + + // change the display name of the updated group in the current list + (*iCurrentList)[ pos ]->SetGroupDisplayNameL( info->GroupDisplayName() ); + + // found in current list, so it must be an updated list name + iUpdated->InsertInOrderL( (*iCurrentList)[ pos ], linearOrder ); + } + } + + // current list may get updated display name to the existing elements, + // otherwise the list is unchanged. list of deleted groups stays empty. + // updated and created lists were updated. the input parameter list can be + // deleted + CleanupStack::PopAndDestroy( tmp ); + iSubscriptionState->SetDataStateL( MXIMPDataSubscriptionState::EDataAvailable ); + } + +// --------------------------------------------------------------------------- +// CGroupListSubscriptionItem::SetDeletedListL +// --------------------------------------------------------------------------- +// +EXPORT_C void CGroupListSubscriptionItem::SetDeletedListL( + RPrGrpInfoImpArray* aGroupList ) + { + TRACE_1( _L("CGroupListSubscriptionItem::SetDeletedListL() aGroupList Count=%d"), aGroupList->Count() ); + // we will eventually take ownership to this + RPrGrpInfoImpArray* tmp = aGroupList; + CleanupDeletePushL( tmp ); + + // see also SetNewListL. + + // the list is already sorted. when a copy was made in datacacheimp, the + // InsertInOrder method was used + TLinearOrder + linearOrder( CPresentityGroupInfoImp::GroupIdLinearOrder ); + + // remove the deleted ones from the current list + for ( TInt i = 0; i < tmp->Count(); i++ ) + { + // compare against current list + CPresentityGroupInfoImp* info = (*tmp)[ i ]; + TInt pos = iCurrentList->FindInOrder( info, linearOrder ); + + // found in current list, so it must be a deleted list name + if ( pos != KErrNotFound ) + { + // remove from current list + delete (*iCurrentList)[ pos ]; + iCurrentList->Remove( pos ); + } + } + + // the given list becomes the new list of + // deleted ones + delete iDeleted; + iDeleted = tmp; + CleanupStack::Pop( tmp ); + iSubscriptionState->SetDataStateL( MXIMPDataSubscriptionState::EDataAvailable ); + } + +// --------------------------------------------------------------------------- +// CGroupListSubscriptionItem::Clean +// --------------------------------------------------------------------------- +// +EXPORT_C void CGroupListSubscriptionItem::Clean() + { + TRACE( _L("CGroupListSubscriptionItem::Clean()") ); + // empty the lists. + // the lists must stay valid for use + + // iCreated and iUpdated are collection from currentlist. Do not delete items. + // iDeleted is only place for items. Delete those. + + iCreated->Reset(); + iUpdated->Reset(); + iDeleted->Close(); + } + +// --------------------------------------------------------------------------- +// CGroupListSubscriptionItem::CleanExpired() +// --------------------------------------------------------------------------- +// +void CGroupListSubscriptionItem::CleanExpired() + { + + } +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencedatamodel/presentitygroups/grouplistsubscriptionitem.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencedatamodel/presentitygroups/grouplistsubscriptionitem.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,148 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Presence Service Connection group list subscription implementation. +* +*/ + +#ifndef CPSCGROUPLISTSUBSCRIPTIONITEM_H +#define CPSCGROUPLISTSUBSCRIPTIONITEM_H + +#include +#include "presenceinfoimp.h" +#include "ximpsubscriptionitem.h" +#include "presencetypehelpers.h" +#include "ximpsubscriptionitembase.h" + +class MXIMPItemParentBase; +class MXIMPPscContext; +class CDesC16Array; +class CPresentityGroupInfoImp; + +/** + * PSC group list subscription implementation + * + * @since S60 v3.2 + */ +class CGroupListSubscriptionItem : public CXIMPSubscriptionItemBase + { + +public: // Construction and destruction + + /** + * Construction + * @param aParent. Parent has to be informed when this object is deleted by RemoveMe method. + */ + static CGroupListSubscriptionItem* NewLC( MXIMPItemParentBase& aParent ); + + /** + * Destruction + * - Remember to inform parent about delete. + */ + ~CGroupListSubscriptionItem(); + +private: // Construction and destruction + + /** + * Construction + * @param aParent. Parent has to be informed when this object is deleted by RemoveMe method. + */ + CGroupListSubscriptionItem( MXIMPItemParentBase& aParent ); + + /** + * Construction + */ + void ConstructL(); + +public: // New methods + + /** + * Set the new list of groups. Will create and set + * the temporary lists for created, deleted and updated lists. + * Ownership is transferred! + * @param aGroupList The list of groups + */ + IMPORT_C void SetNewListL( RPrGrpInfoImpArray* aGroupList ); + + /** + * Set the created list of groups. Will set + * other lists accordingly. If there are no new elements (=no created groups), + * will simply update the display names of the existing groups, i.e. + * HandlePresentityGroupDisplayNameUpdatedL call handling. + * Ownership is transferred! + * @param aGroupList The list of groups + */ + IMPORT_C void SetCreatedListL( RPrGrpInfoImpArray* aGroupList ); + + /** + * Set the deleted list of groups. Will set + * other lists accordingly. + * Ownership is transferred! + * @param aGroupList The list of groups + */ + IMPORT_C void SetDeletedListL( RPrGrpInfoImpArray* aGroupList ); + + /** + * Remove the temporary lists. + */ + IMPORT_C void Clean(); + +public: // From MXIMPSubscriptionItem + + /** + * @see MXIMPSubscriptionItem + */ + void SynthesiseSubscriptionEventToL( MXIMPPscContext* aContext, TBool aForceEvent ); + +private: // From CXIMPSubscriptionItemBase + + /** + * @see CXIMPSubscriptionItemBase + */ + void CleanExpired(); + + +private: // Data + + /** + * Current list of groups. + * Owned. + */ + RPrGrpInfoImpArray* iCurrentList; + + /** + * List of created groups (new since last update). + * Owned. + */ + RPrGrpInfoImpArray* iCreated; + + /** + * List of deleted groups (removed since last update). + * Owned. + */ + RPrGrpInfoImpArray* iDeleted; + + /** + * List of updated groups (same as in last update). + * Owned. + */ + RPrGrpInfoImpArray* iUpdated; + + }; + + +/* ======================================================================== */ + + + +#endif // CPSCGROUPLISTSUBSCRIPTIONITEM_H diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencedatamodel/presentitygroups/presentitygroupcontenteventimp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencedatamodel/presentitygroups/presentitygroupcontenteventimp.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,456 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MPresentityGroupContentEvent API object implementation. + * +*/ + +#include "presentitygroupcontenteventimp.h" +#include "presentitygroupmemberinfoimp.h" +#include "ximpidentityimp.h" +#include "ximpdatasubscriptionstateimp.h" +#include "ximpobjecthelpers.h" +#include + + +// --------------------------------------------------------------------------- +// CPresentityGroupContentEventImp::NewLC() +// --------------------------------------------------------------------------- +// +EXPORT_C CPresentityGroupContentEventImp* CPresentityGroupContentEventImp::NewLC( + CXIMPIdentityImp& aGroupId, + RPrGrpMemInfoImpArray* aAdded, + RPrGrpMemInfoImpArray* aUpdated, + RPrGrpMemInfoImpArray* aRemoved, + CXIMPDataSubscriptionStateImp* aState + ) + { + CPresentityGroupContentEventImp* self = new( ELeave ) CPresentityGroupContentEventImp(); + CleanupStack::PushL( self ); + self->ConstructL( aGroupId, aAdded, aUpdated, aRemoved, aState ); + return self; + } + +// --------------------------------------------------------------------------- +// CPresentityGroupContentEventImp::NewLC() +// --------------------------------------------------------------------------- +// +EXPORT_C CPresentityGroupContentEventImp* CPresentityGroupContentEventImp::NewLC( + CXIMPIdentityImp& aGroupId, + RPrGrpMemInfoImpArray* aAdded, + RPrGrpMemInfoImpArray* aUpdated, + RPrGrpMemInfoImpArray* aRemoved, + RPrGrpMemInfoImpArray* aCurrent, + CXIMPDataSubscriptionStateImp* aState + ) + { + CPresentityGroupContentEventImp* self = new( ELeave ) CPresentityGroupContentEventImp(); + CleanupStack::PushL( self ); + if( aCurrent ) + { + self->ConstructL( aGroupId, aAdded, aUpdated, aRemoved, aCurrent, aState ); + } + else + { + self->ConstructL( aGroupId, aAdded, aUpdated, aRemoved, aState ); + } + return self; + } +// --------------------------------------------------------------------------- +// CPresentityGroupContentEventImp::NewL() +// --------------------------------------------------------------------------- +// +EXPORT_C CPresentityGroupContentEventImp* CPresentityGroupContentEventImp::NewL( + CXIMPIdentityImp& aGroupId, + RPrGrpMemInfoImpArray* aAdded, + RPrGrpMemInfoImpArray* aUpdated, + RPrGrpMemInfoImpArray* aRemoved, + RPrGrpMemInfoImpArray* aCurrent, + CXIMPDataSubscriptionStateImp* aState + ) + { + CPresentityGroupContentEventImp* self = + NewLC( aGroupId, aAdded, aUpdated, aRemoved, aCurrent, aState ); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// CPresentityGroupContentEventImp::NewFromStreamLC() +// --------------------------------------------------------------------------- +// +CXIMPApiEventBase* CPresentityGroupContentEventImp::NewFromStreamLC( RReadStream& aStream ) + { + CPresentityGroupContentEventImp* self = new( ELeave ) CPresentityGroupContentEventImp(); + CleanupStack::PushL( self ); + self->ConstructL( aStream ); + return self; + } + +// --------------------------------------------------------------------------- +// CPresentityGroupContentEventImp::~CPresentityGroupContentEventImp() +// --------------------------------------------------------------------------- +// +CPresentityGroupContentEventImp::~CPresentityGroupContentEventImp() + { + delete iGroupId; + + if( iConstructedFromStream ) + { + delete iAddedMembers; + delete iUpdatedMembers; + delete iRemovedMembers; + delete iCurrentMembers; + iCurrentMembers = NULL; // must be null to skip double deletion below + } + + if ( iOwnsCurrentMembersArray ) + { + delete iCurrentMembers; + } + + delete iSubscriptionState; + } + +// --------------------------------------------------------------------------- +// CPresentityGroupContentEventImp::CPresentityGroupContentEventImp() +// --------------------------------------------------------------------------- +// +CPresentityGroupContentEventImp::CPresentityGroupContentEventImp() + { + } + + +// --------------------------------------------------------------------------- +// CPresentityGroupContentEventImp::ConstructL() +// --------------------------------------------------------------------------- +// +void CPresentityGroupContentEventImp::ConstructL( + CXIMPIdentityImp& aGroupId, + RPrGrpMemInfoImpArray* aAdded, + RPrGrpMemInfoImpArray* aUpdated, + RPrGrpMemInfoImpArray* aRemoved, + CXIMPDataSubscriptionStateImp* aState + ) + { + iGroupId = TXIMPObjectCloner< CXIMPIdentityImp >::CloneL( aGroupId ); + iAddedMembers = aAdded; + iUpdatedMembers = aUpdated; + iRemovedMembers = aRemoved; + + iCurrentMembers = new ( ELeave ) RPrGrpMemInfoImpArray; + iOwnsCurrentMembersArray = ETrue; + + iSubscriptionState = aState; + } + +// --------------------------------------------------------------------------- +// CPresentityGroupContentEventImp::ConstructL() +// --------------------------------------------------------------------------- +// +void CPresentityGroupContentEventImp::ConstructL( + CXIMPIdentityImp& aGroupId, + RPrGrpMemInfoImpArray* aAdded, + RPrGrpMemInfoImpArray* aUpdated, + RPrGrpMemInfoImpArray* aRemoved, + RPrGrpMemInfoImpArray* aCurrent, + CXIMPDataSubscriptionStateImp* aState ) + { + iGroupId = TXIMPObjectCloner< CXIMPIdentityImp >::CloneL( aGroupId ); + iAddedMembers = aAdded; + iUpdatedMembers = aUpdated; + iRemovedMembers = aRemoved; + iCurrentMembers = aCurrent; + + iSubscriptionState = aState; + } + +// --------------------------------------------------------------------------- +// CPresentityGroupContentEventImp::ConstructL() +// --------------------------------------------------------------------------- +// +void CPresentityGroupContentEventImp::ConstructL( RReadStream& aStream ) + { + iConstructedFromStream = ETrue; + iAddedMembers = new ( ELeave ) RPrGrpMemInfoImpArray; + iUpdatedMembers = new ( ELeave ) RPrGrpMemInfoImpArray; + iRemovedMembers = new ( ELeave ) RPrGrpMemInfoImpArray; + iCurrentMembers = new ( ELeave ) RPrGrpMemInfoImpArray; + + iGroupId = CXIMPIdentityImp::NewLC(); + CleanupStack::Pop( 1 ); // iGroupId + + iGroupId->InternalizeL( aStream ); + FillArrayFromStreamL( *iAddedMembers, aStream ); + FillArrayFromStreamL( *iUpdatedMembers, aStream ); + FillArrayFromStreamL( *iRemovedMembers, aStream ); + FillArrayFromStreamL( *iCurrentMembers, aStream ); + + + iSubscriptionState = CXIMPDataSubscriptionStateImp::NewL(); + iSubscriptionState->InternalizeL( aStream ); + } + +// --------------------------------------------------------------------------- +// Implement supported interface access. +// --------------------------------------------------------------------------- +// +XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CPresentityGroupContentEventImp, + MPresentityGroupContentEvent ) + XIMPIMP_IF_BASE_GET_CLASS( CXIMPApiEventBase, this ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + +XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CPresentityGroupContentEventImp, + MPresentityGroupContentEvent ) + XIMPIMP_IF_BASE_GET_CONST_CLASS( CXIMPApiEventBase, this ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + + + +// --------------------------------------------------------------------------- +// Implement methods from base event interface and base event class +// --------------------------------------------------------------------------- +// +XIMPIMP_IMPLEMENT_EVENT_BASE_METHODS( CPresentityGroupContentEventImp, + MPresentityGroupContentEvent ) + + +// --------------------------------------------------------------------------- +// CPresentityGroupContentEventImp::EqualsContent() +// --------------------------------------------------------------------------- +// +TBool CPresentityGroupContentEventImp::EqualsContent( + const CXIMPApiEventBase& aOtherInstance ) const + { + const CPresentityGroupContentEventImp* tmp = + TXIMPGetImpClassOrPanic< const CPresentityGroupContentEventImp >::From( + aOtherInstance.Base() ); + + TBool same = ETrue; + + TBool x = 0 == GroupId().Identity().Compare( tmp->GroupId().Identity() ); + same &= x; + + x = CompareArrays( iAddedMembers, tmp->iAddedMembers ); + same &= x; + + x = CompareArrays( iUpdatedMembers, tmp->iUpdatedMembers ); + same &= x; + + x = CompareArrays( iRemovedMembers, tmp->iRemovedMembers ); + same &= x; + + x = CompareArrays( iCurrentMembers, tmp->iCurrentMembers ); + same &= x; + + x = iSubscriptionState->EqualsContent( *tmp->iSubscriptionState ); + same &= x; + + return same; + } + +// --------------------------------------------------------------------------- +// CPresentityGroupContentEventImp::CompareArrays +// --------------------------------------------------------------------------- +// +TBool CPresentityGroupContentEventImp::CompareArrays( + RPrGrpMemInfoImpArray* aA, RPrGrpMemInfoImpArray* aB ) + { + TBool same = ETrue; + + TBool x; + x = aA->Count() == aB->Count(); // counts must match + same &= x; + + if ( ! same ) + { + // don't bother checking further if counts mismatch + return same; + } + + // now check whole array, arrays have equal length + for ( TInt i = 0; i < aA->Count(); i++ ) + { + x = 0 == ( (*aA)[ i ]->IdentityImp().Compare( + (*aB)[ i ]->IdentityImp() ) ); + same &= x; + + x = 0 == ( (*aA)[ i ]->GroupMemberDisplayName().Compare( + (*aB)[ i ]->GroupMemberDisplayName() ) ); + same &= x; + } + + return same; + } + +// --------------------------------------------------------------------------- +// From class CXIMPApiEventBase. +// CPresentityGroupContentEventImp::ExternalizeL() +// --------------------------------------------------------------------------- +// +void CPresentityGroupContentEventImp::ExternalizeL( RWriteStream& aStream ) const + { + iGroupId->ExternalizeL( aStream ); + WriteArrayToStreamL( *iAddedMembers, aStream ); + WriteArrayToStreamL( *iUpdatedMembers, aStream ); + WriteArrayToStreamL( *iRemovedMembers, aStream ); + WriteArrayToStreamL( *iCurrentMembers, aStream ); + + iSubscriptionState->ExternalizeL( aStream ); + } + + +// --------------------------------------------------------------------------- +// From class MPresentityGroupContentEvent. +// CPresentityGroupContentEventImp::GroupId() +// --------------------------------------------------------------------------- +// +const MXIMPIdentity& CPresentityGroupContentEventImp::GroupId() const + { + return *iGroupId; + } + +// --------------------------------------------------------------------------- +// From class MPresentityGroupContentEvent. +// CPresentityGroupContentEventImp::NewMembersCount() +// --------------------------------------------------------------------------- +// +TInt CPresentityGroupContentEventImp::NewMembersCount() const + { + return iAddedMembers->Count(); + } + +// --------------------------------------------------------------------------- +// From class MPresentityGroupContentEvent. +// CPresentityGroupContentEventImp::NewMember() +// --------------------------------------------------------------------------- +// +const MPresentityGroupMemberInfo& + CPresentityGroupContentEventImp::NewMember( TInt aIndex ) const + { + return *(*iAddedMembers)[ aIndex ]; + } + +// --------------------------------------------------------------------------- +// From class MPresentityGroupContentEvent. +// CPresentityGroupContentEventImp::UpdatedMembersCount() +// --------------------------------------------------------------------------- +// +TInt CPresentityGroupContentEventImp::UpdatedMembersCount() const + { + return iUpdatedMembers->Count(); + } + +// --------------------------------------------------------------------------- +// From class MPresentityGroupContentEvent. +// CPresentityGroupContentEventImp::UpdatedMember() +// --------------------------------------------------------------------------- +// +const MPresentityGroupMemberInfo& + CPresentityGroupContentEventImp::UpdatedMember( TInt aIndex ) const + { + return *(*iUpdatedMembers)[ aIndex ]; + } + +// --------------------------------------------------------------------------- +// From class MPresentityGroupContentEvent. +// CPresentityGroupContentEventImp::DisappearedMembersCount() +// --------------------------------------------------------------------------- +// +TInt CPresentityGroupContentEventImp::DisappearedMembersCount() const + { + return iRemovedMembers->Count(); + } + +// --------------------------------------------------------------------------- +// From class MPresentityGroupContentEvent. +// CPresentityGroupContentEventImp::DisappearedMember() +// --------------------------------------------------------------------------- +// +const MPresentityGroupMemberInfo& + CPresentityGroupContentEventImp::DisappearedMember( TInt aIndex ) const + { + return *(*iRemovedMembers)[ aIndex ]; + } + +// --------------------------------------------------------------------------- +// From class MPresentityGroupContentEvent. +// CPresentityGroupContentEventImp::CurrentMembersCount() +// --------------------------------------------------------------------------- +// +TInt CPresentityGroupContentEventImp::CurrentMembersCount() const + { + return iCurrentMembers->Count(); + } + +// --------------------------------------------------------------------------- +// From class MPresentityGroupContentEvent. +// CPresentityGroupContentEventImp::CurrentMember() +// --------------------------------------------------------------------------- +// +const MPresentityGroupMemberInfo& + CPresentityGroupContentEventImp::CurrentMember( TInt aIndex ) const + { + return *(*iCurrentMembers)[ aIndex ]; + } + +// --------------------------------------------------------------------------- +// From class MPresentityGroupContentEvent. +// CPresentityGroupContentEventImp::Status() +// --------------------------------------------------------------------------- +// +const MXIMPDataSubscriptionState& + CPresentityGroupContentEventImp::DataSubscriptionState() const + { + return *iSubscriptionState; + } + + +// --------------------------------------------------------------------------- +// CPresentityGroupContentEventImp::WriteArrayToStreamL() +// --------------------------------------------------------------------------- +// +void CPresentityGroupContentEventImp::WriteArrayToStreamL( + RPrGrpMemInfoImpArray& aArray, RWriteStream& aStream ) const + { + TInt count = aArray.Count(); + aStream.WriteInt32L( count ); + { + for( TInt a = 0; a < count; ++a ) + { + aArray[ a ]->ExternalizeL( aStream ); + } + } + } + +// --------------------------------------------------------------------------- +// CPresentityGroupContentEventImp::FillArrayFromStreamL +// --------------------------------------------------------------------------- +// +void CPresentityGroupContentEventImp::FillArrayFromStreamL( + RPrGrpMemInfoImpArray& aArray, + RReadStream& aStream ) + { + TInt count = aStream.ReadInt32L(); + for( TInt a = 0; a < count; ++a ) + { + // the stream MUST be in order (since it was externalized by this class) + CPresentityGroupMemberInfoImp* newInfo = CPresentityGroupMemberInfoImp::NewLC(); + newInfo->InternalizeL( aStream ); + aArray.AppendL( newInfo ); + CleanupStack::Pop(); // newInfo + } + } + +// End of file + diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencedatamodel/presentitygroups/presentitygroupcontenteventimp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencedatamodel/presentitygroups/presentitygroupcontenteventimp.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,207 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MPresentityGroupContentEvent API object implementation. + * +*/ + +#ifndef CPRESENTITYGROUPCONTENTEVENTIMP_H +#define CPRESENTITYGROUPCONTENTEVENTIMP_H + + +#include "ximpapieventbase.h" +#include "presencetypehelpers.h" +#include "ximpdatasubscriptionstateimp.h" +#include + + +class RReadStream; +class CXIMPIdentityImp; +class CPresentityGroupInfoImp; +class CXIMPDataSubscriptionStateImp; + +/** + * MOwnPresenceEvent API object implementation. + * + * @lib ximpdatamodel.dll + * @since S60 v3.2 + */ +NONSHARABLE_CLASS( CPresentityGroupContentEventImp ): public CXIMPApiEventBase, + public MPresentityGroupContentEvent + { +public: + /** The class ID. */ + enum { KClassId = PRIMP_CLSID_CPRESENTITYGROUPCONTENTEVENTIMP }; + +public: + + /** + * Exported instantiation method for initializing + * new event object. + */ + IMPORT_C static CPresentityGroupContentEventImp* NewLC( + CXIMPIdentityImp& aGroupId, + RPrGrpMemInfoImpArray* aAdded, + RPrGrpMemInfoImpArray* aUpdated, + RPrGrpMemInfoImpArray* aRemoved, + CXIMPDataSubscriptionStateImp* aState + ); + + IMPORT_C static CPresentityGroupContentEventImp* NewLC( + CXIMPIdentityImp& aGroupId, + RPrGrpMemInfoImpArray* aAdded, + RPrGrpMemInfoImpArray* aUpdated, + RPrGrpMemInfoImpArray* aRemoved, + RPrGrpMemInfoImpArray* aCurrent, + CXIMPDataSubscriptionStateImp* aState + ); + + IMPORT_C static CPresentityGroupContentEventImp* NewL( + CXIMPIdentityImp& aGroupId, + RPrGrpMemInfoImpArray* aAdded, + RPrGrpMemInfoImpArray* aUpdated, + RPrGrpMemInfoImpArray* aRemoved, + RPrGrpMemInfoImpArray* aCurrent, + CXIMPDataSubscriptionStateImp* aState + ); + + /** + * Instantiation method for event automation. + * Method signature must be exactly this to work + * with event delivery automation system. + * + * Event implementation must be registered to + * XIMPEventCodec KXIMPEventConstructorTable. + */ + static CXIMPApiEventBase* NewFromStreamLC( RReadStream& aStream ); + + virtual ~CPresentityGroupContentEventImp(); + + +private: + CPresentityGroupContentEventImp(); + + void ConstructL( CXIMPIdentityImp& aGroupId, + RPrGrpMemInfoImpArray* aAdded, + RPrGrpMemInfoImpArray* aUpdated, + RPrGrpMemInfoImpArray* aRemoved, + CXIMPDataSubscriptionStateImp* aState + ); + + void ConstructL( CXIMPIdentityImp& aGroupId, + RPrGrpMemInfoImpArray* aAdded, + RPrGrpMemInfoImpArray* aUpdated, + RPrGrpMemInfoImpArray* aRemoved, + RPrGrpMemInfoImpArray* aCurrent, + CXIMPDataSubscriptionStateImp* aState ); + + void ConstructL( RReadStream& aStream ); + + /** + * Helper for externalize. + */ + void WriteArrayToStreamL( RPrGrpMemInfoImpArray& aArray, + RWriteStream& aStream ) const; + + /** + * Helper for internalize + */ + void FillArrayFromStreamL( RPrGrpMemInfoImpArray& aArray, + RReadStream& aStream ); + +public: // From API base interfaces + + /** + * Implementation of MXIMPBase interface methods + * @see MXIMPBase + */ + XIMPIMP_DECLARE_IF_BASE_METHODS + + + /** + * Implementation of MXIMPEventBase interface and + * CXIMPApiEventBase methods + * + * @see MXIMPEventBase + * @see CXIMPApiEventBase + */ + XIMPIMP_DECLARE_EVENT_BASE_METHODS + + +public: // From MPresentityGroupContentEvent + + const MXIMPIdentity& GroupId() const; + + TInt NewMembersCount() const; + const MPresentityGroupMemberInfo& NewMember( TInt aIndex ) const; + + TInt UpdatedMembersCount() const; + const MPresentityGroupMemberInfo& UpdatedMember( TInt aIndex ) const; + + TInt DisappearedMembersCount() const; + const MPresentityGroupMemberInfo& DisappearedMember( TInt aIndex ) const; + + TInt CurrentMembersCount() const; + const MPresentityGroupMemberInfo& CurrentMember( TInt aIndex ) const; + + const MXIMPDataSubscriptionState& DataSubscriptionState() const; + +private: + + /** + * Compare the given arrays for equality. + * Arrays must be sorted. This is a method specific + * to the group info imp array. + * @return ETrue if the arrays match, EFalse otherwise. + */ + static TBool CompareArrays( RPrGrpMemInfoImpArray* aA, RPrGrpMemInfoImpArray* aB ); + +private: // data + + /** + * ETrue if constructed from stream. + */ + TBool iConstructedFromStream; + + /** + * Kludge to fix current members ownership issues. + */ + TBool iOwnsCurrentMembersArray; + + /** + * Group id + * + */ + CXIMPIdentityImp* iGroupId; + + /** + * Group member informations. + * Owns if constructed from stream. Otherwise does not own. + * Might own current members in some cases, in which + * iOwnsCurrentMembersArray + * will be set. + */ + RPrGrpMemInfoImpArray* iAddedMembers; + RPrGrpMemInfoImpArray* iUpdatedMembers; + RPrGrpMemInfoImpArray* iRemovedMembers; + RPrGrpMemInfoImpArray* iCurrentMembers; + + + /** + * + */ + CXIMPDataSubscriptionStateImp* iSubscriptionState; + }; + + +#endif // CPRESENTITYGROUPCONTENTEVENTIMP_H diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencedatamodel/presentitygroups/presentitygroupinfoimp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencedatamodel/presentitygroups/presentitygroupinfoimp.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,236 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MPresencetityGrpouInfo API object implementation. +* +*/ + + +#include "presentitygroupinfoimp.h" +#include "ximpidentityimp.h" +#include "ximprbufhelpers.h" +#include "ximpobjecthelpers.h" + +// ============================ MEMBER FUNCTIONS ============================= + +// --------------------------------------------------------------------------- +// CPresentityGroupInfoImp::NewLC() +// --------------------------------------------------------------------------- +// +EXPORT_C CPresentityGroupInfoImp* CPresentityGroupInfoImp::NewLC( + const MXIMPIdentity& aIdentity, + const TDesC16& aDisplayName ) + { + CPresentityGroupInfoImp* self = new( ELeave ) CPresentityGroupInfoImp; + CleanupStack::PushL( self ); + self->ConstructL( aIdentity, aDisplayName ); + return self; + } + +// --------------------------------------------------------------------------- +// CPresentityGroupInfoImp::NewLC() +// --------------------------------------------------------------------------- +// +EXPORT_C CPresentityGroupInfoImp* CPresentityGroupInfoImp::NewLC() + { + CPresentityGroupInfoImp* self = new( ELeave ) CPresentityGroupInfoImp; + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + + +// --------------------------------------------------------------------------- +// CPresentityGroupInfoImp::NewL() +// --------------------------------------------------------------------------- +// +EXPORT_C CPresentityGroupInfoImp* CPresentityGroupInfoImp::NewL() + { + CPresentityGroupInfoImp* self = NewLC(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// CPresentityGroupInfoImp::NewFromStreamLC() +// --------------------------------------------------------------------------- +// +XIMPIMP_IMPLEMENT_DATAOBJ_NEWFROMSTREAM( CPresentityGroupInfoImp ) + +// --------------------------------------------------------------------------- +// Implement supported interface access. +// --------------------------------------------------------------------------- +// +XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CPresentityGroupInfoImp, MPresentityGroupInfo ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() +XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CPresentityGroupInfoImp, MPresentityGroupInfo ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + +// --------------------------------------------------------------------------- +// CPresentityGroupInfoImp::~CPresentityGroupInfoImp() +// --------------------------------------------------------------------------- +// +CPresentityGroupInfoImp::~CPresentityGroupInfoImp() + { + iDisplayName.Close(); + delete iIdentity; + } + +// --------------------------------------------------------------------------- +// CPresentityGroupInfoImp::CPresentityGroupInfoImp() +// --------------------------------------------------------------------------- +// +CPresentityGroupInfoImp::CPresentityGroupInfoImp() + { + } + + +// --------------------------------------------------------------------------- +// CPresentityGroupInfoImp::ConstructL() +// --------------------------------------------------------------------------- +// +void CPresentityGroupInfoImp::ConstructL() + { + iDisplayName.CreateL( 0 ); + iIdentity = CXIMPIdentityImp::NewLC(); + CleanupStack::Pop( iIdentity ); + } + +// --------------------------------------------------------------------------- +// CPresentityGroupInfoImp::ConstructL() +// --------------------------------------------------------------------------- +// +void CPresentityGroupInfoImp::ConstructL( const MXIMPIdentity& aIdentity, + const TDesC16& aDisplayName ) + { + const CXIMPIdentityImp* sourceIdentity = + TXIMPGetImpClassOrPanic< const CXIMPIdentityImp >::From( aIdentity ); + iIdentity = TXIMPObjectCloner< CXIMPIdentityImp >::CloneL( *sourceIdentity ); + + iDisplayName.CreateL( aDisplayName ); + } + +// --------------------------------------------------------------------------- +// CPresentityGroupInfoImp::ExternalizeL() +// --------------------------------------------------------------------------- +// +void CPresentityGroupInfoImp::ExternalizeL( RWriteStream& aStream ) const + { + iIdentity->ExternalizeL( aStream ); + XIMPRBuf16Helper::ExternalizeL( iDisplayName, aStream ); + } + +// --------------------------------------------------------------------------- +// CPresentityGroupInfoImp::InternalizeL() +// --------------------------------------------------------------------------- +// +EXPORT_C void CPresentityGroupInfoImp::InternalizeL( RReadStream& aStream ) + { + iIdentity->InternalizeL( aStream ); + XIMPRBuf16Helper::InternalizeL( iDisplayName, aStream ); + } + +// --------------------------------------------------------------------------- +// From MPresentityGroupInfo class. +// CPresentityGroupInfoImp::GroupId() +// --------------------------------------------------------------------------- +// +const MXIMPIdentity& CPresentityGroupInfoImp::GroupId() const + { + return *iIdentity; + } + + +// --------------------------------------------------------------------------- +// From MPresentityGroupInfo class. +// CPresentityGroupInfoImp::GroupDisplayName() +// --------------------------------------------------------------------------- +// +const TDesC16& CPresentityGroupInfoImp::GroupDisplayName() const + { + return iDisplayName; + } + + +// --------------------------------------------------------------------------- +// From MPresentityGroupInfo class. +// CPresentityGroupInfoImp::SetGroupIdL() +// --------------------------------------------------------------------------- +// +void CPresentityGroupInfoImp::SetGroupIdL( MXIMPIdentity* aIdentity ) + { + CXIMPIdentityImp* identityImp = + TXIMPGetImpClassOrPanic< CXIMPIdentityImp>::From( *aIdentity ); + + delete iIdentity; + iIdentity = identityImp; + } + + +// --------------------------------------------------------------------------- +// From MPresentityGroupInfo class. +// CPresentityGroupInfoImp::SetGroupDisplayNameL() +// --------------------------------------------------------------------------- +// +void CPresentityGroupInfoImp::SetGroupDisplayNameL( + const TDesC16& aDisplayName ) + { + HBufC16* displayNameBuf = aDisplayName.AllocL(); + iDisplayName.Close(); + iDisplayName.Assign( displayNameBuf ); + } + + +// --------------------------------------------------------------------------- +// CPresentityGroupInfoImp::GroupIdLinearOrder +// --------------------------------------------------------------------------- +// +EXPORT_C TInt CPresentityGroupInfoImp::GroupIdLinearOrder( + const CPresentityGroupInfoImp& aA, + const CPresentityGroupInfoImp& aB ) + { + return aA.Identity().Compare( aB.Identity() ); + } + +// --------------------------------------------------------------------------- +// CPresentityGroupInfoImp::Identity +// --------------------------------------------------------------------------- +// +EXPORT_C const CXIMPIdentityImp& CPresentityGroupInfoImp::Identity() const + { + return *iIdentity; + } + +// --------------------------------------------------------------------------- +// CPresentityGroupInfoImp::EqualsContent() +// --------------------------------------------------------------------------- +// +TBool CPresentityGroupInfoImp::EqualsContent( + const CXIMPApiDataObjBase& aOtherInstance ) const + { + const CPresentityGroupInfoImp* tmp = + TXIMPGetImpClassOrPanic< const CPresentityGroupInfoImp >::From( + aOtherInstance.Base() ); + + TBool same = ETrue; + TBool x; + x = iIdentity->EqualsContent( *( tmp->iIdentity ) ); + same &= x; + + x = 0 == iDisplayName.Compare( tmp->iDisplayName ); + same &= x; + + return same; + } + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencedatamodel/presentitygroups/presentitygroupinfoimp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencedatamodel/presentitygroups/presentitygroupinfoimp.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,124 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MPresentityGroupInfo API object implementation. +* +*/ + +#ifndef CPRESENTITYGROUPINFOIMP_H +#define CPRESENTITYGROUPINFOIMP_H + +#include "ximpapidataobjbase.h" +#include "presenceapiobjbase.h" +#include + +#include +#include + +class CXIMPIdentityImp; + +/** + * MPresenceInfo API object implementation. + * + * @lib ximpdatamodel.dll + * @since S60 v3.2 + */ +NONSHARABLE_CLASS( CPresentityGroupInfoImp ): public CXIMPApiDataObjBase, + public MPresentityGroupInfo + { + public: + /** The class ID. */ + enum { KClassId = PRIMP_CLSID_CPRESENTITYGROUPINFOIMP }; + +public: + + IMPORT_C static CPresentityGroupInfoImp* NewLC( + const MXIMPIdentity& aIdentity, + const TDesC16& aDisplayName ); + IMPORT_C static CPresentityGroupInfoImp* NewLC(); + IMPORT_C static CPresentityGroupInfoImp* NewL(); + virtual ~CPresentityGroupInfoImp(); + +private: + + CPresentityGroupInfoImp(); + void ConstructL(); + void ConstructL( const MXIMPIdentity& aIdentity, + const TDesC16& aDisplayName ); + + /** + * @see CXIMPApiDataObjBase + */ + XIMPIMP_DECLARE_DATAOBJ_BASE_PRIV_METHODS + +public: // From MXIMPBase + + /** + * Implementation of MXIMPBase interface methods + * @see MXIMPBase + */ + XIMPIMP_DECLARE_IF_BASE_METHODS + + /** + * @see CXIMPApiDataObjBase + */ + XIMPIMP_DECLARE_DATAOBJ_BASE_METHODS + + +public: // From MPresentityGroupInfo + + const MXIMPIdentity& GroupId() const; + const TDesC16& GroupDisplayName() const; + void SetGroupIdL( MXIMPIdentity* aIdentity ); + void SetGroupDisplayNameL( const TDesC16& aDisplayName ); + + +public: // New functions + + /** + * Internalizes object data from given stream. + * @param aStream Stream to read. + */ + IMPORT_C void InternalizeL( RReadStream& aStream ); + + + /** + * TLinearOrder for ordering based on stored group id, + * when this class is used within an RPointerArray or derivatives. + */ + IMPORT_C static TInt GroupIdLinearOrder( + const CPresentityGroupInfoImp& aA, + const CPresentityGroupInfoImp& aB ); + + /** + * Access to identity object + * @return Identity + */ + IMPORT_C const CXIMPIdentityImp& Identity() const; + +private: // data + + /** + * Identity + */ + CXIMPIdentityImp* iIdentity; + + /** + * Displayname + */ + RBuf16 iDisplayName; + + }; + + +#endif // CPRESENTITYGROUPINFOIMP_H diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencedatamodel/presentitygroups/presentitygrouplisteventimp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencedatamodel/presentitygroups/presentitygrouplisteventimp.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,426 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MOwnPresenceEvent API object implementation. + * +*/ + +#include "presentitygrouplisteventimp.h" +#include "presentitygroupinfoimp.h" +#include "ximpobjecthelpers.h" +#include "ximpdatasubscriptionstateimp.h" +#include "ximpidentityimp.h" +#include + + +// --------------------------------------------------------------------------- +// CPresentityGroupListEventImp::NewLC() +// --------------------------------------------------------------------------- +// +EXPORT_C CPresentityGroupListEventImp* CPresentityGroupListEventImp::NewLC( + RPrGrpInfoImpArray* aCreated, + RPrGrpInfoImpArray* aUpdated, + RPrGrpInfoImpArray* aDeleted, + CXIMPDataSubscriptionStateImp* aState ) + { + CPresentityGroupListEventImp* self = new( ELeave ) CPresentityGroupListEventImp(); + CleanupStack::PushL( self ); + self->ConstructL( aCreated, aUpdated, aDeleted, aState ); + return self; + } + +// --------------------------------------------------------------------------- +// CPresentityGroupListEventImp::NewLC() +// --------------------------------------------------------------------------- +// +EXPORT_C CPresentityGroupListEventImp* CPresentityGroupListEventImp::NewLC( + RPrGrpInfoImpArray* aCreated, + RPrGrpInfoImpArray* aUpdated, + RPrGrpInfoImpArray* aDeleted, + RPrGrpInfoImpArray* aCurrent, + CXIMPDataSubscriptionStateImp* aState + ) + { + CPresentityGroupListEventImp* self = new( ELeave ) CPresentityGroupListEventImp(); + CleanupStack::PushL( self ); + if( aCurrent ) + { + self->ConstructL( aCreated, aUpdated, aDeleted, aCurrent, aState ); + } + else + { + self->ConstructL( aCreated, aUpdated, aDeleted, aState ); + } + return self; + } + +// --------------------------------------------------------------------------- +// CPresentityGroupListEventImp::NewLC() +// --------------------------------------------------------------------------- +// +EXPORT_C CPresentityGroupListEventImp* CPresentityGroupListEventImp::NewL( + RPrGrpInfoImpArray* aCreated, + RPrGrpInfoImpArray* aUpdated, + RPrGrpInfoImpArray* aDeleted, + RPrGrpInfoImpArray* aCurrent, + CXIMPDataSubscriptionStateImp* aState + ) + { + CPresentityGroupListEventImp* self = NewLC( aCreated, aUpdated, aDeleted, aCurrent, aState ); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// CPresentityGroupListEventImp::NewFromStreamLC() +// --------------------------------------------------------------------------- +// +CXIMPApiEventBase* CPresentityGroupListEventImp::NewFromStreamLC( RReadStream& aStream ) + { + CPresentityGroupListEventImp* self = new( ELeave ) CPresentityGroupListEventImp; + CleanupStack::PushL( self ); + self->ConstructL( aStream ); + return self; + } + +// --------------------------------------------------------------------------- +// CPresentityGroupListEventImp::~CPresentityGroupListEventImp() +// --------------------------------------------------------------------------- +// +CPresentityGroupListEventImp::~CPresentityGroupListEventImp() + { + if( iConstructedFromStream ) + { + delete iCreatedGroups; + delete iUpdatedGroups; + delete iDeletedGroups; + delete iCurrentGroups; + iCurrentGroups = NULL; + } + + if ( iOwnsCurrentGroupsArray ) + { + delete iCurrentGroups; + } + + delete iSubscriptionState; + } + + +// --------------------------------------------------------------------------- +// CPresentityGroupListEventImp::CPresentityGroupListEventImp() +// --------------------------------------------------------------------------- +// +CPresentityGroupListEventImp::CPresentityGroupListEventImp() + { + } + + +// --------------------------------------------------------------------------- +// CPresentityGroupListEventImp::ConstructL() +// --------------------------------------------------------------------------- +// +void CPresentityGroupListEventImp::ConstructL( + RPrGrpInfoImpArray* aCreated, + RPrGrpInfoImpArray* aUpdated, + RPrGrpInfoImpArray* aDeleted, + CXIMPDataSubscriptionStateImp* aState ) + { + iCreatedGroups = aCreated; + iUpdatedGroups = aUpdated; + iDeletedGroups = aDeleted; + + iCurrentGroups = new ( ELeave ) RPrGrpInfoImpArray; + iOwnsCurrentGroupsArray = ETrue; + iSubscriptionState = aState; + } + +// --------------------------------------------------------------------------- +// CPresentityGroupListEventImp::ConstructL() +// --------------------------------------------------------------------------- +// +void CPresentityGroupListEventImp::ConstructL( + RPrGrpInfoImpArray* aCreated, + RPrGrpInfoImpArray* aUpdated, + RPrGrpInfoImpArray* aDeleted, + RPrGrpInfoImpArray* aCurrent, + CXIMPDataSubscriptionStateImp* aState + ) + { + iCreatedGroups = aCreated; + iUpdatedGroups = aUpdated; + iDeletedGroups = aDeleted; + iCurrentGroups = aCurrent; + iSubscriptionState = aState; + } + +// --------------------------------------------------------------------------- +// CPresentityGroupListEventImp::ConstructL() +// --------------------------------------------------------------------------- +// +void CPresentityGroupListEventImp::ConstructL( RReadStream& aStream ) + { + iConstructedFromStream = ETrue; + + iCreatedGroups = new ( ELeave ) RPrGrpInfoImpArray; + iUpdatedGroups = new ( ELeave ) RPrGrpInfoImpArray; + iDeletedGroups = new ( ELeave ) RPrGrpInfoImpArray; + iCurrentGroups = new ( ELeave ) RPrGrpInfoImpArray; + + FillArrayFromStreamL( *iCreatedGroups, aStream ); + FillArrayFromStreamL( *iUpdatedGroups, aStream ); + FillArrayFromStreamL( *iDeletedGroups, aStream ); + FillArrayFromStreamL( *iCurrentGroups, aStream ); + + iSubscriptionState = CXIMPDataSubscriptionStateImp::NewL(); + iSubscriptionState->InternalizeL( aStream ); + } + +// --------------------------------------------------------------------------- +// Implement supported interface access. +// --------------------------------------------------------------------------- +// +XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CPresentityGroupListEventImp, + MPresentityGroupListEvent ) + XIMPIMP_IF_BASE_GET_CLASS( CXIMPApiEventBase, this ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + +XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CPresentityGroupListEventImp, + MPresentityGroupListEvent ) + XIMPIMP_IF_BASE_GET_CONST_CLASS( CXIMPApiEventBase, this ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + + +// --------------------------------------------------------------------------- +// Implement methods from base event interface and base event class +// --------------------------------------------------------------------------- +// +XIMPIMP_IMPLEMENT_EVENT_BASE_METHODS( CPresentityGroupListEventImp, + MPresentityGroupListEvent ) + + +// --------------------------------------------------------------------------- +// CPresentityGroupListEventImp::EqualsContent() +// --------------------------------------------------------------------------- +// +TBool CPresentityGroupListEventImp::EqualsContent( + const CXIMPApiEventBase& aOtherInstance ) const + { + const CPresentityGroupListEventImp* tmp = + TXIMPGetImpClassOrPanic< const CPresentityGroupListEventImp >::From( + aOtherInstance.Base() ); + + TBool same = ETrue; + + TBool x; + x = CompareArrays( iCreatedGroups, tmp->iCreatedGroups ); + same &= x; + + x = CompareArrays( iUpdatedGroups, tmp->iUpdatedGroups ); + same &= x; + + x = CompareArrays( iDeletedGroups, tmp->iDeletedGroups ); + same &= x; + + x = CompareArrays( iCurrentGroups, tmp->iCurrentGroups ); + same &= x; + + x = iSubscriptionState->EqualsContent( *tmp->iSubscriptionState ); + same &= x; + + return same; + } + +// --------------------------------------------------------------------------- +// CPresentityGroupListEventImp::CompareArrays +// --------------------------------------------------------------------------- +// +TBool CPresentityGroupListEventImp::CompareArrays( + RPrGrpInfoImpArray* aA, RPrGrpInfoImpArray* aB ) + { + TBool same = ETrue; + + TBool x; + x = aA->Count() == aB->Count(); // counts must match + same &= x; + + if ( ! same ) + { + // don't bother checking further if counts mismatch + return same; + } + + // now check whole array, arrays have equal length + for ( TInt i = 0; i < aA->Count(); i++ ) + { + x = 0 == ( (*aA)[ i ]->GroupId().Identity().Compare( + (*aB)[ i ]->GroupId().Identity() ) ); + same &= x; + + x = 0 == ( (*aA)[ i ]->GroupDisplayName().Compare( + (*aB)[ i ]->GroupDisplayName() ) ); + same &= x; + } + + return same; + } + +// --------------------------------------------------------------------------- +// From class CXIMPApiEventBase. +// CPresentityGroupListEventImp::ExternalizeL() +// --------------------------------------------------------------------------- +// +void CPresentityGroupListEventImp::ExternalizeL( RWriteStream& aStream ) const + { + WriteArrayToStreamL( *iCreatedGroups, aStream ); + WriteArrayToStreamL( *iUpdatedGroups, aStream ); + WriteArrayToStreamL( *iDeletedGroups, aStream ); + WriteArrayToStreamL( *iCurrentGroups, aStream ); + + iSubscriptionState->ExternalizeL( aStream ); + } + + +// --------------------------------------------------------------------------- +// From class MPresentityGroupListEvent. +// CPresentityGroupListEventImp::NewGroupsCount() +// --------------------------------------------------------------------------- +// +TInt CPresentityGroupListEventImp::NewGroupsCount() const + { + return iCreatedGroups->Count(); + } + +// --------------------------------------------------------------------------- +// From class MPresentityGroupListEvent. +// CPresentityGroupListEventImp::NewGroup() +// --------------------------------------------------------------------------- +// +const MPresentityGroupInfo& + CPresentityGroupListEventImp::NewGroup( TInt aIndex ) const + { + return *(*iCreatedGroups)[ aIndex ]; + } + +// --------------------------------------------------------------------------- +// From class MPresentityGroupListEvent. +// CPresentityGroupListEventImp::UpdatedGroupsCount() +// --------------------------------------------------------------------------- +// +TInt CPresentityGroupListEventImp::UpdatedGroupsCount() const + { + return iUpdatedGroups->Count(); + } + +// --------------------------------------------------------------------------- +// From class MPresentityGroupListEvent. +// CPresentityGroupListEventImp::UpdatedGroup() +// --------------------------------------------------------------------------- +// +const MPresentityGroupInfo& + CPresentityGroupListEventImp::UpdatedGroup( TInt aIndex ) const + { + return *(*iUpdatedGroups)[ aIndex ]; + } + +// --------------------------------------------------------------------------- +// From class MPresentityGroupListEvent. +// CPresentityGroupListEventImp::DisappearedGroupsCount() +// --------------------------------------------------------------------------- +// +TInt CPresentityGroupListEventImp::DisappearedGroupsCount() const + { + return iDeletedGroups->Count(); + } + +// --------------------------------------------------------------------------- +// From class MPresentityGroupListEvent. +// CPresentityGroupListEventImp::DisappearedGroup() +// --------------------------------------------------------------------------- +// +const MPresentityGroupInfo& +CPresentityGroupListEventImp::DisappearedGroup( TInt aIndex ) const + { + return *(*iDeletedGroups)[ aIndex ]; + } + +// --------------------------------------------------------------------------- +// From class MPresentityGroupListEvent. +// CPresentityGroupListEventImp::CurrentGroupsCount() +// --------------------------------------------------------------------------- +// +TInt CPresentityGroupListEventImp::CurrentGroupsCount() const + { + return iCurrentGroups->Count(); + } + +// --------------------------------------------------------------------------- +// From class MPresentityGroupListEvent. +// CPresentityGroupListEventImp::CurrentGroup() +// --------------------------------------------------------------------------- +// +const MPresentityGroupInfo& + CPresentityGroupListEventImp::CurrentGroup( TInt aIndex ) const + { + return *(*iCurrentGroups)[ aIndex ]; + } + +// --------------------------------------------------------------------------- +// From class MPresentityGroupListEvent. +// CPresentityGroupListEventImp::Status() +// --------------------------------------------------------------------------- +// +const MXIMPDataSubscriptionState& + CPresentityGroupListEventImp::DataSubscriptionState() const + { + return *iSubscriptionState; + } + +// --------------------------------------------------------------------------- +// CPresentityGroupListEventImp::WriteArrayToStreamL() +// --------------------------------------------------------------------------- +// +void CPresentityGroupListEventImp::WriteArrayToStreamL( + RPrGrpInfoImpArray& aArray, RWriteStream& aStream ) const + { + TInt count = aArray.Count(); + aStream.WriteInt32L( count ); + { + for( TInt a = 0; a < count; ++a ) + { + aArray[ a ]->ExternalizeL( aStream ); + } + } + } + +// --------------------------------------------------------------------------- +// CPresentityGroupListEventImp::FillArrayFromStreamL +// --------------------------------------------------------------------------- +// +void CPresentityGroupListEventImp::FillArrayFromStreamL( + RPrGrpInfoImpArray& aArray, + RReadStream& aStream ) + { + TInt count = aStream.ReadInt32L(); + for( TInt a = 0; a < count; ++a ) + { + // the stream MUST be in order (since it was externalized by this class) + CPresentityGroupInfoImp* newInfo = CPresentityGroupInfoImp::NewLC(); + newInfo->InternalizeL( aStream ); + aArray.AppendL( newInfo ); + CleanupStack::Pop(); // newInfo + } + } + +// End of file + diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencedatamodel/presentitygroups/presentitygrouplisteventimp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencedatamodel/presentitygroups/presentitygrouplisteventimp.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,192 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MPresentityGroupList API object implementation. + * +*/ + +#ifndef CPRESENTITYGROUPLISTEVENTIMP_H +#define CPRESENTITYGROUPLISTEVENTIMP_H + +#include "ximpapieventbase.h" +#include "presencetypehelpers.h" +#include "ximpdatasubscriptionstateimp.h" +#include + +class RReadStream; +class CPresentityGroupInfoImp; +class CXIMPDataSubscriptionStateImp; + +/** + * MOwnPresenceEvent API object implementation. + * + * @lib ximpdatamodel.dll + * @since S60 v3.2 + */ +NONSHARABLE_CLASS( CPresentityGroupListEventImp ): public CXIMPApiEventBase, + public MPresentityGroupListEvent + { +public: + /** The class ID. */ + enum { KClassId = PRIMP_CLSID_CPRESENTITYGROUPLISTEVENTIMP }; + +public: + /** + * Exported instantiation method for initializing + * new event object. + */ + IMPORT_C static CPresentityGroupListEventImp* NewLC( + RPrGrpInfoImpArray* aCreated, + RPrGrpInfoImpArray* aUpdated, + RPrGrpInfoImpArray* aDeleted, + CXIMPDataSubscriptionStateImp* aState + ); + + /** + * Exported instantiation method for initializing + * new event object. + */ + IMPORT_C static CPresentityGroupListEventImp* NewLC( + RPrGrpInfoImpArray* aCreated, + RPrGrpInfoImpArray* aUpdated, + RPrGrpInfoImpArray* aDeleted, + RPrGrpInfoImpArray* aCurrent, + CXIMPDataSubscriptionStateImp* aState + ); + IMPORT_C static CPresentityGroupListEventImp* NewL( + RPrGrpInfoImpArray* aCreated, + RPrGrpInfoImpArray* aUpdated, + RPrGrpInfoImpArray* aDeleted, + RPrGrpInfoImpArray* aCurrent, + CXIMPDataSubscriptionStateImp* aState + ); + + /** + * Instantiation method for event automation. + * Method signature must be exactly this to work + * with event delivery automation system. + * + * Event implementation must be registered to + * XIMPEventCodec KXIMPEventConstructorTable. + */ + static CXIMPApiEventBase* NewFromStreamLC( RReadStream& aStream ); + + virtual ~CPresentityGroupListEventImp(); + + +private: + CPresentityGroupListEventImp(); + + void ConstructL( + RPrGrpInfoImpArray* aCreated, + RPrGrpInfoImpArray* aUpdated, + RPrGrpInfoImpArray* aDeleted, + CXIMPDataSubscriptionStateImp* aState + ); + + void ConstructL( + RPrGrpInfoImpArray* aCreated, + RPrGrpInfoImpArray* aUpdated, + RPrGrpInfoImpArray* aDeleted, + RPrGrpInfoImpArray* aCurrent, + CXIMPDataSubscriptionStateImp* aState + ); + + void ConstructL( RReadStream& aStream ); + + /** + * Helper for externalize. + */ + void WriteArrayToStreamL( RPrGrpInfoImpArray& aArray, + RWriteStream& aStream ) const; + + /** + * Helper for internalize + */ + void FillArrayFromStreamL( RPrGrpInfoImpArray& aArray, + RReadStream& aStream ); + +public: // From API base interfaces + + /** + * Implementation of MXIMPBase interface methods + * @see MXIMPBase + */ + XIMPIMP_DECLARE_IF_BASE_METHODS + + + /** + * Implementation of MXIMPEventBase interface and + * CXIMPApiEventBase methods + * + * @see MXIMPEventBase + * @see CXIMPApiEventBase + */ + XIMPIMP_DECLARE_EVENT_BASE_METHODS + + +public: // From MPresentityGroupList + + TInt NewGroupsCount() const; + const MPresentityGroupInfo& NewGroup( TInt aIndex ) const; + + TInt UpdatedGroupsCount() const; + const MPresentityGroupInfo& UpdatedGroup( TInt aIndex ) const; + + TInt DisappearedGroupsCount() const; + const MPresentityGroupInfo& DisappearedGroup( TInt aIndex ) const; + + TInt CurrentGroupsCount() const; + const MPresentityGroupInfo& CurrentGroup( TInt aIndex ) const; + + const MXIMPDataSubscriptionState& DataSubscriptionState() const; + +private: + + /** + * Compare the given arrays for equality. + * Arrays must be sorted. This is a method specific + * to the group info imp array. + * @return ETrue if the arrays match, EFalse otherwise. + */ + static TBool CompareArrays( RPrGrpInfoImpArray* aA, RPrGrpInfoImpArray* aB ); + +private: // data + + /** + * ETrue if constructed from stream. + */ + TBool iConstructedFromStream; + + /** + * ETrue if current groups array is owned. + */ + TBool iOwnsCurrentGroupsArray; + + /** + * Group informations. + * Owns if constructed from stream. Otherwise does not own. + */ + RPrGrpInfoImpArray* iCreatedGroups; + RPrGrpInfoImpArray* iUpdatedGroups; + RPrGrpInfoImpArray* iDeletedGroups; + RPrGrpInfoImpArray* iCurrentGroups; + + /** + * + */ + CXIMPDataSubscriptionStateImp* iSubscriptionState; + }; + + +#endif // CPRESENTITYGROUPLISTEVENTIMP_H diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencedatamodel/presentitygroups/presentitygroupmemberinfoimp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencedatamodel/presentitygroups/presentitygroupmemberinfoimp.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,241 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MPresentityGroupMemberInfo API object implementation. +* +*/ + + +#include "presentitygroupmemberinfoimp.h" +#include "ximpidentityimp.h" +#include "ximprbufhelpers.h" +#include "ximpobjecthelpers.h" + +// ============================ MEMBER FUNCTIONS ============================= + +// --------------------------------------------------------------------------- +// CPresentityGroupMemberInfoImp::NewLC() +// --------------------------------------------------------------------------- +// +EXPORT_C CPresentityGroupMemberInfoImp* CPresentityGroupMemberInfoImp::NewLC( + const MXIMPIdentity& aIdentity, + const TDesC16& aDisplayName ) + { + CPresentityGroupMemberInfoImp* self = new( ELeave ) CPresentityGroupMemberInfoImp; + CleanupStack::PushL( self ); + self->ConstructL( aIdentity, aDisplayName ); + return self; + } + +// --------------------------------------------------------------------------- +// CPresentityGroupMemberInfoImp::NewLC() +// --------------------------------------------------------------------------- +// +EXPORT_C CPresentityGroupMemberInfoImp* CPresentityGroupMemberInfoImp::NewLC() + { + CPresentityGroupMemberInfoImp* self = new( ELeave ) CPresentityGroupMemberInfoImp; + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + + +// --------------------------------------------------------------------------- +// CPresentityGroupMemberInfoImp::NewL() +// --------------------------------------------------------------------------- +// +EXPORT_C CPresentityGroupMemberInfoImp* CPresentityGroupMemberInfoImp::NewL() + { + CPresentityGroupMemberInfoImp* self = NewLC(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// CPresentityGroupMemberInfoImp::NewFromStreamLC() +// --------------------------------------------------------------------------- +// +XIMPIMP_IMPLEMENT_DATAOBJ_NEWFROMSTREAM( CPresentityGroupMemberInfoImp ) + +// --------------------------------------------------------------------------- +// Implement supported interface access. +// --------------------------------------------------------------------------- +// +XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CPresentityGroupMemberInfoImp, MPresentityGroupMemberInfo ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() +XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CPresentityGroupMemberInfoImp, MPresentityGroupMemberInfo ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + +// --------------------------------------------------------------------------- +// CPresentityGroupMemberInfoImp::~CPresentityGroupMemberInfoImp() +// --------------------------------------------------------------------------- +// +CPresentityGroupMemberInfoImp::~CPresentityGroupMemberInfoImp() + { + iDisplayName.Close(); + delete iIdentity; + } + +// --------------------------------------------------------------------------- +// CPresentityGroupMemberInfoImp::CPresentityGroupMemberInfoImp() +// --------------------------------------------------------------------------- +// +CPresentityGroupMemberInfoImp::CPresentityGroupMemberInfoImp() + { + } + + +// --------------------------------------------------------------------------- +// CPresentityGroupMemberInfoImp::ConstructL() +// --------------------------------------------------------------------------- +// +void CPresentityGroupMemberInfoImp::ConstructL() + { + iDisplayName.CreateL( 0 ); + iIdentity = CXIMPIdentityImp::NewLC(); + CleanupStack::Pop( iIdentity ); + } + +// --------------------------------------------------------------------------- +// CPresentityGroupMemberInfoImp::ConstructL() +// --------------------------------------------------------------------------- +// +void CPresentityGroupMemberInfoImp::ConstructL( const MXIMPIdentity& aIdentity, + const TDesC16& aDisplayName ) + { + CXIMPIdentityImp* identity = CXIMPIdentityImp::NewLC(); + identity->SetIdentityL( aIdentity.Identity() ); + iDisplayName.CreateL( aDisplayName ); + iIdentity = identity; + CleanupStack::Pop(); // identity + } + +// --------------------------------------------------------------------------- +// CPresentityGroupMemberInfoImp::ExternalizeL() +// --------------------------------------------------------------------------- +// +void CPresentityGroupMemberInfoImp::ExternalizeL( RWriteStream& aStream ) const + { + iIdentity->ExternalizeL( aStream ); + XIMPRBuf16Helper::ExternalizeL( iDisplayName, aStream ); + } + +// --------------------------------------------------------------------------- +// CPresentityGroupMemberInfoImp::InternalizeL() +// --------------------------------------------------------------------------- +// +EXPORT_C void CPresentityGroupMemberInfoImp::InternalizeL( RReadStream& aStream ) + { + iIdentity->InternalizeL( aStream ); + XIMPRBuf16Helper::InternalizeL( iDisplayName, aStream ); + } + +// --------------------------------------------------------------------------- +// From MPresentityGroupMemberInfo class. +// CPresentityGroupMemberInfoImp::GroupMemberId() +// --------------------------------------------------------------------------- +// +const MXIMPIdentity& CPresentityGroupMemberInfoImp::GroupMemberId() const + { + return *iIdentity; + } + + +// --------------------------------------------------------------------------- +// From MPresentityGroupMemberInfo class. +// CPresentityGroupMemberInfoImp::GroupMemberDisplayName() +// --------------------------------------------------------------------------- +// +const TDesC16& CPresentityGroupMemberInfoImp::GroupMemberDisplayName() const + { + return iDisplayName; + } + + +// --------------------------------------------------------------------------- +// From MPresentityGroupMemberInfo class. +// CPresentityGroupMemberInfoImp::SetGroupMemberIdL() +// --------------------------------------------------------------------------- +// +void CPresentityGroupMemberInfoImp::SetGroupMemberIdL( + MXIMPIdentity* aIdentity ) + { + CXIMPIdentityImp* identityImp = + TXIMPGetImpClassOrPanic< CXIMPIdentityImp>::From( *aIdentity ); + + delete iIdentity; + iIdentity = identityImp; + } + + + +// --------------------------------------------------------------------------- +// From MPresentityGroupMemberInfo class. +// CPresentityGroupMemberInfoImp::SetGroupMemberDisplayNameL() +// --------------------------------------------------------------------------- +// +void CPresentityGroupMemberInfoImp::SetGroupMemberDisplayNameL( + const TDesC16& aDisplayName ) + { + HBufC16* displayNameBuf = aDisplayName.AllocL(); + iDisplayName.Close(); + iDisplayName.Assign( displayNameBuf ); + } + + + +// --------------------------------------------------------------------------- +// CPresentityGroupMemberInfoImp::GroupIdLinearOrder +// --------------------------------------------------------------------------- +// +EXPORT_C TInt CPresentityGroupMemberInfoImp::GroupIdLinearOrder( + const CPresentityGroupMemberInfoImp& aA, + const CPresentityGroupMemberInfoImp& aB ) + { + // identity is used as primary key + return aA.iIdentity->Compare( *aB.iIdentity ); + } + +// --------------------------------------------------------------------------- +// CPresentityGroupMemberInfoImp::Identity() +// --------------------------------------------------------------------------- +// +EXPORT_C const CXIMPIdentityImp& CPresentityGroupMemberInfoImp::IdentityImp() const + { + return *iIdentity; + } + +// --------------------------------------------------------------------------- +// CPresentityGroupMemberInfoImp::EqualsContent() +// --------------------------------------------------------------------------- +// +TBool CPresentityGroupMemberInfoImp::EqualsContent( + const CXIMPApiDataObjBase& aOtherInstance ) const + { + const CPresentityGroupMemberInfoImp* tmp = + TXIMPGetImpClassOrPanic< const CPresentityGroupMemberInfoImp >::From( + aOtherInstance.Base() ); + + TBool same = ETrue; + + TBool x; + x = iIdentity->EqualsContent( *(tmp->iIdentity) ); + same &= x; + + x = 0 == iDisplayName.Compare( tmp->iDisplayName ); + same &= x; + + return same; + } + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencedatamodel/presentitygroups/presentitygroupmemberinfoimp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencedatamodel/presentitygroups/presentitygroupmemberinfoimp.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,132 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MPresentityGroupMemberInfo API object implementation. +* +*/ + +#ifndef CPRESENTITYGROUPMEMBERINFOIMP_H +#define CPRESENTITYGROUPMEMBERINFOIMP_H + +#include +#include + +#include "ximpapidataobjbase.h" +#include "presenceapiobjbase.h" +#include + +class CXIMPIdentityImp; + +/** + * MPresenceInfo API object implementation. + * + * @lib ximpdatamodel.dll + * @since S60 v3.2 + */ +NONSHARABLE_CLASS( CPresentityGroupMemberInfoImp ): public CXIMPApiDataObjBase, + public MPresentityGroupMemberInfo + { + public: + /** The class ID. */ + enum { KClassId = PRIMP_CLSID_CPRESENTITYGROUPMEMBERINFOIMP }; + +public: + + IMPORT_C static CPresentityGroupMemberInfoImp* NewLC( + const MXIMPIdentity& aIdentity, + const TDesC16& aDisplayName ); + IMPORT_C static CPresentityGroupMemberInfoImp* NewLC(); + IMPORT_C static CPresentityGroupMemberInfoImp* NewL(); + virtual ~CPresentityGroupMemberInfoImp(); + +private: + + CPresentityGroupMemberInfoImp(); + void ConstructL(); + void ConstructL( const MXIMPIdentity& aIdentity, + const TDesC16& aDisplayName ); + + /** + * @see CXIMPApiDataObjBase + */ + XIMPIMP_DECLARE_DATAOBJ_BASE_PRIV_METHODS + +public: // From MXIMPBase + + /** + * Implementation of MXIMPBase interface methods + * @see MXIMPBase + */ + XIMPIMP_DECLARE_IF_BASE_METHODS + + /** + * @see CXIMPApiDataObjBase + */ + XIMPIMP_DECLARE_DATAOBJ_BASE_METHODS + +public: // From MPresentityGroupMemberInfo + + const MXIMPIdentity& GroupMemberId() const; + const TDesC16& GroupMemberDisplayName() const; + void SetGroupMemberIdL( MXIMPIdentity* aIdentity ); + void SetGroupMemberDisplayNameL( const TDesC16& aDisplayName ); + + +public: // New functions + + /** + * Extenalizes object data to given stream. + * @param aStream Stream to write. + */ + //IMPORT_C void ExternalizeL( RWriteStream& aStream ) const; + + + /** + * Internalizes object data from given stream. + * @param aStream Stream to read. + */ + IMPORT_C void InternalizeL( RReadStream& aStream ); + + + /** + * TLinearOrder for ordering based on stored group id, + * when this class is used within an RPointerArray or derivatives. + */ + IMPORT_C static TInt GroupIdLinearOrder( + const CPresentityGroupMemberInfoImp& aA, + const CPresentityGroupMemberInfoImp& aB ); + + /** + * Access to identity object + * @return Identity + */ + IMPORT_C const CXIMPIdentityImp& IdentityImp() const; + +private: // data + + /** + * Identity + * Own. + */ + CXIMPIdentityImp* iIdentity; + + /** + * Displayname + * Own. + */ + RBuf16 iDisplayName; + + }; + + +#endif // CPRESENTITYGROUPMEMBERINFOIMP_H diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencefrontend/srcecomhook/presenceecomhook.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencefrontend/srcecomhook/presenceecomhook.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,46 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework's Presence Manager Ecom Hook implementation. +* +*/ + + +#include "ximpdlluids.hrh" +#include "presencefeaturesimp.h" +#include +#include + + +// --------------------------------------------------------------------------- +// Key value pair table to identify correct constructor +// function for the requested interface. +// --------------------------------------------------------------------------- +// +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY( XIMP_ECOM_IMPLEMENTATION_UID_PRESENCE_INTERFACE, + CPresenceFeaturesImp::NewL ) + }; + + +// --------------------------------------------------------------------------- +// Exported function to return the implementation proxy table +// --------------------------------------------------------------------------- +// +EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount ) + { + aTableCount = sizeof( ImplementationTable ) / sizeof( TImplementationProxy ); + return ImplementationTable; + } + diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencefrontend/srcecomhook/presenceecomhook.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencefrontend/srcecomhook/presenceecomhook.rss Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,51 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ECom registery info for ECom hook +* +*/ + + +#include +#include +#include "ximpdlluids.hrh" + +// --------------------------------------------------------------------------- +// ECom registery info for XIMP Presence Manager ECom hook +// --------------------------------------------------------------------------- +// +RESOURCE REGISTRY_INFO theInfo + { + resource_format_version = RESOURCE_FORMAT_VERSION_2; + dll_uid = XIMP_DLL_UID_PRESENCE_HOOK; + + interfaces = + { + INTERFACE_INFO + { + interface_uid = XIMP_ECOM_IF_UID_PRESENCE_INTERFACE; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = XIMP_ECOM_IMPLEMENTATION_UID_PRESENCE_INTERFACE; + version_no = 1; + display_name = "S60 Default XIMP"; + default_data = XIMP_ECOM_DEFAULT_DATA_PRESENCE_INTERFACE; + opaque_data = ""; + } + }; + } + }; + } + diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencefrontend/srcpresencemanager/presenceauthorizationimp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencefrontend/srcpresencemanager/presenceauthorizationimp.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,333 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of MPresenceAuthorization + * +*/ + +#include "presenceauthorizationimp.h" +#include "presenceinfofilterimp.h" +#include "ximpobjecthelpers.h" +#include "presenceoperationdefs.h" +#include "ximpidentityimp.h" +#include "ximpcontextinternal.h" + + +// ============================ MEMBER FUNCTIONS ============================= + +// --------------------------------------------------------------------------- +// CPresenceAuthorizationImp::NewL() +// --------------------------------------------------------------------------- +// +CPresenceAuthorizationImp* CPresenceAuthorizationImp::NewL( + MXIMPContextInternal& aContext ) + { + CPresenceAuthorizationImp* self = + new( ELeave ) CPresenceAuthorizationImp( aContext ); + + return self; + } + + +// --------------------------------------------------------------------------- +// Implement supported interface access. +// --------------------------------------------------------------------------- +// +XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CPresenceAuthorizationImp, + MPresenceAuthorization ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + + +XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CPresenceAuthorizationImp, + MPresenceAuthorization ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + +// --------------------------------------------------------------------------- +// CPresenceAuthorizationImp::~CPresenceAuthorizationImp() +// --------------------------------------------------------------------------- +// +CPresenceAuthorizationImp::~CPresenceAuthorizationImp() + { + //iContext not own + } + + +// --------------------------------------------------------------------------- +// CPresenceAuthorizationImp::CPresenceAuthorizationImp() +// --------------------------------------------------------------------------- +// +CPresenceAuthorizationImp::CPresenceAuthorizationImp( + MXIMPContextInternal& aContext ) + : iContext( aContext ) + { + } + + +// --------------------------------------------------------------------------- +// CPresenceAuthorizationImp::SubscribePresenceGrantRequestListL() +// --------------------------------------------------------------------------- +// +TXIMPRequestId CPresenceAuthorizationImp::SubscribePresenceGrantRequestListL() + { + return iContext.QueueOperationL( + NPresenceOps::EPrSubscribePresenceGrantRequestList, + KNullDesC8 ); + } + +// --------------------------------------------------------------------------- +// CPresenceAuthorizationImp::UnsubscribePresenceGrantRequestListL() +// --------------------------------------------------------------------------- +// +TXIMPRequestId CPresenceAuthorizationImp::UnsubscribePresenceGrantRequestListL() + { + return iContext.QueueOperationL( + NPresenceOps::EPrUnsubscribePresenceGrantRequestList, + KNullDesC8 ); + } + + +// --------------------------------------------------------------------------- +// CPresenceAuthorizationImp::GrantPresenceForPresentityL() +// --------------------------------------------------------------------------- +// +TXIMPRequestId CPresenceAuthorizationImp::GrantPresenceForPresentityL( + const MXIMPIdentity& aPresentityId, + const MPresenceInfoFilter& aPif ) + { + return QueueOperationL( NPresenceOps::EPrGrantPresenceToPresentity, + aPif, aPresentityId ); + } + + +// --------------------------------------------------------------------------- +// CPresenceAuthorizationImp::WithdrawPresenceGrantFromPresentityL() +// --------------------------------------------------------------------------- +// +TXIMPRequestId CPresenceAuthorizationImp::WithdrawPresenceGrantFromPresentityL( + const MXIMPIdentity& aPresentityId ) + { + HBufC8* idPack = PackPresentityLC( aPresentityId ); + + TXIMPRequestId reqId = + iContext.QueueOperationL( + NPresenceOps::EPrWithdrawPresenceFromPresentity, + *idPack ); + CleanupStack::PopAndDestroy( idPack ); + return reqId; + } + + +// --------------------------------------------------------------------------- +// CPresenceAuthorizationImp::GrantPresenceForPresentityGroupMembersL() +// --------------------------------------------------------------------------- +// +TXIMPRequestId CPresenceAuthorizationImp::GrantPresenceForPresentityGroupMembersL( + const MXIMPIdentity& aGroupId, + const MPresenceInfoFilter& aPif ) + { + return QueueOperationL( NPresenceOps::EPrGrantPresenceToPresentityGroupMembers, + aPif, aGroupId ); + } + + +// --------------------------------------------------------------------------- +// CPresenceAuthorizationImp::WithdrawPresenceGrantFromPresentityGroupMembersL() +// --------------------------------------------------------------------------- +// +TXIMPRequestId + CPresenceAuthorizationImp::WithdrawPresenceGrantFromPresentityGroupMembersL( + const MXIMPIdentity& aGroupId ) + { + HBufC8* idPack = PackPresentityLC( aGroupId ); + + + TXIMPRequestId reqId = + iContext.QueueOperationL( + NPresenceOps::EPrWithdrawPresenceFromPresentityGroupMembers, + *idPack ); + + CleanupStack::PopAndDestroy( idPack ); + return reqId; + } + + +// --------------------------------------------------------------------------- +// CPresenceAuthorizationImp::GrantPresenceForPresentityL() +// --------------------------------------------------------------------------- +// +TXIMPRequestId CPresenceAuthorizationImp::GrantPresenceForEveryoneL( + const MPresenceInfoFilter& aPif ) + { + HBufC8* pifPack = PackPresenceInfoFilterLC( aPif ); + + TXIMPRequestId reqId = + iContext.QueueOperationL( + NPresenceOps::EPrGrantPresenceToEveryone, + *pifPack ); + CleanupStack::PopAndDestroy( pifPack ); + return reqId; + } + +// --------------------------------------------------------------------------- +// CPresenceAuthorizationImp::WithdrawPresenceGrantFromPresentityL() +// --------------------------------------------------------------------------- +// +TXIMPRequestId CPresenceAuthorizationImp::WithdrawPresenceGrantFromEveryoneL() + { + TXIMPRequestId reqId = + iContext.QueueOperationL( + NPresenceOps::EPrWithdrawPresenceFromEveryone, + KNullDesC8 ); + return reqId; + } + + +// --------------------------------------------------------------------------- +// CPresenceAuthorizationImp::SubscribePresenceBlockListL() +// --------------------------------------------------------------------------- +// +TXIMPRequestId CPresenceAuthorizationImp::SubscribePresenceBlockListL() + { + // Queue the operation + return iContext.QueueOperationL( + NPresenceOps::EPrSubscribeBlockList, + KNullDesC8 ); + } + +// --------------------------------------------------------------------------- +// CPresenceAuthorizationImp::UnsubscribePresenceBlockListL() +// --------------------------------------------------------------------------- +// +TXIMPRequestId CPresenceAuthorizationImp::UnsubscribePresenceBlockListL() + { + // Queue the operation + return iContext.QueueOperationL( + NPresenceOps::EPrUnsubscribeBlockList, + KNullDesC8 ); + } + + +// --------------------------------------------------------------------------- +// CPresenceAuthorizationImp::BlockPresenceForPresentityL() +// --------------------------------------------------------------------------- +// +TXIMPRequestId CPresenceAuthorizationImp::BlockPresenceForPresentityL( + const MXIMPIdentity& aPresentityId ) + { + HBufC8* idPack = PackPresentityLC( aPresentityId ); + + TXIMPRequestId reqId = + iContext.QueueOperationL( + NPresenceOps::EPrBlockPresenceForPresentity, + *idPack ); + + CleanupStack::PopAndDestroy( idPack ); + return reqId; + } + + +// --------------------------------------------------------------------------- +// CPresenceAuthorizationImp::CancelPresenceBlockFromPresentityL() +// --------------------------------------------------------------------------- +// +TXIMPRequestId CPresenceAuthorizationImp::CancelPresenceBlockFromPresentityL( + const MXIMPIdentity& aPresentityId ) + { + HBufC8* idPack = PackPresentityLC( aPresentityId ); + + TXIMPRequestId reqId = + iContext.QueueOperationL( + NPresenceOps::EPrCancelPresenceBlockFromPresentity, + *idPack ); + + CleanupStack::PopAndDestroy( idPack ); + return reqId; + } + + +// --------------------------------------------------------------------------- +// CPresenceAuthorizationImp::PackPresenceDocLC() +// --------------------------------------------------------------------------- +// +HBufC8* CPresenceAuthorizationImp::PackPresenceInfoFilterLC( + const MPresenceInfoFilter& aPif ) + { + const CPresenceInfoFilterImp* pifImp = + TXIMPGetImpClassOrPanic< const CPresenceInfoFilterImp >::From( aPif ); + + HBufC8* pack = TXIMPObjectPacker< CPresenceInfoFilterImp>::PackL( *pifImp ); + CleanupStack::PushL( pack ); + + return pack; + } + +// --------------------------------------------------------------------------- +// CPresenceAuthorizationImp::QueueOperationL() +// --------------------------------------------------------------------------- +// +TXIMPRequestId CPresenceAuthorizationImp::QueueOperationL( + NPresenceOps::TPresenceOpTypes aOperation, + const MPresenceInfoFilter& aPif, + const MXIMPIdentity& aIdentity ) + { + CBufFlat* buffer = CBufFlat::NewL( 10 ); + CleanupStack::PushL( buffer ); + + RBufWriteStream ws; + CleanupClosePushL( ws ); + ws.Open( *buffer ); // CSI: 65 # Does not return a value + + // pif + const CPresenceInfoFilterImp* pifImp = + TXIMPGetImpClassOrPanic< const CPresenceInfoFilterImp >::From( aPif ); + pifImp->ExternalizeL( ws ); + + + // identity + const CXIMPIdentityImp* identityImp = + TXIMPGetImpClassOrPanic< const CXIMPIdentityImp >::From( aIdentity ); + identityImp->ExternalizeL( ws ); + + ws.CommitL(); + CleanupStack::PopAndDestroy(); //ws + + HBufC8* packedBuf = buffer->Ptr( 0 ).AllocL(); + CleanupStack::PopAndDestroy( buffer ); + CleanupStack::PushL( packedBuf ); + + // Queue the operation + TXIMPRequestId reqId = + iContext.QueueOperationL( aOperation, *packedBuf ); + CleanupStack::PopAndDestroy( packedBuf ); + + return reqId; + } + +// --------------------------------------------------------------------------- +// CPresenceAuthorizationImp::PackPresentityLC() +// --------------------------------------------------------------------------- +// +HBufC8* CPresenceAuthorizationImp::PackPresentityLC( const MXIMPIdentity& aIdentity ) + { + const CXIMPIdentityImp* identityImp = + TXIMPGetImpClassOrPanic< const CXIMPIdentityImp >::From( aIdentity ); + + HBufC8* pack = TXIMPObjectPacker< const CXIMPIdentityImp >::PackL( *identityImp ); + CleanupStack::PushL( pack ); + + return pack; + } + + +// End of file + diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencefrontend/srcpresencemanager/presenceauthorizationimp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencefrontend/srcpresencemanager/presenceauthorizationimp.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,127 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of MPresenceWatching +* +*/ + +#ifndef CPRESENCEAUTHORIZATIONIMP_H +#define CPRESENCEAUTHORIZATIONIMP_H + +#include +#include "ximpapiobjbase.h" +#include "presenceapiobjbase.h" +#include "presenceoperationdefs.h" + +class MXIMPContextInternal; + +/** + * MPresencePublishing API object implementation. + * + * @lib ximpmanager.dll + * @since S60 v3.2 + */ +NONSHARABLE_CLASS( CPresenceAuthorizationImp ): public CXIMPApiObjBase, + public MPresenceAuthorization + { + public: + /** The class ID. */ + enum { KClassId = PRIMP_CLSID_CPRESENCEAUTHORIZATIONIMP }; + + +public: + static CPresenceAuthorizationImp* NewL( MXIMPContextInternal& aContext ); + ~CPresenceAuthorizationImp(); + + +public: + CPresenceAuthorizationImp( MXIMPContextInternal& aContext ); + + +public: // From MXIMPBase + + /** + * Implementation of MXIMPBase interface methods + * @see MXIMPBase + */ + XIMPIMP_DECLARE_IF_BASE_METHODS + + +public: //From MPresenceAuthorization + + TXIMPRequestId SubscribePresenceGrantRequestListL(); + + TXIMPRequestId UnsubscribePresenceGrantRequestListL(); + + TXIMPRequestId GrantPresenceForPresentityL( + const MXIMPIdentity& aPresentityId, + const MPresenceInfoFilter& aPif ); + + TXIMPRequestId WithdrawPresenceGrantFromPresentityL( + const MXIMPIdentity& aPresentityId ); + + TXIMPRequestId GrantPresenceForPresentityGroupMembersL( + const MXIMPIdentity& aGroupId, + const MPresenceInfoFilter& aPif ); + + TXIMPRequestId WithdrawPresenceGrantFromPresentityGroupMembersL( + const MXIMPIdentity& aGroupId ); + + TXIMPRequestId GrantPresenceForEveryoneL( + const MPresenceInfoFilter& aPif ); + + TXIMPRequestId WithdrawPresenceGrantFromEveryoneL(); + + + TXIMPRequestId SubscribePresenceBlockListL(); + + TXIMPRequestId UnsubscribePresenceBlockListL(); + + TXIMPRequestId BlockPresenceForPresentityL( + const MXIMPIdentity& aPresentityId ); + + TXIMPRequestId CancelPresenceBlockFromPresentityL( + const MXIMPIdentity& aPresentityId ); + + +private: //Helpers + + /** + * Pack info filter for queue. + */ + HBufC8* PackPresenceInfoFilterLC( const MPresenceInfoFilter& aPif ); + + /** + * Pack pif and identity for operation + */ + TXIMPRequestId QueueOperationL( NPresenceOps::TPresenceOpTypes aOperation, + const MPresenceInfoFilter& aPif, + const MXIMPIdentity& aIdentity ); + + /** + * Pack presentity + */ + HBufC8* PackPresentityLC( const MXIMPIdentity& aIdentity ); + +private: // data + + /** + * Context session proxy for accessing context server. + * Ref. + */ + MXIMPContextInternal& iContext; + + }; + + +#endif // CPRESENCEAUTHORIZATIONIMP_H diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencefrontend/srcpresencemanager/presencefeaturesimp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencefrontend/srcpresencemanager/presencefeaturesimp.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,160 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of MXIMPContext + * +*/ + + +#include +#include "presencefeaturesimp.h" +#include "presenceobjectfactoryimp.h" +#include "presencepublishingimp.h" +#include "presentitygroupsimp.h" +#include "presencewatchingimp.h" +#include "presenceauthorizationimp.h" +#include "ximpcontextclientinfoimp.h" +#include "ximpidentityimp.h" +#include "ximpcontextinternal.h" + + + +// ============================ MEMBER FUNCTIONS ============================= + +// --------------------------------------------------------------------------- +// CPresenceFeaturesImp::NewL() +// --------------------------------------------------------------------------- +// +EXPORT_C CPresenceFeaturesImp* CPresenceFeaturesImp::NewL(MXIMPContext* aContext) + { + CPresenceFeaturesImp* self = new( ELeave ) CPresenceFeaturesImp() ; + CleanupStack::PushL( self ); + self->ConstructL(aContext); + CleanupStack::Pop(); + return self; + } + +// --------------------------------------------------------------------------- +// Implement supported interface access. +// --------------------------------------------------------------------------- +// + +XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CPresenceFeaturesImp, + MPresenceFeatures ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + + +XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CPresenceFeaturesImp, + MPresenceFeatures ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + +// --------------------------------------------------------------------------- +// CPresenceFeaturesImp::~CPresenceFeaturesImp() +// --------------------------------------------------------------------------- +// +CPresenceFeaturesImp::~CPresenceFeaturesImp() + { + delete iPresGroup; + delete iPresWatch; + delete iPresAuth; + delete iPresPub; + delete iPresObjFactory; + iCtxInternal = NULL; + } + + +// --------------------------------------------------------------------------- +// CPresenceFeaturesImp::CPresenceFeaturesImp( CXIMPContextClientProxy& aCtxProxy ) +// --------------------------------------------------------------------------- +// +CPresenceFeaturesImp::CPresenceFeaturesImp() + { + } + +// --------------------------------------------------------------------------- +// CPresenceFeaturesImp::SetCtxL(MXIMPContext* aContext) +// --------------------------------------------------------------------------- +// +void CPresenceFeaturesImp::SetCtxL(MXIMPContext* aContext) + { + if(!aContext) + User::Leave(KErrArgument); + iCtxInternal = TXIMPGetInterface::From(*aContext,EReturnNullIfUnknown); + + } + +// --------------------------------------------------------------------------- +// CPresenceFeaturesImp::ConstructL(MXIMPContext* aContext) +// --------------------------------------------------------------------------- +// +void CPresenceFeaturesImp::ConstructL(MXIMPContext* aContext) + { + SetCtxL(aContext); + + iPresObjFactory = CPresenceObjectFactoryImp::NewL(); + iPresPub = CPresencePublishingImp::NewL( *iCtxInternal ); + iPresWatch = CPresenceWatchingImp::NewL( *iCtxInternal ); + iPresGroup = CPresentityGroupsImp::NewL( *iCtxInternal ); + iPresAuth = CPresenceAuthorizationImp::NewL(*iCtxInternal ); + } + + +// --------------------------------------------------------------------------- +// CPresenceFeaturesImp::PresenceObjectFactory() +// --------------------------------------------------------------------------- +// +MPresenceObjectFactory& CPresenceFeaturesImp::PresenceObjectFactory() const + { + return *iPresObjFactory; + } + + +// --------------------------------------------------------------------------- +// CPresenceFeaturesImp::PresencePublishing() +// --------------------------------------------------------------------------- +// +MPresencePublishing& CPresenceFeaturesImp::PresencePublishing() const + { + return *iPresPub; + } + + +// --------------------------------------------------------------------------- +// CPresenceFeaturesImp::PresentityGroups() +// --------------------------------------------------------------------------- +// +MPresentityGroups& CPresenceFeaturesImp::PresentityGroups() const + { + return *iPresGroup; + } + +// --------------------------------------------------------------------------- +// CPresenceFeaturesImp::PresenceWatching() +// --------------------------------------------------------------------------- +// +MPresenceWatching& CPresenceFeaturesImp::PresenceWatching() const + { + return *iPresWatch; + } + +// --------------------------------------------------------------------------- +// CPresenceFeaturesImp::PresenceWatching() +// --------------------------------------------------------------------------- +// +MPresenceAuthorization& CPresenceFeaturesImp::PresenceAuthorization() const + { + return *iPresAuth; + } + + + diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencefrontend/srcpresencemanager/presencefeaturesimp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencefrontend/srcpresencemanager/presencefeaturesimp.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,130 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of MXIMPContext +* +*/ + +#ifndef CPRESENCEFEATURESIMP_H +#define CPRESENCEFEATURESIMP_H + +#include +#include "ximpapiobjbase.h" +#include "presenceapiobjbase.h" + +class CPresencePublishingImp; +class CPresenceObjectFactoryImp; +class CPresentityGroupsImp; +class CPresenceWatchingImp; +class CPresenceAuthorizationImp; +class MXIMPContext; +class MXIMPContextInternal; + + +/** + * MXIMPContext API object implementation. + * + * @lib ximpmanager.dll + * @since S60 v3.2 + */ +NONSHARABLE_CLASS( CPresenceFeaturesImp ): public MPresenceFeatures, + public CXIMPApiObjBase + + { + public: + /** The class ID. */ + enum { KClassId = PRIMP_CLSID_CPRESENCEFEATURESIMP }; + + +public: + + IMPORT_C static CPresenceFeaturesImp* NewL( MXIMPContext* aContext ); + virtual ~CPresenceFeaturesImp(); + + +private: + + CPresenceFeaturesImp(); + void SetCtxL(MXIMPContext* aContext); + void ConstructL(MXIMPContext* aContext); + + +public: // From MXIMPBase + + /** + * Implementation of MXIMPBase interface methods + * @see MXIMPBase + */ + XIMPIMP_DECLARE_IF_BASE_METHODS + + +public: //From MPresenceFeatures + + + MPresenceObjectFactory& PresenceObjectFactory() const; + MPresenceWatching& PresenceWatching() const; + MPresencePublishing& PresencePublishing() const; + MPresentityGroups& PresentityGroups() const; + MPresenceAuthorization& PresenceAuthorization() const; + +//private: // Helpers + + /** + * Converts a string to a uid. + * String must be in Hex and begin with "0x". + */ + //void ConvertStringToUidL( const TDesC8& aData, TUid& aUid ); + + +private: // data + + /** + * Context for having a connection context server. + */ + MXIMPContextInternal* iCtxInternal; + + + /** + * Object factory sub interface. + */ + CPresenceObjectFactoryImp* iPresObjFactory; + + /** + * Own presence management sub interface. + */ + CPresencePublishingImp* iPresPub; + + /** + * Presentity group management sub interface + */ + CPresentityGroupsImp* iPresGroup; + + /** + * Presence watching management sub interface + */ + CPresenceWatchingImp* iPresWatch; + + /** + * Presence authorization management sub interface + */ + CPresenceAuthorizationImp* iPresAuth; + + /** + * Event pump. + * Own. + */ + // CXIMPContextEventPump* iEventPump; + }; + + +#endif // CPRESENCEFEATURESIMP_H diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencefrontend/srcpresencemanager/presencepublishingimp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencefrontend/srcpresencemanager/presencepublishingimp.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,178 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of MPresenceManagement + * +*/ + +#include "presencepublishingimp.h" +#include "presenceinfoimp.h" +#include "presenceinfofilterimp.h" +#include "ximpobjecthelpers.h" +#include "presenceoperationdefs.h" +#include "ximpcontextinternal.h" + + +// ============================ MEMBER FUNCTIONS ============================= + +// --------------------------------------------------------------------------- +// CPresencePublishingImp::NewL() +// --------------------------------------------------------------------------- +// +CPresencePublishingImp* CPresencePublishingImp::NewL( + MXIMPContextInternal& aContext) + { + CPresencePublishingImp* self = + new( ELeave ) CPresencePublishingImp( aContext); + + return self; + } + +// --------------------------------------------------------------------------- +// Implement supported interface access. +// --------------------------------------------------------------------------- +// +XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CPresencePublishingImp, + MPresencePublishing ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + + +XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CPresencePublishingImp, + MPresencePublishing ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + +// --------------------------------------------------------------------------- +// CPresencePublishingImp::~CPresencePublishingImp() +// --------------------------------------------------------------------------- +// +CPresencePublishingImp::~CPresencePublishingImp() + { + //iContext not own + } + + +// --------------------------------------------------------------------------- +// CPresencePublishingImp::CPresencePublishingImp() +// --------------------------------------------------------------------------- +// +CPresencePublishingImp::CPresencePublishingImp( + MXIMPContextInternal& aContext) + : iContext( aContext) + { + } + +// --------------------------------------------------------------------------- +// From class MPresencePublishing. +// CPresencePublishingImp::SubscribeOwnPresenceL() +// --------------------------------------------------------------------------- +// +TXIMPRequestId CPresencePublishingImp::SubscribeOwnPresenceL( + const MPresenceInfoFilter& aPif ) + { + HBufC8* pifPack = PackPresenceInfoFilterLC( aPif ); + + TXIMPRequestId reqId = + iContext.QueueOperationL( NPresenceOps::EPrSubscribeOwnPresence, + *pifPack ); + CleanupStack::PopAndDestroy( pifPack ); + + return reqId; + } + +// --------------------------------------------------------------------------- +// From class MPresencePublishing. +// CPresencePublishingImp::UnsubscribeOwnPresenceL() +// --------------------------------------------------------------------------- +// +TXIMPRequestId CPresencePublishingImp::UnsubscribeOwnPresenceL() + { + return iContext.QueueOperationL( NPresenceOps::EPrUnsubscribeOwnPresence, + KNullDesC8 ); + } + +// --------------------------------------------------------------------------- +// From class MPresencePublishing. +// CPresencePublishingImp::PublishOwnPresenceL() +// --------------------------------------------------------------------------- +// +TXIMPRequestId CPresencePublishingImp::PublishOwnPresenceL( + const MPresenceInfo& aPresence ) + { + HBufC8* docPack = PackPresenceDocLC( aPresence ); + + TXIMPRequestId reqId = + iContext.QueueOperationL( NPresenceOps::EPrPublishOwnPresence, + *docPack ); + CleanupStack::PopAndDestroy( docPack ); + + return reqId; + } + + + +// --------------------------------------------------------------------------- +// From class MPresencePublishing. +// CPresencePublishingImp::SubscribePresenceWatcherListL() +// --------------------------------------------------------------------------- +// +TXIMPRequestId CPresencePublishingImp::SubscribePresenceWatcherListL() + { + return iContext.QueueOperationL( + NPresenceOps::EPrSubscribePresenceWatcherList, + KNullDesC8 ); + } + +// --------------------------------------------------------------------------- +// From class MPresencePublishing. +// CPresencePublishingImp::UnsubscribePresenceWatcherListL() +// --------------------------------------------------------------------------- +// +TXIMPRequestId CPresencePublishingImp::UnsubscribePresenceWatcherListL() + { + return iContext.QueueOperationL( + NPresenceOps::EPrUnsubscribePresenceWatcherList, + KNullDesC8 ); + } + + +// --------------------------------------------------------------------------- +// CPresencePublishingImp::PackPresenceDocLC() +// --------------------------------------------------------------------------- +// +HBufC8* CPresencePublishingImp::PackPresenceDocLC( + const MPresenceInfo& aPresence ) + { + const CPresenceInfoImp* docImp = + TXIMPGetImpClassOrPanic< const CPresenceInfoImp >::From( aPresence ); + + HBufC8* pack = TXIMPObjectPacker< const CPresenceInfoImp >::PackL( *docImp ); + CleanupStack::PushL( pack ); + + return pack; + } + +// --------------------------------------------------------------------------- +// CPresencePublishingImp::PackPresenceDocLC() +// --------------------------------------------------------------------------- +// +HBufC8* CPresencePublishingImp::PackPresenceInfoFilterLC( + const MPresenceInfoFilter& aPif ) + { + const CPresenceInfoFilterImp* pifImp = + TXIMPGetImpClassOrPanic< const CPresenceInfoFilterImp >::From( aPif ); + + HBufC8* pack = TXIMPObjectPacker< CPresenceInfoFilterImp>::PackL( *pifImp ); + CleanupStack::PushL( pack ); + + return pack; + } diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencefrontend/srcpresencemanager/presencepublishingimp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencefrontend/srcpresencemanager/presencepublishingimp.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,88 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of MPresencePublishing +* +*/ + +#ifndef CPRESENCEPUBLISHINGIMP_H +#define CPRESENCEPUBLISHINGIMP_H + +#include +#include "ximpapiobjbase.h" +#include "presenceapiobjbase.h" + +class MXIMPContextInternal; + + +/** + * MPresencePublishing API object implementation. + * + * @lib ximpmanager.dll + * @since S60 v3.2 + */ +NONSHARABLE_CLASS( CPresencePublishingImp ): public CXIMPApiObjBase, + public MPresencePublishing + { + public: + /** The class ID. */ + enum { KClassId = PRIMP_CLSID_CPRESENCEPUBLISHINGIMP }; + + +public: + static CPresencePublishingImp* NewL( MXIMPContextInternal& aContext ); + ~CPresencePublishingImp(); + + +public: + CPresencePublishingImp( MXIMPContextInternal& aContext); + + +public: // From MXIMPBase + + /** + * Implementation of MXIMPBase interface methods + * @see MXIMPBase + */ + XIMPIMP_DECLARE_IF_BASE_METHODS + + +public: //From MPresencePublishing + + TXIMPRequestId SubscribeOwnPresenceL( const MPresenceInfoFilter& aPif ); + TXIMPRequestId UnsubscribeOwnPresenceL(); + TXIMPRequestId PublishOwnPresenceL( const MPresenceInfo& aPresence ); + TXIMPRequestId SubscribePresenceWatcherListL(); + TXIMPRequestId UnsubscribePresenceWatcherListL(); + TXIMPRequestId SubscribePresenceGrantRequestListL(); + TXIMPRequestId UnsubscribePresenceGrantRequestListL(); + + +public: //Helpers + + HBufC8* PackPresenceDocLC( const MPresenceInfo& aPresence ); + HBufC8* PackPresenceInfoFilterLC( const MPresenceInfoFilter& aPif ); + + +private: // data + + /** + * Context session proxy for accessing context server. + * Ref. + */ + MXIMPContextInternal& iContext; + + }; + + +#endif // CPRESENCEPUBLISHINGIMP_H diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencefrontend/srcpresencemanager/presencewatchingimp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencefrontend/srcpresencemanager/presencewatchingimp.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,221 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of MPresenceWatching + * +*/ + +#include "presencewatchingimp.h" +#include "presenceinfofilterimp.h" +#include "ximpobjecthelpers.h" +#include "presenceoperationdefs.h" +#include "ximpidentityimp.h" +#include "ximpcontextinternal.h" + + +// ============================ MEMBER FUNCTIONS ============================= + +// --------------------------------------------------------------------------- +// CPresenceWatchingImp::NewL() +// --------------------------------------------------------------------------- +// +CPresenceWatchingImp* CPresenceWatchingImp::NewL( + MXIMPContextInternal& aContext ) + { + CPresenceWatchingImp* self = + new( ELeave ) CPresenceWatchingImp( aContext ); + + return self; + } + +// --------------------------------------------------------------------------- +// Implement supported interface access. +// --------------------------------------------------------------------------- +// +XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CPresenceWatchingImp, + MPresenceWatching ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + + +XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CPresenceWatchingImp, + MPresenceWatching ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + + +// --------------------------------------------------------------------------- +// CPresenceWatchingImp::~CPresenceWatchingImp() +// --------------------------------------------------------------------------- +// +CPresenceWatchingImp::~CPresenceWatchingImp() + { + //iContext not own + } + + +// --------------------------------------------------------------------------- +// CPresenceWatchingImp::CPresenceWatchingImp() +// --------------------------------------------------------------------------- +// +CPresenceWatchingImp::CPresenceWatchingImp( + MXIMPContextInternal& aContext ) + : iContext( aContext ) + { + } + + +// --------------------------------------------------------------------------- +// CPresenceWatchingImp::SubscribePresentityPresenceL() +// --------------------------------------------------------------------------- +// +TXIMPRequestId CPresenceWatchingImp::SubscribePresentityPresenceL( + const MXIMPIdentity& aPresentityId, + const MPresenceInfoFilter& aPif ) + { + RXIMPObjOwningPtrArray< HBufC8 > packArray; + CleanupClosePushL( packArray ); + + // Pack the identity + HBufC8* idPack = PackPresentityLC( aPresentityId ); + packArray.Append( idPack ); + CleanupStack::Pop( idPack ); + + // pack the filter + HBufC8* filterPack = PackFilterLC( aPif ); + packArray.Append( filterPack ); + CleanupStack::Pop( filterPack ); + + // pack the array to a string + HBufC8* packedBuf = TXIMPHBuf8Packer::PackArrayL( packArray ); + CleanupStack::PushL( packedBuf ); + + // Queue the operation + TXIMPRequestId reqId = + iContext.QueueOperationL( NPresenceOps::EPrSubscribePresentityPresence, + *packedBuf ); + + CleanupStack::PopAndDestroy( packedBuf ); + CleanupStack::PopAndDestroy(); // packArray + + return reqId; + } + + +// --------------------------------------------------------------------------- +// CPresenceWatchingImp::UnsubscribePresentityPresenceL() +// --------------------------------------------------------------------------- +// +TXIMPRequestId CPresenceWatchingImp::UnsubscribePresentityPresenceL( + const MXIMPIdentity& aPresentityId ) + { + // Pack the identity + HBufC8* idPack = PackPresentityLC( aPresentityId ); + // Queue the operation + TXIMPRequestId reqId = + iContext.QueueOperationL( NPresenceOps::EPrUnsubscribePresentityPresence, + *idPack ); + CleanupStack::PopAndDestroy( idPack ); + return reqId; + } + + +// --------------------------------------------------------------------------- +// CPresenceWatchingImp::SubscribePresentityGroupMembersPresenceL() +// --------------------------------------------------------------------------- +// +TXIMPRequestId CPresenceWatchingImp::SubscribePresentityGroupMembersPresenceL( + const MXIMPIdentity& aGroupId, + const MPresenceInfoFilter& aPif ) + { + RXIMPObjOwningPtrArray< HBufC8 > packArray; + CleanupClosePushL( packArray ); + + // Pack the identity + HBufC8* idPack = PackPresentityLC( aGroupId ); + packArray.Append( idPack ); + CleanupStack::Pop( idPack ); + + // pack the filter + HBufC8* filterPack = PackFilterLC( aPif ); + packArray.Append( filterPack ); + CleanupStack::Pop( filterPack ); + + // pack the array to a string + HBufC8* packedBuf = TXIMPHBuf8Packer::PackArrayL( packArray ); + CleanupStack::PushL( packedBuf ); + + // Queue the operation + TXIMPRequestId reqId = + iContext.QueueOperationL( NPresenceOps::EPrSubscribePresentityGroupMembersPresence, + *packedBuf ); + + CleanupStack::PopAndDestroy( packedBuf ); + CleanupStack::PopAndDestroy(); // packArray + + return reqId; + } + + +// --------------------------------------------------------------------------- +// CPresenceWatchingImp::UnsubscribePresentityGroupMembersPresenceL() +// --------------------------------------------------------------------------- +// +TXIMPRequestId CPresenceWatchingImp::UnsubscribePresentityGroupMembersPresenceL( + const MXIMPIdentity& aGroupId ) + { + // Pack the identity + HBufC8* idPack = PackPresentityLC( aGroupId ); + // Queue the operation + TXIMPRequestId reqId = + iContext.QueueOperationL( + NPresenceOps::EPrUnsubscribePresentityGroupMembersPresence, + *idPack ); + CleanupStack::PopAndDestroy( idPack ); + return reqId; + } + + +// --------------------------------------------------------------------------- +// CPresenceWatchingImp::PackPresentityLC() +// --------------------------------------------------------------------------- +// +HBufC8* CPresenceWatchingImp::PackPresentityLC( + const MXIMPIdentity& aIdentity ) + { + const CXIMPIdentityImp* identityImp = + TXIMPGetImpClassOrPanic< const CXIMPIdentityImp >::From( aIdentity ); + + HBufC8* pack = TXIMPObjectPacker< const CXIMPIdentityImp >::PackL( *identityImp ); + CleanupStack::PushL( pack ); + + return pack; + } + +// --------------------------------------------------------------------------- +// CPresenceWatchingImp::PackFilterLC() +// --------------------------------------------------------------------------- +// +HBufC8* CPresenceWatchingImp::PackFilterLC( + const MPresenceInfoFilter& aFilter ) + { + const CPresenceInfoFilterImp* filterImp = + TXIMPGetImpClassOrPanic< const CPresenceInfoFilterImp >::From( aFilter ); + + HBufC8* pack = TXIMPObjectPacker< const CPresenceInfoFilterImp >::PackL( *filterImp ); + CleanupStack::PushL( pack ); + + return pack; + } + + +// End of file + diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencefrontend/srcpresencemanager/presencewatchingimp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencefrontend/srcpresencemanager/presencewatchingimp.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,88 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of MPresenceWatching +* +*/ + +#ifndef CPRESENCEWATCHINGIMP_H +#define CPRESENCEWATCHINGIMP_H + +#include +#include "ximpapiobjbase.h" +#include "presenceapiobjbase.h" + +class MXIMPContextInternal; +class MXIMPIdentity; +class MPresenceInfoFilter; + +/** + * MPresencePublishing API object implementation. + * + * @lib ximpmanager.dll + * @since S60 v3.2 + */ +NONSHARABLE_CLASS( CPresenceWatchingImp ): public CXIMPApiObjBase, + public MPresenceWatching + { + public: + /** The class ID. */ + enum { KClassId = PRIMP_CLSID_CPRESENCEWATCHINGIMP }; + + +public: + static CPresenceWatchingImp* NewL( MXIMPContextInternal& aContext ); + ~CPresenceWatchingImp(); + + +public: + CPresenceWatchingImp( MXIMPContextInternal& aContext ); + + +public: // From MXIMPBase + + /** + * Implementation of MXIMPBase interface methods + * @see MXIMPBase + */ + XIMPIMP_DECLARE_IF_BASE_METHODS + + +public: //From MPresenceWatching + + TXIMPRequestId SubscribePresentityPresenceL( const MXIMPIdentity& aPresentityId, + const MPresenceInfoFilter& aPif ); + TXIMPRequestId UnsubscribePresentityPresenceL( const MXIMPIdentity& aPresentityId ); + TXIMPRequestId SubscribePresentityGroupMembersPresenceL( const MXIMPIdentity& aGroupId, + const MPresenceInfoFilter& aPif ); + TXIMPRequestId UnsubscribePresentityGroupMembersPresenceL( const MXIMPIdentity& aGroupId ); + + +private: //Helpers + + HBufC8* PackPresentityLC( const MXIMPIdentity& aIdentity ); + + HBufC8* PackFilterLC( const MPresenceInfoFilter& aFilter ); + +private: // data + + /** + * Context session proxy for accessing context server. + * Ref. + */ + MXIMPContextInternal& iContext; + + }; + + +#endif // CPRESENCEWATCHINGIMP_H diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencefrontend/srcpresencemanager/presentitygroupsimp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencefrontend/srcpresencemanager/presentitygroupsimp.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,339 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of MPresenceManagement + * +*/ + +#include "presentitygroupsimp.h" +#include "presenceinfoimp.h" +#include "presenceinfofilterimp.h" +#include "ximpobjecthelpers.h" +#include "presentitygroupinfoimp.h" +#include "presentitygroupmemberinfoimp.h" +#include "ximpidentityimp.h" +#include "ximpcontextinternal.h" + + +// ============================ MEMBER FUNCTIONS ============================= + +// --------------------------------------------------------------------------- +// CPresentityGroupsImp::NewL() +// --------------------------------------------------------------------------- +// +CPresentityGroupsImp* CPresentityGroupsImp::NewL( + MXIMPContextInternal& aContext ) + { + CPresentityGroupsImp* self = + new( ELeave ) CPresentityGroupsImp( aContext ); + + return self; + } + +// --------------------------------------------------------------------------- +// Implement supported interface access. +// --------------------------------------------------------------------------- +// +XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CPresentityGroupsImp, + MPresentityGroups ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + +XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CPresentityGroupsImp, + MPresentityGroups ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + +// --------------------------------------------------------------------------- +// CPresentityGroupsImp::~CPresentityGroupsImp() +// --------------------------------------------------------------------------- +// +CPresentityGroupsImp::~CPresentityGroupsImp() + { + //iContext not own + } + + +// --------------------------------------------------------------------------- +// CPresentityGroupsImp::CPresentityGroupsImp() +// --------------------------------------------------------------------------- +// +CPresentityGroupsImp::CPresentityGroupsImp( + MXIMPContextInternal& aContext ) + : iContext( aContext ) + { + } + +// --------------------------------------------------------------------------- +// CPresentityGroupsImp::SubscribeOwnPresenceL() +// --------------------------------------------------------------------------- +// +TXIMPRequestId CPresentityGroupsImp::SubscribePresentityGroupListL() + { + return iContext.QueueOperationL( NPresenceOps::EPrSubscribeGroupList, + KNullDesC8 ); + } + +// --------------------------------------------------------------------------- +// CPresentityGroupsImp::SubscribeOwnPresenceL() +// --------------------------------------------------------------------------- +// +TXIMPRequestId CPresentityGroupsImp::UnsubscribePresentityGroupListL() + { + return iContext.QueueOperationL( NPresenceOps::EPrUnsubscribeGroupList, + KNullDesC8 ); + } + +// --------------------------------------------------------------------------- +// CPresentityGroupsImp::SubscribeOwnPresenceL() +// --------------------------------------------------------------------------- +// +TXIMPRequestId CPresentityGroupsImp::CreatePresentityGroupL( const MXIMPIdentity& aGroupId, + const TDesC16& aGroupDisplayName ) + { + return QueueOperationL( NPresenceOps::EPrCreatePresentityGroup, aGroupId, aGroupDisplayName ); + } + +// --------------------------------------------------------------------------- +// CPresentityGroupsImp::DeletePresentityGroupL() +// --------------------------------------------------------------------------- +// +TXIMPRequestId CPresentityGroupsImp::DeletePresentityGroupL( const MXIMPIdentity& aGroupId ) + { + return QueueOperationL( NPresenceOps::EPrDeletePresentityGroup, aGroupId, KNullDesC ); + } + +// --------------------------------------------------------------------------- +// CPresentityGroupsImp::UpdatePresentityGroupDisplayNameL() +// --------------------------------------------------------------------------- +// +TXIMPRequestId CPresentityGroupsImp::UpdatePresentityGroupDisplayNameL( const MXIMPIdentity& aGroupId, + const TDesC16& aGroupDisplayName ) + { + return QueueOperationL( NPresenceOps::EPrUpdatePresentityGroupDisplayName, aGroupId, aGroupDisplayName ); + } + + +// --------------------------------------------------------------------------- +// From MPresentityGroups class. +// CPresentityGroupsImp::SubscribePresentityGroupContentL +// --------------------------------------------------------------------------- +// +TXIMPRequestId CPresentityGroupsImp::SubscribePresentityGroupContentL( + const MXIMPIdentity& aGroupId ) + { + HBufC8* idPack = PackIdentityLC( aGroupId ); + + TXIMPRequestId reqId = + iContext.QueueOperationL( NPresenceOps::EPrSubscribePresentityGroupContent, + *idPack ); + CleanupStack::PopAndDestroy( idPack ); + return reqId; + } +// --------------------------------------------------------------------------- +// From MPresentityGroups class. +// CPresentityGroupsImp::UnsubscribePresentityGroupContentL +// --------------------------------------------------------------------------- +// +TXIMPRequestId CPresentityGroupsImp::UnsubscribePresentityGroupContentL( + const MXIMPIdentity& aGroupId ) + { + HBufC8* idPack = PackIdentityLC( aGroupId ); + + TXIMPRequestId reqId = + iContext.QueueOperationL( NPresenceOps::EPrUnsubscribePresentityGroupContent, + *idPack ); + CleanupStack::PopAndDestroy( idPack ); + return reqId; + } + +// --------------------------------------------------------------------------- +// From MPresentityGroups class. +// CPresentityGroupsImp::AddPresentityGroupMemberL +// --------------------------------------------------------------------------- +// +TXIMPRequestId CPresentityGroupsImp::AddPresentityGroupMemberL( + const MXIMPIdentity& aGroupId, + const MXIMPIdentity& aMemberId, + const TDesC16& aMemberDisplayName ) + { + return QueueOperationL( NPresenceOps::EPrAddPresentityGroupMember, + aGroupId, + aMemberId, + aMemberDisplayName ); + } + +// --------------------------------------------------------------------------- +// From MPresentityGroups class. +// CPresentityGroupsImp::RemovePresentityGroupMemberL +// --------------------------------------------------------------------------- +// +TXIMPRequestId CPresentityGroupsImp::RemovePresentityGroupMemberL( + const MXIMPIdentity& aGroupId, + const MXIMPIdentity& aMemberId ) + { + return QueueOperationL( NPresenceOps::EPrRemovePresentityGroupMember, + aGroupId, + aMemberId ); + } + +// --------------------------------------------------------------------------- +// From MPresentityGroups class. +// CPresentityGroupsImp::UpdatePresentityGroupMemberDisplayNameL +// --------------------------------------------------------------------------- +// +TXIMPRequestId CPresentityGroupsImp::UpdatePresentityGroupMemberDisplayNameL( + const MXIMPIdentity& aGroupId, + const MXIMPIdentity& aMemberId, + const TDesC16& aMemberDisplayName ) + { + return QueueOperationL( NPresenceOps::EPrUpdatePresentityGroupMemberDisplayName, + aGroupId, + aMemberId, + aMemberDisplayName ); + } + +// --------------------------------------------------------------------------- +// CPresentityGroupsImp::QueueOperationL() +// --------------------------------------------------------------------------- +// +TXIMPRequestId CPresentityGroupsImp::QueueOperationL( NPresenceOps::TPresenceOpTypes aOperation, + const MXIMPIdentity& aGroupId, + const TDesC16& aGroupDisplayName ) + { + CPresentityGroupInfoImp* groupInfo = + CPresentityGroupInfoImp::NewLC( aGroupId, aGroupDisplayName ); + HBufC8* infoPack = PackGroupInfoLC( *groupInfo ); + + TXIMPRequestId reqId = + iContext.QueueOperationL( aOperation, *infoPack ); + CleanupStack::PopAndDestroy( 2, groupInfo ); + + return reqId; + } + +// --------------------------------------------------------------------------- +// CPresentityGroupsImp::QueueOperationL() +// --------------------------------------------------------------------------- +// +TXIMPRequestId CPresentityGroupsImp::QueueOperationL( NPresenceOps::TPresenceOpTypes aOperation, + const MXIMPIdentity& aGroupId, + const MXIMPIdentity& aMemberId, + const TDesC16& aMemberDisplayName ) + { + CBufFlat* buffer = CBufFlat::NewL( 10 ); // set granularity to 10 + CleanupStack::PushL( buffer ); + + RBufWriteStream ws; + CleanupClosePushL( ws ); + ws.Open( *buffer ); // CSI: 65 # Does not return a value + + // group id + const CXIMPIdentityImp* identityImp = + TXIMPGetImpClassOrPanic< const CXIMPIdentityImp >::From( aGroupId ); + identityImp->ExternalizeL( ws ); + + + // member id + identityImp = + TXIMPGetImpClassOrPanic< const CXIMPIdentityImp >::From( aMemberId ); + identityImp->ExternalizeL( ws ); + + + // member display name + ws.WriteInt32L( aMemberDisplayName.Length() ); + ws.WriteL( aMemberDisplayName ); + + ws.CommitL(); + CleanupStack::PopAndDestroy(); //ws + + HBufC8* packedBuf = buffer->Ptr( 0 ).AllocL(); + CleanupStack::PopAndDestroy( buffer ); + CleanupStack::PushL( packedBuf ); + + // Queue the operation + TXIMPRequestId reqId = + iContext.QueueOperationL( aOperation, *packedBuf ); + CleanupStack::PopAndDestroy( packedBuf ); + + return reqId; + } + +// --------------------------------------------------------------------------- +// CPresentityGroupsImp::QueueOperationL() +// --------------------------------------------------------------------------- +// +TXIMPRequestId CPresentityGroupsImp::QueueOperationL( NPresenceOps::TPresenceOpTypes aOperation, + const MXIMPIdentity& aGroupId, + const MXIMPIdentity& aMemberId ) + { + CBufFlat* buffer = CBufFlat::NewL( 10 ); // set granularity to 10 + CleanupStack::PushL( buffer ); + + RBufWriteStream ws; + CleanupClosePushL( ws ); + ws.Open( *buffer ); // CSI: 65 # Does not return a value + + // group id + const CXIMPIdentityImp* identityImp = + TXIMPGetImpClassOrPanic< const CXIMPIdentityImp >::From( aGroupId ); + identityImp->ExternalizeL( ws ); + + + // member id + identityImp = + TXIMPGetImpClassOrPanic< const CXIMPIdentityImp >::From( aMemberId ); + identityImp->ExternalizeL( ws ); + + ws.CommitL(); + CleanupStack::PopAndDestroy(); //ws + + HBufC8* packedBuf = buffer->Ptr( 0 ).AllocL(); + CleanupStack::PopAndDestroy( buffer ); + CleanupStack::PushL( packedBuf ); + + // Queue the operation + TXIMPRequestId reqId = + iContext.QueueOperationL( aOperation, *packedBuf ); + CleanupStack::PopAndDestroy( packedBuf ); + + return reqId; + } + + +// --------------------------------------------------------------------------- +// CPresentityGroupsImp::PackGroupInfoLC() +// --------------------------------------------------------------------------- +// +HBufC8* CPresentityGroupsImp::PackGroupInfoLC( const CPresentityGroupInfoImp& infoImp ) + { + HBufC8* pack = TXIMPObjectPacker< const CPresentityGroupInfoImp >::PackL( infoImp ); + CleanupStack::PushL( pack ); + return pack; + } + +// --------------------------------------------------------------------------- +// CPresentityGroupsImp::PackIdentityLC() +// --------------------------------------------------------------------------- +// +HBufC8* CPresentityGroupsImp::PackIdentityLC( const MXIMPIdentity& aIdentity ) + { + const CXIMPIdentityImp* identityImp = + TXIMPGetImpClassOrPanic< const CXIMPIdentityImp >::From( aIdentity ); + + HBufC8* pack = TXIMPObjectPacker< const CXIMPIdentityImp >::PackL( *identityImp ); + CleanupStack::PushL( pack ); + + return pack; + } + +// End of file + diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresencefrontend/srcpresencemanager/presentitygroupsimp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresencefrontend/srcpresencemanager/presentitygroupsimp.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,108 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of MPresencePublishing +* +*/ + +#ifndef CPRESENTITYGROUPSIMP_H +#define CPRESENTITYGROUPSIMP_H + +#include +#include "ximpapiobjbase.h" +#include "presenceapiobjbase.h" +#include "presenceoperationdefs.h" + +class MXIMPContextInternal; +class CPresentityGroupInfoImp; + +/** + * MPresencePublishing API object implementation. + * + * @lib ximpmanager.dll + * @since S60 v3.2 + */ +NONSHARABLE_CLASS( CPresentityGroupsImp ): public CXIMPApiObjBase, + public MPresentityGroups + { + public: + /** The class ID. */ + enum { KClassId = PRIMP_CLSID_CPRESENTITYGROUPSIMP }; + + +public: + static CPresentityGroupsImp* NewL( MXIMPContextInternal& aContext ); + ~CPresentityGroupsImp(); + + +public: + CPresentityGroupsImp( MXIMPContextInternal& aContext ); + + +public: // From MXIMPBase + + /** + * Implementation of MXIMPBase interface methods + * @see MXIMPBase + */ + XIMPIMP_DECLARE_IF_BASE_METHODS + + +public: //From MPresentityGroups + + TXIMPRequestId SubscribePresentityGroupListL(); + TXIMPRequestId UnsubscribePresentityGroupListL(); + TXIMPRequestId CreatePresentityGroupL( const MXIMPIdentity& aGroupId, + const TDesC16& aGroupDisplayName ); + TXIMPRequestId DeletePresentityGroupL( const MXIMPIdentity& aGroupId ); + TXIMPRequestId UpdatePresentityGroupDisplayNameL( const MXIMPIdentity& aGroupId, + const TDesC16& aGroupDisplayName ); + + TXIMPRequestId SubscribePresentityGroupContentL( const MXIMPIdentity& aGroupId ); + TXIMPRequestId UnsubscribePresentityGroupContentL( const MXIMPIdentity& aGroupId ); + TXIMPRequestId AddPresentityGroupMemberL( const MXIMPIdentity& aGroupId, + const MXIMPIdentity& aMemberId, + const TDesC16& aMemberDisplayName ); + TXIMPRequestId RemovePresentityGroupMemberL( const MXIMPIdentity& aGroupId, + const MXIMPIdentity& aMemberId ); + TXIMPRequestId UpdatePresentityGroupMemberDisplayNameL( const MXIMPIdentity& aGroupId, + const MXIMPIdentity& aMemberId, + const TDesC16& aMemberDisplayName ); + +public: //Helpers + + HBufC8* PackGroupInfoLC( const CPresentityGroupInfoImp& infoImp ); + HBufC8* PackIdentityLC( const MXIMPIdentity& aIdentity ); + TXIMPRequestId QueueOperationL( NPresenceOps::TPresenceOpTypes aOperation, + const MXIMPIdentity& aGroupId, + const TDesC16& aGroupDisplayName ); + TXIMPRequestId QueueOperationL( NPresenceOps::TPresenceOpTypes aOperation, + const MXIMPIdentity& aGroupId, + const MXIMPIdentity& aMemberId, + const TDesC16& aMemberDisplayName ); + TXIMPRequestId QueueOperationL( NPresenceOps::TPresenceOpTypes aOperation, + const MXIMPIdentity& aGroupId, + const MXIMPIdentity& aMemberId ); + +private: // data + + /** + * Context session proxy for accessing context server. + * Ref. + */ + MXIMPContextInternal& iContext; + + }; + + +#endif // CPRESENTITYGROUPSIMP_H diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresenceoperations/operationlaunchcleaner.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresenceoperations/operationlaunchcleaner.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,100 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Internal operation for launching cleaner + * +*/ + + +#include "operationlaunchcleaner.h" +#include "protocolpresencedatahostimp.h" +#include "presencedatacacheimp.h" +#include "ximphost.h" + +#include "ximptrace.h" + +// ============================ MEMBER FUNCTIONS ============================= + +// --------------------------------------------------------------------------- +// COperationLaunchCleaner::COperationLaunchCleaner() +// --------------------------------------------------------------------------- +// +EXPORT_C COperationLaunchCleaner::COperationLaunchCleaner() + { + } + + + +// --------------------------------------------------------------------------- +// COperationLaunchCleaner::~COperationLaunchCleaner() +// --------------------------------------------------------------------------- +// +COperationLaunchCleaner::~COperationLaunchCleaner() + { + } + +// --------------------------------------------------------------------------- +// COperationLaunchCleaner::ConstructL() +// --------------------------------------------------------------------------- +// +void COperationLaunchCleaner::ConstructL( const TDesC8& /*aParamPck*/ ) + { + } + +// --------------------------------------------------------------------------- +// COperationLaunchCleaner::ProcessL() +// --------------------------------------------------------------------------- +// +void COperationLaunchCleaner::ProcessL() + { + TRACE(_L("COperationLaunchCleaner::ProcessL()" ) ); + CXIMPOperationBase::ProcessL(); + + iMyHost->PresenceDataAccess().PresenceDataCache().CleanExpired(); + + iMyHost->HandleInternalRequestCompleted( iReqId, KErrNone ); + } + +// --------------------------------------------------------------------------- +// COperationLaunchCleaner::RequestCompleted() +// --------------------------------------------------------------------------- +// +void COperationLaunchCleaner::RequestCompletedL() + { + TRACE(_L("COperationLaunchCleaner::RequestCompletedL()" ) ); + CXIMPOperationBase::RequestCompletedL(); + } + + +// --------------------------------------------------------------------------- +// COperationLaunchCleaner::Type() +// --------------------------------------------------------------------------- +// +TInt + COperationLaunchCleaner::Type() const + { + return NPresenceOps::EXIMPCleaner; + } + +// --------------------------------------------------------------------------- +// COperationLaunchCleaner::EndOperation() +// --------------------------------------------------------------------------- +// +void COperationLaunchCleaner::EndOperation() + { + CXIMPOperationBase::EndOperation(); + iMyHost->StartCleanerTimer(); + } + + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresenceoperations/operationlaunchcleaner.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresenceoperations/operationlaunchcleaner.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,59 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Internal operation for launching cleaner + * +*/ + +#ifndef CPSCOPERATIONLAUNCHCLEANER_H +#define CPSCOPERATIONLAUNCHCLEANER_H + + +#include +#include +#include "ximpoperationbase.h" +#include "presenceoperationdefs.h" + + +/** + * Internal synthesise own subscription event operation + * + * @lib ximpoperations.lib + * @since S60 v4.0 + */ +class COperationLaunchCleaner : public CXIMPOperationBase + { + public: + + IMPORT_C COperationLaunchCleaner(); + + void ConstructL( const TDesC8& aParamPck ); + + ~COperationLaunchCleaner(); + + + public: // from CXIMPOperationBase + + void ProcessL(); + + void RequestCompletedL(); + + TInt Type() const; + + void EndOperation(); + + private: // data + }; + + +#endif // CPSCOPERATIONLAUNCHCLEANER_H diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresenceoperations/operationsetsubscriptiondata.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresenceoperations/operationsetsubscriptiondata.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,196 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Set subscription data + * +*/ + + +#include "operationsetsubscriptiondata.h" +#include "ximpsubscriptionitem.h" +#include "ximphost.h" +#include "ownpresencesubscriptionitem.h" +#include "grouplistsubscriptionitem.h" +#include "groupcontentsubscriptionitem.h" +#include "presentitypresencesubscriptionitem.h" +#include "presentitygroupmemberspresencesubscriptionitem.h" +#include "watcherlistsubscriptionitem.h" +#include "grantrequestlistsubscriptionitem.h" +#include "blocklistsubscriptionitem.h" +#include "ximpobjecthelpers.h" +#include "ximppanics.h" +#include "ximpidentityimp.h" +#include "ximppsccontextimp.h" +#include "ximprestrictedobjectcollectionimp.h" +#include "ximpstatusimp.h" +#include "ximpdatasubscriptionstateimp.h" +#include "presencedatacacheimp.h" +#include "protocolpresencedatahostimp.h" + +#include "ximptrace.h" + +// ============================ MEMBER FUNCTIONS ============================= + +// --------------------------------------------------------------------------- +// COperationSetSubscriptionData::COperationSetSubscriptionData() +// --------------------------------------------------------------------------- +// +EXPORT_C COperationSetSubscriptionData::COperationSetSubscriptionData( + NPresenceOps::TPresenceOpTypes aType ) + :iType( aType ) + { + } + + + +// --------------------------------------------------------------------------- +// COperationSetSubscriptionData::~COperationSetSubscriptionData() +// --------------------------------------------------------------------------- +// +COperationSetSubscriptionData::~COperationSetSubscriptionData() + { + delete iStatus; + delete iSubscriptionState; + delete iIdentity; + } + +// --------------------------------------------------------------------------- +// COperationSetSubscriptionData::ConstructL() +// --------------------------------------------------------------------------- +// +void COperationSetSubscriptionData::ConstructL( const TDesC8& /*aParamPck*/ ) + { + } + +// --------------------------------------------------------------------------- +// COperationSynthesiseSubscriptionEvent::ProcessL() +// --------------------------------------------------------------------------- +// +void COperationSetSubscriptionData::ProcessL() + { + TRACE(_L("COperationSetSubscriptionData::ProcessL()" ) ); + CXIMPOperationBase::ProcessL(); + + MXIMPBase* object = NULL; + iObjCollection->GetByType( object, MXIMPIdentity::KInterfaceId ); + if( object ) + { + iIdentity = TXIMPGetImpClassOrPanic< CXIMPIdentityImp >::From( *object ); + } + + iObjCollection->GetByType( object, MXIMPDataSubscriptionState::KInterfaceId ); + if( object ) + { + iSubscriptionState = TXIMPGetImpClassOrPanic< CXIMPDataSubscriptionStateImp >::From( *object ); + } + else + { + User::Leave( KErrArgument ); + } + + iObjCollection->GetByType( object, MXIMPDataSubscriptionState::KInterfaceId ); + if( object ) + { + iSubscriptionState = TXIMPGetImpClassOrPanic< CXIMPDataSubscriptionStateImp >::From( *object ); + } + else + { + User::Leave( KErrArgument ); + } + + iObjCollection->GetByType( object, MXIMPStatus::KInterfaceId ); + if( object ) + { + iStatus = TXIMPGetImpClassOrPanic< CXIMPStatusImp >::From( *object ); + } + + MXIMPSubscriptionItem* subscriptionItem = NULL; + switch( iType ) + { + case NPresenceOps::EPrSetOwnPresenceDataSubscriptionState: + { + subscriptionItem = &iMyHost->PresenceDataAccess().PresenceDataCache().OwnPresenceSubscriptionItemLC(); + break; + } + case NPresenceOps::EPrSetPresenceBlockDataSubscriptionState: + { + subscriptionItem = &iMyHost->PresenceDataAccess().PresenceDataCache().BlockListSubscriptionItemLC(); + break; + } + case NPresenceOps::EPrSetPresenceGrantRequestDataSubscriptionState: + { + subscriptionItem = &iMyHost->PresenceDataAccess().PresenceDataCache().GrantRequestListSubscriptionItemLC(); + break; + } + case NPresenceOps::EPrSetPresenceWatcherListDataSubscriptionState: + { + subscriptionItem = &iMyHost->PresenceDataAccess().PresenceDataCache().WatcherListSubscriptionItemLC(); + break; + } + case NPresenceOps::EPrSetPresentityGroupListDataSubscriptionState: + { + subscriptionItem = &iMyHost->PresenceDataAccess().PresenceDataCache().GroupListSubscriptionItemLC(); + break; + } + case NPresenceOps::EPrSetPresentityGroupContentDataSubscriptionState: + { + if( !iIdentity ) + { + User::Leave( KErrArgument ); + } + subscriptionItem = &iMyHost->PresenceDataAccess().PresenceDataCache().GroupContentSubscriptionItemLC( *iIdentity ); + break; + } + case NPresenceOps::EPrSetPresentityPresenceDataSubscriptionState: + { + if( !iIdentity ) + { + User::Leave( KErrArgument ); + } + subscriptionItem = &iMyHost->PresenceDataAccess().PresenceDataCache().PresentityPresenceSubscriptionItemLC( *iIdentity ); + break; + } + + XIMP_DEFAULT_CASE_UNSUPPORTED( NXIMPPrivPanic::EInvalidSubscriptionType ); + } + + subscriptionItem->SetDataSubscriptionStateL( *iSubscriptionState ); + iSubscriptionState = NULL; + + iMyHost->HandleAdaptationRequestCompleted( iReqId, KErrNone ); + } + +// --------------------------------------------------------------------------- +// COperationSetSubscriptionData::RequestCompleted() +// --------------------------------------------------------------------------- +// +void COperationSetSubscriptionData::RequestCompletedL() + { + TRACE(_L("COperationSetSubscriptionData::RequestCompletedL()" ) ); + CXIMPOperationBase::RequestCompletedL(); + } + + +// --------------------------------------------------------------------------- +// COperationSetSubscriptionData::Type() +// --------------------------------------------------------------------------- +// +TInt + COperationSetSubscriptionData::Type() const + { + return iType; + } + + + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresenceoperations/operationsetsubscriptiondata.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresenceoperations/operationsetsubscriptiondata.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,83 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Set subscription data + * +*/ + +#ifndef CPSCOPERATIONSETSUBSCRIPTIONDATA_H +#define CPSCOPERATIONSETSUBSCRIPTIONDATA_H + + +#include +#include + +#include "ximpoperationbase.h" +#include "presenceoperationdefs.h" + +class CXIMPIdentityImp; + +class CXIMPDataSubscriptionStateImp; + +/** + * Set subscription data for items + * + * @lib ximpoperations.lib + * @since S60 v4.0 + */ +class COperationSetSubscriptionData : public CXIMPOperationBase + { + public: // Definitions + + public: + + IMPORT_C COperationSetSubscriptionData( NPresenceOps::TPresenceOpTypes aType ); + + void ConstructL( const TDesC8& aParamPck ); + + ~COperationSetSubscriptionData(); + + public: // from CXIMPOperationBase + + void ProcessL(); + + void RequestCompletedL(); + + TInt Type() const; + + private: // data + + /** + * Identity for presentity presence synthetization. + */ + CXIMPIdentityImp* iIdentity; + + /** + * Type of operation + */ + NPresenceOps::TPresenceOpTypes iType; + + /** + * New subscription state + */ + CXIMPDataSubscriptionStateImp* iSubscriptionState; + + /** + * Status reason for change. + */ + CXIMPStatusImp* iStatus; + + }; + + +#endif // CPSCOPERATIONSETSUBSCRIPTIONDATA_H diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresenceoperations/operationsynthesisesubscriptionevent.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresenceoperations/operationsynthesisesubscriptionevent.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,182 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Internal synthesise subscription event operation + * +*/ + + +#include "operationsynthesisesubscriptionevent.h" +#include "ownpresencesubscriptionitem.h" +#include "grouplistsubscriptionitem.h" +#include "groupcontentsubscriptionitem.h" +#include "presentitypresencesubscriptionitem.h" +#include "presentitygroupmemberspresencesubscriptionitem.h" +#include "watcherlistsubscriptionitem.h" +#include "grantrequestlistsubscriptionitem.h" +#include "blocklistsubscriptionitem.h" +#include "presencedatacacheimp.h" +#include "protocolpresencedatahostimp.h" +#include "ximpobjecthelpers.h" +#include "ximpidentityimp.h" +#include "ximphost.h" +#include "ximppanics.h" +#include "ximppsccontextimp.h" + +#include "ximptrace.h" +// ============================ MEMBER FUNCTIONS ============================= + +// --------------------------------------------------------------------------- +// COperationSynthesiseSubscriptionEvent::COperationSynthesiseSubscriptionEvent() +// --------------------------------------------------------------------------- +// +EXPORT_C COperationSynthesiseSubscriptionEvent::COperationSynthesiseSubscriptionEvent( + COperationSynthesiseSubscriptionEvent::TSubscriptionType aType, TBool aForceEvent ) + : iType( aType ), iForceEvent( aForceEvent ) + { + } + + + +// --------------------------------------------------------------------------- +// COperationSynthesiseSubscriptionEvent::~COperationSynthesiseSubscriptionEvent() +// --------------------------------------------------------------------------- +// +COperationSynthesiseSubscriptionEvent::~COperationSynthesiseSubscriptionEvent() + { + delete iIdentity; + } + +// --------------------------------------------------------------------------- +// COperationSynthesiseSubscriptionEvent::ConstructL() +// --------------------------------------------------------------------------- +// +void COperationSynthesiseSubscriptionEvent::ConstructL( const TDesC8& /*aParamPck*/ ) + { + } + + +// --------------------------------------------------------------------------- +// COperationSynthesiseSubscriptionEvent::ConstructL() +// --------------------------------------------------------------------------- +// +void COperationSynthesiseSubscriptionEvent::ConstructL( const CXIMPIdentityImp& aIdentity ) + { + iIdentity = TXIMPObjectCloner< CXIMPIdentityImp >::CloneL( aIdentity ); + } + +// --------------------------------------------------------------------------- +// COperationSynthesiseSubscriptionEvent::ProcessL() +// --------------------------------------------------------------------------- +// +void COperationSynthesiseSubscriptionEvent::ProcessL() + { + TRACE(_L("COperationSynthesiseSubscriptionEvent::ProcessL()" ) ); + CXIMPOperationBase::ProcessL(); + + MXIMPSubscriptionItem* subscriptionItem = NULL; + switch( iType ) + { + case EOwnPresence: + { + TRACE(_L("COperationSynthesiseSubscriptionEvent::ProcessL() : case EOwnPresence" ) ); + subscriptionItem = &iMyHost->PresenceDataAccess().PresenceDataCache().OwnPresenceSubscriptionItemLC(); + break; + } + case EPresenceBlockList: + { + TRACE(_L("COperationSynthesiseSubscriptionEvent::ProcessL() : case EPresenceBlockList" ) ); + subscriptionItem = &iMyHost->PresenceDataAccess().PresenceDataCache().BlockListSubscriptionItemLC(); + break; + } + case EPresenceGrantRequestList: + { + TRACE(_L("COperationSynthesiseSubscriptionEvent::ProcessL() : case EPresenceGrantRequestList" ) ); + subscriptionItem = &iMyHost->PresenceDataAccess().PresenceDataCache().GrantRequestListSubscriptionItemLC(); + break; + } + case EPresenceWatcherList: + { + TRACE(_L("COperationSynthesiseSubscriptionEvent::ProcessL() : case EPresenceWatcherList" ) ); + subscriptionItem = &iMyHost->PresenceDataAccess().PresenceDataCache().WatcherListSubscriptionItemLC(); + break; + } + case EPresentityGroupList: + { + TRACE(_L("COperationSynthesiseSubscriptionEvent::ProcessL() : case EPresentityGroupList" ) ); + subscriptionItem = &iMyHost->PresenceDataAccess().PresenceDataCache().GroupListSubscriptionItemLC(); + break; + } + case EPresentityGroupContent: + { + TRACE(_L("COperationSynthesiseSubscriptionEvent::ProcessL() : case EPresentityGroupContent" ) ); + subscriptionItem = &iMyHost->PresenceDataAccess().PresenceDataCache().GroupContentSubscriptionItemLC( *iIdentity ); + break; + } + case EPresentityPresence: + { + TRACE(_L("COperationSynthesiseSubscriptionEvent::ProcessL() : case EPresentityPresence" ) ); + subscriptionItem = &iMyHost->PresenceDataAccess().PresenceDataCache().PresentityPresenceSubscriptionItemLC( *iIdentity ); + break; + } + case EPresentityGroupMembersPresence: + { + TRACE(_L("COperationSynthesiseSubscriptionEvent::ProcessL() : case EPresentityGroupMembersPresence" ) ); + subscriptionItem = &iMyHost->PresenceDataAccess().PresenceDataCache().PresentityGroupMembersPresenceSubscriptionItemLC( *iIdentity ); + break; + } + + + XIMP_DEFAULT_CASE_UNSUPPORTED( NXIMPPrivPanic::EInvalidSubscriptionType ); + } + + if( iContext ) + { + TRACE(_L("COperationSynthesiseSubscriptionEvent::ProcessL() : subscriptionItem->ActivateSubscriberL( iContext )" ) ); + subscriptionItem->ActivateSubscriberL( iContext ); + subscriptionItem->SynthesiseSubscriptionEventToL( iContext, iForceEvent ); + } + else + { + TRACE(_L("COperationSynthesiseSubscriptionEvent::ProcessL() : subscriptionItem->SynthesiseSubscriptionEventToAllCtxsL" ) ); + subscriptionItem->SynthesiseSubscriptionEventToAllCtxsL(); + } + + CleanupStack::PopAndDestroy(); // subscriptionItem + iMyHost->HandleInternalRequestCompleted( iReqId, KErrNone ); + } + +// --------------------------------------------------------------------------- +// COperationSynthesiseSubscriptionEvent::RequestCompleted() +// --------------------------------------------------------------------------- +// +void COperationSynthesiseSubscriptionEvent::RequestCompletedL() + { + TRACE(_L("COperationSynthesiseSubscriptionEvent::RequestCompletedL()" ) ); + CXIMPOperationBase::RequestCompletedL(); + } + + +// --------------------------------------------------------------------------- +// COperationSynthesiseSubscriptionEvent::Type() +// --------------------------------------------------------------------------- +// +TInt + COperationSynthesiseSubscriptionEvent::Type() const + { + return NPresenceOps::EPrSynthesisePresenceSubscription; + } + + + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresenceoperations/operationsynthesisesubscriptionevent.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresenceoperations/operationsynthesisesubscriptionevent.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,91 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Internal synthesise subscription event operation + * +*/ + +#ifndef CPSCOPERATIONSYNTHESISESUBSCRIPTIONEVENT_H +#define CPSCOPERATIONSYNTHESISESUBSCRIPTIONEVENT_H + + +#include +#include + +#include "ximpoperationbase.h" +#include "presenceoperationdefs.h" + +class CXIMPIdentityImp; + +/** + * Internal synthesise own subscription event operation + * + * @lib ximpoperations.lib + * @since S60 v4.0 + */ +class COperationSynthesiseSubscriptionEvent : public CXIMPOperationBase + { + public: // Definitions + + enum TSubscriptionType + { + EOwnPresence, + EPresenceBlockList, + EPresenceGrantRequestList, + EPresenceWatcherList, + EPresentityGroupList, + EPresentityGroupContent, + EPresentityPresence, + EPresentityGroupMembersPresence, + }; + + public: + + IMPORT_C COperationSynthesiseSubscriptionEvent( TSubscriptionType aType, + TBool aForceEvent ); + + void ConstructL( const CXIMPIdentityImp& aIdentity ); + void ConstructL( const TDesC8& aParamPck ); + + ~COperationSynthesiseSubscriptionEvent(); + + + public: // from CXIMPOperationBase + + void ProcessL(); + + void RequestCompletedL(); + + TInt Type() const; + + private: // data + + /** + * Type of subscription to synthesise. + */ + TSubscriptionType iType; + + /** + * Identity for presentity presence synthetization. + */ + CXIMPIdentityImp* iIdentity; + + /** + * If event should be forced. + */ + TBool iForceEvent; + + }; + + +#endif // CPSCOPERATIONSYNTHESISESUBSCRIPTIONEVENT_H diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresenceoperations/presenceauthorization/operationblockpresenceforpresentity.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresenceoperations/presenceauthorization/operationblockpresenceforpresentity.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,150 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Block presence for presentity operation + * +*/ + + +#include +#include +#include + +#include "operationblockpresenceforpresentity.h" +#include "presenceblockinfoimp.h" +#include "ximpidentityimp.h" +#include "protocolpresenceauthorizationdatahostimp.h" +#include "ximpobjecthelpers.h" +#include "ximprestrictedobjectcollectionimp.h" +#include "ximphost.h" +#include "ximpstatusimp.h" +#include "protocolpresencedatahostimp.h" + +#include "ximptrace.h" + +// ============================ MEMBER FUNCTIONS ============================= + +// --------------------------------------------------------------------------- +// COperationBlockPresenceForPresentity::COperationBlockPresenceForPresentity() +// --------------------------------------------------------------------------- +// +EXPORT_C COperationBlockPresenceForPresentity::COperationBlockPresenceForPresentity() + { + } + + +// --------------------------------------------------------------------------- +// COperationBlockPresenceForPresentity::~COperationBlockPresenceForPresentity() +// --------------------------------------------------------------------------- +// +COperationBlockPresenceForPresentity::~COperationBlockPresenceForPresentity() + { + delete iIdentity; + delete iBlockInfo; + } + +// --------------------------------------------------------------------------- +// COperationBlockPresenceForPresentity::ConstructL() +// --------------------------------------------------------------------------- +// +void COperationBlockPresenceForPresentity::ConstructL( const TDesC8& aParamPck ) + { + // Read params. identity + RDesReadStream rs; + rs.Open( aParamPck ); // CSI: 65 # Does not return a value. + CleanupClosePushL( rs ); + + // identity + iIdentity = CXIMPIdentityImp::NewLC(); + CleanupStack::Pop( iIdentity ); + iIdentity->InternalizeL( rs ); + + CleanupStack::PopAndDestroy(); // rs + } + + +// --------------------------------------------------------------------------- +// COperationBlockPresenceForPresentity::ProcessL() +// --------------------------------------------------------------------------- +// +void COperationBlockPresenceForPresentity::ProcessL() + { + TRACE(_L("COperationBlockPresenceForPresentity::ProcessL()" ) ); + CXIMPOperationBase::ProcessL(); + + MProtocolPresenceAuthorization& authorization = + iMyHost->GetConnection().ProtocolPresenceFeatures().PresenceAuthorization(); + + authorization.DoBlockPresenceForPresentityL( *iIdentity, iReqId ); + + } + +// --------------------------------------------------------------------------- +// COperationBlockPresenceForPresentity::RequestCompleted() +// --------------------------------------------------------------------------- +// +void COperationBlockPresenceForPresentity::RequestCompletedL() + { + TRACE(_L("COperationBlockPresenceForPresentity::RequestCompletedL()" ) ); + CXIMPOperationBase::RequestCompletedL(); + + MXIMPBase* object = NULL; + iObjCollection->GetByType( object, + MPresenceBlockInfo::KInterfaceId ); + if( object ) + { + CPresenceBlockInfoImp* blockInfo = + TXIMPGetImpClassOrPanic< CPresenceBlockInfoImp >::From( *object ); + + delete iBlockInfo; + iBlockInfo = blockInfo; + } + else // If adaptation didn't return info, wrap the id inside block info + { + delete iBlockInfo; + iBlockInfo = NULL; + iBlockInfo = CPresenceBlockInfoImp::NewLC( *iIdentity, KNullDesC ); + CleanupStack::Pop(); // iBlockinfo + } + + if ( iStatusObj->ResultCode() == KErrNone ) + { + iMyHost->PresenceDataAccess().AuthorizationDataAccess().HandlePresenceBlockedL( iBlockInfo ); + iBlockInfo = NULL; + } + + SynthesiseEventL(); + } + + +// --------------------------------------------------------------------------- +// COperationBlockPresenceForPresentity::Type() +// --------------------------------------------------------------------------- +// +TInt + COperationBlockPresenceForPresentity::Type() const + { + return NPresenceOps::EPrBlockPresenceForPresentity; + } + +// --------------------------------------------------------------------------- +// COperationBlockPresenceForPresentity::SynthesiseEventL() +// --------------------------------------------------------------------------- +// +void COperationBlockPresenceForPresentity::SynthesiseEventL() + { + } + + + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresenceoperations/presenceauthorization/operationblockpresenceforpresentity.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresenceoperations/presenceauthorization/operationblockpresenceforpresentity.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,82 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Block presence for presentity operation + * +*/ + +#ifndef CPSCOPERATIONBLOCKPRESENCEFORPRESENTITY_H +#define CPSCOPERATIONBLOCKPRESENCEFORPRESENTITY_H + + +#include + +#include +#include "ximpoperationbase.h" + +#include "presenceoperationdefs.h" + +class CXIMPIdentityImp; +class CPresenceBlockInfoImp; + +/** + * Grant presence to presentity operation + * + * @lib ximpoperations.lib + * @since S60 v4.0 + */ +class COperationBlockPresenceForPresentity : public CXIMPOperationBase + { + + public: + + IMPORT_C COperationBlockPresenceForPresentity(); + + void ConstructL( const TDesC8& aParamPck ); + + ~COperationBlockPresenceForPresentity(); + + + public: // from CXIMPOperationBase + + void ProcessL(); + + void RequestCompletedL(); + + TInt Type() const; + + private: // Helper methods + + /** + * Synthesise event after completion + */ + void SynthesiseEventL(); + + private: // data + + /** + * Identity + * Own. + */ + CXIMPIdentityImp* iIdentity; + + /** + * Block info + * Own. + */ + CPresenceBlockInfoImp* iBlockInfo; + + }; + + +#endif // CPSCOPERATIONBLOCKPRESENCEFORPRESENTITY_H diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresenceoperations/presenceauthorization/operationcancelpresenceblockfrompresentity.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresenceoperations/presenceauthorization/operationcancelpresenceblockfrompresentity.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,136 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Withdraw presence from presentity + * +*/ + + +#include +#include +#include + +#include "operationcancelpresenceblockfrompresentity.h" +#include "presenceblockinfoimp.h" +#include "ximpidentityimp.h" +#include "ximpobjecthelpers.h" +#include "protocolpresenceauthorizationdatahostimp.h" +#include "ximprestrictedobjectcollectionimp.h" +#include "ximphost.h" +#include "ximpstatusimp.h" +#include "protocolpresencedatahostimp.h" + +#include "ximptrace.h" + +// ============================ MEMBER FUNCTIONS ============================= + +// --------------------------------------------------------------------------- +// COperationCancelPresenceBlockFromPresentity::COperationCancelPresenceBlockFromPresentity() +// --------------------------------------------------------------------------- +// +EXPORT_C COperationCancelPresenceBlockFromPresentity::COperationCancelPresenceBlockFromPresentity() + { + } + + +// --------------------------------------------------------------------------- +// COperationCancelPresenceBlockFromPresentity::~COperationCancelPresenceBlockFromPresentity() +// --------------------------------------------------------------------------- +// +COperationCancelPresenceBlockFromPresentity::~COperationCancelPresenceBlockFromPresentity() + { + delete iIdentity; + } + +// --------------------------------------------------------------------------- +// COperationCancelPresenceBlockFromPresentity::ConstructL() +// --------------------------------------------------------------------------- +// +void COperationCancelPresenceBlockFromPresentity::ConstructL( const TDesC8& aParamPck ) + { + iIdentity = CXIMPIdentityImp::NewLC(); + CleanupStack::Pop( iIdentity ); + TXIMPObjectPacker< CXIMPIdentityImp >::UnPackL( *iIdentity, aParamPck ); + } + + +// --------------------------------------------------------------------------- +// COperationCancelPresenceBlockFromPresentity::ProcessL() +// --------------------------------------------------------------------------- +// +void COperationCancelPresenceBlockFromPresentity::ProcessL() + { + TRACE(_L("COperationCancelPresenceBlockFromPresentity::ProcessL()" ) ); + CXIMPOperationBase::ProcessL(); + + MProtocolPresenceAuthorization& authorization = + iMyHost->GetConnection().ProtocolPresenceFeatures().PresenceAuthorization(); + + authorization.DoCancelPresenceBlockFromPresentityL( *iIdentity, iReqId ); + + } + +// --------------------------------------------------------------------------- +// COperationCancelPresenceBlockFromPresentity::RequestCompleted() +// --------------------------------------------------------------------------- +// +void COperationCancelPresenceBlockFromPresentity::RequestCompletedL() + { + TRACE(_L("COperationCancelPresenceBlockFromPresentity::RequestCompletedL()" ) ); + CXIMPOperationBase::RequestCompletedL(); + + MXIMPBase* object = NULL; + iObjCollection->GetByType( object, + MPresenceBlockInfo::KInterfaceId ); + if( object ) + { + CPresenceBlockInfoImp* blockInfo = + TXIMPGetImpClassOrPanic< CPresenceBlockInfoImp >::From( *object ); + CleanupStack::PushL( blockInfo ); + delete iIdentity; + iIdentity = NULL; + iIdentity = TXIMPObjectCloner< CXIMPIdentityImp >::CloneL( + blockInfo->IdentityImp() ); + CleanupStack::PopAndDestroy( blockInfo ); + } + + if ( iStatusObj->ResultCode() == KErrNone ) + { + iMyHost->PresenceDataAccess().AuthorizationDataAccess().HandlePresenceBlockCanceledL( iIdentity ); + iIdentity = NULL; + } + SynthesiseEventL(); + } + + +// --------------------------------------------------------------------------- +// COperationCancelPresenceBlockFromPresentity::Type() +// --------------------------------------------------------------------------- +// +TInt + COperationCancelPresenceBlockFromPresentity::Type() const + { + return NPresenceOps::EPrCancelPresenceBlockFromPresentity; + } + +// --------------------------------------------------------------------------- +// COperationCancelPresenceBlockFromPresentity::SynthesiseEventL() +// --------------------------------------------------------------------------- +// +void COperationCancelPresenceBlockFromPresentity::SynthesiseEventL() + { + } + + + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresenceoperations/presenceauthorization/operationcancelpresenceblockfrompresentity.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresenceoperations/presenceauthorization/operationcancelpresenceblockfrompresentity.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,73 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Withdraw presence from presentity + * +*/ + +#ifndef CPSCOPERATIONCANCELBLOCKFROMPRESENTITY_H +#define CPSCOPERATIONCANCELBLOCKFROMPRESENTITY_H + + +#include +#include + +#include "ximpoperationbase.h" +#include "presenceoperationdefs.h" + +class CXIMPIdentityImp; + +/** + * Withdraw presence from presentity + * + * @lib ximpoperations.lib + * @since S60 v4.0 + */ +class COperationCancelPresenceBlockFromPresentity : public CXIMPOperationBase + { + + public: + + IMPORT_C COperationCancelPresenceBlockFromPresentity(); + + void ConstructL( const TDesC8& aParamPck ); + + ~COperationCancelPresenceBlockFromPresentity(); + + + public: // from CXIMPOperationBase + + void ProcessL(); + + void RequestCompletedL(); + + TInt Type() const; + + private: // Helper methods + + /** + * Synthesise event after completion + */ + void SynthesiseEventL(); + + private: // data + + /** + * Identity + */ + CXIMPIdentityImp* iIdentity; + + }; + + +#endif // CPSCOPERATIONCANCELBLOCKFROMPRESENTITY_H diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresenceoperations/presenceauthorization/operationgrantpresencetoeveryone.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresenceoperations/presenceauthorization/operationgrantpresencetoeveryone.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,211 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Grant presence to everyone + * +*/ + + +#include +#include +#include + +#include "operationgrantpresencetoeveryone.h" +#include "presenceinfofilterimp.h" +#include "presencedatacacheimp.h" +#include "ximpobjecthelpers.h" +#include "documentutils.h" +#include "ximprestrictedobjectcollectionimp.h" +#include "ximphost.h" +#include "ximpstatusimp.h" +#include "ximppsccontextimp.h" +#include "ximppanics.h" +#include "protocolpresencedatahostimp.h" + +#include "ximptrace.h" +// ============================ MEMBER FUNCTIONS ============================= + +// --------------------------------------------------------------------------- +// COperationGrantPresenceToEveryone::COperationGrantPresenceToEveryone() +// --------------------------------------------------------------------------- +// +EXPORT_C COperationGrantPresenceToEveryone::COperationGrantPresenceToEveryone() + { + } + + +// --------------------------------------------------------------------------- +// COperationGrantPresenceToEveryone::~COperationGrantPresenceToEveryone() +// --------------------------------------------------------------------------- +// +COperationGrantPresenceToEveryone::~COperationGrantPresenceToEveryone() + { + delete iPif; + delete iMergedPif; + + if( iConfItem ) + { + iConfItem->Close(); + } + } + +// --------------------------------------------------------------------------- +// COperationGrantPresenceToEveryone::ConstructL() +// --------------------------------------------------------------------------- +// +void COperationGrantPresenceToEveryone::ConstructL( const TDesC8& aParamPck ) + { + // group id + iPif = CPresenceInfoFilterImp::NewLC(); + CleanupStack::Pop( iPif ); + TXIMPObjectPacker< CPresenceInfoFilterImp >::UnPackL( *iPif, aParamPck ); + } + + +// --------------------------------------------------------------------------- +// COperationGrantPresenceToEveryone::ProcessL() +// --------------------------------------------------------------------------- +// +void COperationGrantPresenceToEveryone::ProcessL() + { + TRACE(_L("COperationGrantPresenceToEveryone::ProcessL()" ) ); + CXIMPOperationBase::ProcessL(); + + CPresenceToEveryoneConfigurationItem& confItem = + iMyHost->PresenceDataAccess().PresenceDataCache().PresenceToEveryoneConfigurationItemLC(); + CleanupStack::Pop(); // subItem + iConfItem = &confItem; + + // Get the subscription status + iConfigurationStatus = iConfItem->ConfigurationStatus( iContext ); + + MProtocolPresenceAuthorization& authorization = + iMyHost->GetConnection().ProtocolPresenceFeatures().PresenceAuthorization(); + + switch( iConfigurationStatus ) + { + case CPresenceToEveryoneConfigurationItem::ENotConfiguredAtAll: + { + iMergedPif = TXIMPObjectCloner< CPresenceInfoFilterImp >::CloneL( *iPif ); + authorization.DoGrantPresenceForEveryoneL( *iMergedPif, iReqId ); + break; + } + case CPresenceToEveryoneConfigurationItem::EConfiguredForOtherCtxOnly: + { + // Aggregate subscription and context pifs + // Check aggregate and if needed.. update subscription + iMergedPif = DocumentUtils::InfoFilterUnionL( iConfItem->ConfigurationPif(), *iPif ); + if( iMergedPif->Contains( iConfItem->ConfigurationPif() ) ) + { + authorization.DoUpdatePresenceGrantPifForEveryoneL( *iMergedPif, iReqId ); + } + else + { + iMyHost->FakeCompleteRequest( iReqId, KErrNone ); + } + break; + } + + case CPresenceToEveryoneConfigurationItem::EConfiguredForCtxOnly: + case CPresenceToEveryoneConfigurationItem::EConfiguredForCtxAndOthers: + { + CPresenceInfoFilterImp* oldPif = + iContext->PresenceInfoFilter( MXIMPPscContext::EGrantPresenceToEveryoneFilter ); + CPresenceInfoFilterImp& oldMergedPif = iConfItem->ConfigurationPif(); + if( *oldPif != *iPif ) + { + iDoNotForce = ETrue; + CPresenceInfoFilterImp* withoutPif = + iConfItem->CollectConfigurationPifWithoutCtxL( iContext ); + iMergedPif = DocumentUtils::InfoFilterUnionL( *withoutPif, *iPif ); + } + else + { + iMergedPif = TXIMPObjectCloner< CPresenceInfoFilterImp >::CloneL( oldMergedPif ); + } + + if( iMergedPif->Contains( oldMergedPif ) ) + { + iDoNotForce = ETrue; + authorization.DoUpdatePresenceGrantPifForEveryoneL( *iMergedPif, iReqId ); + } + else + { + iMyHost->FakeCompleteRequest( iReqId, KErrNone ); + } + break; + } + + XIMP_DEFAULT_CASE_UNSUPPORTED( NXIMPPrivPanic::EInvalidSubscriptionStatus ); + } + } + +// --------------------------------------------------------------------------- +// COperationGrantPresenceToEveryone::RequestCompleted() +// --------------------------------------------------------------------------- +// +void COperationGrantPresenceToEveryone::RequestCompletedL() + { + TRACE(_L("COperationGrantPresenceToEveryone::RequestCompletedL()" ) ); + CXIMPOperationBase::RequestCompletedL(); + + if( iStatusObj->ResultCode() == KErrNone ) + { + switch( iConfigurationStatus ) + { + case CPresenceToEveryoneConfigurationItem::ENotConfiguredAtAll: + case CPresenceToEveryoneConfigurationItem::EConfiguredForOtherCtxOnly: + { + iContext->SetPresenceInfoFilterL( MXIMPPscContext::EGrantPresenceToEveryoneFilter, iPif ); + iPif = NULL; + iConfItem->SetConfigurationPif( iMergedPif ); + iMergedPif = NULL; + iConfItem->AddConfiguratorL( iContext ); + + break; + } + case CPresenceToEveryoneConfigurationItem::EConfiguredForCtxOnly: + case CPresenceToEveryoneConfigurationItem::EConfiguredForCtxAndOthers: + { + break; + } + + XIMP_DEFAULT_CASE_UNSUPPORTED( NXIMPPrivPanic::EInvalidSubscriptionStatus ); + } + + SynthesiseEventL(); + } + } + + +// --------------------------------------------------------------------------- +// COperationGrantPresenceToEveryone::Type() +// --------------------------------------------------------------------------- +// +TInt + COperationGrantPresenceToEveryone::Type() const + { + return NPresenceOps::EPrGrantPresenceToEveryone; + } + +// --------------------------------------------------------------------------- +// COperationGrantPresenceToEveryone::SynthesiseEventL() +// --------------------------------------------------------------------------- +// +void COperationGrantPresenceToEveryone::SynthesiseEventL() + { + } + + + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresenceoperations/presenceauthorization/operationgrantpresencetoeveryone.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresenceoperations/presenceauthorization/operationgrantpresencetoeveryone.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,94 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Grant presence to everyone + * +*/ + +#ifndef CPSCOPERATIONGRANTPRESENCETOEVERYONE_H +#define CPSCOPERATIONGRANTPRESENCETOEVERYONE_H + + +#include + +#include +#include "ximpoperationbase.h" +#include "presencetoeveryoneconfigurationitem.h" + +#include "presenceoperationdefs.h" + +class CXIMPIdentityImp; + +/** + * Grant presence to everyone + * + * @lib ximpoperations.lib + * @since S60 v4.0 + */ +class COperationGrantPresenceToEveryone : public CXIMPOperationBase + { + + public: + + IMPORT_C COperationGrantPresenceToEveryone(); + + void ConstructL( const TDesC8& aParamPck ); + + ~COperationGrantPresenceToEveryone(); + + + public: // from CXIMPOperationBase + + void ProcessL(); + + void RequestCompletedL(); + + TInt Type() const; + + private: // Helper methods + + /** + * Synthesise event after completion + */ + void SynthesiseEventL(); + + private: // data + + /** + * Presence information filter + */ + CPresenceInfoFilterImp* iPif; + + /** + * Merged pif with other contexts. + */ + CPresenceInfoFilterImp* iMergedPif; + + /** + * Authorization item for configuration + */ + CPresenceToEveryoneConfigurationItem* iConfItem; + + /** + * Subscription status + */ + CPresenceToEveryoneConfigurationItem::TConfigurationStatus iConfigurationStatus; + + /** + * Don't force event. + */ + TBool iDoNotForce; + }; + + +#endif // CPSCOPERATIONGRANTPRESENCETOEVERYONE_H diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresenceoperations/presenceauthorization/operationgrantpresencetopresentity.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresenceoperations/presenceauthorization/operationgrantpresencetopresentity.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,251 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Grant presence to presentity operation + * +*/ + + +#include +#include +#include + +#include "operationgrantpresencetopresentity.h" +#include "presenceinfofilterimp.h" +#include "ximpidentityimp.h" +#include "presencedatacacheimp.h" +#include "ximpobjecthelpers.h" +#include "documentutils.h" +#include "ximprestrictedobjectcollectionimp.h" +#include "ximphost.h" +#include "ximpstatusimp.h" +#include "ximppsccontextimp.h" +#include "ximppanics.h" +#include "protocolpresencedatahostimp.h" + +#include "ximptrace.h" + +// ============================ MEMBER FUNCTIONS ============================= + +// --------------------------------------------------------------------------- +// COperationGrantPresenceToPresentity::COperationGrantPresenceToPresentity() +// --------------------------------------------------------------------------- +// +EXPORT_C COperationGrantPresenceToPresentity::COperationGrantPresenceToPresentity() + { + } + + +// --------------------------------------------------------------------------- +// COperationGrantPresenceToPresentity::~COperationGrantPresenceToPresentity() +// --------------------------------------------------------------------------- +// +COperationGrantPresenceToPresentity::~COperationGrantPresenceToPresentity() + { + delete iPif; + delete iIdentity; + delete iMergedPif; + + if( iConfItem ) + { + iConfItem->Close(); + } + } + +// --------------------------------------------------------------------------- +// COperationGrantPresenceToPresentity::ConstructL() +// --------------------------------------------------------------------------- +// +void COperationGrantPresenceToPresentity::ConstructL( const TDesC8& aParamPck ) + { + // Read params. PIF and identity + RDesReadStream rs; + rs.Open( aParamPck ); // CSI: 65 # Does not return a value. + CleanupClosePushL( rs ); + + // group id + iPif = CPresenceInfoFilterImp::NewLC(); + CleanupStack::Pop( iPif ); + iPif->InternalizeL( rs ); + + // identity + iIdentity = CXIMPIdentityImp::NewLC(); + CleanupStack::Pop( iIdentity ); + iIdentity->InternalizeL( rs ); + + CleanupStack::PopAndDestroy(); // rs + } + + +// --------------------------------------------------------------------------- +// COperationGrantPresenceToPresentity::ProcessL() +// --------------------------------------------------------------------------- +// +void COperationGrantPresenceToPresentity::ProcessL() + { + TRACE(_L("COperationGrantPresenceToPresentity::ProcessL()" ) ); + CXIMPOperationBase::ProcessL(); + + CPresenceConfigurationItem& confItem = + iMyHost->PresenceDataAccess().PresenceDataCache().PresenceConfigurationItemLC( *iIdentity ); + CleanupStack::Pop(); // subItem + iConfItem = &confItem; + + // Get the subscription status + iConfigurationStatus = iConfItem->ConfigurationStatus( iContext ); + + MProtocolPresenceAuthorization& authorization = + iMyHost->GetConnection().ProtocolPresenceFeatures().PresenceAuthorization(); + + switch( iConfigurationStatus ) + { + case CPresenceConfigurationItem::ENotConfiguredAtAll: + case CPresenceConfigurationItem::EConfiguredForCtxOnly: + { + iMergedPif = TXIMPObjectCloner< CPresenceInfoFilterImp >::CloneL( *iPif ); + authorization.DoGrantPresenceForPresentityL( iConfItem->Identity(), + *iMergedPif, + iReqId ); + break; + } + case CPresenceConfigurationItem::EConfiguredForOtherCtxOnly: + { + // Aggregate subscription and context pifs + // Check aggregate and if needed.. update subscription + iMergedPif = DocumentUtils::InfoFilterUnionL( iConfItem->ConfigurationPif(), *iPif ); + if( iMergedPif->Contains( iConfItem->ConfigurationPif() ) ) + { + authorization.DoUpdatePresenceGrantPifForPresentityL( iConfItem->Identity(), + *iMergedPif, + iReqId ); + } + else + { + iMyHost->FakeCompleteRequest( iReqId, KErrNone ); + } + break; + } + //case CPresenceConfigurationItem::EConfiguredForCtxOnly: + case CPresenceConfigurationItem::EConfiguredForCtxAndOthers: + { + CPresenceInfoFilterImp* oldPif = + iContext->PresenceInfoFilter( MXIMPPscContext::EGrantPresenceToPresentityFilter, iIdentity ); + CPresenceInfoFilterImp& oldMergedPif = iConfItem->ConfigurationPif(); + TBool makeUnion( EFalse ); + if( !oldPif ) + { + TRACE(_L("COperationGrantPresenceToPresentity::ProcessL() no old pif" ) ); + makeUnion = ETrue; + } + else if ( *oldPif != *iPif ) + { + makeUnion = ETrue; + } + if( makeUnion ) + { + iDoNotForce = ETrue; + CPresenceInfoFilterImp* withoutPif = + iConfItem->CollectConfigurationPifWithoutCtxL( iContext ); + iMergedPif = DocumentUtils::InfoFilterUnionL( *withoutPif, *iPif ); + } + else + { + iMergedPif = TXIMPObjectCloner< CPresenceInfoFilterImp >::CloneL( oldMergedPif ); + } + + if( iMergedPif->Contains( oldMergedPif ) ) + { + iDoNotForce = ETrue; + authorization.DoUpdatePresenceGrantPifForPresentityL( *iIdentity, *iMergedPif, iReqId ); + } + else + { + iMyHost->FakeCompleteRequest( iReqId, KErrNone ); + } + break; + } + + XIMP_DEFAULT_CASE_UNSUPPORTED( NXIMPPrivPanic::EInvalidSubscriptionStatus ); + } + } + +// --------------------------------------------------------------------------- +// COperationGrantPresenceToPresentity::RequestCompleted() +// --------------------------------------------------------------------------- +// +void COperationGrantPresenceToPresentity::RequestCompletedL() + { + TRACE(_L("COperationGrantPresenceToPresentity::RequestCompletedL()" ) ); + CXIMPOperationBase::RequestCompletedL(); + + if( iStatusObj->ResultCode() == KErrNone ) + { + if( iConfigurationStatus == CPresenceConfigurationItem::ENotSubscribedAtAll ) + { + MXIMPBase* object = NULL; + iObjCollection->GetByType( object, MXIMPIdentity::KInterfaceId ); + if( object ) + { + delete iIdentity; + iIdentity = TXIMPGetImpClassOrPanic< CXIMPIdentityImp >::From( *object ); + + // Got altered identity. If it differs from original + // we'll create a new subscription item and close the old. + CPresenceConfigurationItem& altSubItem = + iMyHost->PresenceDataAccess().PresenceDataCache().PresenceConfigurationItemLC( *iIdentity ); + + iConfItem->Close(); + iConfItem = &altSubItem; + + CleanupStack::Pop(); // altSubItem + } + } + + if( iConfigurationStatus == CPresenceConfigurationItem::ENotSubscribedAtAll || + iConfigurationStatus == CPresenceConfigurationItem::ESubscribedForOtherCtxOnly ) + { + iConfItem->AddConfiguratorL( iContext ); + } + + iContext->SetPresenceInfoFilterL( MXIMPPscContext::EGrantPresenceToPresentityFilter, + iPif, iIdentity ); + iPif = NULL; + iConfItem->SetConfigurationPif( iMergedPif ); + iMergedPif = NULL; + + SynthesiseEventL(); + } + } + + +// --------------------------------------------------------------------------- +// COperationGrantPresenceToPresentity::Type() +// --------------------------------------------------------------------------- +// +TInt + COperationGrantPresenceToPresentity::Type() const + { + return NPresenceOps::EPrGrantPresenceToPresentity; + } + +// --------------------------------------------------------------------------- +// COperationGrantPresenceToPresentity::SynthesiseEventL() +// --------------------------------------------------------------------------- +// +void COperationGrantPresenceToPresentity::SynthesiseEventL() + { + } + + + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresenceoperations/presenceauthorization/operationgrantpresencetopresentity.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresenceoperations/presenceauthorization/operationgrantpresencetopresentity.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,99 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Grant presence to presentity operation + * +*/ + +#ifndef CPSCOPERATIONGRANTPRESENCETOPRESENTITY_H +#define CPSCOPERATIONGRANTPRESENCETOPRESENTITY_H + + +#include + +#include +#include "ximpoperationbase.h" +#include "presenceconfigurationitem.h" + +#include "presenceoperationdefs.h" + +class CXIMPIdentityImp; + +/** + * Grant presence to presentity operation + * + * @lib ximpoperations.lib + * @since S60 v4.0 + */ +class COperationGrantPresenceToPresentity : public CXIMPOperationBase + { + + public: + + IMPORT_C COperationGrantPresenceToPresentity(); + + void ConstructL( const TDesC8& aParamPck ); + + ~COperationGrantPresenceToPresentity(); + + + public: // from CXIMPOperationBase + + void ProcessL(); + + void RequestCompletedL(); + + TInt Type() const; + + private: // Helper methods + + /** + * Synthesise event after completion + */ + void SynthesiseEventL(); + + private: // data + + /** + * Presence information filter + */ + CPresenceInfoFilterImp* iPif; + + /** + * Merged pif with other contexts. + */ + CPresenceInfoFilterImp* iMergedPif; + + /** + * Identity + */ + CXIMPIdentityImp* iIdentity; + + /** + * Authorization item for configuration + */ + CPresenceConfigurationItem* iConfItem; + + /** + * Subscription status + */ + CPresenceConfigurationItem::TConfigurationStatus iConfigurationStatus; + + /** + * Don't force event. + */ + TBool iDoNotForce; + }; + + +#endif // CPSCOPERATIONGRANTPRESENCETOPRESENTITY_H diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresenceoperations/presenceauthorization/operationgrantpresencetopresentitygroupmembers.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresenceoperations/presenceauthorization/operationgrantpresencetopresentitygroupmembers.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,252 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Grant presence to presentity group members operation + * +*/ + + +#include +#include +#include + +#include "operationgrantpresencetopresentitygroupmembers.h" +#include "presenceinfofilterimp.h" +#include "ximpidentityimp.h" +#include "presencedatacacheimp.h" +#include "ximpobjecthelpers.h" +#include "documentutils.h" +#include "ximprestrictedobjectcollectionimp.h" +#include "ximphost.h" +#include "ximpstatusimp.h" +#include "ximppsccontextimp.h" +#include "ximppanics.h" +#include "protocolpresencedatahostimp.h" + +#include "ximptrace.h" +// ============================ MEMBER FUNCTIONS ============================= + +// --------------------------------------------------------------------------- +// COperationGrantPresenceToPresentityGroupMembers::COperationGrantPresenceToPresentityGroupMembers() +// --------------------------------------------------------------------------- +// +EXPORT_C COperationGrantPresenceToPresentityGroupMembers::COperationGrantPresenceToPresentityGroupMembers() + { + } + + +// --------------------------------------------------------------------------- +// COperationGrantPresenceToPresentityGroupMembers::~COperationGrantPresenceToPresentityGroupMembers() +// --------------------------------------------------------------------------- +// +COperationGrantPresenceToPresentityGroupMembers::~COperationGrantPresenceToPresentityGroupMembers() + { + delete iPif; + delete iGroupId; + delete iMergedPif; + + if( iConfItem ) + { + iConfItem->Close(); + } + } + +// --------------------------------------------------------------------------- +// COperationGrantPresenceToPresentityGroupMembers::ConstructL() +// --------------------------------------------------------------------------- +// +void COperationGrantPresenceToPresentityGroupMembers::ConstructL( const TDesC8& aParamPck ) + { + // Read params. PIF and identity + RDesReadStream rs; + rs.Open( aParamPck ); // CSI: 65 # Does not return a value. + CleanupClosePushL( rs ); + + // group id + iPif = CPresenceInfoFilterImp::NewLC(); + CleanupStack::Pop( iPif ); + iPif->InternalizeL( rs ); + + // identity + iGroupId = CXIMPIdentityImp::NewLC(); + CleanupStack::Pop( iGroupId ); + iGroupId->InternalizeL( rs ); + + CleanupStack::PopAndDestroy(); // rs + } + + +// --------------------------------------------------------------------------- +// COperationGrantPresenceToPresentityGroupMembers::ProcessL() +// --------------------------------------------------------------------------- +// +void COperationGrantPresenceToPresentityGroupMembers::ProcessL() + { + TRACE(_L("COperationGrantPresenceToPresentityGroupMembers::ProcessL()" ) ); + CXIMPOperationBase::ProcessL(); + + CGroupMembersPresenceConfigurationItem& confItem = + iMyHost->PresenceDataAccess().PresenceDataCache().GroupMembersPresenceConfigurationItemLC( *iGroupId ); + CleanupStack::Pop(); // subItem + iConfItem = &confItem; + + iConfigurationStatus = iConfItem->ConfigurationStatus( iContext ); + + MProtocolPresenceAuthorization& authorization = + iMyHost->GetConnection().ProtocolPresenceFeatures().PresenceAuthorization(); + + switch( iConfigurationStatus ) + { + case CGroupMembersPresenceConfigurationItem::ENotConfiguredAtAll: + { + iMergedPif = TXIMPObjectCloner< CPresenceInfoFilterImp >::CloneL( *iPif ); + authorization.DoGrantPresenceForPresentityGroupMembersL( *iGroupId, + *iMergedPif, + iReqId ); + break; + } + case CGroupMembersPresenceConfigurationItem::EConfiguredForOtherCtxOnly: + { + // Aggregate subscription and context pifs + // Check aggregate and if needed.. update subscription + iMergedPif = DocumentUtils::InfoFilterUnionL( iConfItem->ConfigurationPif(), *iPif ); + if( iMergedPif->Contains( iConfItem->ConfigurationPif() ) ) + { + authorization.DoUpdatePresenceGrantPifForPresentityGroupMembersL( *iGroupId, + *iMergedPif, + iReqId ); + } + else + { + iMyHost->FakeCompleteRequest( iReqId, KErrNone ); + } + break; + } + case CGroupMembersPresenceConfigurationItem::EConfiguredForCtxOnly: + case CGroupMembersPresenceConfigurationItem::EConfiguredForCtxAndOthers: + { + CPresenceInfoFilterImp* oldPif = + iContext->PresenceInfoFilter( MXIMPPscContext::EGrantPresenceToGroupMemberFilter, iGroupId ); + CPresenceInfoFilterImp& oldMergedPif = iConfItem->ConfigurationPif(); + TBool makeUnion( EFalse ); + if( !oldPif ) + { + TRACE(_L("COperationGrantPresenceToPresentityGroupMembers::ProcessL() no old pif" ) ); + makeUnion = ETrue; + } + else if ( *oldPif != *iPif ) + { + makeUnion = ETrue; + } + if( makeUnion ) + { + iDoNotForce = ETrue; + CPresenceInfoFilterImp* withoutPif = + iConfItem->CollectConfigurationPifWithoutCtxL( iContext ); + iMergedPif = DocumentUtils::InfoFilterUnionL( *withoutPif, *iPif ); + } + else + { + iMergedPif = TXIMPObjectCloner< CPresenceInfoFilterImp >::CloneL( oldMergedPif ); + } + + if( iMergedPif->Contains( oldMergedPif ) ) + { + iDoNotForce = ETrue; + authorization.DoUpdatePresenceGrantPifForPresentityGroupMembersL( *iGroupId, + *iMergedPif, + iReqId ); + } + else + { + iMyHost->FakeCompleteRequest( iReqId, KErrNone ); + } + break; + } + + XIMP_DEFAULT_CASE_UNSUPPORTED( NXIMPPrivPanic::EInvalidSubscriptionStatus ); + } + } + + +// --------------------------------------------------------------------------- +// COperationGrantPresenceToPresentityGroupMembers::RequestCompleted() +// --------------------------------------------------------------------------- +// +void COperationGrantPresenceToPresentityGroupMembers::RequestCompletedL() + { + TRACE(_L("COperationGrantPresenceToPresentityGroupMembers::RequestCompletedL()" ) ); + CXIMPOperationBase::RequestCompletedL(); + + if( iStatusObj->ResultCode() == KErrNone ) + { + + if( iConfigurationStatus == CGroupMembersPresenceConfigurationItem::ENotSubscribedAtAll ) + { + MXIMPBase* object = NULL; + iObjCollection->GetByType( object, MXIMPIdentity::KInterfaceId ); + if( object ) + { + delete iGroupId; + iGroupId = TXIMPGetImpClassOrPanic< CXIMPIdentityImp >::From( *object ); + + // Got altered identity. If it differs from original + // we'll create a new subscription item and close the old. + CGroupMembersPresenceConfigurationItem& altSubItem = + iMyHost->PresenceDataAccess().PresenceDataCache().GroupMembersPresenceConfigurationItemLC( *iGroupId ); + + iConfItem->Close(); + iConfItem = &altSubItem; + + CleanupStack::Pop(); // altSubItem + } + } + + if( iConfigurationStatus == CGroupMembersPresenceConfigurationItem::ENotSubscribedAtAll || + iConfigurationStatus == CGroupMembersPresenceConfigurationItem::ESubscribedForOtherCtxOnly ) + { + iConfItem->AddConfiguratorL( iContext ); + } + + iContext->SetPresenceInfoFilterL( MXIMPPscContext::EGrantPresenceToGroupMemberFilter, + iPif, iGroupId ); + iPif = NULL; + iConfItem->SetConfigurationPif( iMergedPif ); + iMergedPif = NULL; + + SynthesiseEventL(); + } + } + + +// --------------------------------------------------------------------------- +// COperationGrantPresenceToPresentityGroupMembers::Type() +// --------------------------------------------------------------------------- +// +TInt + COperationGrantPresenceToPresentityGroupMembers::Type() const + { + return NPresenceOps::EPrGrantPresenceToPresentityGroupMembers; + } + +// --------------------------------------------------------------------------- +// COperationGrantPresenceToPresentityGroupMembers::SynthesiseEventL() +// --------------------------------------------------------------------------- +// +void COperationGrantPresenceToPresentityGroupMembers::SynthesiseEventL() + { + } + + + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresenceoperations/presenceauthorization/operationgrantpresencetopresentitygroupmembers.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresenceoperations/presenceauthorization/operationgrantpresencetopresentitygroupmembers.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,101 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Grant presence to presentity group members operation + * +*/ + +#ifndef CPSCOPERATIONGRANTPRESENCETOPRESENTITYGROUPMEMBERS_H +#define CPSCOPERATIONGRANTPRESENCETOPRESENTITYGROUPMEMBERS_H + + +#include + +#include +#include "ximpoperationbase.h" +#include "groupmemberspresenceconfigurationitem.h" + +#include "presenceoperationdefs.h" + +class CXIMPIdentityImp; + +/** + * Grant presence to presentity group members operation + * + * @lib ximpoperations.lib + * @since S60 v4.0 + */ +class COperationGrantPresenceToPresentityGroupMembers : public CXIMPOperationBase + { + + public: + + IMPORT_C COperationGrantPresenceToPresentityGroupMembers(); + + void ConstructL( const TDesC8& aParamPck ); + + ~COperationGrantPresenceToPresentityGroupMembers(); + + + public: // from CXIMPOperationBase + + void ProcessL(); + + void RequestCompletedL(); + + TInt Type() const; + + private: // Helper methods + + /** + * Synthesise event after completion + */ + void SynthesiseEventL(); + + private: // data + + /** + * Presence information filter + */ + CPresenceInfoFilterImp* iPif; + + /** + * Identity + */ + CXIMPIdentityImp* iGroupId; + + /** + * Subscription item + */ + CGroupMembersPresenceConfigurationItem* iConfItem; + + /** + * Presence info filter having new presence info filter for context. + * Own. + */ + CPresenceInfoFilterImp* iMergedPif; + + /** + * Subscription status + */ + CGroupMembersPresenceConfigurationItem::TConfigurationStatus iConfigurationStatus; + + /** + * Don't force event. + */ + TBool iDoNotForce; + + }; + + +#endif // CPSCOPERATIONGRANTPRESENCETOPRESENTITYGROUPMEMBERS_H diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresenceoperations/presenceauthorization/operationhandlepresenceblocking.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresenceoperations/presenceauthorization/operationhandlepresenceblocking.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,173 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Handle presence blocking operations + * +*/ + + +#include "operationhandlepresenceblocking.h" +#include "ximpobjecthelpers.h" +#include "blocklistsubscriptionitem.h" +#include "presencedatacacheimp.h" +#include "presenceblockinfoimp.h" +#include "ximpidentityimp.h" +#include "ximphost.h" +#include "ximpstatusimp.h" +#include "ximppanics.h" +#include "ximprestrictedobjectcollectionimp.h" +#include "ximpobjectcollectionimp.h" +#include "protocolpresencedatahostimp.h" + +#include "ximptrace.h" +// ============================ MEMBER FUNCTIONS ============================= + +// --------------------------------------------------------------------------- +// COperationHandlePresenceBlocking::~COperationHandlePresenceBlocking() +// --------------------------------------------------------------------------- +// +COperationHandlePresenceBlocking::~COperationHandlePresenceBlocking() + { + delete iBlockList; + delete iBlocked; + delete iCanceledBlockId; + } + +// --------------------------------------------------------------------------- +// COperationHandlePresenceBlocking::COperationHandlePresenceBlocking() +// --------------------------------------------------------------------------- +// +EXPORT_C COperationHandlePresenceBlocking::COperationHandlePresenceBlocking( + TInt aMyType ) + { + iMyType = aMyType; + } + +// --------------------------------------------------------------------------- +// COperationHandlePresenceBlocking::ConstructL() +// --------------------------------------------------------------------------- +// +void COperationHandlePresenceBlocking::ConstructL( const TDesC8& /*aParamPck*/ ) + { + iBlockList = new( ELeave ) RPrBlockInfoImpArray; + } + +// --------------------------------------------------------------------------- +// COperationHandlePresenceBlocking::ProcessL() +// --------------------------------------------------------------------------- +// +void COperationHandlePresenceBlocking::ProcessL() + { + TRACE(_L("COperationHandlePresenceBlocking::ProcessL()") ); + CXIMPOperationBase::ProcessL(); + + CBlockListSubscriptionItem& subItem = + iMyHost->PresenceDataAccess().PresenceDataCache().BlockListSubscriptionItemLC(); + // clean out temporary lists + subItem.Clean(); + + switch ( iMyType ) + { + case NPresenceOps::EPrHandlePresenceBlockList: + { + MXIMPBase* object = NULL; + iObjCollection->GetByType( object, MXIMPObjectCollection::KInterfaceId ); + if( object ) + { + CXIMPObjectCollectionImp* objectCollection = + TXIMPGetImpClassOrPanic< CXIMPObjectCollectionImp >::From( *object ); + CleanupStack::PushL( objectCollection ); + TLinearOrder< CPresenceBlockInfoImp > order( CPresenceBlockInfoImp::IdLinearOrder ); + TXIMPObjectMover< MPresenceBlockInfo, CPresenceBlockInfoImp >:: + MoveFromCollectionToArrayL( *objectCollection, *iBlockList, order ); + CleanupStack::PopAndDestroy( objectCollection ); + } + else + { + User::Leave( KErrArgument ); + } + + subItem.SetNewListL( iBlockList ); + iBlockList = NULL; + break; + } + + case NPresenceOps::EPrHandlePresenceBlocked: + { + MXIMPBase* object = NULL; + iObjCollection->GetByType( object, MPresenceBlockInfo::KInterfaceId ); + if( object ) + { + iBlocked = TXIMPGetImpClassOrPanic< CPresenceBlockInfoImp >::From( *object ); + } + else + { + User::Leave( KErrArgument ); + } + subItem.SetBlockedL( iBlocked ); + iBlocked = NULL; // ownership was transferred + break; + } + + case NPresenceOps::EPrHandlePresenceBlockCanceled: + { + MXIMPBase* object = NULL; + iObjCollection->GetByType( object, MXIMPIdentity::KInterfaceId ); + if( object ) + { + iCanceledBlockId = TXIMPGetImpClassOrPanic< CXIMPIdentityImp >::From( *object ); + } + else + { + User::Leave( KErrArgument ); + } + subItem.SetCanceledBlockIdL( iCanceledBlockId ); + iCanceledBlockId = NULL; // ownership was transferred + break; + } + + XIMP_DEFAULT_CASE_UNSUPPORTED( NXIMPPrivPanic::EInvalidOperationType ); + } + + // synthesize the event to all contexts + TRAPD( err, subItem.SynthesiseSubscriptionEventToAllCtxsL() ); + + CleanupStack::PopAndDestroy(); // subItem + + err = KErrNone; + iMyHost->HandleAdaptationRequestCompleted( iReqId, err ); + } + +// --------------------------------------------------------------------------- +// COperationHandlePresenceBlocking::RequestCompleted() +// --------------------------------------------------------------------------- +// +void COperationHandlePresenceBlocking::RequestCompletedL() + { + TRACE(_L("COperationHandlePresenceBlocking::RequestCompletedL()" ) ); + CXIMPOperationBase::RequestCompletedL(); + + // no special handling for error situations + } + + +// --------------------------------------------------------------------------- +// COperationHandlePresenceBlocking::Type() +// --------------------------------------------------------------------------- +// +TInt COperationHandlePresenceBlocking::Type() const + { + return iMyType; + } + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresenceoperations/presenceauthorization/operationhandlepresenceblocking.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresenceoperations/presenceauthorization/operationhandlepresenceblocking.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,86 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Handle presence blocking operations + * +*/ + +#ifndef CPSCOPERATIONHANDLEPRESENCEBLOCKING_H +#define CPSCOPERATIONHANDLEPRESENCEBLOCKING_H + + +#include +#include + +#include "ximpoperationbase.h" +#include "presencetypehelpers.h" +#include "presenceoperationdefs.h" + +class CXIMPIdentityImp; + +/** + * Handle presentity group related operations. + * + * @lib ximpoperations.lib + * @since S60 v4.0 + */ +class COperationHandlePresenceBlocking : public CXIMPOperationBase + { + + public: + + IMPORT_C COperationHandlePresenceBlocking( + TInt aMyType ); + + void ConstructL( const TDesC8& aParamPck ); + + ~COperationHandlePresenceBlocking(); + + public: // from CXIMPOperationBase + + void ProcessL(); + + void RequestCompletedL(); + + TInt Type() const; + + private: // data + + /** + * Array blocked presentities. + * Owned. + */ + RPrBlockInfoImpArray* iBlockList; + + /** + * Blocked presentity + * Owned. + */ + CPresenceBlockInfoImp* iBlocked; + + /** + * Canceled block presentity + * Owned. + */ + CXIMPIdentityImp* iCanceledBlockId; + + /** + * This is an internal and polymorphic operation. + * The actual type will be defined by this variable, + * set during operation creation. + */ + TInt iMyType; + }; + + +#endif // CPSCOPERATIONHANDLEPRESENCEBLOCKING_H diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresenceoperations/presenceauthorization/operationhandlepresencegrantrequests.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresenceoperations/presenceauthorization/operationhandlepresencegrantrequests.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,173 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: handle of operational grant presence request + * +*/ + + +#include "operationhandlepresencegrantrequests.h" +#include "ximpobjecthelpers.h" +#include "grantrequestlistsubscriptionitem.h" +#include "presencedatacacheimp.h" +#include "presencegrantrequestinfoimp.h" +#include "ximpidentityimp.h" +#include "ximphost.h" +#include "ximpstatusimp.h" +#include "ximppanics.h" +#include "ximprestrictedobjectcollectionimp.h" +#include "ximpobjectcollectionimp.h" +#include "protocolpresencedatahostimp.h" + +#include "ximptrace.h" +// ============================ MEMBER FUNCTIONS ============================= + +// --------------------------------------------------------------------------- +// COperationHandlePresenceGrantRequests::~COperationHandlePresenceGrantRequests() +// --------------------------------------------------------------------------- +// +COperationHandlePresenceGrantRequests::~COperationHandlePresenceGrantRequests() + { + delete iGrantReqList; + delete iObsoletedId; + delete iReceivedReq; + } + +// --------------------------------------------------------------------------- +// COperationHandlePresenceGrantRequests::COperationHandlePresenceGrantRequests() +// --------------------------------------------------------------------------- +// +EXPORT_C COperationHandlePresenceGrantRequests::COperationHandlePresenceGrantRequests( + TInt aMyType ) + { + iMyType = aMyType; + } + +// --------------------------------------------------------------------------- +// COperationHandlePresenceGrantRequests::ConstructL() +// --------------------------------------------------------------------------- +// +void COperationHandlePresenceGrantRequests::ConstructL( const TDesC8& /*aParamPck*/ ) + { + iGrantReqList = new( ELeave ) RPrGrntReqInfoImpArray; + } + +// --------------------------------------------------------------------------- +// COperationHandlePresenceGrantRequests::ProcessL() +// --------------------------------------------------------------------------- +// +void COperationHandlePresenceGrantRequests::ProcessL() + { + TRACE(_L("COperationHandlePresenceGrantRequests::ProcessL()") ); + CXIMPOperationBase::ProcessL(); + + CGrantRequestListSubscriptionItem& subItem = + iMyHost->PresenceDataAccess().PresenceDataCache().GrantRequestListSubscriptionItemLC(); + // clean out temporary lists + subItem.Clean(); + switch ( iMyType ) + { + case NPresenceOps::EPrHandlePresenceGrantRequestList: + { + MXIMPBase* object = NULL; + iObjCollection->GetByType( object, MXIMPObjectCollection::KInterfaceId ); + if( object ) + { + CXIMPObjectCollectionImp* objectCollection = + TXIMPGetImpClassOrPanic< CXIMPObjectCollectionImp >::From( *object ); + CleanupStack::PushL( objectCollection ); + TLinearOrder< CPresenceGrantRequestInfoImp > order( CPresenceGrantRequestInfoImp::IdLinearOrder ); + TXIMPObjectMover< MPresenceGrantRequestInfo, CPresenceGrantRequestInfoImp >:: + MoveFromCollectionToArrayL( *objectCollection, *iGrantReqList, order ); + CleanupStack::PopAndDestroy( objectCollection ); + } + else + { + User::Leave( KErrArgument ); + } + subItem.SetNewListL( iGrantReqList ); + iGrantReqList = NULL; + // ownership was transferred + break; + } + + case NPresenceOps::EPrHandlePresenceGrantRequestReceived: + { + MXIMPBase* object = NULL; + iObjCollection->GetByType( object, MPresenceGrantRequestInfo::KInterfaceId ); + if( object ) + { + iReceivedReq = + TXIMPGetImpClassOrPanic< CPresenceGrantRequestInfoImp >::From( *object ); + } + else + { + User::Leave( KErrArgument ); + } + subItem.SetReceivedRequestL( iReceivedReq ); + iReceivedReq = NULL; // ownership was transferred + break; + } + + case NPresenceOps::EPrHandlePresenceGrantRequestObsoleted: + { + MXIMPBase* object = NULL; + iObjCollection->GetByType( object, MXIMPIdentity::KInterfaceId ); + if( object ) + { + iObsoletedId = TXIMPGetImpClassOrPanic< CXIMPIdentityImp >::From( *object ); + } + else + { + User::Leave( KErrArgument ); + } + subItem.SetObsoletedRequestL( iObsoletedId ); + iObsoletedId = NULL; // ownership was transferred + break; + } + + XIMP_DEFAULT_CASE_UNSUPPORTED( NXIMPPrivPanic::EInvalidOperationType ); + } + + // synthesize the event to all contexts + TRAPD( err, subItem.SynthesiseSubscriptionEventToAllCtxsL() ); + + CleanupStack::PopAndDestroy(); // subItem + + err = KErrNone; + iMyHost->HandleAdaptationRequestCompleted( iReqId, err ); + } + +// --------------------------------------------------------------------------- +// COperationHandlePresenceGrantRequests::RequestCompleted() +// --------------------------------------------------------------------------- +// +void COperationHandlePresenceGrantRequests::RequestCompletedL() + { + TRACE(_L("COperationHandlePresenceGrantRequests::RequestCompletedL()" ) ); + CXIMPOperationBase::RequestCompletedL(); + + // no special handling for error situations + } + + +// --------------------------------------------------------------------------- +// COperationHandlePresenceGrantRequests::Type() +// --------------------------------------------------------------------------- +// +TInt COperationHandlePresenceGrantRequests::Type() const + { + return iMyType; + } + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresenceoperations/presenceauthorization/operationhandlepresencegrantrequests.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresenceoperations/presenceauthorization/operationhandlepresencegrantrequests.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,84 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Handle presentity group list operations + * +*/ + +#ifndef CPSCOPERATIONHANDLEPRESENCEGRANTREQUESTS_H +#define CPSCOPERATIONHANDLEPRESENCEGRANTREQUESTS_H + + +#include +#include + +#include "ximpoperationbase.h" +#include "presencetypehelpers.h" +#include "presenceoperationdefs.h" + +/** + * Handle presentity group related operations. + * + * @lib ximpoperations.lib + * @since S60 v4.0 + */ +class COperationHandlePresenceGrantRequests : public CXIMPOperationBase + { + + public: + + IMPORT_C COperationHandlePresenceGrantRequests( + TInt aMyType ); + + void ConstructL( const TDesC8& aParamPck ); + + ~COperationHandlePresenceGrantRequests(); + + public: // from CXIMPOperationBase + + void ProcessL(); + + void RequestCompletedL(); + + TInt Type() const; + + private: // data + + /** + * Array of group identities. + * Owned. + */ + RPrGrntReqInfoImpArray* iGrantReqList; + + /** + * Obsoleted + * Owned. + */ + CXIMPIdentityImp* iObsoletedId; + + /** + * Received request + * Owned. + */ + CPresenceGrantRequestInfoImp* iReceivedReq; + + /** + * This is an internal and polymorphic operation. + * The actual type will be defined by this variable, + * set during operation creation. + */ + TInt iMyType; + }; + + +#endif // CPSCOPERATIONHANDLEPRESENCEGRANTREQUESTS_H diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresenceoperations/presenceauthorization/operationsubscribeblocklist.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresenceoperations/presenceauthorization/operationsubscribeblocklist.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,170 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Presence block list subscribe operation + * +*/ + +#include +#include +#include + +#include "operationsubscribeblocklist.h" +#include "presencedatacacheimp.h" +#include "ximppanics.h" +#include "operationsynthesisesubscriptionevent.h" +#include "ximphost.h" +#include "ximpstatusimp.h" +#include "ximppsccontextimp.h" +#include "protocolpresencedatahostimp.h" + +#include "ximptrace.h" + + +// ============================ MEMBER FUNCTIONS ============================= + +// --------------------------------------------------------------------------- +// COperationSubscribeBlockList::COperationSubscribeBlockList() +// --------------------------------------------------------------------------- +// +EXPORT_C COperationSubscribeBlockList::COperationSubscribeBlockList() + { + } + + +// --------------------------------------------------------------------------- +// COperationSubscribeBlockList::~COperationSubscribeBlockList() +// --------------------------------------------------------------------------- +// +COperationSubscribeBlockList::~COperationSubscribeBlockList() + { + if( iBlockList ) + { + iBlockList->Close(); + } + } + +// --------------------------------------------------------------------------- +// COperationSubscribeBlockList::ConstructL() +// --------------------------------------------------------------------------- +// +void COperationSubscribeBlockList::ConstructL( const TDesC8& /*aParamPck*/ ) + { + } + + +// --------------------------------------------------------------------------- +// COperationSubscribeBlockList::ProcessL() +// --------------------------------------------------------------------------- +// +void COperationSubscribeBlockList::ProcessL() + { + TRACE(_L("COperationSubscribeBlockList::ProcessL()" ) ); + CXIMPOperationBase::ProcessL(); + + CBlockListSubscriptionItem& subItem = + iMyHost->PresenceDataAccess().PresenceDataCache().BlockListSubscriptionItemLC(); + CleanupStack::Pop(); // subItem + iBlockList = &subItem; + + iSubscriptionStatus = iBlockList->SubscriptionStatus( iContext ); + + MProtocolPresenceAuthorization& authorization = iMyHost->GetConnection().ProtocolPresenceFeatures().PresenceAuthorization(); + + switch( iSubscriptionStatus ) + { + case CBlockListSubscriptionItem::ENotSubscribedAtAll: + { + authorization.DoSubscribePresenceBlockListL( iReqId ); + break; + } + + case CBlockListSubscriptionItem::ESubscribedForOtherCtxOnly: + case CBlockListSubscriptionItem::ESubscribedForCtxOnly: + case CBlockListSubscriptionItem::ESubscribedForCtxAndOthers: + { + iMyHost->FakeCompleteRequest( iReqId, KErrNone ); + break; + } + + XIMP_DEFAULT_CASE_UNSUPPORTED( NXIMPPrivPanic::EInvalidSubscriptionStatus ); + } + } + + +// --------------------------------------------------------------------------- +// COperationSubscribeBlockList::RequestCompleted() +// --------------------------------------------------------------------------- +// +void COperationSubscribeBlockList::RequestCompletedL() + { + TRACE(_L("COperationSubscribeBlockList::RequestCompletedL()" ) ); + CXIMPOperationBase::RequestCompletedL(); + + if( iStatusObj->ResultCode() == KErrNone ) + { + switch( iSubscriptionStatus ) + { + case CBlockListSubscriptionItem::ENotSubscribedAtAll: + case CBlockListSubscriptionItem::ESubscribedForOtherCtxOnly: + { + iBlockList->AddSubscriberL( iContext ); + break; + } + + case CBlockListSubscriptionItem::ESubscribedForCtxOnly: + case CBlockListSubscriptionItem::ESubscribedForCtxAndOthers: + { + break; + } + + XIMP_DEFAULT_CASE_UNSUPPORTED( NXIMPPrivPanic::EInvalidSubscriptionStatus ); + } + SynthesiseEventL(); + } + } + + +// --------------------------------------------------------------------------- +// COperationSubscribeBlockList::Type() +// --------------------------------------------------------------------------- +// +TInt + COperationSubscribeBlockList::Type() const + { + return NPresenceOps::EPrSubscribeBlockList; + } + +// --------------------------------------------------------------------------- +// COperationSubscribeBlockList::SynthesiseEventL() +// --------------------------------------------------------------------------- +// +void COperationSubscribeBlockList::SynthesiseEventL() + { + TBool force = + ( iSubscriptionStatus == CBlockListSubscriptionItem::ESubscribedForCtxOnly || + iSubscriptionStatus == CBlockListSubscriptionItem::ESubscribedForCtxAndOthers ) ? ETrue : EFalse; + + COperationSynthesiseSubscriptionEvent* synthOp = + new ( ELeave ) COperationSynthesiseSubscriptionEvent( + COperationSynthesiseSubscriptionEvent::EPresenceBlockList, + force ); + CleanupStack::PushL( synthOp ); + synthOp->BaseConstructL( TXIMPRequestId(), iContext ); + iMyHost->AddNewOperationL( *synthOp ); + CleanupStack::Pop( synthOp ); + } + + + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresenceoperations/presenceauthorization/operationsubscribeblocklist.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresenceoperations/presenceauthorization/operationsubscribeblocklist.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,79 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Presence block list subscribe operation + * +*/ + +#ifndef CPSCOPERATIONSUBSCRIBEBLOCKLIST_H +#define CPSCOPERATIONSUBSCRIBEBLOCKLIST_H + + +#include + +#include "ximpbase.h" +#include "ximpoperationbase.h" +#include "blocklistsubscriptionitem.h" + +#include "presenceoperationdefs.h" + +class MXIMPHost; + +/** + * Presence grant request list subscribe operation. + * + * @lib ximpoperations.lib + * @since S60 v4.0 + */ +class COperationSubscribeBlockList : public CXIMPOperationBase + { + + public: + + IMPORT_C COperationSubscribeBlockList(); + + void ConstructL( const TDesC8& aParamPck ); + + ~COperationSubscribeBlockList(); + + + public: // from CXIMPOperationBase + + void ProcessL(); + + void RequestCompletedL(); + + TInt Type() const; + + private: // Helper methods + + /** + * Synthesise event after completion + */ + void SynthesiseEventL(); + + private: // data + + /** + * Grant request list access. + */ + CBlockListSubscriptionItem* iBlockList; + + /** + * Subscription status + */ + CBlockListSubscriptionItem::TSubscriptionStatus iSubscriptionStatus; + }; + + +#endif // CPSCOPERATIONSUBSCRIBEBLOCKLIST_H diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresenceoperations/presenceauthorization/operationsubscribegrantrequestlist.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresenceoperations/presenceauthorization/operationsubscribegrantrequestlist.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,167 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Presence grant request list subscribe operation + * +*/ + + +#include +#include +#include + +#include "operationsubscribegrantrequestlist.h" +#include "presencedatacacheimp.h" +#include "ximppanics.h" +#include "operationsynthesisesubscriptionevent.h" +#include "ximphost.h" +#include "ximpstatusimp.h" +#include "ximppsccontextimp.h" +#include "protocolpresencedatahostimp.h" + +#include "ximptrace.h" +// ============================ MEMBER FUNCTIONS ============================= + +// --------------------------------------------------------------------------- +// COperationSubscribeGrantRequestList::COperationSubscribeGrantRequestList() +// --------------------------------------------------------------------------- +// +EXPORT_C COperationSubscribeGrantRequestList::COperationSubscribeGrantRequestList() + { + } + + +// --------------------------------------------------------------------------- +// COperationSubscribeGrantRequestList::~COperationSubscribeGrantRequestList() +// --------------------------------------------------------------------------- +// +COperationSubscribeGrantRequestList::~COperationSubscribeGrantRequestList() + { + if( iGrantRequestList ) + { + iGrantRequestList->Close(); + } + } + +// --------------------------------------------------------------------------- +// COperationSubscribeGrantRequestList::ConstructL() +// --------------------------------------------------------------------------- +// +void COperationSubscribeGrantRequestList::ConstructL( const TDesC8& /*aParamPck*/ ) + { + } + + +// --------------------------------------------------------------------------- +// COperationSubscribeGrantRequestList::ProcessL() +// --------------------------------------------------------------------------- +// +void COperationSubscribeGrantRequestList::ProcessL() + { + TRACE(_L("COperationSubscribeGrantRequestList::ProcessL()" ) ); + CXIMPOperationBase::ProcessL(); + + CGrantRequestListSubscriptionItem& grantReqList = + iMyHost->PresenceDataAccess().PresenceDataCache().GrantRequestListSubscriptionItemLC(); + CleanupStack::Pop(); // grantReqList + iGrantRequestList = &grantReqList; + + iSubscriptionStatus = iGrantRequestList->SubscriptionStatus( iContext ); + MProtocolPresenceAuthorization& authorization = iMyHost->GetConnection().ProtocolPresenceFeatures().PresenceAuthorization(); + + switch( iSubscriptionStatus ) + { + case CGrantRequestListSubscriptionItem::ENotSubscribedAtAll: + { + authorization.DoSubscribePresenceGrantRequestListL( iReqId ); + break; + } + case CGrantRequestListSubscriptionItem::ESubscribedForOtherCtxOnly: + case CGrantRequestListSubscriptionItem::ESubscribedForCtxOnly: + case CGrantRequestListSubscriptionItem::ESubscribedForCtxAndOthers: + { + iMyHost->FakeCompleteRequest( iReqId, KErrNone ); + break; + } + + XIMP_DEFAULT_CASE_UNSUPPORTED( NXIMPPrivPanic::EInvalidSubscriptionStatus ); + } + } + + +// --------------------------------------------------------------------------- +// COperationSubscribeGrantRequestList::RequestCompleted() +// --------------------------------------------------------------------------- +// +void COperationSubscribeGrantRequestList::RequestCompletedL() + { + TRACE(_L("COperationSubscribeGrantRequestList::RequestCompletedL()" ) ); + CXIMPOperationBase::RequestCompletedL(); + + if( iStatusObj->ResultCode() == KErrNone ) + { + switch( iSubscriptionStatus ) + { + case CGrantRequestListSubscriptionItem::ENotSubscribedAtAll: + case CGrantRequestListSubscriptionItem::ESubscribedForOtherCtxOnly: + { + iGrantRequestList->AddSubscriberL( iContext ); + break; + } + case CGrantRequestListSubscriptionItem::ESubscribedForCtxOnly: + case CGrantRequestListSubscriptionItem::ESubscribedForCtxAndOthers: + { + break; + } + + XIMP_DEFAULT_CASE_UNSUPPORTED( NXIMPPrivPanic::EInvalidSubscriptionStatus ); + } + + SynthesiseEventL(); + } + } + + +// --------------------------------------------------------------------------- +// COperationSubscribeGrantRequestList::Type() +// --------------------------------------------------------------------------- +// +TInt + COperationSubscribeGrantRequestList::Type() const + { + return NPresenceOps::EPrSubscribePresenceGrantRequestList; + } + +// --------------------------------------------------------------------------- +// COperationSubscribeGrantRequestList::SynthesiseEventL() +// --------------------------------------------------------------------------- +// +void COperationSubscribeGrantRequestList::SynthesiseEventL() + { + TBool force = + ( iSubscriptionStatus == CGrantRequestListSubscriptionItem::ESubscribedForCtxOnly || + iSubscriptionStatus == CGrantRequestListSubscriptionItem::ESubscribedForCtxAndOthers ) ? ETrue : EFalse; + + COperationSynthesiseSubscriptionEvent* synthOp = + new ( ELeave ) COperationSynthesiseSubscriptionEvent( + COperationSynthesiseSubscriptionEvent::EPresenceGrantRequestList, + force ); + CleanupStack::PushL( synthOp ); + synthOp->BaseConstructL( TXIMPRequestId(), iContext ); + iMyHost->AddNewOperationL( *synthOp ); + CleanupStack::Pop( synthOp ); + } + + + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresenceoperations/presenceauthorization/operationsubscribegrantrequestlist.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresenceoperations/presenceauthorization/operationsubscribegrantrequestlist.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,76 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Presence grant request list subscribe operation + * +*/ + +#ifndef CPSCOPERATIONSUBSCRIBEGRANTREQUESTLIST_H +#define CPSCOPERATIONSUBSCRIBEGRANTREQUESTLIST_H + + +#include +#include + +#include "ximpoperationbase.h" +#include "grantrequestlistsubscriptionitem.h" +#include "presenceoperationdefs.h" + +/** + * Presence grant request list subscribe operation. + * + * @lib ximpoperations.lib + * @since S60 v4.0 + */ +class COperationSubscribeGrantRequestList : public CXIMPOperationBase + { + + public: + + IMPORT_C COperationSubscribeGrantRequestList(); + + void ConstructL( const TDesC8& aParamPck ); + + ~COperationSubscribeGrantRequestList(); + + + public: // from CXIMPOperationBase + + void ProcessL(); + + void RequestCompletedL(); + + TInt Type() const; + + private: // Helper methods + + /** + * Synthesise event after completion + */ + void SynthesiseEventL(); + + private: // data + + /** + * Grant request list access. + */ + CGrantRequestListSubscriptionItem* iGrantRequestList; + + /** + * Subscription status + */ + CGrantRequestListSubscriptionItem::TSubscriptionStatus iSubscriptionStatus; + }; + + +#endif // CPSCOPERATIONSUBSCRIBEGRANTREQUESTLIST_H diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresenceoperations/presenceauthorization/operationunsubscribeblocklist.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresenceoperations/presenceauthorization/operationunsubscribeblocklist.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,170 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Presence block list unsubscription operation + * +*/ + + +#include +#include +#include + +#include "operationunsubscribeblocklist.h" +#include "presencedatacacheimp.h" +#include "ximppanics.h" +#include "operationsynthesisesubscriptionevent.h" +#include "ximphost.h" +#include "ximpstatusimp.h" +#include "ximppsccontextimp.h" +#include "protocolpresencedatahostimp.h" + +#include "ximptrace.h" + +// ============================ MEMBER FUNCTIONS ============================= + +// --------------------------------------------------------------------------- +// COperationUnsubscribeBlockList::COperationUnsubscribeBlockList() +// --------------------------------------------------------------------------- +// +EXPORT_C COperationUnsubscribeBlockList::COperationUnsubscribeBlockList() + { + } + + +// --------------------------------------------------------------------------- +// COperationUnsubscribeBlockList::~COperationUnsubscribeBlockList() +// --------------------------------------------------------------------------- +// +COperationUnsubscribeBlockList::~COperationUnsubscribeBlockList() + { + if( iBlockList ) + { + iBlockList->Close(); + } + } + +// --------------------------------------------------------------------------- +// COperationUnsubscribeBlockList::ConstructL() +// --------------------------------------------------------------------------- +// +void COperationUnsubscribeBlockList::ConstructL( const TDesC8& /*aParamPck*/ ) + { + } + + +// --------------------------------------------------------------------------- +// COperationUnsubscribeBlockList::ProcessL() +// --------------------------------------------------------------------------- +// +void COperationUnsubscribeBlockList::ProcessL() + { + TRACE(_L("COperationUnsubscribeBlockList::ProcessL()" ) ); + CXIMPOperationBase::ProcessL(); + + CBlockListSubscriptionItem& subItem = + iMyHost->PresenceDataAccess().PresenceDataCache().BlockListSubscriptionItemLC(); + CleanupStack::Pop(); // subItem + iBlockList = &subItem; + + iSubscriptionStatus = iBlockList->SubscriptionStatus( iContext ); + + MProtocolPresenceAuthorization& authorization = iMyHost->GetConnection().ProtocolPresenceFeatures().PresenceAuthorization(); + + + switch( iSubscriptionStatus ) + { + case CBlockListSubscriptionItem::ESubscribedForCtxOnly: + { + authorization.DoUnsubscribePresenceBlockListL( iReqId ); + break; + } + + case CBlockListSubscriptionItem::ESubscribedForCtxAndOthers: + { + iMyHost->FakeCompleteRequest( iReqId, KErrNone ); + break; + } + + case CBlockListSubscriptionItem::ENotSubscribedAtAll: + case CBlockListSubscriptionItem::ESubscribedForOtherCtxOnly: + { + iMyHost->FakeCompleteRequest( iReqId, KErrNone ); + break; + } + + XIMP_DEFAULT_CASE_UNSUPPORTED( NXIMPPrivPanic::EInvalidSubscriptionStatus ); + } + } + + +// --------------------------------------------------------------------------- +// COperationUnsubscribeBlockList::RequestCompleted() +// --------------------------------------------------------------------------- +// +void COperationUnsubscribeBlockList::RequestCompletedL() + { + TRACE(_L("COperationUnsubscribeBlockList::RequestCompletedL()" ) ); + CXIMPOperationBase::RequestCompletedL(); + + if( iStatusObj->ResultCode() == KErrNone ) + { + switch( iSubscriptionStatus ) + { + case CBlockListSubscriptionItem::ESubscribedForCtxOnly: + case CBlockListSubscriptionItem::ESubscribedForCtxAndOthers: + { + iBlockList->RemoveSubscriber( iContext ); + break; + } + case CBlockListSubscriptionItem::ENotSubscribedAtAll: + case CBlockListSubscriptionItem::ESubscribedForOtherCtxOnly: + { + break; + } + + XIMP_DEFAULT_CASE_UNSUPPORTED( NXIMPPrivPanic::EInvalidSubscriptionStatus ); + } + SynthesiseEventL(); + } + } + + +// --------------------------------------------------------------------------- +// COperationUnsubscribeBlockList::Type() +// --------------------------------------------------------------------------- +// +TInt + COperationUnsubscribeBlockList::Type() const + { + return NPresenceOps::EPrUnsubscribeBlockList; + } + +// --------------------------------------------------------------------------- +// COperationUnsubscribeBlockList::SynthesiseEventL() +// --------------------------------------------------------------------------- +// +void COperationUnsubscribeBlockList::SynthesiseEventL() + { + COperationSynthesiseSubscriptionEvent* synthOp = + new ( ELeave ) COperationSynthesiseSubscriptionEvent( + COperationSynthesiseSubscriptionEvent::EPresenceBlockList, + EFalse ); + CleanupStack::PushL( synthOp ); + synthOp->BaseConstructL( TXIMPRequestId(), iContext ); + iMyHost->AddNewOperationL( *synthOp ); + CleanupStack::Pop( synthOp ); + } + + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresenceoperations/presenceauthorization/operationunsubscribeblocklist.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresenceoperations/presenceauthorization/operationunsubscribeblocklist.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,78 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Presence block list unsubscription operation + * +*/ + +#ifndef CPSCOPERATIONUNSUBSCRIBEBLOCKLIST_H +#define CPSCOPERATIONUNSUBSCRIBEBLOCKLIST_H + + +#include + +#include "ximpbase.h" +#include "ximpoperationbase.h" +#include "blocklistsubscriptionitem.h" + +#include "presenceoperationdefs.h" + +class MXIMPHost; + +/** + * Presence grant request list unsubscribe operation. + * + * @lib ximpoperations.lib + * @since S60 v4.0 + */ +class COperationUnsubscribeBlockList : public CXIMPOperationBase + { + public: + + IMPORT_C COperationUnsubscribeBlockList(); + + void ConstructL( const TDesC8& aParamPck ); + + ~COperationUnsubscribeBlockList(); + + + public: // from CXIMPOperationBase + + void ProcessL(); + + void RequestCompletedL(); + + TInt Type() const; + + private: // Helper methods + + /** + * Synthesise event after completion + */ + void SynthesiseEventL(); + + private: // data + + /** + * Group list access. + */ + CBlockListSubscriptionItem* iBlockList; + + /** + * Subscription status + */ + CBlockListSubscriptionItem::TSubscriptionStatus iSubscriptionStatus; + }; + + +#endif // CPSCOPERATIONUNSUBSCRIBEBLOCKLIST_H diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresenceoperations/presenceauthorization/operationunsubscribegrantrequestlist.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresenceoperations/presenceauthorization/operationunsubscribegrantrequestlist.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,167 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Presence grant request list unsubscription operation + * +*/ + + +#include +#include +#include + +#include "operationunsubscribegrantrequestlist.h" +#include "presencedatacacheimp.h" +#include "ximppanics.h" +#include "operationsynthesisesubscriptionevent.h" +#include "ximphost.h" +#include "ximpstatusimp.h" +#include "ximppsccontextimp.h" +#include "protocolpresencedatahostimp.h" + +#include "ximptrace.h" +// ============================ MEMBER FUNCTIONS ============================= + +// --------------------------------------------------------------------------- +// COperationUnsubscribeGrantRequestList::COperationUnsubscribeGrantRequestList() +// --------------------------------------------------------------------------- +// +EXPORT_C COperationUnsubscribeGrantRequestList::COperationUnsubscribeGrantRequestList() + { + } + + +// --------------------------------------------------------------------------- +// COperationUnsubscribeGrantRequestList::~COperationUnsubscribeGrantRequestList() +// --------------------------------------------------------------------------- +// +COperationUnsubscribeGrantRequestList::~COperationUnsubscribeGrantRequestList() + { + if( iGrantRequestList ) + { + iGrantRequestList->Close(); + } + } + +// --------------------------------------------------------------------------- +// COperationUnsubscribeGrantRequestList::ConstructL() +// --------------------------------------------------------------------------- +// +void COperationUnsubscribeGrantRequestList::ConstructL( const TDesC8& /*aParamPck*/ ) + { + } + + +// --------------------------------------------------------------------------- +// COperationUnsubscribeGrantRequestList::ProcessL() +// --------------------------------------------------------------------------- +// +void COperationUnsubscribeGrantRequestList::ProcessL() + { + TRACE(_L("COperationUnsubscribeGrantRequestList::ProcessL()" ) ); + CXIMPOperationBase::ProcessL(); + + CGrantRequestListSubscriptionItem& grantReqList = + iMyHost->PresenceDataAccess().PresenceDataCache().GrantRequestListSubscriptionItemLC(); + CleanupStack::Pop(); // grantReqList + iGrantRequestList = &grantReqList; + + iSubscriptionStatus = iGrantRequestList->SubscriptionStatus( iContext ); + + MProtocolPresenceAuthorization& authorization = iMyHost->GetConnection().ProtocolPresenceFeatures().PresenceAuthorization(); + + switch( iSubscriptionStatus ) + { + case CGrantRequestListSubscriptionItem::ESubscribedForCtxOnly: + { + authorization.DoUnsubscribePresenceGrantRequestListL( iReqId ); + break; + } + + case CGrantRequestListSubscriptionItem::ESubscribedForCtxAndOthers: + { + iMyHost->FakeCompleteRequest( iReqId, KErrNone ); + break; + } + + case CGrantRequestListSubscriptionItem::ENotSubscribedAtAll: + case CGrantRequestListSubscriptionItem::ESubscribedForOtherCtxOnly: + { + iMyHost->FakeCompleteRequest( iReqId, KErrNone ); + break; + } + + XIMP_DEFAULT_CASE_UNSUPPORTED( NXIMPPrivPanic::EInvalidSubscriptionStatus ); + } + } + +// --------------------------------------------------------------------------- +// COperationUnsubscribeGrantRequestList::RequestCompleted() +// --------------------------------------------------------------------------- +// +void COperationUnsubscribeGrantRequestList::RequestCompletedL() + { + TRACE(_L("COperationUnsubscribeGrantRequestList::RequestCompletedL()" ) ); + CXIMPOperationBase::RequestCompletedL(); + + if( iStatusObj->ResultCode() == KErrNone ) + { + switch( iSubscriptionStatus ) + { + case CGrantRequestListSubscriptionItem::ESubscribedForCtxOnly: + case CGrantRequestListSubscriptionItem::ESubscribedForCtxAndOthers: + { + iGrantRequestList->RemoveSubscriber( iContext ); + break; + } + case CGrantRequestListSubscriptionItem::ENotSubscribedAtAll: + case CGrantRequestListSubscriptionItem::ESubscribedForOtherCtxOnly: + { + break; + } + + XIMP_DEFAULT_CASE_UNSUPPORTED( NXIMPPrivPanic::EInvalidSubscriptionStatus ); + } + SynthesiseEventL(); + } + } + + +// --------------------------------------------------------------------------- +// COperationUnsubscribeGrantRequestList::Type() +// --------------------------------------------------------------------------- +// +TInt + COperationUnsubscribeGrantRequestList::Type() const + { + return NPresenceOps::EPrUnsubscribePresenceGrantRequestList; + } + +// --------------------------------------------------------------------------- +// COperationUnsubscribeGrantRequestList::SynthesiseEventL() +// --------------------------------------------------------------------------- +// +void COperationUnsubscribeGrantRequestList::SynthesiseEventL() + { + COperationSynthesiseSubscriptionEvent* synthOp = + new ( ELeave ) COperationSynthesiseSubscriptionEvent( + COperationSynthesiseSubscriptionEvent::EPresenceGrantRequestList, + EFalse ); + CleanupStack::PushL( synthOp ); + synthOp->BaseConstructL( TXIMPRequestId(), iContext ); + iMyHost->AddNewOperationL( *synthOp ); + CleanupStack::Pop( synthOp ); + } + + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresenceoperations/presenceauthorization/operationunsubscribegrantrequestlist.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresenceoperations/presenceauthorization/operationunsubscribegrantrequestlist.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,75 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Presence grant request list unsubscription operation + * +*/ + +#ifndef CPSCOPERATIONUNSUBSCRIBEGRANTREQUESTLIST_H +#define CPSCOPERATIONUNSUBSCRIBEGRANTREQUESTLIST_H + + +#include + +#include +#include "ximpoperationbase.h" +#include "grantrequestlistsubscriptionitem.h" +#include "presenceoperationdefs.h" + +/** + * Presence grant request list unsubscribe operation. + * + * @lib ximpoperations.lib + * @since S60 v4.0 + */ +class COperationUnsubscribeGrantRequestList : public CXIMPOperationBase + { + public: + + IMPORT_C COperationUnsubscribeGrantRequestList(); + + void ConstructL( const TDesC8& aParamPck ); + + ~COperationUnsubscribeGrantRequestList(); + + + public: // from CXIMPOperationBase + + void ProcessL(); + + void RequestCompletedL(); + + TInt Type() const; + + private: // Helper methods + + /** + * Synthesise event after completion + */ + void SynthesiseEventL(); + + private: // data + + /** + * Group list access. + */ + CGrantRequestListSubscriptionItem* iGrantRequestList; + + /** + * Subscription status + */ + CGrantRequestListSubscriptionItem::TSubscriptionStatus iSubscriptionStatus; + }; + + +#endif // CPSCOPERATIONUNSUBSCRIBEGRANTREQUESTLIST_H diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresenceoperations/presenceauthorization/operationwithdrawpresencefromeveryone.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresenceoperations/presenceauthorization/operationwithdrawpresencefromeveryone.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,185 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Withdraw presence from everyone + * +*/ + + +#include +#include +#include + +#include "operationwithdrawpresencefromeveryone.h" +#include "ximpidentityimp.h" +#include "ximpobjecthelpers.h" +#include "presencedatacacheimp.h" +#include "presenceinfofilterimp.h" +#include "ximphost.h" +#include "ximpstatusimp.h" +#include "ximppsccontextimp.h" +#include "ximppanics.h" +#include "protocolpresencedatahostimp.h" + +#include "ximptrace.h" +// ============================ MEMBER FUNCTIONS ============================= + +// --------------------------------------------------------------------------- +// COperationWithdrawPresenceFromEveryone::COperationWithdrawPresenceFromEveryone() +// --------------------------------------------------------------------------- +// +EXPORT_C COperationWithdrawPresenceFromEveryone::COperationWithdrawPresenceFromEveryone() + { + } + + +// --------------------------------------------------------------------------- +// COperationWithdrawPresenceFromEveryone::~COperationWithdrawPresenceFromEveryone() +// --------------------------------------------------------------------------- +// +COperationWithdrawPresenceFromEveryone::~COperationWithdrawPresenceFromEveryone() + { + if( iConfItem ) + { + iConfItem->Close(); + } + } + +// --------------------------------------------------------------------------- +// COperationWithdrawPresenceFromEveryone::ConstructL() +// --------------------------------------------------------------------------- +// +void COperationWithdrawPresenceFromEveryone::ConstructL( const TDesC8& /*aParamPck*/ ) + { + } + + +// --------------------------------------------------------------------------- +// COperationWithdrawPresenceFromEveryone::ProcessL() +// --------------------------------------------------------------------------- +// +void COperationWithdrawPresenceFromEveryone::ProcessL() + { + TRACE(_L("COperationWithdrawPresenceFromEveryone::ProcessL()" ) ); + CXIMPOperationBase::ProcessL(); + + CPresenceToEveryoneConfigurationItem& confItem = + iMyHost->PresenceDataAccess().PresenceDataCache().PresenceToEveryoneConfigurationItemLC(); + CleanupStack::Pop(); // subItem + iConfItem = &confItem; + + iConfigurationStatus = iConfItem->ConfigurationStatus( iContext ); + + MProtocolPresenceAuthorization& authorization = iMyHost->GetConnection().ProtocolPresenceFeatures().PresenceAuthorization(); + + iContext->SetPresenceInfoFilterL( MXIMPPscContext::EGrantPresenceToEveryoneFilter, + NULL, NULL ); + + switch( iConfigurationStatus ) + { + case CPresenceToEveryoneConfigurationItem::EConfiguredForCtxOnly: + { + authorization.DoWithdrawPresenceGrantFromEveryoneL( iReqId ); + iConfItem->RemoveConfigurator( iContext ); + break; + } + + case CPresenceToEveryoneConfigurationItem::EConfiguredForCtxAndOthers: + { + CPresenceInfoFilterImp* pifWithoutCtx = + iConfItem->CollectConfigurationPifWithoutCtxL( iContext ); + CleanupStack::PushL( pifWithoutCtx ); + + if ( iConfItem->ConfigurationPif().Contains( *pifWithoutCtx ) ) + { + authorization.DoUpdatePresenceGrantPifForEveryoneL( *pifWithoutCtx, iReqId ); + } + else + { + iMyHost->FakeCompleteRequest( iReqId, KErrNone ); + } + + CleanupStack::PopAndDestroy( pifWithoutCtx ); + break; + } + + case CPresenceToEveryoneConfigurationItem::ENotConfiguredAtAll: + { + // OPAA-73BCS8 + authorization.DoWithdrawPresenceGrantFromEveryoneL( iReqId ); + break; + } + case CPresenceToEveryoneConfigurationItem::EConfiguredForOtherCtxOnly: + { + iMyHost->FakeCompleteRequest( iReqId, KErrNone ); + break; + } + + XIMP_DEFAULT_CASE_UNSUPPORTED( NXIMPPrivPanic::EInvalidSubscriptionStatus ); + } + } + +// --------------------------------------------------------------------------- +// COperationWithdrawPresenceFromEveryone::RequestCompleted() +// --------------------------------------------------------------------------- +// +void COperationWithdrawPresenceFromEveryone::RequestCompletedL() + { + TRACE(_L("COperationWithdrawPresenceFromEveryone::RequestCompletedL()" ) ); + CXIMPOperationBase::RequestCompletedL(); + + if( iStatusObj->ResultCode() == KErrNone ) + { + switch( iConfigurationStatus ) + { + case CPresenceToEveryoneConfigurationItem::EConfiguredForCtxOnly: + case CPresenceToEveryoneConfigurationItem::EConfiguredForCtxAndOthers: + { + iConfItem->RemoveConfigurator( iContext ); + break; + } + + case CPresenceToEveryoneConfigurationItem::ENotConfiguredAtAll: + case CPresenceToEveryoneConfigurationItem::EConfiguredForOtherCtxOnly: + { + break; + } + + XIMP_DEFAULT_CASE_UNSUPPORTED( NXIMPPrivPanic::EInvalidSubscriptionStatus ); + } + SynthesiseEventL(); + } + } + + +// --------------------------------------------------------------------------- +// COperationWithdrawPresenceFromEveryone::Type() +// --------------------------------------------------------------------------- +// +TInt + COperationWithdrawPresenceFromEveryone::Type() const + { + return NPresenceOps::EPrWithdrawPresenceFromEveryone; + } + +// --------------------------------------------------------------------------- +// COperationWithdrawPresenceFromEveryone::SynthesiseEventL() +// --------------------------------------------------------------------------- +// +void COperationWithdrawPresenceFromEveryone::SynthesiseEventL() + { + } + + + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresenceoperations/presenceauthorization/operationwithdrawpresencefromeveryone.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresenceoperations/presenceauthorization/operationwithdrawpresencefromeveryone.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,78 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Withdraw presence from everyone + * +*/ + +#ifndef CPSCOPERATIONWITHDRAWPRESENCEFROMEVERYONE_H +#define CPSCOPERATIONWITHDRAWPRESENCEFROMEVERYONE_H + + +#include +#include + +#include "ximpoperationbase.h" +#include "presencetoeveryoneconfigurationitem.h" +#include "presenceoperationdefs.h" + +/** + * Withdraw presence from everyone + * + * @lib ximpoperations.lib + * @since S60 v4.0 + */ +class COperationWithdrawPresenceFromEveryone : public CXIMPOperationBase + { + + public: + + IMPORT_C COperationWithdrawPresenceFromEveryone(); + + void ConstructL( const TDesC8& aParamPck ); + + ~COperationWithdrawPresenceFromEveryone(); + + + public: // from CXIMPOperationBase + + void ProcessL(); + + void RequestCompletedL(); + + TInt Type() const; + + private: // Helper methods + + /** + * Synthesise event after completion + */ + void SynthesiseEventL(); + + private: // data + + /** + * Presence configuration item + * Own. + */ + CPresenceToEveryoneConfigurationItem* iConfItem; + + /** + * Subscription status + */ + CPresenceToEveryoneConfigurationItem::TConfigurationStatus iConfigurationStatus; + + }; + + +#endif // CPSCOPERATIONWITHDRAWPRESENCEFROMEVERYONE_H diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresenceoperations/presenceauthorization/operationwithdrawpresencefrompresentity.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresenceoperations/presenceauthorization/operationwithdrawpresencefrompresentity.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,191 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Withdraw presence from presentity + * +*/ + + +#include +#include +#include + +#include "operationwithdrawpresencefrompresentity.h" +#include "ximpidentityimp.h" +#include "ximpobjecthelpers.h" +#include "presencedatacacheimp.h" +#include "presenceinfofilterimp.h" +#include "ximphost.h" +#include "ximpstatusimp.h" +#include "ximppsccontextimp.h" +#include "ximppanics.h" +#include "protocolpresencedatahostimp.h" + +#include "ximptrace.h" + +// ============================ MEMBER FUNCTIONS ============================= + +// --------------------------------------------------------------------------- +// COperationWithdrawPresenceFromPresentity::COperationWithdrawPresenceFromPresentity() +// --------------------------------------------------------------------------- +// +EXPORT_C COperationWithdrawPresenceFromPresentity::COperationWithdrawPresenceFromPresentity() + { + } + + +// --------------------------------------------------------------------------- +// COperationWithdrawPresenceFromPresentity::~COperationWithdrawPresenceFromPresentity() +// --------------------------------------------------------------------------- +// +COperationWithdrawPresenceFromPresentity::~COperationWithdrawPresenceFromPresentity() + { + delete iIdentity; + + if( iConfItem ) + { + iConfItem->Close(); + } + } + +// --------------------------------------------------------------------------- +// COperationWithdrawPresenceFromPresentity::ConstructL() +// --------------------------------------------------------------------------- +// +void COperationWithdrawPresenceFromPresentity::ConstructL( const TDesC8& aParamPck ) + { + iIdentity = CXIMPIdentityImp::NewLC(); + CleanupStack::Pop( iIdentity ); + TXIMPObjectPacker< CXIMPIdentityImp >::UnPackL( *iIdentity, aParamPck ); + } + + +// --------------------------------------------------------------------------- +// COperationWithdrawPresenceFromPresentity::ProcessL() +// --------------------------------------------------------------------------- +// +void COperationWithdrawPresenceFromPresentity::ProcessL() + { + TRACE(_L("COperationWithdrawPresenceFromPresentity::ProcessL()" ) ); + CXIMPOperationBase::ProcessL(); + + CPresenceConfigurationItem& confItem = + iMyHost->PresenceDataAccess().PresenceDataCache().PresenceConfigurationItemLC( *iIdentity ); + CleanupStack::Pop(); // subItem + iConfItem = &confItem; + + iConfigurationStatus = iConfItem->ConfigurationStatus( iContext ); + + MProtocolPresenceAuthorization& authorization = iMyHost->GetConnection().ProtocolPresenceFeatures().PresenceAuthorization(); + + iContext->SetPresenceInfoFilterL( MXIMPPscContext::EGrantPresenceToPresentityFilter, + NULL, iIdentity ); + + switch( iConfigurationStatus ) + { + case CPresenceConfigurationItem::EConfiguredForCtxOnly: + { + authorization.DoWithdrawPresenceGrantFromPresentityL( *iIdentity, iReqId ); + iConfItem->RemoveConfigurator( iContext ); + break; + } + + case CPresenceConfigurationItem::EConfiguredForCtxAndOthers: + { + CPresenceInfoFilterImp* pifWithoutCtx = + iConfItem->CollectConfigurationPifWithoutCtxL( iContext ); + CleanupStack::PushL( pifWithoutCtx ); + + if ( iConfItem->ConfigurationPif().Contains( *pifWithoutCtx ) ) + { + authorization.DoUpdatePresenceGrantPifForPresentityL( *iIdentity, *pifWithoutCtx, iReqId ); + } + else + { + iMyHost->FakeCompleteRequest( iReqId, KErrNone ); + } + + CleanupStack::PopAndDestroy( pifWithoutCtx ); + break; + } + + case CPresenceConfigurationItem::ENotConfiguredAtAll: + { + // OPAA-73BCS8 + authorization.DoWithdrawPresenceGrantFromPresentityL( *iIdentity, iReqId ); + break; + } + case CPresenceConfigurationItem::EConfiguredForOtherCtxOnly: + { + iMyHost->FakeCompleteRequest( iReqId, KErrNone ); + break; + } + + XIMP_DEFAULT_CASE_UNSUPPORTED( NXIMPPrivPanic::EInvalidSubscriptionStatus ); + } + } + +// --------------------------------------------------------------------------- +// COperationWithdrawPresenceFromPresentity::RequestCompleted() +// --------------------------------------------------------------------------- +// +void COperationWithdrawPresenceFromPresentity::RequestCompletedL() + { + TRACE(_L("COperationWithdrawPresenceFromPresentity::RequestCompletedL()" ) ); + CXIMPOperationBase::RequestCompletedL(); + + if( iStatusObj->ResultCode() == KErrNone ) + { + switch( iConfigurationStatus ) + { + case CPresenceConfigurationItem::EConfiguredForCtxOnly: + case CPresenceConfigurationItem::EConfiguredForCtxAndOthers: + { + iConfItem->RemoveConfigurator( iContext ); + break; + } + + case CPresenceConfigurationItem::ENotConfiguredAtAll: + case CPresenceConfigurationItem::EConfiguredForOtherCtxOnly: + { + break; + } + + XIMP_DEFAULT_CASE_UNSUPPORTED( NXIMPPrivPanic::EInvalidSubscriptionStatus ); + } + SynthesiseEventL(); + } + } + + +// --------------------------------------------------------------------------- +// COperationWithdrawPresenceFromPresentity::Type() +// --------------------------------------------------------------------------- +// +TInt + COperationWithdrawPresenceFromPresentity::Type() const + { + return NPresenceOps::EPrWithdrawPresenceFromPresentity; + } + +// --------------------------------------------------------------------------- +// COperationWithdrawPresenceFromPresentity::SynthesiseEventL() +// --------------------------------------------------------------------------- +// +void COperationWithdrawPresenceFromPresentity::SynthesiseEventL() + { + } + + + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresenceoperations/presenceauthorization/operationwithdrawpresencefrompresentity.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresenceoperations/presenceauthorization/operationwithdrawpresencefrompresentity.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,83 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Withdraw presence from presentity + * +*/ + +#ifndef CPSCOPERATIONWITHDRAWPRESENCEFROMPRESENTITY_H +#define CPSCOPERATIONWITHDRAWPRESENCEFROMPRESENTITY_H + + +#include +#include + +#include "ximpoperationbase.h" +#include "presenceconfigurationitem.h" +#include "presenceoperationdefs.h" + +/** + * Withdraw presence from presentity + * + * @lib ximpoperations.lib + * @since S60 v4.0 + */ +class COperationWithdrawPresenceFromPresentity : public CXIMPOperationBase + { + + public: + + IMPORT_C COperationWithdrawPresenceFromPresentity(); + + void ConstructL( const TDesC8& aParamPck ); + + ~COperationWithdrawPresenceFromPresentity(); + + + public: // from CXIMPOperationBase + + void ProcessL(); + + void RequestCompletedL(); + + TInt Type() const; + + private: // Helper methods + + /** + * Synthesise event after completion + */ + void SynthesiseEventL(); + + private: // data + + /** + * Identity + */ + CXIMPIdentityImp* iIdentity; + + /** + * Presence configuration item + * Own. + */ + CPresenceConfigurationItem* iConfItem; + + /** + * Subscription status + */ + CPresenceConfigurationItem::TConfigurationStatus iConfigurationStatus; + + }; + + +#endif // CPSCOPERATIONWITHDRAWPRESENCEFROMPRESENTITY_H diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresenceoperations/presenceauthorization/operationwithdrawpresencefrompresentitygroupmembers.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresenceoperations/presenceauthorization/operationwithdrawpresencefrompresentitygroupmembers.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,191 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Withdraw presence from presentity group members operation + * +*/ + + +#include +#include +#include + +#include "operationwithdrawpresencefrompresentitygroupmembers.h" +#include "ximpidentityimp.h" +#include "ximpobjecthelpers.h" +#include "presencedatacacheimp.h" +#include "presenceinfofilterimp.h" +#include "ximphost.h" +#include "ximpstatusimp.h" +#include "ximppsccontextimp.h" +#include "ximppanics.h" +#include "protocolpresencedatahostimp.h" + +#include "ximptrace.h" +// ============================ MEMBER FUNCTIONS ============================= + +// --------------------------------------------------------------------------- +// COperationWithdrawPresenceFromPresentityGroupMembers::COperationWithdrawPresenceFromPresentityGroupMembers() +// --------------------------------------------------------------------------- +// +EXPORT_C COperationWithdrawPresenceFromPresentityGroupMembers::COperationWithdrawPresenceFromPresentityGroupMembers() + { + } + + +// --------------------------------------------------------------------------- +// COperationWithdrawPresenceFromPresentityGroupMembers::~COperationWithdrawPresenceFromPresentityGroupMembers() +// --------------------------------------------------------------------------- +// +COperationWithdrawPresenceFromPresentityGroupMembers::~COperationWithdrawPresenceFromPresentityGroupMembers() + { + delete iGroupId; + + if( iConfItem ) + { + iConfItem->Close(); + } + } + +// --------------------------------------------------------------------------- +// COperationWithdrawPresenceFromPresentityGroupMembers::ConstructL() +// --------------------------------------------------------------------------- +// +void COperationWithdrawPresenceFromPresentityGroupMembers::ConstructL( const TDesC8& aParamPck ) + { + iGroupId = CXIMPIdentityImp::NewLC(); + CleanupStack::Pop( iGroupId ); + TXIMPObjectPacker< CXIMPIdentityImp >::UnPackL( *iGroupId, aParamPck ); + } + + +// --------------------------------------------------------------------------- +// COperationWithdrawPresenceFromPresentityGroupMembers::ProcessL() +// --------------------------------------------------------------------------- +// +void COperationWithdrawPresenceFromPresentityGroupMembers::ProcessL() + { + TRACE(_L("COperationWithdrawPresenceFromPresentityGroupMembers::ProcessL()" ) ); + CXIMPOperationBase::ProcessL(); + + CGroupMembersPresenceConfigurationItem& confItem = + iMyHost->PresenceDataAccess().PresenceDataCache().GroupMembersPresenceConfigurationItemLC( *iGroupId ); + CleanupStack::Pop(); // subItem + iConfItem = &confItem; + + iConfigurationStatus = iConfItem->ConfigurationStatus( iContext ); + + MProtocolPresenceAuthorization& authorization = iMyHost->GetConnection().ProtocolPresenceFeatures().PresenceAuthorization(); + + iContext->SetPresenceInfoFilterL( MXIMPPscContext::EGrantPresenceToGroupMemberFilter, + NULL, iGroupId ); + + switch( iConfigurationStatus ) + { + case CGroupMembersPresenceConfigurationItem::ESubscribedForCtxOnly: + { + authorization.DoWithdrawPresenceGrantFromPresentityGroupMembersL( *iGroupId, iReqId ); + iConfItem->RemoveConfigurator( iContext ); + break; + } + + case CGroupMembersPresenceConfigurationItem::ESubscribedForCtxAndOthers: + { + CPresenceInfoFilterImp* pifWithoutCtx = + iConfItem->CollectConfigurationPifWithoutCtxL( iContext ); + CleanupStack::PushL( pifWithoutCtx ); + + if ( iConfItem->ConfigurationPif().Contains( *pifWithoutCtx ) ) + { + authorization.DoUpdatePresenceGrantPifForPresentityGroupMembersL( *iGroupId, *pifWithoutCtx, iReqId ); + } + else + { + iMyHost->FakeCompleteRequest( iReqId, KErrNone ); + } + + CleanupStack::PopAndDestroy( pifWithoutCtx ); + break; + } + + case CGroupMembersPresenceConfigurationItem::ENotSubscribedAtAll: + { + // OPAA-73BCS8 + authorization.DoWithdrawPresenceGrantFromPresentityGroupMembersL( *iGroupId, iReqId ); + break; + } + case CGroupMembersPresenceConfigurationItem::ESubscribedForOtherCtxOnly: + { + iMyHost->FakeCompleteRequest( iReqId, KErrNone ); + break; + } + + XIMP_DEFAULT_CASE_UNSUPPORTED( NXIMPPrivPanic::EInvalidSubscriptionStatus ); + } + } + + +// --------------------------------------------------------------------------- +// COperationWithdrawPresenceFromPresentityGroupMembers::RequestCompleted() +// --------------------------------------------------------------------------- +// +void COperationWithdrawPresenceFromPresentityGroupMembers::RequestCompletedL() + { + TRACE(_L("COperationWithdrawPresenceFromPresentityGroupMembers::RequestCompletedL()" ) ); + CXIMPOperationBase::RequestCompletedL(); + + if( iStatusObj->ResultCode() == KErrNone ) + { + switch( iConfigurationStatus ) + { + case CGroupMembersPresenceConfigurationItem::ESubscribedForCtxOnly: + case CGroupMembersPresenceConfigurationItem::ESubscribedForCtxAndOthers: + { + iConfItem->RemoveConfigurator( iContext ); + break; + } + + case CGroupMembersPresenceConfigurationItem::ENotSubscribedAtAll: + case CGroupMembersPresenceConfigurationItem::ESubscribedForOtherCtxOnly: + { + break; + } + + XIMP_DEFAULT_CASE_UNSUPPORTED( NXIMPPrivPanic::EInvalidSubscriptionStatus ); + } + SynthesiseEventL(); + } + } + + +// --------------------------------------------------------------------------- +// COperationWithdrawPresenceFromPresentityGroupMembers::Type() +// --------------------------------------------------------------------------- +// +TInt + COperationWithdrawPresenceFromPresentityGroupMembers::Type() const + { + return NPresenceOps::EPrWithdrawPresenceFromPresentityGroupMembers; + } + +// --------------------------------------------------------------------------- +// COperationWithdrawPresenceFromPresentityGroupMembers::SynthesiseEventL() +// --------------------------------------------------------------------------- +// +void COperationWithdrawPresenceFromPresentityGroupMembers::SynthesiseEventL() + { + } + + + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresenceoperations/presenceauthorization/operationwithdrawpresencefrompresentitygroupmembers.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresenceoperations/presenceauthorization/operationwithdrawpresencefrompresentitygroupmembers.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,83 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Withdraw presence from presentity group members operation + * +*/ + +#ifndef CPSCOPERATIONWITHDRAWPRESENCEFROMPRESENTITYGROUPMEMBERS_H +#define CPSCOPERATIONWITHDRAWPRESENCEFROMPRESENTITYGROUPMEMBERS_H + + +#include +#include + +#include "ximpoperationbase.h" +#include "groupmemberspresenceconfigurationitem.h" +#include "presenceoperationdefs.h" + +/** + * Withdraw presence from presentity group members operation + * + * @lib ximpoperations.lib + * @since S60 v4.0 + */ +class COperationWithdrawPresenceFromPresentityGroupMembers : public CXIMPOperationBase + { + + public: + + IMPORT_C COperationWithdrawPresenceFromPresentityGroupMembers(); + + void ConstructL( const TDesC8& aParamPck ); + + ~COperationWithdrawPresenceFromPresentityGroupMembers(); + + + public: // from CXIMPOperationBase + + void ProcessL(); + + void RequestCompletedL(); + + TInt Type() const; + + private: // Helper methods + + /** + * Synthesise event after completion + */ + void SynthesiseEventL(); + + private: // data + + /** + * Identity + */ + CXIMPIdentityImp* iGroupId; + + /** + * Presence configuration item + * Own. + */ + CGroupMembersPresenceConfigurationItem* iConfItem; + + /** + * Configuration status + */ + CGroupMembersPresenceConfigurationItem::TConfigurationStatus iConfigurationStatus; + + }; + + +#endif // CPSCOPERATIONWITHDRAWPRESENCEFROMPRESENTITYGROUPMEMBERS_H diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresenceoperations/presenceoperationdefs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresenceoperations/presenceoperationdefs.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,131 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP framework presence operation definitions. + * +*/ + +#ifndef PRESENCEOPERATIONDEFS_H +#define PRESENCEOPERATIONDEFS_H + +#include + +// TODO: use ranges for operations types, that will make sure that +// the core, presence and IM operations won't overlap + +/** + * PSC operations. + */ +namespace NPresenceOps + { + enum TPresenceOpTypes + { + // ----------------------------------------------- + // From client + // + EPrPublishOwnPresence = 10, // 10 + EPrSubscribeOwnPresence, // 11 + EPrUnsubscribeOwnPresence, // 12 + + EPrSubscribeGroupList, // 13 + EPrUnsubscribeGroupList, // 14 + + EPrCreatePresentityGroup, // 15 + + EPrSubscribePresentityPresence, // 16 + EPrUnsubscribePresentityPresence, // 17 + + EPrDeletePresentityGroup, // 18 + EPrUpdatePresentityGroupDisplayName, // 19 + + EPrSubscribePresentityGroupContent, // 20 + EPrUnsubscribePresentityGroupContent, // 21 + + EPrAddPresentityGroupMember, // 22 + EPrRemovePresentityGroupMember, // 23 + EPrUpdatePresentityGroupMemberDisplayName, // 24 + EPrSynthesisePresenceSubscription, // 25 + EPrSubscribeGroupContent, // 26 + EPrUnsubscribeGroupContent, // 27 + + EPrPresentityGroupChange, // 28 + EPrPresentityGroupContentChange, // 29 + + EPrSubscribePresenceWatcherList, // 30 + EPrUnsubscribePresenceWatcherList, // 31 + + EPrSubscribePresentityGroupMembersPresence, // 32 + EPrUnsubscribePresentityGroupMembersPresence, // 33 + + EPrSubscribePresenceGrantRequestList, // 34 + EPrUnsubscribePresenceGrantRequestList, // 35 + + EPrGrantPresenceToPresentity, // 36 + EPrWithdrawPresenceFromPresentity, // 37 + EPrGrantPresenceToPresentityGroupMembers, // 38 + EPrWithdrawPresenceFromPresentityGroupMembers, // 39 + EPrGrantPresenceToEveryone, // 40 + EPrWithdrawPresenceFromEveryone, // 41 + + EPrSubscribeBlockList, // 42 + EPrUnsubscribeBlockList, // 43 + EPrBlockPresenceForPresentity, // 44 + EPrCancelPresenceBlockFromPresentity, // 45 + + // ----------------------------------------------- + // From adaptation + // + EPrHandleOwnPresence = 50, // 50 + EPrSetOwnPresenceDataSubscriptionState, // 51 + EPrHandlePresentityPresence, // 52 + EPrSetPresentityPresenceDataSubscriptionState, // 53 + EPrHandlePresentityPresenceTerminated, // 54 + EPrHandlePresenceWatcherList, // 55 + EPrSetPresenceWatcherListDataSubscriptionState, // 56 + + // Following map internally to the same operation + EPrHandlePresenceGrantRequestList, // 57 + EPrHandlePresenceGrantRequestReceived, // 58 + EPrHandlePresenceGrantRequestObsoleted, // 59 + EPrSetPresenceGrantRequestDataSubscriptionState, // 60 + + // these map internally to the same operation + EPrHandlePresenceBlockList, // 61 + EPrHandlePresenceBlocked, // 62 + EPrHandlePresenceBlockCanceled, // 63 + EPrSetPresenceBlockDataSubscriptionState, // 64 + + // these map internally to the same operation + EPrHandlePresentityGroupList = 70, // 70 - new list + EPrHandlePresentityGroupCreated, // 71 - created/updated groups + EPrHandlePresentityGroupDeleted, // 72 - deleted groups + EPrHandlePresentityGroupDisplayNameUpdated, // 73 - display name updated + EPrSetPresentityGroupListDataSubscriptionState,// 74 + + EPrHandlePresentityGroupContent = 80, // 80 + EPrHandlePresentityGroupMemberAdded, // 81 + EPrHandlePresentityGroupMemberRemoved, // 82 + EPrHandlePresentityGroupMemberDisplayNameUpdated, // 83 + EPrSetPresentityGroupContentDataSubscriptionState, // 84 + + EXIMPCleaner = 90, // 90 - Internal operation for cleaning. + + }; + } + +#endif //PRESENCEOPERATIONDEFS_H + + + + + diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresenceoperations/presenceoperationfactoryimp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresenceoperations/presenceoperationfactoryimp.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,442 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Presence service operation factory + * +*/ + + +#include "presenceoperationfactoryimp.h" +#include "presenceoperationdefs.h" +#include "operationpublishownpresence.h" +#include "operationsubscribeownpresence.h" +#include "operationunsubscribeownpresence.h" +#include "operationhandleownpresence.h" +#include "operationhandlepresentitygroups.h" +#include "ximpoperationbase.h" +#include "operationsubscribegrouplist.h" +#include "operationunsubscribegrouplist.h" +#include "operationcreatepresentitygroup.h" +#include "operationsubscribepresentitypresence.h" +#include "operationunsubscribepresentitypresence.h" +#include "operationdeletepresentitygroup.h" +#include "operationupdatepresentitygroupdisplayname.h" +#include "operationhandlepresentitypresence.h" +#include "operationsubscribegroupcontent.h" +#include "operationunsubscribegroupcontent.h" +#include "operationaddpresentitygroupmember.h" +#include "operationremovepresentitygroupmember.h" +#include "operationupdatepresentitygroupmemberdisplayname.h" +#include "operationhandlepresentitygroupcontent.h" +#include "operationhandlepresentitygroupmemberadded.h" +#include "operationhandlepresentitygroupmemberremoved.h" +#include "operationhandlepresentitygroupmemberdisplaynameupdated.h" +#include "operationlaunchcleaner.h" +#include "operationsubscribewatcherlist.h" +#include "operationunsubscribewatcherlist.h" +#include "operationhandlepresencewatcherlist.h" +#include "operationsubscribepresentitygroupmemberspresence.h" +#include "operationunsubscribepresentitygroupmemberspresence.h" +#include "operationsubscribegrantrequestlist.h" +#include "operationunsubscribegrantrequestlist.h" +#include "operationhandlepresencegrantrequests.h" +#include "operationgrantpresencetopresentity.h" +#include "operationwithdrawpresencefrompresentity.h" +#include "operationgrantpresencetopresentitygroupmembers.h" +#include "operationwithdrawpresencefrompresentitygroupmembers.h" +#include "operationsubscribeblocklist.h" +#include "operationunsubscribeblocklist.h" +#include "operationblockpresenceforpresentity.h" +#include "operationcancelpresenceblockfrompresentity.h" +#include "operationhandlepresenceblocking.h" +#include "operationgrantpresencetoeveryone.h" +#include "operationwithdrawpresencefromeveryone.h" +#include "operationsetsubscriptiondata.h" +#include "ximppanics.h" +#include "ximptrace.h" + +using namespace NPresenceOps; + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CXIMPOperationFactory::NewL() +// Singleton access method. +// ----------------------------------------------------------------------------- +// +EXPORT_C CPresenceOperationFactory* CPresenceOperationFactory::NewL() + { + CPresenceOperationFactory* self = new ( ELeave ) CPresenceOperationFactory(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// ----------------------------------------------------------------------------- +// CXIMPOperationFactory::CXIMPOperationFactory() +// ----------------------------------------------------------------------------- +// +CPresenceOperationFactory::CPresenceOperationFactory() + { + } + +// ----------------------------------------------------------------------------- +// CXIMPOperationFactory::~CXIMPOperationFactory() +// ----------------------------------------------------------------------------- +// +CPresenceOperationFactory::~CPresenceOperationFactory() + { + #if _BullseyeCoverage + cov_write(); + #endif + } + + +// ----------------------------------------------------------------------------- +// CXIMPOperationFactory::ConstructL() +// ----------------------------------------------------------------------------- +// +void CPresenceOperationFactory::ConstructL() + { + } + + +// ----------------------------------------------------------------------------- +// CXIMPOperationFactory::CreateOperationL() +// ----------------------------------------------------------------------------- +// +CXIMPOperationBase* CPresenceOperationFactory::CreateOperationL( TInt aOperation ) + { + CXIMPOperationBase* op = NULL; + NPresenceOps::TPresenceOpTypes operation = ( NPresenceOps::TPresenceOpTypes ) aOperation; + switch( aOperation ) + { + + case EPrPublishOwnPresence: + { + op = new ( ELeave ) COperationPublishOwnPresence(); + TRACE( _L("Operation PublishOwnPresence created") ); + break; + } + + case EPrSubscribeOwnPresence: + { + op = new ( ELeave ) COperationSubscribeOwnPresence(); + TRACE( _L("Operation SubscribeOwnPresence created") ); + break; + } + + case EPrUnsubscribeOwnPresence: + { + op = new ( ELeave ) COperationUnsubscribeOwnPresence(); + TRACE( _L("Operation UnsubscribeOwnPresence created") ); + break; + } + + case EPrHandleOwnPresence: + { + op = new ( ELeave ) COperationHandleOwnPresence(); + TRACE( _L("Operation HandleOwnPresence created") ); + break; + } + + case EPrSubscribeGroupList: + { + op = new ( ELeave ) COperationSubscribeGroupList(); + TRACE( _L("Operation UnsubscribeOwnPresence created") ); + break; + } + + case EPrUnsubscribeGroupList: + { + op = new ( ELeave ) COperationUnsubscribeGroupList(); + TRACE( _L("Operation SubscribeGroupList created") ); + break; + } + + case EPrCreatePresentityGroup: + { + op = new ( ELeave ) COperationCreatePresentityGroup(); + TRACE( _L("Operation CreatePresentityGroup created") ); + break; + } + + case EPrDeletePresentityGroup: + { + op = new ( ELeave ) COperationDeletePresentityGroup(); + TRACE( _L("Operation DeletePresentityGroup created") ); + break; + } + + case EPrUpdatePresentityGroupDisplayName: + { + op = new ( ELeave ) COperationUpdatePresentityGroupDisplayName(); + TRACE( _L("Operation UpdatePresentityGroupDisplayName created") ); + break; + } + + case EPrSubscribePresentityGroupContent: + { + op = new ( ELeave ) COperationSubscribeGroupContent(); + TRACE( _L("Operation SubscribeGroupContent created") ); + break; + } + + case EPrUnsubscribePresentityGroupContent: + { + op = new ( ELeave ) COperationUnsubscribeGroupContent(); + TRACE( _L("Operation UnsubscribeGroupContent created") ); + break; + } + + case EPrAddPresentityGroupMember: + { + op = new ( ELeave ) COperationAddPresentityGroupMember(); + TRACE( _L("Operation AddPresentityGroupMember created") ); + break; + } + + case EPrRemovePresentityGroupMember: + { + op = new ( ELeave ) COperationRemovePresentityGroupMember(); + TRACE( _L("Operation RemovePresentityGroupMember created") ); + break; + } + + case EPrUpdatePresentityGroupMemberDisplayName: + { + op = new ( ELeave ) COperationUpdatePresentityGroupMemberDisplayName(); + TRACE( _L("Operation UpdatePresentityGroupMemberDisplayName created") ); + break; + } + + case EPrSubscribePresentityPresence: + { + op = new ( ELeave ) COperationSubscribePresentityPresence(); + TRACE( _L("Operation SubscribePresentityPresence created") ); + break; + } + + case EPrUnsubscribePresentityPresence: + { + op = new ( ELeave ) COperationUnsubscribePresentityPresence(); + TRACE( _L("Operation UnsubscribePresentityPresence created") ); + break; + } + + case EPrSubscribePresenceWatcherList: + { + op = new ( ELeave ) COperationSubscribeWatcherList(); + TRACE( _L("Operation SubscribeWatcherList created") ); + break; + } + case EPrUnsubscribePresenceWatcherList: + { + op = new ( ELeave ) COperationUnsubscribeWatcherList(); + TRACE( _L("Operation UnsubscribeWatcherList created") ); + break; + } + + case EPrHandlePresentityPresence: // Flowthrough + case EPrHandlePresentityPresenceTerminated: + { + op = new ( ELeave ) COperationHandlePresentityPresence( aOperation ); + TRACE( _L("Operation HandlePresentityPresence created") ); + break; + } + + case EPrHandlePresenceWatcherList: + { + op = new ( ELeave ) COperationHandlePresenceWatcherList(); + TRACE( _L("Operation HandlePresenceWatcherList created") ); + break; + } + + case EPrHandlePresentityGroupList: + case EPrHandlePresentityGroupCreated: + case EPrHandlePresentityGroupDeleted: + case EPrHandlePresentityGroupDisplayNameUpdated: + { + op = new ( ELeave ) COperationHandlePresentityGroups( operation ); + TRACE( _L("Operation HandlePresentityGroups created") ); + break; + } + + case EPrHandlePresentityGroupContent: + { + op = new ( ELeave ) COperationHandlePresentityGroupContent(); + TRACE( _L("Operation HandlePresentityGroupContent created") ); + break; + } + + case EPrHandlePresentityGroupMemberAdded: + { + op = new ( ELeave ) COperationHandlePresentityGroupMemberAdded(); + TRACE( _L("Operation HandlePresentityGroupMemberAdded created") ); + break; + } + + case EPrHandlePresentityGroupMemberRemoved: + { + op = new ( ELeave ) COperationHandlePresentityGroupMemberRemoved(); + TRACE( _L("Operation HandlePresentityGroupMemberRemoved created") ); + break; + } + + case EPrHandlePresentityGroupMemberDisplayNameUpdated: + { + op = new ( ELeave ) COperationHandlePresentityGroupMemberDisplayNameUpdated(); + TRACE( _L("Operation HandlePresentityGroupMemberDisplayNameUpdated created") ); + break; + } + + case EPrSubscribePresentityGroupMembersPresence: + { + op = new ( ELeave ) COperationSubscribePresentityGroupMembersPresence(); + TRACE( _L("Operation SubscribePresentityGroupMembersPresence created") ); + break; + } + + case EPrUnsubscribePresentityGroupMembersPresence: + { + op = new ( ELeave ) COperationUnsubscribePresentityGroupMembersPresence(); + TRACE( _L("Operation UnsubscribePresentityGroupMembersPresence created") ); + break; + } + + case EPrSubscribePresenceGrantRequestList: + { + op = new ( ELeave ) COperationSubscribeGrantRequestList(); + TRACE( _L("Operation SubscribeGrantRequestList created") ); + break; + } + + case EPrUnsubscribePresenceGrantRequestList: + { + op = new ( ELeave ) COperationUnsubscribeGrantRequestList(); + TRACE( _L("Operation UnsubscribeGrantRequestList created") ); + break; + } + + case EPrHandlePresenceGrantRequestList: + case EPrHandlePresenceGrantRequestReceived: + case EPrHandlePresenceGrantRequestObsoleted: + { + op = new ( ELeave ) COperationHandlePresenceGrantRequests( operation ); + TRACE( _L("Operation HandlePresenceGrantRequests created") ); + break; + } + case EPrGrantPresenceToPresentity: + { + op = new ( ELeave ) COperationGrantPresenceToPresentity(); + TRACE( _L("Operation GrantPresenceToPresentity created") ); + break; + } + case EPrWithdrawPresenceFromPresentity: + { + op = new ( ELeave ) COperationWithdrawPresenceFromPresentity(); + TRACE( _L("Operation WithdrawPresenceFromPresentity created") ); + break; + } + case EPrGrantPresenceToPresentityGroupMembers: + { + op = new ( ELeave ) COperationGrantPresenceToPresentityGroupMembers(); + TRACE( _L("Operation GrantPresenceToPresentityGroupMembers created") ); + break; + } + case EPrWithdrawPresenceFromPresentityGroupMembers: + { + op = new ( ELeave ) COperationWithdrawPresenceFromPresentityGroupMembers(); + TRACE( _L("Operation WithdrawPresenceFromPresentityGroupMembers created") ); + break; + } + + case EPrGrantPresenceToEveryone: + { + op = new ( ELeave ) COperationGrantPresenceToEveryone(); + TRACE( _L("Operation GrantPresenceToEveryone created") ); + break; + } + case EPrWithdrawPresenceFromEveryone: + { + op = new ( ELeave ) COperationWithdrawPresenceFromEveryone(); + TRACE( _L("Operation WithdrawPresenceFromEveryone created") ); + break; + } + + case EXIMPCleaner: + { + op = new ( ELeave ) COperationLaunchCleaner(); + TRACE( _L("Operation LaunchCleaner created") ); + break; + } + + case EPrSubscribeBlockList: + { + op = new ( ELeave ) COperationSubscribeBlockList(); + TRACE( _L("Operation SubscribeBlockList created") ); + break; + } + case EPrUnsubscribeBlockList: + { + op = new ( ELeave ) COperationUnsubscribeBlockList(); + TRACE( _L("Operation UnsubscribeBlockList created") ); + break; + } + + case EPrBlockPresenceForPresentity: + { + op = new ( ELeave ) COperationBlockPresenceForPresentity(); + TRACE( _L("Operation BlockPresenceForPresentity created") ); + break; + } + + case EPrCancelPresenceBlockFromPresentity: + { + op = new ( ELeave ) COperationCancelPresenceBlockFromPresentity(); + TRACE( _L("Operation CancelPresenceBlockFromPresentity created") ); + break; + } + + case EPrHandlePresenceBlockList: + case EPrHandlePresenceBlocked: + case EPrHandlePresenceBlockCanceled: + { + op = new ( ELeave ) COperationHandlePresenceBlocking( operation ); + TRACE( _L("Operation HandlePresenceBlocking created") ); + break; + } + + case EPrSetOwnPresenceDataSubscriptionState: + case EPrSetPresenceBlockDataSubscriptionState: + case EPrSetPresenceGrantRequestDataSubscriptionState: + case EPrSetPresenceWatcherListDataSubscriptionState: + case EPrSetPresentityGroupListDataSubscriptionState: + case EPrSetPresentityGroupContentDataSubscriptionState: + case EPrSetPresentityPresenceDataSubscriptionState: + { + op = new ( ELeave ) COperationSetSubscriptionData( operation ); + TRACE( _L("Operation SetSubscriptionData created") ); + break; + } + + // commented by pankaj. + //XIMP_DEFAULT_CASE_UNSUPPORTED( NXIMPPrivPanic::EInvalidOperationType ); + } + + return op; + } +// End of file + + diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresenceoperations/presenceoperationfactoryimp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresenceoperations/presenceoperationfactoryimp.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,69 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Presence Service Connection operation factory + * +*/ + + +#ifndef PRESENCECPSCOPERATIONFACTORYIMP_H +#define PRESENCECPSCOPERATIONFACTORYIMP_H + + +#include +class CXIMPOperationBase; + +#include "ximpoperationfactory.h" + +/** + * Operation factory + * Class is owned by and handled as singleton by CXIMPGlobals. + * + * @lib presenceoperation.dll + * @since S60 v4.0 + */ +class CPresenceOperationFactory : public CBase, + public MXIMPOperationFactory + { + public: // Construction and desctruction + + IMPORT_C static CPresenceOperationFactory* NewL(); + + ~CPresenceOperationFactory(); + + private: // Construction + + /** + * C++ default constructor. + */ + CPresenceOperationFactory(); + + /** + * Symbian 2nd phase constructor + */ + void ConstructL(); + + + public: // From MXIMPOperationFactory + + /** + * @see MXIMPOperationFactory + */ + CXIMPOperationBase* CreateOperationL( TInt aOperation ); + + private: // Data + + }; + +#endif // PRESENCECPSCOPERATIONFACTORYIMP_H + diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresenceoperations/presencepublishing/operationhandleownpresence.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresenceoperations/presencepublishing/operationhandleownpresence.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,114 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: implementation of COperationHandleOwnPresence + * +*/ + + +#include "operationhandleownpresence.h" + +#include "presenceinfoimp.h" +#include "ximpobjecthelpers.h" +#include "ownpresencesubscriptionitem.h" +#include "presencedatacacheimp.h" +#include "ximphost.h" + +#include "ximprestrictedobjectcollectionimp.h" +#include "protocolpresencedatahostimp.h" + +#include "ximptrace.h" + +// ============================ MEMBER FUNCTIONS ============================= + +// --------------------------------------------------------------------------- +// COperationHandleOwnPresence::~COperationHandleOwnPresence() +// --------------------------------------------------------------------------- +// +COperationHandleOwnPresence::~COperationHandleOwnPresence() + { + delete iPresInfo; + } + + +// --------------------------------------------------------------------------- +// COperationHandleOwnPresence::COperationHandleOwnPresence() +// --------------------------------------------------------------------------- +// +EXPORT_C COperationHandleOwnPresence::COperationHandleOwnPresence() + { + } + + +// --------------------------------------------------------------------------- +// COperationHandleOwnPresence::ConstructL() +// --------------------------------------------------------------------------- +// +void COperationHandleOwnPresence::ConstructL( const TDesC8& /* aParamPck */ ) + { + } + + +// --------------------------------------------------------------------------- +// COperationHandleOwnPresence::ProcessL() +// --------------------------------------------------------------------------- +// +void COperationHandleOwnPresence::ProcessL() + { + TRACE(_L("COperationHandleOwnPresence::ProcessL()") ); + CXIMPOperationBase::ProcessL(); + + MXIMPBase* object = NULL; + iObjCollection->GetByType( object, MPresenceInfo::KInterfaceId ); + if ( object ) + { + iPresInfo = TXIMPGetImpClassOrPanic< CPresenceInfoImp >::From( *object ); + } + else + { + User::Leave( KErrArgument ); + } + + + COwnPresenceSubscriptionItem& ownPresence = + iMyHost->PresenceDataAccess().PresenceDataCache().OwnPresenceSubscriptionItemLC(); + ownPresence.SetPresenceInfoL( iPresInfo ); + iPresInfo = NULL; + TRAPD( err, ownPresence.SynthesiseSubscriptionEventToAllCtxsL() ); + CleanupStack::PopAndDestroy(); // ownPresence + iMyHost->HandleAdaptationRequestCompleted( iReqId, err ); + } + +// --------------------------------------------------------------------------- +// COperationHandleOwnPresence::RequestCompleted() +// --------------------------------------------------------------------------- +// +void COperationHandleOwnPresence::RequestCompletedL() + { + TRACE(_L("COperationHandleOwnPresence::RequestCompletedL()" ) ); + CXIMPOperationBase::RequestCompletedL(); + + // no special handling for error situations + } + + +// --------------------------------------------------------------------------- +// COperationHandleOwnPresence::Type() +// --------------------------------------------------------------------------- +// +TInt COperationHandleOwnPresence::Type() const + { + return NPresenceOps::EPrHandleOwnPresence; + } + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresenceoperations/presencepublishing/operationhandleownpresence.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresenceoperations/presencepublishing/operationhandleownpresence.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,65 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Handle own presence operation + * +*/ + +#ifndef CPSCOPERATIONHANDLEOWNPRESENCE_H +#define CPSCOPERATIONHANDLEOWNPRESENCE_H + + +#include + +#include +#include "ximpoperationbase.h" +#include "presenceoperationdefs.h" + +class CPresenceInfoImp; + +/** + * Publish presence operation. + * + * @lib ximpoperations.lib + * @since S60 v4.0 + */ +class COperationHandleOwnPresence : public CXIMPOperationBase + { + + public: + + IMPORT_C COperationHandleOwnPresence(); + + void ConstructL( const TDesC8& aParamPck ); + + ~COperationHandleOwnPresence(); + + public: // from CXIMPOperationBase + + void ProcessL(); + + void RequestCompletedL(); + + TInt Type() const; + + private: // data + + /** + * Presence document to handle. + * Own. + */ + CPresenceInfoImp* iPresInfo; + }; + + +#endif // CPSCOPERATIONHANDLEOWNPRESENCE_H diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresenceoperations/presencepublishing/operationhandlepresencewatcherlist.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresenceoperations/presencepublishing/operationhandlepresencewatcherlist.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,137 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Handle presence watcher list operation + * +*/ + + +#include "operationhandlepresencewatcherlist.h" + +#include "presencedatacacheimp.h" + +#include "presencewatcherinfoimp.h" +#include "watcherlistsubscriptionitem.h" +#include "ximphost.h" +#include "ximpstatusimp.h" + +#include "ximpobjecthelpers.h" +#include "ximprestrictedobjectcollectionimp.h" +#include "ximpobjectcollectionimp.h" +#include "protocolpresencedatahostimp.h" + +#include "ximptrace.h" + +// ============================ MEMBER FUNCTIONS ============================= + +// --------------------------------------------------------------------------- +// COperationHandlePresenceWatcherList::~COperationHandlePresenceWatcherList() +// --------------------------------------------------------------------------- +// +COperationHandlePresenceWatcherList::~COperationHandlePresenceWatcherList() + { + delete iWatcherList; + } + +// --------------------------------------------------------------------------- +// COperationHandlePresenceWatcherList::COperationHandlePresenceWatcherList() +// --------------------------------------------------------------------------- +// +EXPORT_C COperationHandlePresenceWatcherList::COperationHandlePresenceWatcherList() + { + } + +// --------------------------------------------------------------------------- +// COperationHandlePresenceWatcherList::ConstructL() +// --------------------------------------------------------------------------- +// +void COperationHandlePresenceWatcherList::ConstructL( const TDesC8& /* aParamPck */ ) + { + iWatcherList = new ( ELeave ) RPrWatLstInfoImpArray; + } + +// --------------------------------------------------------------------------- +// From CXIMPOperationBase class. +// COperationHandlePresenceWatcherList::ProcessL() +// --------------------------------------------------------------------------- +// +void COperationHandlePresenceWatcherList::ProcessL() + { + TRACE(_L("COperationHandlePresenceWatcherList::ProcessL()") ); + CXIMPOperationBase::ProcessL(); + + MXIMPBase* object = NULL; + iObjCollection->GetByType( object, MXIMPObjectCollection::KInterfaceId ); + if( object ) + { + CXIMPObjectCollectionImp* objectCollection = + TXIMPGetImpClassOrPanic< CXIMPObjectCollectionImp >::From( *object ); + CleanupStack::PushL( objectCollection ); + TLinearOrder< CPresenceWatcherInfoImp > order( + CPresenceWatcherInfoImp::IdLinearOrder ); + TXIMPObjectMover< MPresenceWatcherInfo, CPresenceWatcherInfoImp >::MoveFromCollectionToArrayL( + *objectCollection, + *iWatcherList, + order ); + CleanupStack::PopAndDestroy( objectCollection ); + } + else + { + User::Leave( KErrArgument ); + } + + CWatcherListSubscriptionItem& subItem = + iMyHost->PresenceDataAccess().PresenceDataCache().WatcherListSubscriptionItemLC(); + + // clean out temporary lists + subItem.Clean(); + + subItem.SetNewListL( iWatcherList ); + iWatcherList = NULL; // ownership was transferred + subItem.UpdateSubscriptionStateL( + CXIMPSubscriptionItemBase::ECompleteDataReceived ); + + // synthesize the event to all contexts + TRAPD( err, subItem.SynthesiseSubscriptionEventToAllCtxsL() ); + + CleanupStack::PopAndDestroy(); // subItem + + err = KErrNone; + iMyHost->HandleAdaptationRequestCompleted( iReqId, err ); + } + +// --------------------------------------------------------------------------- +// From CXIMPOperationBase class. +// COperationHandlePresenceWatcherList::RequestCompleted() +// --------------------------------------------------------------------------- +// +void COperationHandlePresenceWatcherList::RequestCompletedL() + { + TRACE(_L("COperationHandlePresenceWatcherList::RequestCompletedL()" ) ); + CXIMPOperationBase::RequestCompletedL(); + + // no special handling for error situations + } + +// --------------------------------------------------------------------------- +// From CXIMPOperationBase class. +// COperationHandlePresenceWatcherList::Type() +// --------------------------------------------------------------------------- +// +TInt COperationHandlePresenceWatcherList::Type() const + { + return NPresenceOps::EPrHandlePresenceWatcherList; + } + + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresenceoperations/presencepublishing/operationhandlepresencewatcherlist.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresenceoperations/presencepublishing/operationhandlepresencewatcherlist.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,64 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Handle presentity group list operations + * +*/ + +#ifndef CPSCOPERATIONHANDLEPRESENCEWATCHERLIST_H +#define CPSCOPERATIONHANDLEPRESENCEWATCHERLIST_H + + +#include +#include + +#include "ximpoperationbase.h" +#include "presencetypehelpers.h" +#include "presenceoperationdefs.h" + +/** + * Handle presentity group related operations. + * + * @lib ximpoperations.lib + * @since S60 v4.0 + */ +class COperationHandlePresenceWatcherList : public CXIMPOperationBase + { + + public: + + IMPORT_C COperationHandlePresenceWatcherList(); + + void ConstructL( const TDesC8& aParamPck ); + + ~COperationHandlePresenceWatcherList(); + + public: // from CXIMPOperationBase + + void ProcessL(); + + void RequestCompletedL(); + + TInt Type() const; + + private: // data + + /** + * Array of group identities. + * Owned. + */ + RPrWatLstInfoImpArray* iWatcherList; + }; + + +#endif // CPSCOPERATIONHANDLEPRESENCEWATCHERLIST_H diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresenceoperations/presencepublishing/operationpublishownpresence.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresenceoperations/presencepublishing/operationpublishownpresence.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,100 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: implementation of COperationPublishOwnPresence + * +*/ + + +#include +#include +#include + +#include "operationpublishownpresence.h" +#include "presenceinfoimp.h" +#include "ximpobjecthelpers.h" +#include "ximphost.h" +#include "ximpstatusimp.h" + +#include "ximptrace.h" + +// ============================ MEMBER FUNCTIONS ============================= + +// --------------------------------------------------------------------------- +// COperationPublishOwnPresence::~COperationPublishOwnPresence() +// --------------------------------------------------------------------------- +// +COperationPublishOwnPresence::~COperationPublishOwnPresence() + { + delete iPresInfo; + } + + +// --------------------------------------------------------------------------- +// COperationPublishOwnPresence::COperationPublishOwnPresence() +// --------------------------------------------------------------------------- +// +EXPORT_C COperationPublishOwnPresence::COperationPublishOwnPresence() + { + } + + +// --------------------------------------------------------------------------- +// COperationPublishOwnPresence::ConstructL() +// --------------------------------------------------------------------------- +// +void COperationPublishOwnPresence::ConstructL( const TDesC8& aParamPck ) + { + iPresInfo = CPresenceInfoImp::NewL(); + TXIMPObjectPacker< CPresenceInfoImp >::UnPackL( *iPresInfo, + aParamPck ); + } + + +// --------------------------------------------------------------------------- +// COperationPublishOwnPresence::ProcessL() +// --------------------------------------------------------------------------- +// +void COperationPublishOwnPresence::ProcessL() + { + TRACE(_L("COperationPublishOwnPresence::ProcessL()" ) ); + CXIMPOperationBase::ProcessL(); + + MProtocolPresencePublishing& publishing = iMyHost->GetConnection().ProtocolPresenceFeatures().PresencePublishing(); + publishing.DoPublishOwnPresenceL( *iPresInfo, iReqId ); + } + + +// --------------------------------------------------------------------------- +// COperationPublishOwnPresence::RequestCompleted() +// --------------------------------------------------------------------------- +// +void COperationPublishOwnPresence::RequestCompletedL() + { + TRACE(_L("COperationPublishOwnPresence::RequestCompletedL()" ) ); + CXIMPOperationBase::RequestCompletedL(); + + // no special handling for error situations + } + + +// --------------------------------------------------------------------------- +// COperationPublishOwnPresence::Type() +// --------------------------------------------------------------------------- +// +TInt COperationPublishOwnPresence::Type() const + { + return NPresenceOps::EPrPublishOwnPresence; + } + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresenceoperations/presencepublishing/operationpublishownpresence.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresenceoperations/presencepublishing/operationpublishownpresence.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,65 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Publish presence operation + * +*/ + +#ifndef CPSCOPERATIONPUBLISHOWNPRESENCE_H +#define CPSCOPERATIONPUBLISHOWNPRESENCE_H + + +#include +#include + +#include "ximpoperationbase.h" +#include "presenceoperationdefs.h" + +class CPresenceInfoImp; + +/** + * Publish presence operation. + * + * @lib ximpoperations.lib + * @since S60 v4.0 + */ +class COperationPublishOwnPresence : public CXIMPOperationBase + { + + public: + + IMPORT_C COperationPublishOwnPresence(); + + void ConstructL( const TDesC8& aParamPck ); + + ~COperationPublishOwnPresence(); + + public: // from CXIMPOperationBase + + void ProcessL(); + + void RequestCompletedL(); + + TInt Type() const; + + private: // data + + /** + * Presence document to publish. + * Own. + */ + CPresenceInfoImp* iPresInfo; + }; + + +#endif // CPSCOPERATIONPUBLISHOWNPRESENCE_H diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresenceoperations/presencepublishing/operationsubscribeownpresence.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresenceoperations/presencepublishing/operationsubscribeownpresence.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,232 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: implementation of COperationSubscribeOwnPresence + * +*/ + + +#include +#include +#include + +#include "operationsubscribeownpresence.h" +#include "presenceinfofilterimp.h" +#include "ximpobjecthelpers.h" +#include "documentutils.h" +#include "presencedatacacheimp.h" +#include "ximppanics.h" +#include "operationsynthesisesubscriptionevent.h" +#include "ximphost.h" +#include "ximpstatusimp.h" +#include "ximppsccontextimp.h" +#include "protocolpresencedatahostimp.h" + +#include "ximptrace.h" +// ============================ MEMBER FUNCTIONS ============================= + +// --------------------------------------------------------------------------- +// COperationSubscribeOwnPresence::COperationSubscribeOwnPresence() +// --------------------------------------------------------------------------- +// +EXPORT_C COperationSubscribeOwnPresence::COperationSubscribeOwnPresence() + { + } + + +// --------------------------------------------------------------------------- +// COperationSubscribeOwnPresence::~COperationSubscribeOwnPresence() +// --------------------------------------------------------------------------- +// +COperationSubscribeOwnPresence::~COperationSubscribeOwnPresence() + { + delete iPif; + delete iMergedPif; + if( iOwnPresence ) + { + iOwnPresence->Close(); + } + } + +// --------------------------------------------------------------------------- +// COperationSubscribeOwnPresence::ConstructL() +// --------------------------------------------------------------------------- +// +void COperationSubscribeOwnPresence::ConstructL( const TDesC8& aParamPck ) + { + iPif = CPresenceInfoFilterImp::NewL(); + TXIMPObjectPacker< CPresenceInfoFilterImp >::UnPackL( *iPif, + aParamPck ); + } + + +// --------------------------------------------------------------------------- +// COperationSubscribeOwnPresence::ProcessL() +// --------------------------------------------------------------------------- +// +void COperationSubscribeOwnPresence::ProcessL() + { + TRACE(_L("COperationSubscribeOwnPresence::ProcessL()" ) ); + CXIMPOperationBase::ProcessL(); + + COwnPresenceSubscriptionItem& ownPresence = + iMyHost->PresenceDataAccess().PresenceDataCache().OwnPresenceSubscriptionItemLC(); + CleanupStack::Pop(); // ownPresence + iOwnPresence = &ownPresence; + + iSubscriptionStatus = iOwnPresence->SubscriptionStatus( iContext ); + + MProtocolPresencePublishing& publishing = iMyHost->GetConnection().ProtocolPresenceFeatures().PresencePublishing(); + + switch( iSubscriptionStatus ) + { + case COwnPresenceSubscriptionItem::ENotSubscribedAtAll: + { + // Do subscribe + iMergedPif = TXIMPObjectCloner< CPresenceInfoFilterImp >::CloneL( *iPif ); + publishing.DoSubscribeOwnPresenceL( *iMergedPif, iReqId ); + break; + } + case COwnPresenceSubscriptionItem::ESubscribedForOtherCtxOnly: + { + // Check aggregate and if needed.. update subscription + iMergedPif = DocumentUtils::InfoFilterUnionL( iOwnPresence->SubscriptionPif(), *iPif ); + if( iMergedPif->Contains( *iPif ) ) + { + publishing.DoUpdateOwnPresenceSubscriptionPifL( *iMergedPif, iReqId ); + } + else + { + iMyHost->FakeCompleteRequest( iReqId, KErrNone ); + } + break; + } + + case COwnPresenceSubscriptionItem::ESubscribedForCtxOnly: + case COwnPresenceSubscriptionItem::ESubscribedForCtxAndOthers: + { + CPresenceInfoFilterImp* oldPif = + iContext->PresenceInfoFilter( MXIMPPscContext::EOwnPresenceFilter ); + CPresenceInfoFilterImp& oldMergedPif = iOwnPresence->SubscriptionPif(); + TBool fake = ETrue; + TBool makeUnion( EFalse ); + if( !oldPif ) + { + TRACE(_L("COperationSubscribeOwnPresence::ProcessL() no old pif" ) ); + makeUnion = ETrue; + } + else if ( *oldPif != *iPif ) + { + makeUnion = ETrue; + } + if( makeUnion ) + { + iDoNotForce = ETrue; + CPresenceInfoFilterImp* withoutPif = + iOwnPresence->CollectSubscriptionPifWithoutCtxL( iContext ); + CleanupStack::PushL( withoutPif ); + iMergedPif = DocumentUtils::InfoFilterUnionL( *withoutPif, *iPif ); + CleanupStack::PopAndDestroy( withoutPif ); + if( iMergedPif->Contains( oldMergedPif ) ) + { + fake = EFalse; + publishing.DoUpdateOwnPresenceSubscriptionPifL( *iMergedPif, iReqId ); + } + } + else + { + iMergedPif = TXIMPObjectCloner< CPresenceInfoFilterImp >::CloneL( oldMergedPif ); + } + + if( fake ) + { + iMyHost->FakeCompleteRequest( iReqId, KErrNone ); + } + break; + } + XIMP_DEFAULT_CASE_UNSUPPORTED( NXIMPPrivPanic::EInvalidSubscriptionStatus ); + } + } + + +// --------------------------------------------------------------------------- +// COperationSubscribeOwnPresence::RequestCompleted() +// --------------------------------------------------------------------------- +// +void COperationSubscribeOwnPresence::RequestCompletedL() + { + TRACE(_L("COperationSubscribeOwnPresence::RequestCompletedL()" ) ); + CXIMPOperationBase::RequestCompletedL(); + + if( iStatusObj->ResultCode() == KErrNone ) + { + iContext->SetPresenceInfoFilterL( MXIMPPscContext::EOwnPresenceFilter, + iPif, NULL ); + iPif = NULL; + iOwnPresence->SetSubscriptionPif( iMergedPif ); + iMergedPif = NULL; + + switch( iSubscriptionStatus ) + { + case COwnPresenceSubscriptionItem::ENotSubscribedAtAll: + case COwnPresenceSubscriptionItem::ESubscribedForOtherCtxOnly: + { + iOwnPresence->AddSubscriberL( iContext ); + break; + } + case COwnPresenceSubscriptionItem::ESubscribedForCtxOnly: + case COwnPresenceSubscriptionItem::ESubscribedForCtxAndOthers: + { + break; + } + + XIMP_DEFAULT_CASE_UNSUPPORTED( NXIMPPrivPanic::EInvalidSubscriptionStatus ); + } + + SynthesiseEventL(); + } + } + + +// --------------------------------------------------------------------------- +// COperationSubscribeOwnPresence::Type() +// --------------------------------------------------------------------------- +// +TInt + COperationSubscribeOwnPresence::Type() const + { + return NPresenceOps::EPrSubscribeOwnPresence; + } + +// --------------------------------------------------------------------------- +// COperationSubscribeOwnPresence::SynthesiseEventL() +// --------------------------------------------------------------------------- +// +void COperationSubscribeOwnPresence::SynthesiseEventL() + { + TBool force = + ( iSubscriptionStatus == COwnPresenceSubscriptionItem::ESubscribedForCtxOnly || + iSubscriptionStatus == COwnPresenceSubscriptionItem::ESubscribedForCtxAndOthers ) ? ETrue : EFalse; + + COperationSynthesiseSubscriptionEvent* synthOp = + new ( ELeave ) COperationSynthesiseSubscriptionEvent( + COperationSynthesiseSubscriptionEvent::EOwnPresence, force && !iDoNotForce ); + CleanupStack::PushL( synthOp ); + synthOp->BaseConstructL( TXIMPRequestId(), iContext ); + iMyHost->AddNewOperationL( *synthOp ); + CleanupStack::Pop( synthOp ); + } + + + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresenceoperations/presencepublishing/operationsubscribeownpresence.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresenceoperations/presencepublishing/operationsubscribeownpresence.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,88 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Presence interest registration operation + * +*/ + +#ifndef CPSCOPERATIONSUBSCRIBEOWNPRESENCE_H +#define CPSCOPERATIONSUBSCRIBEOWNPRESENCE_H + + +#include +#include + +#include "ximpoperationbase.h" +#include "ownpresencesubscriptionitem.h" +#include "presenceoperationdefs.h" + +/** + * Presence interest registration operation. + * + * @lib ximpoperations.lib + * @since S60 v4.0 + */ +class COperationSubscribeOwnPresence : public CXIMPOperationBase + { + + public: + + IMPORT_C COperationSubscribeOwnPresence(); + + void ConstructL( const TDesC8& aParamPck ); + + ~COperationSubscribeOwnPresence(); + + + public: // from CXIMPOperationBase + + void ProcessL(); + + void RequestCompletedL(); + + TInt Type() const; + + private: // Helper methods + + /** + * Synthesise event after completion + */ + void SynthesiseEventL(); + + private: // data + + /** + * Presence info filter having new presence info filter for context. + * Own. + */ + CPresenceInfoFilterImp* iPif; + CPresenceInfoFilterImp* iMergedPif; + + /** + * + */ + COwnPresenceSubscriptionItem::TSubscriptionStatus iSubscriptionStatus; + + /** + * + */ + COwnPresenceSubscriptionItem* iOwnPresence; + + /** + * Don't force event. + */ + TBool iDoNotForce; + }; + + +#endif // CPSCOPERATIONSUBSCRIBEOWNPRESENCE_H diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresenceoperations/presencepublishing/operationsubscribewatcherlist.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresenceoperations/presencepublishing/operationsubscribewatcherlist.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,170 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Presence watcher list subscription operator + * +*/ + + +#include +#include +#include + +#include "operationsubscribewatcherlist.h" +#include "presencedatacacheimp.h" +#include "ximppanics.h" +#include "operationsynthesisesubscriptionevent.h" +#include "ximphost.h" +#include "ximpstatusimp.h" +#include "ximppsccontextimp.h" +#include "protocolpresencedatahostimp.h" + +#include "ximptrace.h" + +// ============================ MEMBER FUNCTIONS ============================= + +// --------------------------------------------------------------------------- +// COperationSubscribeWatcherList::COperationSubscribeWatcherList() +// --------------------------------------------------------------------------- +// +EXPORT_C COperationSubscribeWatcherList::COperationSubscribeWatcherList() + { + } + + +// --------------------------------------------------------------------------- +// COperationSubscribeWatcherList::~COperationSubscribeWatcherList() +// --------------------------------------------------------------------------- +// +COperationSubscribeWatcherList::~COperationSubscribeWatcherList() + { + if( iWatcherList ) + { + iWatcherList->Close(); + } + } + +// --------------------------------------------------------------------------- +// COperationSubscribeWatcherList::ConstructL() +// --------------------------------------------------------------------------- +// +void COperationSubscribeWatcherList::ConstructL( const TDesC8& /*aParamPck*/ ) + { + } + + +// --------------------------------------------------------------------------- +// COperationSubscribeWatcherList::ProcessL() +// --------------------------------------------------------------------------- +// +void COperationSubscribeWatcherList::ProcessL() + { + TRACE(_L("COperationSubscribeWatcherList::ProcessL()" ) ); + CXIMPOperationBase::ProcessL(); + + CWatcherListSubscriptionItem& watcherList = + iMyHost->PresenceDataAccess().PresenceDataCache().WatcherListSubscriptionItemLC(); + CleanupStack::Pop(); // watcherList + iWatcherList = &watcherList; + + iSubscriptionStatus = iWatcherList->SubscriptionStatus( iContext ); + MProtocolPresencePublishing& publishing = iMyHost->GetConnection().ProtocolPresenceFeatures().PresencePublishing(); + + switch( iSubscriptionStatus ) + { + case CWatcherListSubscriptionItem::ENotSubscribedAtAll: + { + publishing.DoSubscribePresenceWatcherListL( iReqId ); + break; + } + + case CWatcherListSubscriptionItem::ESubscribedForOtherCtxOnly: + case CWatcherListSubscriptionItem::ESubscribedForCtxOnly: + case CWatcherListSubscriptionItem::ESubscribedForCtxAndOthers: + { + iMyHost->FakeCompleteRequest( iReqId, KErrNone ); + break; + } + + XIMP_DEFAULT_CASE_UNSUPPORTED( NXIMPPrivPanic::EInvalidSubscriptionStatus ); + } + } + + +// --------------------------------------------------------------------------- +// COperationSubscribeWatcherList::RequestCompleted() +// --------------------------------------------------------------------------- +// +void COperationSubscribeWatcherList::RequestCompletedL() + { + TRACE(_L("COperationSubscribeWatcherList::RequestCompletedL()" ) ); + CXIMPOperationBase::RequestCompletedL(); + + if( iStatusObj->ResultCode() == KErrNone ) + { + switch( iSubscriptionStatus ) + { + case CWatcherListSubscriptionItem::ENotSubscribedAtAll: + case CWatcherListSubscriptionItem::ESubscribedForOtherCtxOnly: + { + iWatcherList->AddSubscriberL( iContext ); + break; + } + + case CWatcherListSubscriptionItem::ESubscribedForCtxOnly: + case CWatcherListSubscriptionItem::ESubscribedForCtxAndOthers: + { + break; + } + + XIMP_DEFAULT_CASE_UNSUPPORTED( NXIMPPrivPanic::EInvalidSubscriptionStatus ); + } + + SynthesiseEventL(); + } + } + + +// --------------------------------------------------------------------------- +// COperationSubscribeWatcherList::Type() +// --------------------------------------------------------------------------- +// +TInt + COperationSubscribeWatcherList::Type() const + { + return NPresenceOps::EPrSubscribePresenceWatcherList; + } + +// --------------------------------------------------------------------------- +// COperationSubscribeWatcherList::SynthesiseEventL() +// --------------------------------------------------------------------------- +// +void COperationSubscribeWatcherList::SynthesiseEventL() + { + TBool force = + ( iSubscriptionStatus == CWatcherListSubscriptionItem::ESubscribedForCtxOnly || + iSubscriptionStatus == CWatcherListSubscriptionItem::ESubscribedForCtxAndOthers ) ? ETrue : EFalse; + + COperationSynthesiseSubscriptionEvent* synthOp = + new ( ELeave ) COperationSynthesiseSubscriptionEvent( + COperationSynthesiseSubscriptionEvent::EPresenceWatcherList, + force ); + CleanupStack::PushL( synthOp ); + synthOp->BaseConstructL( TXIMPRequestId(), iContext ); + iMyHost->AddNewOperationL( *synthOp ); + CleanupStack::Pop( synthOp ); + } + + + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresenceoperations/presencepublishing/operationsubscribewatcherlist.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresenceoperations/presencepublishing/operationsubscribewatcherlist.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,76 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Presentity group list subscription operator + * +*/ + +#ifndef CPSCOPERATIONSUBSCRIBEWATCHERLIST_H +#define CPSCOPERATIONSUBSCRIBEWATCHERLIST_H + + +#include +#include + +#include "ximpoperationbase.h" +#include "watcherlistsubscriptionitem.h" +#include "presenceoperationdefs.h" + +/** + * Presence interest registration operation. + * + * @lib ximpoperations.lib + * @since S60 v4.0 + */ +class COperationSubscribeWatcherList : public CXIMPOperationBase + { + + public: + + IMPORT_C COperationSubscribeWatcherList(); + + void ConstructL( const TDesC8& aParamPck ); + + ~COperationSubscribeWatcherList(); + + + public: // from CXIMPOperationBase + + void ProcessL(); + + void RequestCompletedL(); + + TInt Type() const; + + private: // Helper methods + + /** + * Synthesise event after completion + */ + void SynthesiseEventL(); + + private: // data + + /** + * Group list access. + */ + CWatcherListSubscriptionItem* iWatcherList; + + /** + * Subscription status + */ + CWatcherListSubscriptionItem::TSubscriptionStatus iSubscriptionStatus; + }; + + +#endif // CPSCOPERATIONSUBSCRIBEWATCHERLIST_H diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresenceoperations/presencepublishing/operationunsubscribeownpresence.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresenceoperations/presencepublishing/operationunsubscribeownpresence.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,188 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: implementation of COperationUnsubscribeOwnPresence + * +*/ + + +#include +#include +#include + +#include "operationunsubscribeownpresence.h" +#include "presenceinfofilterimp.h" +#include "presencedatacacheimp.h" +#include "ximppanics.h" +#include "operationsynthesisesubscriptionevent.h" +#include "ximphost.h" +#include "ximpstatusimp.h" +#include "ximppsccontextimp.h" +#include "protocolpresencedatahostimp.h" + +#include "ximptrace.h" +// ============================ MEMBER FUNCTIONS ============================= + +// --------------------------------------------------------------------------- +// COperationUnsubscribeOwnPresence::COperationUnsubscribeOwnPresence() +// --------------------------------------------------------------------------- +// +EXPORT_C COperationUnsubscribeOwnPresence::COperationUnsubscribeOwnPresence() + { + } + + +// --------------------------------------------------------------------------- +// COperationUnsubscribeOwnPresence::~COperationUnsubscribeOwnPresence() +// --------------------------------------------------------------------------- +// +COperationUnsubscribeOwnPresence::~COperationUnsubscribeOwnPresence() + { + if( iOwnPresence ) + { + iOwnPresence->Close(); + } + delete iPifWithoutCtx; + } + +// --------------------------------------------------------------------------- +// COperationUnsubscribeOwnPresence::ConstructL() +// --------------------------------------------------------------------------- +// +void COperationUnsubscribeOwnPresence::ConstructL( const TDesC8& /*aParamPck*/ ) + { + } + + +// --------------------------------------------------------------------------- +// COperationUnsubscribeOwnPresence::ProcessL() +// --------------------------------------------------------------------------- +// +void COperationUnsubscribeOwnPresence::ProcessL() + { + TRACE(_L("COperationUnsubscribeOwnPresence::ProcessL()" ) ); + CXIMPOperationBase::ProcessL(); + + COwnPresenceSubscriptionItem& ownPresence = + iMyHost->PresenceDataAccess().PresenceDataCache().OwnPresenceSubscriptionItemLC(); + CleanupStack::Pop(); // ownPresence + iOwnPresence = &ownPresence; + + iSubscriptionStatus = iOwnPresence->SubscriptionStatus( iContext ); + + MProtocolPresencePublishing& publishing = iMyHost->GetConnection().ProtocolPresenceFeatures().PresencePublishing(); + + switch( iSubscriptionStatus ) + { + case COwnPresenceSubscriptionItem::ESubscribedForCtxOnly: + { + // Do subscribe + publishing.DoUnsubscribeOwnPresenceL( iReqId ); + break; + } + case COwnPresenceSubscriptionItem::ESubscribedForCtxAndOthers: + { + iPifWithoutCtx = iOwnPresence->CollectSubscriptionPifWithoutCtxL( iContext ); + + if ( iOwnPresence->SubscriptionPif().Contains( *iPifWithoutCtx ) ) + { + publishing.DoUpdateOwnPresenceSubscriptionPifL( *iPifWithoutCtx, iReqId ); + } + else + { + iMyHost->FakeCompleteRequest( iReqId, KErrNone ); + } + break; + } + + case COwnPresenceSubscriptionItem::ENotSubscribedAtAll: + case COwnPresenceSubscriptionItem::ESubscribedForOtherCtxOnly: + { + iMyHost->FakeCompleteRequest( iReqId, KErrNone ); + break; + } + + XIMP_DEFAULT_CASE_UNSUPPORTED( NXIMPPrivPanic::EInvalidSubscriptionStatus ); + } + } + +// --------------------------------------------------------------------------- +// COperationUnsubscribeOwnPresence::RequestCompleted() +// --------------------------------------------------------------------------- +// +void COperationUnsubscribeOwnPresence::RequestCompletedL() + { + TRACE(_L("COperationUnsubscribeWatcherList::RequestCompletedL()" ) ); + CXIMPOperationBase::RequestCompletedL(); + + if( iStatusObj->ResultCode() == KErrNone ) + { + iContext->SetPresenceInfoFilterL( MXIMPPscContext::EOwnPresenceFilter, + NULL, NULL ); + + switch( iSubscriptionStatus ) + { + case COwnPresenceSubscriptionItem::ESubscribedForCtxOnly: + case COwnPresenceSubscriptionItem::ESubscribedForCtxAndOthers: + { + iOwnPresence->RemoveSubscriber( iContext ); + iContext->SetPresenceInfoFilterL( MXIMPPscContext::EOwnPresenceFilter, NULL ); + if( iPifWithoutCtx ) + { + iOwnPresence->SetSubscriptionPif( iPifWithoutCtx ); + iPifWithoutCtx = NULL; + } + break; + } + + case COwnPresenceSubscriptionItem::ENotSubscribedAtAll: + case COwnPresenceSubscriptionItem::ESubscribedForOtherCtxOnly: + { + break; + } + + XIMP_DEFAULT_CASE_UNSUPPORTED( NXIMPPrivPanic::EInvalidSubscriptionStatus ); + } + + SynthesiseEventL(); + } + } + + +// --------------------------------------------------------------------------- +// COperationUnsubscribeOwnPresence::Type() +// --------------------------------------------------------------------------- +// +TInt + COperationUnsubscribeOwnPresence::Type() const + { + return NPresenceOps::EPrUnsubscribeOwnPresence; + } + +// --------------------------------------------------------------------------- +// COperationUnsubscribeOwnPresence::SynthesiseEventL() +// --------------------------------------------------------------------------- +// +void COperationUnsubscribeOwnPresence::SynthesiseEventL() + { + COperationSynthesiseSubscriptionEvent* synthOp = + new ( ELeave ) COperationSynthesiseSubscriptionEvent( + COperationSynthesiseSubscriptionEvent::EOwnPresence, EFalse ); + CleanupStack::PushL( synthOp ); + synthOp->BaseConstructL( TXIMPRequestId(), iContext ); + iMyHost->AddNewOperationL( *synthOp ); + CleanupStack::Pop( synthOp ); + } + + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresenceoperations/presencepublishing/operationunsubscribeownpresence.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresenceoperations/presencepublishing/operationunsubscribeownpresence.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,82 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Presence interest registration operation + * +*/ + +#ifndef CPSCOPERATIONUNSUBSCRIBEOWNPRESENCE_H +#define CPSCOPERATIONUNSUBSCRIBEOWNPRESENCE_H + + +#include +#include + +#include "ximpoperationbase.h" +#include "ownpresencesubscriptionitem.h" +#include "presenceoperationdefs.h" + +/** + * Presence interest registration operation. + * + * @lib ximpoperations.lib + * @since S60 v4.0 + */ +class COperationUnsubscribeOwnPresence : public CXIMPOperationBase + { + public: + + IMPORT_C COperationUnsubscribeOwnPresence(); + + void ConstructL( const TDesC8& aParamPck ); + + ~COperationUnsubscribeOwnPresence(); + + + public: // from CXIMPOperationBase + + void ProcessL(); + + void RequestCompletedL(); + + TInt Type() const; + + private: // Helper methods + + /** + * Synthesise event after completion + */ + void SynthesiseEventL(); + + private: // data + + /** + * + */ + COwnPresenceSubscriptionItem::TSubscriptionStatus iSubscriptionStatus; + + /** + * + */ + COwnPresenceSubscriptionItem* iOwnPresence; + + /** + * + */ + CPresenceInfoFilterImp* iPifWithoutCtx; + + + }; + + +#endif // CPSCOPERATIONUNSUBSCRIBEOWNPRESENCE_H diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresenceoperations/presencepublishing/operationunsubscribewatcherlist.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresenceoperations/presencepublishing/operationunsubscribewatcherlist.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,170 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Presentity group list unsubscription operation + * +*/ + + +#include +#include +#include + +#include "operationunsubscribewatcherlist.h" +#include "presencedatacacheimp.h" +#include "ximppanics.h" +#include "operationsynthesisesubscriptionevent.h" +#include "ximphost.h" +#include "ximpstatusimp.h" +#include "ximppsccontextimp.h" +#include "protocolpresencedatahostimp.h" + +#include "ximptrace.h" + +// ============================ MEMBER FUNCTIONS ============================= + +// --------------------------------------------------------------------------- +// COperationUnsubscribeWatcherList::COperationUnsubscribeWatcherList() +// --------------------------------------------------------------------------- +// +EXPORT_C COperationUnsubscribeWatcherList::COperationUnsubscribeWatcherList() + { + } + + +// --------------------------------------------------------------------------- +// COperationUnsubscribeWatcherList::~COperationUnsubscribeWatcherList() +// --------------------------------------------------------------------------- +// +COperationUnsubscribeWatcherList::~COperationUnsubscribeWatcherList() + { + if( iWatcherList ) + { + iWatcherList->Close(); + } + } + +// --------------------------------------------------------------------------- +// COperationUnsubscribeWatcherList::ConstructL() +// --------------------------------------------------------------------------- +// +void COperationUnsubscribeWatcherList::ConstructL( const TDesC8& /*aParamPck*/ ) + { + } + + +// --------------------------------------------------------------------------- +// COperationUnsubscribeWatcherList::ProcessL() +// --------------------------------------------------------------------------- +// +void COperationUnsubscribeWatcherList::ProcessL() + { + TRACE(_L("COperationUnsubscribeWatcherList::ProcessL()" ) ); + CXIMPOperationBase::ProcessL(); + + CWatcherListSubscriptionItem& watcherList = + iMyHost->PresenceDataAccess().PresenceDataCache().WatcherListSubscriptionItemLC(); + CleanupStack::Pop(); // watcherList + iWatcherList = &watcherList; + + iSubscriptionStatus = iWatcherList->SubscriptionStatus( iContext ); + + MProtocolPresencePublishing& publishing = iMyHost->GetConnection().ProtocolPresenceFeatures().PresencePublishing(); + + switch( iSubscriptionStatus ) + { + case CWatcherListSubscriptionItem::ESubscribedForCtxOnly: + { + publishing.DoUnsubscribePresenceWatcherListL( iReqId ); + break; + } + + case CWatcherListSubscriptionItem::ESubscribedForCtxAndOthers: + { + iMyHost->FakeCompleteRequest( iReqId, KErrNone ); + break; + } + + case CWatcherListSubscriptionItem::ENotSubscribedAtAll: + case CWatcherListSubscriptionItem::ESubscribedForOtherCtxOnly: + { + iMyHost->FakeCompleteRequest( iReqId, KErrNone ); + break; + } + + XIMP_DEFAULT_CASE_UNSUPPORTED( NXIMPPrivPanic::EInvalidSubscriptionStatus ); + } + } + + +// --------------------------------------------------------------------------- +// COperationUnsubscribeWatcherList::RequestCompleted() +// --------------------------------------------------------------------------- +// +void COperationUnsubscribeWatcherList::RequestCompletedL() + { + TRACE(_L("COperationUnsubscribeWatcherList::RequestCompletedL()" ) ); + CXIMPOperationBase::RequestCompletedL(); + + if( iStatusObj->ResultCode() == KErrNone ) + { + switch( iSubscriptionStatus ) + { + case CWatcherListSubscriptionItem::ESubscribedForCtxOnly: + case CWatcherListSubscriptionItem::ESubscribedForCtxAndOthers: + { + iWatcherList->RemoveSubscriber( iContext ); + break; + } + + case CWatcherListSubscriptionItem::ENotSubscribedAtAll: + case CWatcherListSubscriptionItem::ESubscribedForOtherCtxOnly: + { + break; + } + + XIMP_DEFAULT_CASE_UNSUPPORTED( NXIMPPrivPanic::EInvalidSubscriptionStatus ); + } + SynthesiseEventL(); + } + } + + +// --------------------------------------------------------------------------- +// COperationUnsubscribeWatcherList::Type() +// --------------------------------------------------------------------------- +// +TInt + COperationUnsubscribeWatcherList::Type() const + { + return NPresenceOps::EPrUnsubscribePresenceWatcherList; + } + +// --------------------------------------------------------------------------- +// COperationUnsubscribeWatcherList::SynthesiseEventL() +// --------------------------------------------------------------------------- +// +void COperationUnsubscribeWatcherList::SynthesiseEventL() + { + COperationSynthesiseSubscriptionEvent* synthOp = + new ( ELeave ) COperationSynthesiseSubscriptionEvent( + COperationSynthesiseSubscriptionEvent::EPresenceWatcherList, + EFalse ); + CleanupStack::PushL( synthOp ); + synthOp->BaseConstructL( TXIMPRequestId(), iContext ); + iMyHost->AddNewOperationL( *synthOp ); + CleanupStack::Pop( synthOp ); + } + + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresenceoperations/presencepublishing/operationunsubscribewatcherlist.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresenceoperations/presencepublishing/operationunsubscribewatcherlist.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,75 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Presence watcher list unsubscription operation + * +*/ + +#ifndef CPSCOPERATIONUNSUBSCRIBEWATCHERLIST_H +#define CPSCOPERATIONUNSUBSCRIBEWATCHERLIST_H + + +#include +#include + +#include "ximpoperationbase.h" +#include "watcherlistsubscriptionitem.h" +#include "presenceoperationdefs.h" + +/** + * Presence interest registration operation. + * + * @lib ximpoperations.lib + * @since S60 v4.0 + */ +class COperationUnsubscribeWatcherList : public CXIMPOperationBase + { + public: + + IMPORT_C COperationUnsubscribeWatcherList(); + + void ConstructL( const TDesC8& aParamPck ); + + ~COperationUnsubscribeWatcherList(); + + + public: // from CXIMPOperationBase + + void ProcessL(); + + void RequestCompletedL(); + + TInt Type() const; + + private: // Helper methods + + /** + * Synthesise event after completion + */ + void SynthesiseEventL(); + + private: // data + + /** + * Group list access. + */ + CWatcherListSubscriptionItem* iWatcherList; + + /** + * Subscription status + */ + CWatcherListSubscriptionItem::TSubscriptionStatus iSubscriptionStatus; + }; + + +#endif // CPSCOPERATIONUNSUBSCRIBEWATCHERLIST_H diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresenceoperations/presencewatching/operationhandlepresentitypresence.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresenceoperations/presencewatching/operationhandlepresentitypresence.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,127 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: implementation of COperationHandlePresentityPresence + * +*/ + + +#include "operationhandlepresentitypresence.h" +#include "presenceinfoimp.h" +#include "ximpobjecthelpers.h" +#include "presencedatacacheimp.h" +#include "ximpidentityimp.h" +#include "presentitypresencesubscriptionitem.h" +#include "ximphost.h" + +#include "ximprestrictedobjectcollectionimp.h" +#include "protocolpresencedatahostimp.h" + +#include "ximptrace.h" +// ============================ MEMBER FUNCTIONS ============================= + +// --------------------------------------------------------------------------- +// COperationHandlePresentityPresence::~COperationHandlePresentityPresence() +// --------------------------------------------------------------------------- +// +COperationHandlePresentityPresence::~COperationHandlePresentityPresence() + { + delete iIdentity; + delete iPresenceInfo; + } + +// --------------------------------------------------------------------------- +// COperationHandlePresentityPresence::COperationHandlePresentityPresence() +// --------------------------------------------------------------------------- +// +EXPORT_C COperationHandlePresentityPresence::COperationHandlePresentityPresence( TInt aOperation ) +: iOperation( aOperation ) + { + } + +// --------------------------------------------------------------------------- +// COperationHandlePresentityPresence::ConstructL() +// --------------------------------------------------------------------------- +// +void COperationHandlePresentityPresence::ConstructL( const TDesC8& /* aParamPck */ ) + { + } + + +// --------------------------------------------------------------------------- +// COperationHandlePresentityPresence::ProcessL() +// --------------------------------------------------------------------------- +// +void COperationHandlePresentityPresence::ProcessL() + { + TRACE(_L("COperationHandlePresentityPresence::ProcessL()") ); + CXIMPOperationBase::ProcessL(); + + MXIMPBase* object = NULL; + iObjCollection->GetByType( object, MXIMPIdentity::KInterfaceId ); + if ( object ) + { + iIdentity = TXIMPGetImpClassOrPanic< CXIMPIdentityImp >::From( *object ); + } + else + { + User::Leave( KErrArgument ); + } + object = NULL; + iObjCollection->GetByType( object, MPresenceInfo::KInterfaceId ); + if( object ) + { + iPresenceInfo = TXIMPGetImpClassOrPanic< CPresenceInfoImp >::From( *object ); + } + else + { + User::Leave( KErrArgument ); + } + + CPresentityPresenceSubscriptionItem& presenceItem = + iMyHost->PresenceDataAccess().PresenceDataCache().PresentityPresenceSubscriptionItemLC( *iIdentity ); + presenceItem.SetPresenceInfoL( iPresenceInfo ); + iPresenceInfo = NULL; + + if( iOperation == NPresenceOps::EPrHandlePresentityPresenceTerminated ) + { + //presenceItem.SetSubscriptionState( MPresenceInfo::EDataSubscriptionTerminated ); + } + + TRAPD( err, presenceItem.SynthesiseSubscriptionEventToAllCtxsL() ); + CleanupStack::PopAndDestroy(); // presenceItem + iMyHost->HandleAdaptationRequestCompleted( iReqId, err ); + } + +// --------------------------------------------------------------------------- +// COperationHandlePresentityPresence::RequestCompleted() +// --------------------------------------------------------------------------- +// +void COperationHandlePresentityPresence::RequestCompletedL() + { + TRACE(_L("COperationHandlePresentityPresence::RequestCompletedL()" ) ); + CXIMPOperationBase::RequestCompletedL(); + // no special handling for error situations + } + + +// --------------------------------------------------------------------------- +// COperationHandlePresentityPresence::Type() +// --------------------------------------------------------------------------- +// +TInt COperationHandlePresentityPresence::Type() const + { + return ( TInt) iOperation; + } + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresenceoperations/presencewatching/operationhandlepresentitypresence.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresenceoperations/presencewatching/operationhandlepresentitypresence.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,75 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Handle presentity group list operation + * +*/ + +#ifndef CPSCOPERATIONHANDLEPRESENTITYPRESENCE_H +#define CPSCOPERATIONHANDLEPRESENTITYPRESENCE_H + + +#include +#include + +#include "ximpoperationbase.h" +#include "presenceoperationdefs.h" + +class CXIMPIdentityImp; +class CPresenceInfoImp; + +/** + * Publish presence operation. + * + * @lib ximpoperations.lib + * @since S60 v4.0 + */ +class COperationHandlePresentityPresence : public CXIMPOperationBase + { + + public: + + IMPORT_C COperationHandlePresentityPresence( TInt aOperation ); + + void ConstructL( const TDesC8& aParamPck ); + + ~COperationHandlePresentityPresence(); + + public: // from CXIMPOperationBase + + void ProcessL(); + + void RequestCompletedL(); + + TInt Type() const; + + private: // data + + /** + * Identity + */ + CXIMPIdentityImp* iIdentity; + + /** + * Presence info + */ + CPresenceInfoImp* iPresenceInfo; + + /** + * Operation. + */ + TInt iOperation; + }; + + +#endif // CPSCOPERATIONHANDLEPRESENTITYPRESENCE_H diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresenceoperations/presencewatching/operationsubscribepresentitygroupmemberspresence.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresenceoperations/presencewatching/operationsubscribepresentitygroupmemberspresence.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,299 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: implementation of COperationSubscribePresentityGroupMembersPresence + * +*/ + + +#include +#include +#include + +#include "operationsubscribepresentitygroupmemberspresence.h" +#include "presenceinfofilterimp.h" +#include "ximpidentityimp.h" +#include "ximpobjecthelpers.h" +#include "presencedatacacheimp.h" +#include "documentutils.h" +#include "ximprestrictedobjectcollectionimp.h" +#include "operationsynthesisesubscriptionevent.h" +#include "ximphost.h" +#include "ximpstatusimp.h" +#include "ximppsccontextimp.h" +#include "ximppanics.h" +#include "protocolpresencedatahostimp.h" + +#include "ximptrace.h" +// ============================ MEMBER FUNCTIONS ============================= + +// --------------------------------------------------------------------------- +// COperationSubscribePresentityGroupMembersPresence::COperationSubscribePresentityGroupMembersPresence() +// --------------------------------------------------------------------------- +// +EXPORT_C COperationSubscribePresentityGroupMembersPresence::COperationSubscribePresentityGroupMembersPresence() + { + } + + +// --------------------------------------------------------------------------- +// COperationSubscribePresentityGroupMembersPresence::~COperationSubscribePresentityGroupMembersPresence() +// --------------------------------------------------------------------------- +// +COperationSubscribePresentityGroupMembersPresence::~COperationSubscribePresentityGroupMembersPresence() + { + delete iMergedPif; + delete iPif; + delete iGroupId; + if( iSubItem ) + { + iSubItem->Close(); + } + } + +// --------------------------------------------------------------------------- +// COperationSubscribePresentityGroupMembersPresence::ConstructL() +// --------------------------------------------------------------------------- +// +void COperationSubscribePresentityGroupMembersPresence::ConstructL( const TDesC8& aParamPck ) + { + RXIMPObjOwningPtrArray< HBufC8 > packArray; + CleanupClosePushL( packArray ); + TXIMPHBuf8Packer::UnPackArrayL( packArray, aParamPck ); + + iGroupId = CXIMPIdentityImp::NewLC(); + CleanupStack::Pop( iGroupId ); + TXIMPObjectPacker< CXIMPIdentityImp >::UnPackL( *iGroupId, *( packArray[ 0 ] ) ); + + iPif = CPresenceInfoFilterImp::NewLC(); + CleanupStack::Pop( iPif ); + TXIMPObjectPacker< CPresenceInfoFilterImp >::UnPackL( *iPif, *( packArray[ 1 ] ) ); + + CleanupStack::PopAndDestroy(); // packArray + } + + +// --------------------------------------------------------------------------- +// COperationSubscribePresentityGroupMembersPresence::ProcessL() +// --------------------------------------------------------------------------- +// +void COperationSubscribePresentityGroupMembersPresence::ProcessL() + { + TRACE(_L("COperationSubscribePresentityGroupMembersPresence::ProcessL() - begin" ) ); + CXIMPOperationBase::ProcessL(); + + CPresentityGroupMembersPresenceSubscriptionItem& subItem = + iMyHost->PresenceDataAccess().PresenceDataCache().PresentityGroupMembersPresenceSubscriptionItemLC( *iGroupId ); + CleanupStack::Pop(); // subItem + iSubItem = &subItem; + + // Get the subscription status + // Notice that if there is more than one client and clients are using identity + // which will alternate for request complete, this will affect wrong logic mapping + // for subscription operation. + + // For example: Client 1 is subscription "name" and server alters it to name@domain.com + // Client 2 subscribes with "name" and it will get subscription status ENotSubscribedAtAll + // when it should get ESubscribedForOtherCtxOnly. + iSubscriptionStatus = iSubItem->SubscriptionStatus( iContext ); + + MProtocolPresenceWatching& watching = iMyHost->GetConnection().ProtocolPresenceFeatures().PresenceWatching(); + + TRACE(_L("COperationSubscribePresentityGroupMembersPresence::ProcessL() - start action" ) ); + + switch( iSubscriptionStatus ) + { + case CPresentityGroupMembersPresenceSubscriptionItem::ENotSubscribedAtAll: + { + TRACE(_L("COperationSubscribePresentityGroupMembersPresence::ProcessL() - case CPresentityGroupMembersPresenceSubscriptionItem::ENotSubscribedAtAll" ) ); + + iMergedPif = TXIMPObjectCloner< CPresenceInfoFilterImp >::CloneL( *iPif ); + watching.DoSubscribePresentityGroupMembersPresenceL( *iGroupId, + *iMergedPif, + iReqId ); + break; + } + case CPresentityGroupMembersPresenceSubscriptionItem::ESubscribedForOtherCtxOnly: + { + TRACE(_L("COperationSubscribePresentityGroupMembersPresence::ProcessL() - case CPresentityGroupMembersPresenceSubscriptionItem::ESubscribedForOtherCtxOnly" ) ); + + // Aggregate subscription and context pifs + // Check aggregate and if needed.. update subscription + iMergedPif = DocumentUtils::InfoFilterUnionL( iSubItem->SubscriptionPif(), *iPif ); + if( iMergedPif->Contains( iSubItem->SubscriptionPif() ) ) + { + TRACE(_L("COperationSubscribePresentityGroupMembersPresence::ProcessL() - if( iMergedPif->Contains( iSubItem->SubscriptionPif() ) ) " ) ); + + watching.DoUpdatePresentityGroupMembersPresenceSubscriptionPifL( *iGroupId, + *iMergedPif, + iReqId ); + } + else + { + TRACE(_L("COperationSubscribePresentityGroupMembersPresence::ProcessL() - iMyHost->FakeCompleteRequest" ) ); + iMyHost->FakeCompleteRequest( iReqId, KErrNone ); + } + break; + } + case CPresentityGroupMembersPresenceSubscriptionItem::ESubscribedForCtxOnly: + case CPresentityGroupMembersPresenceSubscriptionItem::ESubscribedForCtxAndOthers: + { + TRACE(_L("COperationSubscribePresentityGroupMembersPresence::ProcessL() - case CPresentityGroupMembersPresenceSubscriptionItem::ESubscribedForCtxOnly and ESubscribedForCtxAndOthers" ) ); + + CPresenceInfoFilterImp* oldPif = + iContext->PresenceInfoFilter( MXIMPPscContext::EPresentityGroupMemberPresenceFilter, iGroupId ); + CPresenceInfoFilterImp& oldMergedPif = iSubItem->SubscriptionPif(); + TBool makeUnion( EFalse ); + if( !oldPif ) + { + TRACE(_L("COperationSubscribePresentityGroupMembersPresence::ProcessL() no old pif" ) ); + makeUnion = ETrue; + } + else if ( *oldPif != *iPif ) + { + makeUnion = ETrue; + } + if( makeUnion ) + { + TRACE(_L("COperationSubscribePresentityGroupMembersPresence::ProcessL() - if( *oldPif != *iPif )" ) ); + + iDoNotForce = ETrue; + CPresenceInfoFilterImp* withoutPif = + iSubItem->CollectSubscriptionPifWithoutCtxL( iContext ); + iMergedPif = DocumentUtils::InfoFilterUnionL( *withoutPif, *iPif ); + } + else + { + TRACE(_L("COperationSubscribePresentityGroupMembersPresence::ProcessL() - iMergedPif = TXIMPObjectCloner< CPresenceInfoFilterImp >::CloneL( oldMergedPif );" ) ); + + iMergedPif = TXIMPObjectCloner< CPresenceInfoFilterImp >::CloneL( oldMergedPif ); + } + + if( iMergedPif->Contains( oldMergedPif ) ) + { + TRACE(_L("COperationSubscribePresentityGroupMembersPresence::ProcessL() - if( iMergedPif->Contains( oldMergedPif ) )" ) ); + + iDoNotForce = ETrue; + watching.DoUpdatePresentityGroupMembersPresenceSubscriptionPifL( *iGroupId, *iMergedPif, iReqId ); + } + else + { + TRACE(_L("COperationSubscribePresentityGroupMembersPresence::ProcessL() - iMyHost->FakeCompleteRequest( iReqId, KErrNone );" ) ); + + iMyHost->FakeCompleteRequest( iReqId, KErrNone ); + } + break; + } + + XIMP_DEFAULT_CASE_UNSUPPORTED( NXIMPPrivPanic::EInvalidSubscriptionStatus ); + } + + TRACE(_L("COperationSubscribePresentityGroupMembersPresence::ProcessL() - end" ) ); + } + + +// --------------------------------------------------------------------------- +// COperationSubscribePresentityGroupMembersPresence::RequestCompletedL() +// --------------------------------------------------------------------------- +// +void COperationSubscribePresentityGroupMembersPresence::RequestCompletedL() + { + TRACE(_L("COperationSubscribePresentityGroupMembersPresence::RequestCompletedL() - begin" ) ); + CXIMPOperationBase::RequestCompletedL(); + + TRACE(_L("COperationSubscribePresentityGroupMembersPresence::RequestCompletedL() : after CXIMPOperationBase::RequestCompletedL" ) ); + if( iStatusObj->ResultCode() == KErrNone ) + { + TRACE(_L("COperationSubscribePresentityGroupMembersPresence::RequestCompletedL() : iStatusObj->ResultCode() == KErrNone " ) ); + + if( iSubscriptionStatus == + CPresentityGroupMembersPresenceSubscriptionItem::ENotSubscribedAtAll ) + { + TRACE(_L("COperationSubscribePresentityGroupMembersPresence::RequestCompletedL() : iSubscriptionStatus == ENotSubscribedAtAll " ) ); + + MXIMPBase* object = NULL; + iObjCollection->GetByType( object, MXIMPIdentity::KInterfaceId ); + if( object ) + { + TRACE(_L("COperationSubscribePresentityGroupMembersPresence::RequestCompletedL got altered identity()")); + delete iGroupId; + iGroupId = TXIMPGetImpClassOrPanic< CXIMPIdentityImp >::From( *object ); + + // Got altered identity. If it differs from original + // we'll create a new subscription item and close the old. + CPresentityGroupMembersPresenceSubscriptionItem& altSubItem = + iMyHost->PresenceDataAccess().PresenceDataCache().PresentityGroupMembersPresenceSubscriptionItemLC( *iGroupId ); + + iSubItem->Close(); + iSubItem = &altSubItem; + + CleanupStack::Pop(); // altSubItem + } + } + + TRACE(_L("COperationSubscribePresentityGroupMembersPresence::RequestCompletedL() : before iSubItem->AddSubscriberL")); + TRACE_1(_L(" iSubscriptionStatus = %d" ), (TInt)iSubscriptionStatus ); + if( iSubscriptionStatus == + CPresentityGroupMembersPresenceSubscriptionItem::ENotSubscribedAtAll || + iSubscriptionStatus == + CPresentityGroupMembersPresenceSubscriptionItem::ESubscribedForOtherCtxOnly ) + { + iSubItem->AddSubscriberL( iContext ); + TRACE(_L("COperationSubscribePresentityGroupMembersPresence::RequestCompletedL(): iSubItem->AddSubscriberL( iContext ) called: " ) ); + } + + iContext->SetPresenceInfoFilterL( MXIMPPscContext::EPresentityGroupMemberPresenceFilter, + iPif, iGroupId ); + iPif = NULL; + iSubItem->SetSubscriptionPif( iMergedPif ); + iMergedPif = NULL; + + SynthesiseEventL(); + } + + TRACE(_L("COperationSubscribePresentityGroupMembersPresence::RequestCompletedL(): end " ) ); + } + +// --------------------------------------------------------------------------- +// COperationSubscribePresentityGroupMembersPresence::Type() +// --------------------------------------------------------------------------- +// +TInt + COperationSubscribePresentityGroupMembersPresence::Type() const + { + return NPresenceOps::EPrSubscribePresentityGroupMembersPresence; + } + +// --------------------------------------------------------------------------- +// COperationSubscribePresentityGroupMembersPresence::SynthesiseEventL() +// --------------------------------------------------------------------------- +// +void COperationSubscribePresentityGroupMembersPresence::SynthesiseEventL() + { + TBool force = + ( iSubscriptionStatus == CPresentityGroupMembersPresenceSubscriptionItem::ESubscribedForCtxOnly || + iSubscriptionStatus == CPresentityGroupMembersPresenceSubscriptionItem::ESubscribedForCtxAndOthers ) ? ETrue : EFalse; + TRACE_1(_L("COperationSubscribePresentityGroupMembersPresence::SynthesiseEventL - force=%d" ) , force); + COperationSynthesiseSubscriptionEvent* synthOp = + new ( ELeave ) COperationSynthesiseSubscriptionEvent( + COperationSynthesiseSubscriptionEvent::EPresentityGroupMembersPresence, force && !iDoNotForce ); + CleanupStack::PushL( synthOp ); + synthOp->BaseConstructL( TXIMPRequestId(), iContext ); + synthOp->ConstructL( *iGroupId ); + iMyHost->AddNewOperationL( *synthOp ); + CleanupStack::Pop( synthOp ); + } + + + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresenceoperations/presencewatching/operationsubscribepresentitygroupmemberspresence.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresenceoperations/presencewatching/operationsubscribepresentitygroupmemberspresence.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,97 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Operationon SubscribePresentityGroupMembers Presence + * +*/ + +#ifndef CPSCOPERATIONSUBSCRIBEPRESENTITYGROUPMEMBERSPRESENCE_H +#define CPSCOPERATIONSUBSCRIBEPRESENTITYGROUPMEMBERSPRESENCE_H + + +#include +#include + +#include "ximpoperationbase.h" +#include "presentitygroupmemberspresencesubscriptionitem.h" + +/** + * Group members presence subscription + * + * @lib ximpoperations.lib + * @since S60 v4.0 + */ +class COperationSubscribePresentityGroupMembersPresence : public CXIMPOperationBase + { + + public: + + IMPORT_C COperationSubscribePresentityGroupMembersPresence(); + + void ConstructL( const TDesC8& aParamPck ); + + ~COperationSubscribePresentityGroupMembersPresence(); + + + public: // from CXIMPOperationBase + + void ProcessL(); + + void RequestCompletedL(); + + TInt Type() const; + + private: // Helper methods + + /** + * Synthesise event after completion + */ + void SynthesiseEventL(); + + private: // data + + /** + * Presentity address + * Own. + */ + CXIMPIdentityImp* iGroupId; + + /** + * Subscription item + */ + CPresentityGroupMembersPresenceSubscriptionItem* iSubItem; + + /** + * Presence info filter having new presence info filter for context. + * Own. + */ + CPresenceInfoFilterImp* iMergedPif; + + /** + * Pif from call + */ + CPresenceInfoFilterImp* iPif; + + /** + * Subscription status + */ + CPresentityGroupMembersPresenceSubscriptionItem::TSubscriptionStatus iSubscriptionStatus; + + /** + * Don't force event. + */ + TBool iDoNotForce; + }; + + +#endif // CPSCOPERATIONSUBSCRIBEPRESENTITYGROUPMEMBERSPRESENCE_H diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresenceoperations/presencewatching/operationsubscribepresentitypresence.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresenceoperations/presencewatching/operationsubscribepresentitypresence.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,279 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: implementation of COperationSubscribePresentityPresence + * +*/ + + +#include +#include +#include + +#include "operationsubscribepresentitypresence.h" +#include "presenceinfofilterimp.h" +#include "ximpidentityimp.h" +#include "ximpobjecthelpers.h" +#include "documentutils.h" +#include "presencedatacacheimp.h" +#include "ximppanics.h" +#include "operationsynthesisesubscriptionevent.h" +#include "ximprestrictedobjectcollectionimp.h" +#include "ximphost.h" +#include "ximpstatusimp.h" +#include "ximppsccontextimp.h" +#include "protocolpresencedatahostimp.h" + +#include "ximptrace.h" + +// ============================ MEMBER FUNCTIONS ============================= + +// --------------------------------------------------------------------------- +// COperationSubscribePresentityPresence::COperationSubscribePresentityPresence() +// --------------------------------------------------------------------------- +// +EXPORT_C COperationSubscribePresentityPresence::COperationSubscribePresentityPresence() + { + } + + +// --------------------------------------------------------------------------- +// COperationSubscribePresentityPresence::~COperationSubscribePresentityPresence() +// --------------------------------------------------------------------------- +// +COperationSubscribePresentityPresence::~COperationSubscribePresentityPresence() + { + delete iPif; + delete iMergedPif; + delete iIdentity; + if( iSubItem ) + { + iSubItem->Close(); + } + } + +// --------------------------------------------------------------------------- +// COperationSubscribePresentityPresence::ConstructL() +// --------------------------------------------------------------------------- +// +void COperationSubscribePresentityPresence::ConstructL( const TDesC8& aParamPck ) + { + RXIMPObjOwningPtrArray< HBufC8 > packArray; + CleanupClosePushL( packArray ); + TXIMPHBuf8Packer::UnPackArrayL( packArray, aParamPck ); + + iIdentity = CXIMPIdentityImp::NewLC(); + CleanupStack::Pop( iIdentity ); + TXIMPObjectPacker< CXIMPIdentityImp >::UnPackL( *iIdentity, *( packArray[ 0 ] ) ); + + iPif = CPresenceInfoFilterImp::NewLC(); + CleanupStack::Pop( iPif ); + TXIMPObjectPacker< CPresenceInfoFilterImp >::UnPackL( *iPif, *( packArray[ 1 ] ) ); + + CleanupStack::PopAndDestroy(); // packArray + } + + +// --------------------------------------------------------------------------- +// COperationSubscribePresentityPresence::ProcessL() +// --------------------------------------------------------------------------- +// +void COperationSubscribePresentityPresence::ProcessL() + { + TRACE(_L("COperationSubscribePresentityPresence::ProcessL()" ) ); + CXIMPOperationBase::ProcessL(); + + // MatchAddressTo( subscriptions, iIdentity ) + CPresentityPresenceSubscriptionItem& subItem = + iMyHost->PresenceDataAccess().PresenceDataCache().PresentityPresenceSubscriptionItemLC( *iIdentity ); + CleanupStack::Pop(); // subItem + iSubItem = &subItem; + + // Get the subscription status + // Notice that if there is more than one client and clients are using identity + // which will alternate for request complete, this will affect wrong logic mapping + // for subscription operation. + + // For example: Client 1 is subscription "name" and server alters it to name@domain.com + // Client 2 subscribes with "name" and it will get subscription status ENotSubscribedAtAll + // when it should get ESubscribedForOtherCtxOnly. + iSubscriptionStatus = iSubItem->SubscriptionStatus( iContext ); + + MProtocolPresenceWatching& watching = iMyHost->GetConnection().ProtocolPresenceFeatures().PresenceWatching(); + + switch( iSubscriptionStatus ) + { + case CPresentityPresenceSubscriptionItem::ENotSubscribedAtAll: + { + TRACE(_L("COperationSubscribePresentityPresence::ProcessL() not subscribed" ) ); + iMergedPif = TXIMPObjectCloner< CPresenceInfoFilterImp >::CloneL( *iPif ); + // If this leaves, subscription is not created + watching.DoSubscribePresentityPresenceL( iSubItem->Identity(), + *iMergedPif, + iReqId ); + break; + } + case CPresentityPresenceSubscriptionItem::ESubscribedForOtherCtxOnly: + { + TRACE(_L("COperationSubscribePresentityPresence::ProcessL() subscribed for other ctx" ) ); + // Aggregate subscription and context pifs + // Check aggregate and if needed.. update subscription + iMergedPif = DocumentUtils::InfoFilterUnionL( iSubItem->SubscriptionPif(), *iPif ); + if( iMergedPif->Contains( iSubItem->SubscriptionPif() ) ) + { + TRACE(_L("COperationSubscribePresentityPresence::ProcessL() DoUpdatePresentityPresenceSubscriptionPifL 1" ) ); + // If this leaves, subscription is not created + watching.DoUpdatePresentityPresenceSubscriptionPifL( *iIdentity, *iMergedPif, iReqId ); + } + else + { + TRACE(_L("COperationSubscribePresentityPresence::ProcessL() FakeCompleteRequest" ) ); + iMyHost->FakeCompleteRequest( iReqId, KErrNone ); + } + break; + } + case CPresentityPresenceSubscriptionItem::ESubscribedForCtxOnly: + case CPresentityPresenceSubscriptionItem::ESubscribedForCtxAndOthers: + { + TRACE(_L("COperationSubscribePresentityPresence::ProcessL() subscribed" ) ); + CPresenceInfoFilterImp* oldPif = + iContext->PresenceInfoFilter( MXIMPPscContext::EPresentityPresenceFilter, iIdentity ); + CPresenceInfoFilterImp& oldMergedPif = iSubItem->SubscriptionPif(); + TBool fake( ETrue ); + TBool makeUnion( EFalse ); + if( !oldPif ) + { + TRACE(_L("COperationSubscribePresentityPresence::ProcessL() no old pif" ) ); + makeUnion = ETrue; + } + else if ( *oldPif != *iPif ) + { + makeUnion = ETrue; + } + if( makeUnion ) + { + iDoNotForce = ETrue; + CPresenceInfoFilterImp* withoutPif = + iSubItem->CollectSubscriptionPifWithoutCtxL( iContext ); + iMergedPif = DocumentUtils::InfoFilterUnionL( *withoutPif, *iPif ); + if( iMergedPif->Contains( oldMergedPif ) ) + { + fake = EFalse; + TRACE(_L("COperationSubscribePresentityPresence::ProcessL() DoUpdatePresentityPresenceSubscriptionPifL 2" ) ); + watching.DoUpdatePresentityPresenceSubscriptionPifL( *iIdentity, *iMergedPif, iReqId ); + } + } + else + { + iMergedPif = TXIMPObjectCloner< CPresenceInfoFilterImp >::CloneL( oldMergedPif ); + } + + if( fake ) + { + TRACE(_L("COperationSubscribePresentityPresence::ProcessL() FakeCompleteRequest" ) ); + iMyHost->FakeCompleteRequest( iReqId, KErrNone ); + } + break; + } + + XIMP_DEFAULT_CASE_UNSUPPORTED( NXIMPPrivPanic::EInvalidSubscriptionStatus ); + } + } + +// --------------------------------------------------------------------------- +// COperationSubscribePresentityPresence::RequestCompletedL() +// --------------------------------------------------------------------------- +// +void COperationSubscribePresentityPresence::RequestCompletedL() + { + TRACE(_L("COperationSubscribePresentityPresence::RequestCompletedL()" ) ); + CXIMPOperationBase::RequestCompletedL(); + + if( iStatusObj->ResultCode() == KErrNone ) + { + if( iSubscriptionStatus == CPresentityPresenceSubscriptionItem::ENotSubscribedAtAll ) + { + TRACE(_L("COperationSubscribePresentityPresence::RequestCompletedL() ENotSubscribedAtAll" ) ); + MXIMPBase* object = NULL; + iObjCollection->GetByType( object, MXIMPIdentity::KInterfaceId ); + if( object ) + { + TRACE(_L("COperationSubscribePresentityPresence::RequestCompletedL() identity change" ) ); + delete iIdentity; + iIdentity = TXIMPGetImpClassOrPanic< CXIMPIdentityImp >::From( *object ); + + // Got altered identity. If it differs from original + // we'll create a new subscription item and close the old. + CPresentityPresenceSubscriptionItem& altSubItem = + iMyHost->PresenceDataAccess().PresenceDataCache().PresentityPresenceSubscriptionItemLC( *iIdentity ); + + iSubItem->Close(); + iSubItem = &altSubItem; + + CleanupStack::Pop(); // altSubItem + } + } + + if( iSubscriptionStatus == CPresentityPresenceSubscriptionItem::ENotSubscribedAtAll || + iSubscriptionStatus == CPresentityPresenceSubscriptionItem::ESubscribedForOtherCtxOnly ) + { + TRACE(_L("COperationSubscribePresentityPresence::RequestCompletedL() calling iSubItem->AddSubscriberL" ) ); + TInt error ( KErrNone ); + TRAP( error, iSubItem->AddSubscriberL( iContext ) ); + TRACE_1( _L("COperationSubscribePresentityPresence::RequestCompletedL(): iSubItem->AddSubscriberL : error =%d"), error ); + } + + iContext->SetPresenceInfoFilterL( MXIMPPscContext::EPresentityPresenceFilter, + iPif, iIdentity ); + iPif = NULL; + iSubItem->SetSubscriptionPif( iMergedPif ); + iMergedPif = NULL; + + SynthesiseEventL(); + } + } + + +// --------------------------------------------------------------------------- +// COperationSubscribePresentityPresence::Type() +// --------------------------------------------------------------------------- +// +TInt + COperationSubscribePresentityPresence::Type() const + { + return NPresenceOps::EPrSubscribePresentityPresence; + } + +// --------------------------------------------------------------------------- +// COperationSubscribePresentityPresence::SynthesiseEventL() +// --------------------------------------------------------------------------- +// +void COperationSubscribePresentityPresence::SynthesiseEventL() + { + TBool force = + ( iSubscriptionStatus == CPresentityPresenceSubscriptionItem::ESubscribedForCtxOnly || + iSubscriptionStatus == CPresentityPresenceSubscriptionItem::ESubscribedForCtxAndOthers ) ? ETrue : EFalse; + + COperationSynthesiseSubscriptionEvent* synthOp = + new ( ELeave ) COperationSynthesiseSubscriptionEvent( + COperationSynthesiseSubscriptionEvent::EPresentityPresence, force && !iDoNotForce ); + CleanupStack::PushL( synthOp ); + synthOp->BaseConstructL( TXIMPRequestId(), iContext ); + synthOp->ConstructL( *iIdentity ); + iMyHost->AddNewOperationL( *synthOp ); + CleanupStack::Pop( synthOp ); + } + + + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresenceoperations/presencewatching/operationsubscribepresentitypresence.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresenceoperations/presencewatching/operationsubscribepresentitypresence.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,101 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: implementation of COperationSubscribePresentityPresence + * +*/ + +#ifndef CPSCOPERATIONSUBSCRIBEPRESENTITYPRESENCE_H +#define CPSCOPERATIONSUBSCRIBEPRESENTITYPRESENCE_H + + +#include +#include + +#include "ximpoperationbase.h" +#include "presentitypresencesubscriptionitem.h" + +class CPresenceInfoFilterImp; + +/** + * Presence interest registration operation. + * + * @lib ximpoperations.lib + * @since S60 v4.0 + */ +class COperationSubscribePresentityPresence : public CXIMPOperationBase + { + + public: + + IMPORT_C COperationSubscribePresentityPresence(); + + void ConstructL( const TDesC8& aParamPck ); + + ~COperationSubscribePresentityPresence(); + + + public: // from CXIMPOperationBase + + void ProcessL(); + + void RequestCompletedL(); + + TInt Type() const; + + private: // Helper methods + + /** + * Synthesise event after completion + */ + void SynthesiseEventL(); + + private: // data + + /** + * Presence info filter having new presence info filter for context. + * Own. + */ + CPresenceInfoFilterImp* iMergedPif; + + /** + * Presentity subscription item + * Own. + */ + CPresentityPresenceSubscriptionItem* iSubItem; + + /** + * Presentity address + * Own. + */ + CXIMPIdentityImp* iIdentity; + + /** + * Filter + * Own. + */ + CPresenceInfoFilterImp* iPif; + + /** + * Subscription status + */ + CPresentityPresenceSubscriptionItem::TSubscriptionStatus iSubscriptionStatus; + + /** + * Don't force event. + */ + TBool iDoNotForce; + }; + + +#endif // CPSCOPERATIONSUBSCRIBEPRESENTITYPRESENCE_H diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresenceoperations/presencewatching/operationunsubscribepresentitygroupmemberspresence.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresenceoperations/presencewatching/operationunsubscribepresentitygroupmemberspresence.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,193 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Presentity group members presence unsubscription operation + * +*/ + + +#include +#include +#include + +#include "operationunsubscribepresentitygroupmemberspresence.h" +#include "ximpobjecthelpers.h" +#include "ximpidentityimp.h" +#include "presencedatacacheimp.h" +#include "presenceinfofilterimp.h" +#include "operationsynthesisesubscriptionevent.h" +#include "ximphost.h" +#include "ximpstatusimp.h" +#include "ximppsccontextimp.h" +#include "ximppanics.h" +#include "protocolpresencedatahostimp.h" + +#include "ximptrace.h" +// ============================ MEMBER FUNCTIONS ============================= + +// --------------------------------------------------------------------------- +// COperationUnsubscribePresentityGroupMembersPresence::COperationUnsubscribePresentityGroupMembersPresence() +// --------------------------------------------------------------------------- +// +EXPORT_C COperationUnsubscribePresentityGroupMembersPresence::COperationUnsubscribePresentityGroupMembersPresence() + { + } + + +// --------------------------------------------------------------------------- +// COperationUnsubscribePresentityGroupMembersPresence::~COperationUnsubscribePresentityGroupMembersPresence() +// --------------------------------------------------------------------------- +// +COperationUnsubscribePresentityGroupMembersPresence::~COperationUnsubscribePresentityGroupMembersPresence() + { + delete iGroupId; + if( iSubItem ) + { + iSubItem->Close(); + } + } + +// --------------------------------------------------------------------------- +// COperationUnsubscribePresentityGroupMembersPresence::ConstructL() +// --------------------------------------------------------------------------- +// +void COperationUnsubscribePresentityGroupMembersPresence::ConstructL( const TDesC8& aParamPck ) + { + iGroupId = CXIMPIdentityImp::NewLC(); + CleanupStack::Pop( iGroupId ); + TXIMPObjectPacker< CXIMPIdentityImp >::UnPackL( *iGroupId, aParamPck ); + } + + +// --------------------------------------------------------------------------- +// COperationUnsubscribePresentityGroupMembersPresence::ProcessL() +// --------------------------------------------------------------------------- +// +void COperationUnsubscribePresentityGroupMembersPresence::ProcessL() + { + TRACE(_L("COperationUnsubscribePresentityGroupMembersPresence::ProcessL()" ) ); + CXIMPOperationBase::ProcessL(); + + CPresentityGroupMembersPresenceSubscriptionItem& subItem = + iMyHost->PresenceDataAccess().PresenceDataCache().PresentityGroupMembersPresenceSubscriptionItemLC( *iGroupId ); + CleanupStack::Pop(); // subItem + iSubItem = &subItem; + + iSubscriptionStatus = iSubItem->SubscriptionStatus( iContext ); + + MProtocolPresenceWatching& watching = iMyHost->GetConnection().ProtocolPresenceFeatures().PresenceWatching(); + + switch( iSubscriptionStatus ) + { + case CPresentityGroupMembersPresenceSubscriptionItem::ESubscribedForCtxOnly: + { + watching.DoUnsubscribePresentityGroupMembersPresenceL( *iGroupId, iReqId ); + iSubItem->RemoveSubscriber( iContext ); + break; + } + + case CPresentityGroupMembersPresenceSubscriptionItem::ESubscribedForCtxAndOthers: + { + CPresenceInfoFilterImp* pifWithoutCtx = + iSubItem->CollectSubscriptionPifWithoutCtxL( iContext ); + CleanupStack::PushL( pifWithoutCtx ); + + if ( iSubItem->SubscriptionPif().Contains( *pifWithoutCtx ) ) + { + watching.DoUpdatePresentityGroupMembersPresenceSubscriptionPifL( *iGroupId, *pifWithoutCtx, iReqId ); + } + else + { + iMyHost->FakeCompleteRequest( iReqId, KErrNone ); + } + + CleanupStack::PopAndDestroy( pifWithoutCtx ); + break; + } + + case CPresentityGroupMembersPresenceSubscriptionItem::ENotSubscribedAtAll: + case CPresentityGroupMembersPresenceSubscriptionItem::ESubscribedForOtherCtxOnly: + { + iMyHost->FakeCompleteRequest( iReqId, KErrNone ); + break; + } + + XIMP_DEFAULT_CASE_UNSUPPORTED( NXIMPPrivPanic::EInvalidSubscriptionStatus ); + } + } + +// --------------------------------------------------------------------------- +// COperationUnsubscribePresentityGroupMembersPresence::RequestCompleted() +// --------------------------------------------------------------------------- +// +void COperationUnsubscribePresentityGroupMembersPresence::RequestCompletedL() + { + TRACE(_L("COperationUnsubscribePresentityGroupMembersPresence::RequestCompletedL()" ) ); + CXIMPOperationBase::RequestCompletedL(); + + if( iStatusObj->ResultCode() == KErrNone ) + { + iContext->SetPresenceInfoFilterL( MXIMPPscContext::EPresentityGroupMemberPresenceFilter, + NULL, iGroupId ); + + switch( iSubscriptionStatus ) + { + case CPresentityGroupMembersPresenceSubscriptionItem::ESubscribedForCtxOnly: + case CPresentityGroupMembersPresenceSubscriptionItem::ESubscribedForCtxAndOthers: + { + iSubItem->RemoveSubscriber( iContext ); + break; + } + + case CPresentityGroupMembersPresenceSubscriptionItem::ENotSubscribedAtAll: + case CPresentityGroupMembersPresenceSubscriptionItem::ESubscribedForOtherCtxOnly: + { + break; + } + + XIMP_DEFAULT_CASE_UNSUPPORTED( NXIMPPrivPanic::EInvalidSubscriptionStatus ); + } + + SynthesiseEventL(); + } + } + + +// --------------------------------------------------------------------------- +// COperationUnsubscribePresentityGroupMembersPresence::Type() +// --------------------------------------------------------------------------- +// +TInt + COperationUnsubscribePresentityGroupMembersPresence::Type() const + { + return NPresenceOps::EPrUnsubscribePresentityGroupMembersPresence; + } + +// --------------------------------------------------------------------------- +// COperationUnsubscribePresentityGroupMembersPresence::SynthesiseEventL() +// --------------------------------------------------------------------------- +// +void COperationUnsubscribePresentityGroupMembersPresence::SynthesiseEventL() + { + COperationSynthesiseSubscriptionEvent* synthOp = + new ( ELeave ) COperationSynthesiseSubscriptionEvent( + COperationSynthesiseSubscriptionEvent::EPresentityGroupMembersPresence, EFalse ); + CleanupStack::PushL( synthOp ); + synthOp->BaseConstructL( TXIMPRequestId(), iContext ); + synthOp->ConstructL( *iGroupId ); + iMyHost->AddNewOperationL( *synthOp ); + CleanupStack::Pop( synthOp ); + } + + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresenceoperations/presencewatching/operationunsubscribepresentitygroupmemberspresence.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresenceoperations/presencewatching/operationunsubscribepresentitygroupmemberspresence.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,82 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Presentity group members presence unsubscription operation + * +*/ + +#ifndef CPSCOPERATIONUNSUBSCRIBEPRESENTITYGROUPMEMBERSPRESENCE_H +#define CPSCOPERATIONUNSUBSCRIBEPRESENTITYGROUPMEMBERSPRESENCE_H + + +#include +#include + +#include "ximpoperationbase.h" +#include "presentitygroupmemberspresencesubscriptionitem.h" + +/** + * Group members presence unsubscription + * + * @lib ximpoperations.lib + * @since S60 v4.0 + */ +class COperationUnsubscribePresentityGroupMembersPresence : public CXIMPOperationBase + { + public: + + IMPORT_C COperationUnsubscribePresentityGroupMembersPresence(); + + void ConstructL( const TDesC8& aParamPck ); + + ~COperationUnsubscribePresentityGroupMembersPresence(); + + + public: // from CXIMPOperationBase + + void ProcessL(); + + void RequestCompletedL(); + + TInt Type() const; + + private: // Helper methods + + /** + * Synthesise event after completion + */ + void SynthesiseEventL(); + + private: // data + + /** + * Presence subscription item + * Own. + */ + CPresentityGroupMembersPresenceSubscriptionItem* iSubItem; + + /** + * Presentity address + * Own. + */ + CXIMPIdentityImp* iGroupId; + + /** + * Subscription status + */ + CPresentityGroupMembersPresenceSubscriptionItem::TSubscriptionStatus iSubscriptionStatus; + + }; + + +#endif // CPSCOPERATIONUNSUBSCRIBEPRESENTITYGROUPMEMBERSPRESENCE_H diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresenceoperations/presencewatching/operationunsubscribepresentitypresence.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresenceoperations/presencewatching/operationunsubscribepresentitypresence.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,214 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Presentity presence unsubscription operation + * +*/ + + +#include +#include +#include + +#include "operationunsubscribepresentitypresence.h" +#include "presenceinfofilterimp.h" +#include "ximpidentityimp.h" +#include "ximpobjecthelpers.h" +#include "presencedatacacheimp.h" +#include "ximppanics.h" +#include "operationsynthesisesubscriptionevent.h" +#include "ximphost.h" +#include "ximpstatusimp.h" +#include "ximppsccontextimp.h" +#include "protocolpresencedatahostimp.h" + +#include "ximptrace.h" +// ============================ MEMBER FUNCTIONS ============================= + +// --------------------------------------------------------------------------- +// COperationUnsubscribePresentityPresence::COperationUnsubscribePresentityPresence() +// --------------------------------------------------------------------------- +// +EXPORT_C COperationUnsubscribePresentityPresence::COperationUnsubscribePresentityPresence() + { + } + + +// --------------------------------------------------------------------------- +// COperationUnsubscribePresentityPresence::~COperationUnsubscribePresentityPresence() +// --------------------------------------------------------------------------- +// +COperationUnsubscribePresentityPresence::~COperationUnsubscribePresentityPresence() + { + delete iIdentity; + if( iSubItem ) + { + iSubItem->Close(); + } + } + +// --------------------------------------------------------------------------- +// COperationUnsubscribePresentityPresence::ConstructL() +// --------------------------------------------------------------------------- +// +void COperationUnsubscribePresentityPresence::ConstructL( const TDesC8& aParamPck ) + { + iIdentity = CXIMPIdentityImp::NewLC(); + CleanupStack::Pop( iIdentity ); + TXIMPObjectPacker< CXIMPIdentityImp >::UnPackL( *iIdentity, aParamPck ); + } + + +// --------------------------------------------------------------------------- +// COperationUnsubscribePresentityPresence::ProcessL() +// --------------------------------------------------------------------------- +// +void COperationUnsubscribePresentityPresence::ProcessL() + { + TRACE(_L("COperationUnsubscribePresentityPresence::ProcessL()" ) ); + CXIMPOperationBase::ProcessL(); + + CPresentityPresenceSubscriptionItem& subItem = + iMyHost->PresenceDataAccess().PresenceDataCache().PresentityPresenceSubscriptionItemLC( *iIdentity ); + CleanupStack::Pop(); // subItem + iSubItem = &subItem; + + iSubscriptionStatus = iSubItem->SubscriptionStatus( iContext ); + + MProtocolPresenceWatching& watching = iMyHost->GetConnection().ProtocolPresenceFeatures().PresenceWatching(); + + iContext->SetPresenceInfoFilterL( MXIMPPscContext::EPresentityPresenceFilter, + NULL, iIdentity ); + + switch( iSubscriptionStatus ) + { + case CPresentityPresenceSubscriptionItem::ESubscribedForCtxOnly: + { + TRACE(_L("COperationUnsubscribePresentityPresence::ProcessL() DoUnsubscribePresentityPresenceL" ) ); + TInt err ( KErrNone ); + // If this fails, subscription needs to be removed anyway, + // if everything went ok, subscription is removed in RequestCompleted + TRAP( err, watching.DoUnsubscribePresentityPresenceL( *iIdentity, iReqId ) ); + if ( KErrNone != err ) + { + iSubItem->RemoveSubscriber( iContext ); + User::Leave( err ); + } + break; + } + + case CPresentityPresenceSubscriptionItem::ESubscribedForCtxAndOthers: + { + CPresenceInfoFilterImp* pifWithoutCtx = + iSubItem->CollectSubscriptionPifWithoutCtxL( iContext ); + CleanupStack::PushL( pifWithoutCtx ); + + if ( iSubItem->SubscriptionPif().Contains( *pifWithoutCtx ) ) + { + TRACE(_L("COperationUnsubscribePresentityPresence::ProcessL() DoUpdatePresentityPresenceSubscriptionPifL" ) ); + TInt err ( KErrNone ); + // If this fails, subscription needs to be removed anyway, + // if everything went ok, subscription is removed in RequestCompleted + TRAP( err, watching.DoUpdatePresentityPresenceSubscriptionPifL( *iIdentity, *pifWithoutCtx, iReqId ) ); + if ( KErrNone != err ) + { + iSubItem->RemoveSubscriber( iContext ); + User::Leave( err ); + } + } + else + { + TRACE(_L("COperationUnsubscribePresentityPresence::ProcessL() FakeCompleteRequest 1" ) ); + iMyHost->FakeCompleteRequest( iReqId, KErrNone ); + } + + CleanupStack::PopAndDestroy( pifWithoutCtx ); + break; + } + + case CPresentityPresenceSubscriptionItem::ENotSubscribedAtAll: + case CPresentityPresenceSubscriptionItem::ESubscribedForOtherCtxOnly: + { + TRACE(_L("COperationUnsubscribePresentityPresence::ProcessL() FakeCompleteRequest 2" ) ); + iMyHost->FakeCompleteRequest( iReqId, KErrNone ); + break; + } + + XIMP_DEFAULT_CASE_UNSUPPORTED( NXIMPPrivPanic::EInvalidSubscriptionStatus ); + } + } + +// --------------------------------------------------------------------------- +// COperationUnsubscribePresentityPresence::RequestCompleted() +// --------------------------------------------------------------------------- +// +void COperationUnsubscribePresentityPresence::RequestCompletedL() + { + TRACE(_L("COperationUnsubscribePresentityPresence::RequestCompletedL()" ) ); + CXIMPOperationBase::RequestCompletedL(); + TRACE_1(_L("COperationUnsubscribePresentityPresence::RequestCompletedL() result=%d" ),iStatusObj->ResultCode() ); + if( iStatusObj->ResultCode() == KErrNone ) + { + switch( iSubscriptionStatus ) + { + case CPresentityPresenceSubscriptionItem::ESubscribedForCtxOnly: + case CPresentityPresenceSubscriptionItem::ESubscribedForCtxAndOthers: + { + TRACE(_L("COperationUnsubscribePresentityPresence::RequestCompletedL() removing context" ) ); + iSubItem->RemoveSubscriber( iContext ); + break; + } + + case CPresentityPresenceSubscriptionItem::ENotSubscribedAtAll: + case CPresentityPresenceSubscriptionItem::ESubscribedForOtherCtxOnly: + { + TRACE(_L("COperationUnsubscribePresentityPresence::RequestCompletedL() nothing to do" ) ); + break; + } + + XIMP_DEFAULT_CASE_UNSUPPORTED( NXIMPPrivPanic::EInvalidSubscriptionStatus ); + } + + SynthesiseEventL(); + } + } + + +// --------------------------------------------------------------------------- +// COperationUnsubscribePresentityPresence::Type() +// --------------------------------------------------------------------------- +// +TInt COperationUnsubscribePresentityPresence::Type() const + { + return NPresenceOps::EPrUnsubscribePresentityPresence; + } + + +// --------------------------------------------------------------------------- +// COperationUnsubscribePresentityPresence::SynthesiseEventL() +// --------------------------------------------------------------------------- +// +void COperationUnsubscribePresentityPresence::SynthesiseEventL() + { + COperationSynthesiseSubscriptionEvent* synthOp = + new ( ELeave ) COperationSynthesiseSubscriptionEvent( + COperationSynthesiseSubscriptionEvent::EPresentityPresence, EFalse ); + CleanupStack::PushL( synthOp ); + synthOp->BaseConstructL( TXIMPRequestId(), iContext ); + synthOp->ConstructL( *iIdentity ); + iMyHost->AddNewOperationL( *synthOp ); + CleanupStack::Pop( synthOp ); + } + + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresenceoperations/presencewatching/operationunsubscribepresentitypresence.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresenceoperations/presencewatching/operationunsubscribepresentitypresence.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,82 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Presentity presence unsubscription operation + * +*/ + +#ifndef CPSCOPERATIONUNSUBSCRIBEPRESENTITYPRESENCE_H +#define CPSCOPERATIONUNSUBSCRIBEPRESENTITYPRESENCE_H + + +#include +#include + +#include "ximpoperationbase.h" +#include "presentitypresencesubscriptionitem.h" +#include "presenceoperationdefs.h" + +/** + * Presence interest registration operation. + * + * @lib ximpoperations.lib + * @since S60 v4.0 + */ +class COperationUnsubscribePresentityPresence : public CXIMPOperationBase + { + public: + + IMPORT_C COperationUnsubscribePresentityPresence(); + + void ConstructL( const TDesC8& aParamPck ); + + ~COperationUnsubscribePresentityPresence(); + + + public: // from CXIMPOperationBase + + void ProcessL(); + + void RequestCompletedL(); + + TInt Type() const; + + private: // Helper methods + + /** + * Synthesise event after completion + */ + void SynthesiseEventL(); + + private: // data + + /** + * Presence subscription item + * Own. + */ + CPresentityPresenceSubscriptionItem* iSubItem; + + /** + * Presentity address + * Own. + */ + CXIMPIdentityImp* iIdentity; + + /** + * Subscription status + */ + CPresentityPresenceSubscriptionItem::TSubscriptionStatus iSubscriptionStatus; + }; + + +#endif // CPSCOPERATIONUNSUBSCRIBEPRESENTITYPRESENCE_H diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresenceoperations/presentitygroups/operationaddpresentitygroupmember.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresenceoperations/presentitygroups/operationaddpresentitygroupmember.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,152 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Add Presentity Group Member operation + * +*/ + +#include +#include +#include +#include + +#include "operationaddpresentitygroupmember.h" +#include "presentitygroupmemberinfoimp.h" +#include "ximpidentityimp.h" +#include "ximprbufhelpers.h" +#include "ximprestrictedobjectcollectionimp.h" +#include "protocolpresentitygroupsdatahostimp.h" +#include "ximphost.h" +#include "ximpstatusimp.h" +#include "ximprequestcompleteeventimp.h" +#include "ximpobjecthelpers.h" +#include "protocolpresencedatahostimp.h" + +#include "ximptrace.h" + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// COperationAddPresentityGroupMember::COperationAddPresentityGroupMember() +// --------------------------------------------------------------------------- +// +EXPORT_C COperationAddPresentityGroupMember::COperationAddPresentityGroupMember() + { + } + + +// --------------------------------------------------------------------------- +// COperationAddPresentityGroupMember::ConstructL +// --------------------------------------------------------------------------- +// +void COperationAddPresentityGroupMember::ConstructL( const TDesC8& aParamPck ) + { + RDesReadStream rs; + rs.Open( aParamPck ); // CSI: 65 # Does not return a value. + CleanupClosePushL( rs ); + + // group id + iGroupId = CXIMPIdentityImp::NewLC(); + CleanupStack::Pop( iGroupId ); + iGroupId->InternalizeL( rs ); + + // member id + CXIMPIdentityImp* memberId = CXIMPIdentityImp::NewLC(); + memberId->InternalizeL( rs ); + + // member display name + RBuf16 dispName; + CleanupClosePushL( dispName ); + XIMPRBuf16Helper::InternalizeL( dispName, rs ); + + iMemberInfo = CPresentityGroupMemberInfoImp::NewLC( *memberId, dispName ); + CleanupStack::Pop( iMemberInfo ); + CleanupStack::PopAndDestroy( 3 ); // dispName, memberId, rs + } + +// --------------------------------------------------------------------------- +// COperationAddPresentityGroupMember::~COperationAddPresentityGroupMember() +// --------------------------------------------------------------------------- +// +COperationAddPresentityGroupMember::~COperationAddPresentityGroupMember() + { + delete iGroupId; + delete iMemberInfo; + } + +// --------------------------------------------------------------------------- +// COperationAddPresentityGroupMember::ProcessL() +// --------------------------------------------------------------------------- +// +void COperationAddPresentityGroupMember::ProcessL() + { + TRACE(_L("COperationAddPresentityGroupMember::ProcessL()" ) ); + CXIMPOperationBase::ProcessL(); + + MProtocolPresentityGroups& connection = iMyHost->GetConnection().ProtocolPresenceFeatures().PresentityGroups(); + + connection.DoAddPresentityGroupMemberL( *iGroupId, + iMemberInfo->GroupMemberId(), + iMemberInfo->GroupMemberDisplayName(), + iReqId ); + } + +// --------------------------------------------------------------------------- +// COperationAddPresentityGroupMember::RequestCompletedL() +// --------------------------------------------------------------------------- +// +void COperationAddPresentityGroupMember::RequestCompletedL() + { + TRACE(_L("COperationAddPresentityGroupMember::RequestCompletedL()" ) ); + CXIMPOperationBase::RequestCompletedL(); + + MXIMPBase* object = NULL; + iObjCollection->GetByType( object, MPresentityGroupMemberInfo::KInterfaceId ); + if( object ) + { + CPresentityGroupMemberInfoImp* memberInfo = + TXIMPGetImpClassOrPanic< CPresentityGroupMemberInfoImp >::From( *object ); + + delete iMemberInfo; + iMemberInfo = memberInfo; + } + + if ( iStatusObj->ResultCode() == KErrNone ) + { + CXIMPIdentityImp* groupId = + TXIMPObjectCloner< CXIMPIdentityImp >::CloneL( *iGroupId ); + CleanupStack::PushL( groupId ); + CPresentityGroupMemberInfoImp* memberInfo = + TXIMPObjectCloner< CPresentityGroupMemberInfoImp >::CloneL( *iMemberInfo ); + CleanupStack::PushL( memberInfo ); + iMyHost->PresenceDataAccess().GroupsDataAccess().HandlePresentityGroupMemberAddedL( groupId, memberInfo ); + CleanupStack::Pop( 2, groupId ); + } + + // Set information for request complete event. + iReqCompleteEvent->AppendParamL( iGroupId ); + iGroupId = NULL; + iReqCompleteEvent->AppendParamL( iMemberInfo ); + iMemberInfo = NULL; + } + +// --------------------------------------------------------------------------- +// COperationAddPresentityGroupMember::Type() +// --------------------------------------------------------------------------- +// +TInt COperationAddPresentityGroupMember::Type() const + { + return NPresenceOps::EPrAddPresentityGroupMember; + } + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresenceoperations/presentitygroups/operationaddpresentitygroupmember.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresenceoperations/presentitygroups/operationaddpresentitygroupmember.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,71 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Add Presentity Group Member operation + * +*/ + +#ifndef PSCOPERATIONADDPRESENTITYGROUPMEMBER_H +#define PSCOPERATIONADDPRESENTITYGROUPMEMBER_H + +#include +#include + +#include "ximpoperationbase.h" +#include "presenceoperationdefs.h" + +class CPresentityGroupMemberInfoImp; +class CXIMPIdentityImp; + +/** + * Add presentity group member operation + * + * @lib presenceoperation.lib + * @since S60 v4.0 + */ +class COperationAddPresentityGroupMember : public CXIMPOperationBase + { + + public: + + IMPORT_C COperationAddPresentityGroupMember(); + + void ConstructL( const TDesC8& aParamPck ); + + ~COperationAddPresentityGroupMember(); + + public: // from CXIMPOperationBase + + void ProcessL(); + + void RequestCompletedL(); + + TInt Type() const; + + private: // data + + /** + * Group id + * Own. + */ + CXIMPIdentityImp* iGroupId; + + /** + * Group member info + * Own. + */ + CPresentityGroupMemberInfoImp* iMemberInfo; + }; + + +#endif // PSCOPERATIONADDPRESENTITYGROUPMEMBER_H diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresenceoperations/presentitygroups/operationcreatepresentitygroup.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresenceoperations/presentitygroups/operationcreatepresentitygroup.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,124 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Concrete bind operation + * +*/ + +#include +#include +#include + +#include "operationcreatepresentitygroup.h" +#include "presentitygroupinfoimp.h" +#include "ximpobjecthelpers.h" +#include "ximprestrictedobjectcollectionimp.h" +#include "protocolpresentitygroupsdatahostimp.h" +#include "ximphost.h" +#include "ximpstatusimp.h" +#include "ximprequestcompleteeventimp.h" +#include "protocolpresencedatahostimp.h" + +#include "ximptrace.h" +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// COperationCreatePresentityGroup::COperationCreatePresentityGroup() +// --------------------------------------------------------------------------- +// +EXPORT_C COperationCreatePresentityGroup::COperationCreatePresentityGroup() + { + } + + +// --------------------------------------------------------------------------- +// COperationCreatePresentityGroup::ConstructL +// --------------------------------------------------------------------------- +// +void COperationCreatePresentityGroup::ConstructL( const TDesC8& aParamPck ) + { + CPresentityGroupInfoImp* groupInfo = CPresentityGroupInfoImp::NewLC(); + TXIMPObjectPacker< CPresentityGroupInfoImp >::UnPackL( *groupInfo, + aParamPck ); + CleanupStack::Pop( groupInfo ); + iGroupInfo = groupInfo; + } + +// --------------------------------------------------------------------------- +// COperationCreatePresentityGroup::~COperationCreatePresentityGroup() +// --------------------------------------------------------------------------- +// +COperationCreatePresentityGroup::~COperationCreatePresentityGroup() + { + delete iGroupInfo; + } + +// --------------------------------------------------------------------------- +// COperationCreatePresentityGroup::ProcessL() +// --------------------------------------------------------------------------- +// +void COperationCreatePresentityGroup::ProcessL() + { + TRACE(_L("COperationCreatePresentityGroup::ProcessL()" ) ); + CXIMPOperationBase::ProcessL(); + MProtocolPresentityGroups& presentityGroups = iMyHost->GetConnection().ProtocolPresenceFeatures().PresentityGroups(); + + presentityGroups.DoCreatePresentityGroupL( iGroupInfo->GroupId(), + iGroupInfo->GroupDisplayName(), iReqId ); + } + +// --------------------------------------------------------------------------- +// COperationCreatePresentityGroup::RequestCompleted() +// --------------------------------------------------------------------------- +// +void COperationCreatePresentityGroup::RequestCompletedL() + { + TRACE(_L("COperationCreatePresentityGroup::RequestCompletedL()" ) ); + CXIMPOperationBase::RequestCompletedL(); + + MXIMPBase* object = NULL; + iObjCollection->GetByType( object, MPresentityGroupInfo::KInterfaceId ); + if( object ) + { + CPresentityGroupInfoImp* groupInfo = + TXIMPGetImpClassOrPanic< CPresentityGroupInfoImp >::From( *object ); + + delete iGroupInfo; + iGroupInfo = groupInfo; + } + + if ( iStatusObj->ResultCode() == KErrNone ) + { + CPresentityGroupInfoImp* groupInfo = + TXIMPObjectCloner< CPresentityGroupInfoImp >::CloneL( *iGroupInfo ); + CleanupStack::PushL( groupInfo ); + iMyHost->PresenceDataAccess().GroupsDataAccess().HandlePresentityGroupCreatedL( groupInfo ); + CleanupStack::Pop( groupInfo ); + } + + // Set information for request complete event. + iReqCompleteEvent->AppendParamL( ( CXIMPApiDataObjBase* ) iGroupInfo ); + iGroupInfo = NULL; + } + +// --------------------------------------------------------------------------- +// COperationCreatePresentityGroup::Type() +// --------------------------------------------------------------------------- +// +TInt COperationCreatePresentityGroup::Type() const + { + return NPresenceOps::EPrCreatePresentityGroup; + } + + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresenceoperations/presentitygroups/operationcreatepresentitygroup.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresenceoperations/presentitygroups/operationcreatepresentitygroup.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,63 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Bind operation + * +*/ + +#ifndef C_PSCOPERATIONCREATEPRESENTITYGROUP_H +#define C_PSCOPERATIONCREATEPRESENTITYGROUP_H + +#include +#include + +#include "ximpoperationbase.h" +#include "presenceoperationdefs.h" + +class CPresentityGroupInfoImp; + +/** + * Create presentity group operation + * + * @lib presenceoperation.lib + * @since S60 v4.0 + */ +class COperationCreatePresentityGroup : public CXIMPOperationBase + { + + public: + + IMPORT_C COperationCreatePresentityGroup(); + + void ConstructL( const TDesC8& aParamPck ); + + ~COperationCreatePresentityGroup(); + + public: // from CXIMPOperationBase + + void ProcessL(); + + void RequestCompletedL(); + + TInt Type() const; + + private: // data + + /** + * groupinfo + */ + CPresentityGroupInfoImp* iGroupInfo; + }; + + +#endif // C_PSCOPERATIONCREATEPRESENTITYGROUP_H diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresenceoperations/presentitygroups/operationdeletepresentitygroup.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresenceoperations/presentitygroups/operationdeletepresentitygroup.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,106 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Concrete bind operation + * +*/ + +#include +#include +#include + +#include "operationdeletepresentitygroup.h" +#include "presentitygroupinfoimp.h" +#include "ximpobjecthelpers.h" +#include "protocolpresentitygroupsdatahostimp.h" +#include "ximphost.h" +#include "ximpstatusimp.h" +#include "ximpidentityimp.h" +#include "protocolpresencedatahostimp.h" + +#include "ximptrace.h" +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// COperationDeletePresentityGroup::COperationDeletePresentityGroup() +// --------------------------------------------------------------------------- +// +EXPORT_C COperationDeletePresentityGroup::COperationDeletePresentityGroup() + { + } + + +// --------------------------------------------------------------------------- +// COperationDeletePresentityGroup::ConstructL +// --------------------------------------------------------------------------- +// +void COperationDeletePresentityGroup::ConstructL( const TDesC8& aParamPck ) + { + CPresentityGroupInfoImp* groupInfo = CPresentityGroupInfoImp::NewLC(); + TXIMPObjectPacker< CPresentityGroupInfoImp >::UnPackL( *groupInfo, + aParamPck ); + CleanupStack::Pop( groupInfo ); + iGroupInfo = groupInfo; + } + +// --------------------------------------------------------------------------- +// COperationDeletePresentityGroup::~COperationDeletePresentityGroup() +// --------------------------------------------------------------------------- +// +COperationDeletePresentityGroup::~COperationDeletePresentityGroup() + { + delete iGroupInfo; + } + +// --------------------------------------------------------------------------- +// COperationDeletePresentityGroup::ProcessL() +// --------------------------------------------------------------------------- +// +void COperationDeletePresentityGroup::ProcessL() + { + TRACE(_L("COperationDeletePresentityGroup::ProcessL()" ) ); + CXIMPOperationBase::ProcessL(); + + MProtocolPresentityGroups& presentityGroups = iMyHost->GetConnection().ProtocolPresenceFeatures().PresentityGroups(); + + presentityGroups.DoDeletePresentityGroupL( iGroupInfo->GroupId(), iReqId ); + } + +// --------------------------------------------------------------------------- +// COperationDeletePresentityGroup::RequestCompleted() +// --------------------------------------------------------------------------- +// +void COperationDeletePresentityGroup::RequestCompletedL() + { + TRACE(_L("COperationDeletePresentityGroup::RequestCompletedL()" ) ); + CXIMPOperationBase::RequestCompletedL(); + + if ( iStatusObj->ResultCode() == KErrNone ) + { + CXIMPIdentityImp* identity = CXIMPIdentityImp::NewLC( iGroupInfo->Identity().Identity() ); + iMyHost->PresenceDataAccess().GroupsDataAccess().HandlePresentityGroupDeletedL( identity ); + CleanupStack::Pop( identity ); + } + } + +// --------------------------------------------------------------------------- +// COperationDeletePresentityGroup::Type() +// --------------------------------------------------------------------------- +// +TInt COperationDeletePresentityGroup::Type() const + { + return NPresenceOps::EPrDeletePresentityGroup; + } + + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresenceoperations/presentitygroups/operationdeletepresentitygroup.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresenceoperations/presentitygroups/operationdeletepresentitygroup.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,63 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Bind operation + * +*/ + +#ifndef C_PSCOPERATIONDELETEPRESENTITYGROUP_H +#define C_PSCOPERATIONDELETEPRESENTITYGROUP_H + +#include +#include + +#include "ximpoperationbase.h" +#include "presenceoperationdefs.h" + +class CPresentityGroupInfoImp; + +/** + * Create presentity group operation + * + * @lib presenceoperation.lib + * @since S60 v4.0 + */ +class COperationDeletePresentityGroup : public CXIMPOperationBase + { + + public: + + IMPORT_C COperationDeletePresentityGroup(); + + void ConstructL( const TDesC8& aParamPck ); + + ~COperationDeletePresentityGroup(); + + public: // from CXIMPOperationBase + + void ProcessL(); + + void RequestCompletedL(); + + TInt Type() const; + + private: // data + + /** + * groupinfo + */ + CPresentityGroupInfoImp* iGroupInfo; + }; + + +#endif // C_PSCOPERATIONDELETEPRESENTITYGROUP_H diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresenceoperations/presentitygroups/operationhandlepresentitygroupcontent.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresenceoperations/presentitygroups/operationhandlepresentitygroupcontent.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,144 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Handle presentity group content operations + * +*/ + + +#include "operationhandlepresentitygroupcontent.h" +#include "ximpobjecthelpers.h" +#include "groupcontentsubscriptionitem.h" +#include "presencedatacacheimp.h" +#include "presentitygroupmemberinfoimp.h" +#include "ximpidentityimp.h" +#include "ximphost.h" +#include "ximpstatusimp.h" +#include "ximprestrictedobjectcollectionimp.h" +#include "ximpobjectcollectionimp.h" +#include "protocolpresencedatahostimp.h" + +#include "ximptrace.h" +// ============================ MEMBER FUNCTIONS ============================= + +// --------------------------------------------------------------------------- +// COperationHandlePresentityGroupContent::~COperationHandlePresentityGroupContent() +// --------------------------------------------------------------------------- +// +COperationHandlePresentityGroupContent::~COperationHandlePresentityGroupContent() + { + delete iGroupMemberList; + delete iGroupId; + } + + +// --------------------------------------------------------------------------- +// COperationHandlePresentityGroupContent::COperationHandlePresentityGroupContent() +// --------------------------------------------------------------------------- +// +EXPORT_C COperationHandlePresentityGroupContent::COperationHandlePresentityGroupContent() + { + } + + +// --------------------------------------------------------------------------- +// COperationHandlePresentityGroupContent::ConstructL() +// --------------------------------------------------------------------------- +// +void COperationHandlePresentityGroupContent::ConstructL( const TDesC8& /*aParamPck*/ ) + { + iGroupMemberList = new ( ELeave ) RPrGrpMemInfoImpArray; + } + + +// --------------------------------------------------------------------------- +// COperationHandlePresentityGroupContent::ProcessL() +// --------------------------------------------------------------------------- +// +void COperationHandlePresentityGroupContent::ProcessL() + { + TRACE(_L("COperationHandlePresentityGroupContent::ProcessL()") ); + CXIMPOperationBase::ProcessL(); + + MXIMPBase* object = NULL; + iObjCollection->GetByType( object, MXIMPIdentity::KInterfaceId ); + if( object ) + { + iGroupId = TXIMPGetImpClassOrPanic< CXIMPIdentityImp >::From( *object ); + } + else + { + User::Leave( KErrArgument ); + } + + object = NULL; + iObjCollection->GetByType( object, MXIMPObjectCollection::KInterfaceId ); + if( object ) + { + CXIMPObjectCollectionImp* objectCollection = + TXIMPGetImpClassOrPanic< CXIMPObjectCollectionImp >::From( *object ); + CleanupStack::PushL( objectCollection ); + TLinearOrder< CPresentityGroupMemberInfoImp > order( CPresentityGroupMemberInfoImp::GroupIdLinearOrder ); + TXIMPObjectMover< MPresentityGroupMemberInfo, CPresentityGroupMemberInfoImp >:: + MoveFromCollectionToArrayL( *objectCollection, *iGroupMemberList, order ); + CleanupStack::PopAndDestroy( objectCollection ); + } + else + { + User::Leave( KErrArgument ); + } + + // recreate temporary lists + CGroupContentSubscriptionItem& subItem = + iMyHost->PresenceDataAccess().PresenceDataCache().GroupContentSubscriptionItemLC( *iGroupId ); + + // clean out temporary lists + subItem.Clean(); + + subItem.SetNewListL( iGroupMemberList ); + iGroupMemberList = NULL; // ownership was transferred + + subItem.UpdateSubscriptionStateL( CXIMPSubscriptionItemBase::ECompleteDataReceived ); + + // synthesize the event to all contexts + TRAPD( err, subItem.SynthesiseSubscriptionEventToAllCtxsL() ); + + CleanupStack::PopAndDestroy(); // subItem + + err = KErrNone; + iMyHost->HandleAdaptationRequestCompleted( iReqId, err ); + } + +// --------------------------------------------------------------------------- +// COperationHandlePresentityGroupContent::RequestCompleted() +// --------------------------------------------------------------------------- +// +void COperationHandlePresentityGroupContent::RequestCompletedL() + { + TRACE(_L("COperationHandlePresentityGroupContent::RequestCompletedL()" ) ); + CXIMPOperationBase::RequestCompletedL(); + // no special handling for error situations + } + + +// --------------------------------------------------------------------------- +// COperationHandlePresentityGroupContent::Type() +// --------------------------------------------------------------------------- +// +TInt + COperationHandlePresentityGroupContent::Type() const + { + return NPresenceOps::EPrHandlePresentityGroupContent; + } + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresenceoperations/presentitygroups/operationhandlepresentitygroupcontent.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresenceoperations/presentitygroups/operationhandlepresentitygroupcontent.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,72 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Handle presentity group content operations + * +*/ + +#ifndef CPSCOPERATIONHANDLEPRESENTITYGROUPCONTENT_H +#define CPSCOPERATIONHANDLEPRESENTITYGROUPCONTENT_H + + +#include +#include + +#include "ximpoperationbase.h" +#include "presencetypehelpers.h" +#include "presenceoperationdefs.h" + +class CXIMPIdentityImp; + +/** + * Handle presentity group related operations. + * + * @lib ximpoperations.lib + * @since S60 v4.0 + */ +class COperationHandlePresentityGroupContent : public CXIMPOperationBase + { + + public: + + IMPORT_C COperationHandlePresentityGroupContent(); + + void ConstructL( const TDesC8& aParamPck ); + + ~COperationHandlePresentityGroupContent(); + + public: // from CXIMPOperationBase + + void ProcessL(); + + void RequestCompletedL(); + TInt Type() const; + + private: // data + + /** + * Array of group identities. + * Owned. + */ + CXIMPIdentityImp* iGroupId; + + /** + * Array of group identities. + * Owned. + */ + RPrGrpMemInfoImpArray* iGroupMemberList; + + }; + + +#endif // CPSCOPERATIONHandlePresentityGroups_H diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresenceoperations/presentitygroups/operationhandlepresentitygroupmemberadded.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresenceoperations/presentitygroups/operationhandlepresentitygroupmemberadded.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,163 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Handle presentity group content operations + * +*/ + + +#include "operationhandlepresentitygroupmemberadded.h" +#include "ximpobjecthelpers.h" +#include "groupcontentsubscriptionitem.h" +#include "presencedatacacheimp.h" +#include "presentitygroupmemberinfoimp.h" +#include "ximpidentityimp.h" +#include "ximphost.h" +#include "ximpstatusimp.h" +#include "ximprestrictedobjectcollectionimp.h" +#include "protocolpresencedatahostimp.h" + +#include "ximptrace.h" +// ============================ MEMBER FUNCTIONS ============================= + +// --------------------------------------------------------------------------- +// COperationHandlePresentityGroupMemberAdded::~COperationHandlePresentityGroupMemberAdded() +// --------------------------------------------------------------------------- +// +COperationHandlePresentityGroupMemberAdded::~COperationHandlePresentityGroupMemberAdded() + { + delete iMemberInfo; + delete iGroupId; + } + + +// --------------------------------------------------------------------------- +// COperationHandlePresentityGroupMemberAdded::COperationHandlePresentityGroupMemberAdded() +// --------------------------------------------------------------------------- +// +EXPORT_C COperationHandlePresentityGroupMemberAdded::COperationHandlePresentityGroupMemberAdded() + { + } + + +// --------------------------------------------------------------------------- +// COperationHandlePresentityGroupMemberAdded::ConstructL() +// --------------------------------------------------------------------------- +// +void COperationHandlePresentityGroupMemberAdded::ConstructL( const TDesC8& /*aParamPck*/ ) + { + } + + +// --------------------------------------------------------------------------- +// COperationHandlePresentityGroupMemberAdded::ProcessL() +// --------------------------------------------------------------------------- +// +void COperationHandlePresentityGroupMemberAdded::ProcessL() + { + TRACE(_L("COperationHandlePresentityGroupMemberAdded::ProcessL()") ); + CXIMPOperationBase::ProcessL(); + + MXIMPBase* object = NULL; + iObjCollection->GetByType( object, MXIMPIdentity::KInterfaceId ); + if( object ) + { + iGroupId = TXIMPGetImpClassOrPanic< CXIMPIdentityImp >::From( *object ); + } + else + { + User::Leave( KErrArgument ); + } + + object = NULL; + iObjCollection->GetByType( object, MPresentityGroupMemberInfo::KInterfaceId ); + if( object ) + { + iMemberInfo = TXIMPGetImpClassOrPanic< CPresentityGroupMemberInfoImp >::From( *object ); + } + else + { + User::Leave( KErrArgument ); + } + + // Check if the item exits, only full subscriptions are allowed to + // create new ones. + if ( iMyHost->PresenceDataAccess().PresenceDataCache().GroupContentSubscriptionItemExists( *iGroupId ) ) + { + CGroupContentSubscriptionItem& subItem = + iMyHost->PresenceDataAccess().PresenceDataCache().GroupContentSubscriptionItemLC( *iGroupId ); + + // clean out temporary lists + subItem.Clean(); + + if ( !subItem.GroupMemberExistsL( *iMemberInfo ) ) + { + // New member + RPrGrpMemInfoImpArray* added = new ( ELeave ) RPrGrpMemInfoImpArray; + CleanupStack::PushL( added ); + added->AppendL( iMemberInfo ); + iMemberInfo = NULL; // ownership was transferred + + subItem.SetAddedListL( added ); + CleanupStack::Pop( added ); // ownership was transferred + + // synthesize the event to all contexts + TRAP_IGNORE( subItem.SynthesiseSubscriptionEventToAllCtxsL() ); + } + else if ( subItem.IsGroupMemberUpdatedL( *iMemberInfo ) ) + { + // Existing member updated (actually this implementation might be redundant + // because of the implementation of subcription item. Refactor if needed. + RPrGrpMemInfoImpArray* updated = new ( ELeave ) RPrGrpMemInfoImpArray; + CleanupStack::PushL( updated ); + updated->AppendL( iMemberInfo ); + iMemberInfo = NULL; // ownership was transferred + + subItem.SetAddedListL( updated ); + CleanupStack::Pop( updated ); // ownership was transferred + + // synthesize the event to all contexts + TRAP_IGNORE( subItem.SynthesiseSubscriptionEventToAllCtxsL() ); + } + + CleanupStack::PopAndDestroy(); // subItem + } + + iMyHost->HandleAdaptationRequestCompleted( iReqId, KErrNone ); + } + +// --------------------------------------------------------------------------- +// COperationHandlePresentityGroupMemberAdded::RequestCompleted() +// --------------------------------------------------------------------------- +// +void COperationHandlePresentityGroupMemberAdded::RequestCompletedL() + { + TRACE(_L("COperationHandlePresentityGroupMemberAdded::RequestCompletedL()" ) ); + CXIMPOperationBase::RequestCompletedL(); + + // no special handling for error situations + } + + +// --------------------------------------------------------------------------- +// COperationHandlePresentityGroupMemberAdded::Type() +// --------------------------------------------------------------------------- +// +TInt + COperationHandlePresentityGroupMemberAdded::Type() const + { + return NPresenceOps::EPrHandlePresentityGroupMemberAdded; + } + + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresenceoperations/presentitygroups/operationhandlepresentitygroupmemberadded.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresenceoperations/presentitygroups/operationhandlepresentitygroupmemberadded.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,72 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Handle presentity group content operations + * +*/ + +#ifndef CPSCOPERATIONHANDLEPRESENTITYGROUPMEMBERADDED_H +#define CPSCOPERATIONHANDLEPRESENTITYGROUPMEMBERADDED_H + + +#include +#include + +#include "ximpoperationbase.h" +#include "presencetypehelpers.h" +#include "presenceoperationdefs.h" + +class CXIMPIdentityImp; + +/** + * Handle presentity group related operations. + * + * @lib ximpoperations.lib + * @since S60 v4.0 + */ +class COperationHandlePresentityGroupMemberAdded : public CXIMPOperationBase + { + + public: + + IMPORT_C COperationHandlePresentityGroupMemberAdded(); + + void ConstructL( const TDesC8& aParamPck ); + + ~COperationHandlePresentityGroupMemberAdded(); + + public: // from CXIMPOperationBase + + void ProcessL(); + + void RequestCompletedL(); + TInt Type() const; + + private: // data + + /** + * Array of group identities. + * Owned. + */ + CXIMPIdentityImp* iGroupId; + + /** + * Array of group identities. + * Owned. + */ + CPresentityGroupMemberInfoImp* iMemberInfo; + + }; + + +#endif // CPSCOPERATIONHANDLEPRESENTITYGROUPMEMBERADDED_H diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresenceoperations/presentitygroups/operationhandlepresentitygroupmemberdisplaynameupdated.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresenceoperations/presentitygroups/operationhandlepresentitygroupmemberdisplaynameupdated.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,147 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Handle presentity group content operations + * +*/ + + +#include "operationhandlepresentitygroupmemberdisplaynameupdated.h" +#include "ximpobjecthelpers.h" +#include "groupcontentsubscriptionitem.h" +#include "presencedatacacheimp.h" +#include "presentitygroupmemberinfoimp.h" +#include "ximpidentityimp.h" +#include "ximphost.h" +#include "ximpstatusimp.h" +#include "ximprestrictedobjectcollectionimp.h" +#include "protocolpresencedatahostimp.h" + +#include "ximptrace.h" +// ============================ MEMBER FUNCTIONS ============================= + +// --------------------------------------------------------------------------- +// COperationHandlePresentityGroupMemberDisplayNameUpdated::~COperationHandlePresentityGroupMemberDisplayNameUpdated() +// --------------------------------------------------------------------------- +// +COperationHandlePresentityGroupMemberDisplayNameUpdated::~COperationHandlePresentityGroupMemberDisplayNameUpdated() + { + delete iMemberInfo; + delete iGroupId; + } + + +// --------------------------------------------------------------------------- +// COperationHandlePresentityGroupMemberDisplayNameUpdated::COperationHandlePresentityGroupMemberDisplayNameUpdated() +// --------------------------------------------------------------------------- +// +EXPORT_C COperationHandlePresentityGroupMemberDisplayNameUpdated::COperationHandlePresentityGroupMemberDisplayNameUpdated() + { + } + + +// --------------------------------------------------------------------------- +// COperationHandlePresentityGroupMemberDisplayNameUpdated::ConstructL() +// --------------------------------------------------------------------------- +// +void COperationHandlePresentityGroupMemberDisplayNameUpdated::ConstructL( const TDesC8& /*aParamPck*/ ) + { + } + + +// --------------------------------------------------------------------------- +// COperationHandlePresentityGroupMemberDisplayNameUpdated::ProcessL() +// --------------------------------------------------------------------------- +// +void COperationHandlePresentityGroupMemberDisplayNameUpdated::ProcessL() + { + TRACE(_L("COperationHandlePresentityGroupMemberDisplayNameUpdated::ProcessL()") ); + CXIMPOperationBase::ProcessL(); + + MXIMPBase* object = NULL; + iObjCollection->GetByType( object, MXIMPIdentity::KInterfaceId ); + if( object ) + { + iGroupId = TXIMPGetImpClassOrPanic< CXIMPIdentityImp >::From( *object ); + } + else + { + User::Leave( KErrArgument ); + } + + object = NULL; + iObjCollection->GetByType( object, MPresentityGroupMemberInfo::KInterfaceId ); + if( object ) + { + iMemberInfo = TXIMPGetImpClassOrPanic< CPresentityGroupMemberInfoImp >::From( *object ); + } + else + { + User::Leave( KErrArgument ); + } + + TInt err = KErrNone; + + if ( iMyHost->PresenceDataAccess().PresenceDataCache().GroupContentSubscriptionItemExists( *iGroupId ) ) + { + CGroupContentSubscriptionItem& subItem = + iMyHost->PresenceDataAccess().PresenceDataCache().GroupContentSubscriptionItemLC( *iGroupId ); + + // clean out temporary lists + subItem.Clean(); + + if ( subItem.GroupMemberExistsL( *iMemberInfo ) && + subItem.IsGroupMemberUpdatedL( *iMemberInfo ) ) + { + RPrGrpMemInfoImpArray* updated = new ( ELeave ) RPrGrpMemInfoImpArray; + CleanupStack::PushL( updated ); + updated->AppendL( iMemberInfo ); + iMemberInfo = NULL; // ownership was transferred + + subItem.SetAddedListL( updated ); + CleanupStack::Pop( updated ); // ownership was transferred + + // synthesize the event to all contexts + TRAP( err, subItem.SynthesiseSubscriptionEventToAllCtxsL() ); + } + + CleanupStack::PopAndDestroy(); // subItem + } + + iMyHost->HandleAdaptationRequestCompleted( iReqId, err ); // error code means subsc. synth. error + } + +// --------------------------------------------------------------------------- +// COperationHandlePresentityGroupMemberDisplayNameUpdated::RequestCompleted() +// --------------------------------------------------------------------------- +// +void COperationHandlePresentityGroupMemberDisplayNameUpdated::RequestCompletedL() + { + TRACE(_L("COperationHandlePresentityGroupMemberDisplayNameUpdated::RequestCompletedL()" ) ); + CXIMPOperationBase::RequestCompletedL(); + + // no special handling for error situations + } + + +// --------------------------------------------------------------------------- +// COperationHandlePresentityGroupMemberDisplayNameUpdated::Type() +// --------------------------------------------------------------------------- +// +TInt + COperationHandlePresentityGroupMemberDisplayNameUpdated::Type() const + { + return NPresenceOps::EPrHandlePresentityGroupMemberDisplayNameUpdated; + } + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresenceoperations/presentitygroups/operationhandlepresentitygroupmemberdisplaynameupdated.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresenceoperations/presentitygroups/operationhandlepresentitygroupmemberdisplaynameupdated.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,73 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Handle presentity group content operations + * +*/ + +#ifndef CPSCOPERATIONHANDLEPRESENTITYGROUPMEMBERDISPLAYNAMEUPDATED_H +#define CPSCOPERATIONHANDLEPRESENTITYGROUPMEMBERDISPLAYNAMEUPDATED_H + + +#include + +#include +#include "ximpoperationbase.h" +#include "presencetypehelpers.h" +#include "presenceoperationdefs.h" + +class CXIMPIdentityImp; + +/** + * Handle presentity group related operations. + * + * @lib ximpoperations.lib + * @since S60 v4.0 + */ +class COperationHandlePresentityGroupMemberDisplayNameUpdated : public CXIMPOperationBase + { + + public: + + IMPORT_C COperationHandlePresentityGroupMemberDisplayNameUpdated(); + + void ConstructL( const TDesC8& aParamPck ); + + ~COperationHandlePresentityGroupMemberDisplayNameUpdated(); + + public: // from CXIMPOperationBase + + void ProcessL(); + + void RequestCompletedL(); + + TInt Type() const; + + private: // data + + /** + * Array of group identities. + * Owned. + */ + CXIMPIdentityImp* iGroupId; + + /** + * Group member information. + * Owned. + */ + CPresentityGroupMemberInfoImp* iMemberInfo; + + }; + + +#endif // CPSCOPERATIONHANDLEPRESENTITYGROUPMEMBERDISPLAYNAMEUPDATED_H diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresenceoperations/presentitygroups/operationhandlepresentitygroupmemberremoved.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresenceoperations/presentitygroups/operationhandlepresentitygroupmemberremoved.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,143 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Handle presentity group content operations + * +*/ + + +#include "operationhandlepresentitygroupmemberremoved.h" +#include "ximpobjecthelpers.h" +#include "groupcontentsubscriptionitem.h" +#include "presencedatacacheimp.h" +#include "presentitygroupmemberinfoimp.h" +#include "ximpidentityimp.h" +#include "ximphost.h" +#include "ximpstatusimp.h" +#include "ximprestrictedobjectcollectionimp.h" +#include "protocolpresencedatahostimp.h" + +#include "ximptrace.h" + +// ============================ MEMBER FUNCTIONS ============================= + +// --------------------------------------------------------------------------- +// COperationHandlePresentityGroupMemberRemoved::~COperationHandlePresentityGroupMemberRemoved() +// --------------------------------------------------------------------------- +// +COperationHandlePresentityGroupMemberRemoved::~COperationHandlePresentityGroupMemberRemoved() + { + delete iMemberInfo; + delete iGroupId; + } + + +// --------------------------------------------------------------------------- +// COperationHandlePresentityGroupMemberRemoved::COperationHandlePresentityGroupMemberRemoved() +// --------------------------------------------------------------------------- +// +EXPORT_C COperationHandlePresentityGroupMemberRemoved::COperationHandlePresentityGroupMemberRemoved() + { + } + + +// --------------------------------------------------------------------------- +// COperationHandlePresentityGroupMemberRemoved::ConstructL() +// --------------------------------------------------------------------------- +// +void COperationHandlePresentityGroupMemberRemoved::ConstructL( const TDesC8& /*aParamPck*/ ) + { + } + + +// --------------------------------------------------------------------------- +// COperationHandlePresentityGroupMemberRemoved::ProcessL() +// --------------------------------------------------------------------------- +// +void COperationHandlePresentityGroupMemberRemoved::ProcessL() + { + TRACE(_L("COperationHandlePresentityGroupMemberRemoved::ProcessL()") ); + CXIMPOperationBase::ProcessL(); + + MXIMPBase* object = NULL; + iObjCollection->GetByType( object, MXIMPIdentity::KInterfaceId ); + if( object ) + { + iGroupId = TXIMPGetImpClassOrPanic< CXIMPIdentityImp >::From( *object ); + } + else + { + User::Leave( KErrArgument ); + } + + object = NULL; + iObjCollection->GetByType( object, MPresentityGroupMemberInfo::KInterfaceId ); + if( object ) + { + iMemberInfo = TXIMPGetImpClassOrPanic< CPresentityGroupMemberInfoImp >::From( *object ); + } + else + { + User::Leave( KErrArgument ); + } + + if ( iMyHost->PresenceDataAccess().PresenceDataCache().GroupContentSubscriptionItemExists( *iGroupId ) ) + { + CGroupContentSubscriptionItem& subItem = + iMyHost->PresenceDataAccess().PresenceDataCache().GroupContentSubscriptionItemLC( *iGroupId ); + + if ( subItem.GroupMemberExistsL( *iMemberInfo ) ) + { + // clean out temporary lists + subItem.Clean(); + + RPrGrpMemInfoImpArray* removed = new ( ELeave ) RPrGrpMemInfoImpArray; + CleanupStack::PushL( removed ); + removed->AppendL( iMemberInfo ); + iMemberInfo = NULL; + subItem.SetRemovedListL( removed ); + CleanupStack::Pop( removed ); // ownership was transferred + + // synthesize the event to all contexts + TRAP_IGNORE( subItem.SynthesiseSubscriptionEventToAllCtxsL() ); + } + CleanupStack::PopAndDestroy(); // subItem + } + + iMyHost->HandleAdaptationRequestCompleted( iReqId, KErrNone ); + } + +// --------------------------------------------------------------------------- +// COperationHandlePresentityGroupMemberRemoved::RequestCompleted() +// --------------------------------------------------------------------------- +// +void COperationHandlePresentityGroupMemberRemoved::RequestCompletedL() + { + TRACE(_L("COperationHandlePresentityGroupMemberRemoved::RequestCompletedL()" ) ); + CXIMPOperationBase::RequestCompletedL(); + + // no special handling for error situations + } + + +// --------------------------------------------------------------------------- +// COperationHandlePresentityGroupMemberRemoved::Type() +// --------------------------------------------------------------------------- +// +TInt + COperationHandlePresentityGroupMemberRemoved::Type() const + { + return NPresenceOps::EPrHandlePresentityGroupMemberRemoved; + } + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresenceoperations/presentitygroups/operationhandlepresentitygroupmemberremoved.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresenceoperations/presentitygroups/operationhandlepresentitygroupmemberremoved.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,72 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Handle presentity group content operations + * +*/ + +#ifndef CPSCOPERATIONHANDLEPRESENTITYGROUPMEMBERREMOVED_H +#define CPSCOPERATIONHANDLEPRESENTITYGROUPMEMBERREMOVED_H + + +#include +#include + +#include "ximpoperationbase.h" +#include "presencetypehelpers.h" +#include "presenceoperationdefs.h" + +class CXIMPIdentityImp; + +/** + * Handle presentity group related operations. + * + * @lib ximpoperations.lib + * @since S60 v4.0 + */ +class COperationHandlePresentityGroupMemberRemoved : public CXIMPOperationBase + { + + public: + + IMPORT_C COperationHandlePresentityGroupMemberRemoved(); + + void ConstructL( const TDesC8& aParamPck ); + + ~COperationHandlePresentityGroupMemberRemoved(); + + public: // from CXIMPOperationBase + + void ProcessL(); + + void RequestCompletedL(); + TInt Type() const; + + private: // data + + /** + * Array of group identities. + * Owned. + */ + CXIMPIdentityImp* iGroupId; + + /** + * Array of group identities. + * Owned. + */ + CPresentityGroupMemberInfoImp* iMemberInfo; + + }; + + +#endif // CPSCOPERATIONHANDLEPRESENTITYGROUPMEMBERREMOVED_H diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresenceoperations/presentitygroups/operationhandlepresentitygroups.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresenceoperations/presentitygroups/operationhandlepresentitygroups.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,193 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: implementation of COperationHandlePresentityGroups + * +*/ + + +#include "operationhandlepresentitygroups.h" +#include "grouplistsubscriptionitem.h" +#include "presencedatacacheimp.h" +#include "presentitygroupinfoimp.h" +#include "ximphost.h" +#include "ximpstatusimp.h" +#include "ximppanics.h" +#include "ximprestrictedobjectcollectionimp.h" +#include "ximpobjectcollectionimp.h" +#include "ximpobjecthelpers.h" +#include "ximpidentityimp.h" +#include "protocolpresencedatahostimp.h" + +#include "ximptrace.h" + +// ============================ MEMBER FUNCTIONS ============================= + +// --------------------------------------------------------------------------- +// COperationHandlePresentityGroups::~COperationHandlePresentityGroups() +// --------------------------------------------------------------------------- +// +COperationHandlePresentityGroups::~COperationHandlePresentityGroups() + { + delete iGroupAddressList; + } + + +// --------------------------------------------------------------------------- +// COperationHandlePresentityGroups::COperationHandlePresentityGroups() +// --------------------------------------------------------------------------- +// +EXPORT_C COperationHandlePresentityGroups::COperationHandlePresentityGroups( + NPresenceOps::TPresenceOpTypes aMyType ) + { + iMyType = aMyType; + } + + +// --------------------------------------------------------------------------- +// COperationHandlePresentityGroups::ConstructL() +// --------------------------------------------------------------------------- +// +void COperationHandlePresentityGroups::ConstructL( const TDesC8& /* aParamPck */ ) + { + iGroupAddressList = new ( ELeave ) RPrGrpInfoImpArray; + } + + +// --------------------------------------------------------------------------- +// COperationHandlePresentityGroups::ProcessL() +// --------------------------------------------------------------------------- +// +void COperationHandlePresentityGroups::ProcessL() + { + TRACE(_L("COperationHandlePresentityGroups::ProcessL()") ); + CXIMPOperationBase::ProcessL(); + + // recreate temporary lists + CGroupListSubscriptionItem& groupListSubs = + iMyHost->PresenceDataAccess().PresenceDataCache().GroupListSubscriptionItemLC(); + + // clean out temporary lists + groupListSubs.Clean(); + + switch ( iMyType ) + { + case NPresenceOps::EPrHandlePresentityGroupList : + { + MXIMPBase* object = NULL; + iObjCollection->GetByType( object, MXIMPObjectCollection::KInterfaceId ); + if( object ) + { + CXIMPObjectCollectionImp* objectCollection = + TXIMPGetImpClassOrPanic< CXIMPObjectCollectionImp >::From( *object ); + CleanupStack::PushL( objectCollection ); + TLinearOrder< CPresentityGroupInfoImp > order( CPresentityGroupInfoImp::GroupIdLinearOrder ); + TXIMPObjectMover< MPresentityGroupInfo, CPresentityGroupInfoImp >:: + MoveFromCollectionToArrayL( *objectCollection, *iGroupAddressList, order ); + CleanupStack::PopAndDestroy( objectCollection ); + } + else + { + User::Leave( KErrArgument ); + } + + // handling a list of groups + groupListSubs.SetNewListL( iGroupAddressList ); + break; + } + + case NPresenceOps::EPrHandlePresentityGroupCreated : // fall-through + case NPresenceOps::EPrHandlePresentityGroupDisplayNameUpdated : + { + // handling a list of only created groups and/or + // handling a list of groups which have display + // name updated + MXIMPBase* object = NULL; + iObjCollection->GetByType( object, MPresentityGroupInfo::KInterfaceId ); + CPresentityGroupInfoImp* createdInfo = NULL; + if( object ) + { + createdInfo = + TXIMPGetImpClassOrPanic< CPresentityGroupInfoImp >::From( *object ); + } + else + { + User::Leave( KErrArgument ); + } + + CleanupStack::PushL( createdInfo ); + iGroupAddressList->AppendL( createdInfo ); + CleanupStack::Pop( createdInfo ); + groupListSubs.SetCreatedListL( iGroupAddressList ); + break; + } + + case NPresenceOps::EPrHandlePresentityGroupDeleted : + { + MXIMPBase* object = NULL; + iObjCollection->GetByType( object, MXIMPIdentity::KInterfaceId ); + CXIMPIdentityImp* identity = NULL; + if( object ) + { + identity = TXIMPGetImpClassOrPanic< CXIMPIdentityImp >::From( *object ); + CleanupStack::PushL( identity ); + } + else + { + User::Leave( KErrArgument ); + } + CPresentityGroupInfoImp* deletedInfo = CPresentityGroupInfoImp::NewLC( *identity, KNullDesC ); + iGroupAddressList->AppendL( deletedInfo ); + CleanupStack::Pop( deletedInfo ); + CleanupStack::PopAndDestroy( identity ); + // handling a list of only deleted groups + groupListSubs.SetDeletedListL( iGroupAddressList ); + break; + } + + XIMP_DEFAULT_CASE_UNSUPPORTED( NXIMPPrivPanic::EInvalidOperationType ); + } + + iGroupAddressList = NULL; + // ownership was transferred + + // synthesize the event to all contexts + TRAP_IGNORE( groupListSubs.SynthesiseSubscriptionEventToAllCtxsL() ); + + CleanupStack::PopAndDestroy(); // groupListSubs + + iMyHost->HandleAdaptationRequestCompleted( iReqId, KErrNone ); + } + +// --------------------------------------------------------------------------- +// COperationHandlePresentityGroups::RequestCompleted() +// --------------------------------------------------------------------------- +// +void COperationHandlePresentityGroups::RequestCompletedL() + { + TRACE(_L("COperationHandlePresentityGroups::RequestCompletedL()" ) ); + CXIMPOperationBase::RequestCompletedL(); + // no special handling for error situations + } + + +// --------------------------------------------------------------------------- +// COperationHandlePresentityGroups::Type() +// --------------------------------------------------------------------------- +// +TInt COperationHandlePresentityGroups::Type() const + { + return iMyType; + } + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresenceoperations/presentitygroups/operationhandlepresentitygroups.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresenceoperations/presentitygroups/operationhandlepresentitygroups.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,72 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Handle presentity group list operations + * +*/ + +#ifndef CPSCOPERATIONHANDLEPRESENTITYGROUPS_H +#define CPSCOPERATIONHANDLEPRESENTITYGROUPS_H + + +#include +#include + +#include "ximpoperationbase.h" +#include "presencetypehelpers.h" +#include "presenceoperationdefs.h" + +/** + * Handle presentity group related operations. + * + * @lib ximpoperations.lib + * @since S60 v4.0 + */ +class COperationHandlePresentityGroups : public CXIMPOperationBase + { + + public: + + IMPORT_C COperationHandlePresentityGroups( + NPresenceOps::TPresenceOpTypes aMyType ); + + void ConstructL( const TDesC8& aParamPck ); + + ~COperationHandlePresentityGroups(); + + public: // from CXIMPOperationBase + + void ProcessL(); + + void RequestCompletedL(); + + TInt Type() const; + + private: // data + + /** + * Array of group identities. + * Owned. + */ + RPrGrpInfoImpArray* iGroupAddressList; + + /** + * This is an internal and polymorphic operation. + * The actual type will be defined by this variable, + * set during operation creation. + */ + NPresenceOps::TPresenceOpTypes iMyType; + }; + + +#endif // CPSCOPERATIONHandlePresentityGroups_H diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresenceoperations/presentitygroups/operationremovepresentitygroupmember.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresenceoperations/presentitygroups/operationremovepresentitygroupmember.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,119 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Remove Presentity Group Member operation + * +*/ + +#include +#include +#include +#include + +#include "operationremovepresentitygroupmember.h" +#include "ximpidentityimp.h" +#include "protocolpresentitygroupsdatahostimp.h" +#include "ximphost.h" +#include "ximpstatusimp.h" +#include "protocolpresencedatahostimp.h" + +#include "ximptrace.h" +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// COperationRemovePresentityGroupMember::COperationRemovePresentityGroupMember() +// --------------------------------------------------------------------------- +// +EXPORT_C COperationRemovePresentityGroupMember::COperationRemovePresentityGroupMember() + { + } + + +// --------------------------------------------------------------------------- +// COperationRemovePresentityGroupMember::ConstructL +// --------------------------------------------------------------------------- +// +void COperationRemovePresentityGroupMember::ConstructL( const TDesC8& aParamPck ) + { + RDesReadStream rs; + rs.Open( aParamPck ); // CSI: 65 # Does not return a value. + CleanupClosePushL( rs ); + + // group id + iGroupId = CXIMPIdentityImp::NewLC(); + CleanupStack::Pop( iGroupId ); + iGroupId->InternalizeL( rs ); + + // member id + iMemberId = CXIMPIdentityImp::NewLC(); + CleanupStack::Pop( iMemberId ); + iMemberId->InternalizeL( rs ); + + + CleanupStack::PopAndDestroy( 1 ); // rs + } + +// --------------------------------------------------------------------------- +// COperationRemovePresentityGroupMember::~COperationRemovePresentityGroupMember() +// --------------------------------------------------------------------------- +// +COperationRemovePresentityGroupMember::~COperationRemovePresentityGroupMember() + { + delete iGroupId; + delete iMemberId; + } + +// --------------------------------------------------------------------------- +// COperationRemovePresentityGroupMember::ProcessL() +// --------------------------------------------------------------------------- +// +void COperationRemovePresentityGroupMember::ProcessL() + { + TRACE(_L("COperationRemovePresentityGroupMember::ProcessL()" ) ); + CXIMPOperationBase::ProcessL(); + + MProtocolPresentityGroups& presentityGroups = iMyHost->GetConnection().ProtocolPresenceFeatures().PresentityGroups(); + + presentityGroups.DoRemovePresentityGroupMemberL( *iGroupId, + *iMemberId, + iReqId ); + } + +// --------------------------------------------------------------------------- +// COperationRemovePresentityGroupMember::RequestCompleted() +// --------------------------------------------------------------------------- +// +void COperationRemovePresentityGroupMember::RequestCompletedL() + { + TRACE(_L("COperationRemovePresentityGroupMember::RequestCompletedL()" ) ); + CXIMPOperationBase::RequestCompletedL(); + + if ( iStatusObj->ResultCode() == KErrNone ) + { + iMyHost->PresenceDataAccess().GroupsDataAccess().HandlePresentityGroupMemberRemovedL( iGroupId, iMemberId ); + iGroupId = NULL; + iMemberId = NULL; + } + } + +// --------------------------------------------------------------------------- +// COperationRemovePresentityGroupMember::Type() +// --------------------------------------------------------------------------- +// +TInt COperationRemovePresentityGroupMember::Type() const + { + return NPresenceOps::EPrRemovePresentityGroupMember; + } + + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresenceoperations/presentitygroups/operationremovepresentitygroupmember.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresenceoperations/presentitygroups/operationremovepresentitygroupmember.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,65 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Remove Presentity Group Member operation + * +*/ + +#ifndef PSCOPERATIONREMOVEPRESENTITYGROUPMEMBER_H +#define PSCOPERATIONREMOVEPRESENTITYGROUPMEMBER_H + +#include +#include + +#include "ximpoperationbase.h" +#include "presenceoperationdefs.h" + +class CXIMPIdentityImp; + +/** + * Remove presentity group member operation + * + * @lib presenceoperation.lib + * @since S60 v4.0 + */ +class COperationRemovePresentityGroupMember : public CXIMPOperationBase + { + + public: + + IMPORT_C COperationRemovePresentityGroupMember(); + + void ConstructL( const TDesC8& aParamPck ); + + ~COperationRemovePresentityGroupMember(); + + public: // from CXIMPOperationBase + + void ProcessL(); + + void RequestCompletedL(); + + TInt Type() const; + + private: // data + + /** + * Group id + * Own. + */ + CXIMPIdentityImp* iGroupId; + CXIMPIdentityImp* iMemberId; + }; + + +#endif // PSCOPERATIONREMOVEPRESENTITYGROUPMEMBER_H diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresenceoperations/presentitygroups/operationsubscribegroupcontent.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresenceoperations/presentitygroups/operationsubscribegroupcontent.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,208 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Presentity group content subscription operator + * +*/ + + +#include +#include +#include + +#include "operationsubscribegroupcontent.h" +#include "ximpobjecthelpers.h" +#include "presencedatacacheimp.h" +#include "ximppanics.h" +#include "operationsynthesisesubscriptionevent.h" +#include "ximprestrictedobjectcollectionimp.h" +#include "ximpidentityimp.h" +#include "ximphost.h" +#include "ximpstatusimp.h" +#include "ximppsccontextimp.h" +#include "protocolpresencedatahostimp.h" + +#include "ximptrace.h" + +// ============================ MEMBER FUNCTIONS ============================= + +// --------------------------------------------------------------------------- +// COperationSubscribeGroupContent::COperationSubscribeGroupContent() +// --------------------------------------------------------------------------- +// +EXPORT_C COperationSubscribeGroupContent::COperationSubscribeGroupContent() + { + } + + +// --------------------------------------------------------------------------- +// COperationSubscribeGroupContent::~COperationSubscribeGroupContent() +// --------------------------------------------------------------------------- +// +COperationSubscribeGroupContent::~COperationSubscribeGroupContent() + { + if( iSubItem ) + { + iSubItem->Close(); + } + delete iGroupId; + } + +// --------------------------------------------------------------------------- +// COperationSubscribeGroupContent::ConstructL() +// --------------------------------------------------------------------------- +// +void COperationSubscribeGroupContent::ConstructL( const TDesC8& aParamPck ) + { + iGroupId = CXIMPIdentityImp::NewLC(); + CleanupStack::Pop( iGroupId ); + TXIMPObjectPacker< CXIMPIdentityImp >::UnPackL( *iGroupId, aParamPck ); + } + + +// --------------------------------------------------------------------------- +// COperationSubscribeGroupContent::ProcessL() +// --------------------------------------------------------------------------- +// +void COperationSubscribeGroupContent::ProcessL() + { + TRACE(_L("COperationSubscribeGroupContent::ProcessL()" ) ); + CXIMPOperationBase::ProcessL(); + + CGroupContentSubscriptionItem& subItem = + iMyHost->PresenceDataAccess().PresenceDataCache().GroupContentSubscriptionItemLC( *iGroupId ); + CleanupStack::Pop(); // subItem + iSubItem = &subItem; + iSubscriptionStatus = iSubItem->SubscriptionStatus( iContext ); + MProtocolPresentityGroups& presentityGroups = iMyHost->GetConnection().ProtocolPresenceFeatures().PresentityGroups(); + + switch( iSubscriptionStatus ) + { + case CGroupContentSubscriptionItem::ENotSubscribedAtAll: + { + presentityGroups.DoSubscribePresentityGroupContentL( *iGroupId, iReqId ); + break; + } + + case CGroupContentSubscriptionItem::ESubscribedForOtherCtxOnly: + case CGroupContentSubscriptionItem::ESubscribedForCtxOnly: + case CGroupContentSubscriptionItem::ESubscribedForCtxAndOthers: + { + iMyHost->FakeCompleteRequest( iReqId, KErrNone ); + break; + } + + XIMP_DEFAULT_CASE_UNSUPPORTED( NXIMPPrivPanic::EInvalidSubscriptionStatus ); + } + } + + +// --------------------------------------------------------------------------- +// COperationSubscribeGroupContent::RequestCompleted() +// --------------------------------------------------------------------------- +// +void COperationSubscribeGroupContent::RequestCompletedL() + { + TRACE(_L("COperationSubscribeGroupContent::RequestCompletedL()" ) ); + CXIMPOperationBase::RequestCompletedL(); + + if( iStatusObj->ResultCode() == KErrNone ) + { + switch( iSubscriptionStatus ) + { + case CGroupContentSubscriptionItem::ENotSubscribedAtAll: + { + CXIMPIdentityImp* altGroupId = NULL; + MXIMPBase* object = NULL; + iObjCollection->GetByType( object, MXIMPIdentity::KInterfaceId ); + if( object ) + { + // Got altered identity + altGroupId = TXIMPGetImpClassOrPanic< CXIMPIdentityImp >::From( *object ); + CleanupStack::PushL( altGroupId ); + } + + if ( altGroupId && iGroupId->Identity().Compare( altGroupId->Identity() ) != 0 ) + { + CGroupContentSubscriptionItem& altSubItem = + iMyHost->PresenceDataAccess().PresenceDataCache().GroupContentSubscriptionItemLC( *altGroupId ); + CleanupStack::Pop(); // altSubItem + iSubItem->Close(); + iSubItem = &altSubItem; + iSubItem->AddOrRenewSubscriberL( iContext ); + } + else + { + iSubItem->AddSubscriberL( iContext ); + } + + if( altGroupId ) + { + CleanupStack::PopAndDestroy( altGroupId ); + } + break; + } + + case CGroupContentSubscriptionItem::ESubscribedForOtherCtxOnly: + { + iSubItem->AddSubscriberL( iContext ); + break; + } + + case CGroupContentSubscriptionItem::ESubscribedForCtxOnly: + case CGroupContentSubscriptionItem::ESubscribedForCtxAndOthers: + { + break; + } + + XIMP_DEFAULT_CASE_UNSUPPORTED( NXIMPPrivPanic::EInvalidSubscriptionStatus ); + } + + SynthesiseEventL(); + } + } + + +// --------------------------------------------------------------------------- +// COperationSubscribeGroupContent::Type() +// --------------------------------------------------------------------------- +// +TInt + COperationSubscribeGroupContent::Type() const + { + return NPresenceOps::EPrSubscribeGroupContent; + } + +// --------------------------------------------------------------------------- +// COperationSubscribeGroupContent::SynthesiseEventL() +// --------------------------------------------------------------------------- +// +void COperationSubscribeGroupContent::SynthesiseEventL() + { + TBool force = + ( iSubscriptionStatus == CGroupContentSubscriptionItem::ESubscribedForCtxOnly || + iSubscriptionStatus == CGroupContentSubscriptionItem::ESubscribedForCtxAndOthers ) ? ETrue : EFalse; + + COperationSynthesiseSubscriptionEvent* synthOp = + new ( ELeave ) COperationSynthesiseSubscriptionEvent( + COperationSynthesiseSubscriptionEvent::EPresentityGroupContent, force ); + CleanupStack::PushL( synthOp ); + synthOp->BaseConstructL( TXIMPRequestId(), iContext ); + synthOp->ConstructL( *iGroupId ); + iMyHost->AddNewOperationL( *synthOp ); + CleanupStack::Pop( synthOp ); + } + + + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresenceoperations/presentitygroups/operationsubscribegroupcontent.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresenceoperations/presentitygroups/operationsubscribegroupcontent.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,83 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Presentity group content subscription operator + * +*/ + +#ifndef CPSCOPERATIONSUBSCRIBEGROUPCONTENT_H +#define CPSCOPERATIONSUBSCRIBEGROUPCONTENT_H + + +#include +#include + +#include "ximpoperationbase.h" +#include "presenceoperationdefs.h" +#include "groupcontentsubscriptionitem.h" + +/** + * Presence interest registration operation. + * + * @lib ximpoperations.lib + * @since S60 v4.0 + */ +class COperationSubscribeGroupContent : public CXIMPOperationBase + { + + public: + + IMPORT_C COperationSubscribeGroupContent(); + + void ConstructL( const TDesC8& aParamPck ); + + ~COperationSubscribeGroupContent(); + + + public: // from CXIMPOperationBase + + void ProcessL(); + + void RequestCompletedL(); + + TInt Type() const; + + private: // Helper methods + + /** + * Synthesise event after completion + */ + void SynthesiseEventL(); + + private: // data + + /** + * Group list access. + */ + CGroupContentSubscriptionItem* iSubItem; + + /** + * Subscription status + */ + CGroupContentSubscriptionItem::TSubscriptionStatus iSubscriptionStatus; + + /** + * Subscribed Group Id + * Own. + */ + CXIMPIdentityImp* iGroupId; + + }; + + +#endif // CPSCOPERATIONSUBSCRIBEGROUPCONTENT_H diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresenceoperations/presentitygroups/operationsubscribegrouplist.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresenceoperations/presentitygroups/operationsubscribegrouplist.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,166 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Presentity group list subscription operator + * +*/ + + +#include +#include +#include + +#include "operationsubscribegrouplist.h" +#include "presencedatacacheimp.h" +#include "ximppanics.h" +#include "operationsynthesisesubscriptionevent.h" +#include "ximphost.h" +#include "ximppsccontextimp.h" +#include "ximpstatusimp.h" +#include "protocolpresencedatahostimp.h" + +#include "ximptrace.h" +// ============================ MEMBER FUNCTIONS ============================= + +// --------------------------------------------------------------------------- +// COperationSubscribeGroupList::COperationSubscribeGroupList() +// --------------------------------------------------------------------------- +// +EXPORT_C COperationSubscribeGroupList::COperationSubscribeGroupList() + { + } + + +// --------------------------------------------------------------------------- +// COperationSubscribeGroupList::~COperationSubscribeGroupList() +// --------------------------------------------------------------------------- +// +COperationSubscribeGroupList::~COperationSubscribeGroupList() + { + if( iGroupList ) + { + iGroupList->Close(); + } + } + +// --------------------------------------------------------------------------- +// COperationSubscribeGroupList::ConstructL() +// --------------------------------------------------------------------------- +// +void COperationSubscribeGroupList::ConstructL( const TDesC8& /*aParamPck*/ ) + { + } + + +// --------------------------------------------------------------------------- +// COperationSubscribeGroupList::ProcessL() +// --------------------------------------------------------------------------- +// +void COperationSubscribeGroupList::ProcessL() + { + TRACE(_L("COperationSubscribeGroupList::ProcessL()" ) ); + CXIMPOperationBase::ProcessL(); + + CGroupListSubscriptionItem& groupList = + iMyHost->PresenceDataAccess().PresenceDataCache().GroupListSubscriptionItemLC(); + CleanupStack::Pop(); // groupList + iGroupList = &groupList; + + iSubscriptionStatus = iGroupList->SubscriptionStatus( iContext ); + MProtocolPresentityGroups& presentityGroups = iMyHost->GetConnection().ProtocolPresenceFeatures().PresentityGroups(); + + switch( iSubscriptionStatus ) + { + case CGroupListSubscriptionItem::ENotSubscribedAtAll: + { + // Do subscribe + presentityGroups.DoSubscribePresentityGroupListL( iReqId ); + break; + } + case CGroupListSubscriptionItem::ESubscribedForOtherCtxOnly: + case CGroupListSubscriptionItem::ESubscribedForCtxOnly: + case CGroupListSubscriptionItem::ESubscribedForCtxAndOthers: + { + iMyHost->FakeCompleteRequest( iReqId, KErrNone ); + break; + } + + + XIMP_DEFAULT_CASE_UNSUPPORTED( NXIMPPrivPanic::EInvalidSubscriptionStatus ); + } + } + +// --------------------------------------------------------------------------- +// COperationSubscribeGroupList::RequestCompleted() +// --------------------------------------------------------------------------- +// +void COperationSubscribeGroupList::RequestCompletedL() + { + TRACE(_L("COperationSubscribeGroupList::RequestCompletedL()" ) ); + CXIMPOperationBase::RequestCompletedL(); + + if( iStatusObj->ResultCode() == KErrNone ) + { + switch( iSubscriptionStatus ) + { + case CGroupListSubscriptionItem::ENotSubscribedAtAll: + case CGroupListSubscriptionItem::ESubscribedForOtherCtxOnly: + { + iGroupList->AddSubscriberL( iContext ); + break; + } + case CGroupListSubscriptionItem::ESubscribedForCtxOnly: + case CGroupListSubscriptionItem::ESubscribedForCtxAndOthers: + { + break; + } + + XIMP_DEFAULT_CASE_UNSUPPORTED( NXIMPPrivPanic::EInvalidSubscriptionStatus ); + } + SynthesiseEventL(); + } + } + + +// --------------------------------------------------------------------------- +// COperationSubscribeGroupList::Type() +// --------------------------------------------------------------------------- +// +TInt + COperationSubscribeGroupList::Type() const + { + return NPresenceOps::EPrSubscribeGroupList; + } + +// --------------------------------------------------------------------------- +// COperationSubscribeGroupList::SynthesiseEventL() +// --------------------------------------------------------------------------- +// +void COperationSubscribeGroupList::SynthesiseEventL() + { + TBool force = + ( iSubscriptionStatus == CGroupListSubscriptionItem::ESubscribedForCtxOnly || + iSubscriptionStatus == CGroupListSubscriptionItem::ESubscribedForCtxAndOthers ) ? ETrue : EFalse; + + COperationSynthesiseSubscriptionEvent* synthOp = + new ( ELeave ) COperationSynthesiseSubscriptionEvent( + COperationSynthesiseSubscriptionEvent::EPresentityGroupList, force ); + CleanupStack::PushL( synthOp ); + synthOp->BaseConstructL( TXIMPRequestId(), iContext ); + iMyHost->AddNewOperationL( *synthOp ); + CleanupStack::Pop( synthOp ); + } + + + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresenceoperations/presentitygroups/operationsubscribegrouplist.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresenceoperations/presentitygroups/operationsubscribegrouplist.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,76 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Presentity group list subscription operator + * +*/ + +#ifndef CPSCOPERATIONSUBSCRIBEGROUPLIST_H +#define CPSCOPERATIONSUBSCRIBEGROUPLIST_H + + +#include +#include + +#include "ximpoperationbase.h" +#include "grouplistsubscriptionitem.h" +#include "presenceoperationdefs.h" + +/** + * Presence interest registration operation. + * + * @lib ximpoperations.lib + * @since S60 v4.0 + */ +class COperationSubscribeGroupList : public CXIMPOperationBase + { + + public: + + IMPORT_C COperationSubscribeGroupList(); + + void ConstructL( const TDesC8& aParamPck ); + + ~COperationSubscribeGroupList(); + + + public: // from CXIMPOperationBase + + void ProcessL(); + + void RequestCompletedL(); + + TInt Type() const; + + private: // Helper methods + + /** + * Synthesise event after completion + */ + void SynthesiseEventL(); + + private: // data + + /** + * Group list access. + */ + CGroupListSubscriptionItem* iGroupList; + + /** + * Subscription status + */ + CGroupListSubscriptionItem::TSubscriptionStatus iSubscriptionStatus; + }; + + +#endif // CPSCOPERATIONSUBSCRIBEGROUPLIST_H diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresenceoperations/presentitygroups/operationunsubscribegroupcontent.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresenceoperations/presentitygroups/operationunsubscribegroupcontent.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,169 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Presentity group content unsubscribe operator + * +*/ + + +#include +#include +#include + +#include "operationunsubscribegroupcontent.h" +#include "ximpobjecthelpers.h" +#include "presencedatacacheimp.h" +#include "ximppanics.h" +#include "operationsynthesisesubscriptionevent.h" +#include "ximpidentityimp.h" +#include "ximphost.h" +#include "ximpstatusimp.h" +#include "ximppsccontextimp.h" +#include "protocolpresencedatahostimp.h" + +#include "ximptrace.h" +// ============================ MEMBER FUNCTIONS ============================= + +// --------------------------------------------------------------------------- +// COperationUnsubscribeGroupContent::COperationUnsubscribeGroupContent() +// --------------------------------------------------------------------------- +// +EXPORT_C COperationUnsubscribeGroupContent::COperationUnsubscribeGroupContent() + { + } + + +// --------------------------------------------------------------------------- +// COperationUnsubscribeGroupContent::~COperationUnsubscribeGroupContent() +// --------------------------------------------------------------------------- +// +COperationUnsubscribeGroupContent::~COperationUnsubscribeGroupContent() + { + if( iSubItem ) + { + iSubItem->Close(); + } + delete iGroupId; + } + +// --------------------------------------------------------------------------- +// COperationUnsubscribeGroupContent::ConstructL() +// --------------------------------------------------------------------------- +// +void COperationUnsubscribeGroupContent::ConstructL( const TDesC8& aParamPck ) + { + iGroupId = CXIMPIdentityImp::NewLC(); + CleanupStack::Pop( iGroupId ); + TXIMPObjectPacker< CXIMPIdentityImp >::UnPackL( *iGroupId, aParamPck ); + } + + +// --------------------------------------------------------------------------- +// COperationUnsubscribeGroupContent::ProcessL() +// --------------------------------------------------------------------------- +// +void COperationUnsubscribeGroupContent::ProcessL() + { + TRACE(_L("COperationUnsubscribeGroupContent::ProcessL()" ) ); + CXIMPOperationBase::ProcessL(); + + CGroupContentSubscriptionItem& subItem = + iMyHost->PresenceDataAccess().PresenceDataCache().GroupContentSubscriptionItemLC( *iGroupId ); + CleanupStack::Pop(); // subItem + iSubItem = &subItem; + + iSubscriptionStatus = iSubItem->SubscriptionStatus( iContext ); + MProtocolPresentityGroups& presentityGroups = iMyHost->GetConnection().ProtocolPresenceFeatures().PresentityGroups(); + + switch( iSubscriptionStatus ) + { + case CGroupContentSubscriptionItem::ESubscribedForCtxOnly: + { + presentityGroups.DoUnsubscribePresentityGroupContentL( *iGroupId, iReqId ); + break; + } + + case CGroupContentSubscriptionItem::ENotSubscribedAtAll: + case CGroupContentSubscriptionItem::ESubscribedForCtxAndOthers: + case CGroupContentSubscriptionItem::ESubscribedForOtherCtxOnly: + { + iMyHost->FakeCompleteRequest( iReqId, KErrNone ); + break; + } + + XIMP_DEFAULT_CASE_UNSUPPORTED( NXIMPPrivPanic::EInvalidSubscriptionStatus ); + } + } + +// --------------------------------------------------------------------------- +// COperationUnsubscribeGroupContent::RequestCompleted() +// --------------------------------------------------------------------------- +// +void COperationUnsubscribeGroupContent::RequestCompletedL() + { + TRACE(_L("COperationUnsubscribeGroupContent::RequestCompletedL()" ) ); + CXIMPOperationBase::RequestCompletedL(); + + if( iStatusObj->ResultCode() == KErrNone ) + { + switch( iSubscriptionStatus ) + { + case CGroupContentSubscriptionItem::ESubscribedForCtxOnly: + case CGroupContentSubscriptionItem::ESubscribedForCtxAndOthers: + { + iSubItem->RemoveSubscriber( iContext ); + break; + } + case CGroupContentSubscriptionItem::ENotSubscribedAtAll: + case CGroupContentSubscriptionItem::ESubscribedForOtherCtxOnly: + { + break; + } + + XIMP_DEFAULT_CASE_UNSUPPORTED( NXIMPPrivPanic::EInvalidSubscriptionStatus ); + } + + SynthesiseEventL(); + } + } + + +// --------------------------------------------------------------------------- +// COperationUnsubscribeGroupContent::Type() +// --------------------------------------------------------------------------- +// +TInt + COperationUnsubscribeGroupContent::Type() const + { + return NPresenceOps::EPrUnsubscribeGroupContent; + } + +// --------------------------------------------------------------------------- +// COperationUnsubscribeGroupContent::SynthesiseEventL() +// --------------------------------------------------------------------------- +// +void COperationUnsubscribeGroupContent::SynthesiseEventL() + { + COperationSynthesiseSubscriptionEvent* synthOp = + new ( ELeave ) COperationSynthesiseSubscriptionEvent( + COperationSynthesiseSubscriptionEvent::EPresentityGroupContent, ETrue ); + CleanupStack::PushL( synthOp ); + synthOp->BaseConstructL( TXIMPRequestId(), iContext ); + synthOp->ConstructL( *iGroupId ); + iMyHost->AddNewOperationL( *synthOp ); + CleanupStack::Pop( synthOp ); + } + + + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresenceoperations/presentitygroups/operationunsubscribegroupcontent.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresenceoperations/presentitygroups/operationunsubscribegroupcontent.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,83 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Presentity group content unsubscribe operator + * +*/ + +#ifndef CPSCOPERATIONUNSUBSCRIBEGROUPCONTENT_H +#define CPSCOPERATIONUNSUBSCRIBEGROUPCONTENT_H + + +#include +#include + +#include "ximpoperationbase.h" +#include "groupcontentsubscriptionitem.h" +#include "presenceoperationdefs.h" + +/** + * Presence interest registration operation. + * + * @lib ximpoperations.lib + * @since S60 v4.0 + */ +class COperationUnsubscribeGroupContent : public CXIMPOperationBase + { + + public: + + IMPORT_C COperationUnsubscribeGroupContent(); + + void ConstructL( const TDesC8& aParamPck ); + + ~COperationUnsubscribeGroupContent(); + + + public: // from CXIMPOperationBase + + void ProcessL(); + + void RequestCompletedL(); + + TInt Type() const; + + private: // Helper methods + + /** + * Synthesise event after completion + */ + void SynthesiseEventL(); + + private: // data + + /** + * Group content access. + */ + CGroupContentSubscriptionItem* iSubItem; + + /** + * Subscription status + */ + CGroupContentSubscriptionItem::TSubscriptionStatus iSubscriptionStatus; + + /** + * Subscribed Group Id + * Own. + */ + CXIMPIdentityImp* iGroupId; + + }; + + +#endif // CPSCOPERATIONUNSUBSCRIBEGROUPCONTENT_H diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresenceoperations/presentitygroups/operationunsubscribegrouplist.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresenceoperations/presentitygroups/operationunsubscribegrouplist.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,163 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Presentity group list unsubscription operation + * +*/ + + +#include +#include +#include + +#include "operationunsubscribegrouplist.h" +#include "presencedatacacheimp.h" +#include "ximppanics.h" +#include "operationsynthesisesubscriptionevent.h" +#include "ximphost.h" +#include "ximppsccontextimp.h" +#include "ximpstatusimp.h" +#include "protocolpresencedatahostimp.h" + +#include "ximptrace.h" +// ============================ MEMBER FUNCTIONS ============================= + +// --------------------------------------------------------------------------- +// COperationUnsubscribeGroupList::COperationUnsubscribeGroupList() +// --------------------------------------------------------------------------- +// +EXPORT_C COperationUnsubscribeGroupList::COperationUnsubscribeGroupList() + { + } + + +// --------------------------------------------------------------------------- +// COperationUnsubscribeGroupList::~COperationUnsubscribeGroupList() +// --------------------------------------------------------------------------- +// +COperationUnsubscribeGroupList::~COperationUnsubscribeGroupList() + { + if( iGroupList ) + { + iGroupList->Close(); + } + } + +// --------------------------------------------------------------------------- +// COperationUnsubscribeGroupList::ConstructL() +// --------------------------------------------------------------------------- +// +void COperationUnsubscribeGroupList::ConstructL( const TDesC8& /*aParamPck*/ ) + { + } + + +// --------------------------------------------------------------------------- +// COperationUnsubscribeGroupList::ProcessL() +// --------------------------------------------------------------------------- +// +void COperationUnsubscribeGroupList::ProcessL() + { + TRACE(_L("COperationUnsubscribeGroupList::ProcessL()" ) ); + CXIMPOperationBase::ProcessL(); + + CGroupListSubscriptionItem& groupList = + iMyHost->PresenceDataAccess().PresenceDataCache().GroupListSubscriptionItemLC(); + CleanupStack::Pop(); // ownPresence + iGroupList = &groupList; + + iSubscriptionStatus = iGroupList->SubscriptionStatus( iContext ); + + MProtocolPresentityGroups& presentityGroups = iMyHost->GetConnection().ProtocolPresenceFeatures().PresentityGroups(); + + switch( iSubscriptionStatus ) + { + case CGroupListSubscriptionItem::ESubscribedForCtxOnly: + { + // Do subscribe + presentityGroups.DoUnsubscribePresentityGroupListL( iReqId ); + break; + } + case CGroupListSubscriptionItem::ESubscribedForCtxAndOthers: + case CGroupListSubscriptionItem::ENotSubscribedAtAll: + case CGroupListSubscriptionItem::ESubscribedForOtherCtxOnly: + { + // Everything is ok. We are not handling updates through this one. + // Already subscribed -> complete request. + iMyHost->FakeCompleteRequest( iReqId, KErrNone ); + break; + } + + XIMP_DEFAULT_CASE_UNSUPPORTED( NXIMPPrivPanic::EInvalidSubscriptionStatus ); + } + } + +// --------------------------------------------------------------------------- +// COperationUnsubscribeGroupList::RequestCompleted() +// --------------------------------------------------------------------------- +// +void COperationUnsubscribeGroupList::RequestCompletedL() + { + TRACE(_L("COperationUnsubscribeGroupList::RequestCompletedL()" ) ); + CXIMPOperationBase::RequestCompletedL(); + + if( iStatusObj->ResultCode() == KErrNone ) + { + switch( iSubscriptionStatus ) + { + case CGroupListSubscriptionItem::ESubscribedForCtxOnly: + case CGroupListSubscriptionItem::ESubscribedForCtxAndOthers: + { + iGroupList->RemoveSubscriber( iContext ); + break; + } + case CGroupListSubscriptionItem::ENotSubscribedAtAll: + case CGroupListSubscriptionItem::ESubscribedForOtherCtxOnly: + { + break; + } + + XIMP_DEFAULT_CASE_UNSUPPORTED( NXIMPPrivPanic::EInvalidSubscriptionStatus ); + } + SynthesiseEventL(); + } + } + + +// --------------------------------------------------------------------------- +// COperationUnsubscribeGroupList::Type() +// --------------------------------------------------------------------------- +// +TInt + COperationUnsubscribeGroupList::Type() const + { + return NPresenceOps::EPrUnsubscribeGroupList; + } + +// --------------------------------------------------------------------------- +// COperationUnsubscribeGroupList::SynthesiseEventL() +// --------------------------------------------------------------------------- +// +void COperationUnsubscribeGroupList::SynthesiseEventL() + { + COperationSynthesiseSubscriptionEvent* synthOp = + new ( ELeave ) COperationSynthesiseSubscriptionEvent( + COperationSynthesiseSubscriptionEvent::EPresentityGroupList, ETrue ); + CleanupStack::PushL( synthOp ); + synthOp->BaseConstructL( TXIMPRequestId(), iContext ); + iMyHost->AddNewOperationL( *synthOp ); + CleanupStack::Pop( synthOp ); + } + + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresenceoperations/presentitygroups/operationunsubscribegrouplist.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresenceoperations/presentitygroups/operationunsubscribegrouplist.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,75 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Presentity group list unsubscription operation + * +*/ + +#ifndef CPSCOPERATIONUNSUBSCRIBEGROUPLIST_H +#define CPSCOPERATIONUNSUBSCRIBEGROUPLIST_H + + +#include +#include + +#include "ximpoperationbase.h" +#include "grouplistsubscriptionitem.h" +#include "presenceoperationdefs.h" + +/** + * Presence interest registration operation. + * + * @lib ximpoperations.lib + * @since S60 v4.0 + */ +class COperationUnsubscribeGroupList : public CXIMPOperationBase + { + public: + + IMPORT_C COperationUnsubscribeGroupList(); + + void ConstructL( const TDesC8& aParamPck ); + + ~COperationUnsubscribeGroupList(); + + + public: // from CXIMPOperationBase + + void ProcessL(); + + void RequestCompletedL(); + + TInt Type() const; + + private: // Helper methods + + /** + * Synthesise event after completion + */ + void SynthesiseEventL(); + + private: // data + + /** + * Group list access. + */ + CGroupListSubscriptionItem* iGroupList; + + /** + * Subscription status + */ + CGroupListSubscriptionItem::TSubscriptionStatus iSubscriptionStatus; + }; + + +#endif // CPSCOPERATIONUNSUBSCRIBEGROUPLIST_H diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresenceoperations/presentitygroups/operationupdatepresentitygroupdisplayname.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresenceoperations/presentitygroups/operationupdatepresentitygroupdisplayname.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,126 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Concrete bind operation + * +*/ + + +#include +#include +#include + +#include "operationupdatepresentitygroupdisplayname.h" +#include "presentitygroupinfoimp.h" +#include "ximpobjecthelpers.h" +#include "ximpidentity.h" +#include "ximprestrictedobjectcollectionimp.h" +#include "protocolpresentitygroupsdatahostimp.h" +#include "ximphost.h" +#include "ximpstatusimp.h" +#include "ximprequestcompleteeventimp.h" +#include "protocolpresencedatahostimp.h" + +#include "ximptrace.h" +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// COperationUpdatePresentityGroupDisplayName::COperationUpdatePresentityGroupDisplayName() +// --------------------------------------------------------------------------- +// +EXPORT_C COperationUpdatePresentityGroupDisplayName::COperationUpdatePresentityGroupDisplayName() + { + } + + +// --------------------------------------------------------------------------- +// COperationUpdatePresentityGroupDisplayName::ConstructL +// --------------------------------------------------------------------------- +// +void COperationUpdatePresentityGroupDisplayName::ConstructL( const TDesC8& aParamPck ) + { + CPresentityGroupInfoImp* groupInfo = CPresentityGroupInfoImp::NewLC(); + TXIMPObjectPacker< CPresentityGroupInfoImp >::UnPackL( *groupInfo, + aParamPck ); + CleanupStack::Pop( groupInfo ); + iGroupInfo = groupInfo; + } + +// --------------------------------------------------------------------------- +// COperationUpdatePresentityGroupDisplayName::~COperationUpdatePresentityGroupDisplayName() +// --------------------------------------------------------------------------- +// +COperationUpdatePresentityGroupDisplayName::~COperationUpdatePresentityGroupDisplayName() + { + delete iGroupInfo; + } + +// --------------------------------------------------------------------------- +// COperationUpdatePresentityGroupDisplayName::ProcessL() +// --------------------------------------------------------------------------- +// +void COperationUpdatePresentityGroupDisplayName::ProcessL() + { + TRACE(_L("COperationUpdatePresentityGroupDisplayName::ProcessL()" ) ); + CXIMPOperationBase::ProcessL(); + + MProtocolPresentityGroups& presentityGroups = iMyHost->GetConnection().ProtocolPresenceFeatures().PresentityGroups(); + + presentityGroups.DoUpdatePresentityGroupDisplayNameL( iGroupInfo->GroupId(), + iGroupInfo->GroupDisplayName(), iReqId ); + } + +// --------------------------------------------------------------------------- +// COperationUpdatePresentityGroupDisplayName::RequestCompleted() +// --------------------------------------------------------------------------- +// +void COperationUpdatePresentityGroupDisplayName::RequestCompletedL() + { + TRACE(_L("COperationUpdatePresentityGroupDisplayName::RequestCompletedL()" ) ); + CXIMPOperationBase::RequestCompletedL(); + + MXIMPBase* object = NULL; + iObjCollection->GetByType( object, MPresentityGroupInfo::KInterfaceId ); + if( object ) + { + CPresentityGroupInfoImp* groupInfo = + TXIMPGetImpClassOrPanic< CPresentityGroupInfoImp >::From( *object ); + + delete iGroupInfo; + iGroupInfo = groupInfo; + } + + if ( iStatusObj->ResultCode() == KErrNone ) + { + CPresentityGroupInfoImp* groupInfo = + TXIMPObjectCloner< CPresentityGroupInfoImp >::CloneL( *iGroupInfo ); + CleanupStack::PushL( groupInfo ); + iMyHost->PresenceDataAccess().GroupsDataAccess().HandlePresentityGroupDisplayNameUpdatedL( groupInfo ); + CleanupStack::Pop( groupInfo ); + } + + // Set information for request complete event. + iReqCompleteEvent->AppendParamL( ( CXIMPApiDataObjBase* ) iGroupInfo ); + iGroupInfo = NULL; + } + +// --------------------------------------------------------------------------- +// COperationUpdatePresentityGroupDisplayName::Type() +// --------------------------------------------------------------------------- +// +TInt COperationUpdatePresentityGroupDisplayName::Type() const + { + return NPresenceOps::EPrUpdatePresentityGroupDisplayName; + } + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresenceoperations/presentitygroups/operationupdatepresentitygroupdisplayname.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresenceoperations/presentitygroups/operationupdatepresentitygroupdisplayname.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,63 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Bind operation + * +*/ + +#ifndef C_PSCOPERATIONUPDATEPRESENTITYGROUPDISPLAYNAME_H +#define C_PSCOPERATIONUPDATEPRESENTITYGROUPDISPLAYNAME_H + +#include +#include + +#include "ximpoperationbase.h" +#include "presenceoperationdefs.h" + +class CPresentityGroupInfoImp; + +/** + * Create presentity group operation + * + * @lib presenceoperation.lib + * @since S60 v4.0 + */ +class COperationUpdatePresentityGroupDisplayName : public CXIMPOperationBase + { + + public: + + IMPORT_C COperationUpdatePresentityGroupDisplayName(); + + void ConstructL( const TDesC8& aParamPck ); + + ~COperationUpdatePresentityGroupDisplayName(); + + public: // from CXIMPOperationBase + + void ProcessL(); + + void RequestCompletedL(); + + TInt Type() const; + + private: // data + + /** + * groupinfo + */ + CPresentityGroupInfoImp* iGroupInfo; + }; + + +#endif // C_PSCOPERATIONUPDATEPRESENTITYGROUPDISPLAYNAME_H diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresenceoperations/presentitygroups/operationupdatepresentitygroupmemberdisplayname.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresenceoperations/presentitygroups/operationupdatepresentitygroupmemberdisplayname.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,151 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Update Presentity Group Member Display Name operation + * +*/ + +#include +#include +#include +#include + +#include "operationupdatepresentitygroupmemberdisplayname.h" +#include "presentitygroupmemberinfoimp.h" +#include "ximpidentityimp.h" +#include "protocolpresentitygroupsdatahostimp.h" +#include "ximprbufhelpers.h" +#include "ximprestrictedobjectcollectionimp.h" +#include "ximphost.h" +#include "ximpstatusimp.h" +#include "ximprequestcompleteeventimp.h" +#include "ximpobjecthelpers.h" +#include "protocolpresencedatahostimp.h" + +#include "ximptrace.h" +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// COperationUpdatePresentityGroupMemberDisplayName::COperationUpdatePresentityGroupMemberDisplayName() +// --------------------------------------------------------------------------- +// +EXPORT_C COperationUpdatePresentityGroupMemberDisplayName::COperationUpdatePresentityGroupMemberDisplayName() + { + } + + +// --------------------------------------------------------------------------- +// COperationUpdatePresentityGroupMemberDisplayName::ConstructL +// --------------------------------------------------------------------------- +// +void COperationUpdatePresentityGroupMemberDisplayName::ConstructL( const TDesC8& aParamPck ) + { + RDesReadStream rs; + rs.Open( aParamPck ); // CSI: 65 # Does not return a value. + CleanupClosePushL( rs ); + + // group id + iGroupId = CXIMPIdentityImp::NewLC(); + CleanupStack::Pop( iGroupId ); + iGroupId->InternalizeL( rs ); + + // member id + CXIMPIdentityImp* memberId = CXIMPIdentityImp::NewLC(); + memberId->InternalizeL( rs ); + + // member display name + RBuf16 dispName; + CleanupClosePushL( dispName ); + XIMPRBuf16Helper::InternalizeL( dispName, rs ); + + iMemberInfo = CPresentityGroupMemberInfoImp::NewLC( *memberId, dispName ); + CleanupStack::Pop( iMemberInfo ); + CleanupStack::PopAndDestroy( 3 ); // dispName, memberId, rs + } + +// --------------------------------------------------------------------------- +// COperationUpdatePresentityGroupMemberDisplayName::~COperationUpdatePresentityGroupMemberDisplayName() +// --------------------------------------------------------------------------- +// +COperationUpdatePresentityGroupMemberDisplayName::~COperationUpdatePresentityGroupMemberDisplayName() + { + delete iGroupId; + delete iMemberInfo; + } + +// --------------------------------------------------------------------------- +// COperationUpdatePresentityGroupMemberDisplayName::ProcessL() +// --------------------------------------------------------------------------- +// +void COperationUpdatePresentityGroupMemberDisplayName::ProcessL() + { + TRACE(_L("COperationUpdatePresentityGroupMemberDisplayName::ProcessL()" ) ); + CXIMPOperationBase::ProcessL(); + + MProtocolPresentityGroups& presentityGroups = iMyHost->GetConnection().ProtocolPresenceFeatures().PresentityGroups(); + + presentityGroups.DoUpdatePresentityGroupMemberDisplayNameL( + *iGroupId, + iMemberInfo->GroupMemberId(), + iMemberInfo->GroupMemberDisplayName(), + iReqId ); + } + +// --------------------------------------------------------------------------- +// COperationUpdatePresentityGroupMemberDisplayName::RequestCompleted() +// --------------------------------------------------------------------------- +// +void COperationUpdatePresentityGroupMemberDisplayName::RequestCompletedL() + { + TRACE(_L("COperationUpdatePresentityGroupMemberDisplayName::RequestCompletedL()" ) ); + CXIMPOperationBase::RequestCompletedL(); + + MXIMPBase* object = NULL; + iObjCollection->GetByType( object, MPresentityGroupMemberInfo::KInterfaceId ); + if( object ) + { + CPresentityGroupMemberInfoImp* memberInfo = + TXIMPGetImpClassOrPanic< CPresentityGroupMemberInfoImp >::From( *object ); + delete iMemberInfo; + iMemberInfo = memberInfo; + } + + if ( iStatusObj->ResultCode() == KErrNone ) + { + CXIMPIdentityImp* groupId = + TXIMPObjectCloner< CXIMPIdentityImp >::CloneL( *iGroupId ); + CleanupStack::PushL( groupId ); + CPresentityGroupMemberInfoImp* memberInfo = + TXIMPObjectCloner< CPresentityGroupMemberInfoImp >::CloneL( *iMemberInfo ); + CleanupStack::PushL( memberInfo ); + iMyHost->PresenceDataAccess().GroupsDataAccess().HandlePresentityGroupMemberDisplayNameUpdatedL( groupId, memberInfo ); + CleanupStack::Pop( 2, groupId ); + } + + // Set information for request complete event. + iReqCompleteEvent->AppendParamL( iGroupId ); + iGroupId = NULL; + iReqCompleteEvent->AppendParamL( iMemberInfo ); + iMemberInfo = NULL; + } + +// --------------------------------------------------------------------------- +// COperationUpdatePresentityGroupMemberDisplayName::Type() +// --------------------------------------------------------------------------- +// +TInt COperationUpdatePresentityGroupMemberDisplayName::Type() const + { + return NPresenceOps::EPrUpdatePresentityGroupMemberDisplayName; + } + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresenceoperations/presentitygroups/operationupdatepresentitygroupmemberdisplayname.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresenceoperations/presentitygroups/operationupdatepresentitygroupmemberdisplayname.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,72 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Update Presentity Group Member Display Name operation + * +*/ + +#ifndef PSCOPERATIONUPDATEPRESENTITYGROUPMEMBERDISPLAYNAME_H +#define PSCOPERATIONUPDATEPRESENTITYGROUPMEMBERDISPLAYNAME_H + +#include +#include + +#include "ximpoperationbase.h" +#include "presenceoperationdefs.h" + +class CXIMPIdentityImp; +class CPresentityGroupMemberInfoImp; + +/** + * Update presentity group member display name operation + * + * @lib presenceoperation.lib + * @since S60 v4.0 + */ +class COperationUpdatePresentityGroupMemberDisplayName : public CXIMPOperationBase + { + + public: + + IMPORT_C COperationUpdatePresentityGroupMemberDisplayName(); + + void ConstructL( const TDesC8& aParamPck ); + + ~COperationUpdatePresentityGroupMemberDisplayName(); + + public: // from CXIMPOperationBase + + void ProcessL(); + + void RequestCompletedL(); + + TInt Type() const; + + private: // data + + + /** + * Group id + * Own. + */ + CXIMPIdentityImp* iGroupId; + + /** + * Group member info + * Own. + */ + CPresentityGroupMemberInfoImp* iMemberInfo; + }; + + +#endif // PSCOPERATIONUPDATEPRESENTITYGROUPMEMBERDISPLAYNAME_H diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresenceprocessor/protocolpresenceauthorizationdatahostimp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresenceprocessor/protocolpresenceauthorizationdatahostimp.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,206 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation for managing cached authorization information. + * +*/ + + +//#include +//#include + +#include +#include +#include +#include +#include +#include + +#include "protocolpresencedatahostimp.h" +#include "protocolpresenceauthorizationdatahostimp.h" +#include "ximprestrictedobjectcollectionimp.h" +#include "ximpoperationbase.h" +#include "ximpglobals.h" +#include "ximpoperationfactory.h" +#include "ximphost.h" +#include "presencedatacacheimp.h" +#include "presenceoperationdefs.h" +#include "ximptrace.h" + +// --------------------------------------------------------------------------- +// CProtocolPresenceAuthorizationDataHostImp::CProtocolPresenceAuthorizationDataHostImp() +// --------------------------------------------------------------------------- +// +CProtocolPresenceAuthorizationDataHostImp::CProtocolPresenceAuthorizationDataHostImp( MXIMPHost& aHost ) +:iHost( aHost ) + { + } + + +// --------------------------------------------------------------------------- +// CProtocolPresenceAuthorizationDataHostImp::ConstructL() +// --------------------------------------------------------------------------- +// +void CProtocolPresenceAuthorizationDataHostImp::ConstructL() + { + } + + +// --------------------------------------------------------------------------- +// CProtocolPresenceAuthorizationDataHostImp::NewL() +// --------------------------------------------------------------------------- +// +EXPORT_C CProtocolPresenceAuthorizationDataHostImp* CProtocolPresenceAuthorizationDataHostImp::NewL( MXIMPHost& aHost ) + { + CProtocolPresenceAuthorizationDataHostImp* self = new( ELeave ) CProtocolPresenceAuthorizationDataHostImp( aHost ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// Implement supported interface access. +// --------------------------------------------------------------------------- +// +XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CProtocolPresenceAuthorizationDataHostImp, + MProtocolPresenceAuthorizationDataHost ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + + +XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CProtocolPresenceAuthorizationDataHostImp, + MProtocolPresenceAuthorizationDataHost ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + +// --------------------------------------------------------------------------- +// CProtocolPresenceAuthorizationDataHostImp::~CProtocolPresenceAuthorizationDataHostImp() +// --------------------------------------------------------------------------- +// +CProtocolPresenceAuthorizationDataHostImp::~CProtocolPresenceAuthorizationDataHostImp() + { + } + +// --------------------------------------------------------------------------- +// CProtocolPresenceAuthorizationDataHostImp::HandlePresenceGrantRequestListL() +// --------------------------------------------------------------------------- +// +TXIMPRequestId CProtocolPresenceAuthorizationDataHostImp::HandlePresenceGrantRequestListL( + MXIMPObjectCollection* aGrantRequestList ) + { + TRACE(_L("CProtocolPresenceAuthorizationDataHostImp::HandlePresenceGrantRequestListL") ); + return iHost.AddNewOperationL( NPresenceOps::EPrHandlePresenceGrantRequestList, aGrantRequestList ); + } +// --------------------------------------------------------------------------- +// CProtocolPresenceAuthorizationDataHostImp::HandlePresenceGrantRequestReceivedL() +// --------------------------------------------------------------------------- +// +TXIMPRequestId CProtocolPresenceAuthorizationDataHostImp::HandlePresenceGrantRequestReceivedL( + MPresenceGrantRequestInfo* aGrantRequest ) + { + TRACE(_L("CProtocolPresenceAuthorizationDataHostImp::HandlePresenceGrantRequestReceivedL") ); + return iHost.AddNewOperationL( NPresenceOps::EPrHandlePresenceGrantRequestReceived, aGrantRequest ); + } + +// --------------------------------------------------------------------------- +// CProtocolPresenceAuthorizationDataHostImp::HandlePresenceGrantRequestObsoletedL() +// --------------------------------------------------------------------------- +// +TXIMPRequestId CProtocolPresenceAuthorizationDataHostImp::HandlePresenceGrantRequestObsoletedL( + MXIMPIdentity* aGrantRequestor ) + { + TRACE(_L("CProtocolPresenceAuthorizationDataHostImp::HandlePresenceGrantRequestObsoletedL") ); + return iHost.AddNewOperationL( NPresenceOps::EPrHandlePresenceGrantRequestObsoleted, aGrantRequestor ); + } + +// --------------------------------------------------------------------------- +// CProtocolPresenceAuthorizationDataHostImp::PresenceGrantRequestDataSubscriptionState() +// --------------------------------------------------------------------------- +// +const MXIMPDataSubscriptionState& + CProtocolPresenceAuthorizationDataHostImp::PresenceGrantRequestDataSubscriptionState() const + { + TRACE(_L("CProtocolPresenceAuthorizationDataHostImp::PresenceGrantRequestDataSubscriptionState") ); + return iHost.PresenceDataAccess().PresenceDataCache().PresenceGrantRequestDataSubscriptionState(); + } + +// --------------------------------------------------------------------------- +// CProtocolPresenceAuthorizationDataHostImp::SetPresenceGrantRequestDataSubscriptionStateL() +// --------------------------------------------------------------------------- +// +TXIMPRequestId + CProtocolPresenceAuthorizationDataHostImp::SetPresenceGrantRequestDataSubscriptionStateL( + MXIMPDataSubscriptionState* aSubscriptionState, + MXIMPStatus* aStatus ) + { + TRACE(_L("CProtocolPresenceAuthorizationDataHostImp::SetPresenceGrantRequestDataSubscriptionStateL") ); + return iHost.AddNewOperationL( NPresenceOps::EPrSetPresenceGrantRequestDataSubscriptionState, + aSubscriptionState, aStatus ); + } + +// --------------------------------------------------------------------------- +// CProtocolPresenceAuthorizationDataHostImp::HandlePresenceBlockListL() +// --------------------------------------------------------------------------- +// +TXIMPRequestId CProtocolPresenceAuthorizationDataHostImp::HandlePresenceBlockListL( + MXIMPObjectCollection* aBlockList ) + { + TRACE(_L("CProtocolPresenceAuthorizationDataHostImp::HandlePresenceBlockListL") ); + return iHost.AddNewOperationL( NPresenceOps::EPrHandlePresenceBlockList, aBlockList ); + } + +// --------------------------------------------------------------------------- +// CProtocolPresenceAuthorizationDataHostImp::HandlePresenceBlockedL() +// --------------------------------------------------------------------------- +// +TXIMPRequestId CProtocolPresenceAuthorizationDataHostImp::HandlePresenceBlockedL( + MPresenceBlockInfo* aBlockInfo ) + { + TRACE(_L("CProtocolPresenceAuthorizationDataHostImp::HandlePresenceBlockedL") ); + return iHost.AddNewOperationL( NPresenceOps::EPrHandlePresenceBlocked, aBlockInfo ); + } +// --------------------------------------------------------------------------- +// CProtocolPresenceAuthorizationDataHostImp::HandlePresenceBlockCanceledL() +// --------------------------------------------------------------------------- +// +TXIMPRequestId CProtocolPresenceAuthorizationDataHostImp::HandlePresenceBlockCanceledL( + MXIMPIdentity* aBlockedIdentity ) + { + TRACE(_L("CProtocolPresenceAuthorizationDataHostImp::HandlePresenceBlockCanceledL") ); + return iHost.AddNewOperationL( NPresenceOps::EPrHandlePresenceBlockCanceled, aBlockedIdentity ); + } + +// --------------------------------------------------------------------------- +// CProtocolPresenceAuthorizationDataHostImp::PresenceBlockDataSubscriptionState() +// --------------------------------------------------------------------------- +// +const MXIMPDataSubscriptionState& + CProtocolPresenceAuthorizationDataHostImp::PresenceBlockDataSubscriptionState() const + { + TRACE(_L("CProtocolPresenceAuthorizationDataHostImp::PresenceBlockDataSubscriptionState") ); + return iHost.PresenceDataAccess().PresenceDataCache().PresenceBlockDataSubscriptionState(); + } + +// --------------------------------------------------------------------------- +// CProtocolPresenceAuthorizationDataHostImp::SetPresenceBlockDataSubscriptionStateL() +// --------------------------------------------------------------------------- +// +TXIMPRequestId CProtocolPresenceAuthorizationDataHostImp::SetPresenceBlockDataSubscriptionStateL( + MXIMPDataSubscriptionState* aSubscriptionState, + MXIMPStatus* aStatus ) + { + TRACE(_L("CProtocolPresenceAuthorizationDataHostImp::SetPresenceBlockDataSubscriptionStateL") ); + return iHost.AddNewOperationL( NPresenceOps::EPrSetPresenceBlockDataSubscriptionState, + aSubscriptionState, aStatus ); + } + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresenceprocessor/protocolpresenceauthorizationdatahostimp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresenceprocessor/protocolpresenceauthorizationdatahostimp.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,108 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation for managing cached authorization information. +* +*/ + +#ifndef CPROTOCOLPRESENCEAUTHORIZATIONDATAHOSTIMP +#define CPROTOCOLPRESENCEAUTHORIZATIONDATAHOSTIMP + +#include + +#include "ximpapiobjbase.h" +#include "presenceapiobjbase.h" +#include "ximpitemparent.h" +#include "presencetypehelpers.h" +#include "ximpoperationdefs.h" + +class MXIMPHost; + +/** + * Implementation for managing cached authorization information + * + * @since S60 v3.2 + */ +class CProtocolPresenceAuthorizationDataHostImp : public CXIMPApiObjBase, + public MProtocolPresenceAuthorizationDataHost + { +public: // Definitions + + /** The class ID. */ + enum { KClassId = PRIMP_CLSID_CPROTOCOLPRESENCEAUTHORIZATIONDATAHOST }; + +public: // Construction and destruction + + /** + * Construction + */ + IMPORT_C static CProtocolPresenceAuthorizationDataHostImp* NewL( MXIMPHost& aHost ); + + /** + * Destruction + */ + virtual ~CProtocolPresenceAuthorizationDataHostImp(); + +private: + + CProtocolPresenceAuthorizationDataHostImp( MXIMPHost& aHost ); + void ConstructL(); + +public: // From MXIMPBase + + /** + * Implementation of MXIMPBase interface methods + * @see MXIMPBase + */ + XIMPIMP_DECLARE_IF_BASE_METHODS + +public: //From MProtocolPresenceAuthorizationDataHost + + TXIMPRequestId HandlePresenceGrantRequestListL( + MXIMPObjectCollection* aGrantRequestList ); + TXIMPRequestId HandlePresenceGrantRequestReceivedL( + MPresenceGrantRequestInfo* aGrantRequest ); + TXIMPRequestId HandlePresenceGrantRequestObsoletedL( + MXIMPIdentity* aGrantRequestor ); + const MXIMPDataSubscriptionState& PresenceGrantRequestDataSubscriptionState() const; + TXIMPRequestId SetPresenceGrantRequestDataSubscriptionStateL( + MXIMPDataSubscriptionState* aSubscriptionState, + MXIMPStatus* aStatus ); + + // Handling presence blocking + + TXIMPRequestId HandlePresenceBlockListL( + MXIMPObjectCollection* aBlockList ); + TXIMPRequestId HandlePresenceBlockedL( + MPresenceBlockInfo* aBlockInfo ); + TXIMPRequestId HandlePresenceBlockCanceledL( + MXIMPIdentity* aBlockedIdentity ); + const MXIMPDataSubscriptionState& PresenceBlockDataSubscriptionState() const; + TXIMPRequestId SetPresenceBlockDataSubscriptionStateL( + MXIMPDataSubscriptionState* aSubscriptionState, + MXIMPStatus* aStatus ); + +private: // Data + + /** + * Access to host. + */ + MXIMPHost& iHost; + }; + + +/* ======================================================================== */ + + + +#endif // CPROTOCOLPRESENCEAUTHORIZATIONDATAHOSTIMP diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresenceprocessor/protocolpresencedatahostimp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresenceprocessor/protocolpresencedatahostimp.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,219 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Presence connection host + * +*/ + +//#include +//#include +#include +#include +#include +#include +#include +#include + +#include "ximpapiobjbase.h" +#include "presenceapiobjbase.h" +//#include "ximpstatusimp.h" +//#include "ximpoperationbase.h" + +#include "protocolpresencedatahostimp.h" +#include "presenceobjectfactoryimp.h" +#include "presencedatacacheimp.h" +//#include "ximpglobals.h" +/*#include "ximppluginfactory.h" +#include "ximpeventmanager.h" +#include "ximphoststates.h" +#include "ximpcontextstateeventimp.h" +#include "ximpobjectfactoryimp.h" +#include "ximppanics.h" +#include "ximppsccontextimp.h"*/ +#include "presencedatacacheimp.h" +/*#include "ximpserviceinfoimp.h" +#include "ximpoperationbase.h" +#include "ximpoperationfactory.h" +#include "ximpobjecthelpers.h" +#include "ximpoperationdefs.h" +#include "ximpcontexteventqueue.h" +#include "ximphostmanager.h" +#include "ximpidentityimp.h" +#include "ximprestrictedobjectcollectionimp.h" +#include "ximprequestcompleteeventimp.h" +*/ +#include "protocolpresenceauthorizationdatahostimp.h" +#include "protocolpresencepublishingdatahostimp.h" +#include "protocolpresencewatchingdatahostimp.h" +#include "protocolpresentitygroupsdatahostimp.h" +#include "ximpprotocolrequestcompleteeventimp.h" + +#include "ximpdlluids.hrh" + +// ======== LOCAL FUNCTIONS ======== + + + +// ======== MEMBER FUNCTIONS ======== + + +// This should be variated. Branding variation can be one +// possibility. One is to leave adaptation deside how soon +// cleanup will be done. +// Now 5 sec used for testing purposes. Better value could be +// some minutes. + +// --------------------------------------------------------------------------- +// CProtocolPresenceDataHostImp::CProtocolPresenceDataHostImp() +// --------------------------------------------------------------------------- +// +CProtocolPresenceDataHostImp::CProtocolPresenceDataHostImp( MXIMPHost& aHost ) +:iHost( aHost ) + { + } + + +// --------------------------------------------------------------------------- +// CProtocolPresenceDataHostImp::ConstructL() +// --------------------------------------------------------------------------- +// +void CProtocolPresenceDataHostImp::ConstructL() + { + iPresenceDataCache = CPresenceDataCache::NewL( iHost ); + iPresenceObjFactory = CPresenceObjectFactoryImp::NewL(); + iAuthDataHost = CProtocolPresenceAuthorizationDataHostImp::NewL( iHost ); + iPublishingDataHost = CProtocolPresencePublishingDataHostImp::NewL( iHost ); + iWatchingDataHost = CProtocolPresenceWatchingDataHostImp::NewL( iHost ); + iGroupsDataHost = CProtocolPresentityGroupsDataHostImp::NewL( iHost ); + } + + +// --------------------------------------------------------------------------- +// CProtocolPresenceDataHostImp::NewLC() +// --------------------------------------------------------------------------- +// +EXPORT_C CProtocolPresenceDataHostImp* CProtocolPresenceDataHostImp::NewLC( MXIMPHost& aHost ) + { + CProtocolPresenceDataHostImp* self = new( ELeave ) CProtocolPresenceDataHostImp( aHost ); + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + +// --------------------------------------------------------------------------- +// CProtocolPresenceDataHostImp::NewL() +// --------------------------------------------------------------------------- +// +EXPORT_C CProtocolPresenceDataHostImp* CProtocolPresenceDataHostImp::NewL( MXIMPHost& aHost ) + { + CProtocolPresenceDataHostImp* self = new( ELeave ) CProtocolPresenceDataHostImp( aHost ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } +// --------------------------------------------------------------------------- +// CProtocolPresenceDataHostImp::~CProtocolPresenceDataHostImp() +// --------------------------------------------------------------------------- +// +CProtocolPresenceDataHostImp::~CProtocolPresenceDataHostImp() + { + delete iPresenceDataCache; + delete iPresenceObjFactory; + delete iAuthDataHost; + delete iPublishingDataHost; + delete iWatchingDataHost; + delete iGroupsDataHost; + + } + +// --------------------------------------------------------------------------- +// Implement supported interface access. +// --------------------------------------------------------------------------- +// +XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CProtocolPresenceDataHostImp, MProtocolPresenceDataHost ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() +XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CProtocolPresenceDataHostImp, MProtocolPresenceDataHost ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + + + +// --------------------------------------------------------------------------- +// CProtocolPresenceDataHostImp::PresenceObjectFactory() +// --------------------------------------------------------------------------- +// +MPresenceObjectFactory& CProtocolPresenceDataHostImp::PresenceObjectFactory() + { + return *iPresenceObjFactory; + } + +// --------------------------------------------------------------------------- +// CProtocolPresenceDataHostImp::AuthorizationDataHost() +// --------------------------------------------------------------------------- +// +MProtocolPresenceAuthorizationDataHost& CProtocolPresenceDataHostImp::AuthorizationDataHost() + { + return *iAuthDataHost; + } + +// --------------------------------------------------------------------------- +// CProtocolPresenceDataHostImp::PublishingDataHost() +// --------------------------------------------------------------------------- +// +MProtocolPresencePublishingDataHost& CProtocolPresenceDataHostImp::PublishingDataHost() + { + return *iPublishingDataHost; + } + +// --------------------------------------------------------------------------- +// CProtocolPresenceDataHostImp::WatchingDataHost() +// --------------------------------------------------------------------------- +// +MProtocolPresenceWatchingDataHost& CProtocolPresenceDataHostImp::WatchingDataHost() + { + return *iWatchingDataHost; + } + +// --------------------------------------------------------------------------- +// CProtocolPresenceDataHostImp::GroupsDataHost() +// --------------------------------------------------------------------------- +// +MProtocolPresentityGroupsDataHost& CProtocolPresenceDataHostImp::GroupsDataHost() + { + return *iGroupsDataHost; + } + + +EXPORT_C CPresenceDataCache& CProtocolPresenceDataHostImp::PresenceDataCache() + { + return *iPresenceDataCache; + } +EXPORT_C CProtocolPresenceAuthorizationDataHostImp& CProtocolPresenceDataHostImp::AuthorizationDataAccess() + { + return *iAuthDataHost; + } +EXPORT_C CProtocolPresencePublishingDataHostImp& CProtocolPresenceDataHostImp::PublishingDataAccess() + { + return *iPublishingDataHost; + } +EXPORT_C CProtocolPresenceWatchingDataHostImp& CProtocolPresenceDataHostImp::WatchingDataAccess() + { + return *iWatchingDataHost; + } +EXPORT_C CProtocolPresentityGroupsDataHostImp& CProtocolPresenceDataHostImp::GroupsDataAccess() + { + return *iGroupsDataHost; + } + +// End of file + diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresenceprocessor/protocolpresencedatahostimp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresenceprocessor/protocolpresencedatahostimp.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,176 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Presence connection host + * +*/ + +#ifndef CPROTOCOLPRESENCEDATAHOSTIMP_H +#define CPROTOCOLPRESENCEDATAHOSTIMP_H + +//#include +//#include +//#include +#include + +#include "ximpapiobjbase.h" +#include "presenceapiobjbase.h" +#include "ximpitemparent.h" +//#include "ximphost.h" +#include "ximpoperationdefs.h" +#include "ximprequestidbuilder.h" + + +class MXIMPHost; +class MPresenceObjectFactory; +class CPresenceObjectFactoryImp; + +//class CXIMPPscContext; +class MPresenceDataCache; +class CPresenceDataCache; +/*class CXIMPContextStateEventImp; +class CPeriodic; +class MXIMPProtocolConnection;*/ +class CProtocolPresenceAuthorizationDataHostImp; +class MProtocolPresenceAuthorizationDataHost; +class CProtocolPresencePublishingDataHostImp; +class MProtocolPresencePublishingDataHost; +class CProtocolPresenceWatchingDataHostImp; +class MProtocolPresenceWatchingDataHost; +class CProtocolPresentityGroupsDataHostImp; +class MProtocolPresentityGroupsDataHost; +//class CXIMPRestrictedCollectionImp; +//class CXIMPProtocolRequestCompleteEventImp; + + + +/** + * Presence connection host. + * + * @lib ximpprocessor.lib + * @since S60 v3.2 + */ +class CProtocolPresenceDataHostImp : public CXIMPApiObjBase, + public MProtocolPresenceDataHost + + { +public: + /** The class ID. */ + enum { KClassId = PRIMP_CLSID_CPROTOCOLPRESENCEDATAHOSTIMP }; + +public: + + IMPORT_C static CProtocolPresenceDataHostImp* NewL( MXIMPHost& aHost ); + + IMPORT_C static CProtocolPresenceDataHostImp* NewLC( MXIMPHost& aHost ); + + virtual ~CProtocolPresenceDataHostImp(); + +private: + + CProtocolPresenceDataHostImp( MXIMPHost& aHost ); + void ConstructL(); + +public: // From MXIMPBase + + /** + * Implementation of MXIMPBase interface methods + * @see MXIMPBase + */ + XIMPIMP_DECLARE_IF_BASE_METHODS + + +public: // MProtocolPresenceDataHost + + MPresenceObjectFactory& PresenceObjectFactory(); + + MProtocolPresenceAuthorizationDataHost& AuthorizationDataHost(); + + MProtocolPresencePublishingDataHost& PublishingDataHost(); + + MProtocolPresenceWatchingDataHost& WatchingDataHost(); + + MProtocolPresentityGroupsDataHost& GroupsDataHost(); + +public: + + IMPORT_C CPresenceDataCache& PresenceDataCache(); + IMPORT_C CProtocolPresenceAuthorizationDataHostImp& AuthorizationDataAccess(); + IMPORT_C CProtocolPresencePublishingDataHostImp& PublishingDataAccess(); + IMPORT_C CProtocolPresenceWatchingDataHostImp& WatchingDataAccess(); + IMPORT_C CProtocolPresentityGroupsDataHostImp& GroupsDataAccess(); + +// MXIMPHost + +/* MXIMPProtocolConnection& GetConnection() const; + + void AddEventL( CXIMPApiEventBase& aEvent, MXIMPPscContext* aContext ); + void ActivateEventL( CXIMPApiEventBase& aEvent, MXIMPPscContext* aContext ); + + void UnregisterSession( CXIMPPscContext* aContext ); + + void FakeCompleteRequest( TXIMPRequestId aReqId, TInt aResult ); + void HandleAdaptationRequestCompleted( TXIMPRequestId aReqId, TInt aResult ); + void HandleSessionMgmtRequestCompleted( TXIMPRequestId aReqId, TInt aResult ); + void HandleInternalRequestCompleted( TXIMPRequestId aReqId, TInt aResult ); + + CPresenceDataCache& DataAccess(); + CProtocolPresenceAuthorizationDataHostImp& AuthorizationDataAccess(); + CProtocolPresencePublishingDataHostImp& PublishingDataAccess(); + CProtocolPresenceWatchingDataHostImp& WatchingDataAccess(); + CProtocolPresentityGroupsDataHostImp& GroupsDataAccess(); + + void AddNewOperationL( CXIMPOperationBase& aOperation ); + TXIMPRequestId AddNewOperationL( CXIMPOperationBase* aOperation ); + + void ForcedTeardownL(); + + void StartCleanerTimer(); + + TXIMPRequestId AddNewOperationL( + TInt aOperation, MXIMPBase* aParam, MXIMPBase* aParam2 = NULL ); + TXIMPRequestId AddNewOperationL( + TInt aOperation, CXIMPRestrictedObjectCollectionImp* aParams ); + +public: // New functions + + void AddEventL( CXIMPApiEventBase& aEvent, CXIMPPscContext* aContext ); + void ActivateEventL( CXIMPApiEventBase& aEvent, CXIMPPscContext* aContext ); + + + void RegisterSessionL( CXIMPPscContext* aContext );*/ + +private: // data + + MXIMPHost& iHost; + /** + * Data cache + */ + CPresenceDataCache* iPresenceDataCache; + + CPresenceObjectFactoryImp* iPresenceObjFactory; + + /** + * Data hosts + */ + CProtocolPresenceAuthorizationDataHostImp* iAuthDataHost; + CProtocolPresencePublishingDataHostImp* iPublishingDataHost; + CProtocolPresenceWatchingDataHostImp* iWatchingDataHost; + CProtocolPresentityGroupsDataHostImp* iGroupsDataHost; + + + }; + + +#endif // CPROTOCOLPRESENCEDATAHOSTIMP_H + diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresenceprocessor/protocolpresencepublishingdatahostimp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresenceprocessor/protocolpresencepublishingdatahostimp.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,175 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation for managing cached presence publish information. + * +*/ + + +#include +#include +#include +#include + +#include "protocolpresencedatahostimp.h" +#include "protocolpresencepublishingdatahostimp.h" + +#include "ximpoperationbase.h" +#include "ximpoperationfactory.h" +#include "ximprestrictedobjectcollectionimp.h" +#include "ximpglobals.h" +#include "ximphost.h" +#include "presencedatacacheimp.h" +#include "presenceoperationdefs.h" +#include "ximptrace.h" + +// ======== LOCAL FUNCTIONS ======== + + +// ======== MEMBER FUNCTIONS ======== + + +// --------------------------------------------------------------------------- +// CProtocolPresencePublishingDataHostImp::NewL() +// --------------------------------------------------------------------------- +// +EXPORT_C CProtocolPresencePublishingDataHostImp* + CProtocolPresencePublishingDataHostImp::NewL( MXIMPHost& aHost ) + { + CProtocolPresencePublishingDataHostImp* self = + new( ELeave ) CProtocolPresencePublishingDataHostImp( aHost ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + + +// --------------------------------------------------------------------------- +// Implement supported interface access. +// --------------------------------------------------------------------------- +// +XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CProtocolPresencePublishingDataHostImp, + MProtocolPresencePublishingDataHost ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + +XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CProtocolPresencePublishingDataHostImp, + MProtocolPresencePublishingDataHost ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + + +// --------------------------------------------------------------------------- +// CProtocolPresencePublishingDataHostImp::~CProtocolPresencePublishingDataHostImp() +// --------------------------------------------------------------------------- +// +CProtocolPresencePublishingDataHostImp::~CProtocolPresencePublishingDataHostImp() + { + } + + +// --------------------------------------------------------------------------- +// CProtocolPresencePublishingDataHostImp::CProtocolPresencePublishingDataHostImp() +// --------------------------------------------------------------------------- +// +CProtocolPresencePublishingDataHostImp::CProtocolPresencePublishingDataHostImp( + MXIMPHost& aHost ) + : iHost( aHost ) + { + } + +// --------------------------------------------------------------------------- +// CProtocolPresencePublishingDataHostImp::ConstructL() +// --------------------------------------------------------------------------- +// +void CProtocolPresencePublishingDataHostImp::ConstructL() + { + } + +// --------------------------------------------------------------------------- +// CProtocolPresencePublishingDataHostImp::HandleSubscribedOwnPresenceL() +// --------------------------------------------------------------------------- +// +TXIMPRequestId + CProtocolPresencePublishingDataHostImp::HandleSubscribedOwnPresenceL( + MPresenceInfo* aPresenceInfo ) + { + TRACE(_L("CProtocolPresencePublishingDataHostImp::HandleSubscribedOwnPresenceL") ); + return iHost.AddNewOperationL( NPresenceOps::EPrHandleOwnPresence, + aPresenceInfo ); + } + + +// --------------------------------------------------------------------------- +// CProtocolPresencePublishingDataHostImp::OwnPresenceDataSubscriptionState() +// --------------------------------------------------------------------------- +// +const MXIMPDataSubscriptionState& + CProtocolPresencePublishingDataHostImp::OwnPresenceDataSubscriptionState() const + { + TRACE(_L("CProtocolPresencePublishingDataHostImp::OwnPresenceDataSubscriptionState") ); + return iHost.PresenceDataAccess().PresenceDataCache().OwnPresenceDataSubscriptionState(); + } + +// --------------------------------------------------------------------------- +// CProtocolPresencePublishingDataHostImp::SetOwnPresenceDataSubscriptionStateL() +// --------------------------------------------------------------------------- +// +TXIMPRequestId CProtocolPresencePublishingDataHostImp::SetOwnPresenceDataSubscriptionStateL( + MXIMPDataSubscriptionState* aSubscriptionState, + MXIMPStatus* aStatus ) + { + TRACE(_L("CProtocolPresencePublishingDataHostImp::SetOwnPresenceDataSubscriptionStateL") ); + return iHost.AddNewOperationL( NPresenceOps::EPrSetOwnPresenceDataSubscriptionState, + aSubscriptionState, aStatus ); + } + +// --------------------------------------------------------------------------- +// CProtocolPresencePublishingDataHostImp::HandlePresenceWatcherListL() +// --------------------------------------------------------------------------- +// +TXIMPRequestId + CProtocolPresencePublishingDataHostImp::HandlePresenceWatcherListL( + MXIMPObjectCollection* aWatcherList ) + { + TRACE(_L("CProtocolPresencePublishingDataHostImp::HandlePresenceWatcherListL") ); + return iHost.AddNewOperationL( NPresenceOps::EPrHandlePresenceWatcherList, + aWatcherList ); + } + +// --------------------------------------------------------------------------- +// CProtocolPresencePublishingDataHostImp::HandlePresenceWatcherListL() +// --------------------------------------------------------------------------- +// +const MXIMPDataSubscriptionState& + CProtocolPresencePublishingDataHostImp::PresenceWatcherListDataSubscriptionState() const + { + TRACE(_L("CProtocolPresencePublishingDataHostImp::PresenceWatcherListDataSubscriptionState") ); + return iHost.PresenceDataAccess().PresenceDataCache().PresenceWatcherListDataSubscriptionState(); + } + +// --------------------------------------------------------------------------- +// CProtocolPresencePublishingDataHostImp::HandlePresenceWatcherListL() +// --------------------------------------------------------------------------- +// +TXIMPRequestId + CProtocolPresencePublishingDataHostImp::SetPresenceWatcherListDataSubscriptionStateL( + MXIMPDataSubscriptionState* aSubscriptionState, + MXIMPStatus* aStatus ) + { + TRACE(_L("CProtocolPresencePublishingDataHostImp::SetPresenceWatcherListDataSubscriptionStateL") ); + return iHost.AddNewOperationL( NPresenceOps::EPrSetPresenceWatcherListDataSubscriptionState, + aSubscriptionState, aStatus ); + } + +// End of file + diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresenceprocessor/protocolpresencepublishingdatahostimp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresenceprocessor/protocolpresencepublishingdatahostimp.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,99 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation for managing cached presence publish information. +* +*/ + +#ifndef CPROTOCOLPRESENCEPUBLISHINGDATAHOSTIMP_H +#define CPROTOCOLPRESENCEPUBLISHINGDATAHOSTIMP_H + +#include + +#include "ximpapiobjbase.h" +#include "presenceapiobjbase.h" +#include "ximpitemparent.h" +#include "presencetypehelpers.h" +#include "ximpoperationdefs.h" + +class MXIMPHost; +class MPresenceInfo; +class MXIMPObjectCollection; + + +/** + * Implementation for managing cached presence publish information. + * + * @since S60 v3.2 + */ +class CProtocolPresencePublishingDataHostImp : public CXIMPApiObjBase, + public MProtocolPresencePublishingDataHost + { +public: // Definitions + + /** The class ID. */ + enum { KClassId = PRIMP_CLSID_CPROTOCOLPRESENCEPUBLISHINGDATAHOST }; + +public: // Construction and destruction + + /** + * Construction + */ + IMPORT_C static CProtocolPresencePublishingDataHostImp* NewL( MXIMPHost& aHost ); + + /** + * Destruction + */ + virtual ~CProtocolPresencePublishingDataHostImp(); + +private: + + CProtocolPresencePublishingDataHostImp( MXIMPHost& aHost ); + void ConstructL(); + +public: // From MXIMPBase + + /** + * Implementation of MXIMPBase interface methods + * @see MXIMPBase + */ + XIMPIMP_DECLARE_IF_BASE_METHODS + +public: //From MProtocolPresencePublishingDataHost + + // Handling user own presence information + TXIMPRequestId HandleSubscribedOwnPresenceL( MPresenceInfo* aPresenceInfo ); + const MXIMPDataSubscriptionState& OwnPresenceDataSubscriptionState() const; + TXIMPRequestId SetOwnPresenceDataSubscriptionStateL( + MXIMPDataSubscriptionState* aSubscriptionState, + MXIMPStatus* aStatus ); + + + // Handling presence watcher list content + TXIMPRequestId HandlePresenceWatcherListL( MXIMPObjectCollection* aWatcherList ); + const MXIMPDataSubscriptionState& PresenceWatcherListDataSubscriptionState() const; + TXIMPRequestId SetPresenceWatcherListDataSubscriptionStateL( + MXIMPDataSubscriptionState* aSubscriptionState, + MXIMPStatus* aStatus ); + +private: // Data + + /** + * Access to host. + */ + MXIMPHost& iHost; + + }; + + +#endif // CPROTOCOLPRESENCEPUBLISHINGDATAHOSTIMP_H diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresenceprocessor/protocolpresencewatchingdatahostimp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresenceprocessor/protocolpresencewatchingdatahostimp.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,148 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation for managing cached subscribed presence information. + * +*/ + + +#include +#include +#include +#include +#include + +#include "protocolpresencedatahostimp.h" +#include "protocolpresencewatchingdatahostimp.h" + +#include "ximpoperationbase.h" +#include "ximpoperationfactory.h" +#include "ximprestrictedobjectcollectionimp.h" +#include "ximpglobals.h" +#include "ximphost.h" +#include "presencedatacacheimp.h" +#include "presenceoperationdefs.h" +#include "ximptrace.h" + +// ======== LOCAL FUNCTIONS ======== + + +// ======== MEMBER FUNCTIONS ======== + + +// --------------------------------------------------------------------------- +// CProtocolPresenceWatchingDataHostImp::NewL() +// --------------------------------------------------------------------------- +// +EXPORT_C CProtocolPresenceWatchingDataHostImp* + CProtocolPresenceWatchingDataHostImp::NewL( MXIMPHost& aHost ) + { + CProtocolPresenceWatchingDataHostImp* self = + new( ELeave ) CProtocolPresenceWatchingDataHostImp( aHost ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// Implement supported interface access. +// --------------------------------------------------------------------------- +// +XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CProtocolPresenceWatchingDataHostImp, + MProtocolPresenceWatchingDataHost ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + +XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CProtocolPresenceWatchingDataHostImp, + MProtocolPresenceWatchingDataHost ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + +// --------------------------------------------------------------------------- +// CProtocolPresenceWatchingDataHostImp::~CProtocolPresenceWatchingDataHostImp() +// --------------------------------------------------------------------------- +// +CProtocolPresenceWatchingDataHostImp::~CProtocolPresenceWatchingDataHostImp() + { + } + + +// --------------------------------------------------------------------------- +// CProtocolPresenceWatchingDataHostImp::CProtocolPresenceWatchingDataHostImp() +// --------------------------------------------------------------------------- +// +CProtocolPresenceWatchingDataHostImp::CProtocolPresenceWatchingDataHostImp( + MXIMPHost& aHost ) + : iHost( aHost ) + { + } + +// --------------------------------------------------------------------------- +// CProtocolPresenceWatchingDataHostImp::ConstructL() +// --------------------------------------------------------------------------- +// +void CProtocolPresenceWatchingDataHostImp::ConstructL() + { + } + + +// --------------------------------------------------------------------------- +// CProtocolPresenceWatchingDataHostImp::HandleSubscribedPresentityPresenceL() +// --------------------------------------------------------------------------- +// +TXIMPRequestId + CProtocolPresenceWatchingDataHostImp::HandleSubscribedPresentityPresenceL( + MXIMPIdentity* aPresentityId, + MPresenceInfo* aPresenceInfo ) + { + TRACE(_L("CProtocolPresenceWatchingDataHostImp::HandleSubscribedPresentityPresenceL") ); + return iHost.AddNewOperationL( NPresenceOps::EPrHandlePresentityPresence, + aPresentityId, aPresenceInfo ); + } + +// --------------------------------------------------------------------------- +// CProtocolPresenceWatchingDataHostImp::PresentityPresenceDataSubscriptionState() +// --------------------------------------------------------------------------- +// +const MXIMPDataSubscriptionState& + CProtocolPresenceWatchingDataHostImp::PresentityPresenceDataSubscriptionState( + const MXIMPIdentity& aPresentityId ) const + { + TRACE(_L("CProtocolPresenceWatchingDataHostImp::PresentityPresenceDataSubscriptionState") ); + return iHost.PresenceDataAccess().PresenceDataCache().PresentityPresenceDataSubscriptionState( aPresentityId ); + } +// --------------------------------------------------------------------------- +// CProtocolPresenceWatchingDataHostImp::SetPresentityPresenceDataSubscriptionStateL() +// --------------------------------------------------------------------------- +// +TXIMPRequestId CProtocolPresenceWatchingDataHostImp::SetPresentityPresenceDataSubscriptionStateL( + MXIMPIdentity* aPresentityId, + MXIMPDataSubscriptionState* aSubscriptionState, + MXIMPStatus* aStatus ) + { + TRACE(_L("CProtocolPresenceWatchingDataHostImp::SetPresentityPresenceDataSubscriptionStateL") ); + CXIMPRestrictedObjectCollectionImp* collection = CXIMPRestrictedObjectCollectionImp::NewLC( ETrue ); + collection->AddOrReplaceTypeL( aPresentityId ); + collection->AddOrReplaceTypeL( aSubscriptionState ); + collection->AddOrReplaceTypeL( aStatus ); + TXIMPRequestId reqId = + iHost.AddNewOperationL( NPresenceOps::EPrSetPresentityPresenceDataSubscriptionState, + collection ); + CleanupStack::Pop( collection ); + return reqId; + } + + + + +// End of file + diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresenceprocessor/protocolpresencewatchingdatahostimp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresenceprocessor/protocolpresencewatchingdatahostimp.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,92 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation for managing cached subscribed presence information. +* +*/ + +#ifndef CPROTOCOLPRESENCEWATCHINGDATAHOSTIMP_H +#define CPROTOCOLPRESENCEWATCHINGDATAHOSTIMP_H + +#include + +#include "ximpapiobjbase.h" +#include "presenceapiobjbase.h" +#include "ximpitemparent.h" +#include "presencetypehelpers.h" +#include "ximpoperationdefs.h" + +class MXIMPHost; +class MPresenceInfo; +class MXIMPObjectCollection; + +/** + * Implementation for managing cached subscribed presence information. + * + * @since S60 v3.2 + */ +class CProtocolPresenceWatchingDataHostImp : public CXIMPApiObjBase, + public MProtocolPresenceWatchingDataHost + { +public: // Definitions + + /** The class ID. */ + enum { KClassId = PRIMP_CLSID_CPROTOCOLPRESENCEWATCHINGDATAHOST }; + +public: // Construction and destruction + + /** + * Construction + */ + IMPORT_C static CProtocolPresenceWatchingDataHostImp* NewL( MXIMPHost& aHost ); + + /** + * Destruction + */ + virtual ~CProtocolPresenceWatchingDataHostImp(); + +private: + + CProtocolPresenceWatchingDataHostImp( MXIMPHost& aHost ); + void ConstructL(); + +public: // From MXIMPBase + + /** + * Implementation of MXIMPBase interface methods + * @see MXIMPBase + */ + XIMPIMP_DECLARE_IF_BASE_METHODS + +public: //From MProtocolPresenceWatchingDataHost + + TXIMPRequestId HandleSubscribedPresentityPresenceL( + MXIMPIdentity* aPresentityId, + MPresenceInfo* aPresenceInfo ); + const MXIMPDataSubscriptionState& PresentityPresenceDataSubscriptionState( + const MXIMPIdentity& aPresentityId ) const; + TXIMPRequestId SetPresentityPresenceDataSubscriptionStateL( + MXIMPIdentity* aPresentityId, + MXIMPDataSubscriptionState* aSubscriptionState, + MXIMPStatus* aStatus ); +private: // Data + + /** + * Access to host. + */ + MXIMPHost& iHost; + + }; + + +#endif // CPROTOCOLPRESENCEWATCHINGDATAHOSTIMP_H diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresenceprocessor/protocolpresentitygroupsdatahostimp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresenceprocessor/protocolpresentitygroupsdatahostimp.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,248 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation for managing cached presentity group information. + * +*/ + + +#include +#include +#include +#include +#include + +#include "protocolpresencedatahostimp.h" +#include "protocolpresentitygroupsdatahostimp.h" + +#include "presentitygroupmemberinfoimp.h" +#include "ximpoperationbase.h" +#include "ximprestrictedobjectcollectionimp.h" +#include "ximpglobals.h" +#include "ximpoperationfactory.h" +#include "ximphost.h" +#include "presencedatacacheimp.h" +#include "presenceoperationdefs.h" +#include "ximptrace.h" + +// --------------------------------------------------------------------------- +// CProtocolPresentityGroupsDataHostImp::CProtocolPresentityGroupsDataHostImp() +// --------------------------------------------------------------------------- +// +CProtocolPresentityGroupsDataHostImp::CProtocolPresentityGroupsDataHostImp( MXIMPHost& aHost ) +:iHost( aHost ) + { + } + + +// --------------------------------------------------------------------------- +// CProtocolPresentityGroupsDataHostImp::ConstructL() +// --------------------------------------------------------------------------- +// +void CProtocolPresentityGroupsDataHostImp::ConstructL() + { + } + + +// --------------------------------------------------------------------------- +// CProtocolPresentityGroupsDataHostImp::NewL() +// --------------------------------------------------------------------------- +// +EXPORT_C CProtocolPresentityGroupsDataHostImp* CProtocolPresentityGroupsDataHostImp::NewL( MXIMPHost& aHost ) + { + CProtocolPresentityGroupsDataHostImp* self = new( ELeave ) CProtocolPresentityGroupsDataHostImp( aHost ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// Implement supported interface access. +// --------------------------------------------------------------------------- +// +XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CProtocolPresentityGroupsDataHostImp, + MProtocolPresentityGroupsDataHost ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + + +XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CProtocolPresentityGroupsDataHostImp, + MProtocolPresentityGroupsDataHost ) +XIMPIMP_IF_BASE_GET_INTERFACE_END() + +// --------------------------------------------------------------------------- +// CProtocolPresentityGroupsDataHostImp::~CProtocolPresentityGroupsDataHostImp() +// --------------------------------------------------------------------------- +// +CProtocolPresentityGroupsDataHostImp::~CProtocolPresentityGroupsDataHostImp() + { + } + +// --------------------------------------------------------------------------- +// CProtocolPresentityGroupsDataHostImp::HandlePresentityGroupListL +// --------------------------------------------------------------------------- +// +TXIMPRequestId CProtocolPresentityGroupsDataHostImp::HandlePresentityGroupListL( + MXIMPObjectCollection* aGroupList ) + { + TRACE(_L("CProtocolPresentityGroupsDataHostImp::HandlePresentityGroupListL") ); + return iHost.AddNewOperationL( NPresenceOps::EPrHandlePresentityGroupList, aGroupList ); + } + +// --------------------------------------------------------------------------- +// CProtocolPresentityGroupsDataHostImp::HandlePresentityGroupCreatedL +// --------------------------------------------------------------------------- +// +TXIMPRequestId CProtocolPresentityGroupsDataHostImp::HandlePresentityGroupCreatedL( + MPresentityGroupInfo* aGroupInfo ) + { + TRACE(_L("CProtocolPresentityGroupsDataHostImp::HandlePresentityGroupCreatedL") ); + return iHost.AddNewOperationL( NPresenceOps::EPrHandlePresentityGroupCreated, aGroupInfo ); + } + +// --------------------------------------------------------------------------- +// CProtocolPresentityGroupsDataHostImp::HandlePresentityGroupDeletedL +// --------------------------------------------------------------------------- +// +TXIMPRequestId CProtocolPresentityGroupsDataHostImp::HandlePresentityGroupDeletedL( + MXIMPIdentity* aGroupId ) + { + TRACE(_L("CProtocolPresentityGroupsDataHostImp::HandlePresentityGroupDeletedL") ); + return iHost.AddNewOperationL( NPresenceOps::EPrHandlePresentityGroupDeleted, aGroupId ); + } + +// --------------------------------------------------------------------------- +// CProtocolPresentityGroupsDataHostImp::HandlePresentityGroupDisplayNameUpdatedL +// --------------------------------------------------------------------------- +// +TXIMPRequestId CProtocolPresentityGroupsDataHostImp::HandlePresentityGroupDisplayNameUpdatedL( + MPresentityGroupInfo* aGroupInfo ) + { + TRACE(_L("CProtocolPresentityGroupsDataHostImp::HandlePresentityGroupDisplayNameUpdatedL") ); + return iHost.AddNewOperationL( NPresenceOps::EPrHandlePresentityGroupDisplayNameUpdated, aGroupInfo ); + } + +// --------------------------------------------------------------------------- +// CProtocolPresentityGroupsDataHostImp::PresentityGroupDataSubscriptionState +// --------------------------------------------------------------------------- +// +const MXIMPDataSubscriptionState& + CProtocolPresentityGroupsDataHostImp::PresentityGroupListDataSubscriptionState() const + { + TRACE(_L("CProtocolPresentityGroupsDataHostImp::PresentityGroupListDataSubscriptionState") ); + return iHost.PresenceDataAccess().PresenceDataCache().PresentityGroupListDataSubscriptionState(); + } + +// --------------------------------------------------------------------------- +// CProtocolPresentityGroupsDataHostImp::SetPresentityGroupDataSubscriptionStateL +// --------------------------------------------------------------------------- +// +TXIMPRequestId CProtocolPresentityGroupsDataHostImp::SetPresentityGroupListDataSubscriptionStateL( + MXIMPDataSubscriptionState* aSubscriptionState, + MXIMPStatus* aStatus ) + { + TRACE(_L("CProtocolPresentityGroupsDataHostImp::SetPresentityGroupListDataSubscriptionStateL") ); + return iHost.AddNewOperationL( NPresenceOps::EPrSetPresentityGroupListDataSubscriptionState, + aSubscriptionState, aStatus ); + } + +// --------------------------------------------------------------------------- +// From MProtocolPresentityGroupsDataHost class. +// CProtocolPresentityGroupsDataHostImp::HandlePresentityGroupContentL +// --------------------------------------------------------------------------- +// +TXIMPRequestId CProtocolPresentityGroupsDataHostImp::HandlePresentityGroupContentL( + MXIMPIdentity* aGroupId, MXIMPObjectCollection* aGroupMembers ) + { + TRACE(_L("CProtocolPresentityGroupsDataHostImp::HandlePresentityGroupContentL") ); + return iHost.AddNewOperationL( NPresenceOps::EPrHandlePresentityGroupContent, aGroupId, aGroupMembers ); + } + +// --------------------------------------------------------------------------- +// From MProtocolPresentityGroupsDataHost class. +// CProtocolPresentityGroupsDataHostImp::HandlePresentityGroupMemberAddedL +// --------------------------------------------------------------------------- +// +TXIMPRequestId CProtocolPresentityGroupsDataHostImp::HandlePresentityGroupMemberAddedL( + MXIMPIdentity* aGroupId, MPresentityGroupMemberInfo* aGroupMember ) + { + TRACE(_L("CProtocolPresentityGroupsDataHostImp::HandlePresentityGroupMemberAddedL") ); + return iHost.AddNewOperationL( NPresenceOps::EPrHandlePresentityGroupMemberAdded, aGroupId, aGroupMember ); + } + +// --------------------------------------------------------------------------- +// From MProtocolPresentityGroupsDataHost class. +// CProtocolPresentityGroupsDataHostImp::HandlePresentityGroupMemberRemovedL +// --------------------------------------------------------------------------- +// +TXIMPRequestId CProtocolPresentityGroupsDataHostImp::HandlePresentityGroupMemberRemovedL( + MXIMPIdentity* aGroupId, MXIMPIdentity* aGroupMemberId ) + { + TRACE(_L("CProtocolPresentityGroupsDataHostImp::HandlePresentityGroupMemberRemovedL") ); + CPresentityGroupMemberInfoImp* infoImp = CPresentityGroupMemberInfoImp::NewLC( + *aGroupMemberId, KNullDesC ); + TXIMPRequestId reqId = iHost.AddNewOperationL( + NPresenceOps::EPrHandlePresentityGroupMemberRemoved, aGroupId, infoImp ); + CleanupStack::Pop( infoImp ); + delete aGroupMemberId; + return reqId; + } + +// --------------------------------------------------------------------------- +// From MProtocolPresentityGroupsDataHost class. +// CProtocolPresentityGroupsDataHostImp::HandlePresentityGroupMemberUpdatedL +// --------------------------------------------------------------------------- +// +TXIMPRequestId CProtocolPresentityGroupsDataHostImp::HandlePresentityGroupMemberDisplayNameUpdatedL( + MXIMPIdentity* aGroupId, MPresentityGroupMemberInfo* aGroupMember ) + { + TRACE(_L("CProtocolPresentityGroupsDataHostImp::HandlePresentityGroupMemberDisplayNameUpdatedL") ); + return iHost.AddNewOperationL( NPresenceOps::EPrHandlePresentityGroupMemberDisplayNameUpdated, aGroupId, aGroupMember ); + } + +// --------------------------------------------------------------------------- +// CProtocolPresentityGroupsDataHostImp::PresentityGroupMemberDataSubscriptionState +// --------------------------------------------------------------------------- +// +const MXIMPDataSubscriptionState& + CProtocolPresentityGroupsDataHostImp::PresentityGroupContentDataSubscriptionState( + const MXIMPIdentity& aGroupId ) const + { + TRACE(_L("CProtocolPresentityGroupsDataHostImp::PresentityGroupContentDataSubscriptionState") ); + return iHost.PresenceDataAccess().PresenceDataCache().PresentityGroupContentDataSubscriptionState( aGroupId ); + } + +// --------------------------------------------------------------------------- +// CProtocolPresentityGroupsDataHostImp::SetPresentityGroupContentDataSubscriptionStateL +// --------------------------------------------------------------------------- +// +TXIMPRequestId + CProtocolPresentityGroupsDataHostImp::SetPresentityGroupContentDataSubscriptionStateL( + MXIMPIdentity* aGroupId, + MXIMPDataSubscriptionState* aSubscriptionState, + MXIMPStatus* aStatus ) + { + TRACE(_L("CProtocolPresentityGroupsDataHostImp::SetPresentityGroupContentDataSubscriptionState") ); + CXIMPRestrictedObjectCollectionImp* collection = CXIMPRestrictedObjectCollectionImp::NewLC( ETrue ); + collection->AddOrReplaceTypeL( aGroupId ); + collection->AddOrReplaceTypeL( aSubscriptionState ); + collection->AddOrReplaceTypeL( aStatus ); + TXIMPRequestId reqId = + iHost.AddNewOperationL( NPresenceOps::EPrSetPresentityGroupContentDataSubscriptionState, + collection ); + CleanupStack::Pop( collection ); + return reqId; + } + + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/presence/srcpresenceprocessor/protocolpresentitygroupsdatahostimp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/presence/srcpresenceprocessor/protocolpresentitygroupsdatahostimp.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,131 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation for managing cached presentity group information. +* +*/ + +#ifndef CPROTOCOLPRESENTITYGROUPSDATAHOSTIMP +#define CPROTOCOLPRESENTITYGROUPSDATAHOSTIMP + +#include + +#include "ximpapiobjbase.h" +#include "presenceapiobjbase.h" +#include "ximpitemparent.h" +#include "presencetypehelpers.h" +#include "ximpoperationdefs.h" + +class MXIMPHost; +class COwnPresenceSubscriptionItem; +class CPresentityPresenceSubscriptionItem; +class CGroupContentSubscriptionItem; +class CWatcherListSubscriptionItem; +class MPresentityGroupInfo; +class CXIMPIdentityImp; +class MXIMPContext; +class CXIMPSubscriptionItemBase; +class MPresenceWatcherInfo; +class MXIMPStatus; +class MPresenceBlockInfo; +class CBlockListSubscriptionItem; + +/** + * Implementation for managing cached presentity group information + * + * @since S60 v3.2 + */ +class CProtocolPresentityGroupsDataHostImp : public CXIMPApiObjBase, + public MProtocolPresentityGroupsDataHost + { +public: // Definitions + + /** The class ID. */ + enum { KClassId = PRIMP_CLSID_CPROTOCOLPRESENTITYGROUPSDATAHOST }; + +public: // Construction and destruction + + /** + * Construction + */ + IMPORT_C static CProtocolPresentityGroupsDataHostImp* NewL( MXIMPHost& aHost ); + + /** + * Destruction + */ + virtual ~CProtocolPresentityGroupsDataHostImp(); + +private: + + CProtocolPresentityGroupsDataHostImp( MXIMPHost& aHost ); + void ConstructL(); + +public: // From MXIMPBase + + /** + * Implementation of MXIMPBase interface methods + * @see MXIMPBase + */ + XIMPIMP_DECLARE_IF_BASE_METHODS + +public: //From MProtocolPresentityGroupsDataHost + + // Handling presentity groups + TXIMPRequestId HandlePresentityGroupListL( + MXIMPObjectCollection* aGroupList ); + TXIMPRequestId HandlePresentityGroupCreatedL( + MPresentityGroupInfo* aGroupInfo ); + TXIMPRequestId HandlePresentityGroupDeletedL( + MXIMPIdentity* aGroupId ); + TXIMPRequestId HandlePresentityGroupDisplayNameUpdatedL( + MPresentityGroupInfo* aGroupInfo ); + const MXIMPDataSubscriptionState& PresentityGroupListDataSubscriptionState() const; + TXIMPRequestId SetPresentityGroupListDataSubscriptionStateL( + MXIMPDataSubscriptionState* aSubscriptionState, + MXIMPStatus* aStatus ); + + // Handling presentity group content + + TXIMPRequestId HandlePresentityGroupContentL( + MXIMPIdentity* aGroupId, + MXIMPObjectCollection* aGroupMembers ); + TXIMPRequestId HandlePresentityGroupMemberAddedL( + MXIMPIdentity* aGroupId, + MPresentityGroupMemberInfo* aGroupMember ); + TXIMPRequestId HandlePresentityGroupMemberRemovedL( + MXIMPIdentity* aGroupId, + MXIMPIdentity* aGroupMemberId ); + TXIMPRequestId HandlePresentityGroupMemberDisplayNameUpdatedL( + MXIMPIdentity* aGroupId, + MPresentityGroupMemberInfo* aGroupMember ); + const MXIMPDataSubscriptionState& PresentityGroupContentDataSubscriptionState( + const MXIMPIdentity& aGroupId ) const; + TXIMPRequestId SetPresentityGroupContentDataSubscriptionStateL( + MXIMPIdentity* aGroupId, + MXIMPDataSubscriptionState* aSubscriptionState, + MXIMPStatus* aStatus ); + +private: // Data + + /** + * Access to host. + */ + MXIMPHost& iHost; + }; + + +/* ======================================================================== */ + + + +#endif // CPROTOCOLPRESENTITYGROUPSDATAHOSTIMP diff -r 000000000000 -r e6b17d312c8b ximpfw/rom/ximpfw.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/rom/ximpfw.iby Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,61 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Image description file for project XIMP Framework +* +*/ + +#ifndef PRESENCEFW_IBY +#define PRESENCEFW_IBY + +#ifdef __PRESENCE_FRAMEWORK + +#include + +// XIMP Framework components +file=ABI_DIR\BUILD_DIR\ximputils.dll SHARED_LIB_DIR\ximputils.dll +file=ABI_DIR\BUILD_DIR\ximpoperations.dll SHARED_LIB_DIR\ximpoperations.dll +file=ABI_DIR\BUILD_DIR\ximpprocessor.dll SHARED_LIB_DIR\ximpprocessor.dll +file=ABI_DIR\BUILD_DIR\ximpsrvclient.dll SHARED_LIB_DIR\ximpsrvclient.dll +file=ABI_DIR\BUILD_DIR\ximpdatamodel.dll SHARED_LIB_DIR\ximpdatamodel.dll +file=ABI_DIR\BUILD_DIR\ximpmanager.dll SHARED_LIB_DIR\ximpmanager.dll + + +// XIMP Framework server +file=ABI_DIR\BUILD_DIR\ximpserver.exe PROGRAMS_DIR\ximpserver.exe +file=ABI_DIR\BUILD_DIR\ximprootserver.exe PROGRAMS_DIR\ximprootserver.exe + +// XIMP ECOM Hook plugin +ECOM_PLUGIN( ximpecomhook.dll, ximpecomhook.rsc ) + +// Presence Plugin components +file=ABI_DIR\BUILD_DIR\presencemanager.dll SHARED_LIB_DIR\presencemanager.dll +file=ABI_DIR\BUILD_DIR\presencedatamodel.dll SHARED_LIB_DIR\presencedatamodel.dll +file=ABI_DIR\BUILD_DIR\presenceoperation.dll SHARED_LIB_DIR\presenceoperation.dll +file=ABI_DIR\BUILD_DIR\presencecacheclient.dll SHARED_LIB_DIR\presencecacheclient.dll + +// Presence Plugin server +file=ABI_DIR\BUILD_DIR\presencecacheserver.exe PROGRAMS_DIR\presencecacheserver.exe + +// Presence Plugin ECOM Hook plugins +ECOM_PLUGIN( presenceecomhook.dll, presenceecomhook.rsc ) +ECOM_PLUGIN( presencedatamodelhook.dll, presencedatamodelhook.rsc ) +ECOM_PLUGIN( presencecacheecomhook.dll, presencecacheecomhook.rsc ) + +// ximpfw SIS, provides support for SIS upgrading +//data=DATAZ_\system\install\ximpfw.sis system\install\ximpfw.sis + + +#endif // __PRESENCE_FRAMEWORK + +#endif //PRESENCEFW_IBY diff -r 000000000000 -r e6b17d312c8b ximpfw/rom/ximpfw_install.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/rom/ximpfw_install.pkg Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,63 @@ +; +; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +; All rights reserved. +; This component and the accompanying materials are made available +; under the terms of "Eclipse Public License v1.0" +; which accompanies this distribution, and is available +; at the URL "http://www.eclipse.org/legal/epl-v10.html". +; +; Initial Contributors: +; Nokia Corporation - initial contribution. +; +; Contributors: +; +; Description: pkg file for ximpfw_install +; +;Language +&EN + +;Header +#{"XIMPFramework"}, (0x10282DDC), 1, 0, 0, TYPE=SA + + +;Localised VendorID +%{"Nokia"} + +;VendorID +:"Nokia" + +(0x101F7961), 0, 0, 0, {"Series60ProductID"} + + +;binaries +"\EPOC32\RELEASE\ARMV5\UREL\ximpdatamodel.dll"-"!:\sys\bin\ximpdatamodel.dll" +"\EPOC32\RELEASE\ARMV5\UREL\ximpoperations.dll"-"!:\sys\bin\ximpoperations.dll" +"\EPOC32\RELEASE\ARMV5\UREL\ximpprocessor.dll"-"!:\sys\bin\ximpprocessor.dll" +"\EPOC32\RELEASE\ARMV5\UREL\ximpserver.exe"-"!:\sys\bin\ximpserver.exe" +"\EPOC32\RELEASE\ARMV5\UREL\ximprootserver.exe"-"!:\sys\bin\ximprootserver.exe" +"\EPOC32\RELEASE\ARMV5\UREL\ximpsrvclient.dll"-"!:\sys\bin\ximpsrvclient.dll" +"\EPOC32\RELEASE\ARMV5\UREL\ximpmanager.dll"-"!:\sys\bin\ximpmanager.dll" +"\EPOC32\RELEASE\ARMV5\UREL\ximpecomhook.dll"-"!:\sys\bin\ximpecomhook.dll" +"\EPOC32\RELEASE\ARMV5\UREL\ximputils.dll"-"!:\sys\bin\ximputils.dll" +"\EPOC32\RELEASE\ARMV5\UREL\presencemanager.dll"-"!:\sys\bin\presencemanager.dll" +"\EPOC32\RELEASE\ARMV5\UREL\presencedatamodel.dll"-"!:\sys\bin\presencedatamodel.dll" +"\EPOC32\RELEASE\ARMV5\UREL\presenceoperation.dll"-"!:\sys\bin\presenceoperation.dll" +"\EPOC32\RELEASE\ARMV5\UREL\presencedatamodelhook.dll"-"!:\sys\bin\presencedatamodelhook.dll" +"\EPOC32\RELEASE\ARMV5\UREL\presenceecomhook.dll"-"!:\sys\bin\presenceecomhook.dll" +"\EPOC32\RELEASE\ARMV5\UREL\presencecacheclient.dll"-"!:\sys\bin\presencecacheclient.dll" +"\EPOC32\RELEASE\ARMV5\UREL\presencecacheecomhook.dll"-"!:\sys\bin\presencecacheecomhook.dll" +"\EPOC32\RELEASE\ARMV5\UREL\presencecacheserver.exe"-"!:\sys\bin\presencecacheserver.exe" +"\EPOC32\RELEASE\ARMV5\UREL\immanager.dll"-"!:\sys\bin\immanager.dll" +"\EPOC32\RELEASE\ARMV5\UREL\imdatamodel.dll"-"!:\sys\bin\imdatamodel.dll" +"\EPOC32\RELEASE\ARMV5\UREL\imoperation.dll"-"!:\sys\bin\imoperation.dll" +"\EPOC32\RELEASE\ARMV5\UREL\imdatamodelhook.dll"-"!:\sys\bin\imdatamodelhook.dll" +"\EPOC32\RELEASE\ARMV5\UREL\imecomhook.dll"-"!:\sys\bin\imecomhook.dll" + +;resources +"\EPOC32\DATA\Z\Resource\Plugins\ximpecomhook.RSC"-"!:\resource\plugins\ximpecomhook.rsc" +"\EPOC32\DATA\Z\Resource\Plugins\presenceecomhook.RSC"-"!:\resource\plugins\presenceecomhook.rsc" +"\EPOC32\DATA\Z\Resource\Plugins\presencedatamodelhook.RSC"-"!:\resource\plugins\presencedatamodelhook.rsc" +"\EPOC32\DATA\Z\Resource\Plugins\presencecacheecomhook.RSC"-"!:\resource\plugins\presencecacheecomhook.rsc" +"\EPOC32\DATA\Z\Resource\Plugins\imecomhook.RSC"-"!:\resource\plugins\imecomhook.rsc" +"\EPOC32\DATA\Z\Resource\Plugins\imdatamodelhook.RSC"-"!:\resource\plugins\imdatamodelhook.rsc" + diff -r 000000000000 -r e6b17d312c8b ximpfw/sis/metadata.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/sis/metadata.xml Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,72 @@ + + + ABC:ABC + + + + + 1 + + XIMPFramework + + Update for XIMPFramework + + + + + + S60 + + + 5 + 2 + + + 2007 + 1 + + + + + 5 + 2 + + 2009 + 52 + + + + + + + + 0x10282DDC + + + 1 + 0 + 0 + + + + 2 + 2 + 2 + + + + + diff -r 000000000000 -r e6b17d312c8b ximpfw/sis/ximpfw.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/sis/ximpfw.pkg Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,55 @@ +; +; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +; All rights reserved. +; This component and the accompanying materials are made available +; under the terms of "Eclipse Public License v1.0" +; which accompanies this distribution, and is available +; at the URL "http://www.eclipse.org/legal/epl-v10.html". +; +; Initial Contributors: +; Nokia Corporation - initial contribution. +; +; Contributors: +; +; Description: +; +;Language +&EN + +;Header +#{"XIMPFramework"}, (0x10282DDC), 1, 1, 0, TYPE=SA, RU + +;Localised VendorID +%{"Nokia"} + +;VendorID +:"Nokia" + +;Supports Series 60 v 5.2; Needs to be updated when platform is changed +(0x20022E6D ), 0, 0, 0, {"Series60ProductID"} + +;binaries +"\EPOC32\RELEASE\ARMV5\UREL\ximpdatamodel.dll"-"!:\sys\bin\ximpdatamodel.dll" +"\EPOC32\RELEASE\ARMV5\UREL\ximpoperations.dll"-"!:\sys\bin\ximpoperations.dll" +"\EPOC32\RELEASE\ARMV5\UREL\ximpprocessor.dll"-"!:\sys\bin\ximpprocessor.dll" +"\EPOC32\RELEASE\ARMV5\UREL\ximpserver.exe"-"!:\sys\bin\ximpserver.exe" +"\EPOC32\RELEASE\ARMV5\UREL\ximprootserver.exe"-"!:\sys\bin\ximprootserver.exe" +"\EPOC32\RELEASE\ARMV5\UREL\ximpsrvclient.dll"-"!:\sys\bin\ximpsrvclient.dll" +"\EPOC32\RELEASE\ARMV5\UREL\ximpmanager.dll"-"!:\sys\bin\ximpmanager.dll" +"\EPOC32\RELEASE\ARMV5\UREL\ximpecomhook.dll"-"!:\sys\bin\ximpecomhook.dll" +"\EPOC32\RELEASE\ARMV5\UREL\ximputils.dll"-"!:\sys\bin\ximputils.dll" +"\EPOC32\RELEASE\ARMV5\UREL\presencemanager.dll"-"!:\sys\bin\presencemanager.dll" +"\EPOC32\RELEASE\ARMV5\UREL\presencedatamodel.dll"-"!:\sys\bin\presencedatamodel.dll" +"\EPOC32\RELEASE\ARMV5\UREL\presenceoperation.dll"-"!:\sys\bin\presenceoperation.dll" +"\EPOC32\RELEASE\ARMV5\UREL\presencedatamodelhook.dll"-"!:\sys\bin\presencedatamodelhook.dll" +"\EPOC32\RELEASE\ARMV5\UREL\presenceecomhook.dll"-"!:\sys\bin\presenceecomhook.dll" +"\EPOC32\RELEASE\ARMV5\UREL\presencecacheclient.dll"-"!:\sys\bin\presencecacheclient.dll" +"\EPOC32\RELEASE\ARMV5\UREL\presencecacheecomhook.dll"-"!:\sys\bin\presencecacheecomhook.dll" +"\EPOC32\RELEASE\ARMV5\UREL\presencecacheserver.exe"-"!:\sys\bin\presencecacheserver.exe" + +;resources +"\EPOC32\DATA\Z\Resource\Plugins\ximpecomhook.RSC"-"!:\resource\plugins\ximpecomhook.rsc" +"\EPOC32\DATA\Z\Resource\Plugins\presenceecomhook.RSC"-"!:\resource\plugins\presenceecomhook.rsc" +"\EPOC32\DATA\Z\Resource\Plugins\presencedatamodelhook.RSC"-"!:\resource\plugins\presencedatamodelhook.rsc" +"\EPOC32\DATA\Z\Resource\Plugins\presencecacheecomhook.RSC"-"!:\resource\plugins\presencecacheecomhook.rsc" + diff -r 000000000000 -r e6b17d312c8b ximpfw/sis/ximpfwstub.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/sis/ximpfwstub.pkg Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,67 @@ +; +; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +; All rights reserved. +; This component and the accompanying materials are made available +; under the terms of "Eclipse Public License v1.0" +; which accompanies this distribution, and is available +; at the URL "http://www.eclipse.org/legal/epl-v10.html". +; +; Initial Contributors: +; Nokia Corporation - initial contribution. +; +; Contributors: +; +; Description: +; +; +; Package file for presencefw SIS stub in ROM +; and a ximp framework upgrade SIS. +; Including the stub in ROM enables components +; defined in stub to be updated by SIS installer. +; When adding or removing components from presencefw +; please update this pkg file and create an updated +; stub to group directory. +; +; To create SIS stub: makesis -s ximpfw_upgrade.pkg ximpfwstub.sis +; Copy ximpfwstub.sis to z:\system\install\ximpfwstub.sis +; or use abld export to export it automatically. +; + +;Language +&EN + +;Header +#{"XIMPFramework"}, (0x10282DDC), 1, 0, 0, TYPE=SA + + +;Localised VendorID +%{"Nokia"} + +;VendorID +:"Nokia" + +;binaries +""-"z:\sys\bin\ximpdatamodel.dll" +""-"z:\sys\bin\ximpoperations.dll" +""-"z:\sys\bin\ximpprocessor.dll" +""-"z:\sys\bin\ximpserver.exe" +""-"z:\sys\bin\ximprootserver.exe" +""-"z:\sys\bin\ximpsrvclient.dll" +""-"z:\sys\bin\ximpmanager.dll" +""-"z:\sys\bin\ximpecomhook.dll" +""-"z:\sys\bin\ximputils.dll" +""-"z:\sys\bin\presencemanager.dll" +""-"z:\sys\bin\presencedatamodel.dll" +""-"z:\sys\bin\presenceoperation.dll" +""-"z:\sys\bin\presencedatamodelhook.dll" +""-"z:\sys\bin\presenceecomhook.dll" +""-"z:\sys\bin\presencecacheclient.dll" +""-"z:\sys\bin\presencecacheecomhook.dll" +""-"z:\sys\bin\presencecacheserver.exe" + +;resources +""-"z:\resource\plugins\ximpecomhook.rsc" +""-"z:\resource\plugins\presenceecomhook.rsc" +""-"z:\resource\plugins\presencedatamodelhook.rsc" +""-"z:\resource\plugins\presencecacheecomhook.rsc" + diff -r 000000000000 -r e6b17d312c8b ximpfw/sis/ximpfwstub.sis Binary file ximpfw/sis/ximpfwstub.sis has changed diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/group/bld.inf Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,59 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Build information file for test dlls and related helpers +* +*/ + + +// tsrc utils, including test mover +//#include "../tsrcutils/bld.inf" + +// Test protocols +//#include "../tsrcprotocols/bld.inf" + +// Module release tests +//#include "../src/t_rootservices/bld.inf" +//#include "../src/t_sessionmng/bld.inf" +//#include "../src/t_presencepublishing/bld.inf" +//#include "../src/t_presencewatching/bld.inf" +//#include "../src/t_presencegrouplistmngt/bld.inf" +//#include "../src/t_presencegroupmembermngt/bld.inf" +//#include "../src/t_presencewatcherlistmngt/bld.inf" +//#include "../src/t_presencegrantrequestmngt/bld.inf" +//#include "../src/t_presenceauthorization/bld.inf" +//#"../src/t_presenceblocking/bld.inf" +//#include "../src/t_utils/bld.inf" +//#include "../src/t_presenceall/bld.inf" + +PRJ_TESTMMPFILES +../tsrcutils/testcaseutils/prfwtestcaseutils.mmp +../tsrcutils/processmaster/prfwtestprocessmaster.mmp +../tsrcprotocols/pr_prfwtestprotocol/pr_prfwtestprotocol.mmp +../src/t_rootservices/t_rootservices.mmp +../src/t_sessionmng/t_sessionmng.mmp +../src/t_presencepublishing/t_presencepublishing.mmp +../src/t_presencewatching/t_presencewatching.mmp +../src/t_presencegrouplistmngt/t_presencegrouplistmngt.mmp +../src/t_presencegroupmembermngt/t_presencegroupmembermngt.mmp +../src/t_presencewatcherlistmngt/t_presencewatcherlistmngt.mmp +../src/t_presencegrantrequestmngt/t_presencegrantrequestmngt.mmp +../src/t_presenceauthorization/t_presenceauthorization.mmp +../src/t_presenceblocking/t_presenceblocking.mmp +../src/t_utils/t_utils.mmp +../src/t_presenceall/t_presenceall.mmp + +// Export the .iby for module release tests +PRJ_EXPORTS +ximpfwmrt.iby /epoc32/rom/include/ximpfwmrt.iby + diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/group/ximpfw_release_tests.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/group/ximpfw_release_tests.pkg Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,56 @@ +; +; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +; All rights reserved. +; This component and the accompanying materials are made available +; under the terms of "Eclipse Public License v1.0" +; which accompanies this distribution, and is available +; at the URL "http://www.eclipse.org/legal/epl-v10.html". +; +; Initial Contributors: +; Nokia Corporation - initial contribution. +; +; Contributors: +; +; Description: XIMP Framewor Test code Package File +; +;Header +#{"XIMPFW ReleaseTests"}, (0x10282DE4), 1, 0, 0 + +;Language +&EN + +;Localised VendorID +%{"Nokia"} + +;VendorID +:"Nokia" + + +;Supports Series 60 v 0.9 +(0x101F6F88), 0, 0, 0, +{"Series60ProductID"} + + +;Needed test protocols and test helpers +"\EPOC32\RELEASE\ARMV5\UREL\pr_prfwtestprotocol.dll" - "!:\sys\bin\pr_prfwtestprotocol.dll" +"\EPOC32\DATA\Z\Resource\Plugins\pr_prfwtestprotocol.RSC"-"!:\resource\plugins\pr_prfwtestprotocol.rsc" +"\EPOC32\RELEASE\ARMV5\UREL\prfwtestcaseutils.dll" - "!:\sys\bin\prfwtestcaseutils.dll" + + +;EUnit test dlls +;"\EPOC32\RELEASE\ARMV5\UREL\t_presenceall.dll" - "!:\sys\bin\t_presenceall.dll" +"\EPOC32\RELEASE\ARMV5\UREL\t_rootservices.dll" - "!:\sys\bin\t_rootservices.dll" +"\EPOC32\RELEASE\ARMV5\UREL\t_sessionmng.dll" - "!:\sys\bin\t_sessionmng.dll" +"\EPOC32\RELEASE\ARMV5\UREL\t_presencepublishing.dll" - "!:\sys\bin\t_presencepublishing.dll" +"\EPOC32\RELEASE\ARMV5\UREL\t_presencewatching.dll" - "!:\sys\bin\t_presencewatching.dll" +"\EPOC32\RELEASE\ARMV5\UREL\t_presencegrouplistmngt.dll" - "!:\sys\bin\t_presencegrouplistmngt.dll" +"\EPOC32\RELEASE\ARMV5\UREL\t_presencegroupmembermngt.dll" - "!:\sys\bin\t_presencegroupmembermngt.dll" +"\EPOC32\RELEASE\ARMV5\UREL\t_presencewatcherlistmngt.dll" - "!:\sys\bin\t_presencewatcherlistmngt.dll" +"\EPOC32\RELEASE\ARMV5\UREL\t_presencegrantrequestmngt.dll" - "!:\sys\bin\t_presencegrantrequestmngt.dll" +"\EPOC32\RELEASE\ARMV5\UREL\t_presenceauthorization.dll" - "!:\sys\bin\t_presenceauthorization.dll" +"\EPOC32\RELEASE\ARMV5\UREL\t_presenceblocking.dll" - "!:\sys\bin\t_presenceblocking.dll" +"\EPOC32\RELEASE\ARMV5\UREL\t_utils.dll" - "!:\sys\bin\t_utils.dll" + +;ProcessMaster +"\EPOC32\RELEASE\ARMV5\UREL\prfwtestprocessmaster.exe" - "!:\sys\bin\prfwtestprocessmaster.exe" + diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/group/ximpfwmrt.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/group/ximpfwmrt.iby Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,47 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Image description file for module release tests +* +*/ + +#ifndef __prfwmrt_iby__ +#define __prfwmrt_iby__ + +#include + +// Test protocol (ECOM plugin) +ECOM_PLUGIN( pr_prfwtestprotocol.dll, pr_prfwtestprotocol.rsc ) + +// Test utils and helpers +file=ABI_DIR\BUILD_DIR\prfwtestcaseutils.dll SHARED_LIB_DIR\prfwtestcaseutils.dll + +// Test dlls +file=ABI_DIR\BUILD_DIR\t_presenceall.dll SHARED_LIB_DIR\t_presenceall.dll +file=ABI_DIR\BUILD_DIR\t_rootservices.dll SHARED_LIB_DIR\t_rootservices.dll +file=ABI_DIR\BUILD_DIR\t_sessionmng.dll SHARED_LIB_DIR\t_sessionmng.dll +file=ABI_DIR\BUILD_DIR\t_presencepublishing.dll SHARED_LIB_DIR\t_presencepublishing.dll +file=ABI_DIR\BUILD_DIR\t_presencewatching.dll SHARED_LIB_DIR\t_presencewatching.dll +file=ABI_DIR\BUILD_DIR\t_presencegrouplistmngt.dll SHARED_LIB_DIR\t_presencegrouplistmngt.dll +file=ABI_DIR\BUILD_DIR\t_presencegroupmembermngt.dll SHARED_LIB_DIR\t_presencegroupmembermngt.dll +file=ABI_DIR\BUILD_DIR\t_presencewatcherlistmngt.dll SHARED_LIB_DIR\t_presencewatcherlistmngt.dll +file=ABI_DIR\BUILD_DIR\t_presenceauthorization.dll SHARED_LIB_DIR\t_presenceauthorization.dll +file=ABI_DIR\BUILD_DIR\t_presenceblocking.dll SHARED_LIB_DIR\t_presenceblocking.dll +file=ABI_DIR\BUILD_DIR\t_utils.dll SHARED_LIB_DIR\t_utils.dll +file=ABI_DIR\BUILD_DIR\t_presencecache.dll SHARED_LIB_DIR\t_presencecache.dll + +//ProcessMaster +file=ABI_DIR\BUILD_DIR\prfwtestprocessmaster.exe SHARED_LIB_DIR\prfwtestprocessmaster.exe + +#endif //__prfwmrt_iby__ + diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/init/ximpfw_install.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/init/ximpfw_install.pkg Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,63 @@ +; +; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +; All rights reserved. +; This component and the accompanying materials are made available +; under the terms of "Eclipse Public License v1.0" +; which accompanies this distribution, and is available +; at the URL "http://www.eclipse.org/legal/epl-v10.html". +; +; Initial Contributors: +; Nokia Corporation - initial contribution. +; +; Contributors: +; +; Description: XIMP Framework Package File +; +;Language +&EN + +;Header +#{"XIMPFramework"}, (0x10282DDC), 1, 0, 0, TYPE=SA + + +;Localised VendorID +%{"Nokia"} + +;VendorID +:"Nokia" + +(0x101F7961), 0, 0, 0, {"Series60ProductID"} + + +;binaries +"\EPOC32\RELEASE\ARMV5\UDEB\ximpdatamodel.dll"-"!:\sys\bin\ximpdatamodel.dll" +"\EPOC32\RELEASE\ARMV5\UDEB\ximpoperations.dll"-"!:\sys\bin\ximpoperations.dll" +"\EPOC32\RELEASE\ARMV5\UDEB\ximpprocessor.dll"-"!:\sys\bin\ximpprocessor.dll" +"\EPOC32\RELEASE\ARMV5\UDEB\ximpserver.exe"-"!:\sys\bin\ximpserver.exe" +"\EPOC32\RELEASE\ARMV5\UDEB\ximprootserver.exe"-"!:\sys\bin\ximprootserver.exe" +"\EPOC32\RELEASE\ARMV5\UDEB\ximpsrvclient.dll"-"!:\sys\bin\ximpsrvclient.dll" +"\EPOC32\RELEASE\ARMV5\UDEB\ximpmanager.dll"-"!:\sys\bin\ximpmanager.dll" +"\EPOC32\RELEASE\ARMV5\UDEB\ximpecomhook.dll"-"!:\sys\bin\ximpecomhook.dll" +"\EPOC32\RELEASE\ARMV5\UDEB\ximputils.dll"-"!:\sys\bin\ximputils.dll" +"\EPOC32\RELEASE\ARMV5\UDEB\presencemanager.dll"-"!:\sys\bin\presencemanager.dll" +"\EPOC32\RELEASE\ARMV5\UDEB\presencedatamodel.dll"-"!:\sys\bin\presencedatamodel.dll" +"\EPOC32\RELEASE\ARMV5\UDEB\presenceoperation.dll"-"!:\sys\bin\presenceoperation.dll" +"\EPOC32\RELEASE\ARMV5\UDEB\presencedatamodelhook.dll"-"!:\sys\bin\presencedatamodelhook.dll" +"\EPOC32\RELEASE\ARMV5\UDEB\presenceecomhook.dll"-"!:\sys\bin\presenceecomhook.dll" +"\EPOC32\RELEASE\ARMV5\UDEB\presencecacheclient.dll"-"!:\sys\bin\presencecacheclient.dll" +"\EPOC32\RELEASE\ARMV5\UDEB\presencecacheecomhook.dll"-"!:\sys\bin\presencecacheecomhook.dll" +"\EPOC32\RELEASE\ARMV5\UDEB\presencecacheserver.exe"-"!:\sys\bin\presencecacheserver.exe" +"\EPOC32\RELEASE\ARMV5\UDEB\immanager.dll"-"!:\sys\bin\immanager.dll" +"\EPOC32\RELEASE\ARMV5\UDEB\imdatamodel.dll"-"!:\sys\bin\imdatamodel.dll" +"\EPOC32\RELEASE\ARMV5\UDEB\imoperation.dll"-"!:\sys\bin\imoperation.dll" +"\EPOC32\RELEASE\ARMV5\UDEB\imdatamodelhook.dll"-"!:\sys\bin\imdatamodelhook.dll" +"\EPOC32\RELEASE\ARMV5\UDEB\imecomhook.dll"-"!:\sys\bin\imecomhook.dll" + +;resources +"\EPOC32\DATA\Z\Resource\Plugins\ximpecomhook.RSC"-"!:\resource\plugins\ximpecomhook.rsc" +"\EPOC32\DATA\Z\Resource\Plugins\presenceecomhook.RSC"-"!:\resource\plugins\presenceecomhook.rsc" +"\EPOC32\DATA\Z\Resource\Plugins\presencedatamodelhook.RSC"-"!:\resource\plugins\presencedatamodelhook.rsc" +"\EPOC32\DATA\Z\Resource\Plugins\presencecacheecomhook.RSC"-"!:\resource\plugins\presencecacheecomhook.rsc" +"\EPOC32\DATA\Z\Resource\Plugins\imecomhook.RSC"-"!:\resource\plugins\imecomhook.rsc" +"\EPOC32\DATA\Z\Resource\Plugins\imdatamodelhook.RSC"-"!:\resource\plugins\imdatamodelhook.rsc" + diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/init/ximpfw_upgrade.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/init/ximpfw_upgrade.pkg Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,75 @@ +; +; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +; All rights reserved. +; This component and the accompanying materials are made available +; under the terms of "Eclipse Public License v1.0" +; which accompanies this distribution, and is available +; at the URL "http://www.eclipse.org/legal/epl-v10.html". +; +; Initial Contributors: +; Nokia Corporation - initial contribution. +; +; Contributors: +; +; Description: XIMP Framework Package File +; +; +; Package file for presencefw SIS stub in ROM +; and a ximp framework upgrade SIS. +; Including the stub in ROM enables components +; defined in stub to be updated by SIS installer. +; When adding or removing components from presencefw +; please update this pkg file and create an updated +; stub to group directory. +; +; To create SIS stub: makesis -s ximpfw_upgrade.pkg ximpfwstub.sis +; Copy ximpfwstub.sis to z:\system\install\ximpfwstub.sis +; or use abld export to export it automatically. +; + +;Language +&EN + +;Header +#{"PresenceFramework"}, (0x10282DDC), 1, 0, 0, TYPE=PU + + +;Localised VendorID +%{"Nokia"} + +;VendorID +:"Nokia" + +(0x101F7961), 0, 0, 0, {"Series60ProductID"} + + +;binaries +"\EPOC32\RELEASE\ARMV5\UREL\ximpdatamodel.dll"-"z:\sys\bin\ximpdatamodel.dll" +"\EPOC32\RELEASE\ARMV5\UREL\ximpoperations.dll"-"z:\sys\bin\ximpoperations.dll" +"\EPOC32\RELEASE\ARMV5\UREL\ximpprocessor.dll"-"z:\sys\bin\ximpprocessor.dll" +"\EPOC32\RELEASE\ARMV5\UREL\ximpserver.exe"-"z:\sys\bin\ximpserver.exe" +"\EPOC32\RELEASE\ARMV5\UREL\ximprootserver.exe"-"z:\sys\bin\ximprootserver.exe" +"\EPOC32\RELEASE\ARMV5\UREL\ximpsrvclient.dll"-"z:\sys\bin\ximpsrvclient.dll" +"\EPOC32\RELEASE\ARMV5\UREL\ximpmanager.dll"-"z:\sys\bin\ximpmanager.dll" +"\EPOC32\RELEASE\ARMV5\UREL\ximpecomhook.dll"-"z:\sys\bin\ximpecomhook.dll" +"\EPOC32\RELEASE\ARMV5\UREL\ximputils.dll"-"z:\sys\bin\ximputils.dll" +"\EPOC32\RELEASE\ARMV5\UREL\presencemanager.dll"-"z:\sys\bin\presencemanager.dll" +"\EPOC32\RELEASE\ARMV5\UREL\presencedatamodel.dll"-"z:\sys\bin\presencedatamodel.dll" +"\EPOC32\RELEASE\ARMV5\UREL\presenceoperation.dll"-"z:\sys\bin\presenceoperation.dll" +"\EPOC32\RELEASE\ARMV5\UREL\presencecacheclient.dll"-"z:\sys\bin\presencecacheclient.dll" +"\EPOC32\RELEASE\ARMV5\UREL\presencecacheecomhook.dll"-"z:\sys\bin\presencecacheecomhook.dll" +"\EPOC32\RELEASE\ARMV5\UREL\presencecacheserver.exe"-"z:\sys\bin\presencecacheserver.exe" +"\EPOC32\RELEASE\ARMV5\UREL\immanager.dll"-"z:\sys\bin\immanager.dll" +"\EPOC32\RELEASE\ARMV5\UREL\imdatamodel.dll"-"z:\sys\bin\imdatamodel.dll" +"\EPOC32\RELEASE\ARMV5\UREL\imoperation.dll"-"z:\sys\bin\imoperation.dll" +"\EPOC32\RELEASE\ARMV5\UREL\imdatamodelhook.dll"-"z:\sys\bin\imdatamodelhook.dll" +"\EPOC32\RELEASE\ARMV5\UREL\imecomhook.dll"-"z:\sys\bin\imecomhook.dll" + +;resources +"\EPOC32\DATA\z\Resource\Plugins\ximpecomhook.RSC"-"z:\resource\plugins\ximpecomhook.rsc" +"\EPOC32\DATA\z\Resource\Plugins\presenceecomhook.RSC"-"z:\resource\plugins\presenceecomhook.rsc" +"\EPOC32\DATA\z\Resource\Plugins\presencedatamodelhook.RSC"-"z:\resource\plugins\presencedatamodelhook.rsc" +"\EPOC32\DATA\z\Resource\Plugins\presencecacheecomhook.RSC"-"z:\resource\plugins\presencecacheecomhook.rsc" +"\EPOC32\DATA\z\Resource\Plugins\imecomhook.RSC"-"z:\resource\plugins\imecomhook.rsc" +"\EPOC32\DATA\z\Resource\Plugins\imdatamodelhook.RSC"-"z:\resource\plugins\imdatamodelhook.rsc" + diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/src/t_eunittemplate/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/src/t_eunittemplate/bld.inf Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,22 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Build information file for T_EunitTemplate test dll. +* +*/ + +PRJ_PLATFORMS +DEFAULT + +PRJ_TESTMMPFILES +t_eunittemplate.mmp diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/src/t_eunittemplate/t_eunittemplate.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/src/t_eunittemplate/t_eunittemplate.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,124 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework Test Code +* +*/ + +#include "t_eunittemplate.h" +#include "eunittools.h" +#include + + + +// ============================ MEMBER FUNCTIONS =============================== + +// CONSTRUCTION +T_EunitTemplate* T_EunitTemplate::NewL() + { + T_EunitTemplate* self = new( ELeave ) T_EunitTemplate; + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + + return self; + } + + +T_EunitTemplate::~T_EunitTemplate() + { + } + + +void T_EunitTemplate::ConstructL() + { + CEUnitTestSuiteClass::ConstructL(); + } + + +T_EunitTemplate::T_EunitTemplate() + { + } + + + +// =========================================================================== +// TEST CASE SETUP & TEARDOWN METHODS +// =========================================================================== +// +void T_EunitTemplate::Setup_L() + { + } + + + +void T_EunitTemplate::Teardown() + { + } + + + +// =========================================================================== +// TODO: Test case description & grouping +// =========================================================================== +// +void T_EunitTemplate::TestSomething_L() + { + EUNIT_ASSERT( EFalse ); + } + + + + +// =========================================================================== +// TEST CASE TABLE +// =========================================================================== +// +EUNIT_BEGIN_TEST_TABLE( + T_EunitTemplate, + "Add test suite description here.", + "MODULE" ) + + PRFW_NOT_DECORATED_TEST( + "Empty test skeleton", + "Add tested class name here", + "Add tested function names here", + "FUNCTIONALITY ERRORHANDLING BOUNDARY", + Setup_L, + TestSomething_L, + Teardown ) + + +EUNIT_END_TEST_TABLE + + + + + +// =========================================================================== +// TEST SUITE CONSTRUCTION +// =========================================================================== +// +EXPORT_C MEUnitTest* CreateTestSuiteL() + { + return T_EunitTemplate::NewL(); + } + + +// end of file + + + + + + diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/src/t_eunittemplate/t_eunittemplate.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/src/t_eunittemplate/t_eunittemplate.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,96 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework Test Code +* +*/ + +#ifndef T_EUNITTEMPLATE_H +#define T_EUNITTEMPLATE_H + +#include + + + + + +/** + * XIMP Framework Eunit tests. + * + * TODO: Add test description here. + * + * @since S60 v4.0 + */ +class T_EunitTemplate : public CEUnitTestSuiteClass + { + +public: + + /** ?description */ + //enum ?declaration + + /** ?description */ + //typedef ?declaration + + static T_EunitTemplate* NewL(); + virtual ~T_EunitTemplate(); + +private: + + T_EunitTemplate(); + void ConstructL(); + + + +private: // Test case functions + + void Setup_L(); + void Teardown(); + + void TestSomething_L(); + + + +private: // Test helpers + + + + + +private: // Test data + + + /** + * Eunit test case table declaration. + */ + EUNIT_DECLARE_TEST_TABLE; + + + /** + * + * Own. / Not own. + */ + //?type* ?member_name; + + }; + + +#endif // T_EUNITTEMPLATE_H + + + +// end of file + + + + diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/src/t_eunittemplate/t_eunittemplate.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/src/t_eunittemplate/t_eunittemplate.mmp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,35 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework Test Code +* +*/ + +#include "../../tsrcutils/eunitcommon/eunittstdllbase.mmh" + +TARGET t_eunittemplate.dll + + +SOURCEPATH . +SOURCE t_eunittemplate.cpp + + + +// Dependencies to system components +//LIBRARY + + + +// end of file + + diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/src/t_presenceall/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/src/t_presenceall/bld.inf Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,25 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Build information file for t_presenceall.dll +* +*/ + + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +PRJ_TESTMMPFILES +t_presenceall.mmp diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/src/t_presenceall/t_presenceall.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/src/t_presenceall/t_presenceall.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,999 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework Test Code +* +*/ + + +#include "eunittools.h" + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + + +#include +#include +#include + +#include +#include +#include + +#include "t_presenceall.h" +#include "prfwteststatuseventlistener.h" +#include "prfwtestmessaging.h" +#include "prfwtestmessenger.h" +#include "prfwtestcontextwrappermgr.h" +#include "prfwtestcontextwrapper.h" + +#include "presenceinfoimp.h" +#include "presenceinfofilterimp.h" +#include "prfwtestpresencedatautils.h" +#include "ximpidentityimp.h" +#include "presentitygroupmemberinfoimp.h" +#include "ximpobjecthelpers.h" +#include "prfwtestfilesrvmsg.h" +#include "prfwtestwaithelper.h" +#include "prfwtestlistener.h" + + +#include "presentitygroupcontenteventimp.h" +#include "ximprequestcompleteeventimp.h" +#include "presentitygroupinfoimp.h" +#include "presentitygrouplisteventimp.h" +#include "presentitygroupmemberinfoimp.h" +#include "ximprequestcompleteeventimp.h" +#include "ximprestrictedobjectcollection.h" +#include "ximpobjectfactoryimp.h" + +#include "prfwtesteventfactory.h" + +#include "prfwtestpresencedatautils.h" + +#include "ximpobjecthelpers.h" +#include "presentitygroupinfoimp.h" +#include "presentitygrouplisteventimp.h" +#include "presentitygroupcontenteventimp.h" + +#include "prfwtestfiletool.h" + + +#include "prfwtestrobustnesstools.h" + +_LIT8( KPrefix1, "PreA_" ); +_LIT8( KPrefix2, "PreB_" ); +_LIT8( KPrefix3, "PreC_" ); +_LIT8( KPrefix4, "PreD_" ); + +_LIT( KPrefix5, "PreXX_" ); +_LIT( KPrefix6, "PreYY_" ); + +_LIT( KIdentity, "TestId@hello.world" ); + + +_LIT( KMemberId1, "tel:user1@foo.bar" ); +_LIT( KMemberDisplayName1, "user1" ); + +_LIT( KMemberId2, "tel:user2@foo.bar" ); +_LIT( KMemberDisplayName2, "user2" ); + +_LIT( KGroupId, "PrsDemoGrp" ); +_LIT( KGroupDisplayName, "demo group" ); + + + +// ============================ MEMBER FUNCTIONS =============================== + +// CONSTRUCTION +T_PresenceAll* T_PresenceAll::NewL() + { + T_PresenceAll* self = new( ELeave ) T_PresenceAll; + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + + return self; + } + + +T_PresenceAll::~T_PresenceAll() + { + } + + +void T_PresenceAll::ConstructL() + { + CEUnitTestSuiteClass::ConstructL(); + } + + +T_PresenceAll::T_PresenceAll() + { + } + + + +// =========================================================================== +// TEST CASE SETUP & TEARDOWN METHODS +// =========================================================================== +// + +void T_PresenceAll::Setup_L() + { + __UHEAP_MARK; + PrfwTestRobustness::DoPreCleaning(); + + iWrapperMgr = CXIMPTestContextWrapperMgr::NewL(); + iWrapperMgr->CreateWrapperL(); + } + +void T_PresenceAll::SetupMultiple_L() + { + PrfwTestRobustness::DoPreCleaning(); + + iWrapperMgr = CXIMPTestContextWrapperMgr::NewL(); + iWrapperMgr->CreateWrapperL(); + iWrapperMgr->CreateWrapperL(); + iWrapperMgr->CreateWrapperL(); + } + + +void T_PresenceAll::BindL() + { + CXIMPTestContextWrapper* wrapper0 = iWrapperMgr->GetWrapperL( 0 ); + + wrapper0->BindL( 0 ); + } + +void T_PresenceAll::BindAllL() + { + for( TInt a = 0; a < iWrapperMgr->WrapperCount(); ++a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + wrapper->BindL( 0 ); + } + } + + +void T_PresenceAll::Teardown() + { + delete iWrapperMgr; + iWrapperMgr = NULL; + + REComSession::FinalClose(); + + PrfwTestRobustness::DoPreCleaning(); + User::SetJustInTime( ETrue ); + __UHEAP_MARKEND; + } + +void T_PresenceAll::UnbindL() + { + // Do unbind + CXIMPTestContextWrapper* wrapper0 = iWrapperMgr->GetWrapperL( 0 ); + wrapper0->UnbindL(); + } + +void T_PresenceAll::UnbindAllL() + { + for( TInt a = 0; a < iWrapperMgr->WrapperCount(); ++a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + wrapper->UnbindL(); + } + } + + +// =========================================================================== +// TEST CASES for presentity presence subscription +// =========================================================================== + +// Jani +void T_PresenceAll::T_TMO_demo_Startup_L() + { + EUNIT_PRINT( _L("T_TMO_demo_Startup_L") ); + + BindL(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresencePublishing& presPub = presFeat->PresencePublishing(); + MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization(); + MPresentityGroups& presGroup = presFeat->PresentityGroups(); + MPresenceWatching& presWatch = presFeat->PresenceWatching(); + + + + ////////////////////////////////////////////////////////////////////////// + // SUBSCRIBE OWN PRESENCE + ////////////////////////////////////////////////////////////////////////// + + // Create own presence info filter + CPresenceInfoFilterImp* ownPif = CPresenceInfoFilterImp::NewLC(); // << ownPif + ownPif->AcceptPersonFilterL( NPresenceInfo::NFieldType::KAcceptAll ); + //ownPif->AcceptPersonFilterL( NPresenceInfo::NFieldType::KStatusMessage ); + //ownPif->AcceptPersonFilterL( NPresenceInfo::NFieldType::KAvatar ); + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + + // subscribe own presence + TXIMPRequestId reqId = presPub.SubscribeOwnPresenceL( *ownPif ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Subscribing own presence, complete with error: ") ); + + // verify that SubscribeOwnPresenceL was called + COMMONASSERT( messenger, EXIMPPlgTestSubscribeOwnPresenceCalled, "SubscribeOwnPresenceL was not called", ETrue, NULL ); + + ////////////////////////////////////////////////////////////////////////// + // SUBSCRIBE PRESENCE WATCHER LIST + ////////////////////////////////////////////////////////////////////////// + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + + // subscribe + reqId = presPub.SubscribePresenceWatcherListL(); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Subscribing presence watcher list, complete with error: ") ); + + COMMONASSERT( messenger, EXIMPPlgTestSubscribePresenceWatcherListCalled, "SubscribeWatcherListL was not called", ETrue, NULL ); + + + ////////////////////////////////////////////////////////////////////////// + // SUBSCRIBE PRESENCE BLOCK LIST + ////////////////////////////////////////////////////////////////////////// + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + + // subscribe + reqId = presAuth.SubscribePresenceBlockListL(); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Subscribing presence watcher list, complete with error: ") ); + + // verify that SubscribeBlockListL was called + COMMONASSERT( messenger, EXIMPPlgTestSubscribePresenceBlockListCalled, "SubscribeBlockListL was not called", ETrue, NULL ); + + + + ////////////////////////////////////////////////////////////////////////// + // SUBSCRIBE PRESENTITY GROUP LIST + ////////////////////////////////////////////////////////////////////////// + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + + // subscribe + reqId = presGroup.SubscribePresentityGroupListL(); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Subscribing presentity group list, complete with error: ") ); + + // verify that SubscribePresentityGroupListL was called + messenger->AssertSubscribePresentityGroupListCalled( ETrue ); + + + ////////////////////////////////////////////////////////////////////////// + // EMPTY GROUP LIST EVENT + ///////////////////////////////////////////////////////////////////////// + // According to design, this should not be called + // because the group list is empty, this can be removed + // Create help listener + +/* CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); // << listener2 + + // Create faked server message about group list + SendSrvMsgL( CXIMPTestFileSrvMsg::ETestSrvMsgPresentityGroupList ); + + // expect empty MPresentityGroupList event. + CPresentityGroupListEventImp* event = XIMPTestEventFactory::CreateGroupListEventLCX( + KNullDesC, KNullDesC, + XIMPTestEventFactory::ETestPGLEmpty, + KNullDesC, KNullDesC, + MXIMPDataSubscriptionState::ESubscriptionActive, + MXIMPDataSubscriptionState::EDataAvailable + ); + + listener2->ExpectL( event ); + CleanupStack::Pop( event ); // 4 more items in cleanupstack + + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "HandlePresentityGroupListL failed" ); + CleanupStack::PopAndDestroy( 4 ); // lists + CleanupStack::PopAndDestroy( listener2 ); // >>> listener2 + +*/ + ////////////////////////////////////////////////////////////////////////// + // CREATE PRESENTITY GROUP + ///////////////////////////////////////////////////////////////////////// + + // Setup status event listener for RequestComplete + // This will also produce HandlePresentityGroupListEvent, since the + // the group is subscribed + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + + + MXIMPIdentity* groupId = context->ObjectFactory().NewIdentityLC(); + CleanupStack::Pop(); // groupId + groupId->SetIdentityL( KGroupId ); + + // subscribe + reqId = presGroup.CreatePresentityGroupL( *groupId, KGroupDisplayName ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("CreatePresentityGroupL failed, complete with error: ") ); + + // verify that SubscribePresentityGroupListL was called + messenger->AssertCreatePresentityGroupCalled( ETrue ); + + + + ////////////////////////////////////////////////////////////////////////// + // ADD PRESENTITY GROUP MEMBER + ////////////////////////////////////////////////////////////////////////// + + CXIMPTestListener* listener4 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener4 ); // << listener4 + + MXIMPIdentity* member = context->ObjectFactory().NewIdentityLC(); // << member + member->SetIdentityL( KMemberId1 ); + + + // request complete + TXIMPRequestId reqIdDummy; + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + + // group id + CXIMPIdentityImp* identity2 = CXIMPIdentityImp::NewLC( groupId->Identity() ); + evReqComplete->AppendParamL( identity2 ); + CleanupStack::Pop(identity2); // identity2 + + // id for member info + CXIMPIdentityImp* miId = CXIMPIdentityImp::NewLC( KMemberId1 ); + // member info + CPresentityGroupMemberInfoImp* memInfoImp = + CPresentityGroupMemberInfoImp::NewLC( *miId, KMemberDisplayName1 ); + evReqComplete->AppendParamL( memInfoImp ); + CleanupStack::Pop(memInfoImp); // memInfoImp owned by AppendParamL + CleanupStack::PopAndDestroy( miId ); // copy was made + + listener4->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + // do the call + reqId = presGroup.AddPresentityGroupMemberL( + *groupId, *member, KMemberDisplayName1 ); + + // and wait + EUNIT_ASSERT_DESC( KErrNone == listener4->WaitAndAssertL(), "AddPresentityGroupMemberL (not subscribed) failed" ); + + messenger->AssertAddPresentityGroupMemberCalled( ETrue ); + CleanupStack::PopAndDestroy(); // >>> member + CleanupStack::PopAndDestroy( listener4 );// >>> listener4 + + + ////////////////////////////////////////////////////////////////////////// + // SUBSCRIBE PRESENTITY GROUP CONTENT + ////////////////////////////////////////////////////////////////////////// + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + + // subscribe group content + MXIMPIdentity* identity = context->ObjectFactory().NewIdentityLC(); + identity->SetIdentityL( KGroupId ); // << identity + + reqId = presGroup.SubscribePresentityGroupContentL( *identity ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Subscribe presentity group content, complete with error: ") ); + + COMMONASSERT( messenger, EXIMPPlgTestSubscribePresentityGroupContentCalled, "SubscribeGroupContentL was not called", ETrue, NULL ); + + ////////////////////////////////////////////////////////////////////////// + // SUBSCRIBE PRESENTITY GROUP MEMBERS PRESENCE + ////////////////////////////////////////////////////////////////////////// + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + + // This is the group we are interested in + MXIMPIdentity* group = context->ObjectFactory().NewIdentityLC(); + CleanupStack::Pop(); // group + group->SetIdentityL( KGroupId ); + // Set filter for the group + //CPresenceInfoFilterImp* gpif = CPresenceInfoFilterImp::NewLC(); + //gpif->AcceptPersonFilterL( NPresenceInfo::NFieldType::KStatusMessage ); + //gpif->AcceptPersonFilterL( NPresenceInfo::NFieldType::KAvatar ); + + + + CPresenceInfoFilterImp* gpif = + XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 ); + + CleanupStack::Pop(gpif); // gpif + + // register interest + reqId = presWatch.SubscribePresentityGroupMembersPresenceL( *group, *gpif ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Subscribe presentity group members, complete with error: ") ); + + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestSubscribePresentityGroupMembersPresesenceCalled, "SubscribePresentityGroupMembersPresenceL was not called", ETrue, NULL ); + + delete gpif; + + + ////////////////////////////////////////////////////////////////////////// + // ADD PRESENTITY GROUP MEMBER, GROUP CONTENT SUBSCRIBED + ////////////////////////////////////////////////////////////////////////// + + // Setup status event listener for RequestComplete + // This will also produce HandlePresentityGroupMemberAddedL, since the + // the group is subscribed + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + + MXIMPIdentity* member2 = context->ObjectFactory().NewIdentityLC(); // << member2 + member2->SetIdentityL( KMemberId2 ); + + // do the call + reqId = presGroup.AddPresentityGroupMemberL( + *groupId, *member2, KMemberDisplayName2 ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("AddPresentityGroupMemberL (subscribed) failed, complete with error: ") ); + + + messenger->AssertAddPresentityGroupMemberCalled( ETrue ); + CleanupStack::PopAndDestroy(); // >>> member2 + + + + ////////////////////////////////////////////////////////////////////////// + // GRANT PRESENTITY GROUP MEMBER + ////////////////////////////////////////////////////////////////////////// + + // This is the group we are interested in + MXIMPIdentity* ggroup = context->ObjectFactory().NewIdentityLC(); + CleanupStack::Pop(); // ggroup + ggroup->SetIdentityL( KGroupId ); + // Set filter for the group + CPresenceInfoFilterImp* ggpif = CPresenceInfoFilterImp::NewLC(); + //ggpif->AcceptPersonFilterL( NPresenceInfo::NFieldType::KAcceptAll ); + CleanupStack::Pop(); // ggpif + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + + // grant for all + reqId = presAuth.GrantPresenceForPresentityGroupMembersL( *ggroup, *ggpif ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForPresentityGroupMembersCalled, + "GrantPresenceForPresentityGroupMembersL was not called", ETrue, NULL ); + + delete ggpif; + + + ////////////////////////////////////////////////////////////////////////// + // WITHDRAW PRESENTITY GROUP MEMBER + ////////////////////////////////////////////////////////////////////////// + + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + + // withdraw from all + reqId = presAuth.WithdrawPresenceGrantFromPresentityGroupMembersL( *ggroup ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForPresentityGroupMembersCalled, + "GrantPresenceForPresentityGroupMembersL was not called", ETrue, NULL ); + + delete ggroup; + + + ////////////////////////////////////////////////////////////////////////// + // UNSUBSCRIBE PRESENTITY GROUP MEMBERS + ////////////////////////////////////////////////////////////////////////// + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + + // unregister interest + reqId = presWatch.UnsubscribePresentityGroupMembersPresenceL( *group ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Unsubscribe presentity group members, complete with error: ") ); + + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestUnsubscribePresentityGroupMembersPresesenceCalled, "UnsubscribePresentityGroupMembersPresenceL was not called", ETrue, NULL ); + + + + ////////////////////////////////////////////////////////////////////////// + // UNSUBSCRIBE PRESENTITY GROUP CONTENT + ////////////////////////////////////////////////////////////////////////// + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + + // unsubscribe + reqId = presGroup.UnsubscribePresentityGroupContentL( *identity ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Unsubscribe presentity group content, complete with error: ") ); + + // verify that UnsubscribePresentityGroupContentL was called + messenger->AssertUnsubscribePresentityGroupContentCalled( ETrue ); + + CleanupStack::PopAndDestroy(); // >>> identity + + ////////////////////////////////////////////////////////////////////////// + // UNSUBSCRIBE PRESENCE BLOCK LIST + ////////////////////////////////////////////////////////////////////////// + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + + // subscribe + reqId = presAuth.UnsubscribePresenceBlockListL(); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Unsubscribing presence watcher list, complete with error: ") ); + + // verify that SubscribeBlockListL was called + COMMONASSERT( messenger, EXIMPPlgTestUnsubscribePresenceBlockListCalled, "UnubscribeBlockListL was not called", ETrue, NULL ); + + ////////////////////////////////////////////////////////////////////////// + // UNSUBSCRIBE PRESENTITY GROUP LIST + ////////////////////////////////////////////////////////////////////////// + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + + // unsubscribe + reqId = presGroup.UnsubscribePresentityGroupListL(); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Unsubscribing presentity group list, complete with error: ") ); + + // verify that SubscribePresentityGroupListL was called + messenger->AssertUnsubscribePresentityGroupListCalled( ETrue ); + + + ////////////////////////////////////////////////////////////////////////// + // UNSUBSCRIBE PRESENCE WATCHER LIST + ////////////////////////////////////////////////////////////////////////// + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + + // unsubscribe + reqId = presPub.UnsubscribePresenceWatcherListL(); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Unsubscribing presence watcher list, complete with error: ") ); + + // verify that UnsubscribeWatcherListL was called + COMMONASSERT( messenger, EXIMPPlgTestUnsubscribePresenceWatcherListCalled, "UnsubscribeWatcherListL was not called", ETrue, NULL ); + + + //////////////////////////////////////////////////////////////////////////// + // UNSUBSCRIBE OWN PRESENCE + //////////////////////////////////////////////////////////////////////////// + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + + // unsubscribe own presence + reqId = presPub.UnsubscribeOwnPresenceL(); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + + wrapper->VerifyEventStackL( _L8("Unsubscribing own presence, complete with error: ") ); + + // verify that UnsubscribeOwnPresenceL was called + COMMONASSERT( messenger, EXIMPPlgTestUnsubscribeOwnPresenceCalled, "UnsubscribeOwnPresenceL was not called", ETrue, NULL ); + + CleanupStack::PopAndDestroy( ownPif ); // >>> ownPif + delete group; + delete groupId; + + + UnbindL(); + + wrapper = NULL; + context = NULL; + messenger = NULL; + + + + } + +// Grant/Withdraw from group +void T_PresenceAll::T_GrantWithdrawGroup_L() + { + EUNIT_PRINT( _L("T_GrantWithdrawGroup_L") ); + + BindL(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresencePublishing& presPub = presFeat->PresencePublishing(); + MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization(); + MPresentityGroups& presGroup = presFeat->PresentityGroups(); + MPresenceWatching& presWatch = presFeat->PresenceWatching(); + + + + ////////////////////////////////////////////////////////////////////////// + // CREATE PRESENTITY GROUP + ///////////////////////////////////////////////////////////////////////// + + // Setup status event listener for RequestComplete + // This will also produce HandlePresentityGroupListEvent, since the + // the group is subscribed + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + + + MXIMPIdentity* groupId = context->ObjectFactory().NewIdentityLC(); + CleanupStack::Pop(); // groupId + groupId->SetIdentityL( KGroupId ); + + // subscribe + TXIMPRequestId reqId = presGroup.CreatePresentityGroupL( *groupId, KGroupDisplayName ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("CreatePresentityGroupL failed, complete with error: ") ); + + // verify that SubscribePresentityGroupListL was called + messenger->AssertCreatePresentityGroupCalled( ETrue ); + + + + ////////////////////////////////////////////////////////////////////////// + // ADD PRESENTITY GROUP MEMBER + ////////////////////////////////////////////////////////////////////////// + + CXIMPTestListener* listener4 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener4 ); // << listener4 + + MXIMPIdentity* member = context->ObjectFactory().NewIdentityLC(); // << member + member->SetIdentityL( KMemberId1 ); + + + // request complete + TXIMPRequestId reqIdDummy; + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + + // group id + CXIMPIdentityImp* identity2 = CXIMPIdentityImp::NewLC( groupId->Identity() ); + evReqComplete->AppendParamL( identity2 ); + CleanupStack::Pop(); // identity2 + + // id for member info + CXIMPIdentityImp* miId = CXIMPIdentityImp::NewLC( KMemberId1 ); + // member info + CPresentityGroupMemberInfoImp* memInfoImp = + CPresentityGroupMemberInfoImp::NewLC( *miId, KMemberDisplayName1 ); + evReqComplete->AppendParamL( memInfoImp ); + CleanupStack::Pop(); // memInfoImp owned by AppendParamL + CleanupStack::PopAndDestroy( miId ); // copy was made + + listener4->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + // do the call + reqId = presGroup.AddPresentityGroupMemberL( + *groupId, *member, KMemberDisplayName1 ); + + // and wait + EUNIT_ASSERT_DESC( KErrNone == listener4->WaitAndAssertL(), "AddPresentityGroupMemberL (not subscribed) failed" ); + + messenger->AssertAddPresentityGroupMemberCalled( ETrue ); + CleanupStack::PopAndDestroy(); // >>> member + CleanupStack::PopAndDestroy( listener4 );// >>> listener4 + + delete groupId; + + ////////////////////////////////////////////////////////////////////////// + // ADD PRESENTITY GROUP MEMBER, GROUP CONTENT SUBSCRIBED + ////////////////////////////////////////////////////////////////////////// + + // Setup status event listener for RequestComplete + // This will also produce HandlePresentityGroupMemberAddedL, since the + // the group is subscribed + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + + MXIMPIdentity* member2 = context->ObjectFactory().NewIdentityLC(); // << member2 + member2->SetIdentityL( KMemberId2 ); + + // do the call + reqId = presGroup.AddPresentityGroupMemberL( + *groupId, *member2, KMemberDisplayName2 ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("AddPresentityGroupMemberL (subscribed) failed, complete with error: ") ); + + + messenger->AssertAddPresentityGroupMemberCalled( ETrue ); + CleanupStack::PopAndDestroy(); // >>> member2 + + + + ////////////////////////////////////////////////////////////////////////// + // GRANT PRESENTITY GROUP MEMBER + ////////////////////////////////////////////////////////////////////////// + + // This is the group we are interested in + MXIMPIdentity* ggroup = context->ObjectFactory().NewIdentityLC(); + CleanupStack::Pop(); // ggroup + ggroup->SetIdentityL( KGroupId ); + // Set filter for the group + CPresenceInfoFilterImp* ggpif = CPresenceInfoFilterImp::NewLC(); + ggpif->AcceptPersonFilterL( NPresenceInfo::NFieldType::KAcceptAll ); + CleanupStack::Pop(); // ggpif + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + + // grant for all + reqId = presAuth.GrantPresenceForPresentityGroupMembersL( *ggroup, *ggpif ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForPresentityGroupMembersCalled, + "GrantPresenceForPresentityGroupMembersL was not called", ETrue, NULL ); + + delete ggpif; + + + + ////////////////////////////////////////////////////////////////////////// + // WITHDRAW PRESENTITY GROUP MEMBER + ////////////////////////////////////////////////////////////////////////// + + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + + // withdraw from all + reqId = presAuth.WithdrawPresenceGrantFromPresentityGroupMembersL( *ggroup ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForPresentityGroupMembersCalled, + "GrantPresenceForPresentityGroupMembersL was not called", ETrue, NULL ); + + delete ggroup; + + UnbindL(); + + wrapper = NULL; + context = NULL; + messenger = NULL; + + } + + +// =========================================================================== +// SETUP HELPERS FOR THE LISTENER +// =========================================================================== +// +void T_PresenceAll::SetupListenerReqCompleteL( CXIMPTestContextWrapper* aWrapper, TXIMPTestStatusEventTemplate aEventType ) + { + RArray< TInt32 > array; + CleanupClosePushL( array ); + array.Append( MXIMPContextStateEvent::KInterfaceId ); + array.Append( MPresentityPresenceEvent::KInterfaceId ); + aWrapper->SetupListenerReqCompleteL( aEventType, &array ); + CleanupStack::PopAndDestroy(); // array + } + +void T_PresenceAll::SetupListenerReqCompleteAllowEventsL( CXIMPTestContextWrapper* aWrapper, TXIMPTestStatusEventTemplate aEventType ) + { + RArray< TInt32 > array; + CleanupClosePushL( array ); + array.AppendL( MXIMPRequestCompleteEvent::KInterfaceId ); + array.AppendL( MXIMPContextStateEvent::KInterfaceId ); + array.AppendL( MPresentityPresenceEvent::KInterfaceId ); + aWrapper->SetupListenerReqCompleteL( aEventType, &array ); + CleanupStack::PopAndDestroy(); // array + } + +void T_PresenceAll::SendSrvMsgL( + const TDesC& aUri, const TDesC& aDispName, + TInt aMsgType ) + { + // we'll use hard-coded wrapper 0 instance for now. + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + + // create a group info contained within the server-originated + // faked message + CXIMPIdentityImp* groupId = CXIMPIdentityImp::NewLC( aUri ); + CPresentityGroupInfoImp* groupItem = CPresentityGroupInfoImp::NewLC( *groupId, aDispName ); + HBufC8* packet = NULL; + if( aMsgType == CXIMPTestFileSrvMsg::ETestSrvMsgPresentityGroupDelete ) + { + packet = TXIMPObjectPacker< CXIMPIdentityImp >::PackL( *groupId ); + } + else + { + packet = TXIMPObjectPacker< CPresentityGroupInfoImp >::PackL( *groupItem ); + } + CleanupStack::PushL( packet ); + + // use filetool to send it for plugin. + CXIMPTestFileSrvMsg* srvMsg = CXIMPTestFileSrvMsg::NewL( aMsgType, *packet ); + CleanupStack::PushL( srvMsg ); + wrapper->FileTool().CleanAllL(); + wrapper->FileTool().SrvMsgStoreL( srvMsg ); + CleanupStack::PopAndDestroy( 4, groupId ); // srvMsg, packet, groupItem, groupId + } + +// send a faked server-originated message with empty contents +// +void T_PresenceAll::SendSrvMsgL( TInt aMsgType ) + { + // we'll use hard-coded wrapper 0 instance for now. + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + + // create a server-originated faked message with empty contents + RXIMPObjOwningPtrArray groupList; + + HBufC8* packedArray = TXIMPObjectPacker::PackArrayL( groupList ); + CleanupStack::PushL( packedArray ); + + // use filetool to send it for plugin. + CXIMPTestFileSrvMsg* srvMsg = CXIMPTestFileSrvMsg::NewL( aMsgType, + *packedArray ); + CleanupStack::PushL( srvMsg ); + wrapper->FileTool().CleanAllL(); + wrapper->FileTool().SrvMsgStoreL( srvMsg ); + CleanupStack::PopAndDestroy( 2 ); // srvMsg, packedArray + } + + +void T_PresenceAll::T_BindUnbindL() + { + EUNIT_PRINT( _L("T_BindUnbindL") ); + + BindL(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + + UnbindL(); + + wrapper = NULL; + context = NULL; + messenger = NULL; + } +// =========================================================================== +// TEST CASE TABLE +// =========================================================================== +// +EUNIT_BEGIN_TEST_TABLE( + T_PresenceAll, + "XIMP presence all tests", + "MODULE" ) + +PRFW_DECORATED_TEST( + "TMO_demo_Startup", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_TMO_demo_Startup_L, + Teardown ) + +PRFW_DECORATED_TEST( + "BindUnbind", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_BindUnbindL, + Teardown ) + +PRFW_DECORATED_TEST( + "GrantWithdrawGroup", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_GrantWithdrawGroup_L, + Teardown ) + +EUNIT_END_TEST_TABLE + + +// =========================================================================== +// TEST SUITE CONSTRUCTION +// =========================================================================== +// +EXPORT_C MEUnitTest* CreateTestSuiteL() + { + return T_PresenceAll::NewL(); + } + + +// end of file diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/src/t_presenceall/t_presenceall.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/src/t_presenceall/t_presenceall.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,101 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework Test Code +* +*/ + +#ifndef T_PRESENCEALL_H +#define T_PRESENCEALL_H + +#include +#include +#include "prfwteststatuseventlistener.h" +#include "prfwtestmessaging.h" + +class CXIMPTestContextWrapper; +class CXIMPTestContextWrapperMgr; +class CXIMPTestMessenger; + +/** + * XIMP Framework Eunit tests. + * + * Tests for XIMP session management services. + * + * @since S60 v4.0 + */ +class T_PresenceAll : public CEUnitTestSuiteClass + { + +public: + static T_PresenceAll* NewL(); + virtual ~T_PresenceAll(); + + +private: + T_PresenceAll(); + void ConstructL(); + + + +private: // Test case functions + + void Setup_L(); + void SetupMultiple_L(); + void BindL(); + void BindAllL(); + void Teardown(); + void UnbindL(); + void UnbindAllL(); + + void T_TMO_demo_Startup_L(); + void T_GrantWithdrawGroup_L(); + + void T_BindUnbindL(); + +private: // Test helpers + +void SendSrvMsgL( + const TDesC& aUri, const TDesC& aDispName, + TInt aMsgType ); + + +// send a faked server-originated message with empty contents +// +void SendSrvMsgL( TInt aMsgType ); + + void SetupListenerReqCompleteL( CXIMPTestContextWrapper* aWrapper, TXIMPTestStatusEventTemplate aEventType ); + void SetupListenerReqCompleteAllowEventsL( CXIMPTestContextWrapper* aWrapper, TXIMPTestStatusEventTemplate aEventTypes ); + +private: // Test data + + /** + * Eunit test case table declaration. + */ + EUNIT_DECLARE_TEST_TABLE; + + // owned + CXIMPTestContextWrapperMgr* iWrapperMgr; + + }; + + +#endif // t_presenceall_H + + + +// end of file + + + + diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/src/t_presenceall/t_presenceall.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/src/t_presenceall/t_presenceall.mmp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,46 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework Test Code +* +*/ + +#include "../../tsrcutils/eunitcommon/eunittstdllbase.hrh" +#include "../../tsrcutils/processmaster/pm.h" + +TARGET t_presenceall.dll + +SOURCEPATH . +SOURCE t_presenceall.cpp + + +USERINCLUDE ../../../core/srcdatamodel +USERINCLUDE ../../../presence/srcpresencedatamodel +USERINCLUDE ../../../presence/srcpresencedatamodel/presentitygroups +USERINCLUDE ../../../presence/srcpresencedatamodel/presencewatching +USERINCLUDE ../../../presence/srcpresencedatamodel/presenceauthorization +USERINCLUDE ../../../presence/srcpresencedatamodel/presencepublishing +USERINCLUDE ../../../presence/srcpresencedatamodel/presenceinfo +USERINCLUDE ../../../core/srcutils + +LIBRARY ecom.lib +LIBRARY bafl.lib +LIBRARY ximpdatamodel.lib +LIBRARY presencedatamodel.lib +LIBRARY estor.lib +LIBRARY ximputils.lib + + +// end of file + + diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/src/t_presenceauthorization/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/src/t_presenceauthorization/bld.inf Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,25 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Build information file for t_presenceauthorization.dll +* +*/ + + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +PRJ_TESTMMPFILES +t_presenceauthorization.mmp diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/src/t_presenceauthorization/t_presenceauthorization.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/src/t_presenceauthorization/t_presenceauthorization.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,2061 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework Test Code +* +*/ + + +#include "eunittools.h" + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "prfwtestlistener.h" + +#include +#include +#include + +#include "t_presenceauthorization.h" +#include "prfwteststatuseventlistener.h" +#include "prfwtestmessaging.h" +#include "prfwtestmessenger.h" +#include "prfwtestcontextwrappermgr.h" +#include "prfwtestcontextwrapper.h" + +#include "presenceinfoimp.h" +#include "presenceinfofilterimp.h" +#include "prfwtestpresencedatautils.h" +#include "ximpidentityimp.h" +#include "presentitygroupmemberinfoimp.h" +#include "ximpobjecthelpers.h" +#include "prfwtestfilesrvmsg.h" +#include "prfwtestwaithelper.h" + +#include "prfwtestrobustnesstools.h" + + +#include "presentitygroupcontenteventimp.h" +#include "ximprequestcompleteeventimp.h" +#include "presentitygroupinfoimp.h" +#include "presentitygrouplisteventimp.h" +#include "presentitygroupmemberinfoimp.h" +#include "ximprequestcompleteeventimp.h" +#include "ximprestrictedobjectcollection.h" +#include "ximpobjectfactoryimp.h" + +_LIT8( KIdentity1, "Identity1" ); +_LIT8( KIdentity2, "Identity2" ); +_LIT8( KIdentity3, "Identity3" ); + +_LIT( KIdentity1_16, "Identity1" ); +_LIT( KIdentity2_16, "Identity2" ); +_LIT( KIdentity3_16, "Identity3" ); + + +_LIT( KGroupId, "Group" ); +_LIT( KGroupId1, "Group1" ); +_LIT( KGroupId2, "Group2" ); + + +_LIT( KGroupDisplayName, "GroupDisplayName" ); + + +_LIT8( KPrefix1, "PreA_" ); +_LIT8( KPrefix2, "PreB_" ); +_LIT8( KPrefix3, "PreC_" ); +_LIT8( KPrefix4, "PreD_" ); + +_LIT( KIdentity, "TestId@hello.world" ); + +// ============================ MEMBER FUNCTIONS =============================== + +// CONSTRUCTION +T_PresenceAuthorization* T_PresenceAuthorization::NewL() + { + T_PresenceAuthorization* self = new( ELeave ) T_PresenceAuthorization; + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + + return self; + } + + +T_PresenceAuthorization::~T_PresenceAuthorization() + { + } + + +void T_PresenceAuthorization::ConstructL() + { + CEUnitTestSuiteClass::ConstructL(); + } + + +T_PresenceAuthorization::T_PresenceAuthorization() + { + } + + + +// =========================================================================== +// TEST CASE SETUP & TEARDOWN METHODS +// =========================================================================== +// + +void T_PresenceAuthorization::Setup_L() + { + PrfwTestRobustness::DoPreCleaning(); + + iWrapperMgr = CXIMPTestContextWrapperMgr::NewL(); + iWrapperMgr->CreateWrapperL(); + } + +void T_PresenceAuthorization::SetupMultiple_L() + { + PrfwTestRobustness::DoPreCleaning(); + + iWrapperMgr = CXIMPTestContextWrapperMgr::NewL(); + iWrapperMgr->CreateWrapperL(); + iWrapperMgr->CreateWrapperL(); + iWrapperMgr->CreateWrapperL(); + } + + +void T_PresenceAuthorization::BindL() + { + CXIMPTestContextWrapper* wrapper0 = iWrapperMgr->GetWrapperL( 0 ); + + wrapper0->BindL( 0 ); + } + +void T_PresenceAuthorization::BindAllL() + { + for( TInt a = 0; a < iWrapperMgr->WrapperCount(); ++a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + wrapper->BindL( 0 ); + } + } + + +void T_PresenceAuthorization::Teardown() + { + delete iWrapperMgr; + iWrapperMgr = NULL; + + REComSession::FinalClose(); + + PrfwTestRobustness::DoPreCleaning(); + } + +void T_PresenceAuthorization::UnbindL() + { + // Do unbind + CXIMPTestContextWrapper* wrapper0 = iWrapperMgr->GetWrapperL( 0 ); + wrapper0->UnbindL(); + } + +void T_PresenceAuthorization::UnbindAllL() + { + for( TInt a = 0; a < iWrapperMgr->WrapperCount(); ++a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + wrapper->UnbindL(); + } + } + + +// =========================================================================== +// TEST CASES for presentity authorization +// =========================================================================== + +void T_PresenceAuthorization::T_GrantPresenceForPresentity_L() + { + EUNIT_PRINT( _L("Grant presence for presentity") ); + +// INITIALIZE + + BindL(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization(); + + CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 ); + CPresenceInfoFilterImp* pif = + XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 ); + +// GRANT + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + + // register interest + TXIMPRequestId reqId = presAuth.GrantPresenceForPresentityL( *identity, *pif ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForPresentityCalled, + "GrantPresenceForPresentityL was not called", ETrue, NULL ); + +// GRANT AGAIN + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + messenger->SetValueFor( EXIMPPlgTestGrantPresenceForPresentityCalled, 0 ); + + // register interest + reqId = presAuth.GrantPresenceForPresentityL( *identity, *pif ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForPresentityCalled, + "GrantPresenceForPresentityL was not called", EFalse, + "GrantPresenceForPresentityL was called" ); + +// WITHDRAW + + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + // register interest + reqId = presAuth.WithdrawPresenceGrantFromPresentityL( *identity ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Grantin presence to presentity, complete with error: ") ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestWithdrawPresenceFromPresentityCalled, + "WithdrawPresenceForPresentityL was not called", ETrue, NULL ); + +// DEINITIALIZE + + CleanupStack::PopAndDestroy( 2, identity ); //pif, identity + UnbindL(); + } + +// ============================================================================================== + +void T_PresenceAuthorization::T_WithdrawNotGrantedPresenceFromPresentity_L() + { + EUNIT_PRINT( _L("Withdraw presence from presentity not granted") ); + +// INITIALIZE + + BindL(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization(); + + CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 ); + +// WITHDRAW + + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + // register interest + TXIMPRequestId reqId = presAuth.WithdrawPresenceGrantFromPresentityL( *identity ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Grantin presence to presentity, complete with error: ") ); + // Changed for OPAA-73BCS( + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestWithdrawPresenceFromPresentityCalled, + "WithdrawPresenceForPresentityL was not called", ETrue/*EFalse*/, + "WithdrawPresenceForPresentityL was called" ); + +// DEINITIALIZE + + CleanupStack::PopAndDestroy( identity ); //identity + UnbindL(); + } + +// ============================================================================================== + + +void T_PresenceAuthorization::T_GrantPresenceForPresentityChangeId_L() + { + EUNIT_PRINT( _L("Grant presence for presentity change id") ); + +// INITIALIZE + + BindL(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // Get the management interface + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization(); + + + CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 ); + CPresenceInfoFilterImp* pif = + XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 ); + +// ID CHANGE REQUEST TO ADAPTATION + + MXIMPIdentity* identityParam = context->ObjectFactory().NewIdentityLC(); + identityParam->SetIdentityL( KIdentity ); + + CXIMPIdentityImp* identityParamImp = + ( CXIMPIdentityImp* ) identityParam->GetInterface( + CXIMPIdentityImp::KClassId, + MXIMPBase::EPanicIfUnknown ); + HBufC8* packedId = TXIMPObjectPacker< CXIMPIdentityImp >::PackL( *identityParamImp ); + CleanupStack::PopAndDestroy(); // identityParam + CleanupStack::PushL( packedId ); + CXIMPTestFileSrvMsg* srvMsg = CXIMPTestFileSrvMsg::NewL( CXIMPTestFileSrvMsg::ETestSrvMsgReqParamIdentity, + *packedId ); + CleanupStack::PopAndDestroy( packedId ); + CleanupStack::PushL( srvMsg ); + wrapper->FileTool().SrvMsgStoreL( srvMsg ); + CleanupStack::PopAndDestroy( srvMsg ); + + // Wait for server to handle srvmsg. + CXIMPTestWaitHelper* wait = CXIMPTestWaitHelper::NewL(); + CleanupStack::PushL( wait ); + wait->WaitForL( 2 ); + CleanupStack::PopAndDestroy( wait ); + +// GRANT + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + + // register interest + TXIMPRequestId reqId = presAuth.GrantPresenceForPresentityL( *identity, *pif ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForPresentityCalled, + "GrantPresenceForPresentityL was not called", ETrue, NULL ); + +// DEINITIALIZE + + CleanupStack::PopAndDestroy( 2, identity ); //pif, identity + UnbindL(); + } + +// ============================================================================================== + +void T_PresenceAuthorization::T_WithdrawNotGrantedPresenceFromPresentity_Multiple_L() + { + EUNIT_PRINT( _L("Withdraw presence from presentity not granted multiple clients") ); + + BindAllL(); + + CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 ); + CPresenceInfoFilterImp* pif = + XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 ); + +// GRANT ALL BUT FIRST + + TInt countOfWrappers = iWrapperMgr->WrapperCount(); + TInt a(0); + for( a = countOfWrappers - 1; a >= 1; --a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization(); + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + + // register interest + TXIMPRequestId reqId = presAuth.GrantPresenceForPresentityL( *identity, *pif ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForPresentityCalled, + "GrantPresenceForPresentityL was not called", + ( a > 1 ) ? ETrue : EFalse, + "GrantPresenceForPresentityL was called" ); + } + +// WITHDRAW + + for( a = 0; a < countOfWrappers; ++a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization(); + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); // allow events after reqcomplete + + // register interest + TXIMPRequestId reqId = presAuth.WithdrawPresenceGrantFromPresentityL( *identity ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Subscribing presentity presence, complete with error: ") ); + // Changed for OPAA-73BCS8 + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestWithdrawPresenceFromPresentityCalled, + "WithdrawPresenceForPresentityL was not called", + ( a < ( countOfWrappers -1 ) /*a < 2*/ ) ? EFalse : ETrue, + "WithdrawPresenceForPresentityL was called" ); + } + + CleanupStack::PopAndDestroy( pif ); + CleanupStack::PopAndDestroy( identity ); + + UnbindAllL(); + } + + +// ============================================================================================== + +void T_PresenceAuthorization::T_ErrFromPlg_LeaveOnGrantPresenceForPresentity_L() + { + EUNIT_PRINT( _L("Error from plug-in in grant presence for presentity") ); + +// INITIALIZE + + BindL(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization(); + + + CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 ); + CPresenceInfoFilterImp* pif = + XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 ); + +// GRANT + + messenger->SetLeave( KErrAbort ); + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_PresentitySubscribeFailKErrAbort ); + + // register interest + TXIMPRequestId reqId = presAuth.GrantPresenceForPresentityL( *identity, *pif ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForPresentityCalled, + "GrantPresenceForPresentityL was not called", EFalse, + "GrantPresenceForPresentityL was called" ); + + messenger->SetLeave( KErrNone ); + +// DEINITIALIZE + + CleanupStack::PopAndDestroy( 2, identity ); //pif, identity + UnbindL(); + } + + +// ============================================================================================== + +void T_PresenceAuthorization::T_ErrFromPlg_LeaveOnWithdrawPresenceFromPresentity_L() + { + EUNIT_PRINT( _L("Error from plug-in in withdraw presence from presentity") ); + +// INITIALIZE + + BindL(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization(); + + + CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 ); + CPresenceInfoFilterImp* pif = + XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 ); + +// GRANT + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + + // register interest + TXIMPRequestId reqId = presAuth.GrantPresenceForPresentityL( *identity, *pif ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForPresentityCalled, + "GrantPresenceForPresentityL was not called", ETrue, + "GrantPresenceForPresentityL was called" ); + +// WITHDRAW + + messenger->SetLeave( KErrAbort ); + + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_PresentitySubscribeFailKErrAbort ); + // register interest + reqId = presAuth.WithdrawPresenceGrantFromPresentityL( *identity ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Grantin presence to presentity, complete with error: ") ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestWithdrawPresenceFromPresentityCalled, + "WithdrawPresenceGrantFromPresentityL was not called", EFalse, + "WithdrawPresenceGrantFromPresentityL was called" ); + + messenger->SetLeave( KErrNone ); + +// DEINITIALIZE + + CleanupStack::PopAndDestroy( 2, identity ); //pif, identity + UnbindL(); + } + +// ============================================================================================== + +void T_PresenceAuthorization::T_GrantPresenceForPresentity_Multiple_L() + { + EUNIT_PRINT( _L("Grant presence for presentity multiple clients") ); + + BindAllL(); + + CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 ); + CPresenceInfoFilterImp* pif = + XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 ); + +// GRANT + + TInt countOfWrappers = iWrapperMgr->WrapperCount(); + TInt a(0); + for( a = 0; a < countOfWrappers; ++a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization(); + + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + + // register interest + TXIMPRequestId reqId = presAuth.GrantPresenceForPresentityL( *identity, *pif ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForPresentityCalled, + "GrantPresenceForPresentityL was not called", + ( a == 0 ) ? ETrue : EFalse, + "GrantPresenceForPresentityL was called" ); + } + +// GRANT AGAIN + + for( a = 0; a < countOfWrappers; ++a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization(); + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + messenger->SetValueFor( EXIMPPlgTestGrantPresenceForPresentityCalled, 0 ); + + // register interest + TXIMPRequestId reqId = presAuth.GrantPresenceForPresentityL( *identity, *pif ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForPresentityCalled, + "GrantPresenceForPresentityL was not called", EFalse, + "GrantPresenceForPresentityL was called" ); + } + + +// WITHDRAW + + for( a = 0; a < countOfWrappers; ++a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization(); + + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); // allow events after reqcomplete + + // register interest + TXIMPRequestId reqId = presAuth.WithdrawPresenceGrantFromPresentityL( *identity ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Subscribing presentity presence, complete with error: ") ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestWithdrawPresenceFromPresentityCalled, + "WithdrawPresenceForPresentityL was not called", + ( a < 2 ) ? EFalse : ETrue, + "WithdrawPresenceForPresentityL was called" ); + } + + CleanupStack::PopAndDestroy( pif ); + CleanupStack::PopAndDestroy( identity ); + + UnbindAllL(); + } + + +// ============================================================================================== + +void T_PresenceAuthorization::T_WithdrawNotGrantedPresenceFromGroupMembers_L() + { + EUNIT_PRINT( _L("Withdraw presence from group members not granted") ); + +// INITIALIZE + + BindL(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization(); + + + CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 ); + +// WITHDRAW + + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + // register interest + TXIMPRequestId reqId = presAuth.WithdrawPresenceGrantFromPresentityGroupMembersL( *identity ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Withdraw not granted group members, complete with error: ") ); + // Changed for OPAA-73BCS8 + COMMONASSERT( messenger, EXIMPPlgTestWithdrawPresenceFromPresentityGroupMembersCalled, + "WithdrawPresenceGrantFromPresentityGroupMembersL was not called", ETrue/*EFalse*/, + "WithdrawPresenceGrantFromPresentityGroupMembersL was called" ); + +// DEINITIALIZE + + CleanupStack::PopAndDestroy( identity ); //identity + UnbindL(); + } + + +// ============================================================================================== + +void T_PresenceAuthorization::T_WithdrawNotGrantedPresenceFromGroupMembers_Multiple_L() + { + EUNIT_PRINT( _L("Withdraw presence from group members not granted multiple clients") ); + + BindAllL(); + + CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 ); + CPresenceInfoFilterImp* pif = + XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 ); + +// GRANT ALL BUT FIRST + + TInt countOfWrappers = iWrapperMgr->WrapperCount(); + TInt a(0); + for( a = countOfWrappers - 1; a >= 1; --a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization(); + + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + + // register interest + TXIMPRequestId reqId = presAuth.GrantPresenceForPresentityGroupMembersL( *identity, *pif ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForPresentityGroupMembersCalled, + "GrantPresenceForPresentityGroupMembersL was not called", + ( a > 1 ) ? ETrue : EFalse, + "GrantPresenceForPresentityGroupMembersL was called" ); + } + +// WITHDRAW + + for( a = 0; a < countOfWrappers; ++a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization(); + + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); // allow events after reqcomplete + + // register interest + TXIMPRequestId reqId = presAuth.WithdrawPresenceGrantFromPresentityGroupMembersL( *identity ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Subscribing presentity presence, complete with error: ") ); + // Changed for OPAA-73BCS8 + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestWithdrawPresenceFromPresentityGroupMembersCalled, + "WithdrawPresenceForPresentityGroupMembersL was not called", + ( a < ( countOfWrappers - 1 )/*a < 2*/ ) ? EFalse : ETrue, + "WithdrawPresenceForPresentityGroupMembersL was called" ); + } + + CleanupStack::PopAndDestroy( pif ); + CleanupStack::PopAndDestroy( identity ); + + UnbindAllL(); + } + +// ============================================================================================== + + +void T_PresenceAuthorization::T_GrantPresenceForGroupMembers_Multiple_L() + { + EUNIT_PRINT( _L("Grant presence for group members multiple clients") ); + + BindAllL(); + + CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 ); + CPresenceInfoFilterImp* pif = + XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 ); + +// GRANT + + TInt countOfWrappers = iWrapperMgr->WrapperCount(); + TInt a(0); + for( a = 0; a < countOfWrappers; ++a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization(); + + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + + // register interest + TXIMPRequestId reqId = presAuth.GrantPresenceForPresentityGroupMembersL( *identity, *pif ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForPresentityGroupMembersCalled, + "GrantPresenceForPresentityGroupMembersL was not called", + ( a == 0 ) ? ETrue : EFalse, + "GrantPresenceForPresentityGroupMembersL was called" ); + } + +// GRANT AGAIN + + for( a = 0; a < countOfWrappers; ++a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization(); + + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + messenger->SetValueFor( EXIMPPlgTestGrantPresenceForPresentityGroupMembersCalled, 0 ); + + // register interest + TXIMPRequestId reqId = presAuth.GrantPresenceForPresentityGroupMembersL( *identity, *pif ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForPresentityGroupMembersCalled, + "GrantPresenceForPresentityGroupMembersL was not called", EFalse, + "GrantPresenceForPresentityGroupMembersL was called" ); + } + + +// WITHDRAW + + for( a = 0; a < countOfWrappers; ++a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization(); + + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); // allow events after reqcomplete + + // register interest + TXIMPRequestId reqId = presAuth.WithdrawPresenceGrantFromPresentityGroupMembersL( *identity ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Subscribing presentity presence, complete with error: ") ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestWithdrawPresenceFromPresentityGroupMembersCalled, + "WithdrawPresenceForPresentityGroupMembersL was not called", + ( a < 2 ) ? EFalse : ETrue, + "WithdrawPresenceForPresentityGroupMembersL was called" ); + } + + CleanupStack::PopAndDestroy( pif ); + CleanupStack::PopAndDestroy( identity ); + + UnbindAllL(); + } + +// ============================================================================================== + +void T_PresenceAuthorization::T_ErrFromPlg_LeaveOnGrantPresenceForGroupMembers_L() + { + EUNIT_PRINT( _L("Error from plug-in in grant presence for group members") ); + +// INITIALIZE + + BindL(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization(); + + CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 ); + CPresenceInfoFilterImp* pif = + XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 ); + +// GRANT + + messenger->SetLeave( KErrAbort ); + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_PresentitySubscribeFailKErrAbort ); + + // register interest + TXIMPRequestId reqId = presAuth.GrantPresenceForPresentityGroupMembersL( *identity, *pif ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForPresentityGroupMembersCalled, + "GrantPresenceForPresentityGroupMembersL was not called", EFalse, + "GrantPresenceForPresentityGroupMembersL was called" ); + + messenger->SetLeave( KErrNone ); + +// DEINITIALIZE + + CleanupStack::PopAndDestroy( 2, identity ); //pif, identity + UnbindL(); + } + +// ============================================================================================== + +void T_PresenceAuthorization::T_ErrFromPlg_LeaveOnWithdrawPresenceFromGroupMembers_L() + { + EUNIT_PRINT( _L("Error from plug-in in withdraw presence from group members") ); + +// INITIALIZE + + BindL(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization(); + + CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 ); + CPresenceInfoFilterImp* pif = + XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 ); + +// GRANT + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + + // register interest + TXIMPRequestId reqId = presAuth.GrantPresenceForPresentityGroupMembersL( *identity, *pif ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForPresentityGroupMembersCalled, + "GrantPresenceForPresentityGroupMembersL was not called", ETrue, + "GrantPresenceForPresentityGroupMembersL was called" ); + +// WITHDRAW + + messenger->SetLeave( KErrAbort ); + + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_PresentitySubscribeFailKErrAbort ); + // register interest + reqId = presAuth.WithdrawPresenceGrantFromPresentityGroupMembersL( *identity ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Grantin presence to presentity, complete with error: ") ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestWithdrawPresenceFromPresentityGroupMembersCalled, + "WithdrawPresenceGrantFromPresentityGroupMembersL was not called", EFalse, + "WithdrawPresenceGrantFromPresentityGroupMembersL was called" ); + + messenger->SetLeave( KErrNone ); + +// DEINITIALIZE + + CleanupStack::PopAndDestroy( 2, identity ); //pif, identity + UnbindL(); + } + +// ============================================================================================== + +// To Everyone, empty filter +void T_PresenceAuthorization::T_GrantPresenceForEveryone_L() + { + EUNIT_PRINT( _L("Grant presence for everyone") ); + + BindL(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization(); + + CPresenceInfoFilterImp* pif = XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 ); + +// GRANT + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + + TXIMPRequestId reqId = presAuth.GrantPresenceForEveryoneL( *pif ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForEveryoneCalled, "GrantPresenceForEveryoneL was not called", ETrue, NULL ); + +// GRANT AGAIN + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + messenger->SetValueFor( EXIMPPlgTestGrantPresenceForEveryoneCalled, 0 ); + + reqId = presAuth.GrantPresenceForEveryoneL( *pif ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForEveryoneCalled, "GrantPresenceForEveryoneL was not called", EFalse, "GrantPresenceForEveryoneL was called" ); + +// WITHDRAW + + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + // register interest + reqId = presAuth.WithdrawPresenceGrantFromEveryoneL(); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Granting presence to everyone, complete with error: ") ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestWithdrawPresenceFromEveryoneCalled, "WithdrawPresenceForEveryoneL was not called", ETrue, NULL ); + + CleanupStack::PopAndDestroy( pif ); //pif + UnbindL(); + } + +// ============================================================================================== + +void T_PresenceAuthorization::T_ErrFromPlg_LeaveOnGrantPresenceForEveryone_L() + { + EUNIT_PRINT( _L("Error from plug-in in grant presence for everyone") ); + +// INITIALIZE + + BindL(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization(); + + CPresenceInfoFilterImp* pif = + XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 ); + +// GRANT + + messenger->SetLeave( KErrAbort ); + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_PresentitySubscribeFailKErrAbort ); + + // register interest + TXIMPRequestId reqId = presAuth.GrantPresenceForEveryoneL( *pif ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForEveryoneCalled, + "GrantPresenceForEveryoneL was not called", EFalse, + "GrantPresenceForEveryoneL was called" ); + + messenger->SetLeave( KErrNone ); + +// DEINITIALIZE + + CleanupStack::PopAndDestroy( pif ); //pif + UnbindL(); + } + +// ============================================================================================== + +void T_PresenceAuthorization::T_GrantPresenceForEveryone_Multiple_L() + { + EUNIT_PRINT( _L("Grant presence for presentity multiple clients") ); + + BindAllL(); + + CPresenceInfoFilterImp* pif = + XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 ); + +// GRANT + + TInt countOfWrappers = iWrapperMgr->WrapperCount(); + TInt a(0); + for( a = 0; a < countOfWrappers; ++a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization(); + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + + // register interest + TXIMPRequestId reqId = presAuth.GrantPresenceForEveryoneL( *pif ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForEveryoneCalled, + "GrantPresenceForEveryoneL was not called", + ( a == 0 ) ? ETrue : EFalse, + "GrantPresenceForEveryoneL was called" ); + } + +// GRANT AGAIN + + for( a = 0; a < countOfWrappers; ++a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization(); + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + messenger->SetValueFor( EXIMPPlgTestGrantPresenceForEveryoneCalled, 0 ); + + + // register interest + TXIMPRequestId reqId = presAuth.GrantPresenceForEveryoneL( *pif ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForEveryoneCalled, + "GrantPresenceForEveryoneL was not called", EFalse, + "GrantPresenceForEveryoneL was called" ); + } + + +// WITHDRAW + + for( a = 0; a < countOfWrappers; ++a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization(); + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); // allow events after reqcomplete + + // register interest + TXIMPRequestId reqId = presAuth.WithdrawPresenceGrantFromEveryoneL(); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Subscribing presentity presence, complete with error: ") ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestWithdrawPresenceFromEveryoneCalled, + "WithdrawPresenceGrantFromEveryoneL was not called", + ( a < 2 ) ? EFalse : ETrue, + "WithdrawPresenceGrantFromEveryoneL was called" ); + } + + CleanupStack::PopAndDestroy( pif ); + + UnbindAllL(); + } + + +// ============================================================================================== + +void T_PresenceAuthorization::T_ErrFromPlg_LeaveOnWithdrawPresenceFromEveryone_L() + { + EUNIT_PRINT( _L("Error from plug-in in withdraw presence from everyone") ); + +// INITIALIZE + + BindL(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization(); + + CPresenceInfoFilterImp* pif = + XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 ); + +// GRANT + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + + // register interest + TXIMPRequestId reqId = presAuth.GrantPresenceForEveryoneL( *pif ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForEveryoneCalled, + "GrantPresenceForEveryoneL was not called", ETrue, + "GrantPresenceForEveryoneL was called" ); + +// WITHDRAW + + messenger->SetLeave( KErrAbort ); + + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_PresentitySubscribeFailKErrAbort ); + // register interest + reqId = presAuth.WithdrawPresenceGrantFromEveryoneL(); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Grantin presence to presentity, complete with error: ") ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestWithdrawPresenceFromPresentityCalled, + "WithdrawPresenceGrantFromEveryoneL was not called", EFalse, + "WithdrawPresenceGrantFromEveryoneL was called" ); + + messenger->SetLeave( KErrNone ); + +// DEINITIALIZE + + CleanupStack::PopAndDestroy( pif ); //pif + UnbindL(); + } + + + +// ============================================================================================== + +void T_PresenceAuthorization::T_GrantPresenceForGroupMembers_L() + { + EUNIT_PRINT( _L("Grant presence for presentity group members") ); + + BindL(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization(); + + CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 ); + CPresenceInfoFilterImp* pif = + XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 ); + +// GRANT + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + + // register interest + TXIMPRequestId reqId = presAuth.GrantPresenceForPresentityGroupMembersL( *identity, *pif ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForPresentityGroupMembersCalled, "GrantPresenceForPresentityGroupMembers was not called", ETrue, NULL ); + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); // allow events after reqcomplete + +// GRANT AGAIN + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + messenger->SetValueFor( EXIMPPlgTestGrantPresenceForPresentityGroupMembersCalled, 0 ); + + reqId = presAuth.GrantPresenceForPresentityGroupMembersL( *identity, *pif ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForPresentityGroupMembersCalled, "GrantPresenceForPresentityGroupMembers was not called", EFalse, "GrantPresenceForPresentityGroupMembers was called" ); + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); // allow events after reqcomplete + +// WITHDRAW + // register interest + reqId = presAuth.WithdrawPresenceGrantFromPresentityGroupMembersL( *identity ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Granting presence for presentity group members complete with error: ") ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestWithdrawPresenceFromPresentityGroupMembersCalled, "WithdrawPresenceFromPresentityGroupMembers was not called", ETrue, NULL ); + + CleanupStack::PopAndDestroy( 2, identity ); //pif, identity + UnbindL(); + } + +// ============================================================================================== + +void T_PresenceAuthorization::T_GrantPresenceForGroupMembersChangeId_L() + { + EUNIT_PRINT( _L("Grant presence for presentity group members change id") ); + +// INITIALIZE + + BindL(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization(); + +// ID CHANGE REQUEST TO ADAPTATION + + MXIMPIdentity* identityParam = context->ObjectFactory().NewIdentityLC(); + identityParam->SetIdentityL( KIdentity ); + + CXIMPIdentityImp* identityParamImp = + ( CXIMPIdentityImp* ) identityParam->GetInterface( + CXIMPIdentityImp::KClassId, + MXIMPBase::EPanicIfUnknown ); + HBufC8* packedId = TXIMPObjectPacker< CXIMPIdentityImp >::PackL( *identityParamImp ); + CleanupStack::PopAndDestroy(); // identityParam + CleanupStack::PushL( packedId ); + CXIMPTestFileSrvMsg* srvMsg = CXIMPTestFileSrvMsg::NewL( CXIMPTestFileSrvMsg::ETestSrvMsgReqParamIdentity, + *packedId ); + CleanupStack::PopAndDestroy( packedId ); + CleanupStack::PushL( srvMsg ); + wrapper->FileTool().SrvMsgStoreL( srvMsg ); + CleanupStack::PopAndDestroy( srvMsg ); + + // Wait for server to handle srvmsg. + CXIMPTestWaitHelper* wait = CXIMPTestWaitHelper::NewL(); + CleanupStack::PushL( wait ); + wait->WaitForL( 2 ); + CleanupStack::PopAndDestroy( wait ); + +// GRANT + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + + CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 ); + CPresenceInfoFilterImp* pif = + XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 ); + + // register interest + TXIMPRequestId reqId = presAuth.GrantPresenceForPresentityGroupMembersL( *identity, *pif ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForPresentityGroupMembersCalled, "GrantPresenceForPresentityGroupMembers was not called", ETrue, NULL ); + +// DEINITIALIZE + + CleanupStack::PopAndDestroy( 2, identity ); //pif, identity + UnbindL(); + } + + +// ============================================================================================== + +void T_PresenceAuthorization::T_WithdrawNotGrantedPresenceFromEveryone_L() + { + EUNIT_PRINT( _L("Withdraw presence from everyone not granted") ); + +// INITIALIZE + + BindL(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization(); + +// WITHDRAW + + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + // register interest + TXIMPRequestId reqId = presAuth.WithdrawPresenceGrantFromEveryoneL(); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + // Changed for OPAA-73BCS8 + wrapper->VerifyEventStackL( _L8("Withdraw not granted everyone, complete with error: ") ); + COMMONASSERT( messenger, EXIMPPlgTestWithdrawPresenceFromEveryoneCalled, + "WithdrawPresenceGrantFromEveryoneL was not called", ETrue /*EFalse*/, + "WithdrawPresenceGrantFromEveryoneL was called" ); + +// DEINITIALIZE + UnbindL(); + } + + +// ============================================================================================== + +void T_PresenceAuthorization::T_WithdrawNotGrantedPresenceFromEveryone_Multiple_L() + { + EUNIT_PRINT( _L("Withdraw presence from everyone not granted multiple clients") ); + + BindAllL(); + + CPresenceInfoFilterImp* pif = + XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 ); + +// GRANT ALL BUT FIRST + + TInt countOfWrappers = iWrapperMgr->WrapperCount(); + TInt a(0); + for( a = countOfWrappers - 1; a >= 1; --a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization(); + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + + // register interest + TXIMPRequestId reqId = presAuth.GrantPresenceForEveryoneL( *pif ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForEveryoneCalled, + "GrantPresenceForEveryoneL was not called", + ( a > 1 ) ? ETrue : EFalse, + "GrantPresenceForEveryoneL was called" ); + } + +// WITHDRAW + + for( a = 0; a < countOfWrappers; ++a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization(); + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); // allow events after reqcomplete + + // register interest + TXIMPRequestId reqId = presAuth.WithdrawPresenceGrantFromEveryoneL(); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Subscribing presentity presence, complete with error: ") ); + // verify that UpdateInterest was called + // Changed for OPAA-73BCS8 + COMMONASSERT( messenger, EXIMPPlgTestWithdrawPresenceFromEveryoneCalled, + "WithdrawPresenceGrantFromEveryoneL was not called", + ( a < ( countOfWrappers -1 )/*a < 2^*/ ) ? EFalse : ETrue, + "WithdrawPresenceGrantFromEveryoneL was called" ); + } + + CleanupStack::PopAndDestroy( pif ); + + UnbindAllL(); + } + + +// ============================================================================================== +void T_PresenceAuthorization::T_MakeAndGrantGroup_WithdrawOneID_L() + { + EUNIT_PRINT( _L("T_MakeAndGrantGroup_WithdrawOneID_L") ); + + BindL(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization(); + MPresentityGroups& presGroup = presFeat->PresentityGroups(); + + + // CREATE PRESENTITY GROUP + + // Setup status event listener for RequestComplete + // This will also produce HandlePresentityGroupListEvent, since the + // the group is subscribed + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + + + MXIMPIdentity* groupId = context->ObjectFactory().NewIdentityLC(); + CleanupStack::Pop(); // groupId + groupId->SetIdentityL( KGroupId ); + + // subscribe + TXIMPRequestId reqId; + reqId = presGroup.CreatePresentityGroupL( *groupId, KGroupDisplayName ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("CreatePresentityGroupL failed, complete with error: ") ); + + // verify that SubscribePresentityGroupListL was called + messenger->AssertCreatePresentityGroupCalled( ETrue ); + + + // ADD PRESENTITY GROUP MEMBER 1 + + CXIMPTestListener* listener4 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener4 ); // << listener4 + + MXIMPIdentity* member = context->ObjectFactory().NewIdentityLC(); // << member + member->SetIdentityL( KIdentity1_16 ); + + + // request complete + TXIMPRequestId reqIdDummy; + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + + // group id + CXIMPIdentityImp* identity2 = CXIMPIdentityImp::NewLC( groupId->Identity() ); + evReqComplete->AppendParamL( identity2 ); + CleanupStack::Pop(identity2); // identity2 + + // id for member info + CXIMPIdentityImp* miId = CXIMPIdentityImp::NewLC( KIdentity1_16 ); + // member info + CPresentityGroupMemberInfoImp* memInfoImp = + CPresentityGroupMemberInfoImp::NewLC( *miId, KIdentity1_16 ); + evReqComplete->AppendParamL( memInfoImp ); + CleanupStack::Pop(memInfoImp); // memInfoImp owned by AppendParamL + CleanupStack::PopAndDestroy( miId ); // copy was made + + listener4->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + // do the call + reqId = presGroup.AddPresentityGroupMemberL( + *groupId, *member, KIdentity1_16 ); + + // and wait + EUNIT_ASSERT_DESC( KErrNone == listener4->WaitAndAssertL(), "AddPresentityGroupMemberL (not subscribed) failed" ); + + messenger->AssertAddPresentityGroupMemberCalled( ETrue ); + CleanupStack::PopAndDestroy(); // >>> member + CleanupStack::PopAndDestroy( listener4 );// >>> listener4 + + // ADD PRESENTITY GROUP MEMBER 2 + + listener4 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener4 ); // << listener4 + + member = context->ObjectFactory().NewIdentityLC(); // << member + member->SetIdentityL( KIdentity2_16 ); + + + // request complete + evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + + // group id + //delete identity2; + identity2 = CXIMPIdentityImp::NewLC( groupId->Identity() ); + evReqComplete->AppendParamL( identity2 ); + CleanupStack::Pop(identity2); // identity2 + + // id for member info + miId = CXIMPIdentityImp::NewLC( KIdentity2_16 ); + // member info + memInfoImp = CPresentityGroupMemberInfoImp::NewLC( *miId, KIdentity2_16 ); + evReqComplete->AppendParamL( memInfoImp ); + CleanupStack::Pop(memInfoImp); // memInfoImp owned by AppendParamL + CleanupStack::PopAndDestroy( miId ); // copy was made + + listener4->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + // do the call + reqId = presGroup.AddPresentityGroupMemberL( *groupId, *member, KIdentity2_16 ); + + // and wait + EUNIT_ASSERT_DESC( KErrNone == listener4->WaitAndAssertL(), "AddPresentityGroupMemberL (not subscribed) failed" ); + + messenger->AssertAddPresentityGroupMemberCalled( ETrue ); + CleanupStack::PopAndDestroy(); // >>> member + CleanupStack::PopAndDestroy( listener4 );// >>> listener4 + + // ADD PRESENTITY GROUP MEMBER 3 + + //delete identity2; + listener4 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener4 ); // << listener4 + + member = context->ObjectFactory().NewIdentityLC(); // << member + member->SetIdentityL( KIdentity3_16 ); + + + // request complete + evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + + // group id + identity2 = CXIMPIdentityImp::NewLC( groupId->Identity() ); + evReqComplete->AppendParamL( identity2 ); + CleanupStack::Pop(identity2); // identity2 + + // id for member info + miId = CXIMPIdentityImp::NewLC( KIdentity3_16 ); + // member info + memInfoImp = CPresentityGroupMemberInfoImp::NewLC( *miId, KIdentity3_16 ); + evReqComplete->AppendParamL( memInfoImp ); + CleanupStack::Pop(memInfoImp); // memInfoImp owned by AppendParamL + CleanupStack::PopAndDestroy( miId ); // copy was made + + listener4->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + // do the call + reqId = presGroup.AddPresentityGroupMemberL( + *groupId, *member, KIdentity3_16 ); + + // and wait + EUNIT_ASSERT_DESC( KErrNone == listener4->WaitAndAssertL(), "AddPresentityGroupMemberL (not subscribed) failed" ); + + messenger->AssertAddPresentityGroupMemberCalled( ETrue ); + CleanupStack::PopAndDestroy(); // >>> member + CleanupStack::PopAndDestroy( listener4 );// >>> listener4 + + + // GRANT PRESENTITY GROUP MEMBER + + // This is the group we are interested in + MXIMPIdentity* ggroup = context->ObjectFactory().NewIdentityLC(); + CleanupStack::Pop(); // ggroup + ggroup->SetIdentityL( KGroupId ); + // Set filter for the group + CPresenceInfoFilterImp* ggpif = CPresenceInfoFilterImp::NewLC(); + //ggpif->AcceptPersonFilterL( NPresenceInfo::NFieldType::KAcceptAll ); + CleanupStack::Pop(ggpif); // ggpif + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + + // grant for all + reqId = presAuth.GrantPresenceForPresentityGroupMembersL( *ggroup, *ggpif ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestGrantPresenceForPresentityGroupMembersCalled, + "GrantPresenceForPresentityGroupMembersL was not called", ETrue, NULL ); + delete ggroup; + delete ggpif; + + + // Withdraw one of group's member's ID + + MXIMPIdentity* identity = context->ObjectFactory().NewIdentityLC(); + identity->SetIdentityL( KIdentity2_16 ); // << identity + + + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + // register interest + reqId = presAuth.WithdrawPresenceGrantFromPresentityL( *identity ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Grantin presence to presentity, complete with error: ") ); + + // Changed for OPAA-73BCS8 + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestWithdrawPresenceFromPresentityCalled, + "WithdrawPresenceForPresentityL was not called", ETrue/*EFalse*/, + "WithdrawPresenceForPresentityL was called" ); + + CleanupStack::PopAndDestroy(); // identity + delete groupId; + + UnbindL(); + + wrapper = NULL; + context = NULL; + messenger = NULL; + } + + +// =========================================================================== +// SETUP HELPERS FOR THE LISTENER +// =========================================================================== +// +void T_PresenceAuthorization::SetupListenerReqCompleteL( CXIMPTestContextWrapper* aWrapper, TXIMPTestStatusEventTemplate aEventType ) + { + RArray< TInt32 > array; + CleanupClosePushL( array ); + array.Append( MXIMPContextStateEvent::KInterfaceId ); + array.Append( MPresentityPresenceEvent::KInterfaceId ); + aWrapper->SetupListenerReqCompleteL( aEventType, &array ); + CleanupStack::PopAndDestroy(); // array + } + +void T_PresenceAuthorization::SetupListenerReqCompleteAllowEventsL( CXIMPTestContextWrapper* aWrapper, TXIMPTestStatusEventTemplate aEventType ) + { + RArray< TInt32 > array; + CleanupClosePushL( array ); + array.AppendL( MXIMPRequestCompleteEvent::KInterfaceId ); + array.AppendL( MXIMPContextStateEvent::KInterfaceId ); + array.AppendL( MPresentityPresenceEvent::KInterfaceId ); + aWrapper->SetupListenerReqCompleteL( aEventType, &array ); + CleanupStack::PopAndDestroy(); // array + } + +// =========================================================================== +// TEST CASE TABLE +// =========================================================================== +// +EUNIT_BEGIN_TEST_TABLE( + T_PresenceAuthorization, + "XIMP presence authorization tests", + "MODULE" ) + +PRFW_DECORATED_TEST( + "Grant presence for presentity", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_GrantPresenceForPresentity_L, + Teardown ) + + +PRFW_DECORATED_TEST( + "MakeAndGrantGroup_WithdrawOneID", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_MakeAndGrantGroup_WithdrawOneID_L, + Teardown ) + + +PRFW_DECORATED_TEST( + "Grant presence for presentity multiple", + "", + "", + "FUNCTIONALITY", + SetupMultiple_L, + T_GrantPresenceForPresentity_Multiple_L, + Teardown ) + + +PRFW_DECORATED_TEST( + "Withdraw not granted presence for presentity", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_WithdrawNotGrantedPresenceFromPresentity_L, + Teardown ) + + +PRFW_DECORATED_TEST( + "Grant presence for presentity change id", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_GrantPresenceForPresentityChangeId_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Grant presence for group members change id", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_GrantPresenceForGroupMembersChangeId_L, + Teardown ) + + +PRFW_DECORATED_TEST( + "Withdraw not granted presence from presentity multiple", + "", + "", + "FUNCTIONALITY", + SetupMultiple_L, + T_WithdrawNotGrantedPresenceFromPresentity_Multiple_L, + Teardown ) + +PRFW_DECORATED_TEST( + "ErrorPlugin - Leave on grant", + "", + "", + "ERRORHANDLING", + Setup_L, + T_ErrFromPlg_LeaveOnGrantPresenceForPresentity_L, + Teardown ) + +PRFW_DECORATED_TEST( + "ErrorPlugin - Leave on withdraw", + "", + "", + "ERRORHANDLING", + Setup_L, + T_ErrFromPlg_LeaveOnWithdrawPresenceFromPresentity_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Withdraw not granted presence for group members", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_WithdrawNotGrantedPresenceFromGroupMembers_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Withdraw not granted presence for group members multiple", + "", + "", + "FUNCTIONALITY", + SetupMultiple_L, + T_WithdrawNotGrantedPresenceFromGroupMembers_Multiple_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Grant presence for group members", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_GrantPresenceForGroupMembers_L, + Teardown ) + + +PRFW_DECORATED_TEST( + "Grant presence for group members multiple", + "", + "", + "FUNCTIONALITY", + SetupMultiple_L, + T_GrantPresenceForGroupMembers_Multiple_L, + Teardown ) + + +PRFW_DECORATED_TEST( + "ErrorPlugin - Leave on withdraw for group members", + "", + "", + "ERRORHANDLING", + Setup_L, + T_ErrFromPlg_LeaveOnGrantPresenceForGroupMembers_L, + Teardown ) + +PRFW_DECORATED_TEST( + "ErrorPlugin - Leave on withdraw from group members", + "", + "", + "ERRORHANDLING", + Setup_L, + T_ErrFromPlg_LeaveOnWithdrawPresenceFromGroupMembers_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Grant presence for everyone", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_GrantPresenceForEveryone_L, + Teardown ) + +PRFW_DECORATED_TEST( + "ErrorPlugin - Leave on grant to everyone", + "", + "", + "ERRORHANDLING", + Setup_L, + T_ErrFromPlg_LeaveOnGrantPresenceForEveryone_L, + Teardown ) + +PRFW_DECORATED_TEST( + "ErrorPlugin - Leave on withdraw from everyone", + "", + "", + "ERRORHANDLING", + Setup_L, + T_ErrFromPlg_LeaveOnWithdrawPresenceFromEveryone_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Grant presence for everyone multiple ", + "", + "", + "FUNCTIONALITY", + SetupMultiple_L, + T_GrantPresenceForEveryone_Multiple_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Withdraw not granted presence from everyone", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_WithdrawNotGrantedPresenceFromEveryone_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Withdraw not granted presence from everyone multiple", + "", + "", + "FUNCTIONALITY", + SetupMultiple_L, + T_WithdrawNotGrantedPresenceFromEveryone_Multiple_L, + Teardown ) + + +EUNIT_END_TEST_TABLE + + +// =========================================================================== +// TEST SUITE CONSTRUCTION +// =========================================================================== +// +EXPORT_C MEUnitTest* CreateTestSuiteL() + { + return T_PresenceAuthorization::NewL(); + } + + + +// end of file diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/src/t_presenceauthorization/t_presenceauthorization.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/src/t_presenceauthorization/t_presenceauthorization.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,112 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework Test Code +* +*/ + +#ifndef T_PRESENCEAUTHORIZATION_H +#define T_PRESENCEAUTHORIZATION_H + +#include +#include +#include "prfwteststatuseventlistener.h" +#include "prfwtestmessaging.h" + +class CXIMPTestContextWrapper; +class CXIMPTestContextWrapperMgr; +class CXIMPTestMessenger; + +/** + * XIMP Framework Eunit tests. + * + * Tests for XIMP session management services. + * + * @since S60 v4.0 + */ +class T_PresenceAuthorization : public CEUnitTestSuiteClass + { + +public: + static T_PresenceAuthorization* NewL(); + virtual ~T_PresenceAuthorization(); + + +private: + T_PresenceAuthorization(); + void ConstructL(); + +private: // Test case functions + + void Setup_L(); + void SetupMultiple_L(); + void BindL(); + void BindAllL(); + void Teardown(); + void UnbindL(); + void UnbindAllL(); + + void T_GrantPresenceForPresentity_L(); + void T_GrantPresenceForPresentityChangeId_L(); + void T_WithdrawNotGrantedPresenceFromPresentity_L(); + void T_ErrFromPlg_LeaveOnGrantPresenceForPresentity_L(); + void T_ErrFromPlg_LeaveOnWithdrawPresenceFromPresentity_L(); + + void T_GrantPresenceForPresentity_Multiple_L(); + void T_WithdrawNotGrantedPresenceFromPresentity_Multiple_L(); + + void T_GrantPresenceForGroupMembers_L(); + void T_GrantPresenceForGroupMembersChangeId_L(); + void T_ErrFromPlg_LeaveOnGrantPresenceForGroupMembers_L(); + void T_ErrFromPlg_LeaveOnWithdrawPresenceFromGroupMembers_L(); + + void T_GrantPresenceForGroupMembers_Multiple_L(); + void T_WithdrawNotGrantedPresenceFromGroupMembers_L(); + void T_WithdrawNotGrantedPresenceFromGroupMembers_Multiple_L(); + + void T_GrantPresenceForEveryone_L(); + void T_ErrFromPlg_LeaveOnGrantPresenceForEveryone_L(); + void T_ErrFromPlg_LeaveOnWithdrawPresenceFromEveryone_L(); + + void T_GrantPresenceForEveryone_Multiple_L(); + void T_WithdrawNotGrantedPresenceFromEveryone_L(); + void T_WithdrawNotGrantedPresenceFromEveryone_Multiple_L(); + + void T_MakeAndGrantGroup_WithdrawOneID_L(); + +private: // Test helpers + + void SetupListenerReqCompleteL( CXIMPTestContextWrapper* aWrapper, TXIMPTestStatusEventTemplate aEventType ); + void SetupListenerReqCompleteAllowEventsL( CXIMPTestContextWrapper* aWrapper, TXIMPTestStatusEventTemplate aEventTypes ); + +private: // Test data + + /** + * Eunit test case table declaration. + */ + EUNIT_DECLARE_TEST_TABLE; + + // owned + CXIMPTestContextWrapperMgr* iWrapperMgr; + }; + + +#endif // T_PRESENCEAUTHORIZATION_H + + + +// end of file + + + + diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/src/t_presenceauthorization/t_presenceauthorization.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/src/t_presenceauthorization/t_presenceauthorization.mmp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,58 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework Test Code +* +*/ + +#include "../../tsrcutils/eunitcommon/eunittstdllbase.hrh" +#include "../../tsrcutils/processmaster/pm.h" + + +TARGET t_presenceauthorization.dll + +SOURCEPATH . +SOURCE t_presenceauthorization.cpp + + +USERINCLUDE ../../../core/srcdatamodel +USERINCLUDE ../../../presence/srcpresencedatamodel +USERINCLUDE ../../../presence/srcpresencedatamodel/presentitygroups +USERINCLUDE ../../../presence/srcpresencedatamodel/presencewatching +USERINCLUDE ../../../presence/srcpresencedatamodel/presenceauthorization +USERINCLUDE ../../../presence/srcpresencedatamodel/presencepublishing +USERINCLUDE ../../../presence/srcpresencedatamodel/presenceinfo +USERINCLUDE ../../../core/srcutils + +// TODO remove unnecessary +SYSTEMINCLUDE ../../../inc/core/base +SYSTEMINCLUDE ../../../inc/core/datamodel +SYSTEMINCLUDE ../../../inc/core/protocolplugin +SYSTEMINCLUDE ../../../inc/core/protocolpluginhost +SYSTEMINCLUDE ../../../inc/presence/presencedatamodel +SYSTEMINCLUDE ../../../inc/presence/presencemanagement +SYSTEMINCLUDE ../../../inc/presence/presenceprotocolplugin +SYSTEMINCLUDE ../../../inc/presence/presenceprotocolpluginhost + +LIBRARY ecom.lib +LIBRARY bafl.lib +LIBRARY ximpdatamodel.lib +LIBRARY presencedatamodel.lib +LIBRARY estor.lib +LIBRARY ximputils.lib + + + +// end of file + + diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/src/t_presenceblocking/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/src/t_presenceblocking/bld.inf Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,23 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Build information file for t_presenceblocking.dll +* +*/ + + +PRJ_PLATFORMS +DEFAULT + +PRJ_TESTMMPFILES +t_presenceblocking.mmp diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/src/t_presenceblocking/t_presenceblocking.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/src/t_presenceblocking/t_presenceblocking.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,1280 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework Test Code +* +*/ + + +#include "eunittools.h" + +#include +#include +#include + + +#include +#include +#include +#include + + +#include +#include +#include + +#include "t_presenceblocking.h" + +// blocking includes +#include "presenceblockinfoimp.h" +#include "presenceblocklisteventimp.h" + +// other datamodel and utils includes +#include "ximpidentityimp.h" +#include "ximpobjecthelpers.h" + + +// testing tool includes +#include "prfwtestpresencedatautils.h" + +#include "prfwtestmessaging.h" +#include "prfwtestmessenger.h" +#include "prfwtestcontextwrappermgr.h" +#include "prfwtestcontextwrapper.h" + + +#include "prfwtestfilesrvmsg.h" +#include "prfwtestfiletool.h" +#include "prfwtestlistener.h" +#include "ximprequestcompleteeventimp.h" + +#include "prfwtestrobustnesstools.h" + + +// ============================ MEMBER FUNCTIONS =============================== + +// CONSTRUCTION +T_PresenceBlocking* T_PresenceBlocking::NewL() + { + T_PresenceBlocking* self = new( ELeave ) T_PresenceBlocking; + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + + return self; + } + + +T_PresenceBlocking::~T_PresenceBlocking() + { + PrfwTestRobustness::DoPreCleaning(); + } + + +void T_PresenceBlocking::ConstructL() + { + CEUnitTestSuiteClass::ConstructL(); + } + + +T_PresenceBlocking::T_PresenceBlocking() + { + } + + + +// =========================================================================== +// TEST CASE SETUP & TEARDOWN METHODS +// =========================================================================== +// + +void T_PresenceBlocking::Setup_L() + { + PrfwTestRobustness::DoPreCleaning(); + + iWrapperMgr = CXIMPTestContextWrapperMgr::NewL(); + iWrapperMgr->CreateWrapperL(); + } + +void T_PresenceBlocking::SetupMultiple_L() + { + PrfwTestRobustness::DoPreCleaning(); + + iWrapperMgr = CXIMPTestContextWrapperMgr::NewL(); + iWrapperMgr->CreateWrapperL(); + iWrapperMgr->CreateWrapperL(); + iWrapperMgr->CreateWrapperL(); + } + + +void T_PresenceBlocking::BindL() + { + CXIMPTestContextWrapper* wrapper0 = iWrapperMgr->GetWrapperL( 0 ); + + wrapper0->BindL( 0 ); + } + +void T_PresenceBlocking::BindAllL() + { + for( TInt a = 0; a < iWrapperMgr->WrapperCount(); ++a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + wrapper->BindL( 0 ); + } + } + + +void T_PresenceBlocking::Teardown() + { + delete iWrapperMgr; + iWrapperMgr = NULL; + + REComSession::FinalClose(); + + PrfwTestRobustness::DoPreCleaning(); + } + +void T_PresenceBlocking::UnbindL() + { + // Do unbind + CXIMPTestContextWrapper* wrapper0 = iWrapperMgr->GetWrapperL( 0 ); + wrapper0->UnbindL(); + } + +void T_PresenceBlocking::UnbindAllL() + { + for( TInt a = 0; a < iWrapperMgr->WrapperCount(); ++a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + wrapper->UnbindL(); + } + } + + +// =========================================================================== +// TEST CASES for presentity presence subscription +// =========================================================================== + + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// Single client, empty filter +void T_PresenceBlocking::T_SubscribeBlockList_Single_L() + { + EUNIT_PRINT( _L("Single presence block list subscription") ); + + BindL(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + + MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization(); + + // Setup status event listener for RequestComplete + // --------------------------------------------- + listener2->Reset(); + + // normal request complete + TXIMPRequestId reqIdDummy; // not checked + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + // --------------------------------------------- + + // subscribe + // --------------------------------------------- + TXIMPRequestId reqId = presAuth.SubscribePresenceBlockListL(); + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Subscribe failed" ); + // --------------------------------------------- + + // verify that SubscribeBlockListL was called + COMMONASSERT( messenger, EXIMPPlgTestSubscribePresenceBlockListCalled, "SubscribeBlockListL was not called", ETrue, NULL ); + + // Setup status event listener for RequestComplete + // --------------------------------------------- + listener2->Reset(); + + evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + // --------------------------------------------- + + // unsubscribe + // --------------------------------------------- + reqId = presAuth.UnsubscribePresenceBlockListL(); + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Unsubscribe failed" ); + // --------------------------------------------- + + // verify that UnsubscribeBlockListL was called + COMMONASSERT( messenger, EXIMPPlgTestUnsubscribePresenceBlockListCalled, "UnsubscribeBlockListL was not called", ETrue, NULL ); + + // Deinitiliaze event source from listener. + listener2->SetEventSourceL( NULL ); + + UnbindL(); + + //CleanupStack::Pop(presFeat); + //delete presFeat; + //CleanupStack::PopAndDestroy(); + CleanupStack::PopAndDestroy( listener2 ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// Single client, empty filter +void T_PresenceBlocking::T_SubscribeBlockListRefresh_Single_L() + { + EUNIT_PRINT( _L("Single presence block list subscription refresh") ); + + BindL(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization(); + + // Setup status event listener for RequestComplete + // --------------------------------------------- + listener2->Reset(); + + // normal request complete + TXIMPRequestId reqIdDummy; // not checked + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + // --------------------------------------------- + + // subscribe + // --------------------------------------------- + TXIMPRequestId reqId = presAuth.SubscribePresenceBlockListL(); + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Subscribe failed" ); + // --------------------------------------------- + + // verify that SubscribeBlockListL was called + COMMONASSERT( messenger, EXIMPPlgTestSubscribePresenceBlockListCalled, "SubscribeBlockListL was not called", ETrue, NULL ); + + // Setup status event listener for RequestComplete + // --------------------------------------------- + listener2->Reset(); + + evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + RPrBlockInfoImpArray* currentList(NULL); + CPresenceBlockListEventImp* event = CreateBlockListEventLCX( + KNullDesC, KNullDesC, + MXIMPDataSubscriptionState::ESubscriptionActive, + MXIMPDataSubscriptionState::EDataUnavailable, + ETestPBlCurrent, currentList ); + listener2->ExpectL( event ); + CleanupStack::Pop(); //event 4 to go. + // --------------------------------------------- + + // subscribe again + // --------------------------------------------- + reqId = presAuth.SubscribePresenceBlockListL(); + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Refresh failed" ); + CleanupStack::PopAndDestroy( 4 ); // rest of the items. + // --------------------------------------------- + + // Setup status event listener for RequestComplete + // --------------------------------------------- + listener2->Reset(); + + evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + // --------------------------------------------- + + // unsubscribe + // --------------------------------------------- + reqId = presAuth.UnsubscribePresenceBlockListL(); + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Unsubscribe failed" ); + // --------------------------------------------- + + // verify that UnsubscribeBlockListL was called + COMMONASSERT( messenger, EXIMPPlgTestUnsubscribePresenceBlockListCalled, "UnsubscribeBlockListL was not called", ETrue, NULL ); + + listener2->SetEventSourceL( NULL ); + + UnbindL(); + + CleanupStack::PopAndDestroy( listener2 ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// Single client, empty filter +void T_PresenceBlocking::T_SubscribeBlockList_Multiple_L() + { + EUNIT_PRINT( _L("Multiple presence block list subscription") ); + + BindAllL(); + + TInt countOfWrappers = iWrapperMgr->WrapperCount(); + TInt a(0); + for( a = 0; a < countOfWrappers; ++a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization(); + + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // expect normal request complete + TXIMPRequestId reqIdDummy; // not checked + CXIMPRequestCompleteEventImp* evReqComplete = + CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + // subscribe + TXIMPRequestId reqId = presAuth.SubscribePresenceBlockListL(); + + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Subscribe failed" ); + + // verify that SubscribePresenceBlockListL was called + COMMONASSERT( messenger, EXIMPPlgTestSubscribePresenceBlockListCalled, "SubscribePresenceBlockListL was not called", ETrue, NULL ); + + CleanupStack::PopAndDestroy( listener2 ); + } + + for( a = 0; a < countOfWrappers; ++a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization(); + + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // expect normal request complete + TXIMPRequestId reqIdDummy; // not checked + CXIMPRequestCompleteEventImp* evReqComplete = + CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + // unsubscribe + TXIMPRequestId reqId = presAuth.UnsubscribePresenceBlockListL(); + + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Unsubscribe failed" ); + + // verify that EXIMPPlgTestUnsubscribeBlockListCalled was called + COMMONASSERT( messenger, EXIMPPlgTestUnsubscribePresenceBlockListCalled, + "UnsubscribePresenceBlockListL was not called", + ( a < 2 ) ? EFalse : ETrue, + "UnsubscribePresenceBlockListL was called" ); + + CleanupStack::PopAndDestroy( listener2 ); + } + + UnbindAllL(); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +void T_PresenceBlocking::SubscribeL() + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization(); + + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + + // ------------------------------------------------------ + // expect normal request complete + TXIMPRequestId reqIdDummy; // not checked + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + // ------------------------------------------------------ + + // subscribe + TXIMPRequestId reqId = presAuth.SubscribePresenceBlockListL(); + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Subscribe failed" ); + + COMMONASSERT( messenger, EXIMPPlgTestSubscribePresenceBlockListCalled, "SubscribeBlockListL was not called", ETrue, NULL ); + + CleanupStack::PopAndDestroy( listener2 ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +void T_PresenceBlocking::UnsubscribeL() + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization(); + + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + + // ------------------------------------------------------ + // expect normal request complete + TXIMPRequestId reqIdDummy; // not checked + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + // ------------------------------------------------------ + + // unsubscribe + TXIMPRequestId reqId = presAuth.UnsubscribePresenceBlockListL(); + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Unsubscribe failed" ); + + COMMONASSERT( messenger, EXIMPPlgTestUnsubscribePresenceBlockListCalled, "UnsubscribeBlockListL was not called", ETrue, NULL ); + + CleanupStack::PopAndDestroy( listener2 ); + } + + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +void T_PresenceBlocking::T_HandlePresenceBlockList_L() + { + EUNIT_PRINT( _L("Handle presence block list.") ); + + // log in and subscribe a block list + BindL(); + SubscribeL(); + + // ------------------------------------------------------ + // some startup stuff + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + // ------------------------------------------------------ + + // Tell the protocol it should act normally + wrapper->GetMessenger()->SetNoError(); + + // ------------------------------------------------------ + // 1. Create faked server message about block list + SendSrvMsgL( CXIMPTestFileSrvMsg::ETestSrvMsgPresenceBlockList ); + + // ------------------------------------------------------ + // expect current(empty) MPresenceBlockList event. + RPrBlockInfoImpArray* currentList(NULL); + CPresenceBlockListEventImp* event = CreateBlockListEventLCX( + KNullDesC, KNullDesC, + MXIMPDataSubscriptionState::ESubscriptionActive, + MXIMPDataSubscriptionState::EDataAvailable, + ETestPBlCurrent, currentList); + + listener2->ExpectL( event ); + CleanupStack::Pop( event ); // 4 more items in cleanupstack + + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "HandlePresenceBlockListL failed" ); + CleanupStack::PopAndDestroy( 4 ); // lists + // ------------------------------------------------------ + + CleanupStack::PopAndDestroy( listener2 ); + + // clean it up + UnsubscribeL(); + UnbindL(); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// Single client, empty filter +void T_PresenceBlocking::T_BlockPresence_L() + { + EUNIT_PRINT( _L("Block presence") ); + + BindL(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization(); + + // Setup status event listener for RequestComplete + // --------------------------------------------- + listener2->Reset(); + + // normal request complete + TXIMPRequestId reqIdDummy; // not checked + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + // subscribe + TXIMPRequestId reqId = presAuth.SubscribePresenceBlockListL(); + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Subscribe failed" ); + + // verify that SubscribePresenceBlockListL was called + COMMONASSERT( messenger, EXIMPPlgTestSubscribePresenceBlockListCalled, "SubscribePresenceBlockListL was not called", ETrue, NULL ); + + + // --------------------------------------------- + // 1. Block presence + + CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 ); + _LIT16( KDisplayName1, "DispnameA, LoremI" ); + + + // Setup status event listener for RequestComplete + // --------------------------------------------- + listener2->Reset(); + + evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + RPrBlockInfoImpArray* currentList(NULL); + CPresenceBlockListEventImp* event = + CreateBlockListEventLCX( identity->Identity(), + KNullDesC, + MXIMPDataSubscriptionState::ESubscriptionActive, + MXIMPDataSubscriptionState::EDataAvailable, + ETestPBlAdded, currentList ); + + listener2->ExpectL( event ); + CleanupStack::Pop( event ); + + // block + reqId = presAuth.BlockPresenceForPresentityL( *identity ); + + //Waqas: fixed current list in event + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Block failed" ); + + // verify that BlockPresenceForPresentityL was called + COMMONASSERT( messenger, EXIMPPlgTestBlockPresenceForPresentityCalled, "BlockPresenceForPresentityL was not called", ETrue, NULL ); + + CleanupStack::PopAndDestroy( 4 ); // lists + // --------------------------------------------- + + + // --------------------------------------------- + // 2. Re-block + + // Setup status event listener for RequestComplete + listener2->Reset(); + + evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + // we need to create current list to give to the event + currentList = new ( ELeave ) RPrBlockInfoImpArray; // previous is destroyed + CleanupDeletePushL( currentList ); + // create the group info + CPresenceBlockInfoImp* blockInfoForEvent = + CPresenceBlockInfoImp::NewLC( *identity, KNullDesC ); + currentList->AppendL( blockInfoForEvent ); + CleanupStack::Pop( blockInfoForEvent ); + CleanupStack::Pop( currentList ); + + // now make the event + event = CreateBlockListEventLCX( identity->Identity(), + KNullDesC, + MXIMPDataSubscriptionState::ESubscriptionActive, + MXIMPDataSubscriptionState::EDataAvailable, + ETestPBlCurrent, currentList ); + + listener2->ExpectL( event ); + CleanupStack::Pop( event ); + + // re-block + reqId = presAuth.BlockPresenceForPresentityL( *identity ); + + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Block failed" ); + + // verify that BlockPresenceForPresentityL was called + COMMONASSERT( messenger, EXIMPPlgTestBlockPresenceForPresentityCalled, "BlockPresenceForPresentityL was not called", ETrue, NULL ); + + + CleanupStack::PopAndDestroy( 4 ); // lists + + + // Deinitiliaze event source from listener. + listener2->SetEventSourceL( NULL ); + + UnbindL(); + + CleanupStack::PopAndDestroy( identity ); + + CleanupStack::PopAndDestroy( listener2 ); + + } +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// Single client, empty filter +void T_PresenceBlocking::T_CancelBlockedPresence_L() + { + EUNIT_PRINT( _L("Cancel presence block") ); + + BindL(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization(); + + // Setup status event listener for RequestComplete + // --------------------------------------------- + listener2->Reset(); + + // normal request complete + TXIMPRequestId reqIdDummy; // not checked + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + // --------------------------------------------- + + // subscribe + // --------------------------------------------- + TXIMPRequestId reqId = presAuth.SubscribePresenceBlockListL(); + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Subscribe failed" ); + // --------------------------------------------- + + // verify that SubscribePresenceBlockListL was called + COMMONASSERT( messenger, EXIMPPlgTestSubscribePresenceBlockListCalled, "SubscribePresenceBlockListL was not called", ETrue, NULL ); + + + CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 ); + + // --------------------------------------------- + // 1. Cancel non-existing block (no blocks) + + // Setup status event listener for RequestComplete + listener2->Reset(); + + evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + RPrBlockInfoImpArray* currentList(NULL); + CPresenceBlockListEventImp* event = + CreateBlockListEventLCX( KNullDesC, + KNullDesC, + MXIMPDataSubscriptionState::ESubscriptionActive, + MXIMPDataSubscriptionState::EDataUnavailable, + ETestPBlRemoved, currentList ); + listener2->ExpectL( event ); + CleanupStack::Pop( event ); + + // cancel nonexisting block + reqId = presAuth.CancelPresenceBlockFromPresentityL( *identity ); + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Cancel failed" ); + // --------------------------------------------- + + // verify that method was called + COMMONASSERT( messenger, EXIMPPlgTestCancelPresenceBlockFromPresentityCalled, "CancelPresenceBlockFromPresentityL was not called", ETrue, NULL ); + + CleanupStack::PopAndDestroy( 4 ); // lists + + + // --------------------------------------------- + // 2. Cancel block + + + // Setup status event listener for RequestComplete + listener2->Reset(); + + evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + currentList = NULL; // previous is destroyed + event = CreateBlockListEventLCX( identity->Identity(), + KNullDesC, + MXIMPDataSubscriptionState::ESubscriptionActive, + MXIMPDataSubscriptionState::EDataAvailable, + ETestPBlAdded, currentList ); + listener2->ExpectL( event ); + CleanupStack::Pop( event ); + + // block a presentity + reqId = presAuth.BlockPresenceForPresentityL( *identity ); + // Waqas: Fixed current list in event + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Block failed" ); + + // verify that method was called + COMMONASSERT( messenger, EXIMPPlgTestBlockPresenceForPresentityCalled, "BlockPresenceForPresentityL was not called", ETrue, NULL ); + CleanupStack::PopAndDestroy( 4 ); // lists + // --------------------------------------------- + + + // Setup status event listener for RequestComplete + listener2->Reset(); + + evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + // we need to create current list to give to the event + currentList = new ( ELeave ) RPrBlockInfoImpArray; // previous is destroyed + CleanupDeletePushL( currentList ); + CPresenceBlockInfoImp* blockInfoForEvent = + CPresenceBlockInfoImp::NewLC( *identity, KNullDesC ); + currentList->AppendL( blockInfoForEvent ); + CleanupStack::Pop( blockInfoForEvent ); + CleanupStack::Pop( currentList ); + + // now create event and give currentList to it + event = CreateBlockListEventLCX( identity->Identity(), + KNullDesC, + MXIMPDataSubscriptionState::ESubscriptionActive, + MXIMPDataSubscriptionState::EDataAvailable, + ETestPBlRemoved, currentList ); + listener2->ExpectL( event ); + CleanupStack::Pop( event ); + + // cancel the existing block + reqId = presAuth.CancelPresenceBlockFromPresentityL( *identity ); + // Waqas: Fixed current list in event + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Cancel block failed" ); + + // verify that method was called + COMMONASSERT( messenger, EXIMPPlgTestCancelPresenceBlockFromPresentityCalled, "CancelPresenceBlockFromPresentityL was not called", ETrue, NULL ); + CleanupStack::PopAndDestroy( 4 ); // lists + // --------------------------------------------- + + + // --------------------------------------------- + // TODO 3. Cancel block (non-existing block, other blocks exist) + + + // Deinitiliaze event source from listener. + listener2->SetEventSourceL( NULL ); + + UnbindL(); + + CleanupStack::PopAndDestroy( identity ); + + CleanupStack::PopAndDestroy( listener2 ); + } + + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +void T_PresenceBlocking::T_HandlePresenceBlocked_L() + { + EUNIT_PRINT( _L("Handle presence blocked") ); + + // log in and subscribe a block list + BindL(); + SubscribeL(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + + // Tell the protocol it should act normally + wrapper->GetMessenger()->SetNoError(); + + + CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 ); + + // ------------------------------------------------------ + // 1. Create faked server message about blocked + SendBlockedSrvMsgL( identity->Identity(), + KNullDesC, + CXIMPTestFileSrvMsg::ETestSrvMsgPresenceBlocked ); + + RPrBlockInfoImpArray* currentList(NULL); + CPresenceBlockListEventImp* event = CreateBlockListEventLCX( + identity->Identity(), KNullDesC, + MXIMPDataSubscriptionState::ESubscriptionActive, + MXIMPDataSubscriptionState::EDataAvailable, + ETestPBlAdded, currentList ); + + listener2->ExpectL( event ); + CleanupStack::Pop( event ); // 4 more items in cleanupstack + + // Waqas: Fixed current list handling + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "HandlePresenceBlocked failed" ); + + CleanupStack::PopAndDestroy( 4 ); // lists + // ------------------------------------------------------ + + CleanupStack::PopAndDestroy( identity ); + CleanupStack::PopAndDestroy( listener2 ); + + // clean it up + UnsubscribeL(); + UnbindL(); + + } +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +void T_PresenceBlocking::T_HandlePresenceBlockCanceled_L() + { + + EUNIT_PRINT( _L("Handle presence block canceled") ); + + // log in and subscribe a block list + BindL(); + SubscribeL(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + + // Tell the protocol it should act normally + wrapper->GetMessenger()->SetNoError(); + + + CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 ); + + // ------------------------------------------------------ + // 1. Cancel block (with no blocks) + SendCanceledSrvMsgL( identity->Identity(), + KNullDesC, + CXIMPTestFileSrvMsg::ETestSrvMsgPresenceBlockCanceled ); + + RPrBlockInfoImpArray* currentList(NULL); + CPresenceBlockListEventImp* event = CreateBlockListEventLCX( + KNullDesC, KNullDesC, + MXIMPDataSubscriptionState::ESubscriptionActive, + MXIMPDataSubscriptionState::EDataUnavailable, + ETestPBlRemoved, currentList ); + + listener2->ExpectL( event ); + CleanupStack::Pop( event ); // 4 more items in cleanupstack + + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "HandlePresenceBlockCanceled failed" ); + CleanupStack::PopAndDestroy( 4 ); // lists + // ------------------------------------------------------ + + CleanupStack::PopAndDestroy( identity ); + CleanupStack::PopAndDestroy( listener2 ); + + // clean it up + UnsubscribeL(); + UnbindL(); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// send a faked server-originated message with group info made +// from the given uri and displayname +// +void T_PresenceBlocking::SendSrvMsgL( + const TDesC& aUri, const TDesC& aDispName, + TInt aMsgType ) + { + // we'll use hard-coded wrapper 0 instance for now. + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + + // create a grant req info contained within the server-originated + // faked message + RXIMPObjOwningPtrArray blockList; + CleanupClosePushL( blockList ); + + CXIMPIdentityImp* blockId = CXIMPIdentityImp::NewLC( aUri ); + CPresenceBlockInfoImp* blockItem = + CPresenceBlockInfoImp::NewLC( *blockId, aDispName ); + blockList.AppendL( blockItem ); + CleanupStack::Pop( blockItem ); + CleanupStack::PopAndDestroy( blockId ); + + HBufC8* packedArray = + TXIMPObjectPacker::PackArrayL( blockList ); + CleanupStack::PushL( packedArray ); + + // use filetool to send it for plugin. + CXIMPTestFileSrvMsg* srvMsg = CXIMPTestFileSrvMsg::NewL( aMsgType, + *packedArray ); + CleanupStack::PushL( srvMsg ); + wrapper->FileTool().CleanAllL(); + wrapper->FileTool().SrvMsgStoreL( srvMsg ); + CleanupStack::PopAndDestroy( 3 ); // srvMsg, packedArray, blockList + } + +void T_PresenceBlocking::SendBlockedSrvMsgL( + const TDesC& aUri, const TDesC& aDispName, + TInt aMsgType ) + { + // we'll use hard-coded wrapper 0 instance for now. + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + + // create a grant req info contained within the server-originated + // faked message + CXIMPIdentityImp* blockId = CXIMPIdentityImp::NewLC( aUri ); + CPresenceBlockInfoImp* blockItem = + CPresenceBlockInfoImp::NewLC( *blockId, aDispName ); + + + HBufC8* packedArray = + TXIMPObjectPacker::PackL( *blockItem ); + CleanupStack::PushL( packedArray ); + + // use filetool to send it for plugin. + CXIMPTestFileSrvMsg* srvMsg = CXIMPTestFileSrvMsg::NewL( aMsgType, + *packedArray ); + CleanupStack::PushL( srvMsg ); + wrapper->FileTool().CleanAllL(); + wrapper->FileTool().SrvMsgStoreL( srvMsg ); + CleanupStack::PopAndDestroy( 4 ); // blockId, blockItem, packedArray, srvMsg + } + +void T_PresenceBlocking::SendCanceledSrvMsgL( + const TDesC& aUri, const TDesC& aDispName, + TInt aMsgType ) + { + // we'll use hard-coded wrapper 0 instance for now. + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + + CXIMPIdentityImp* blockId = CXIMPIdentityImp::NewLC( aUri ); + + HBufC8* packedArray = + TXIMPObjectPacker::PackL( *blockId ); + CleanupStack::PushL( packedArray ); + + // use filetool to send it for plugin. + CXIMPTestFileSrvMsg* srvMsg = CXIMPTestFileSrvMsg::NewL( aMsgType, + *packedArray ); + CleanupStack::PushL( srvMsg ); + wrapper->FileTool().CleanAllL(); + wrapper->FileTool().SrvMsgStoreL( srvMsg ); + CleanupStack::PopAndDestroy( 3 ); // blockId, packedArray, srvMsg + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// send a faked server-originated message with empty contents +// +void T_PresenceBlocking::SendSrvMsgL( TInt aMsgType ) + { + // we'll use hard-coded wrapper 0 instance for now. + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + + // create a server-originated faked message with empty contents + RXIMPObjOwningPtrArray blockList; + + HBufC8* packedArray = TXIMPObjectPacker::PackArrayL( blockList ); + CleanupStack::PushL( packedArray ); + + // use filetool to send it for plugin. + CXIMPTestFileSrvMsg* srvMsg = CXIMPTestFileSrvMsg::NewL( aMsgType, + *packedArray ); + CleanupStack::PushL( srvMsg ); + wrapper->FileTool().CleanAllL(); + wrapper->FileTool().SrvMsgStoreL( srvMsg ); + CleanupStack::PopAndDestroy( 2 ); // srvMsg, packedArray + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// create a block list event with given arrays +// +CPresenceBlockListEventImp* + T_PresenceBlocking::CreateBlockListEventLCX( + const TDesC& aUri, + const TDesC& aDispName, + MXIMPDataSubscriptionState::TSubscriptionState aSubscriptionState, + MXIMPDataSubscriptionState::TDataState aDataState, + TTestPBlOperationSpecifier aOperation, + RPrBlockInfoImpArray* aCurrentList) + { + // create the arrays + + // new list + RPrBlockInfoImpArray* newList = new ( ELeave ) RPrBlockInfoImpArray; + CleanupDeletePushL( newList ); + + // current list, created by caller + if(!aCurrentList) // if client didnt created the list + aCurrentList = new ( ELeave ) RPrBlockInfoImpArray; + CleanupDeletePushL( aCurrentList ); + + // removed list + RPrBlockInfoImpArray* removedList = new ( ELeave ) RPrBlockInfoImpArray; + CleanupDeletePushL( removedList ); + + // updated list + RPrBlockInfoImpArray* updatedList = new ( ELeave ) RPrBlockInfoImpArray; + CleanupDeletePushL( updatedList ); + + // create subscription state + CXIMPDataSubscriptionStateImp* subsState = CXIMPDataSubscriptionStateImp::NewLC(); + + + // create the group info + CPresenceBlockInfoImp* blockInfoForEvent1 = NULL; + { + CXIMPIdentityImp* idForEvent = CXIMPIdentityImp::NewLC( aUri ); + blockInfoForEvent1 = CPresenceBlockInfoImp::NewLC( *idForEvent, aDispName ); + + CleanupStack::Pop( blockInfoForEvent1 ); + CleanupStack::PopAndDestroy( idForEvent ); + CleanupStack::PushL( blockInfoForEvent1 ); + } + + CPresenceBlockInfoImp* blockInfoForEvent2 = + TXIMPObjectCloner< CPresenceBlockInfoImp >::CloneLC( *blockInfoForEvent1 ); + + TInt count(0); + TBool found(EFalse); + TInt i(0); + + // put the given group info into the specified array + switch ( aOperation ) + { + case ETestPBlAdded: + { + newList->AppendL( blockInfoForEvent2 ); + CleanupStack::Pop( blockInfoForEvent2 ); + + aCurrentList->AppendL( blockInfoForEvent1 ); + CleanupStack::Pop( blockInfoForEvent1 ); + + break; + } + + case ETestPBlRemoved: + { + // search the given id in current list + count = aCurrentList->Count(); + for(i=0;iBlockedEntityId()).Identity()) == aUri ) + && ( (((*aCurrentList)[i])->BlockedEntityDisplayName()) == aDispName )) + { + found = ETrue; + break; + } + } + if(found) // do we need to leave if error? Waqas + { + delete (*aCurrentList)[i]; + aCurrentList->Remove(i); + removedList->AppendL( blockInfoForEvent2 ); + CleanupStack::Pop( blockInfoForEvent2 ); + } + else + CleanupStack::PopAndDestroy( blockInfoForEvent2 ); + + CleanupStack::PopAndDestroy( blockInfoForEvent1 ); + } + break; + case ETestPBlUpdated: + { + updatedList->AppendL( blockInfoForEvent2 ); + CleanupStack::Pop( blockInfoForEvent2); + CleanupStack::PopAndDestroy( blockInfoForEvent1 ); + } + break; + + case ETestPBlCurrent: + { + // don't add, thus return what user has given + CleanupStack::PopAndDestroy( blockInfoForEvent2 ); // blockInfoForEvent2 + CleanupStack::PopAndDestroy( blockInfoForEvent1 ); // blockInfoForEvent1 + } + break; + + default: + { + User::Leave( KErrArgument ); + } + break; + } + + subsState->SetSubscriptionStateL(aSubscriptionState); + subsState->SetDataStateL(aDataState); + + // create the actual event + CPresenceBlockListEventImp* tmp = + CPresenceBlockListEventImp::NewLC( + newList, + aCurrentList, + removedList, + updatedList, + subsState ); + + // subState is owned by the event, we need to pop it out from the stack + CleanupStack::Pop( tmp ); + CleanupStack::Pop( subsState ); + CleanupStack::PushL( tmp ); + + /* + * In cleanupstack there are 5 items, FIFO + * - added/new list + * - current list + * - removed list + * - updated list + * - event imp + */ + + return tmp; + } + +// =========================================================================== +// TEST CASE TABLE +// =========================================================================== +// +EUNIT_BEGIN_TEST_TABLE( + T_PresenceBlocking, + "XIMPFW presence blocking tests", + "MODULE" ) + +PRFW_DECORATED_TEST( + "Subscribe block list", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_SubscribeBlockList_Single_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Refresh block list subscription", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_SubscribeBlockListRefresh_Single_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Subscribe block list, multiple", + "", + "", + "FUNCTIONALITY", + SetupMultiple_L, + T_SubscribeBlockList_Multiple_L, + Teardown ) + + +PRFW_DECORATED_TEST( + "Handle presence block list", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_HandlePresenceBlockList_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Block presence", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_BlockPresence_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Cancel presence block", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_CancelBlockedPresence_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Handle blocked and canceled blocks", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_HandlePresenceBlocked_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Handle blocked and canceled blocks", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_HandlePresenceBlockCanceled_L, + Teardown ) + +EUNIT_END_TEST_TABLE + + +// =========================================================================== +// TEST SUITE CONSTRUCTION +// =========================================================================== +// +EXPORT_C MEUnitTest* CreateTestSuiteL() + { + return T_PresenceBlocking::NewL(); + } + + +// end of file diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/src/t_presenceblocking/t_presenceblocking.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/src/t_presenceblocking/t_presenceblocking.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,177 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework Test Code +* +*/ + +#ifndef T_PRESENCEBLOCKING_H +#define T_PRESENCEBLOCKING_H + +#include +#include +#include "prfwteststatuseventlistener.h" +#include "prfwtestmessaging.h" +#include "ximpdatasubscriptionstateimp.h" +#include "presencetypehelpers.h" + +class CXIMPTestContextWrapper; +class CXIMPTestContextWrapperMgr; +class CXIMPTestMessenger; +class CPresenceBlockInfoImp; +class CPresenceBlockListEventImp; + +/** + * XIMP Framework Eunit tests. + * + * Tests for XIMP session management services. + * + * @since S60 v4.0 + */ +class T_PresenceBlocking : public CEUnitTestSuiteClass + { + +public: + static T_PresenceBlocking* NewL(); + virtual ~T_PresenceBlocking(); + + +private: + T_PresenceBlocking(); + void ConstructL(); + +private: // Test case functions + + void Setup_L(); + void SetupMultiple_L(); + void BindL(); + void BindAllL(); + void Teardown(); + void UnbindL(); + void UnbindAllL(); + void SubscribeL(); + void UnsubscribeL(); + + void T_SubscribeBlockList_Single_L(); + void T_SubscribeBlockListRefresh_Single_L(); + void T_SubscribeBlockList_Multiple_L(); + void T_HandlePresenceBlockList_L(); + void T_BlockPresence_L(); + void T_CancelBlockedPresence_L(); + void T_HandlePresenceBlocked_L(); + void T_HandlePresenceBlockCanceled_L(); + + +private: // Test helpers + + /** + * Fake a server-originated (=mobile terminated) message. + * The message appears to adaptation and framework as if + * it came from the network. Uses only one group. + * @param aUri The URI of group + * @param aDispName The display name for the group + * @param aMsgType The message type for CXIMPTestFileSrvMsg + */ + void SendSrvMsgL( + const TDesC& aUri, const TDesC& aDispName, + TInt aMsgType ); + void SendBlockedSrvMsgL( + const TDesC& aUri, const TDesC& aDispName, + TInt aMsgType ); + void SendCanceledSrvMsgL( + const TDesC& aUri, const TDesC& aDispName, + TInt aMsgType ); + + /** + * Fake a server-originated message with empty content. + * Whether to use this depends on the event you expect. + * @see SendSrvMsgL + */ + void SendSrvMsgL( TInt aMsgType ); + + // @see below + /* + enum TTestPBlArraySpecifier //Waqas: Not used anymore, use next one + { + ETestPBlNewList = 0, // new block list + ETestPBlAdded, // added block + ETestPBlCurrent, // current block list + ETestPBlRemoved, // removed block + ETestPBlUpdated, // updated block + ETestPBlEmpty, // make an empty array for empty event + };*/ + + enum TTestPBlOperationSpecifier + { + ETestPBlAdded = 0, // added block + ETestPBlCurrent, // current block list + ETestPBlRemoved, // removed block + ETestPBlUpdated // updated block + }; + + /** + * Creates an event for adding, current, removing or updating + * block list. The caller provides an identity and current blocked list + * and depending on the provided operation an event is created. + * + * In cleanupstack there are 4 items, FIFO: + * - created list + * - updated list + * - deleted list + * - event imp + * + * This is because this event won't take ownership to the arrays + * when created this way. + * + * @param aUri Uri + * @param aDispName Displayname + * @param aOperation operation for which caller wants to generates event + * @param aCurrentList Current blocked list provided by caller, method takes + * ownership of the current list, and it is included in above 4 items. + * a NULL pointer with operation ETestPBlCurrent causes empty event. + * @return The suitably filled event. + */ + CPresenceBlockListEventImp* CreateBlockListEventLCX( + const TDesC& aUri, + const TDesC& aDispName, + MXIMPDataSubscriptionState::TSubscriptionState aSubscriptionState, + MXIMPDataSubscriptionState::TDataState aDataState, + TTestPBlOperationSpecifier aOperation, + RPrBlockInfoImpArray* aCurrentList = NULL + ); + + +private: // Test data + + /** + * Eunit test case table declaration. + */ + EUNIT_DECLARE_TEST_TABLE; + + // owned + CXIMPTestContextWrapperMgr* iWrapperMgr; + + // + TInt iLastError; + RXIMPObjOwningPtrArray< CPresenceBlockInfoImp > iValidateArray; + }; + + +#endif // T_PRESENCEBLOCKING_H + + + +// end of file + + + diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/src/t_presenceblocking/t_presenceblocking.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/src/t_presenceblocking/t_presenceblocking.mmp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,56 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework Test Code +* +*/ + +#include "../../tsrcutils/eunitcommon/eunittstdllbase.hrh" +#include "../../tsrcutils/processmaster/pm.h" + +TARGET t_presenceblocking.dll + +SOURCEPATH . +SOURCE t_presenceblocking.cpp + + +USERINCLUDE ../../../core/srcdatamodel +USERINCLUDE ../../../presence/srcpresencedatamodel +USERINCLUDE ../../../presence/srcpresencedatamodel/presentitygroups +USERINCLUDE ../../../presence/srcpresencedatamodel/presencewatching +USERINCLUDE ../../../presence/srcpresencedatamodel/presenceauthorization +USERINCLUDE ../../../presence/srcpresencedatamodel/presencepublishing +USERINCLUDE ../../../presence/srcpresencedatamodel/presenceinfo +USERINCLUDE ../../../core/srcutils + +// TODO remove unnecessary +SYSTEMINCLUDE ../../../inc/core/base +SYSTEMINCLUDE ../../../inc/core/datamodel +SYSTEMINCLUDE ../../../inc/core/protocolplugin +SYSTEMINCLUDE ../../../inc/core/protocolpluginhost +SYSTEMINCLUDE ../../../inc/presence/presencedatamodel +SYSTEMINCLUDE ../../../inc/presence/presencemanagement +SYSTEMINCLUDE ../../../inc/presence/presenceprotocolplugin +SYSTEMINCLUDE ../../../inc/presence/presenceprotocolpluginhost + +LIBRARY ecom.lib +LIBRARY bafl.lib +LIBRARY ximpdatamodel.lib +LIBRARY presencedatamodel.lib +LIBRARY ximputils.lib +LIBRARY estor.lib + + +// end of file + + diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/src/t_presencecache/T_PresenceCache.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/src/t_presencecache/T_PresenceCache.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,978 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework Test Code +* +*/ + + +// CLASS HEADER +#include "T_PresenceCache.h" + +// EXTERNAL INCLUDES +#include +#include + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + + +// Implementation files used for testing only +#include "presencebuddyinfoimp.h" +#include "presenceinfoimp.h" +#include "presencebuddyinfolistimp.h" + + +// CONSTANTS +_LIT8( KIdentityField, "Identity" ); + +_LIT( KBuddyId1sip, "sip:BuddyId1@xyz.com" ); +_LIT( KBuddyId2sip, "sip:BuddyId2@xyz.com" ); +_LIT( KBuddyId3sip, "sip:BuddyId3@xyz.com" ); +_LIT( KBuddyId1ECE, "ECE:BuddyId1@xyz.com" ); +_LIT( KBuddyId2ECE, "ECE:BuddyId2@xyz.com" ); +_LIT( KBuddyId3ECE, "ECE:BuddyId3@xyz.com" ); +_LIT( KBuddyId1MSN, "MSN:BuddyId1@xyz.com" ); +_LIT( KBuddyId2MSN, "MSN:BuddyId2@xyz.com" ); +_LIT( KBuddyId3MSN, "MSN:BuddyId3@xyz.com" ); +_LIT( KBuddyId1VoIP, "VoIP:BuddyId1@xyz.com" ); +_LIT( KBuddyId2VoIP, "VoIP:BuddyId2@xyz.com" ); +_LIT( KBuddyId3VoIP, "VoIP:BuddyId3@xyz.com" ); +_LIT( KBuddyId1ICQ, "ICQ:BuddyId1@xyz.com" ); +_LIT( KBuddyId2ICQ, "ICQ:BuddyId2@xyz.com" ); +_LIT( KBuddyId3ICQ, "ICQ:BuddyId3@xyz.com" ); +_LIT( KBuddyId1no, "no:BuddyId1@xyz.com" ); +_LIT( KBuddyId2no, "no:BuddyId2@xyz.com" ); +_LIT( KBuddyId3no, "no:BuddyId3@xyz.com" ); + +_LIT( KBuddyId1, "BuddyId1@xyz.com" ); +_LIT( KBuddyId2, "BuddyId2@xyz.com" ); +_LIT( KBuddyId3, "BuddyId3@xyz.com" ); + +_LIT( KText1, "KText1" ); +_LIT( KText2, "KText2" ); +_LIT( KText3, "KText3" ); +_LIT( KText4, "KText4" ); +_LIT( KText5, "KText5" ); +_LIT( KText6, "KText6" ); + +_LIT( KService1, "sip" ); +_LIT( KService2, "ECE" ); +_LIT( KService3, "MSN" ); +_LIT( KService4, "VoIP" ); +_LIT( KService5, "ICQ" ); +_LIT( KService6, "no" ); + +// INTERNAL INCLUDES + + +// CONSTRUCTION +T_PresenceCache* T_PresenceCache::NewL() + { + T_PresenceCache* self = T_PresenceCache::NewLC(); + CleanupStack::Pop(); + + return self; + } + +T_PresenceCache* T_PresenceCache::NewLC() + { + T_PresenceCache* self = new( ELeave ) T_PresenceCache(); + CleanupStack::PushL( self ); + + self->ConstructL(); + + return self; + } + +// Destructor (virtual by CBase) +T_PresenceCache::~T_PresenceCache() + { + } + +// Default constructor +T_PresenceCache::T_PresenceCache() + { + } + +// Second phase construct +void T_PresenceCache::ConstructL() + { + // The ConstructL from the base class CEUnitTestSuiteClass must be called. + // It generates the test case table. + CEUnitTestSuiteClass::ConstructL(); + + iCoverageTesting=EFalse; + } + +// METHODS + + +void T_PresenceCache::SetupL( ) + { + __UHEAP_MARK; + iMPresenceCacheWriter = MPresenceCacheWriter::NewL(); + iMPresenceCacheReader = MPresenceCacheReader::NewL(); + + iPresenceFeeder = MPresenceFeeder::NewL(KService6); + } + + +void T_PresenceCache::Teardown( ) + { + if(iMPresenceCacheReader) + delete iMPresenceCacheReader; + delete iMPresenceCacheWriter; + delete iPresenceFeeder; + delete iExpectedNotifyContent; + + if(iPresBuddyInfoList) + delete iPresBuddyInfoList; + REComSession::FinalClose(); + User::SetJustInTime( ETrue ); + __UHEAP_MARKEND; + } + +void T_PresenceCache::T__PresenceInfoL() + { + // Try to read while empty + MXIMPIdentity* identity = iMPresenceCacheReader->NewIdentityLC(); + identity->SetIdentityL(KBuddyId1); + + //KErrArgument + MPresenceInfo* presInfoRead = iMPresenceCacheReader->PresenceInfoLC(*identity); + EUNIT_ASSERT_EQUALS( (TInt)presInfoRead, NULL ); + + //empty read + identity->SetIdentityL(KBuddyId1sip); + presInfoRead = iMPresenceCacheReader->PresenceInfoLC(*identity); + EUNIT_ASSERT_EQUALS( (TInt)presInfoRead, NULL ); + + // write buddy presence info + MPresenceBuddyInfo* buddyPresInfoWrite = + MakeBuddyPresenceInfoLC(KBuddyId1sip, KText1); + TInt err = iMPresenceCacheWriter->WritePresenceL(buddyPresInfoWrite); + + // Now read it + presInfoRead = iMPresenceCacheReader->PresenceInfoLC(*identity); + + + //Now verify it + const CPresenceInfoImp* actualInfo = + TXIMPGetImpClassOrPanic::From(*(buddyPresInfoWrite->PresenceInfo())); + + CPresenceInfoImp* readInfo = + TXIMPGetImpClassOrPanic::From(*presInfoRead); + + TBool same = actualInfo->EqualsContent(*readInfo); + + CleanupStack::PopAndDestroy(3); //identity, buddyPresInfoWrite, presInfoRead; + + EUNIT_ASSERT_EQUALS( same, ETrue ); + } + + +void T_PresenceCache::T_WriteReadPresenceAsyncL() + { + + //MPresenceBuddyInfoList* buddyInfoList = CPresenceBuddyInfoListImp::NewLC(); + MPresenceBuddyInfoList* buddyInfoList = + iMPresenceCacheWriter->NewPresenceBuddyInfoListLC(KNullDesC); + //buddyInfoList->SetServiceNameL(KService1); + // write buddies in all services + MPresenceBuddyInfo* buddyPresInfoWrite(NULL); + + TInt err2(KErrNone); + + buddyPresInfoWrite =MakeBuddyPresenceInfoLC(KBuddyId1sip, KText1); + buddyInfoList->AddOrReplace(buddyPresInfoWrite);CleanupStack::Pop(1); + + buddyPresInfoWrite =MakeBuddyPresenceInfoLC(KBuddyId2sip, KText1); + buddyInfoList->AddOrReplace(buddyPresInfoWrite);CleanupStack::Pop(1); + + buddyPresInfoWrite =MakeBuddyPresenceInfoLC(KBuddyId3sip, KText1); + buddyInfoList->AddOrReplace(buddyPresInfoWrite);CleanupStack::Pop(1); + + buddyPresInfoWrite =MakeBuddyPresenceInfoLC(KBuddyId1ECE, KText1); + buddyInfoList->AddOrReplace(buddyPresInfoWrite);CleanupStack::Pop(1); + + buddyPresInfoWrite =MakeBuddyPresenceInfoLC(KBuddyId2ECE, KText1); + buddyInfoList->AddOrReplace(buddyPresInfoWrite);CleanupStack::Pop(1); + + buddyPresInfoWrite =MakeBuddyPresenceInfoLC(KBuddyId3ECE, KText1); + buddyInfoList->AddOrReplace(buddyPresInfoWrite);CleanupStack::Pop(1); + + buddyPresInfoWrite =MakeBuddyPresenceInfoLC(KBuddyId1MSN, KText1); + buddyInfoList->AddOrReplace(buddyPresInfoWrite);CleanupStack::Pop(1); + + buddyPresInfoWrite =MakeBuddyPresenceInfoLC(KBuddyId2MSN, KText1); + buddyInfoList->AddOrReplace(buddyPresInfoWrite);CleanupStack::Pop(1); + + buddyPresInfoWrite =MakeBuddyPresenceInfoLC(KBuddyId3MSN, KText1); + buddyInfoList->AddOrReplace(buddyPresInfoWrite);CleanupStack::Pop(1); + + + //Only For increasing coverage for lists + MXIMPIdentity* identity = CXIMPIdentityImp::NewLC(); + identity->SetIdentityL(KBuddyId3no); + EUNIT_ASSERT_EQUALS( buddyInfoList->FindAndRemove(*identity), KErrNotFound); + EUNIT_ASSERT_EQUALS( buddyInfoList->Count(), 9); + buddyPresInfoWrite =MakeBuddyPresenceInfoLC(KBuddyId3no, KText1); + EUNIT_ASSERT_EQUALS( buddyInfoList->AddOrReplace(buddyPresInfoWrite), KErrNone); + + EUNIT_ASSERT_EQUALS( buddyInfoList->Count(), 10); + EUNIT_ASSERT_EQUALS( buddyInfoList->FindAndRemove(*identity), KErrNone); + EUNIT_ASSERT_EQUALS( buddyInfoList->Count(), 9); + EUNIT_ASSERT_EQUALS( buddyInfoList->FindAndRemove(*identity), KErrNotFound); + CleanupStack::Pop(1); // buddyPresInfoWrite + EUNIT_ASSERT_EQUALS( (TInt)(buddyInfoList->FindAndGet(*identity)), NULL); + CleanupStack::PopAndDestroy(1); // identity + + //calling async write function + TInt err = iMPresenceCacheWriter->WritePresenceL(buddyInfoList,this); + //if (err==KErrNone) + // WaitComplete(); + //Try Cancelling + err = iMPresenceCacheWriter->CancelWrite(); //always cancels receiving callback + //Write Again + err = iMPresenceCacheWriter->WritePresenceL(buddyInfoList,this); + if (err==KErrNone) + WaitComplete(); + else //Try again + { + err = iMPresenceCacheWriter->WritePresenceL(buddyInfoList,this); + if (err==KErrNone) + WaitComplete(); + } + EUNIT_ASSERT_EQUALS( iErrorFromHandler, KErrNone); + + + // read from 3rd service MSN + err = iMPresenceCacheReader->AllBuddiesPresenceInService(KService3, this); + //Try Cancelling + err = iMPresenceCacheReader->CancelRead(); + // Try reading again + err = iMPresenceCacheReader->AllBuddiesPresenceInService(KService3, this); + if (err+1) + WaitComplete(); + EUNIT_ASSERT_EQUALS( iErrorFromHandler, KErrNone); + + + //Now verify it, pick something to verify + CPresenceBuddyInfoImp* actualInfo(NULL); + CPresenceBuddyInfoImp* readInfo(NULL); + RPointerArray myArraywrite = buddyInfoList->GetObjectCollection(); + + RPointerArray myArrayread; // wont be owned + + TBool same1(EFalse); + if(iPresBuddyInfoList) // if list is received, compare for 3rd service MSN + { + myArrayread = iPresBuddyInfoList->GetObjectCollection(); //not owned + //1 + actualInfo = + TXIMPGetImpClassOrPanic::From(*(myArraywrite[6])); + + readInfo = + TXIMPGetImpClassOrPanic::From(*(myArrayread[0])); + + same1 = actualInfo->EqualsContent(*readInfo); + } + + + // read for first service sip + err = iMPresenceCacheReader->AllBuddiesPresenceInService(KService1, this); + if (err+1) + WaitComplete(); + EUNIT_ASSERT_EQUALS( iErrorFromHandler, KErrNone); + TBool same2(EFalse); + if(iPresBuddyInfoList) // if list is received, compare for 1st service SIP + { + myArrayread = iPresBuddyInfoList->GetObjectCollection(); //not owned + + actualInfo = + TXIMPGetImpClassOrPanic::From(*(myArraywrite[2])); + + readInfo = + TXIMPGetImpClassOrPanic::From(*(myArrayread[2])); + + same2 = actualInfo->EqualsContent(*readInfo); + } + + + // All buddies count + TInt count = iMPresenceCacheReader->BuddyCountInAllServices(); + + // buddies count in specific service + TInt count2 = iMPresenceCacheReader->BuddyCountInService(KService2); + + + // Testing DeletePresenceL + MXIMPIdentity* identity2 = CXIMPIdentityImp::NewLC(); + identity2->SetIdentityL(KBuddyId3MSN); + TInt remove = iMPresenceCacheWriter->DeletePresenceL(*identity2); + EUNIT_ASSERT_EQUALS( remove, KErrNone ); + remove = iMPresenceCacheWriter->DeletePresenceL(*identity2); + EUNIT_ASSERT_EQUALS( remove, KErrNotFound ); + identity2->SetIdentityL(KBuddyId3ICQ); + remove = iMPresenceCacheWriter->DeletePresenceL(*identity2); + EUNIT_ASSERT_EQUALS( remove, KErrNotFound ); + CleanupStack::PopAndDestroy(1); //identity2; + + + + TInt serviceCount = iMPresenceCacheReader->ServicesCount(); + + CleanupStack::PopAndDestroy(1); //buddyInfoList; + + EUNIT_ASSERT_EQUALS( same1, ETrue ); + EUNIT_ASSERT_EQUALS( same2, ETrue ); + EUNIT_ASSERT_EQUALS( count, 9 ); + EUNIT_ASSERT_EQUALS( count2, 3 ); + EUNIT_ASSERT_EQUALS( serviceCount, 3 ); + + } + + +void T_PresenceCache::T_DeletingAndCancellingL() + { + //Empty Reading + MXIMPIdentity* identity = CXIMPIdentityImp::NewLC(); + identity->SetIdentityL(KBuddyId1); + + + CleanupStack::PopAndDestroy(1); //identity + + //Empty counting functions + + // All buddies count + TInt count = iMPresenceCacheReader->BuddyCountInAllServices(); + EUNIT_ASSERT_EQUALS( count, 0 ); + + // buddies count in specific service + TInt count2 = iMPresenceCacheReader->BuddyCountInService(KService2); + EUNIT_ASSERT_EQUALS( count2, KErrNotFound ); + + + //Services count + TInt serviceCount = iMPresenceCacheReader->ServicesCount(); + EUNIT_ASSERT_EQUALS( serviceCount, 0 ); + + + //Empty async reading + TInt err = iMPresenceCacheReader->AllBuddiesPresenceInService(KService3, this); + if (err+1) + WaitComplete(); + EUNIT_ASSERT_EQUALS( iErrorFromHandler, KErrNotFound); + + //Writing async and verify results// this checks cancelling also + T_WriteReadPresenceAsyncL(); + + // Now try deleting + err = iMPresenceCacheWriter->DeleteService(KService3); + EUNIT_ASSERT_EQUALS( err, KErrNone); + + //Try deleting again + err = iMPresenceCacheWriter->DeleteService(KService3); + EUNIT_ASSERT_EQUALS( err, KErrNotFound); + + //Try reading the deleted presence + err = iMPresenceCacheReader->AllBuddiesPresenceInService(KService3, this); + if (err==KErrNone) + WaitComplete(); + EUNIT_ASSERT_EQUALS( iErrorFromHandler, KErrNotFound); + } + +void T_PresenceCache::T_PerformanceL() + { + + + + + } + +void T_PresenceCache::T_RunAllL() + { + T__PresenceInfoL(); + T_DeleteAllCacheL(); + + T_WriteReadPresenceAsyncL(); + T_DeleteAllCacheL(); + + T_DeletingAndCancellingL(); + // let the destructor delete the cache + } + + +//Utility Functions +MPresenceInfo* T_PresenceCache::MakePresenceInfoLC() + { + MPresenceInfo* presInfo = CPresenceInfoImp::NewLC(); + + MPresenceInfoFieldValueText* value = CPresenceInfoFieldValueTextImp::NewLC(); + value->SetTextValueL(KBuddyId1); + + MPresenceInfoField* infoField = CPresenceInfoFieldImp::NewLC(); + infoField->SetFieldTypeL(KIdentityField); + infoField->SetFieldValue(value); + + + MPersonPresenceInfo* personPres = CPersonPresenceInfoImp::NewLC(); + MPresenceInfoFieldCollection& fieldCol = personPres->Fields(); + fieldCol.AddOrReplaceFieldL(infoField); + TInt fieldCount= fieldCol.FieldCount(); + + presInfo->SetPersonPresenceL(personPres); + + CleanupStack::Pop(3);//personPres,infoField,value + + return presInfo; + } + +// Utility function but also test some code +MPresenceBuddyInfo* T_PresenceCache::MakeBuddyPresenceInfoLC( + const TDesC& id, const TDesC& text) + { + // it sets objects differently for different flag values of iCoverageTesting + // just of code coverage purpose + if(iCoverageTesting) + { // make the new + iCoverageTesting = !iCoverageTesting; + MPresenceBuddyInfo* buddyPresInfo = iMPresenceCacheWriter->NewBuddyPresenceInfoLC(); + MPresenceInfo* presInfo = iMPresenceCacheWriter->NewPresenceInfoLC(); + + MPresenceInfoFieldValueText* value = CPresenceInfoFieldValueTextImp::NewLC(); + value->SetTextValueL(text); + + MPresenceInfoField* infoField = CPresenceInfoFieldImp::NewLC(); + infoField->SetFieldTypeL(KIdentityField); + infoField->SetFieldValue(value); + + + MPersonPresenceInfo* personPres = CPersonPresenceInfoImp::NewLC(); + MPresenceInfoFieldCollection& fieldCol = personPres->Fields(); + fieldCol.AddOrReplaceFieldL(infoField); + TInt fieldCount= fieldCol.FieldCount(); + + presInfo->SetPersonPresenceL(personPres); + + MXIMPIdentity* identity = CXIMPIdentityImp::NewLC(); + identity->SetIdentityL(id); + + buddyPresInfo->Set(identity, presInfo); + + CleanupStack::Pop(5);//personPres,infoField,value,buddyPresInfo, identity + + return buddyPresInfo; + } + + iCoverageTesting = !iCoverageTesting; + MPresenceBuddyInfo* buddyPresInfo = iMPresenceCacheWriter->NewBuddyPresenceInfoLC(); + MPresenceInfo* presInfo = iMPresenceCacheWriter->NewPresenceInfoLC(); + + MPresenceInfoFieldValueText* value = CPresenceInfoFieldValueTextImp::NewLC(); + value->SetTextValueL(text); + + MPresenceInfoField* infoField = CPresenceInfoFieldImp::NewLC(); + infoField->SetFieldTypeL(KIdentityField); + infoField->SetFieldValue(value); + + + MPersonPresenceInfo* personPres = CPersonPresenceInfoImp::NewLC(); + MPresenceInfoFieldCollection& fieldCol = personPres->Fields(); + fieldCol.AddOrReplaceFieldL(infoField); + TInt fieldCount= fieldCol.FieldCount(); + + presInfo->SetPersonPresenceL(personPres); + + MXIMPIdentity* identity = CXIMPIdentityImp::NewLC(); + identity->SetIdentityL(id); + + + //Call again for the sake of code coverage + EUNIT_ASSERT_EQUALS( buddyPresInfo->SetBuddyId(identity), KErrNone); + EUNIT_ASSERT_EQUALS( buddyPresInfo->SetPresenceInfo(presInfo), KErrNone); + + CleanupStack::Pop(5);//personPres,infoField,value,buddyPresInfo, identity + + return buddyPresInfo; + } + +void T_PresenceCache::T_DeleteAllCacheL() + { + // all service uids + TInt count = iMPresenceCacheReader->ServicesCount(); + TInt err(KErrNone); + + err = iMPresenceCacheWriter->DeleteService(KService1); + err = iMPresenceCacheWriter->DeleteService(KService2); + err = iMPresenceCacheWriter->DeleteService(KService3); + err = iMPresenceCacheWriter->DeleteService(KService4); + err = iMPresenceCacheWriter->DeleteService(KService5); + err = iMPresenceCacheWriter->DeleteService(KService6); + } + +void T_PresenceCache::T_MakePerformancePreconditionsL() + { + } + +// Buddy with status text and avater +MPresenceBuddyInfo* T_PresenceCache::T_MakePerformanceBuddyLC(const TDesC& /*id*/ ) + { + /* + MPresenceBuddyInfo* buddyPresInfo = iMPresenceCacheWriter->NewBuddyPresenceInfoLC(); + MPresenceInfo* presInfo = iMPresenceCacheWriter->NewPresenceInfoLC(); + + //Text field + MPresenceInfoFieldValueText* value = CPresenceInfoFieldValueTextImp::NewLC(); + value->SetTextValueL(text); + + MPresenceInfoField* infoField = CPresenceInfoFieldImp::NewLC(); + infoField->SetFieldTypeL(KIdentityField); + infoField->SetFieldValue(value); + + //Binary field + MPresenceInfoFieldValueBinay* value = CPresenceInfoFieldValueBinaryImp::NewLC(); + value->SetBinaryValueL(text); + + MPresenceInfoField* infoField = CPresenceInfoFieldImp::NewLC(); + infoField->SetFieldTypeL(KIdentityField); + infoField->SetFieldValue(value); + + + + MPersonPresenceInfo* personPres = CPersonPresenceInfoImp::NewLC(); + MPresenceInfoFieldCollection& fieldCol = personPres->Fields(); + fieldCol.AddOrReplaceFieldL(infoField); + TInt fieldCount= fieldCol.FieldCount(); + + presInfo->SetPersonPresenceL(personPres); + + MXIMPIdentity* identity = CXIMPIdentityImp::NewLC(); + identity->SetIdentityL(id); + + TUid serviceid; + serviceid.iUid = service; + + buddyPresInfo->Set(serviceid, identity, presInfo); + + CleanupStack::Pop(5);//personPres,infoField,value,buddyPresInfo, identity + + return buddyPresInfo;*/ + } + + +void T_PresenceCache::T_SubscribeBuddy1Response() + { + // Notice: First set the initial state for User1, this is needed at least now. + MPresenceBuddyInfo* initInfo = MakeBuddyPresenceInfoLC(KBuddyId1no, KText1); + TInt err = iMPresenceCacheWriter->WritePresenceL(initInfo); + CleanupStack::PopAndDestroy( ); // initInfo + EUNIT_ASSERT_EQUALS( err, 0 ); + + err = iMPresenceCacheReader->SetObserverForSubscribedNotifications( this ); + EUNIT_ASSERT_EQUALS( err, 0 ); + + MXIMPIdentity* identity = CXIMPIdentityImp::NewLC(); + identity->SetIdentityL(KBuddyId1no); + + err = iMPresenceCacheReader->SubscribePresenceBuddyChangeL( *identity); + CleanupStack::PopAndDestroy(1); //identity + EUNIT_ASSERT_EQUALS( err, 0 ); + + // Presence feeder + iExpectedNotifyStatus = KErrNone; + iNbrNotifys = 1; + iPresenceFeeder->SetAvailabilityL( KBuddyId1, MPresenceFeeder::ENotAvailable, KText2); + + // TODO: + delete iExpectedNotifyContent; + iExpectedNotifyContent = NULL; + iExpectedNotifyContent = + MakeBuddyPresenceInfoLC(KBuddyId1no, KText2); + CleanupStack::Pop( ); // iExpectedNotifyContent + err = iMPresenceCacheWriter->WritePresenceL(iExpectedNotifyContent); + EUNIT_ASSERT_EQUALS( err, 0 ); + + iPresenceFeeder->RemoveAvailabilityL(KBuddyId2); + + // Now we start to wait callback method HandlePresenceNotificationL + WaitComplete(); + } + +void T_PresenceCache::T_SubscribeBuddyAndUnsubscribe() + { + // Test few error cases first + + // Test null parameter error case + TInt err = iMPresenceCacheReader->SetObserverForSubscribedNotifications( NULL ); + EUNIT_ASSERT_EQUALS( err, KErrArgument ); + + // Test subscription without callback registeration + MXIMPIdentity* identity = CXIMPIdentityImp::NewLC(); + identity->SetIdentityL(KBuddyId1ECE); + + err = iMPresenceCacheReader->SubscribePresenceBuddyChangeL( *identity); + EUNIT_ASSERT_EQUALS( err, KErrNotReady ); + + // Now make successful subscription + err = iMPresenceCacheReader->SetObserverForSubscribedNotifications( this ); + EUNIT_ASSERT_EQUALS( err, 0 ); + err = iMPresenceCacheReader->SubscribePresenceBuddyChangeL( *identity); + EUNIT_ASSERT_EQUALS( err, 0); + + // Make successful unsubscription + iMPresenceCacheReader->UnSubscribePresenceBuddyChangeL( *identity); + + CleanupStack::PopAndDestroy(1); //identity + // Now we start to wait callback method HandlePresenceNotificationL + } + +void T_PresenceCache::T_SubscribeBuddyManyResponses() + { + // Notice: First set the initial state for User1, this is needed at least now. + MPresenceBuddyInfo* initInfo = MakeBuddyPresenceInfoLC(KBuddyId1no, KText1); + TInt err = iMPresenceCacheWriter->WritePresenceL(initInfo); + CleanupStack::PopAndDestroy( ); // initInfo + EUNIT_ASSERT_EQUALS( err, 0 ); + + err = iMPresenceCacheReader->SetObserverForSubscribedNotifications( this ); + EUNIT_ASSERT_EQUALS( err, 0 ); + + MXIMPIdentity* identity = CXIMPIdentityImp::NewLC(); + identity->SetIdentityL(KBuddyId1no); + + err = iMPresenceCacheReader->SubscribePresenceBuddyChangeL( *identity); + CleanupStack::PopAndDestroy(1); //identity + EUNIT_ASSERT_EQUALS( err, 0 ); + + // Presence feeder + iExpectedNotifyStatus = KErrNone; + iNbrNotifys = 4; + iPresenceFeeder->SetAvailabilityL( KBuddyId1, MPresenceFeeder::ENotAvailable, KText2); + + delete iExpectedNotifyContent; + iExpectedNotifyContent = NULL; + iExpectedNotifyContent = + MakeBuddyPresenceInfoLC(KBuddyId1no, KText1); + CleanupStack::Pop( ); // iExpectedNotifyContent + err = iMPresenceCacheWriter->WritePresenceL(iExpectedNotifyContent); + EUNIT_ASSERT_EQUALS( err, 0 ); + + // Now we start to wait callback method HandlePresenceNotificationL + WaitComplete(); + } + +void T_PresenceCache::T_DeleteBeforeNotify() + { + // Notice: First set the initial state for User1, this is needed at least now. + TInt err; + /* + MPresenceBuddyInfo* initInfo = MakeBuddyPresenceInfoLC( KServiceUid6, KBuddyId1, KText1); + TInt err = iMPresenceCacheWriter->WritePresenceL(initInfo); + CleanupStack::PopAndDestroy( ); // initInfo + EUNIT_ASSERT_EQUALS( err, 0 ); */ + + err = iMPresenceCacheReader->SetObserverForSubscribedNotifications( this ); + EUNIT_ASSERT_EQUALS( err, 0 ); + + MXIMPIdentity* identity = CXIMPIdentityImp::NewLC(); + identity->SetIdentityL(KBuddyId1no); + + err = iMPresenceCacheReader->SubscribePresenceBuddyChangeL( *identity); + CleanupStack::PopAndDestroy(1); //identity + EUNIT_ASSERT_EQUALS( err, 0 ); + + // Presence feeder + iExpectedNotifyStatus = KErrNone; + iNbrNotifys = 1; + + + delete iMPresenceCacheReader; + iMPresenceCacheReader = NULL; + + // TODO: + delete iExpectedNotifyContent; + iExpectedNotifyContent = NULL; + iExpectedNotifyContent = + MakeBuddyPresenceInfoLC(KBuddyId1no, KText2); + CleanupStack::Pop( ); // iExpectedNotifyContent + err = iMPresenceCacheWriter->WritePresenceL(iExpectedNotifyContent); + EUNIT_ASSERT_EQUALS( err, 0 ); + + //no notification should come, since we have deleted the subscriber + } + + +// Callback observers + +void T_PresenceCache::HandlePresenceWriteL(TInt aErrorCode) + { + EUNIT_PRINT(_L("HandlePresenceWriteL")); + EUNIT_PRINT(_L(" aErrorCode: %d"), aErrorCode); + iCbReceived = ETrue; + iErrorFromHandler = aErrorCode; + + if( iWait.IsStarted() ) + { + iWait.AsyncStop(); + } + } + +void T_PresenceCache::HandlePresenceReadL(TInt aErrorCode, + MPresenceBuddyInfoList* aPresenceBuddyInfoList) + { + EUNIT_PRINT(_L("HandlePresenceReadL")); + EUNIT_PRINT(_L(" aErrorCode: %d"), aErrorCode); + iCbReceived = ETrue; + iErrorFromHandler = aErrorCode; + + + if(iPresBuddyInfoList) + delete iPresBuddyInfoList; iPresBuddyInfoList=NULL; + iPresBuddyInfoList = aPresenceBuddyInfoList; + + if( iWait.IsStarted() ) + { + iWait.AsyncStop(); + } + } + +// ***************************************************************************** + +void T_PresenceCache::HandlePresenceNotificationL(TInt aErrorCode, + MPresenceBuddyInfo* aPresenceBuddyInfo) + { + EUNIT_PRINT(_L("HandlePresenceNotiicationL")); + EUNIT_PRINT(_L(" aErrorCode: %d"), aErrorCode); + iCbReceived = ETrue; + iErrorFromHandler = aErrorCode; + + // check what is expected + EUNIT_ASSERT_EQUALS( aErrorCode, iExpectedNotifyStatus ); + + if ( aPresenceBuddyInfo ) + { + // We do not want to get anything when not expecting it. + TBool isNull = iExpectedNotifyContent ? EFalse : ETrue; + EUNIT_ASSERT_EQUALS( isNull, EFalse ); + // just check that this does not crash + const MXIMPIdentity* buddyId = aPresenceBuddyInfo->BuddyId(); + // Then test the whole content + TBool eq = iExpectedNotifyContent->EqualsIdentity( aPresenceBuddyInfo ); + EUNIT_ASSERT_EQUALS( eq, ETrue ); + } + else + { + EUNIT_PRINT(_L(" received buddyInfo is NULL")); + } + + delete aPresenceBuddyInfo; + + iNbrNotifys--; + + /* The test sequence of complicated case is + * sub Usr1 + * write Usr1 -> Notify + * sub Usr2 + * write Usr1 -> Notify + * write Usr2 -> Notify + * unsub Usr2 + * write Usr2 + * delete Usr1 -> notify(empty) + */ + + switch ( iNbrNotifys ) + { + case 3: + // subscribe U2 + { + // Notice: First set the initial state for User1, this is needed at least now. + MPresenceBuddyInfo* initInfo = MakeBuddyPresenceInfoLC(KBuddyId2no, KText2); + TInt err = iMPresenceCacheWriter->WritePresenceL(initInfo); + CleanupStack::PopAndDestroy( ); // initInfo + EUNIT_ASSERT_EQUALS( err, 0 ); + + MXIMPIdentity* identity = CXIMPIdentityImp::NewLC(); + identity->SetIdentityL(KBuddyId2no); + err = iMPresenceCacheReader->SubscribePresenceBuddyChangeL( *identity); + CleanupStack::PopAndDestroy(1); //identity + EUNIT_ASSERT_EQUALS( err, 0 ); + + // Presence feeder + iExpectedNotifyStatus = KErrNone; + delete iExpectedNotifyContent; + iExpectedNotifyContent = NULL; + iExpectedNotifyContent = + MakeBuddyPresenceInfoLC(KBuddyId1no, KText1); + CleanupStack::Pop( ); // iExpectedNotifyContent + err = iMPresenceCacheWriter->WritePresenceL(iExpectedNotifyContent); + EUNIT_ASSERT_EQUALS( err, 0 ); + // Now we start to wait callback method HandlePresenceNotificationL + } + break; + case 2: + { + // Presence feeder + iExpectedNotifyStatus = KErrNone; + delete iExpectedNotifyContent; + iExpectedNotifyContent = NULL; + iExpectedNotifyContent = + MakeBuddyPresenceInfoLC(KBuddyId2no, KText3); + CleanupStack::Pop( ); // iExpectedNotifyContent + TInt err = iMPresenceCacheWriter->WritePresenceL(iExpectedNotifyContent); + EUNIT_ASSERT_EQUALS( err, 0 ); + // Now we start to wait callback method HandlePresenceNotificationL + } + break; + case 1: + { + // Unsubscribe Usr2 + MXIMPIdentity* identity = CXIMPIdentityImp::NewLC(); + identity->SetIdentityL(KBuddyId2no); + iMPresenceCacheReader->UnSubscribePresenceBuddyChangeL( *identity ); + CleanupStack::PopAndDestroy(1); //identity + + // Write Usr2 + iExpectedNotifyStatus = KErrNone; + delete iExpectedNotifyContent; + iExpectedNotifyContent = NULL; + + // delete Usr1 + iPresenceFeeder->RemovePresenceL(KBuddyId1no); + iExpectedNotifyContent = + MakeBuddyPresenceInfoLC( KBuddyId1no, KText3); + TInt err = iExpectedNotifyContent->SetPresenceInfo( NULL ); + EUNIT_ASSERT_EQUALS( err, KErrArgument ); + CleanupStack::Pop( ); // iExpectedNotifyContent + + // Now we start to wait callback method HandlePresenceNotificationL + } + break; + case 0: + default: + if( iWait.IsStarted() ) + { + iWait.AsyncStop(); + } + break; + }; + + } + +// ***************************************************************************** + + +void T_PresenceCache::T_TestFeeder() + { + iPresenceFeeder->SetAvailabilityL(KBuddyId1,MPresenceFeeder::ENotAvailable,KText2); + iPresenceFeeder->SetAvailabilityL(KBuddyId1,MPresenceFeeder::ENotAvailable,KText2); + iPresenceFeeder->RemoveAvailabilityL(KBuddyId2); + iPresenceFeeder->RemoveAvailabilityL(KBuddyId1); + iPresenceFeeder->SetAvailabilityL(KBuddyId1,MPresenceFeeder::ENotAvailable,KText2); + iPresenceFeeder->RemovePresenceL(KBuddyId2); + iPresenceFeeder->RemovePresenceL(KBuddyId1); + iPresenceFeeder->SetAvailabilityL(KBuddyId1,MPresenceFeeder::ENotAvailable,KText2); + iPresenceFeeder->RemoveAllPresences(); + } + +// TEST TABLE +EUNIT_BEGIN_TEST_TABLE( + T_PresenceCache, + "Presence Cache module tests.", + "MODULE" ) + +EUNIT_TEST( + "T__PresenceInfoL", + "PresenceCache", + "T__PresenceInfoL", + "FUNCTIONALITY", + SetupL, T__PresenceInfoL, Teardown) + +EUNIT_TEST( + "T_WriteReadPresenceAsyncL", + "PresenceCache", + "T_WriteReadPresenceAsyncL", + "FUNCTIONALITY", + SetupL, T_WriteReadPresenceAsyncL, Teardown) + +EUNIT_TEST( + "T_DeletingAndCancellingL", + "PresenceCache", + "T_DeletingAndCancellingL", + "FUNCTIONALITY", + SetupL, T_DeletingAndCancellingL, Teardown) + +EUNIT_TEST( + "T_RunAllL", + "PresenceCache", + "T_RunAllL", + "FUNCTIONALITY", + SetupL, T_RunAllL, Teardown) + +EUNIT_TEST( + "T_TestFeeder", + "PresenceFeeder", + "T_TestFeeder", + "FUNCTIONALITY", + SetupL, T_TestFeeder, Teardown) + +EUNIT_TEST( + "T_SubscribeBuddyAndUnsubscribe", + "PresenceCache", + "T_SubscribeBuddyAndUnsubscribe", + "FUNCTIONALITY", + SetupL, T_SubscribeBuddyAndUnsubscribe, Teardown) + +EUNIT_TEST( + "T_SubscribeBuddy1Response", + "PresenceCache", + "T_SubscribeBuddy1Response", + "FUNCTIONALITY", + SetupL, T_SubscribeBuddy1Response, Teardown) + +EUNIT_TEST( + "T_SubscribeBuddyManyResponses", + "PresenceCache", + "T_SubscribeBuddyManyResponses", + "FUNCTIONALITY", + SetupL, T_SubscribeBuddyManyResponses, Teardown) + +EUNIT_TEST( + "T_DeleteBeforeNotify", + "PresenceCache", + "T_DeleteBeforeNotify", + "FUNCTIONALITY", + SetupL, T_DeleteBeforeNotify, Teardown) + +EUNIT_END_TEST_TABLE + +// END OF FILE diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/src/t_presencecache/T_PresenceCache.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/src/t_presencecache/T_PresenceCache.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,161 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework Test Code +* +*/ + + +#ifndef __T_MPRESENCECACHEREADER_H__ +#define __T_MPRESENCECACHEREADER_H__ + +// EXTERNAL INCLUDES +#include +#include +#include +#include +#include +#include + +#include + +class MPresenceBuddyInfo; +class MPresenceFeeder; + + +// INTERNAL INCLUDES + + +// FORWARD DECLARATIONS + + +// CLASS DEFINITION +/** + * TODO Auto-generated EUnit test suite + * + */ +NONSHARABLE_CLASS( T_PresenceCache ) + : public CEUnitTestSuiteClass, + public MPresCacheReadHandler, + public MPresCacheWriteHandler + { + public: // Constructors and destructors + + /** + * Two phase construction + */ + static T_PresenceCache* NewL(); + static T_PresenceCache* NewLC(); + /** + * Destructor + */ + ~T_PresenceCache(); + + public: // from handlers + void HandlePresenceWriteL(TInt aErrorCode); + void HandlePresenceReadL(TInt aErrorCode, + MPresenceBuddyInfoList* aPresenceBuddyInfoList); + void HandlePresenceNotificationL(TInt aErrorCode, + MPresenceBuddyInfo* aPresenceBuddyInfo); + + private: // Constructors and destructors + + T_PresenceCache(); + void ConstructL(); + + private: // New methods + + void SetupL(); + + void Teardown(); + + void T__PresenceInfoL(); + + void T_WriteReadPresenceAsyncL(); + + void T_DeletingAndCancellingL(); + + void T_PerformanceL(); + + void T_RunAllL(); + + void T_TestFeeder(); + + void T_SubscribeBuddy1Response(); + + void T_SubscribeBuddyAndUnsubscribe(); + + void T_SubscribeBuddyManyResponses(); + + void T_DeleteBeforeNotify(); + + + private: // utilities + MPresenceInfo* MakePresenceInfoLC(); + + MPresenceBuddyInfo* MakeBuddyPresenceInfoLC( + const TDesC& id, const TDesC& text); + + void T_DeleteAllCacheL(); + + void T_MakePerformancePreconditionsL(); + + MPresenceBuddyInfo* T_MakePerformanceBuddyLC(const TDesC& id); + + inline void WaitComplete(); + + + private: // Data + + MPresenceCacheReader* iMPresenceCacheReader; + MPresenceCacheWriter* iMPresenceCacheWriter; + + MPresenceFeeder* iPresenceFeeder; + + + MPresenceBuddyInfoList* iPresBuddyInfoList; + + EUNIT_DECLARE_TEST_TABLE; + TUid iUid; + + TBool iCoverageTesting; + + // we will record the error from handler here + TInt iErrorFromHandler; + + //OWN: Active scheduler wait and Cb received indication + CActiveSchedulerWait iWait; + TBool iCbReceived; + + // expected status of next notification + TInt iExpectedNotifyStatus; + // How many notifications are waicted until test is done. + TInt iNbrNotifys; + // Expected content of notification + // OWN + MPresenceBuddyInfo* iExpectedNotifyContent; + + }; + +inline void T_PresenceCache::WaitComplete() + { + iCbReceived = EFalse; + if( !iCbReceived ) + { + iWait.Start(); + } + } + +#endif // __T_MPRESENCECACHEREADER_H__ + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/src/t_presencecache/T_PresenceCache.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/src/t_presencecache/T_PresenceCache.mmp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,72 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework Test Code +* +*/ + +#include + + +TARGET t_presencecache.dll +TARGETTYPE dll +UID 0x1000af5a 0x01700000 + +CAPABILITY ALL -TCB +VENDORID 0x00000000 + +SOURCEPATH . +SOURCE t_presencecache.cpp +SOURCE t_presencecache_dllmain.cpp + + +USERINCLUDE . +USERINCLUDE ../../../presence/srcpresencedatamodel +USERINCLUDE ../../../presence/srcpresencedatamodel/presencecache + +SYSTEMINCLUDE /epoc32/../../epoc32/include +SYSTEMINCLUDE /epoc32/../../epoc32/include/Digia/EUnit + +// System include folders required by the tested code +//SYSTEMINCLUDE ../../../inc/presence/presencecache +SYSTEMINCLUDE ../../../inc/presence/presencedatamodel + + +//Following internal headers we are using +SYSTEMINCLUDE ../../../core/srcdatamodel +SYSTEMINCLUDE ../../../core/srcutils + + +SYSTEMINCLUDE ../../../presence/srcpresencedatamodel/presencepublishing +SYSTEMINCLUDE ../../../presence/srcpresencedatamodel/presenceinfo +SYSTEMINCLUDE ../../../presence/srcpresencedatamodel/presentitygroups +SYSTEMINCLUDE ../../../presence/srcpresencedatamodel +SYSTEMINCLUDE ../../../presence/srcpresencedatamodel/presencewatching +SYSTEMINCLUDE ../../../presence/srcpresencedatamodel/presenceauthorization +SYSTEMINCLUDE ../../../presence/srcpresencecache/presencecacheclient +SYSTEMINCLUDE ../../../presence/srcpresencecache/presencecacheserver + +MW_LAYER_SYSTEMINCLUDE + +LIBRARY EUnit.lib +LIBRARY EUnitUtil.lib +LIBRARY euser.lib +LIBRARY ecom.lib +LIBRARY presencedatamodel.lib +LIBRARY ximpdatamodel.lib +LIBRARY presencecacheclient.lib +LIBRARY ximputils.lib + +LIBRARY presencefeeder.lib + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/src/t_presencecache/T_PresenceCache_DllMain.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/src/t_presencecache/T_PresenceCache_DllMain.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,37 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework Test Code +* +*/ + + +// CLASS HEADER +#include "T_PresenceCache.h" + +// EXTERNAL INCLUDES +#include + +EXPORT_C MEUnitTest* CreateTestSuiteL() + { + return T_PresenceCache::NewL(); + } + +#ifndef EKA2 +GLDEF_C TInt E32Dll( TDllReason ) + { + return KErrNone; + } +#endif + +// END OF FILE diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/src/t_presencecache/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/src/t_presencecache/bld.inf Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,28 @@ +/* +* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework Test Code +* +*/ + + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS +// /epoc32/RELEASE/winscw/UDEB/T_PresenceCache.dll /epoc32/RELEASE/winscw/UDEB/z/sys/bin/T_PresenceCache.dll + +PRJ_TESTMMPFILES +T_PresenceCache.mmp + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/src/t_presencegrantrequestmngt/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/src/t_presencegrantrequestmngt/bld.inf Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,25 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Build information file for t_presencegrantrequestmngt.dll +* +*/ + + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +PRJ_TESTMMPFILES +t_presencegrantrequestmngt.mmp diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/src/t_presencegrantrequestmngt/t_presencegrantrequestmngt.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/src/t_presencegrantrequestmngt/t_presencegrantrequestmngt.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,911 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework Test Code +* +*/ + + +#include "eunittools.h" + +#include +#include +#include + +#include +#include +#include +#include +#include + +#include "t_presencegrantrequestmngt.h" + +#include "ximprequestcompleteeventimp.h" + +//#include "prfwtestpresencedatautils.h" + +// grant req includes +#include "presencegrantrequestinfoimp.h" +#include "presencegrantrequestlisteventimp.h" + + +// other data model includes +#include "ximpidentityimp.h" + +// utils includes +#include "ximpobjecthelpers.h" + +// testing tool includes +#include "prfwtestmessaging.h" +#include "prfwtestmessenger.h" +#include "prfwtestcontextwrappermgr.h" +#include "prfwtestcontextwrapper.h" + +#include "prfwtestfilesrvmsg.h" +#include "prfwtestfiletool.h" +#include "prfwtestlistener.h" + +#include "prfwtestrobustnesstools.h" + +_LIT8( KPrefix1, "PreA_" ); +_LIT8( KPrefix2, "PreB_" ); +_LIT8( KPrefix3, "PreC_" ); +_LIT8( KPrefix4, "PreD_" ); + +// ============================ MEMBER FUNCTIONS =============================== + +// CONSTRUCTION +T_PresenceGrantRequestManagement* T_PresenceGrantRequestManagement::NewL() + { + T_PresenceGrantRequestManagement* self = new( ELeave ) T_PresenceGrantRequestManagement; + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + + return self; + } + + +T_PresenceGrantRequestManagement::~T_PresenceGrantRequestManagement() + { + PrfwTestRobustness::DoPreCleaning(); + } + + +void T_PresenceGrantRequestManagement::ConstructL() + { + CEUnitTestSuiteClass::ConstructL(); + } + + +T_PresenceGrantRequestManagement::T_PresenceGrantRequestManagement() + { + } + + + +// =========================================================================== +// TEST CASE SETUP & TEARDOWN METHODS +// =========================================================================== +// + +void T_PresenceGrantRequestManagement::Setup_L() + { + PrfwTestRobustness::DoPreCleaning(); + + iWrapperMgr = CXIMPTestContextWrapperMgr::NewL(); + iWrapperMgr->CreateWrapperL(); + } + +void T_PresenceGrantRequestManagement::SetupMultiple_L() + { + PrfwTestRobustness::DoPreCleaning(); + + iWrapperMgr = CXIMPTestContextWrapperMgr::NewL(); + iWrapperMgr->CreateWrapperL(); + iWrapperMgr->CreateWrapperL(); + iWrapperMgr->CreateWrapperL(); + } + + +void T_PresenceGrantRequestManagement::BindL() + { + CXIMPTestContextWrapper* wrapper0 = iWrapperMgr->GetWrapperL( 0 ); + + wrapper0->BindL( 0 ); + } + +void T_PresenceGrantRequestManagement::BindAllL() + { + for( TInt a = 0; a < iWrapperMgr->WrapperCount(); ++a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + wrapper->BindL( 0 ); + } + } + + +void T_PresenceGrantRequestManagement::Teardown() + { + delete iWrapperMgr; + iWrapperMgr = NULL; + + REComSession::FinalClose(); + + PrfwTestRobustness::DoPreCleaning(); + } + +void T_PresenceGrantRequestManagement::UnbindL() + { + // Do unbind + CXIMPTestContextWrapper* wrapper0 = iWrapperMgr->GetWrapperL( 0 ); + wrapper0->UnbindL(); + } + +void T_PresenceGrantRequestManagement::UnbindAllL() + { + for( TInt a = 0; a < iWrapperMgr->WrapperCount(); ++a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + wrapper->UnbindL(); + } + } + + +// =========================================================================== +// TEST CASES for presentity presence subscription +// =========================================================================== + + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +void T_PresenceGrantRequestManagement::T_SubscribeGrantRequestList_Single_L() + { + EUNIT_PRINT( _L("Single presence grant request list subscription") ); + + BindL(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization(); + + // --------------------------------------------- + // 1. Subscribe grant request list + + // Setup status event listener for RequestComplete + listener2->Reset(); + + // normal request complete + TXIMPRequestId reqIdDummy; // not checked + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + // --------------------------------------------- + + // subscribe + // --------------------------------------------- + TXIMPRequestId reqId = presAuth.SubscribePresenceGrantRequestListL(); + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Subscribe failed" ); + // --------------------------------------------- + + // verify that SubscribeGrantListL was called + COMMONASSERT( messenger, EXIMPPlgTestSubscribePresenceGrantRequestListCalled, "SubscribeGrantListL was not called", ETrue, NULL ); + + + // --------------------------------------------- + // 2. refresh subscription + + // Setup status event listener for RequestComplete + listener2->Reset(); + + evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + RPrGrntReqInfoImpArray* pendingList(NULL); + CPresenceGrantRequestListEventImp* event = CreateGrantRequestListEventLCX( + KNullDesC, KNullDesC, + MXIMPDataSubscriptionState::ESubscriptionActive, + MXIMPDataSubscriptionState::EDataUnavailable, + ETestPGRPending, pendingList ); + listener2->ExpectL( event ); + CleanupStack::Pop(); //event 3 to go. + + // refresh subscription + // --------------------------------------------- + reqId = presAuth.SubscribePresenceGrantRequestListL(); + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Refresh failed" ); + CleanupStack::PopAndDestroy( 3 ); // rest of the items. + + + // --------------------------------------------- + // 3. Unsubscribe grant request list + + // Setup status event listener for RequestComplete + listener2->Reset(); + + evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + // unsubscribe + // --------------------------------------------- + reqId = presAuth.UnsubscribePresenceGrantRequestListL(); + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Unsubscribe failed" ); + + + // verify that UnsubscribeGrantListL was called + COMMONASSERT( messenger, EXIMPPlgTestUnsubscribePresenceGrantRequestListCalled, "UnsubscribeGrantListL was not called", ETrue, NULL ); + + + // --------------------------------------------- + // 4. Unsubscribe grant request list (non-subscribed) + + // Setup status event listener for RequestComplete + listener2->Reset(); + + evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + // unsubscribe + // --------------------------------------------- + reqId = presAuth.UnsubscribePresenceGrantRequestListL(); + + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Unsubscribe failed" ); + + // verify that UnsubscribeGrantListL was called + COMMONASSERT( messenger, EXIMPPlgTestUnsubscribePresenceGrantRequestListCalled, "UnsubscribeGrantListL was not called", ETrue, NULL ); + + // Deinitiliaze event source from listener. + listener2->SetEventSourceL( NULL ); + + UnbindL(); + + CleanupStack::PopAndDestroy( listener2 ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +void T_PresenceGrantRequestManagement::T_SubscribeGrantRequestList_Multiple_L() + { + EUNIT_PRINT( _L("Multiple presence grant request list subscription") ); + + BindAllL(); + + TInt countOfWrappers = iWrapperMgr->WrapperCount(); + TInt a(0); + for( a = 0; a < countOfWrappers; ++a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization(); + + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // expect normal request complete + TXIMPRequestId reqIdDummy; // not checked + CXIMPRequestCompleteEventImp* evReqComplete = + CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + // subscribe + TXIMPRequestId reqId = presAuth.SubscribePresenceGrantRequestListL(); + + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Subscribe failed" ); + + // verify that SubscribePresenceGrantRequestListL was called + COMMONASSERT( messenger, EXIMPPlgTestSubscribePresenceGrantRequestListCalled, "SubscribePresenceGrantRequestListL was not called", ETrue, NULL ); + + CleanupStack::PopAndDestroy( listener2 ); + } + + for( a = 0; a < countOfWrappers; ++a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization(); + + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // expect normal request complete + TXIMPRequestId reqIdDummy; // not checked + CXIMPRequestCompleteEventImp* evReqComplete = + CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + // unsubscribe + TXIMPRequestId reqId = presAuth.UnsubscribePresenceGrantRequestListL(); + + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Unsubscribe failed" ); + + // verify that EXIMPPlgTestUnsubscribeGroupListCalled was called + COMMONASSERT( messenger, EXIMPPlgTestUnsubscribeGroupListCalled, + "UnsubscribePresenceGrantRequestListL was not called", + EFalse, + "UnsubscribePresenceGrantRequestListL was called" ); + + CleanupStack::PopAndDestroy( listener2 ); + } + + UnbindAllL(); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +void T_PresenceGrantRequestManagement::SubscribeL() + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization(); + + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + + // ------------------------------------------------------ + // expect normal request complete + TXIMPRequestId reqIdDummy; // not checked + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + // ------------------------------------------------------ + + // subscribe + TXIMPRequestId reqId = presAuth.SubscribePresenceGrantRequestListL(); + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Subscribe failed" ); + + COMMONASSERT( messenger, EXIMPPlgTestSubscribePresenceGrantRequestListCalled, "SubscribeGrantRequestListL was not called", ETrue, NULL ); + + CleanupStack::PopAndDestroy( listener2 ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +void T_PresenceGrantRequestManagement::UnsubscribeL() + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceAuthorization& presAuth = presFeat->PresenceAuthorization(); + + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + + // ------------------------------------------------------ + // expect normal request complete + TXIMPRequestId reqIdDummy; // not checked + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + // ------------------------------------------------------ + + // unsubscribe + TXIMPRequestId reqId = presAuth.UnsubscribePresenceGrantRequestListL(); + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Unsubscribe failed" ); + + COMMONASSERT( messenger, EXIMPPlgTestUnsubscribePresenceGrantRequestListCalled, "UnsubscribeGrantRequestListL was not called", ETrue, NULL ); + + CleanupStack::PopAndDestroy( listener2 ); + } + + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +void T_PresenceGrantRequestManagement::T_HandlePresenceGrantRequestList_L() + { + EUNIT_PRINT( _L("Handle presence grant request list.") ); + + // log in and subscribe a group list + BindL(); + SubscribeL(); + + // ------------------------------------------------------ + // some startup stuff + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + // ------------------------------------------------------ + + // Tell the protocol it should act normally + wrapper->GetMessenger()->SetNoError(); + + // ------------------------------------------------------ + // 1. Create faked server message about grant req list (empty) + SendSrvMsgL( CXIMPTestFileSrvMsg::ETestSrvMsgPresenceGrantRequestList ); + + // ------------------------------------------------------ + // expect empty MPresentityGroupList event. + + RPrGrntReqInfoImpArray* pendingList(NULL); + CPresenceGrantRequestListEventImp* event = CreateGrantRequestListEventLCX( + KNullDesC, KNullDesC, + MXIMPDataSubscriptionState::ESubscriptionActive, + MXIMPDataSubscriptionState::EDataAvailable, + ETestPGRPending, pendingList ); + + listener2->ExpectL( event ); + CleanupStack::Pop( event ); // 3 more items in cleanupstack + + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "HandlePresenceGrantRequestListL failed" ); + CleanupStack::PopAndDestroy( 3 ); // lists + // ------------------------------------------------------ + + + _LIT16( KGrantReqUri, "http://carpe.diem.com" ); + _LIT16( KGrantReqDispName, "DispnameA, LoremI" ); + + // ------------------------------------------------------ + // 2. Create faked server message about grant req list (new) + listener2->Reset(); + + pendingList = NULL; // previous one was destroyed + event = CreateGrantRequestListEventLCX( KGrantReqUri, + KGrantReqDispName, + MXIMPDataSubscriptionState::ESubscriptionActive, + MXIMPDataSubscriptionState::EDataAvailable, + ETestPGRNewReq, pendingList ); + + SendSrvMsgL( KGrantReqUri, + KGrantReqDispName, + CXIMPTestFileSrvMsg::ETestSrvMsgPresenceGrantRequestList ); + + listener2->ExpectL( event ); + CleanupStack::Pop( event ); // 3 more items in cleanupstack + + // Waqas: Fixed Ticket #18 + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "HandlePresenceGrantRequestListL failed" ); + + CleanupStack::PopAndDestroy( 3 ); // lists + // ------------------------------------------------------ + + + CleanupStack::PopAndDestroy( listener2 ); + + // clean it up + UnsubscribeL(); + UnbindL(); + } + + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +_LIT16( KPresentUri1, "http://lorem.ipsum.com" ); +_LIT16( KPresentUri2, "http://carpe.diem.com" ); +_LIT16( KPresentDispName1, "DispnameA, LoremI" ); +_LIT16( KPresentDispName2, "DispnameB, CarpeD" ); +_LIT16( KPresentProtAddr1, "ABC" ); +_LIT16( KPresentProtAddr2, "HIJ" ); + +void T_PresenceGrantRequestManagement::T_HandlePresenceGrantRequestReceivedObsoleted_L() + { + EUNIT_PRINT( _L("Handle presence grant request received") ); + + BindL(); + SubscribeL(); + + // ------------------------------------------------------ + // some startup stuff + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + // ------------------------------------------------------ + + // Tell the protocol it should act normally + wrapper->GetMessenger()->SetNoError(); + + // ------------------------------------------------------ + // 1. Create faked server message about grant req received + SendSrvMsgInfoL( KPresentUri1, + KPresentDispName1, + CXIMPTestFileSrvMsg::ETestSrvMsgPresenceGrantRequestReceived ); + + // ------------------------------------------------------ + // expect MPresenceGrantRequestList event. + + CPresenceGrantRequestListEventImp* event = CreateGrantRequestListEventLCX( + KPresentUri1, KPresentDispName1, + MXIMPDataSubscriptionState::ESubscriptionActive, + MXIMPDataSubscriptionState::EDataAvailable, + ETestPGRNewReq, NULL ); + + listener2->ExpectL( event ); + CleanupStack::Pop( event ); // 3 more items in cleanupstack + + // Waqas: Fixed Ticket #18 + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "HandlePresenceGrantRequesReceivedL failed" ); + + + CleanupStack::PopAndDestroy( 3 ); // lists + // ------------------------------------------------------ + + + // ------------------------------------------------------ + // 2. Create faked server message about grant req obsoleted + listener2->Reset(); + + SendSrvMsgInfoL( KPresentUri1, + KPresentDispName1, + CXIMPTestFileSrvMsg::ETestSrvMsgPresenceGrantRequestObsoleted ); + + + // we need to create pending list to give to the event + RPrGrntReqInfoImpArray* pendingList = new ( ELeave ) RPrGrntReqInfoImpArray; + CleanupDeletePushL( pendingList ); + // create the group info + CXIMPIdentityImp* idForEvent = CXIMPIdentityImp::NewLC( KPresentUri1 ); + CPresenceGrantRequestInfoImp* grantInfoForEvent = + CPresenceGrantRequestInfoImp::NewLC( *idForEvent, KPresentDispName1 ); + pendingList->AppendL( grantInfoForEvent ); + CleanupStack::Pop( grantInfoForEvent ); + CleanupStack::PopAndDestroy( idForEvent ); + CleanupStack::Pop( pendingList ); + + //Now create the event + event = CreateGrantRequestListEventLCX( + KPresentUri1, KPresentDispName1, + MXIMPDataSubscriptionState::ESubscriptionActive, + MXIMPDataSubscriptionState::EDataAvailable, + ETestPGRObsoleted, pendingList ); + + listener2->ExpectL( event ); + CleanupStack::Pop( event ); // 3 more items in cleanupstack + + // Waqas: Fixed Ticket #18 + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "HandlePresenceGrantRequesObsoletedL failed" ); + + CleanupStack::PopAndDestroy( 3 ); // lists + // ------------------------------------------------------ + + CleanupStack::PopAndDestroy( listener2 ); + + // clean it up + UnsubscribeL(); + UnbindL(); + } + + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// send a faked server-originated message with grant request list made +// from the given uri and displayname +// +void T_PresenceGrantRequestManagement::SendSrvMsgL( + const TDesC& aUri, const TDesC& aDispName, + TInt aMsgType ) + { + // we'll use hard-coded wrapper 0 instance for now. + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + + // create a grant req info contained within the server-originated + // faked message + RXIMPObjOwningPtrArray grantList; + CleanupClosePushL( grantList ); + + CXIMPIdentityImp* grantId = CXIMPIdentityImp::NewLC( aUri ); + CPresenceGrantRequestInfoImp* grantItem = + CPresenceGrantRequestInfoImp::NewLC( *grantId, aDispName ); + grantList.AppendL( grantItem ); + CleanupStack::Pop( grantItem ); + CleanupStack::PopAndDestroy( grantId ); + + HBufC8* packedArray = + TXIMPObjectPacker::PackArrayL( grantList ); + CleanupStack::PushL( packedArray ); + + // use filetool to send it for plugin. + CXIMPTestFileSrvMsg* srvMsg = CXIMPTestFileSrvMsg::NewL( aMsgType, + *packedArray ); + CleanupStack::PushL( srvMsg ); + wrapper->FileTool().CleanAllL(); + wrapper->FileTool().SrvMsgStoreL( srvMsg ); + CleanupStack::PopAndDestroy( 3 ); // srvMsg, packedArray, grantList + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// send a faked server-originated message with grant request info made +// from the given uri and displayname +// +void T_PresenceGrantRequestManagement::SendSrvMsgInfoL( + const TDesC& aUri, const TDesC& aDispName, + TInt aMsgType ) + { + // we'll use hard-coded wrapper 0 instance for now. + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + + CXIMPIdentityImp* grantId = CXIMPIdentityImp::NewLC( aUri ); + CPresenceGrantRequestInfoImp* grantItem = + CPresenceGrantRequestInfoImp::NewLC( *grantId, aDispName ); + + HBufC8* packedInfo = + TXIMPObjectPacker::PackL( *grantItem ); + CleanupStack::PushL( packedInfo ); + + // use filetool to send it for plugin. + CXIMPTestFileSrvMsg* srvMsg = CXIMPTestFileSrvMsg::NewL( aMsgType, + *packedInfo ); + CleanupStack::PushL( srvMsg ); + wrapper->FileTool().CleanAllL(); + wrapper->FileTool().SrvMsgStoreL( srvMsg ); + CleanupStack::PopAndDestroy( 4 ); // srvMsg, packedItem, grantItem, grantId + } + + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// send a faked server-originated message with empty contents +// +void T_PresenceGrantRequestManagement::SendSrvMsgL( TInt aMsgType ) + { + // we'll use hard-coded wrapper 0 instance for now. + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + + // create a server-originated faked message with empty contents + RXIMPObjOwningPtrArray grantList; + + HBufC8* packedArray = TXIMPObjectPacker::PackArrayL( grantList ); + CleanupStack::PushL( packedArray ); + + // use filetool to send it for plugin. + CXIMPTestFileSrvMsg* srvMsg = CXIMPTestFileSrvMsg::NewL( aMsgType, + *packedArray ); + CleanupStack::PushL( srvMsg ); + wrapper->FileTool().CleanAllL(); + wrapper->FileTool().SrvMsgStoreL( srvMsg ); + CleanupStack::PopAndDestroy( 2 ); // srvMsg, packedArray + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// create a grant request list event with given arrays +// +CPresenceGrantRequestListEventImp* + T_PresenceGrantRequestManagement::CreateGrantRequestListEventLCX( + const TDesC& aUri, + const TDesC& aDispName, + MXIMPDataSubscriptionState::TSubscriptionState aSubscriptionState, + MXIMPDataSubscriptionState::TDataState aDataState, + TTestPGROperation aOperation, + RPrGrntReqInfoImpArray* aPendingList + ) + { + // create the arrays + + + // new list + RPrGrntReqInfoImpArray* newList = new ( ELeave ) RPrGrntReqInfoImpArray; + CleanupDeletePushL( newList ); + + // pending list + if(!aPendingList) // if client didnt created the list + aPendingList = new ( ELeave ) RPrGrntReqInfoImpArray; + CleanupDeletePushL( aPendingList ); + + // obsoleted list + RPrGrntReqInfoImpArray* obsoletedList = new ( ELeave ) RPrGrntReqInfoImpArray; + CleanupDeletePushL( obsoletedList ); + + // create subscription state + CXIMPDataSubscriptionStateImp* subsState = CXIMPDataSubscriptionStateImp::NewLC(); + + // create the group info + CPresenceGrantRequestInfoImp* grantInfoForEvent1 = NULL; + { + CXIMPIdentityImp* idForEvent = CXIMPIdentityImp::NewLC( aUri ); + grantInfoForEvent1 = CPresenceGrantRequestInfoImp::NewLC( *idForEvent, aDispName ); + CleanupStack::Pop( grantInfoForEvent1 ); + CleanupStack::PopAndDestroy( idForEvent ); + CleanupStack::PushL( grantInfoForEvent1 ); + } + + CPresenceGrantRequestInfoImp* grantInfoForEvent2 = + TXIMPObjectCloner< CPresenceGrantRequestInfoImp >::CloneLC( *grantInfoForEvent1 ); + + TInt count(0); + TBool found(EFalse); + TInt i(0); + + + // put the given grant info into the specified array + switch ( aOperation ) + { + case ETestPGRNewReq: + { + newList->AppendL( grantInfoForEvent2 ); + CleanupStack::Pop( grantInfoForEvent2 ); + + aPendingList->AppendL( grantInfoForEvent1 ); + CleanupStack::Pop( grantInfoForEvent1 ); + + break; + } + case ETestPGRPending: + { + // don't add, thus return what user has given + CleanupStack::PopAndDestroy( grantInfoForEvent2 ); // grantInfoForEvent2 + CleanupStack::PopAndDestroy( grantInfoForEvent1 ); // grantInfoForEvent1 + break; + } + + case ETestPGRObsoleted: + { + // search the given id in pending list + count = aPendingList->Count(); + for(i=0;iRequestorId()).Identity()) == aUri ) + && ( (((*aPendingList)[i])->RequestorDisplayName()) == aDispName )) + { + found = ETrue; + break; + } + } + if(found) // do we need to leave if error? Waqas + { + delete (*aPendingList)[i]; + aPendingList->Remove(i); + obsoletedList->AppendL( grantInfoForEvent2 ); + CleanupStack::Pop( grantInfoForEvent2 ); + } + else + CleanupStack::PopAndDestroy( grantInfoForEvent2 ); + + CleanupStack::PopAndDestroy( grantInfoForEvent1 ); + break; + } + + default: + { + User::Leave( KErrArgument ); + break; + } + }; + + subsState->SetSubscriptionStateL(aSubscriptionState); + subsState->SetDataStateL(aDataState); + + // create the actual event + CPresenceGrantRequestListEventImp* tmp = + CPresenceGrantRequestListEventImp::NewLC( + newList, + aPendingList, + obsoletedList, + subsState ); + + // subState is owned by the event, we need to pop it out from the stack + CleanupStack::Pop( tmp ); + CleanupStack::Pop( subsState ); + CleanupStack::PushL( tmp ); + + /* + * In cleanupstack there are 4 items, FIFO: + * - new list + * - pending list + * - obsoleted list + * - event imp + */ + + return tmp; + } + +// =========================================================================== +// TEST CASE TABLE +// =========================================================================== +// +EUNIT_BEGIN_TEST_TABLE( + T_PresenceGrantRequestManagement, + "XIMP presence grant request management tests", + "MODULE" ) + +PRFW_DECORATED_TEST( + "Grant request list subscription, single client", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_SubscribeGrantRequestList_Single_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Grant request list subscription, multiple clients", + "", + "", + "FUNCTIONALITY", + SetupMultiple_L, + T_SubscribeGrantRequestList_Multiple_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Handle presence grant request List", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_HandlePresenceGrantRequestList_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Handle presence grant request received and obsoleted", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_HandlePresenceGrantRequestReceivedObsoleted_L, + Teardown ) + + +/* +PRFW_DECORATED_TEST( + "New and obsolete request.", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_HandlePresentityGroupCreateAndDelete_L, + Teardown ) +*/ + +EUNIT_END_TEST_TABLE + + +// =========================================================================== +// TEST SUITE CONSTRUCTION +// =========================================================================== +// +EXPORT_C MEUnitTest* CreateTestSuiteL() + { + return T_PresenceGrantRequestManagement::NewL(); + } + + +// end of file diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/src/t_presencegrantrequestmngt/t_presencegrantrequestmngt.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/src/t_presencegrantrequestmngt/t_presencegrantrequestmngt.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,168 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework Test Code +* +*/ + +#ifndef T_PRESENCEGRANTREQUESTMANAGEMENT_H +#define T_PRESENCEGRANTREQUESTMANAGEMENT_H + +#include +#include +#include "prfwteststatuseventlistener.h" +#include "prfwtestmessaging.h" +#include "ximpdatasubscriptionstateimp.h" +#include "presencetypehelpers.h" + +class CXIMPTestContextWrapper; +class CXIMPTestContextWrapperMgr; +class CXIMPTestMessenger; +class CPresenceGrantRequestInfoImp; +class CPresenceGrantRequestListEventImp; + +/** + * XIMP Framework Eunit tests. + * + * Tests for XIMP session management services. + * + * @since S60 v4.0 + */ +class T_PresenceGrantRequestManagement : public CEUnitTestSuiteClass + { + +public: + static T_PresenceGrantRequestManagement* NewL(); + virtual ~T_PresenceGrantRequestManagement(); + + +private: + T_PresenceGrantRequestManagement(); + void ConstructL(); + +private: // Test case functions + + void Setup_L(); + void SetupMultiple_L(); + void BindL(); + void BindAllL(); + void Teardown(); + void UnbindL(); + void UnbindAllL(); + void SubscribeL(); + void UnsubscribeL(); + + void T_SubscribeGrantRequestList_Single_L(); + void T_SubscribeGrantRequestListRefresh_Single_L(); + void T_SubscribeGrantRequestList_Multiple_L(); + void T_HandlePresenceGrantRequestList_L(); + void T_HandlePresenceGrantRequestReceivedObsoleted_L(); + +private: // Test helpers + + /** + * Fake a server-originated (=mobile terminated) message. + * The message appears to adaptation and framework as if + * it came from the network. Uses only one group. + * @param aUri The URI of group + * @param aDispName The display name for the group + * @param aMsgType The message type for CXIMPTestFileSrvMsg + */ + void SendSrvMsgL( + const TDesC& aUri, const TDesC& aDispName, + TInt aMsgType ); + + // version for sending just the info instead of array + void SendSrvMsgInfoL( + const TDesC& aUri, const TDesC& aDispName, + TInt aMsgType ); + /** + * Fake a server-originated message with empty content. + * Whether to use this depends on the event you expect. + * @see SendSrvMsgL + */ + void SendSrvMsgL( TInt aMsgType ); + + // @see below + /* + enum TTestPGRArraySpecifier //Waqas: Not used anymore, use the next one + { + ETestPGRNewList = 0, // grant request list + ETestPGRNewReq, // new grant request + ETestPGRPending, // new grant request + ETestPGRObsoleted, // obsoleted grant request + ETestPGREmpty, // make an empty array for empty event + };*/ + + enum TTestPGROperation + { + ETestPGRNewReq = 0, // new grant request i.e. new req comes + ETestPGRPending, // new grant request i.e. subscribe to + ETestPGRObsoleted // obsoleted grant request i.e. req expired + }; + + /** + * Creates an event for newRequest, pending, or obselete presence grant + * request list. The caller provides an identity and current presence grant + * request listand depending on the provided operation an event is created. + * + * In cleanupstack there are 4 items, FIFO: + * - new list + * - pending list + * - obsoleted list + * - event imp + * + * This is because this event won't take ownership to the arrays + * when created this way. + * + * @param aUri Uri + * @param aDispName Displayname + * @param aOperation operation for which caller wants to generates event + * @param aPendingList Current pending list provided by caller, method takes + * ownership of the pending list, and it is included in above 3 lists. + * a NULL pointer with operation ETestPGRPending causes empty event. + * @return The suitably filled event. + */ + CPresenceGrantRequestListEventImp* CreateGrantRequestListEventLCX( + const TDesC& aUri, + const TDesC& aDispName, + MXIMPDataSubscriptionState::TSubscriptionState aSubscriptionState, + MXIMPDataSubscriptionState::TDataState aDataState, + TTestPGROperation aOperation, + RPrGrntReqInfoImpArray* aPendingList = NULL + ); + +private: // Test data + + /** + * Eunit test case table declaration. + */ + EUNIT_DECLARE_TEST_TABLE; + + // owned + CXIMPTestContextWrapperMgr* iWrapperMgr; + + // + TInt iLastError; + RXIMPObjOwningPtrArray< CPresenceGrantRequestInfoImp > iValidateArray; + }; + + +#endif // T_PRESENCEGRANTREQUESTMANAGEMENT_H + + + +// end of file + + + diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/src/t_presencegrantrequestmngt/t_presencegrantrequestmngt.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/src/t_presencegrantrequestmngt/t_presencegrantrequestmngt.mmp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,56 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework Test Code +* +*/ + +#include "../../tsrcutils/eunitcommon/eunittstdllbase.hrh" +#include "../../tsrcutils/processmaster/pm.h" + +TARGET t_presencegrantrequestmngt.dll + +SOURCEPATH . +SOURCE t_presencegrantrequestmngt.cpp + + +USERINCLUDE ../../../core/srcdatamodel +USERINCLUDE ../../../presence/srcpresencedatamodel +USERINCLUDE ../../../presence/srcpresencedatamodel/presentitygroups +USERINCLUDE ../../../presence/srcpresencedatamodel/presencewatching +USERINCLUDE ../../../presence/srcpresencedatamodel/presenceauthorization +USERINCLUDE ../../../presence/srcpresencedatamodel/presencepublishing +USERINCLUDE ../../../presence/srcpresencedatamodel/presenceinfo +USERINCLUDE ../../../core/srcutils + +// TODO remove unnecessary +SYSTEMINCLUDE ../../../inc/core/base +SYSTEMINCLUDE ../../../inc/core/datamodel +SYSTEMINCLUDE ../../../inc/core/protocolplugin +SYSTEMINCLUDE ../../../inc/core/protocolpluginhost +SYSTEMINCLUDE ../../../inc/presence/presencedatamodel +SYSTEMINCLUDE ../../../inc/presence/presencemanagement +SYSTEMINCLUDE ../../../inc/presence/presenceprotocolplugin +SYSTEMINCLUDE ../../../inc/presence/presenceprotocolpluginhost + +LIBRARY ecom.lib +LIBRARY bafl.lib +LIBRARY ximpdatamodel.lib +LIBRARY presencedatamodel.lib +LIBRARY ximputils.lib +LIBRARY estor.lib + + +// end of file + + diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/src/t_presencegrouplistmngt/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/src/t_presencegrouplistmngt/bld.inf Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,23 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Build information file for t_presencegrouplistmngt.dll +* +*/ + + +PRJ_PLATFORMS +DEFAULT + +PRJ_TESTMMPFILES +t_presencegrouplistmngt.mmp diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/src/t_presencegrouplistmngt/t_presencegrouplistmngt.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/src/t_presencegrouplistmngt/t_presencegrouplistmngt.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,1447 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework Test Code +* +*/ + + +#include "eunittools.h" + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "ximpstatusimp.h" +#include "ximprequestcompleteeventimp.h" +#include "t_presencegrouplistmngt.h" +#include "prfwteststatuseventlistener.h" +#include "prfwtestmessaging.h" +#include "prfwtestmessenger.h" +#include "prfwtestcontextwrappermgr.h" +#include "prfwtestcontextwrapper.h" +#include "prfwtesteventfactory.h" + +#include "presenceinfoimp.h" +#include "presenceinfofilterimp.h" +#include "prfwtestpresencedatautils.h" +#include "ximpidentityimp.h" +#include "ximpobjecthelpers.h" +#include "presentitygroupinfoimp.h" +#include "presentitygrouplisteventimp.h" +#include "presentitygroupcontenteventimp.h" +#include "prfwtestfilesrvmsg.h" +#include "prfwtestfiletool.h" +#include "prfwtestlistener.h" + +#include "prfwtestrobustnesstools.h" + +// ============================ MEMBER FUNCTIONS =============================== + +// CONSTRUCTION +T_PresenceGroupListManagement* T_PresenceGroupListManagement::NewL() + { + T_PresenceGroupListManagement* self = new( ELeave ) T_PresenceGroupListManagement; + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + + return self; + } + + +T_PresenceGroupListManagement::~T_PresenceGroupListManagement() + { + PrfwTestRobustness::DoPreCleaning(); + } + + +void T_PresenceGroupListManagement::ConstructL() + { + CEUnitTestSuiteClass::ConstructL(); + } + + +T_PresenceGroupListManagement::T_PresenceGroupListManagement() + { + } + + + +// =========================================================================== +// TEST CASE SETUP & TEARDOWN METHODS +// =========================================================================== +// + +void T_PresenceGroupListManagement::Setup_L() + { + PrfwTestRobustness::DoPreCleaning(); + + iWrapperMgr = CXIMPTestContextWrapperMgr::NewL(); + iWrapperMgr->CreateWrapperL(); + } + +void T_PresenceGroupListManagement::SetupMultiple_L() + { + PrfwTestRobustness::DoPreCleaning(); + + + iWrapperMgr = CXIMPTestContextWrapperMgr::NewL(); + iWrapperMgr->CreateWrapperL(); + iWrapperMgr->CreateWrapperL(); + iWrapperMgr->CreateWrapperL(); + } + + +void T_PresenceGroupListManagement::BindL() + { + CXIMPTestContextWrapper* wrapper0 = iWrapperMgr->GetWrapperL( 0 ); + + wrapper0->BindL( 0 ); + } + +void T_PresenceGroupListManagement::BindAllL() + { + for( TInt a = 0; a < iWrapperMgr->WrapperCount(); ++a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + wrapper->BindL( 0 ); + } + } + + +void T_PresenceGroupListManagement::Teardown() + { + delete iWrapperMgr; + iWrapperMgr = NULL; + + REComSession::FinalClose(); + + PrfwTestRobustness::DoPreCleaning(); + } + +void T_PresenceGroupListManagement::UnbindL() + { + // Do unbind + CXIMPTestContextWrapper* wrapper0 = iWrapperMgr->GetWrapperL( 0 ); + wrapper0->UnbindL(); + } + +void T_PresenceGroupListManagement::UnbindAllL() + { + for( TInt a = 0; a < iWrapperMgr->WrapperCount(); ++a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + wrapper->UnbindL(); + } + } + + +// =========================================================================== +// TEST CASES for presentity presence subscription +// =========================================================================== + + +// Single client, empty filter +void T_PresenceGroupListManagement::T_SubscribePresentityGroup_Single_L() + { + EUNIT_PRINT( _L("Single presentity group list subscription") ); + + BindL(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresentityGroups& presGroup = presFeat->PresentityGroups(); + + + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // --------------------------------------------- + // normal request complete + TXIMPRequestId reqIdDummy; // not checked + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + // subscribe + TXIMPRequestId reqId = presGroup.SubscribePresentityGroupListL(); + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Subscribe failed" ); + messenger->AssertSubscribePresentityGroupListCalled( ETrue ); + + // --------------------------------------------- + evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + + + CPresentityGroupListEventImp* event = XIMPTestEventFactory::CreateGroupListEventLCX( + KNullDesC, KNullDesC, + XIMPTestEventFactory::ETestPGLEmpty, + KNullDesC, KNullDesC, + MXIMPDataSubscriptionState::ESubscriptionInactive, + MXIMPDataSubscriptionState::EDataUnavailable + ); + + listener2->ExpectL( event ); + CleanupStack::Pop( event ); // 4 more items in cleanupstack + + // unsubscribe + // --------------------------------------------- + reqId = presGroup.UnsubscribePresentityGroupListL(); + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Unsubscribe failed" ); + CleanupStack::PopAndDestroy( 4 ); // group list event imp + messenger->AssertUnsubscribePresentityGroupListCalled( ETrue ); + + CleanupStack::PopAndDestroy( listener2 ); + + UnbindL(); + } + +// Single client, empty filter, error in unsubscribe +void T_PresenceGroupListManagement::T_UnsubscribePresentityGroup_Error_Single_L() + { + EUNIT_PRINT( _L("Single presentity group list unsubscribe with error") ); + + BindL(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresentityGroups& presGroup = presFeat->PresentityGroups(); + + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // --------------------------------------------- + // subscribe + TXIMPRequestId reqIdDummy; // not checked + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + TXIMPRequestId reqId = presGroup.SubscribePresentityGroupListL(); + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Subscribe failed" ); + messenger->AssertSubscribePresentityGroupListCalled( ETrue ); + + // --------------------------------------------- + // unsubscribe + messenger->SetError( KErrArgument ); + evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + evReqComplete->CompletionResultImp().SetResultCode( KErrArgument ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + reqId = presGroup.UnsubscribePresentityGroupListL(); + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Unsubscribe failed" ); + messenger->AssertUnsubscribePresentityGroupListCalled( ETrue ); + + CleanupStack::PopAndDestroy( listener2 ); + + UnbindL(); + } + +// Single client, empty filter, error in sub +void T_PresenceGroupListManagement::T_SubscribePresentityGroup_Error_Single_L() + { + EUNIT_PRINT( _L("Single presentity group list subscribe with error") ); + + BindL(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresentityGroups& presGroup = presFeat->PresentityGroups(); + + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + + // Tell the protocol it should act normally + messenger->SetError( KErrArgument ); + + // --------------------------------------------- + // subscribe + TXIMPRequestId reqIdDummy; // not checked + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + evReqComplete->CompletionResultImp().SetResultCode( KErrArgument ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + TXIMPRequestId reqId = presGroup.SubscribePresentityGroupListL(); + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Subscribe failed" ); + messenger->AssertSubscribePresentityGroupListCalled( ETrue ); + + CleanupStack::PopAndDestroy( listener2 ); + + UnbindL(); + } + + +// multiple clients, all subscribe + unsubscribe +void T_PresenceGroupListManagement::T_SubscribePresentityGroup_Multiple_L() + { + EUNIT_PRINT( _L("Multiple presentity group list subscription") ); + + BindAllL(); + + TInt countOfWrappers = iWrapperMgr->WrapperCount(); + for( TInt a = 0; a < countOfWrappers; ++a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresentityGroups& presGroup = presFeat->PresentityGroups(); + + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // expect normal request complete + TXIMPRequestId reqIdDummy; // not checked + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + // subscribe + TXIMPRequestId reqId = presGroup.SubscribePresentityGroupListL(); + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Subscribe failed" ); + messenger->AssertSubscribePresentityGroupListCalled( ETrue ); + + CleanupStack::PopAndDestroy( listener2 ); + } + + for( TInt a = 0; a < countOfWrappers; ++a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresentityGroups& presGroup = presFeat->PresentityGroups(); + + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // expect normal request complete + TXIMPRequestId reqIdDummy; // not checked + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + CPresentityGroupListEventImp* event = XIMPTestEventFactory::CreateGroupListEventLCX( + KNullDesC, KNullDesC, + XIMPTestEventFactory::ETestPGLEmpty, + KNullDesC, KNullDesC, + MXIMPDataSubscriptionState::ESubscriptionInactive, + MXIMPDataSubscriptionState::EDataUnavailable + ); + + listener2->ExpectL( event ); + CleanupStack::Pop( event ); // 4 more items in cleanupstack + + // unsubscribe + TXIMPRequestId reqId = presGroup.UnsubscribePresentityGroupListL(); + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Unsubscribe failed" ); + CleanupStack::PopAndDestroy( 4 ); // group list event imp + messenger->AssertUnsubscribePresentityGroupListCalled( a == countOfWrappers-1 ? ETrue : EFalse ); + + CleanupStack::PopAndDestroy( listener2 ); + } + + UnbindAllL(); + } + +// Multiple clients, all subscribe and refresh +void T_PresenceGroupListManagement::T_RefreshPresentityGroup_Multiple_L() + { + EUNIT_PRINT( _L("Multiple presentity group list subscription refresh") ); + + BindAllL(); + + // SUBSCRIBE + TInt countOfWrappers = iWrapperMgr->WrapperCount(); + for( TInt a = 0; a < countOfWrappers; ++a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresentityGroups& presGroup = presFeat->PresentityGroups(); + + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // expect normal request complete + TXIMPRequestId reqIdDummy; // not checked + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + // subscribe + TXIMPRequestId reqId = presGroup.SubscribePresentityGroupListL(); + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Subscribe failed" ); + messenger->AssertSubscribePresentityGroupListCalled( ETrue ); + + CleanupStack::PopAndDestroy( listener2 ); + } + + // REFRESH + for( TInt a = 0; a < countOfWrappers; ++a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresentityGroups& presGroup = presFeat->PresentityGroups(); + + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // refresh subscription + TXIMPRequestId reqIdDummy; // not checked + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + CPresentityGroupListEventImp* event = XIMPTestEventFactory::CreateGroupListEventLCX( + KNullDesC, KNullDesC, + XIMPTestEventFactory::ETestPGLUpdated, + KNullDesC, KNullDesC, + MXIMPDataSubscriptionState::ESubscriptionActive, + MXIMPDataSubscriptionState::EDataUnavailable + ); + + listener2->ExpectL( event ); + CleanupStack::Pop( event ); // 4 more items in cleanupstack + + TXIMPRequestId reqId = presGroup.SubscribePresentityGroupListL(); + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Subscribe failed" ); + CleanupStack::PopAndDestroy( 4 ); // group list event imp + messenger->AssertSubscribePresentityGroupListCalled( ETrue ); + + CleanupStack::PopAndDestroy( listener2 ); + } + + // unsubscribe all + for( TInt a = 0; a < countOfWrappers; ++a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresentityGroups& presGroup = presFeat->PresentityGroups(); + + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // expect normal request complete + TXIMPRequestId reqIdDummy; // not checked + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + CPresentityGroupListEventImp* event = XIMPTestEventFactory::CreateGroupListEventLCX( + KNullDesC, KNullDesC, + XIMPTestEventFactory::ETestPGLEmpty, + KNullDesC, KNullDesC, + MXIMPDataSubscriptionState::ESubscriptionInactive, + MXIMPDataSubscriptionState::EDataUnavailable + ); + + listener2->ExpectL( event ); + CleanupStack::Pop( event ); // 4 more items in cleanupstack + + // unsubscribe + TXIMPRequestId reqId = presGroup.UnsubscribePresentityGroupListL(); + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Unsubscribe failed" ); + CleanupStack::PopAndDestroy( 4 ); // group list event imp + messenger->AssertUnsubscribePresentityGroupListCalled( a == countOfWrappers-1 ? ETrue : EFalse ); + + CleanupStack::PopAndDestroy( listener2 ); + } + + UnbindAllL(); + } + + +// Multiple clients, all but one subscribe and all do unsubscribe +void T_PresenceGroupListManagement::T_SubscribeAll_One_Unsub_Multiple_L() + { + EUNIT_PRINT( _L("Multiple, all but one subscribes and all unsubscribe") ); + + BindAllL(); + + // SUBSCRIBE + TInt countOfWrappers = iWrapperMgr->WrapperCount(); + TInt skipIndex = 1; + for( TInt a = 0; a < countOfWrappers; ++a ) + { + if ( skipIndex != a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresentityGroups& presGroup = presFeat->PresentityGroups(); + + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // expect normal request complete + TXIMPRequestId reqIdDummy; // not checked + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + // subscribe + TXIMPRequestId reqId = presGroup.SubscribePresentityGroupListL(); + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Subscribe failed" ); + messenger->AssertSubscribePresentityGroupListCalled( ETrue ); + + CleanupStack::PopAndDestroy( listener2 ); + } + } + + // unsubscribe all + for( TInt a = 0; a < countOfWrappers; ++a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresentityGroups& presGroup = presFeat->PresentityGroups(); + + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // expect normal request complete + TXIMPRequestId reqIdDummy; // not checked + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + CPresentityGroupListEventImp* event = XIMPTestEventFactory::CreateGroupListEventLCX( + KNullDesC, KNullDesC, + XIMPTestEventFactory::ETestPGLEmpty, + KNullDesC, KNullDesC, + MXIMPDataSubscriptionState::ESubscriptionInactive, + MXIMPDataSubscriptionState::EDataUnavailable + ); + + listener2->ExpectL( event ); + CleanupStack::Pop( event ); // 4 more items in cleanupstack + + // unsubscribe + TXIMPRequestId reqId = presGroup.UnsubscribePresentityGroupListL(); + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Unsubscribe failed" ); + CleanupStack::PopAndDestroy( 4 ); // group list event imp + + messenger->AssertUnsubscribePresentityGroupListCalled( a == countOfWrappers-1 ? ETrue : EFalse ); + + CleanupStack::PopAndDestroy( listener2 ); + } + + UnbindAllL(); + } + +// Multiple clients, refresh case for one +void T_PresenceGroupListManagement::T_RefreshPresentityGroup_One_Multiple_L() + { + EUNIT_PRINT( _L("Multiple, one context does presentity group list refresh") ); + + BindAllL(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresentityGroups& presGroup = presFeat->PresentityGroups(); + + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // --------------------------------------------- + // subscribe + TXIMPRequestId reqIdDummy; // not checked + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + TXIMPRequestId reqId = presGroup.SubscribePresentityGroupListL(); + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Subscribe failed" ); + messenger->AssertSubscribePresentityGroupListCalled( ETrue ); + + // --------------------------------------------- + // refresh subscribe + + messenger->SetValueFor( + EXIMPPlgTestSubscribeGroupListCalled, + EFalse ); + + evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + CPresentityGroupListEventImp* event = XIMPTestEventFactory::CreateGroupListEventLCX( + KNullDesC, KNullDesC, + XIMPTestEventFactory::ETestPGLUpdated, + KNullDesC, KNullDesC, + MXIMPDataSubscriptionState::ESubscriptionActive, + MXIMPDataSubscriptionState::EDataUnavailable + ); + + listener2->ExpectL( event ); + CleanupStack::Pop( event ); // 4 more items in cleanupstack + + reqId = presGroup.SubscribePresentityGroupListL(); + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Subscribe refresh failed" ); + CleanupStack::PopAndDestroy( 4 ); // group list event imp + messenger->AssertSubscribePresentityGroupListCalled( EFalse ); + + // --------------------------------------------- + // unsubscribe + evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + event = XIMPTestEventFactory::CreateGroupListEventLCX( + KNullDesC, KNullDesC, + XIMPTestEventFactory::ETestPGLEmpty, + KNullDesC, KNullDesC, + MXIMPDataSubscriptionState::ESubscriptionInactive, + MXIMPDataSubscriptionState::EDataUnavailable + ); + + listener2->ExpectL( event ); + CleanupStack::Pop( event ); // 4 more items in cleanupstack + + reqId = presGroup.UnsubscribePresentityGroupListL(); + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Unsubscribe failed" ); + CleanupStack::PopAndDestroy( 4 ); // group list event imp + messenger->AssertUnsubscribePresentityGroupListCalled( ETrue ); + + CleanupStack::PopAndDestroy( listener2 ); + + UnbindAllL(); + } + + + +void T_PresenceGroupListManagement::SubscribeL() + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresentityGroups& presGroup = presFeat->PresentityGroups(); + + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + + // ------------------------------------------------------ + // expect normal request complete + TXIMPRequestId reqIdDummy; // not checked + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + // ------------------------------------------------------ + + // subscribe + TXIMPRequestId reqId = presGroup.SubscribePresentityGroupListL(); + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Subscribe failed" ); + messenger->AssertSubscribePresentityGroupListCalled( ETrue ); + + CleanupStack::PopAndDestroy( listener2 ); + } + + + +void T_PresenceGroupListManagement::SubscribeGroupL( const TDesC& aGroupId ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresentityGroups& presGroup = presFeat->PresentityGroups(); + + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + + // ------------------------------------------------------ + // expect normal request complete + TXIMPRequestId reqIdDummy; // not checked + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + // ------------------------------------------------------ + + // subscribe group content + MXIMPIdentity* identity = context->ObjectFactory().NewIdentityLC(); + identity->SetIdentityL( aGroupId ); + + TXIMPRequestId reqId = presGroup.SubscribePresentityGroupContentL( *identity ); + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Subscribe content failed" ); + + COMMONASSERT( messenger, EXIMPPlgTestSubscribePresentityGroupContentCalled, "SubscribeGroupContentL was not called", ETrue, NULL ); + + CleanupStack::PopAndDestroy(); // identity + CleanupStack::PopAndDestroy( listener2 ); + } + + + +void T_PresenceGroupListManagement::UnsubscribeL() + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresentityGroups& presGroup = presFeat->PresentityGroups(); + + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + + // ------------------------------------------------------ + // expect normal request complete + TXIMPRequestId reqIdDummy; // not checked + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + CPresentityGroupListEventImp* event = XIMPTestEventFactory::CreateGroupListEventLCX( + KNullDesC, KNullDesC, + XIMPTestEventFactory::ETestPGLEmpty, + KNullDesC, KNullDesC, + MXIMPDataSubscriptionState::ESubscriptionInactive, + MXIMPDataSubscriptionState::EDataUnavailable + ); + + listener2->ExpectL( event ); + CleanupStack::Pop( event ); // 4 more items in cleanupstack + + // unsubscribe + TXIMPRequestId reqId = presGroup.UnsubscribePresentityGroupListL(); + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Unsubscribe failed" ); + CleanupStack::PopAndDestroy( 4 ); // group list event imp + messenger->AssertUnsubscribePresentityGroupListCalled( ETrue ); + + CleanupStack::PopAndDestroy( listener2 ); + } + + +void T_PresenceGroupListManagement::UnsubscribeGroupL( const TDesC& aGroupId ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresentityGroups& presGroup = presFeat->PresentityGroups(); + + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + + // ------------------------------------------------------ + // expect normal request complete + TXIMPRequestId reqIdDummy; // not checked + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + // and a group content event, IF we have subscribed the group beforehand + // i.e. SubscribeGroupL has been called before this + + MXIMPIdentity* identity = context->ObjectFactory().NewIdentityLC(); + identity->SetIdentityL( aGroupId ); + + CPresentityGroupContentEventImp* groupCntEvent = + XIMPTestEventFactory::CreateGroupContentEventLCX( + aGroupId, + KNullDesC, + KNullDesC, + XIMPTestEventFactory::ETestPGLCntRemoved, + KNullDesC, + KNullDesC, + MXIMPDataSubscriptionState::ESubscriptionInactive, + MXIMPDataSubscriptionState::EDataUnavailable + ); + + listener2->ExpectL( groupCntEvent ); + CleanupStack::Pop( groupCntEvent ); + + // ------------------------------------------------------ + + // unsubscribe + + TXIMPRequestId reqId = presGroup.UnsubscribePresentityGroupContentL( *identity ); + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Unsubscribe group content failed" ); + messenger->AssertUnsubscribePresentityGroupContentCalled( ETrue ); + + CleanupStack::PopAndDestroy( 5 ); // rest of the group content event + CleanupStack::PopAndDestroy(); // identity + + CleanupStack::PopAndDestroy( listener2 ); + } + + + +// Single client, empty filter +void T_PresenceGroupListManagement::T_HandlePresentityGroupList_L() + { + EUNIT_PRINT( _L("Handle presentity group list.") ); + + // log in and subscribe a group list + BindL(); + SubscribeL(); + + // ------------------------------------------------------ + // some startup stuff + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + // ------------------------------------------------------ + + // Tell the protocol it should act normally + wrapper->GetMessenger()->SetNoError(); + + // ------------------------------------------------------ + // 1. Create faked server message about group list + SendSrvMsgL( CXIMPTestFileSrvMsg::ETestSrvMsgPresentityGroupList ); + + // ------------------------------------------------------ + // expect empty MPresentityGroupList event. + + CPresentityGroupListEventImp* event = XIMPTestEventFactory::CreateGroupListEventLCX( + KNullDesC, KNullDesC, + XIMPTestEventFactory::ETestPGLEmpty, + KNullDesC, KNullDesC, + MXIMPDataSubscriptionState::ESubscriptionActive, + MXIMPDataSubscriptionState::EDataAvailable + ); + + listener2->ExpectL( event ); + CleanupStack::Pop( event ); // 4 more items in cleanupstack + + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "HandlePresentityGroupListL failed" ); + CleanupStack::PopAndDestroy( 4 ); // lists + // ------------------------------------------------------ + + CleanupStack::PopAndDestroy( listener2 ); + + // clean it up + UnsubscribeL(); + UnbindL(); + } + + + +_LIT16( KPresentUri1, "http://lorem.ipsum.com" ); +_LIT16( KPresentUri2, "http://carpe.diem.com" ); +_LIT16( KPresentDispName1, "DispnameA, LoremI" ); +_LIT16( KPresentDispName2, "DispnameB, CarpeD" ); +_LIT16( KPresentProtAddr1, "ABC" ); +_LIT16( KPresentProtAddr2, "HIJ" ); + +void T_PresenceGroupListManagement::T_HandlePresentityGroupCreateAndDelete_L() + { + EUNIT_PRINT( _L("Handle presentity group creation and deletion.") ); + + // log in and subscribe a group list + BindL(); + SubscribeL(); + + // ------------------------------------------------------ + // some startup stuff + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + // ------------------------------------------------------ + + // Tell the protocol it should act normally + wrapper->GetMessenger()->SetNoError(); + + // ------------------------------------------------------ + // 1. Create faked notification about create + SendSrvMsgL( KPresentUri1, KPresentDispName1, + CXIMPTestFileSrvMsg::ETestSrvMsgPresentityGroupCreate ); + + // ------------------------------------------------------ + // expect MPresentityGroupList event. + CPresentityGroupListEventImp* event = XIMPTestEventFactory::CreateGroupListEventLCX( + KPresentUri1, KPresentDispName1, + XIMPTestEventFactory::ETestPGLCreated, + + KPresentUri1, KPresentDispName1, + MXIMPDataSubscriptionState::ESubscriptionActive, + MXIMPDataSubscriptionState::EDataAvailable + ); + + listener2->ExpectL( event ); + CleanupStack::Pop( event ); // 4 more items in cleanupstack + + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "HandlePresentityGroupListL failed (Creation)" ); + CleanupStack::PopAndDestroy( 4 ); // lists + + // ------------------------------------------------------ + // Send a faked delete message + + SendSrvMsgL( KPresentUri1, KPresentDispName1, + CXIMPTestFileSrvMsg::ETestSrvMsgPresentityGroupDelete ); + + // ------------------------------------------------------ + // expect MPresentityGroupList event. + + event = XIMPTestEventFactory::CreateGroupListEventLCX( + KPresentUri1, KNullDesC, + XIMPTestEventFactory::ETestPGLDeleted, + KNullDesC, KNullDesC, + MXIMPDataSubscriptionState::ESubscriptionActive, + MXIMPDataSubscriptionState::EDataAvailable + ); + + listener2->ExpectL( event ); + CleanupStack::Pop( event ); // 4 more items in cleanupstack + + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "HandlePresentityGroupListL failed (Deletion)" ); + CleanupStack::PopAndDestroy( 4 ); // lists + // ------------------------------------------------------ + + CleanupStack::PopAndDestroy( listener2 ); + + // unsubscribe group list and log out + UnsubscribeL(); + UnbindL(); + } + +// Single client, subscribed to the group, then subscribe list +void T_PresenceGroupListManagement::T_HandlePresentityGroupList_Subscribed_L() + { + EUNIT_PRINT( _L("Handle presentity group list, subscribed to the group.") ); + + // log in + BindL(); + SubscribeGroupL( KPresentUri1 ); + SubscribeL(); + + // ------------------------------------------------------ + // some startup stuff + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + // ------------------------------------------------------ + + // Tell the protocol it should act normally + wrapper->GetMessenger()->SetNoError(); + + // ------------------------------------------------------ + // 1. Create faked server message about group list + SendSrvMsgL( KPresentUri1, + KPresentDispName1, + CXIMPTestFileSrvMsg::ETestSrvMsgPresentityGroupCreate ); + + // ------------------------------------------------------ + // expect empty MPresentityGroupList event. + + CPresentityGroupListEventImp* event = XIMPTestEventFactory::CreateGroupListEventLCX( + KPresentUri1, KPresentDispName1, + XIMPTestEventFactory::ETestPGLCreated, + KPresentUri1, KPresentDispName1, + MXIMPDataSubscriptionState::ESubscriptionActive, + MXIMPDataSubscriptionState::EDataAvailable + ); + + listener2->ExpectL( event ); + CleanupStack::Pop( event ); // 4 more items in cleanupstack + + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "HandlePresentityGroupListL failed" ); + CleanupStack::PopAndDestroy( 4 ); // lists + // ------------------------------------------------------ + + CleanupStack::PopAndDestroy( listener2 ); + + // clean it up + UnsubscribeL(); + UnsubscribeGroupL( KPresentUri1 ); + UnbindL(); + } + +void T_PresenceGroupListManagement::T_HandlePresentityGroupUpdate_L() + { + EUNIT_PRINT( _L("Handle presentity group displayname update.") ); + + // log in and subscribe a group list + BindL(); + SubscribeL(); + + // ------------------------------------------------------ + // some startup stuff + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + // ------------------------------------------------------ + + // Tell the protocol it should act normally + wrapper->GetMessenger()->SetNoError(); + + // ------------------------------------------------------ + // 1. Create faked notification about create + SendSrvMsgL( KPresentUri1, KPresentDispName1, + CXIMPTestFileSrvMsg::ETestSrvMsgPresentityGroupCreate ); + + // ------------------------------------------------------ + // expect MPresentityGroupList event. + + CPresentityGroupListEventImp* event = XIMPTestEventFactory::CreateGroupListEventLCX( + KPresentUri1, KPresentDispName1, + XIMPTestEventFactory::ETestPGLCreated, + KPresentUri1, KPresentDispName1, + MXIMPDataSubscriptionState::ESubscriptionActive, + MXIMPDataSubscriptionState::EDataAvailable + ); + + listener2->ExpectL( event ); + CleanupStack::Pop( event ); // 4 more items in cleanupstack + + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "HandlePresentityGroupListL failed (Creation)" ); + CleanupStack::PopAndDestroy( 4 ); // lists + + // ------------------------------------------------------ + // 4. Change displayname of group and send faked notification about + // update + + SendSrvMsgL( KPresentUri1, KPresentDispName2, + CXIMPTestFileSrvMsg::ETestSrvMsgPresentityGroupUpdate ); + + // ------------------------------------------------------ + // expect MPresentityGroupList event. + + event = XIMPTestEventFactory::CreateGroupListEventLCX( + KPresentUri1, KPresentDispName2, + XIMPTestEventFactory::ETestPGLUpdated, + KPresentUri1, KPresentDispName2, + MXIMPDataSubscriptionState::ESubscriptionActive, + MXIMPDataSubscriptionState::EDataAvailable + ); + + listener2->ExpectL( event ); + CleanupStack::Pop( event ); // 4 more items in cleanupstack + + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "HandlePresentityGroupListL failed (Update)" ); + CleanupStack::PopAndDestroy( 4 ); // lists + // ------------------------------------------------------ + + CleanupStack::PopAndDestroy( listener2 ); + + // unsubscribe group list and log out + UnsubscribeL(); + UnbindL(); + } + +// =========================================================================== +// SETUP HELPERS FOR THE LISTENER +// =========================================================================== +// + +// send a faked server-originated message with group info made +// from the given uri and displayname +// +void T_PresenceGroupListManagement::SendSrvMsgL( + const TDesC& aUri, const TDesC& aDispName, + TInt aMsgType ) + { + // we'll use hard-coded wrapper 0 instance for now. + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + + // create a group info contained within the server-originated + // faked message + CXIMPIdentityImp* groupId = CXIMPIdentityImp::NewLC( aUri ); + CPresentityGroupInfoImp* groupItem = CPresentityGroupInfoImp::NewLC( *groupId, aDispName ); + HBufC8* packet = NULL; + if( aMsgType == CXIMPTestFileSrvMsg::ETestSrvMsgPresentityGroupDelete ) + { + packet = TXIMPObjectPacker< CXIMPIdentityImp >::PackL( *groupId ); + } + else + { + packet = TXIMPObjectPacker< CPresentityGroupInfoImp >::PackL( *groupItem ); + } + CleanupStack::PushL( packet ); + + // use filetool to send it for plugin. + CXIMPTestFileSrvMsg* srvMsg = CXIMPTestFileSrvMsg::NewL( aMsgType, *packet ); + CleanupStack::PushL( srvMsg ); + wrapper->FileTool().CleanAllL(); + wrapper->FileTool().SrvMsgStoreL( srvMsg ); + CleanupStack::PopAndDestroy( 4, groupId ); // srvMsg, packet, groupItem, groupId + } + +// send a faked server-originated message with empty contents +// +void T_PresenceGroupListManagement::SendSrvMsgL( TInt aMsgType ) + { + // we'll use hard-coded wrapper 0 instance for now. + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + + // create a server-originated faked message with empty contents + RXIMPObjOwningPtrArray groupList; + + HBufC8* packedArray = TXIMPObjectPacker::PackArrayL( groupList ); + CleanupStack::PushL( packedArray ); + + // use filetool to send it for plugin. + CXIMPTestFileSrvMsg* srvMsg = CXIMPTestFileSrvMsg::NewL( aMsgType, + *packedArray ); + CleanupStack::PushL( srvMsg ); + wrapper->FileTool().CleanAllL(); + wrapper->FileTool().SrvMsgStoreL( srvMsg ); + CleanupStack::PopAndDestroy( 2 ); // srvMsg, packedArray + } + +// update display name of group without having subscribed to it +void T_PresenceGroupListManagement::T_UpdateDisplayNameL( + const TDesC& aGroupId, + const TDesC& aDispName ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresentityGroups& presGroup = presFeat->PresentityGroups(); + + wrapper->GetMessenger()->SetNoError(); + + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + + MXIMPIdentity* groupId = context->ObjectFactory().NewIdentityLC(); + groupId->SetIdentityL( aGroupId ); + + // ------------------------------------------------------ + // expect request complete with a group info imp inside + TXIMPRequestId reqIdDummy; // not checked + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + + CPresentityGroupInfoImp* grpInfo = CPresentityGroupInfoImp::NewLC( + *groupId, + aDispName ); + + evReqComplete->AppendParamL( grpInfo ); + CleanupStack::Pop(); // grpInfo + + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + // ------------------------------------------------------ + // update + TXIMPRequestId reqId = presGroup.UpdatePresentityGroupDisplayNameL( + *groupId, + aDispName ); + + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Unsubscribe group content failed" ); + + messenger->AssertUpdatePresentityGroupDisplayNameCalled( ETrue ); + + CleanupStack::PopAndDestroy(); // groupId + CleanupStack::PopAndDestroy( listener2 ); + } + + +// test method for updating display name of group without having subscribed +// to it +void T_PresenceGroupListManagement::T_UpdateDisplayName_Single_L() + { + EUNIT_PRINT( _L("Update presentity group displayname, single.") ); + + BindL(); + + T_UpdateDisplayNameL( KPresentUri1, KPresentDispName1 ); + + UnbindL(); + } + + + +// Single client, unsubscribe nonsubscribed +void T_PresenceGroupListManagement::T_UnsubNonsubscribed_Single_L() + { + EUNIT_PRINT( _L("Single unsubscribe nonsubscribed") ); + + BindL(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresentityGroups& presGroup = presFeat->PresentityGroups(); + + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // --------------------------------------------- + // unsubscribe + TXIMPRequestId reqIdDummy; // not checked + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + // group list event with Unsubscribed + CPresentityGroupListEventImp* event = XIMPTestEventFactory::CreateGroupListEventLCX( + KNullDesC, KNullDesC, + XIMPTestEventFactory::ETestPGLEmpty, + + KNullDesC, KNullDesC, + MXIMPDataSubscriptionState::ESubscriptionInactive, + MXIMPDataSubscriptionState::EDataUnavailable + ); + + listener2->ExpectL( event ); + CleanupStack::Pop( event ); // 4 more items in cleanupstack + + TXIMPRequestId reqId = presGroup.UnsubscribePresentityGroupListL(); + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Unsubscribe failed" ); + CleanupStack::PopAndDestroy( 4 ); // rest of the group list event + messenger->AssertUnsubscribePresentityGroupListCalled( EFalse ); // should not be called, no subscriptions + + CleanupStack::PopAndDestroy( listener2 ); + + UnbindL(); + } + +// =========================================================================== +// TEST CASE TABLE +// =========================================================================== +// +EUNIT_BEGIN_TEST_TABLE( + T_PresenceGroupListManagement, + "XIMP presence group list management tests", + "MODULE" ) + +PRFW_DECORATED_TEST( + "Subscribe single presence", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_SubscribePresentityGroup_Single_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Subscribe single presence with error", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_SubscribePresentityGroup_Error_Single_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Unsubscribe single presence with error", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_UnsubscribePresentityGroup_Error_Single_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Unsubscribe nonsubscribed", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_UnsubNonsubscribed_Single_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Subscribe multiple presence", + "", + "", + "FUNCTIONALITY", + SetupMultiple_L, + T_SubscribePresentityGroup_Multiple_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Multiple subscribe all but one, unsub all", + "", + "", + "FUNCTIONALITY", + SetupMultiple_L, + T_SubscribeAll_One_Unsub_Multiple_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Single refresh multiple presence", + "", + "", + "FUNCTIONALITY", + SetupMultiple_L, + T_RefreshPresentityGroup_One_Multiple_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Multiple refresh presence", + "", + "", + "FUNCTIONALITY", + SetupMultiple_L, + T_RefreshPresentityGroup_Multiple_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Handle Presentity Group List", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_HandlePresentityGroupList_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Handle Presentity Group List (subscribed group)", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_HandlePresentityGroupList_Subscribed_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Create and delete group.", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_HandlePresentityGroupCreateAndDelete_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Handle update displayname", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_HandlePresentityGroupUpdate_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Update displayname", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_UpdateDisplayName_Single_L, + Teardown ) + +EUNIT_END_TEST_TABLE + + +// =========================================================================== +// TEST SUITE CONSTRUCTION +// =========================================================================== +// +EXPORT_C MEUnitTest* CreateTestSuiteL() + { + return T_PresenceGroupListManagement::NewL(); + } + + +// end of file diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/src/t_presencegrouplistmngt/t_presencegrouplistmngt.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/src/t_presencegrouplistmngt/t_presencegrouplistmngt.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,129 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework Test Code +* +*/ + +#ifndef T_PRESENCEGROUPLISTMANAGEMENT_H +#define T_PRESENCEGROUPLISTMANAGEMENT_H + +#include +#include +#include "prfwteststatuseventlistener.h" +#include "prfwtestmessaging.h" + +class CXIMPTestContextWrapper; +class CXIMPTestContextWrapperMgr; +class CXIMPTestMessenger; +class CPresentityGroupInfoImp; +class CPresentityGroupListEventImp; + +/** + * XIMP Framework Eunit tests. + * + * Tests for XIMP session management services. + * + * @since S60 v4.0 + */ +class T_PresenceGroupListManagement : public CEUnitTestSuiteClass + { + +public: + static T_PresenceGroupListManagement* NewL(); + virtual ~T_PresenceGroupListManagement(); + + +private: + T_PresenceGroupListManagement(); + void ConstructL(); + +private: // Test case functions + + void Setup_L(); + void SetupMultiple_L(); + void BindL(); + void BindAllL(); + void Teardown(); + void UnbindL(); + void UnbindAllL(); + void SubscribeL(); + void SubscribeGroupL( const TDesC& aGroupId ); + void UnsubscribeGroupL( const TDesC& aGroupId ); + void UnsubscribeL(); + + void T_SubscribePresentityGroup_Single_L(); + void T_UnsubscribePresentityGroup_Error_Single_L(); + void T_SubscribePresentityGroup_Error_Single_L(); + void T_SubscribePresentityGroup_Multiple_L(); + void T_UpdateDisplayName_Single_L(); + void T_HandlePresentityGroupList_L(); + void T_HandlePresentityGroupList_Subscribed_L(); + void T_HandlePresentityGroupCreateAndDelete_L(); + void T_HandlePresentityGroupUpdate_L(); + void T_HandlePresentityGroupUpdate_WithHelpers_L(); + void T_SubscribePresentityGroup_One_Multiple_L(); + void T_RefreshPresentityGroup_One_Multiple_L(); + void T_UnsubNonsubscribed_Single_L(); + void T_RefreshPresentityGroup_Multiple_L(); + void T_SubscribeAll_One_Unsub_Multiple_L(); + + void T_UpdateDisplayNameL( + const TDesC& aGroupId, + const TDesC& aDispName ); + +private: // Test helpers + + /** + * Fake a server-originated (=mobile terminated) message. + * The message appears to adaptation and framework as if + * it came from the network. Uses only one group. + * @param aUri The URI of group + * @param aDispName The display name for the group + * @param aMsgType The message type for CXIMPTestFileSrvMsg + */ + void SendSrvMsgL( + const TDesC& aUri, const TDesC& aDispName, + TInt aMsgType ); + + /** + * Fake a server-originated message with empty content. + * Whether to use this depends on the event you expect. + * @see SendSrvMsgL + */ + void SendSrvMsgL( TInt aMsgType ); + +private: // Test data + + /** + * Eunit test case table declaration. + */ + EUNIT_DECLARE_TEST_TABLE; + + // owned + CXIMPTestContextWrapperMgr* iWrapperMgr; + + // + TInt iLastError; + RXIMPObjOwningPtrArray< CPresentityGroupInfoImp > iValidateArray; + }; + + +#endif // T_PRESENCEGROUPLISTMANAGEMENT_H + + + +// end of file + + + diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/src/t_presencegrouplistmngt/t_presencegrouplistmngt.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/src/t_presencegrouplistmngt/t_presencegrouplistmngt.mmp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,55 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework Test Code +* +*/ + +#include "../../tsrcutils/eunitcommon/eunittstdllbase.hrh" +#include "../../tsrcutils/processmaster/pm.h" + +TARGET t_presencegrouplistmngt.dll + +SOURCEPATH . +SOURCE t_presencegrouplistmngt.cpp + +USERINCLUDE ../../../core/srcdatamodel +USERINCLUDE ../../../presence/srcpresencedatamodel +USERINCLUDE ../../../presence/srcpresencedatamodel/presentitygroups +USERINCLUDE ../../../presence/srcpresencedatamodel/presencewatching +USERINCLUDE ../../../presence/srcpresencedatamodel/presenceauthorization +USERINCLUDE ../../../presence/srcpresencedatamodel/presencepublishing +USERINCLUDE ../../../presence/srcpresencedatamodel/presenceinfo +USERINCLUDE ../../../core/srcutils + +// TODO remove unnecessary +SYSTEMINCLUDE ../../../inc/core/base +SYSTEMINCLUDE ../../../inc/core/datamodel +SYSTEMINCLUDE ../../../inc/core/protocolplugin +SYSTEMINCLUDE ../../../inc/core/protocolpluginhost +SYSTEMINCLUDE ../../../inc/presence/presencedatamodel +SYSTEMINCLUDE ../../../inc/presence/presencemanagement +SYSTEMINCLUDE ../../../inc/presence/presenceprotocolplugin +SYSTEMINCLUDE ../../../inc/presence/presenceprotocolpluginhost + + +LIBRARY ecom.lib +LIBRARY bafl.lib +LIBRARY ximpdatamodel.lib +LIBRARY presencedatamodel.lib +LIBRARY ximputils.lib +LIBRARY estor.lib + +// end of file + + diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/src/t_presencegroupmembermngt/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/src/t_presencegroupmembermngt/bld.inf Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,23 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Build information file for t_presencegroupmngt.dll + * +*/ + + +PRJ_PLATFORMS +DEFAULT + +PRJ_TESTMMPFILES +t_presencegroupmembermngt.mmp diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/src/t_presencegroupmembermngt/t_presencegroupmembermngt.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/src/t_presencegroupmembermngt/t_presencegroupmembermngt.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,2280 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework Test Code +* +*/ + + +#include "eunittools.h" + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +#include "ximpeventcodec.h" + +#include "t_presencegroupmembermngt.h" +#include "prfwteststatuseventlistener.h" +#include "prfwtestmessaging.h" +#include "prfwtestmessenger.h" +#include "prfwtestlistener.h" +#include "prfwtestcontextwrappermgr.h" +#include "prfwtestcontextwrapper.h" +#include "ximpcontextstateeventimp.h" +#include "ximpcontextstateevent.h" + +#include "presenceinfoimp.h" +#include "presenceinfofilterimp.h" +#include "prfwtestpresencedatautils.h" +#include "ximpidentityimp.h" +#include "presentitygroupcontenteventimp.h" +#include "ximprequestcompleteeventimp.h" +#include "presentitygroupinfoimp.h" +#include "presentitygrouplisteventimp.h" +#include "presentitygroupmemberinfoimp.h" +#include "ximprequestcompleteeventimp.h" +#include "ximprestrictedobjectcollection.h" +#include "ximpobjectfactoryimp.h" + +#include "prfwtestrobustnesstools.h" +#include "ximpobjecthelpers.h" +#include "prfwtestfilesrvmsg.h" +#include "prfwtestfiletool.h" +#include "prfwtestwaithelper.h" +#include "prfwtesteventfactory.h" + + +_LIT( KGroupId, "wv:group/member@imps.com" ); +_LIT( KGroupId2, "wv:group2/chutney@naan.com" ); +_LIT( KGroupDisplayName, "Salamapartio Z" ); + +_LIT( KMemberId, "wv:member@imps.com" ); +_LIT( KMemberDisplayName, "Stroustrup" ); +_LIT( KMemberDisplayName2, "Bjarne" ); + +// ============================ MEMBER FUNCTIONS =============================== + +// CONSTRUCTION +T_PresenceGroupMemberManagement* T_PresenceGroupMemberManagement::NewL() + { + T_PresenceGroupMemberManagement* self = new( ELeave ) T_PresenceGroupMemberManagement; + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + + return self; + } + +T_PresenceGroupMemberManagement::~T_PresenceGroupMemberManagement() + { + delete iLastEvent; + + if ( iASWait && iASWait->IsStarted() ) + { + iASWait->AsyncStop(); + } + delete iASWait; + + delete iListener2; + + delete iCurrentGrId; + } + +void T_PresenceGroupMemberManagement::ConstructL() + { + CEUnitTestSuiteClass::ConstructL(); + iASWait = new ( ELeave ) CActiveSchedulerWait(); + } + + +T_PresenceGroupMemberManagement::T_PresenceGroupMemberManagement() + { + } + +// =========================================================================== +// TEST CASE SETUP & TEARDOWN METHODS +// =========================================================================== +// + +void T_PresenceGroupMemberManagement::Setup_L() + { + PrfwTestRobustness::DoPreCleaning(); + + iWrapperMgr = CXIMPTestContextWrapperMgr::NewL(); + iWrapperMgr->CreateWrapperL(); + + // must reset these to EFalse + iSkipSubscribe = EFalse; + iSkipUnsubscribe = EFalse; + } + +void T_PresenceGroupMemberManagement::SetupMultiple_L() + { + PrfwTestRobustness::DoPreCleaning(); + + iWrapperMgr = CXIMPTestContextWrapperMgr::NewL(); + iWrapperMgr->CreateWrapperL(); + iWrapperMgr->CreateWrapperL(); + iWrapperMgr->CreateWrapperL(); + + // must reset these to EFalse + iSkipSubscribe = EFalse; + iSkipUnsubscribe = EFalse; + } + +// bind helper +void T_PresenceGroupMemberManagement::BindAllL() + { + for( TInt a = 0; a < iWrapperMgr->WrapperCount(); ++a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + wrapper->BindL( 0 ); + } + } + +// unbind helper +void T_PresenceGroupMemberManagement::UnbindAllL() + { + for( TInt a = 0; a < iWrapperMgr->WrapperCount(); ++a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + wrapper->UnbindL(); + } + } + +void T_PresenceGroupMemberManagement::TeardownTestSupport() + { + // anything NOT initialized by test case Setup method, + // but initialized in the test case itself, goes here + delete iCurrentGrId; + iCurrentGrId = NULL; + + delete iListener2; + iListener2 = NULL; + + delete iLastEvent; + iLastEvent = NULL; + } + +void T_PresenceGroupMemberManagement::Teardown() + { + TeardownTestSupport(); + // just in case to avoid memleaks. should not have anything to + // delete anyway + + delete iWrapperMgr; + iWrapperMgr = NULL; + + REComSession::FinalClose(); + + // must reset these to EFalse + iSkipSubscribe = EFalse; + iSkipUnsubscribe = EFalse; + + // it's best to nuke the servers during exit too. + PrfwTestRobustness::DoPreCleaning(); + } + +// =========================================================================== +// TEST CASES for presentity presence subscription +// =========================================================================== + +// General test case for single member +void T_PresenceGroupMemberManagement::T_GenericSubAndUnsubL( + TXIMPCallBack& aCbFuncL ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + wrapper->BindL( 0 ); + + // ------------------------------------------------------ + // some startup stuff + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresentityGroups& presGroup = presFeat->PresentityGroups(); + + iListener2 = CXIMPTestListener::NewL( context ); + // ------------------------------------------------------ + + // Tell the protocol it should act normally + wrapper->GetMessenger()->SetNoError(); + + iCurrentGrId = context->ObjectFactory().NewIdentityLC(); + CleanupStack::Pop(); // iCurrentGrId + iCurrentGrId->SetIdentityL( KGroupId ); + + // ------------------------------------------------------ + // create presentity group + // + // expect events: + // - request complete. + // NOTE: no presentitygrouplistevent as we've not subscribed the group lists + + // normal request complete + TXIMPRequestId reqIdDummy; // not checked + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + + // identity + displayname + CPresentityGroupInfoImp* infoImp = CPresentityGroupInfoImp::NewLC( *iCurrentGrId, KGroupDisplayName ); + evReqComplete->AppendParamL( infoImp ); + CleanupStack::Pop( infoImp ); + + iListener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + TXIMPRequestId reqId = presGroup.CreatePresentityGroupL( *iCurrentGrId, KGroupDisplayName ); + + // and wait + EUNIT_ASSERT_DESC( KErrNone == iListener2->WaitAndAssertL(), "CreatePresentityGroupL failed" ); + messenger->AssertCreatePresentityGroupCalled( ETrue ); + + if ( ! iSkipSubscribe ) + { + // ------------------------------------------------------ + // subscribe presentity group CONTENT + // + // expect events: + // - request complete + evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + iListener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + // do the call + reqId = presGroup.SubscribePresentityGroupContentL( *iCurrentGrId ); + + // and wait + EUNIT_ASSERT_DESC( KErrNone == iListener2->WaitAndAssertL(), "SubscribePresentityGroupContentL failed" ); + + // verify that subscribe was called + messenger->AssertSubscribePresentityGroupContentCalled( ETrue ); + } + + // ------------------------------------------------------ + // do the actual test. this is a function pointer because the + // "red tape" of each test is similar (create group, subscribe content, do + // actual test, unsubscribe content, delete group) - this is the variable + // part, the "do actual test". + (this->*aCbFuncL)(); + + if ( ! iSkipUnsubscribe ) + { + // ------------------------------------------------------ + // unsubscribe presentity group content + // + // expect events: + // - request complete + // - presentity group content event + + evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + iListener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + CPresentityGroupContentEventImp* groupCntEvent = + XIMPTestEventFactory::CreateGroupContentEventLCX( + KGroupId, + KNullDesC, + KNullDesC, + XIMPTestEventFactory::ETestPGLCntRemoved, + KNullDesC, + KNullDesC, + MXIMPDataSubscriptionState::ESubscriptionInactive, + MXIMPDataSubscriptionState::EDataUnavailable + ); + + iListener2->ExpectL( groupCntEvent ); + CleanupStack::Pop( groupCntEvent ); // 5 more items in cleanupstack + + // do the call + reqId = presGroup.UnsubscribePresentityGroupContentL( *iCurrentGrId ); + + // and wait + EUNIT_ASSERT_DESC( KErrNone == iListener2->WaitAndAssertL(), "UnsubscribePresentityGroupContentL failed" ); + CleanupStack::PopAndDestroy( 5 ); // lists + + // verify that unsubscribe was called + messenger->AssertUnsubscribePresentityGroupContentCalled( ETrue ); + } + + // ------------------------------------------------------ + // delete presentity group + // + // expect events: + // - request complete + // NO presentity group content event as we've just unsubscribed it. + + evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + iListener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + // do the call + reqId = presGroup.DeletePresentityGroupL( *iCurrentGrId ); + + // and wait + EUNIT_ASSERT_DESC( KErrNone == iListener2->WaitAndAssertL(), "DeletePresentityGroupL failed" ); + + // ------------------------------------------------------ + + // make sure the new listener is not listening for events! + iListener2->SetEventSourceL( NULL ); + + wrapper->UnbindL(); + + TeardownTestSupport(); + } + +// =========================================================================== +// Variant methods, this is where the actual testing happens. +// Called by the generic subscribe and unsubscribe -method +// =========================================================================== + +// ------------------------------------------------------ +// empty test variant method +// test only the creation, subscribe and unsubcscribe +// ------------------------------------------------------ +// +void T_PresenceGroupMemberManagement::T_EmptyFunc() + { + // nothing + } + +// ------------------------------------------------------ +// test adding members +// ------------------------------------------------------ +// +void T_PresenceGroupMemberManagement::T_TestAddMembersL() + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresentityGroups& presGroup = presFeat->PresentityGroups(); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // ------------------------------------------------------ + // add presentity group member + // + // expect events: + // - request complete, + // - presentitygroupcontentevent + + MXIMPIdentity* member = context->ObjectFactory().NewIdentityLC(); + member->SetIdentityL( KMemberId ); + + // normal request complete + TXIMPRequestId reqIdDummy; // not checked + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + + // group id + CXIMPIdentityImp* identity = CXIMPIdentityImp::NewLC( iCurrentGrId->Identity() ); + evReqComplete->AppendParamL( identity ); + CleanupStack::Pop(); // identity + + // id for member info + CXIMPIdentityImp* miId = CXIMPIdentityImp::NewLC( KMemberId ); + // member info + CPresentityGroupMemberInfoImp* memInfoImp = + CPresentityGroupMemberInfoImp::NewLC( *miId, KMemberDisplayName ); + evReqComplete->AppendParamL( memInfoImp ); + CleanupStack::Pop(); // memInfoImp owned by AppendParamL + CleanupStack::PopAndDestroy( miId ); // copy was made + + iListener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + // group content event + CPresentityGroupContentEventImp* groupCntEvent = + XIMPTestEventFactory::CreateGroupContentEventLCX( + iCurrentGrId->Identity(), + KMemberId, + KMemberDisplayName, + XIMPTestEventFactory::ETestPGLCntAdded, + KMemberId, + KMemberDisplayName, + MXIMPDataSubscriptionState::ESubscriptionActive, + MXIMPDataSubscriptionState::EDataAvailable + ); + + iListener2->ExpectL( groupCntEvent ); + CleanupStack::Pop( groupCntEvent ); // 5 more items in cleanupstack + + // do the call + TXIMPRequestId reqId = presGroup.AddPresentityGroupMemberL( + *iCurrentGrId, *member, KMemberDisplayName ); + + // and wait + EUNIT_ASSERT_DESC( KErrNone == iListener2->WaitAndAssertL(), "AddPresentityGroupMemberL failed" ); + CleanupStack::PopAndDestroy( 5 ); // lists from groupCntEvent + + messenger->AssertAddPresentityGroupMemberCalled( ETrue ); + + // ------------------------------------------------------ + CleanupStack::PopAndDestroy(); // member + } + +// ------------------------------------------------------ +// test adding members when not subscribed +// ------------------------------------------------------ +// +void T_PresenceGroupMemberManagement::T_TestAddMembers_NonSub_L() + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresentityGroups& presGroup = presFeat->PresentityGroups(); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // ------------------------------------------------------ + // add presentity group member + // + // expect events: + // - request complete, + + MXIMPIdentity* member = context->ObjectFactory().NewIdentityLC(); + member->SetIdentityL( KMemberId ); + + // normal request complete + TXIMPRequestId reqIdDummy; // not checked + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + + // group id + CXIMPIdentityImp* identity = CXIMPIdentityImp::NewLC( iCurrentGrId->Identity() ); + evReqComplete->AppendParamL( identity ); + CleanupStack::Pop(); // identity + + // id for member info + CXIMPIdentityImp* miId = CXIMPIdentityImp::NewLC( KMemberId ); + // member info + CPresentityGroupMemberInfoImp* memInfoImp = + CPresentityGroupMemberInfoImp::NewLC( *miId, KMemberDisplayName ); + evReqComplete->AppendParamL( memInfoImp ); + CleanupStack::Pop(); // memInfoImp owned by AppendParamL + CleanupStack::PopAndDestroy( miId ); // copy was made + + iListener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + // do the call + TXIMPRequestId reqId = presGroup.AddPresentityGroupMemberL( + *iCurrentGrId, *member, KMemberDisplayName ); + + // and wait + EUNIT_ASSERT_DESC( KErrNone == iListener2->WaitAndAssertL(), "AddPresentityGroupMemberL failed" ); + + messenger->AssertAddPresentityGroupMemberCalled( ETrue ); + + // ------------------------------------------------------ + CleanupStack::PopAndDestroy(); // member + } + +// ------------------------------------------------------ +// test removing members +// ------------------------------------------------------ +// +void T_PresenceGroupMemberManagement::T_TestRemoveMembersL() + { + // add a member + T_TestAddMembersL(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresentityGroups& presGroup = presFeat->PresentityGroups(); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // ------------------------------------------------------ + // remove presentity group member + // + // expect events: + // - request complete, + // - presentitygroupcontentevent + + MXIMPIdentity* member = context->ObjectFactory().NewIdentityLC(); + member->SetIdentityL( KMemberId ); + + // normal request complete + TXIMPRequestId reqIdDummy; // not checked + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + iListener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + // group content event + CPresentityGroupContentEventImp* groupCntEvent = + XIMPTestEventFactory::CreateGroupContentEventLCX( + iCurrentGrId->Identity(), + KMemberId, + KNullDesC, + XIMPTestEventFactory::ETestPGLCntRemoved, + KNullDesC, + KNullDesC, + MXIMPDataSubscriptionState::ESubscriptionActive, + MXIMPDataSubscriptionState::EDataAvailable + ); + + iListener2->ExpectL( groupCntEvent ); + CleanupStack::Pop( groupCntEvent ); // 5 more items in cleanupstack + + // do the call + TXIMPRequestId reqId = presGroup.RemovePresentityGroupMemberL( + *iCurrentGrId, *member ); + + // and wait + EUNIT_ASSERT_DESC( KErrNone == iListener2->WaitAndAssertL(), "RemovePresentityGroupMemberL failed" ); + CleanupStack::PopAndDestroy( 5 ); // lists from groupCntEvent + + messenger->AssertRemovePresentityGroupMemberCalled( ETrue ); + + // ------------------------------------------------------ + CleanupStack::PopAndDestroy(); //member + } + +// ------------------------------------------------------ +// test removing members when non-subscribed +// ------------------------------------------------------ +// +void T_PresenceGroupMemberManagement::T_TestRemoveMembers_NonSub_L() + { + // add a member + T_TestAddMembers_NonSub_L(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresentityGroups& presGroup = presFeat->PresentityGroups(); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // ------------------------------------------------------ + // remove presentity group member + // + // expect events: + // - request complete, + // - presentitygroupcontentevent + + MXIMPIdentity* member = context->ObjectFactory().NewIdentityLC(); + member->SetIdentityL( KMemberId ); + + // normal request complete + TXIMPRequestId reqIdDummy; // not checked + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + iListener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + // do the call + TXIMPRequestId reqId = presGroup.RemovePresentityGroupMemberL( + *iCurrentGrId, *member ); + + // and wait + EUNIT_ASSERT_DESC( KErrNone == iListener2->WaitAndAssertL(), "RemovePresentityGroupMemberL failed" ); + + messenger->AssertRemovePresentityGroupMemberCalled( ETrue ); + + // ------------------------------------------------------ + CleanupStack::PopAndDestroy(); //member + } + +// test removing nonexisting members +void T_PresenceGroupMemberManagement::T_TestRemoveMembers_NonExisting_L() + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresentityGroups& presGroup = presFeat->PresentityGroups(); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // ------------------------------------------------------ + // remove presentity group member + // + // expect events: + // - request complete, + + MXIMPIdentity* member = context->ObjectFactory().NewIdentityLC(); + member->SetIdentityL( KMemberId ); + + // normal request complete + TXIMPRequestId reqIdDummy; // not checked + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + iListener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + // do the call + TXIMPRequestId reqId = presGroup.RemovePresentityGroupMemberL( + *iCurrentGrId, *member ); + + // and wait + EUNIT_ASSERT_DESC( KErrNone == iListener2->WaitAndAssertL(), "RemovePresentityGroupMemberL failed" ); + + messenger->AssertRemovePresentityGroupMemberCalled( ETrue ); + + // ------------------------------------------------------ + CleanupStack::PopAndDestroy(); //member + } + +// ------------------------------------------------------ +// test updating members +// ------------------------------------------------------ +// +void T_PresenceGroupMemberManagement::T_TestUpdateMembers_L() + { + // add a member + T_TestAddMembersL(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresentityGroups& presGroup = presFeat->PresentityGroups(); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // ------------------------------------------------------ + // update presentity group member + // + // expect events: + // - request complete, + // - presentitygroupcontentevent + + MXIMPIdentity* member = context->ObjectFactory().NewIdentityLC(); + member->SetIdentityL( KMemberId ); + + // group content request complete + TXIMPRequestId reqIdDummy; // not checked + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + CXIMPIdentityImp* identity = CXIMPIdentityImp::NewLC( iCurrentGrId->Identity() ); + evReqComplete->AppendParamL( identity ); + CleanupStack::Pop( identity ); + + CPresentityGroupMemberInfoImp* mbrInfo = CPresentityGroupMemberInfoImp::NewLC( *member, KMemberDisplayName2 ); + evReqComplete->AppendParamL( mbrInfo ); + CleanupStack::Pop( mbrInfo ); + + iListener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + // group content event + CPresentityGroupContentEventImp* groupCntEvent = + XIMPTestEventFactory::CreateGroupContentEventLCX( + iCurrentGrId->Identity(), + KMemberId, + KMemberDisplayName2, + XIMPTestEventFactory::ETestPGLCntUpdated, + KMemberId, + KMemberDisplayName2, + MXIMPDataSubscriptionState::ESubscriptionActive, + MXIMPDataSubscriptionState::EDataAvailable + ); + + iListener2->ExpectL( groupCntEvent ); + CleanupStack::Pop( groupCntEvent ); // 5 more items in cleanupstack + + // do the call + TXIMPRequestId reqId = presGroup.UpdatePresentityGroupMemberDisplayNameL( + *iCurrentGrId, *member, KMemberDisplayName2 ); + + // and wait + EUNIT_ASSERT_DESC( KErrNone == iListener2->WaitAndAssertL(), "UpdatePresentityGroupMemberDisplayNameL failed" ); + CleanupStack::PopAndDestroy( 5 ); // lists from groupCntEvent + + messenger->AssertUpdatePresentityGroupMemberDisplayNameCalled( ETrue ); + + // ------------------------------------------------------ + CleanupStack::PopAndDestroy(); + } + +// ------------------------------------------------------ +// test updating members (nonsubscribed) +// ------------------------------------------------------ +// +void T_PresenceGroupMemberManagement::T_TestUpdateMembers_NonSub_L() + { + // add a member + T_TestAddMembers_NonSub_L(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresentityGroups& presGroup = presFeat->PresentityGroups(); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // ------------------------------------------------------ + // update presentity group member + // + // expect events: + // - request complete, + + MXIMPIdentity* member = context->ObjectFactory().NewIdentityLC(); + member->SetIdentityL( KMemberId ); + + // group content request complete + TXIMPRequestId reqIdDummy; // not checked + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + CXIMPIdentityImp* identity = CXIMPIdentityImp::NewLC( iCurrentGrId->Identity() ); + evReqComplete->AppendParamL( identity ); + CleanupStack::Pop( identity ); + + CPresentityGroupMemberInfoImp* mbrInfo = CPresentityGroupMemberInfoImp::NewLC( *member, KMemberDisplayName2 ); + evReqComplete->AppendParamL( mbrInfo ); + CleanupStack::Pop( mbrInfo ); + + iListener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + // do the call + TXIMPRequestId reqId = presGroup.UpdatePresentityGroupMemberDisplayNameL( + *iCurrentGrId, *member, KMemberDisplayName2 ); + + // and wait + EUNIT_ASSERT_DESC( KErrNone == iListener2->WaitAndAssertL(), "UpdatePresentityGroupMemberDisplayNameL failed" ); + + messenger->AssertUpdatePresentityGroupMemberDisplayNameCalled( ETrue ); + + // ------------------------------------------------------ + CleanupStack::PopAndDestroy(); + } + +// ------------------------------------------------------ +// test updating members with non-existing id +// ------------------------------------------------------ +// +void T_PresenceGroupMemberManagement::T_TestUpdateMembers_NonExisting_L() + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresentityGroups& presGroup = presFeat->PresentityGroups(); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // ------------------------------------------------------ + // update presentity group member + // + // expect events: + // - request complete, + + MXIMPIdentity* member = context->ObjectFactory().NewIdentityLC(); + member->SetIdentityL( KMemberId ); + + // group content request complete + TXIMPRequestId reqIdDummy; // not checked + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + CXIMPIdentityImp* identity = CXIMPIdentityImp::NewLC( iCurrentGrId->Identity() ); + evReqComplete->AppendParamL( identity ); + CleanupStack::Pop( identity ); + + CPresentityGroupMemberInfoImp* mbrInfo = CPresentityGroupMemberInfoImp::NewLC( *member, KMemberDisplayName2 ); + evReqComplete->AppendParamL( mbrInfo ); + CleanupStack::Pop( mbrInfo ); + + iListener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + // do the call + TXIMPRequestId reqId = presGroup.UpdatePresentityGroupMemberDisplayNameL( + *iCurrentGrId, *member, KMemberDisplayName2 ); + + // and wait + EUNIT_ASSERT_DESC( KErrNone == iListener2->WaitAndAssertL(), "UpdatePresentityGroupMemberDisplayNameL failed" ); + + messenger->AssertUpdatePresentityGroupMemberDisplayNameCalled( ETrue ); + + // ------------------------------------------------------ + CleanupStack::PopAndDestroy(); + } + +// =========================================================================== +// Test case methods +// =========================================================================== + +// Subscribe and unsubscribe test +void T_PresenceGroupMemberManagement::T_SubUnsubGroupContent_Single_L() + { + EUNIT_PRINT( _L("Single presentity group content sub and unsub") ); + + TXIMPCallBack callback = &T_PresenceGroupMemberManagement::T_EmptyFunc; + T_GenericSubAndUnsubL( callback ); + } + +// subscribe and unsubscribe, altered id +void T_PresenceGroupMemberManagement::T_SubUnsubGroupContent_Altered_Single_L() + { + EUNIT_PRINT( _L("Single presentity group content sub and unsub with altered id") ); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + wrapper->BindL( 0 ); + + // ------------------------------------------------------ + // some startup stuff + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresentityGroups& presGroup = presFeat->PresentityGroups(); + + iListener2 = CXIMPTestListener::NewL( context ); + // ------------------------------------------------------ + + // Tell the protocol it should act normally + wrapper->GetMessenger()->SetNoError(); + + iCurrentGrId = context->ObjectFactory().NewIdentityLC(); + CleanupStack::Pop(); // iCurrentGrId + iCurrentGrId->SetIdentityL( KGroupId ); + + // ------------------------------------------------------ + // create presentity group + // + // expect events: + // - request complete. + // NOTE: no presentitygrouplistevent as we've not subscribed the group lists + + // normal request complete + TXIMPRequestId reqIdDummy; // not checked + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + + // identity + displayname + CPresentityGroupInfoImp* infoImp = CPresentityGroupInfoImp::NewLC( *iCurrentGrId, KGroupDisplayName ); + evReqComplete->AppendParamL( infoImp ); + CleanupStack::Pop( infoImp ); + + iListener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + TXIMPRequestId reqId = presGroup.CreatePresentityGroupL( *iCurrentGrId, KGroupDisplayName ); + + // and wait + EUNIT_ASSERT_DESC( KErrNone == iListener2->WaitAndAssertL(), "CreatePresentityGroupL failed" ); + messenger->AssertCreatePresentityGroupCalled( ETrue ); + + // ------------------------------------------------------ + // subscribe presentity group CONTENT + // + // expect events: + // - request complete + evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + iListener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + // tell the test protocol to send back an altered id + MXIMPIdentity* identityParam = context->ObjectFactory().NewIdentityLC(); + identityParam->SetIdentityL( KGroupId2 ); + + CXIMPIdentityImp* identityParamImp = + ( CXIMPIdentityImp* ) identityParam->GetInterface( + CXIMPIdentityImp::KClassId, + MXIMPBase::EPanicIfUnknown ); + HBufC8* packedId = TXIMPObjectPacker< CXIMPIdentityImp >::PackL( *identityParamImp ); + CleanupStack::PopAndDestroy(); // identityParam + CleanupStack::PushL( packedId ); + CXIMPTestFileSrvMsg* srvMsg = CXIMPTestFileSrvMsg::NewL( CXIMPTestFileSrvMsg::ETestSrvMsgReqParamIdentity, + *packedId ); + CleanupStack::PopAndDestroy( packedId ); + CleanupStack::PushL( srvMsg ); + wrapper->FileTool().SrvMsgStoreL( srvMsg ); + CleanupStack::PopAndDestroy( srvMsg ); + + // Wait for server to handle srvmsg. + User::After( 2 ); + // now the adaptation should know how to answer + + // do the call + reqId = presGroup.SubscribePresentityGroupContentL( *iCurrentGrId ); + + // and wait + EUNIT_ASSERT_DESC( KErrNone == iListener2->WaitAndAssertL(), "SubscribePresentityGroupContentL failed" ); + + // verify that subscribe was called + messenger->AssertSubscribePresentityGroupContentCalled( ETrue ); + + // ------------------------------------------------------ + + // make sure the new listener is not listening for events! + iListener2->SetEventSourceL( NULL ); + + wrapper->UnbindL(); + + TeardownTestSupport(); + } + +// subscribe and unsubscribe, altered id is the same +void T_PresenceGroupMemberManagement::T_SubUnsubGroupContent_AlteredSame_Single_L() + { + EUNIT_PRINT( _L("Single presentity group content sub and unsub with altered but same id") ); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + wrapper->BindL( 0 ); + + // ------------------------------------------------------ + // some startup stuff + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresentityGroups& presGroup = presFeat->PresentityGroups(); + + iListener2 = CXIMPTestListener::NewL( context ); + // ------------------------------------------------------ + + // Tell the protocol it should act normally + wrapper->GetMessenger()->SetNoError(); + + iCurrentGrId = context->ObjectFactory().NewIdentityLC(); + CleanupStack::Pop(); // iCurrentGrId + iCurrentGrId->SetIdentityL( KGroupId ); + + // ------------------------------------------------------ + // create presentity group + // + // expect events: + // - request complete. + // NOTE: no presentitygrouplistevent as we've not subscribed the group lists + + // normal request complete + TXIMPRequestId reqIdDummy; // not checked + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + + // identity + displayname + CPresentityGroupInfoImp* infoImp = CPresentityGroupInfoImp::NewLC( *iCurrentGrId, KGroupDisplayName ); + evReqComplete->AppendParamL( infoImp ); + CleanupStack::Pop( infoImp ); + + iListener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + TXIMPRequestId reqId = presGroup.CreatePresentityGroupL( *iCurrentGrId, KGroupDisplayName ); + + // and wait + EUNIT_ASSERT_DESC( KErrNone == iListener2->WaitAndAssertL(), "CreatePresentityGroupL failed" ); + messenger->AssertCreatePresentityGroupCalled( ETrue ); + + // ------------------------------------------------------ + // subscribe presentity group CONTENT + // + // expect events: + // - request complete + evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + iListener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + // tell the test protocol to send back an altered id + MXIMPIdentity* identityParam = context->ObjectFactory().NewIdentityLC(); + identityParam->SetIdentityL( KGroupId ); + + CXIMPIdentityImp* identityParamImp = + ( CXIMPIdentityImp* ) identityParam->GetInterface( + CXIMPIdentityImp::KClassId, + MXIMPBase::EPanicIfUnknown ); + HBufC8* packedId = TXIMPObjectPacker< CXIMPIdentityImp >::PackL( *identityParamImp ); + CleanupStack::PopAndDestroy(); // identityParam + CleanupStack::PushL( packedId ); + CXIMPTestFileSrvMsg* srvMsg = CXIMPTestFileSrvMsg::NewL( CXIMPTestFileSrvMsg::ETestSrvMsgReqParamIdentity, + *packedId ); + CleanupStack::PopAndDestroy( packedId ); + CleanupStack::PushL( srvMsg ); + wrapper->FileTool().SrvMsgStoreL( srvMsg ); + CleanupStack::PopAndDestroy( srvMsg ); + + // Wait for server to handle srvmsg. + User::After( 2 ); + // now the adaptation should know how to answer + + // do the call + reqId = presGroup.SubscribePresentityGroupContentL( *iCurrentGrId ); + + // and wait + EUNIT_ASSERT_DESC( KErrNone == iListener2->WaitAndAssertL(), "SubscribePresentityGroupContentL failed" ); + + // verify that subscribe was called + messenger->AssertSubscribePresentityGroupContentCalled( ETrue ); + + // ------------------------------------------------------ + + // make sure the new listener is not listening for events! + iListener2->SetEventSourceL( NULL ); + + wrapper->UnbindL(); + + TeardownTestSupport(); + } + + +// Add members +void T_PresenceGroupMemberManagement::T_AddGroupMembers_Single_L() + { + EUNIT_PRINT( _L("Single add members to group") ); + + TXIMPCallBack callback = &T_PresenceGroupMemberManagement::T_TestAddMembersL; + T_GenericSubAndUnsubL( callback ); + } + +// Remove members +void T_PresenceGroupMemberManagement::T_RemoveGroupMembers_Single_L() + { + EUNIT_PRINT( _L("Single remove member of group") ); + + TXIMPCallBack callback = &T_PresenceGroupMemberManagement::T_TestRemoveMembersL; + T_GenericSubAndUnsubL( callback ); + } + +// Update members +void T_PresenceGroupMemberManagement::T_UpdateGroupMembers_Single_L() + { + EUNIT_PRINT( _L("Single update member of group") ); + + TXIMPCallBack callback = &T_PresenceGroupMemberManagement::T_TestUpdateMembers_L; + T_GenericSubAndUnsubL( callback ); + } + +// Update members without subscription +void T_PresenceGroupMemberManagement::T_UpdateGroupMembers_NonSub_Single_L() + { + EUNIT_PRINT( _L("Single update member of group, unsubscribed") ); + + TXIMPCallBack callback = &T_PresenceGroupMemberManagement::T_TestUpdateMembers_NonSub_L; + iSkipSubscribe = ETrue; + iSkipUnsubscribe = ETrue; + T_GenericSubAndUnsubL( callback ); + } + +// Update members with non-existing member +void T_PresenceGroupMemberManagement::T_UpdateGroupMembers_NonExist_Single_L() + { + EUNIT_PRINT( _L("Single update nonexisting member of group") ); + + TXIMPCallBack callback = &T_PresenceGroupMemberManagement::T_TestUpdateMembers_NonExisting_L; + T_GenericSubAndUnsubL( callback ); + } + +// Remove members without subscription +void T_PresenceGroupMemberManagement::T_RemoveGroupMembers_NonSub_Single_L() + { + EUNIT_PRINT( _L("Single remove member of group, unsubscribed") ); + + TXIMPCallBack callback = &T_PresenceGroupMemberManagement::T_TestRemoveMembers_NonSub_L; + iSkipSubscribe = ETrue; + iSkipUnsubscribe = ETrue; + T_GenericSubAndUnsubL( callback ); + } + +// Remove members with non-existing member +void T_PresenceGroupMemberManagement::T_RemoveGroupMembers_NonExist_Single_L() + { + EUNIT_PRINT( _L("Single remove nonexisting member of group") ); + + TXIMPCallBack callback = &T_PresenceGroupMemberManagement::T_TestRemoveMembers_NonExisting_L; + T_GenericSubAndUnsubL( callback ); + } + +// ------------------------------------------------------ +// expire non-subscribed data +// ------------------------------------------------------ +// +void T_PresenceGroupMemberManagement::T_ExpireNonSubscribedData_L() + { + EUNIT_PRINT( _L("Expire non subscribed data") ); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + wrapper->BindL( 0 ); + + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresentityGroups& presGroup = presFeat->PresentityGroups(); + + iCurrentGrId = context->ObjectFactory().NewIdentityLC(); + CleanupStack::Pop(); // iCurrentGrId + iCurrentGrId->SetIdentityL( KGroupId ); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // 1. Create notification + RXIMPObjOwningPtrArray groupMemberList; + CXIMPIdentityImp* identityImp = + ( CXIMPIdentityImp* ) iCurrentGrId->GetInterface( + CXIMPIdentityImp::KClassId, + MXIMPBase::EPanicIfUnknown ); + HBufC8* packedId = TXIMPObjectPacker< CXIMPIdentityImp >::PackL( *identityImp ); + CleanupStack::PushL( packedId ); + HBufC8* packedArray = TXIMPObjectPacker::PackArrayL( groupMemberList ); + CleanupStack::PushL( packedArray ); + RPointerArray< HBufC8 > bufferArray; + CleanupClosePushL( bufferArray ); + bufferArray.AppendL( packedId ); + bufferArray.AppendL( packedArray ); + HBufC8* packedBufferArray = TXIMPHBuf8Packer::PackArrayL( bufferArray ); + CleanupStack::PopAndDestroy( 2, packedArray ); // bufferArray, packedArray + CleanupStack::PushL( packedBufferArray ); + + // 2. Use filetool to send it for plugin. + CXIMPTestFileSrvMsg* srvMsg = CXIMPTestFileSrvMsg::NewL( CXIMPTestFileSrvMsg::ETestSrvMsgPresentityGroupMemberList, + *packedBufferArray ); + CleanupStack::PopAndDestroy( packedBufferArray ); + CleanupStack::PushL( srvMsg ); + wrapper->FileTool().CleanAllL(); + wrapper->FileTool().SrvMsgStoreL( srvMsg ); + CleanupStack::PopAndDestroy( srvMsg ); + + // Wait for server to handle srvmsg. + CXIMPTestWaitHelper* wait = CXIMPTestWaitHelper::NewL(); + CleanupStack::PushL( wait ); + wait->WaitForL( 2 ); + + // 3. Create and send check notification to server + srvMsg = CXIMPTestFileSrvMsg::NewL( CXIMPTestFileSrvMsg::ETestCheckIfGroupMemberExists, + *packedId ); + CleanupStack::PushL( srvMsg ); + wrapper->FileTool().SrvMsgStoreL( srvMsg ); + + // Wait for server to handle srvmsg. + wait->WaitForL( 2 ); + + TInt value = messenger->GetValueFor( EXIMPPlgTestExistsGroupContentInCache ); + EUNIT_ASSERT_DESC( value == 1, "Data not cached temporarly" ); + + // 4. Wait for cache to clear. + wait->WaitForL( 15 ); + + // 5. Send check notification to server + wrapper->FileTool().SrvMsgStoreL( srvMsg ); + CleanupStack::PopAndDestroy( srvMsg ); + + // Wait for server to handle srvmsg. + wait->WaitForL( 2 ); + CleanupStack::PopAndDestroy( wait ); + CleanupStack::PopAndDestroy( packedId ); + value = messenger->GetValueFor( EXIMPPlgTestExistsGroupContentInCache ); + EUNIT_ASSERT_DESC( value == KErrNotFound, "Data not cleared like it should" ); + wrapper->UnbindL(); + } + +// ------------------------------------------------------ +// expire non-subscribed data, update multiple +// ------------------------------------------------------ +// +void T_PresenceGroupMemberManagement::T_ExpireNonSubscribedDataUpdateMultiple_L() + { + EUNIT_PRINT( _L("Expire non subscribed data, update multiple") ); + + // Wait for server to handle srvmsg. + CXIMPTestWaitHelper* wait = CXIMPTestWaitHelper::NewL(); + CleanupStack::PushL( wait ); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + wrapper->BindL( 0 ); + + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresentityGroups& presGroup = presFeat->PresentityGroups(); + + iCurrentGrId = context->ObjectFactory().NewIdentityLC(); + CleanupStack::Pop(); // iCurrentGrId + iCurrentGrId->SetIdentityL( KGroupId ); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // 1. Create notification + RXIMPObjOwningPtrArray groupMemberList; + CXIMPIdentityImp* identityImp = + ( CXIMPIdentityImp* ) iCurrentGrId->GetInterface( + CXIMPIdentityImp::KClassId, + MXIMPBase::EPanicIfUnknown ); + HBufC8* packedId = TXIMPObjectPacker< CXIMPIdentityImp >::PackL( *identityImp ); + CleanupStack::PushL( packedId ); + HBufC8* packedArray = TXIMPObjectPacker::PackArrayL( groupMemberList ); + CleanupStack::PushL( packedArray ); + RPointerArray< HBufC8 > bufferArray; + CleanupClosePushL( bufferArray ); + bufferArray.AppendL( packedId ); + bufferArray.AppendL( packedArray ); + HBufC8* packedBufferArray = TXIMPHBuf8Packer::PackArrayL( bufferArray ); + CleanupStack::PopAndDestroy( 2, packedArray ); // bufferArray, packedArray + CleanupStack::PushL( packedBufferArray ); + + // 2. Use filetool to send it for plugin. + CXIMPTestFileSrvMsg* srvMsg = CXIMPTestFileSrvMsg::NewL( CXIMPTestFileSrvMsg::ETestSrvMsgPresentityGroupMemberList, + *packedBufferArray ); + CleanupStack::PopAndDestroy( packedBufferArray ); + CleanupStack::PushL( srvMsg ); + wrapper->FileTool().CleanAllL(); + wrapper->FileTool().SrvMsgStoreL( srvMsg ); + + wait->WaitForL( 2 ); + + // 3. Create and send check notification to server + CXIMPTestFileSrvMsg* srvMsg2 = CXIMPTestFileSrvMsg::NewL( CXIMPTestFileSrvMsg::ETestCheckIfGroupMemberExists, + *packedId ); + CleanupStack::PushL( srvMsg2 ); + wrapper->FileTool().SrvMsgStoreL( srvMsg2 ); + + // Wait for server to handle srvmsg. + wait->WaitForL( 2 ); + + TInt value = messenger->GetValueFor( EXIMPPlgTestExistsGroupContentInCache ); + EUNIT_ASSERT_DESC( value == 1, "Data not cached temporarly" ); + + // 4. Wait for cache to clear. + wait->WaitForL( 5 ); + + // Refresh temporar cache. + wrapper->FileTool().SrvMsgStoreL( srvMsg ); + + // 4. Wait for cache to clear. + wait->WaitForL( 10 ); + + // 5. Send check notification to server + wrapper->FileTool().SrvMsgStoreL( srvMsg2 ); + CleanupStack::PopAndDestroy( 3, packedId ); //packedId, srvMsg, srvMsg2 + + // Wait for server to handle srvmsg. + wait->WaitForL( 2 ); + value = messenger->GetValueFor( EXIMPPlgTestExistsGroupContentInCache ); + EUNIT_ASSERT_DESC( value == 1, "Data not cached temporarly, but it should be" ); + + wrapper->UnbindL(); + + CleanupStack::PopAndDestroy( wait ); + } + +// ------------------------------------------------------ +// General subscribe and unsubscribe for multiple +// ------------------------------------------------------ +// +void T_PresenceGroupMemberManagement::T_SubUnsubGroupContent_Multi_L() + { + BindAllL(); + + TInt countOfWrappers = iWrapperMgr->WrapperCount(); + + CXIMPObjectFactoryImp* factory = CXIMPObjectFactoryImp::NewL(); + CleanupStack::PushL( factory ); + + MXIMPIdentity* currentGrId = factory->NewIdentityLC(); + currentGrId->SetIdentityL( KGroupId ); + + // create group to all connections + for ( TInt i = 0; i < countOfWrappers; i++ ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( i ); + + // ------------------------------------------------------ + // some startup stuff + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresentityGroups& presGroup = presFeat->PresentityGroups(); + + CXIMPTestListener* listener = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener ); + // ------------------------------------------------------ + + // Tell the protocol it should act normally + wrapper->GetMessenger()->SetNoError(); + + // ------------------------------------------------------ + // create presentity group + // + // expect events: + // - request complete. + // NOTE: no presentitygrouplistevent as we've not subscribed the group lists + + // normal request complete + TXIMPRequestId reqIdDummy; // not checked + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + + // identity + displayname + CPresentityGroupInfoImp* infoImp = CPresentityGroupInfoImp::NewLC( *currentGrId, KGroupDisplayName ); + evReqComplete->AppendParamL( infoImp ); + CleanupStack::Pop( infoImp ); + + listener->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + TXIMPRequestId reqId = presGroup.CreatePresentityGroupL( *currentGrId, KGroupDisplayName ); + + // and wait + EUNIT_ASSERT_DESC( KErrNone == listener->WaitAndAssertL(), "CreatePresentityGroupL failed" ); + + // verify that create was called + messenger->AssertCreatePresentityGroupCalled( ETrue ); + + CleanupStack::PopAndDestroy( listener ); + } + + // subscribe presentity group content in all connections + for ( TInt i = 0; i < countOfWrappers; i++ ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( i ); + + // ------------------------------------------------------ + // some startup stuff + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresentityGroups& presGroup = presFeat->PresentityGroups(); + + CXIMPTestListener* listener = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener ); + // ------------------------------------------------------ + + // ------------------------------------------------------ + // subscribe presentity group CONTENT + // + // expect events: + // - request complete + TXIMPRequestId reqIdDummy; // not checked + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + // do the call + TXIMPRequestId reqId = presGroup.SubscribePresentityGroupContentL( *currentGrId ); + + // and wait + EUNIT_ASSERT_DESC( KErrNone == listener->WaitAndAssertL(), "SubscribePresentityGroupContentL failed" ); + + // verify that subscribe was called + messenger->AssertSubscribePresentityGroupContentCalled( ETrue ); + + CleanupStack::PopAndDestroy( listener ); + } + + // unsubscribe presentity group content in all connections + for ( TInt i = 0; i < countOfWrappers; i++ ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( i ); + + // ------------------------------------------------------ + // some startup stuff + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresentityGroups& presGroup = presFeat->PresentityGroups(); + + CXIMPTestListener* listener = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener ); + // ------------------------------------------------------ + + // ------------------------------------------------------ + // unsubscribe presentity group content + // + // expect events: + // - request complete + // - presentity group content event + + TXIMPRequestId reqIdDummy; // not checked + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + CPresentityGroupContentEventImp* groupCntEvent = + XIMPTestEventFactory::CreateGroupContentEventLCX( + KGroupId, + KNullDesC, + KNullDesC, + XIMPTestEventFactory::ETestPGLCntRemoved, + KNullDesC, + KNullDesC, + MXIMPDataSubscriptionState::ESubscriptionInactive, + MXIMPDataSubscriptionState::EDataUnavailable + ); + + listener->ExpectL( groupCntEvent ); + CleanupStack::Pop( groupCntEvent ); // 5 more items in cleanupstack + + // do the call + TXIMPRequestId reqId = presGroup.UnsubscribePresentityGroupContentL( *currentGrId ); + + // and wait + EUNIT_ASSERT_DESC( KErrNone == listener->WaitAndAssertL(), "UnsubscribePresentityGroupContentL failed" ); + CleanupStack::PopAndDestroy( 5 ); // lists + + // verify that unsubscribe was called + // unsubscribe really called only on the last one + messenger->AssertUnsubscribePresentityGroupContentCalled( i == countOfWrappers-1 ? ETrue : EFalse ); + + CleanupStack::PopAndDestroy( listener ); + } + + // delete presentity group in all connections + for ( TInt i = 0; i < countOfWrappers; i++ ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( i ); + + // ------------------------------------------------------ + // some startup stuff + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresentityGroups& presGroup = presFeat->PresentityGroups(); + + CXIMPTestListener* listener = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener ); + // ------------------------------------------------------ + + // ------------------------------------------------------ + // delete presentity group + // + // expect events: + // - request complete + // NO presentity group content event as we've just unsubscribed it. + + TXIMPRequestId reqIdDummy; // not checked + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + // do the call + TXIMPRequestId reqId = presGroup.DeletePresentityGroupL( *currentGrId ); + + // and wait + EUNIT_ASSERT_DESC( KErrNone == listener->WaitAndAssertL(), "DeletePresentityGroupL failed" ); + + CleanupStack::PopAndDestroy( listener ); + } + + // ------------------------------------------------------ + + CleanupStack::PopAndDestroy( 2 ); // currentGrId, factory + + + UnbindAllL(); + + TeardownTestSupport(); + } + +// ------------------------------------------------------ +// General subscribe and unsubscribe for multiple +// Subscribed for all contexts, force refresh +// ------------------------------------------------------ +// +void T_PresenceGroupMemberManagement::T_SubUnsubGroupContent_All_Multi_L() + { + BindAllL(); + + TInt countOfWrappers = iWrapperMgr->WrapperCount(); + + CXIMPObjectFactoryImp* factory = CXIMPObjectFactoryImp::NewL(); + CleanupStack::PushL( factory ); + + MXIMPIdentity* currentGrId = factory->NewIdentityLC(); + currentGrId->SetIdentityL( KGroupId ); + + // create group to all connections + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + + // ------------------------------------------------------ + // some startup stuff + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresentityGroups& presGroup = presFeat->PresentityGroups(); + + CXIMPTestListener* listener = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener ); + // ------------------------------------------------------ + + // Tell the protocol it should act normally + wrapper->GetMessenger()->SetNoError(); + + // ------------------------------------------------------ + // create presentity group + // + // expect events: + // - request complete. + // NOTE: no presentitygrouplistevent as we've not subscribed the group lists + + // normal request complete + TXIMPRequestId reqIdDummy; // not checked + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + + // identity + displayname + CPresentityGroupInfoImp* infoImp = CPresentityGroupInfoImp::NewLC( *currentGrId, KGroupDisplayName ); + evReqComplete->AppendParamL( infoImp ); + CleanupStack::Pop( infoImp ); + + listener->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + TXIMPRequestId reqId = presGroup.CreatePresentityGroupL( *currentGrId, KGroupDisplayName ); + + // and wait + EUNIT_ASSERT_DESC( KErrNone == listener->WaitAndAssertL(), "CreatePresentityGroupL failed" ); + + // verify that create was called + messenger->AssertCreatePresentityGroupCalled( ETrue ); + + // we'll make a new listener below, disable temporarily + listener->SetEventSourceL( NULL ); + + // subscribe presentity group content in all connections + for ( TInt i = 0; i < countOfWrappers; i++ ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( i ); + + // ------------------------------------------------------ + // some startup stuff + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresentityGroups& presGroup = presFeat->PresentityGroups(); + + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + // ------------------------------------------------------ + + // ------------------------------------------------------ + // subscribe presentity group content for ALL contexts + // + // expect events: + // - request complete + evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + // do the call + reqId = presGroup.SubscribePresentityGroupContentL( *currentGrId ); + + // and wait + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "SubscribePresentityGroupContentL failed" ); + + // verify that subscribe was called for first only + if ( i == 0 ) + { + messenger->AssertSubscribePresentityGroupContentCalled( ETrue ); + // reset flag + messenger->SetValueFor( + EXIMPPlgTestSubscribePresentityGroupContentCalled, + EFalse ); + } + else + { + messenger->AssertSubscribePresentityGroupContentCalled( EFalse ); + } + + CleanupStack::PopAndDestroy( listener2 ); + } + + for ( TInt i = 0; i < countOfWrappers; i++ ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( i ); + + // ------------------------------------------------------ + // some startup stuff + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresentityGroups& presGroup = presFeat->PresentityGroups(); + + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + // ------------------------------------------------------ + + // ------------------------------------------------------ + // subscribe presentity group content, making a REFRESH case + // with multiple contexts + // + // expect events: + // - request complete + // - group content event + + evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + CPresentityGroupContentEventImp* groupCntEvent = + XIMPTestEventFactory::CreateGroupContentEventLCX( + KGroupId, + KNullDesC, + KNullDesC, + XIMPTestEventFactory::ETestPGLCntUpdated, + KNullDesC, + KNullDesC, + MXIMPDataSubscriptionState::ESubscriptionActive, + MXIMPDataSubscriptionState::EDataUnavailable + ); + + listener2->ExpectL( groupCntEvent ); + CleanupStack::Pop( groupCntEvent ); // 5 more items in cleanupstack + + // do the call + reqId = presGroup.SubscribePresentityGroupContentL( *currentGrId ); + + // and wait + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "SubscribePresentityGroupContentL failed" ); + + CleanupStack::PopAndDestroy( 5 ); // rest of group the content event + + // subscribe is not called in the adaptation, this is a refresh case + messenger->AssertSubscribePresentityGroupContentCalled( EFalse ); + + CleanupStack::PopAndDestroy( listener2 ); + } + + // continue listening + listener->SetEventSourceL( context ); + + // ------------------------------------------------------ + // unsubscribe presentity group content + // + // expect events: + // - request complete + // - presentity group content event + + evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + CPresentityGroupContentEventImp* groupCntEvent = + XIMPTestEventFactory::CreateGroupContentEventLCX( + KGroupId, + KNullDesC, + KNullDesC, + XIMPTestEventFactory::ETestPGLCntRemoved, + KNullDesC, + KNullDesC, + MXIMPDataSubscriptionState::ESubscriptionInactive, + MXIMPDataSubscriptionState::EDataUnavailable + ); + + listener->ExpectL( groupCntEvent ); + CleanupStack::Pop( groupCntEvent ); // 5 more items in cleanupstack + + // do the call + reqId = presGroup.UnsubscribePresentityGroupContentL( *currentGrId ); + + // and wait + EUNIT_ASSERT_DESC( KErrNone == listener->WaitAndAssertL(), "UnsubscribePresentityGroupContentL failed" ); + CleanupStack::PopAndDestroy( 5 ); // lists + + // verify that unsubscribe was NOT called (other contexts are listening too), + // and it will be unscubscribed on the last call + messenger->AssertUnsubscribePresentityGroupContentCalled( EFalse ); + + // ------------------------------------------------------ + // delete presentity group + // + // expect events: + // - request complete + // NO presentity group content event as we've just unsubscribed it. + + evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + // do the call + reqId = presGroup.DeletePresentityGroupL( *currentGrId ); + + // and wait + EUNIT_ASSERT_DESC( KErrNone == listener->WaitAndAssertL(), "DeletePresentityGroupL failed" ); + + // ------------------------------------------------------ + + CleanupStack::PopAndDestroy( 3 ); // listener, currentGrId, factory + + UnbindAllL(); + + TeardownTestSupport(); + } + +// ------------------------------------------------------ +// General subscribe and unsubscribe for multiple +// Subscribed for one context only +// ------------------------------------------------------ +// +void T_PresenceGroupMemberManagement::T_SubUnsubGroupContent_One_Multi_L() + { + BindAllL(); + + CXIMPObjectFactoryImp* factory = CXIMPObjectFactoryImp::NewL(); + CleanupStack::PushL( factory ); + + MXIMPIdentity* currentGrId = factory->NewIdentityLC(); + currentGrId->SetIdentityL( KGroupId ); + + // create group to all connections + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + + // ------------------------------------------------------ + // some startup stuff + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresentityGroups& presGroup = presFeat->PresentityGroups(); + + CXIMPTestListener* listener = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener ); + // ------------------------------------------------------ + + // Tell the protocol it should act normally + wrapper->GetMessenger()->SetNoError(); + + // ------------------------------------------------------ + // create presentity group + // + // expect events: + // - request complete. + // NOTE: no presentitygrouplistevent as we've not subscribed the group lists + + // normal request complete + TXIMPRequestId reqIdDummy; // not checked + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + + // identity + displayname + CPresentityGroupInfoImp* infoImp = CPresentityGroupInfoImp::NewLC( *currentGrId, KGroupDisplayName ); + evReqComplete->AppendParamL( infoImp ); + CleanupStack::Pop( infoImp ); + + listener->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + TXIMPRequestId reqId = presGroup.CreatePresentityGroupL( *currentGrId, KGroupDisplayName ); + + // and wait + EUNIT_ASSERT_DESC( KErrNone == listener->WaitAndAssertL(), "CreatePresentityGroupL failed" ); + + // verify that create was called + messenger->AssertCreatePresentityGroupCalled( ETrue ); + + // ------------------------------------------------------ + // subscribe presentity group CONTENT + // + // expect events: + // - request complete + evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + // do the call + reqId = presGroup.SubscribePresentityGroupContentL( *currentGrId ); + + // and wait + EUNIT_ASSERT_DESC( KErrNone == listener->WaitAndAssertL(), "SubscribePresentityGroupContentL failed" ); + + // verify that subscribe was called + messenger->AssertSubscribePresentityGroupContentCalled( ETrue ); + + // ------------------------------------------------------ + // subscribe presentity group content, making a REFRESH case + // with multiple contexts + // + // expect events: + // - request complete + // - group content event + + evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + CPresentityGroupContentEventImp* groupCntEvent = + XIMPTestEventFactory::CreateGroupContentEventLCX( + KGroupId, + KNullDesC, + KNullDesC, + XIMPTestEventFactory::ETestPGLCntUpdated, + KNullDesC, + KNullDesC, + MXIMPDataSubscriptionState::ESubscriptionActive, + MXIMPDataSubscriptionState::EDataUnavailable + ); + + listener->ExpectL( groupCntEvent ); + CleanupStack::Pop( groupCntEvent ); // 5 more items in cleanupstack + + // do the call + reqId = presGroup.SubscribePresentityGroupContentL( *currentGrId ); + + // and wait + EUNIT_ASSERT_DESC( KErrNone == listener->WaitAndAssertL(), "SubscribePresentityGroupContentL failed" ); + + CleanupStack::PopAndDestroy( 5 ); // rest of group the content event + + // verify that subscribe was called + messenger->AssertSubscribePresentityGroupContentCalled( ETrue ); + + // ------------------------------------------------------ + // unsubscribe presentity group content + // + // expect events: + // - request complete + // - presentity group content event + + evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + groupCntEvent = + XIMPTestEventFactory::CreateGroupContentEventLCX( + KGroupId, + KNullDesC, + KNullDesC, + XIMPTestEventFactory::ETestPGLCntRemoved, + KNullDesC, + KNullDesC, + MXIMPDataSubscriptionState::ESubscriptionInactive, + MXIMPDataSubscriptionState::EDataUnavailable + ); + + listener->ExpectL( groupCntEvent ); + CleanupStack::Pop( groupCntEvent ); // 5 more items in cleanupstack + + // do the call + reqId = presGroup.UnsubscribePresentityGroupContentL( *currentGrId ); + + // and wait + EUNIT_ASSERT_DESC( KErrNone == listener->WaitAndAssertL(), "UnsubscribePresentityGroupContentL failed" ); + CleanupStack::PopAndDestroy( 5 ); // lists + + // verify that unsubscribe was called + // unsubscribe really called only on the last one + messenger->AssertUnsubscribePresentityGroupContentCalled( ETrue ); + + // ------------------------------------------------------ + // delete presentity group + // + // expect events: + // - request complete + // NO presentity group content event as we've just unsubscribed it. + + evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + // do the call + reqId = presGroup.DeletePresentityGroupL( *currentGrId ); + + // and wait + EUNIT_ASSERT_DESC( KErrNone == listener->WaitAndAssertL(), "DeletePresentityGroupL failed" ); + + // ------------------------------------------------------ + + CleanupStack::PopAndDestroy( 3 ); // listener, currentGrId, factory + + UnbindAllL(); + + TeardownTestSupport(); + } + +// Unsubscribe non-subscribed +void T_PresenceGroupMemberManagement::T_UnsubscribeNonSubscribed_L() + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + wrapper->BindL( 0 ); + + // ------------------------------------------------------ + // some startup stuff + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresentityGroups& presGroup = presFeat->PresentityGroups(); + + iListener2 = CXIMPTestListener::NewL( context ); + // ------------------------------------------------------ + + // Tell the protocol it should act normally + wrapper->GetMessenger()->SetNoError(); + + iCurrentGrId = context->ObjectFactory().NewIdentityLC(); + CleanupStack::Pop(); // iCurrentGrId + iCurrentGrId->SetIdentityL( KGroupId ); + + // ------------------------------------------------------ + // create presentity group + // + // expect events: + // - request complete. + // NOTE: no presentitygrouplistevent as we've not subscribed the group lists + + // normal request complete + TXIMPRequestId reqIdDummy; // not checked + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + + // identity + displayname + CPresentityGroupInfoImp* infoImp = CPresentityGroupInfoImp::NewLC( *iCurrentGrId, KGroupDisplayName ); + evReqComplete->AppendParamL( infoImp ); + CleanupStack::Pop( infoImp ); + + iListener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + TXIMPRequestId reqId = presGroup.CreatePresentityGroupL( *iCurrentGrId, KGroupDisplayName ); + + // and wait + EUNIT_ASSERT_DESC( KErrNone == iListener2->WaitAndAssertL(), "CreatePresentityGroupL failed" ); + messenger->AssertCreatePresentityGroupCalled( ETrue ); + + // ------------------------------------------------------ + // unsubscribe presentity group content + // + // expect events: + // - request complete + // - presentity group content event + + evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + iListener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + CPresentityGroupContentEventImp* groupCntEvent = + XIMPTestEventFactory::CreateGroupContentEventLCX( + KGroupId, + KNullDesC, + KNullDesC, + XIMPTestEventFactory::ETestPGLCntRemoved, + KNullDesC, + KNullDesC, + MXIMPDataSubscriptionState::ESubscriptionInactive, + MXIMPDataSubscriptionState::EDataUnavailable + ); + + iListener2->ExpectL( groupCntEvent ); + CleanupStack::Pop( groupCntEvent ); // 5 more items in cleanupstack + + // do the call + reqId = presGroup.UnsubscribePresentityGroupContentL( *iCurrentGrId ); + + // and wait + EUNIT_ASSERT_DESC( KErrNone == iListener2->WaitAndAssertL(), "UnsubscribePresentityGroupContentL failed" ); + + CleanupStack::PopAndDestroy( 5 ); // lists + + // verify that unsubscribe was not called, not subscribed, so won't + // unsubscribe + messenger->AssertUnsubscribePresentityGroupContentCalled( EFalse ); + + // make sure the new listener is not listening for events! + iListener2->SetEventSourceL( NULL ); + + wrapper->UnbindL(); + + TeardownTestSupport(); + } + +// =========================================================================== +// SETUP HELPERS FOR THE LISTENER +// =========================================================================== +// +void T_PresenceGroupMemberManagement::SetupListenerReqCompleteL( CXIMPTestContextWrapper* aWrapper, TXIMPTestStatusEventTemplate aEventType ) + { + RArray< TInt32 > array; + CleanupClosePushL( array ); + array.Append( MXIMPContextStateEvent::KInterfaceId ); + array.Append( MPresentityGroupListEvent::KInterfaceId ); + aWrapper->SetupListenerReqCompleteL( aEventType, &array ); + CleanupStack::PopAndDestroy(); // array + } + +void T_PresenceGroupMemberManagement::SetupListenerReqCompleteAllowEventsL( CXIMPTestContextWrapper* aWrapper, TXIMPTestStatusEventTemplate aEventType ) + { + RArray< TInt32 > array; + CleanupClosePushL( array ); + array.AppendL( MXIMPRequestCompleteEvent::KInterfaceId ); + array.AppendL( MXIMPContextStateEvent::KInterfaceId ); + array.Append( MPresentityGroupListEvent::KInterfaceId ); + array.Append( MXIMPContextStateEvent::KInterfaceId ); + array.Append( MPresentityGroupListEvent::KInterfaceId ); + array.Append( MPresentityGroupContentEvent::KInterfaceId ); + aWrapper->SetupListenerReqCompleteL( aEventType, &array ); + CleanupStack::PopAndDestroy(); // array + } + +// =========================================================================== +// TEST CASE TABLE +// =========================================================================== +// +EUNIT_BEGIN_TEST_TABLE( + T_PresenceGroupMemberManagement, + "XIMP presence group member management tests", + "MODULE" ) + +PRFW_DECORATED_TEST( + "Subscribe and unsubscribe presentity group content", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_SubUnsubGroupContent_Single_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Subscribe and unsubscribe multiple", + "", + "", + "FUNCTIONALITY", + SetupMultiple_L, + T_SubUnsubGroupContent_Multi_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Refresh subscription for one, multiple", + "", + "", + "FUNCTIONALITY", + SetupMultiple_L, + T_SubUnsubGroupContent_One_Multi_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Refresh subscription for all, multiple", + "", + "", + "FUNCTIONALITY", + SetupMultiple_L, + T_SubUnsubGroupContent_All_Multi_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Subscribe content and receive altered id", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_SubUnsubGroupContent_Altered_Single_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Subscribe content and receive altered but same id", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_SubUnsubGroupContent_AlteredSame_Single_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Unsubscribe non-subscribed", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_UnsubscribeNonSubscribed_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Add members to group", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_AddGroupMembers_Single_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Remove members from group", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_RemoveGroupMembers_Single_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Remove members from unsubscribed group", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_RemoveGroupMembers_NonSub_Single_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Remove nonexisting member from group", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_RemoveGroupMembers_NonExist_Single_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Updated members from group", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_UpdateGroupMembers_Single_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Updated members from nonsubscribed group", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_UpdateGroupMembers_NonSub_Single_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Updated nonexisting member of group", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_UpdateGroupMembers_NonExist_Single_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Expire non-subscribed data", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_ExpireNonSubscribedData_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Expire non-subscribed data. Update multiple times", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_ExpireNonSubscribedDataUpdateMultiple_L, + Teardown ) + + +EUNIT_END_TEST_TABLE + + +// =========================================================================== +// TEST SUITE CONSTRUCTION +// =========================================================================== +// +EXPORT_C MEUnitTest* CreateTestSuiteL() + { + return T_PresenceGroupMemberManagement::NewL(); + } + +// TODO implement this (split this file to multiple parts): +/* +// =========================================================================== +// TEST SUITE CONSTRUCTION +// =========================================================================== +// +EXPORT_C MEUnitTest* CreateTestSuiteL() + { + CEUnitTestSuite* suiteCollection = CEUnitTestSuite::NewLC( _L("XIMP group list management tests") ); + + CEUnitTestSuite* suite = T_PresenceGroupListManagement::NewL(); + CleanupStack::PushL( suite ); + suiteCollection->AddL( suite ); + CleanupStack::Pop( suite ); + + suite = T_xxx::NewL(); + CleanupStack::PushL( suite ); + suiteCollection->AddL( suite ); + CleanupStack::Pop( suite ); + + CleanupStack::Pop( suiteCollection ); + return suiteCollection; + } + +*/ + + + +// =========================================================================== +// MISC +// =========================================================================== +// +//Exception handler function +void MyExceptionHandler( TExcType /*aType*/ ) + { + __BREAKPOINT(); + } + +void T_PresenceGroupMemberManagement::UseMyOwnExceptionHandler() + { + //Register exeption handler + TInt r = User::SetExceptionHandler( MyExceptionHandler, 0xFFFFFFFF ); + if (r != KErrNone) + { + User::Panic( _L("MyExHandler"), 1 ); + } + } + + +// end of file diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/src/t_presencegroupmembermngt/t_presencegroupmembermngt.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/src/t_presencegroupmembermngt/t_presencegroupmembermngt.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,153 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework Test Code +* +*/ + +#ifndef T_PRESENCEGROUPMEMBERMANAGEMENT_H +#define T_PRESENCEGROUPMEMBERMANAGEMENT_H + +#include +#include +#include +#include "prfwteststatuseventlistener.h" +#include "prfwtestmessaging.h" + +class CXIMPTestContextWrapper; +class CXIMPTestContextWrapperMgr; +class CXIMPTestMessenger; +class CPresentityGroupListEventImp; +class CPresentityGroupContentEventImp; + +class T_PresenceGroupMemberManagement; + +class CXIMPTestListener; + +// function pointer to a method +typedef void (T_PresenceGroupMemberManagement::* TXIMPCallBack )(); + +/** + * XIMP Framework Eunit tests. + * + * Tests for XIMP group member management services. + * + * @since S60 v4.0 + */ +class T_PresenceGroupMemberManagement : public CEUnitTestSuiteClass + { + +public: + static T_PresenceGroupMemberManagement* NewL(); + virtual ~T_PresenceGroupMemberManagement(); + + +private: + T_PresenceGroupMemberManagement(); + void ConstructL(); + +private: // Test case functions + + void Setup_L(); + void SetupMultiple_L(); + void BindAllL(); + void Teardown(); + + // destroy test case support things, which cannot + // be known in Setup method. + void TeardownTestSupport(); + + void UnbindAllL(); + + void T_SubUnsubGroupContent_Single_L(); + void T_SubUnsubGroupContent_Multi_L(); + void T_SubUnsubGroupContent_One_Multi_L(); + void T_SubUnsubGroupContent_All_Multi_L(); + void T_SubUnsubGroupContent_Altered_Single_L(); + void T_SubUnsubGroupContent_AlteredSame_Single_L(); + void T_UnsubscribeNonSubscribed_L(); + void T_AddGroupMembers_Single_L(); + void T_RemoveGroupMembers_Single_L(); + void T_RemoveGroupMembers_NonSub_Single_L(); + void T_RemoveGroupMembers_NonExist_Single_L(); + void T_UpdateGroupMembers_Single_L(); + void T_UpdateGroupMembers_NonSub_Single_L(); + void T_UpdateGroupMembers_NonExist_Single_L(); + void T_ExpireNonSubscribedData_L(); + void T_ExpireNonSubscribedDataUpdateMultiple_L(); + + // variable test method support + void T_GenericSubAndUnsubL( TXIMPCallBack& aCbFuncL ); + + void T_EmptyFunc(); + void T_TestAddMembersL(); + void T_TestAddMembers_NonSub_L(); + void T_TestRemoveMembersL(); + void T_TestRemoveMembers_NonSub_L(); + void T_TestRemoveMembers_NonExisting_L(); + void T_TestUpdateMembers_L(); + void T_TestUpdateMembers_NonSub_L(); + void T_TestUpdateMembers_NonExisting_L(); + +private: // Test helpers + + void SetupListenerReqCompleteL( CXIMPTestContextWrapper* aWrapper, TXIMPTestStatusEventTemplate aEventType ); + void SetupListenerReqCompleteAllowEventsL( CXIMPTestContextWrapper* aWrapper, TXIMPTestStatusEventTemplate aEventTypes ); + + // sometimes EUnit might eat e.g. an Access violation. + // Call this method in the test case to break when it happens, + // hopefully you will find the cause. + void UseMyOwnExceptionHandler(); + +private: // Test data + + /** + * Eunit test case table declaration. + */ + EUNIT_DECLARE_TEST_TABLE; + + // owned + CXIMPTestContextWrapperMgr* iWrapperMgr; + + CActiveSchedulerWait* iASWait; + + // current group id + // owned. + MXIMPIdentity* iCurrentGrId; + + /** + * Last received group content event. + * Owned. + */ + CPresentityGroupContentEventImp* iLastEvent; + + CXIMPTestListener* iListener2; + + // ETrue, if you want to skip group content subscription in generic + // sub and unsub + TBool iSkipSubscribe; + + // EFalse, if you want to skip group content unsubscription + TBool iSkipUnsubscribe; + }; + + +#endif // T_PRESENCEGROUPMEMBERMANAGEMENT_H + + + +// end of file + + + + diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/src/t_presencegroupmembermngt/t_presencegroupmembermngt.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/src/t_presencegroupmembermngt/t_presencegroupmembermngt.mmp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,56 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework Test Code +* +*/ + +#include "../../tsrcutils/eunitcommon/eunittstdllbase.hrh" +#include "../../tsrcutils/processmaster/pm.h" + +TARGET t_presencegroupmembermngt.dll + +SOURCEPATH . +SOURCE t_presencegroupmembermngt.cpp + + +USERINCLUDE ../../../core/srcdatamodel +USERINCLUDE ../../../presence/srcpresencedatamodel +USERINCLUDE ../../../presence/srcpresencedatamodel/presentitygroups +USERINCLUDE ../../../presence/srcpresencedatamodel/presencewatching +USERINCLUDE ../../../presence/srcpresencedatamodel/presenceauthorization +USERINCLUDE ../../../presence/srcpresencedatamodel/presencepublishing +USERINCLUDE ../../../presence/srcpresencedatamodel/presenceinfo +USERINCLUDE ../../../core/srcutils + +// TODO remove unnecessary +SYSTEMINCLUDE ../../../inc/core/base +SYSTEMINCLUDE ../../../inc/core/datamodel +SYSTEMINCLUDE ../../../inc/core/protocolplugin +SYSTEMINCLUDE ../../../inc/core/protocolpluginhost +SYSTEMINCLUDE ../../../inc/presence/presencedatamodel +SYSTEMINCLUDE ../../../inc/presence/presencemanagement +SYSTEMINCLUDE ../../../inc/presence/presenceprotocolplugin +SYSTEMINCLUDE ../../../inc/presence/presenceprotocolpluginhost + +LIBRARY ecom.lib +LIBRARY bafl.lib +LIBRARY ximpdatamodel.lib +LIBRARY presencedatamodel.lib +LIBRARY ximputils.lib +LIBRARY estor.lib + + +// end of file + + diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/src/t_presencepublishing/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/src/t_presencepublishing/bld.inf Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,26 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Build information file for t_presencemng.dll +* +*/ + + +PRJ_PLATFORMS +DEFAULT + +PRJ_TESTMMPFILES +t_presencepublishing.mmp + +PRJ_TESTMMPFILES +///epoc32/RELEASE/winscw/UDEB/t_presencepublishing.dll /epoc32/RELEASE/winscw/UDEB/z/sys/bin/t_presencepublishing.dll diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/src/t_presencepublishing/t_presencepublishing.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/src/t_presencepublishing/t_presencepublishing.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,1211 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework Test Code +* +*/ + + +#include "eunittools.h" + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "t_presencepublishing.h" + +#include "prfwtestmessaging.h" +#include "prfwtestmessenger.h" +#include "prfwtestcontextwrappermgr.h" +#include "prfwtestcontextwrapper.h" + +#include "prfwtestpresencedatautils.h" + +#include "ximprequestcompleteeventimp.h" +#include "ximpcontextstateeventimp.h" +#include "ximpcontextstateimp.h" +#include "ximpstatusimp.h" +#include "ownpresenceeventimp.h" + +// new test stuff +#include "prfwtestlistener.h" +#include "prfwtestfilesrvmsg.h" +#include "prfwtestfiletool.h" + + +#include "prfwtestrobustnesstools.h" + +_LIT8( KPrefix1, "PreA_" ); +_LIT8( KPrefix2, "PreB_" ); +_LIT8( KPrefix3, "PreC_" ); +_LIT8( KPrefix4, "PreD_" ); + +_LIT8( KServiceType, "test_service" ); +_LIT( KStatusMsg, "This is my status." ); + +const TInt KTestAvailability = 1; + +// ============================ MEMBER FUNCTIONS =============================== + +// CONSTRUCTION +T_PresencePublishing* T_PresencePublishing::NewL() + { + T_PresencePublishing* self = new( ELeave ) T_PresencePublishing; + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + + return self; + } + + +T_PresencePublishing::~T_PresencePublishing() + { + } + + +void T_PresencePublishing::ConstructL() + { + CEUnitTestSuiteClass::ConstructL(); + } + + +T_PresencePublishing::T_PresencePublishing() + { + } + + + +// =========================================================================== +// TEST CASE SETUP & TEARDOWN METHODS +// =========================================================================== +// + +void T_PresencePublishing::Setup_L() + { + PrfwTestRobustness::DoPreCleaning(); + + iWrapperMgr = CXIMPTestContextWrapperMgr::NewL(); + iWrapperMgr->CreateWrapperL(); + } + +void T_PresencePublishing::SetupMultiple_L() + { + PrfwTestRobustness::DoPreCleaning(); + + iWrapperMgr = CXIMPTestContextWrapperMgr::NewL(); + iWrapperMgr->CreateWrapperL(); + iWrapperMgr->CreateWrapperL(); + iWrapperMgr->CreateWrapperL(); + } + + +void T_PresencePublishing::BindL() + { + CXIMPTestContextWrapper* wrapper0 = iWrapperMgr->GetWrapperL( 0 ); + + wrapper0->BindL( 0 ); + } + +void T_PresencePublishing::Bind2L() + { + CXIMPTestContextWrapper* wrapper0 = iWrapperMgr->GetWrapperL( 0 ); + wrapper0->BindWithSettingsL( 0 ); + } + +void T_PresencePublishing::BindAllL() + { + for( TInt a = 0; a < iWrapperMgr->WrapperCount(); ++a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + wrapper->BindL( 0 ); + } + } + + +void T_PresencePublishing::Teardown() + { + delete iWrapperMgr; + iWrapperMgr = NULL; + + REComSession::FinalClose(); + + PrfwTestRobustness::DoPreCleaning(); + } + +void T_PresencePublishing::UnbindL() + { + // Do unbind + CXIMPTestContextWrapper* wrapper0 = iWrapperMgr->GetWrapperL( 0 ); + wrapper0->UnbindL(); + } + +void T_PresencePublishing::UnbindAllL() + { + for( TInt a = 0; a < iWrapperMgr->WrapperCount(); ++a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + wrapper->UnbindL(); + } + } + + +// =========================================================================== +// TEST CASES for presence publish +// =========================================================================== +void T_PresencePublishing::T_Publish_Single_L() + { + EUNIT_PRINT( _L("Single Presence Publish test") ); + + BindL(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresencePublishing& presPub = presFeat->PresencePublishing(); + + // Generate a doc + CPresenceInfoImp* presInfo = + XIMPTestPresenceDataUtils::GenerateInfoLC( &KPrefix1 ); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // Publish the presence + TXIMPRequestId reqId = presPub.PublishOwnPresenceL( *presInfo ); + + // Setup status event listener + CXIMPRequestCompleteEventImp* evReqComplete = + CXIMPRequestCompleteEventImp::NewLC( reqId ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + // Wait for events on the request + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Publishing presence failed" ); + + + COMMONASSERT( messenger, EXIMPPlgTestPublishPresenceCalled, "PublishPresenceL was not called", ETrue, NULL ); + + CleanupStack::PopAndDestroy( presInfo ); + CleanupStack::PopAndDestroy( listener2 ); + UnbindL(); + } + +void T_PresencePublishing::T_NetworkUnplugError_L() + { + EUNIT_PRINT( _L("Error from plug-in in publish own presence") ); + + // Creating the error which comes from KErrTimedOut and protocol sends Connection terminated. + +// BIND AND SETUP + + Bind2L(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresencePublishing& presPub = presFeat->PresencePublishing(); + + +// PUBLISH OWN + + //messenger->SetLeave( KErrAbort ); + messenger->SetError(KErrTimedOut); + + // publish own presence in here + MPresenceInfo* info = CreateInfoLC(); + + TXIMPRequestId reqId = presPub.PublishOwnPresenceL( *info ); + + + // Setup status event listener for RequestComplete + listener2->Reset(); + // request complete with KErrAbort + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqId ); + evReqComplete->CompletionResultImp().SetResultCode( KErrTimedOut ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + CXIMPContextStateEventImp* evContextEvent = CXIMPContextStateEventImp::NewLC(); + evContextEvent->ContextStateImp().SetStateValue( MXIMPContextState::EUnbinding); + listener2->ExpectL( evContextEvent ); + CleanupStack::Pop( evContextEvent ); + + CXIMPContextStateEventImp* evContextEvent2 = CXIMPContextStateEventImp::NewLC(); + evContextEvent2->ContextStateImp().SetStateValue( MXIMPContextState::EInactive); + listener2->ExpectL( evContextEvent2 ); + CleanupStack::Pop( evContextEvent2 ); + + listener2->WaitAndAssertL(); + +// UNBIND + + CleanupStack::PopAndDestroy(1);//info + CleanupStack::PopAndDestroy( listener2 ); + + messenger->SetError( KErrNone ); + + UnbindL(); + } + + +void T_PresencePublishing::T_NetworkUnplugErrorMultiple_L() + { + EUNIT_PRINT( _L("Network disconnect from plug-in in publish own presence, multiple contexts") ); + + // Bind 2 contexts + BindAllL(); + + /* + * Make the 1st client publish someting and then the disconnect would happen + */ + CXIMPTestContextWrapper* wrapper0 = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context0 = wrapper0->GetContext(); + CXIMPTestMessenger* messenger0 = wrapper0->GetMessenger(); + + + CXIMPTestListener* listener0 = CXIMPTestListener::NewL( context0); + CleanupStack::PushL( listener0); + + MPresenceFeatures* presFeat0 = wrapper0->GetPresenceFeatures(); + MPresencePublishing& presPub0 = presFeat0->PresencePublishing(); + + //messenger->SetLeave( KErrAbort ); + messenger0->SetError(KErrTimedOut); + + + // publish own presence in here + MPresenceInfo* info = CreateInfoLC(); + TXIMPRequestId reqId = presPub0.PublishOwnPresenceL( *info ); + + /* Setup status event listener for RequestComplete for client 1 */ + listener0->Reset(); + // request complete with KErrTimedOut + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqId ); + evReqComplete->CompletionResultImp().SetResultCode( KErrTimedOut ); + listener0->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + // Create the context state events for unbinding + CXIMPContextStateEventImp* evContextEvent = CXIMPContextStateEventImp::NewLC(); + evContextEvent->ContextStateImp().SetStateValue( MXIMPContextState::EUnbinding); + listener0->ExpectL( evContextEvent ); + CleanupStack::Pop( evContextEvent ); + + CXIMPContextStateEventImp* evContextEvent2 = CXIMPContextStateEventImp::NewLC(); + evContextEvent2->ContextStateImp().SetStateValue( MXIMPContextState::EInactive); + listener0->ExpectL( evContextEvent2 ); + CleanupStack::Pop( evContextEvent2 ); + + + + /* + * Create a request for client 2, this will not be processed by the protocol plug-in + */ + CXIMPTestContextWrapper* wrapper1 = iWrapperMgr->GetWrapperL( 1 ); + MXIMPContext* context1 = wrapper1->GetContext(); + + MPresenceFeatures* presFeat1 = wrapper1->GetPresenceFeatures(); + MPresencePublishing& presPub1 = presFeat1->PresencePublishing(); + + + // Create the empty presence info filter + CPresenceInfoFilterImp* pif = CPresenceInfoFilterImp::NewLC(); + TXIMPRequestId reqId1 = presPub1.SubscribeOwnPresenceL( *pif ); + CleanupStack::PopAndDestroy(pif); + + // Setup status event listener for RequestComplete + CXIMPTestListener* listener1 = CXIMPTestListener::NewL( context1); + CleanupStack::PushL( listener1); + listener1->Reset(); + // normal request complete + CXIMPRequestCompleteEventImp* evReqComplete1 = CXIMPRequestCompleteEventImp::NewLC( reqId1 ); + evReqComplete1->CompletionResultImp().SetResultCode( KErrTimedOut ); + listener1->ExpectL( evReqComplete1 ); + CleanupStack::Pop( evReqComplete1 ); + + // Create the context state events for unbinding + evContextEvent = CXIMPContextStateEventImp::NewLC(); + evContextEvent->ContextStateImp().SetStateValue( MXIMPContextState::EUnbinding); + listener1->ExpectL( evContextEvent ); + CleanupStack::Pop( evContextEvent ); + + evContextEvent2 = CXIMPContextStateEventImp::NewLC(); + evContextEvent2->ContextStateImp().SetStateValue( MXIMPContextState::EInactive); + listener1->ExpectL( evContextEvent2 ); + CleanupStack::Pop( evContextEvent2 ); + + + // Wait for events on the request + + EUNIT_ASSERT_DESC( KErrNone == listener0->WaitAndAssertL(), "Publish own presence failed in client 1"); + + EUNIT_ASSERT_DESC( KErrNone == listener1->WaitAndAssertL(), "SubscribeOwnPresence failed in client 2" ); + + CleanupStack::PopAndDestroy( listener1 ); + CleanupStack::PopAndDestroy(1);//info + CleanupStack::PopAndDestroy( listener0 ); + + // Finish the test case + UnbindAllL(); + } + +void T_PresencePublishing::T_Publish_ErrFromPlg_Leave_L() + { + EUNIT_PRINT( _L("Single Presence Publish test") ); + EUNIT_PRINT( _L("Plugin leaves from PublishOwnPresenceL") ); + + BindL(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresencePublishing& presPub = presFeat->PresencePublishing(); + + // Generate a doc + CPresenceInfoImp* presDoc = + XIMPTestPresenceDataUtils::GenerateInfoLC( &KPrefix1 ); + + // Setup status event listener + SetupListenerReqCompleteL( wrapper, EXIMPTestStatusEvents_RequestOk ); + + // Tell the test protocol to leave on next operation + messenger->SetLeave( KErrAbort ); + + // Publish the presence + TXIMPRequestId reqId = presPub.PublishOwnPresenceL( *presDoc ); + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Publishing single presence, leave with error: ") ); + + // Verify that plugin left and didn't go through the PublishOwnPresenceL. + COMMONASSERT( messenger, EXIMPPlgTestPublishPresenceCalled, "PublishPresenceL was not called", + EFalse, "PublishPresenceL was called." ); + + + // TODO wait and verify the events + EUNIT_FAIL_TEST( "Under construction." ); + + CleanupStack::PopAndDestroy( presDoc ); + CleanupStack::PopAndDestroy( listener2 ); + UnbindL(); + } + +void T_PresencePublishing::T_Publish_ErrFromPlg_CompleteWithError_L() + { + EUNIT_PRINT( _L("Single Presence Publish test") ); + EUNIT_PRINT( _L("Plugin completes PublishOwnPresenceL with error") ); + + BindL(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresencePublishing& presPub = presFeat->PresencePublishing(); + + // Generate a doc + CPresenceInfoImp* presDoc = + XIMPTestPresenceDataUtils::GenerateInfoLC( &KPrefix1 ); + + // Setup status event listener: + //TODO Setup presence event listener + SetupListenerReqCompleteL( wrapper, EXIMPTestStatusEvents_RequestOk ); + + // Tell the test protocol to return with error on next operation + messenger->SetError( KErrAbort ); + + // Publish the presence + TXIMPRequestId reqId = presPub.PublishOwnPresenceL( *presDoc ); + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Publishing single presence, complete with error: ") ); + + // Verify that we did go through PublishOwnPresenceL. + COMMONASSERT( messenger, EXIMPPlgTestPublishPresenceCalled, "PublishPresenceL was not called", ETrue, NULL ); + + // TODO wait and verify presence events + EUNIT_FAIL_TEST( "Under construction." ); + + CleanupStack::PopAndDestroy( presDoc ); + CleanupStack::PopAndDestroy( listener2 ); + + UnbindL(); + } + + +// =========================================================================== +// TEST CASES for presence interest registration +// =========================================================================== + +// Single client, empty filter +void T_PresencePublishing::T_SubscribeOwnPresence_Single_Empty_L() + { + EUNIT_PRINT( _L("Single interest registration") ); + + BindL(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresencePublishing& presPub = presFeat->PresencePublishing(); + + // Create the empty presence info filter + CPresenceInfoFilterImp* pif = CPresenceInfoFilterImp::NewLC(); + + // Setup status event listener for RequestComplete + listener2->Reset(); + // normal request complete + TXIMPRequestId reqIdDummy; // not checked + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + // subscribe own presence + TXIMPRequestId reqId = presPub.SubscribeOwnPresenceL( *pif ); + + // Wait for events on the request + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "SubscribeOwnPresence failed" ); + + // verify that SubscribeOwnPresenceL was called + COMMONASSERT( messenger, EXIMPPlgTestSubscribeOwnPresenceCalled, "SubscribeOwnPresenceL was not called", ETrue, NULL ); + + // Setup status event listener for RequestComplete + listener2->Reset(); + evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + // unsubscribe own presence + reqId = presPub.UnsubscribeOwnPresenceL(); + + // Wait for events on the request + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "UnsubscribeOwnPresence failed" ); + + // verify that UnsubscribeOwnPresenceL was called + COMMONASSERT( messenger, EXIMPPlgTestUnsubscribeOwnPresenceCalled, "UnsubscribeOwnPresenceL was not called", ETrue, NULL ); + + CleanupStack::PopAndDestroy( pif ); + CleanupStack::PopAndDestroy( listener2 ); + UnbindL(); + } + +// Single client, empty filter +void T_PresencePublishing::T_SubscribeOwnPresence_Multiple_Empty_L() + { + EUNIT_PRINT( _L("Multiple client filter registration") ); + + BindAllL(); + + // Create the empty presence info filter + CPresenceInfoFilterImp* pif = CPresenceInfoFilterImp::NewLC(); + + TInt countOfWrappers = iWrapperMgr->WrapperCount(); + + CXIMPTestListener* listeners[ 50 ]; + TXIMPRequestId reqIdDummy; // not checked + + + +// Setup listeners + for( TInt a = 0; a < countOfWrappers; a++ ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + MXIMPContext* context = wrapper->GetContext(); + listeners[ a ] = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listeners[ a ] ); + } + + +// SUBSCRIBE + for( TInt a = countOfWrappers - 1; a > 0 ; --a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresencePublishing& presPub = presFeat->PresencePublishing(); + + // Setup status event listener for RequestComplete + listeners[ a ]->Reset(); + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listeners[ a ]->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + messenger->SetValueFor( EXIMPPlgTestSubscribeOwnPresenceCalled, 0 ); + // subscribe own presence + TXIMPRequestId reqId = presPub.SubscribeOwnPresenceL( *pif ); + + // Wait for events on the request + EUNIT_ASSERT_DESC( KErrNone == listeners[ a ]->WaitAndAssertL(), "SubscribeOwnPresence failed" ); + + // verify that SubscribeOwnPresenceL was called + COMMONASSERT( messenger, EXIMPPlgTestSubscribeOwnPresenceCalled, "SubscribeOwnPresenceL was not called", + ( a > 1 ) ? ETrue : EFalse , "SubscribeOwnPresenceL was called." ); + } + +// REFRESH + + for( TInt a = countOfWrappers - 1; a > 0 ; --a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresencePublishing& presPub = presFeat->PresencePublishing(); + + // Setup status event listener for RequestComplete + listeners[ a ]->Reset(); + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listeners[ a ]->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + CXIMPDataSubscriptionStateImp* stateImp = CXIMPDataSubscriptionStateImp::NewLC(); + stateImp->SetDataStateL( MXIMPDataSubscriptionState::EDataUnavailable ); + stateImp->SetSubscriptionStateL( MXIMPDataSubscriptionState::ESubscriptionActive ); + COwnPresenceEventImp* evOwnPresence = COwnPresenceEventImp::NewLC( stateImp ); + CleanupStack::Pop( 2, stateImp ); + CleanupStack::PushL( evOwnPresence ); + listeners[ a ]->ExpectL( evOwnPresence ); + CleanupStack::Pop( evOwnPresence ); + + // TODO check if this call is still needed + messenger->SetValueFor( EXIMPPlgTestSubscribeOwnPresenceCalled, 0 ); + + // subscribe own presence + TXIMPRequestId reqId = presPub.SubscribeOwnPresenceL( *pif ); + + // Wait for events on the request + EUNIT_ASSERT_DESC( KErrNone == listeners[ a ]->WaitAndAssertL(), "SubscribeOwnPresence failed" ); + + // verify that SubscribeOwnPresenceL was called + COMMONASSERT( messenger, EXIMPPlgTestSubscribeOwnPresenceCalled, + "SubscribeOwnPresenceL was not called", + EFalse , "SubscribeOwnPresenceL was called." ); + } + + +// UNSUBSCRIBE + + for( TInt a = 0; a < countOfWrappers; ++a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresencePublishing& presPub = presFeat->PresencePublishing(); + + // Setup status event listener for RequestComplete + listeners[ a ]->Reset(); + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listeners[ a ]->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + + // register interest + TXIMPRequestId reqId = presPub.UnsubscribeOwnPresenceL(); + + // Wait for events on the request + EUNIT_ASSERT_DESC( KErrNone == listeners[ a ]->WaitAndAssertL(), "UnsubscribeOwnPresence failed" ); + + + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestUnsubscribeOwnPresenceCalled, + "UnsubscribeOwnPresenceL was not called", + ( a < 2 ) ? EFalse : ETrue, + "UnsubscribeOwnPresenceL was called" ); + } + + + // delete the listeners + CleanupStack::PopAndDestroy( countOfWrappers ); // the contents of listeners[] + + CleanupStack::PopAndDestroy( pif ); + + UnbindAllL(); + } + + +// Single client, filled filter +void T_PresencePublishing::T_SubscribeOwnPresence_Single_L() + { + EUNIT_PRINT( _L("Single interest registration") ); + + BindL(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresencePublishing& presPub = presFeat->PresencePublishing(); + + // Create the filled interest document + CPresenceInfoFilterImp* pif = + XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 ); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + +// SUBSCRIBE + + // subscribe own presence + TXIMPRequestId reqId = presPub.SubscribeOwnPresenceL( *pif ); + + // Setup status event listener for RequestComplete + listener2->Reset(); + SetupListenerReqCompleteL( wrapper, EXIMPTestStatusEvents_RequestOk ); + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqId ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + // Wait for events on the request + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "SubscribeOwnPresence failed" ); + + // verify that SubscribeOwnPresenceL was called + COMMONASSERT( messenger, EXIMPPlgTestSubscribeOwnPresenceCalled, "SubscribeOwnPresenceL was not called", ETrue, NULL ); + +// REFRESH + + // subscribe own presence (refresh) + reqId = presPub.SubscribeOwnPresenceL( *pif ); + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteL( wrapper, EXIMPTestStatusEvents_RequestOk ); + messenger->SetValueFor( EXIMPPlgTestSubscribeOwnPresenceCalled, 0 ); + listener2->Reset(); + evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqId ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + // also the event + + CXIMPDataSubscriptionStateImp* stateImp = CXIMPDataSubscriptionStateImp::NewLC(); + stateImp->SetDataStateL( MXIMPDataSubscriptionState::EDataUnavailable ); + stateImp->SetSubscriptionStateL( MXIMPDataSubscriptionState::ESubscriptionActive ); + COwnPresenceEventImp* event = COwnPresenceEventImp::NewLC( stateImp ); + CleanupStack::Pop( 2, stateImp ); + CleanupStack::PushL( event ); + listener2->ExpectL( event ); + CleanupStack::Pop( event ); + + // Wait for events on the request + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Refreshing own presence subscription failed" ); + + // verify that SubscribeOwnPresenceL was called + COMMONASSERT( messenger, EXIMPPlgTestSubscribeOwnPresenceCalled, "SubscribeOwnPresenceL was not called", EFalse, "SubscribeOwnPresenceL was called" ); + + CleanupStack::PopAndDestroy( pif ); + CleanupStack::PopAndDestroy( listener2 ); + UnbindL(); + } + +void T_PresencePublishing::T_ErrFromPlg_LeaveOnSubscribeOwnPresence_L() + { + EUNIT_PRINT( _L("Error from plug-in in presentity presence subscribe") ); + EUNIT_PRINT( _L("Plug-in leaves from SubscribePresence().") ); + +// BIND AND SETUP + + BindL(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresencePublishing& presPub = presFeat->PresencePublishing(); + + // Create the filled interest document + CPresenceInfoFilterImp* pif = + XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 ); + +// SUBSCRIBE + + messenger->SetLeave( KErrAbort ); + + // subscribe own presence + TXIMPRequestId reqId = presPub.SubscribeOwnPresenceL( *pif ); + + // Setup status event listener for RequestComplete + listener2->Reset(); + // request complete with KErrAbort + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqId ); + evReqComplete->CompletionResultImp().SetResultCode( KErrAbort ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + // Wait for events on the request + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Subscribing presentity presence, didn't complete with error" ); + + // verify that SubscribeOwnPresenceL was called + COMMONASSERT( messenger, EXIMPPlgTestSubscribeOwnPresenceCalled, "SubscribeOwnPresenceL was not called", EFalse, "SubscribeOwnPresenceL was called" ); + + +// SUBSCRIBE + + messenger->SetLeave( KErrNone ); + + // subscribe own presence + reqId = presPub.SubscribeOwnPresenceL( *pif ); + + // Setup status event listener for RequestComplete + listener2->Reset(); + evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqId ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + // Wait for events on the request + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Subscribing presentity presence failed" ); + + // verify that SubscribeOwnPresenceL was called + COMMONASSERT( messenger, EXIMPPlgTestSubscribeOwnPresenceCalled, "SubscribeOwnPresenceL was not called", ETrue, "SubscribeOwnPresenceL was called" ); + + +// UNSUBSCRIBE + + messenger->SetLeave( KErrAbort ); + + // register interest + reqId = presPub.UnsubscribeOwnPresenceL(); + + // Setup status event listener for RequestComplete + listener2->Reset(); + evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqId ); + evReqComplete->CompletionResultImp().SetResultCode( KErrAbort ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + // Wait for events on the request + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Unsubscribing presentity presence with error failed" ); + + // verify that UnsubscribeOwnPresenceL was called + COMMONASSERT( messenger, EXIMPPlgTestUnsubscribeOwnPresenceCalled, "UnsubscribeOwnPresenceL was not called", EFalse, + "UnsubscribeOwnPresenceL was called." ); + +// UNBIND + + CleanupStack::PopAndDestroy( pif ); + CleanupStack::PopAndDestroy( listener2 ); + + messenger->SetLeave( KErrNone ); + + UnbindL(); + } + +// =========================================================================== +// Single client, filled filter, publish. +// =========================================================================== +// + +void T_PresencePublishing::T_SubscribeOwnPresence_Publish_Single_L() + { + EUNIT_PRINT( _L("Single interest registration with publish") ); + + /* + * TODO: + * + * case 1 + * + * - subscribetä oma presence + * - luo filtteri + * - luo info + * - publishaa oma presence + info + * - tsekkaa että alakerta on saanut infon + * - subscribetä uudelleen (=refresh case) + * - tsekkaa että kaikki ok + * + * case 2 + * + * - sama filtteri kuin edellä + * - feikkaa verkkoserveriltä tuleva viesti, jossa sama info kuin edellä + * - tsekkaa, että frameworkin läpi tuleva info sisältää vain ne kamat + * jotka on sallittu ja että muut on blokattu. ts. "test_service":n + * "availability" pitäisi tulla läpi. person-presenceen tungettu kama jää + * pois + * + */ + + BindL(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresencePublishing& presPub = presFeat->PresencePublishing(); + + // Create the filter + MPresenceInfoFilter* pif = presFeat->PresenceObjectFactory().NewPresenceInfoFilterLC(); + pif->AcceptServiceFilterL( KServiceType, NPresenceInfo::NFieldType::KAvailability ); // "test_service", "availability" + // note, the person info will be filtered out now since we don't accept it. + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // SUBSCRIBE + + // subscribe own presence + TXIMPRequestId reqId = presPub.SubscribeOwnPresenceL( *pif ); + + // Setup status event listener for RequestComplete + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqId ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + // Wait for events on the request + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "SubscribeOwnPresence failed" ); + + // verify that SubscribeOwnPresenceL was called + COMMONASSERT( messenger, EXIMPPlgTestSubscribeOwnPresenceCalled, "SubscribeOwnPresenceL was not called", ETrue, NULL ); + + // publish own presence in here + MPresenceInfo* info = CreateInfoLC(); + + reqId = presPub.PublishOwnPresenceL( *info ); + + // Setup status event listener + evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqId ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + CXIMPDataSubscriptionStateImp* stateImp = CXIMPDataSubscriptionStateImp::NewLC(); + stateImp->SetDataStateL( MXIMPDataSubscriptionState::EDataAvailable ); + stateImp->SetSubscriptionStateL( MXIMPDataSubscriptionState::ESubscriptionActive ); + COwnPresenceEventImp* event = COwnPresenceEventImp::NewLC( stateImp ); + CleanupStack::Pop( 2, stateImp ); + CleanupStack::PushL( event ); + listener2->ExpectL( event ); + CleanupStack::Pop( event ); + + // Wait for events on the request + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Publishing presence failed" ); + COMMONASSERT( messenger, EXIMPPlgTestPublishPresenceCalled, "PublishPresenceL was not called", ETrue, NULL ); + + // REFRESH + + // subscribe own presence (refresh) + reqId = presPub.SubscribeOwnPresenceL( *pif ); + + // Setup status event listener for RequestComplete + messenger->SetValueFor( EXIMPPlgTestSubscribeOwnPresenceCalled, 0 ); + evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqId ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + // also the event + + stateImp = CXIMPDataSubscriptionStateImp::NewLC(); + stateImp->SetDataStateL( MXIMPDataSubscriptionState::EDataAvailable ); + stateImp->SetSubscriptionStateL( MXIMPDataSubscriptionState::ESubscriptionActive ); + event = COwnPresenceEventImp::NewLC( stateImp ); + CleanupStack::Pop( 2, stateImp ); + CleanupStack::PushL( event ); + listener2->ExpectL( event ); + CleanupStack::Pop( event ); + + // Wait for events on the request + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Refreshing own presence subscription failed" ); + + // verify that SubscribeOwnPresenceL was called + COMMONASSERT( messenger, EXIMPPlgTestSubscribeOwnPresenceCalled, "SubscribeOwnPresenceL was not called", EFalse, "SubscribeOwnPresenceL was called" ); + + CleanupStack::PopAndDestroy( 3, listener2 ); // info, pif, listener2 + UnbindL(); + } + + +// =========================================================================== +// SETUP HELPERS FOR THE LISTENER +// =========================================================================== +// +void T_PresencePublishing::SetupListenerReqCompleteL( CXIMPTestContextWrapper* aWrapper, TXIMPTestStatusEventTemplate aEventType ) + { + RArray< TInt32 > array; + CleanupClosePushL( array ); + array.Append( MXIMPContextStateEvent::KInterfaceId ); + array.Append( MOwnPresenceEvent::KInterfaceId ); + aWrapper->SetupListenerReqCompleteL( aEventType, &array ); + CleanupStack::PopAndDestroy(); // array + } + +void T_PresencePublishing::SetupListenerReqCompleteAllowEventsL( CXIMPTestContextWrapper* aWrapper, TXIMPTestStatusEventTemplate aEventType ) + { + RArray< TInt32 > array; + CleanupClosePushL( array ); + array.AppendL( MXIMPRequestCompleteEvent::KInterfaceId ); + array.AppendL( MXIMPContextStateEvent::KInterfaceId ); + array.AppendL( MOwnPresenceEvent::KInterfaceId ); + aWrapper->SetupListenerReqCompleteL( aEventType, &array ); + CleanupStack::PopAndDestroy(); // array + } + +MPresenceInfo* T_PresencePublishing::CreateInfoLC() + { + // fill up the info structure with: + // service info imp: + // - info name: "test_service" + // - field name: availability + // - field value: enum type, value 1 + // person info imp: + // - field name: "status-message" + // - field value: "This is my status message." + // + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + + // Get the interface + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceInfo* info = presFeat->PresenceObjectFactory().NewPresenceInfoLC(); + + // fill service info + MServicePresenceInfo* srvInfo = presFeat->PresenceObjectFactory().NewServicePresenceInfoLC(); + srvInfo->SetServiceTypeL( KServiceType ); // test + + MPresenceInfoField* infoField = presFeat->PresenceObjectFactory().NewInfoFieldLC(); + + MPresenceInfoFieldValueEnum* enumField = presFeat->PresenceObjectFactory().NewEnumInfoFieldLC(); + enumField->SetValueL( KTestAvailability ); // 1 + infoField->SetFieldTypeL( NPresenceInfo::NFieldType::KAvailability ); // "availability" + infoField->SetFieldValue( enumField ); + CleanupStack::Pop(); // enumField + + srvInfo->Fields().AddOrReplaceFieldL( infoField ); + CleanupStack::Pop(); // infoField + + info->AddServicePresenceL( srvInfo ); + CleanupStack::Pop(); // srvInfo + + // fill person info + MPersonPresenceInfo* persInfo = presFeat->PresenceObjectFactory().NewPersonPresenceInfoLC(); + MPresenceInfoField* infoField2 = presFeat->PresenceObjectFactory().NewInfoFieldLC(); + + MPresenceInfoFieldValueText* textField = presFeat->PresenceObjectFactory().NewTextInfoFieldLC(); + textField->SetTextValueL( KStatusMsg ); + + infoField2->SetFieldTypeL( NPresenceInfo::NFieldType::KStatusMessage ); + infoField2->SetFieldValue( textField ); + CleanupStack::Pop(); // textField + + persInfo->Fields().AddOrReplaceFieldL( infoField2 ); + CleanupStack::Pop(); // infoField2 + + info->SetPersonPresenceL( persInfo ); + CleanupStack::Pop(); // persInfo + // that's it + + return info; + } + +// =========================================================================== +// TEST CASE TABLE +// =========================================================================== +// +EUNIT_BEGIN_TEST_TABLE( + T_PresencePublishing, + "XIMP presence management tests", + "MODULE" ) + + +PRFW_DECORATED_TEST( + "Publish single presence", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_Publish_Single_L, + Teardown ) + +/* +PRFW_NOT_DECORATED_TEST( + "Publish, error leave", + "", + "", + "ERRORHANDLING", + Setup_Bind_L, + T_Publish_ErrFromPlg_Leave_L, + Teardown_Unbind ) + +PRFW_NOT_DECORATED_TEST( + "Publish, error complete", + "", + "", + "ERRORHANDLING", + Setup_Bind_L, + T_Publish_ErrFromPlg_CompleteWithError_L, + Teardown_Unbind ) +*/ + +PRFW_DECORATED_TEST( + "Empty own presence subscribtion", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_SubscribeOwnPresence_Single_Empty_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Empty own presence subscribtion for multiple clients", + "", + "", + "FUNCTIONALITY", + SetupMultiple_L, + T_SubscribeOwnPresence_Multiple_Empty_L, + Teardown ) + + +PRFW_DECORATED_TEST( + "Single own presence subscribtion", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_SubscribeOwnPresence_Single_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Single own presence subscribtion with publish", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_SubscribeOwnPresence_Publish_Single_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Error - Fail subscription", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_ErrFromPlg_LeaveOnSubscribeOwnPresence_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Error - Network UnplugError", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_NetworkUnplugError_L, + Teardown ) + +/* +PRFW_DECORATED_TEST( + "Error - Network UnplugError", + "", + "", + "FUNCTIONALITY", + SetupMultiple_L, + T_NetworkUnplugErrorMultiple_L, + Teardown ) +*/ + +EUNIT_END_TEST_TABLE + + +// =========================================================================== +// TEST SUITE CONSTRUCTION +// =========================================================================== +// +EXPORT_C MEUnitTest* CreateTestSuiteL() + { + return T_PresencePublishing::NewL(); + } + + +// end of file + + + + + + diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/src/t_presencepublishing/t_presencepublishing.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/src/t_presencepublishing/t_presencepublishing.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,131 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework Test Code +* +*/ + +#ifndef T_PRESENCEPUBLISHING_H +#define T_PRESENCEPUBLISHING_H + +#include +#include +#include "prfwteststatuseventlistener.h" +#include "prfwtestmessaging.h" + +class CXIMPTestContextWrapper; +class CXIMPTestContextWrapperMgr; +class CXIMPTestMessenger; + +/** + * XIMP Framework Eunit tests. + * + * Tests for XIMP session management services. + * + * @since S60 v4.0 + */ +class T_PresencePublishing : public CEUnitTestSuiteClass + { + +public: + static T_PresencePublishing* NewL(); + virtual ~T_PresencePublishing(); + + +private: + T_PresencePublishing(); + void ConstructL(); + + + +private: // Test case functions + + void Setup_L(); + void SetupMultiple_L(); + void BindL(); + void Bind2L(); + void BindAllL(); + void Teardown(); + void UnbindL(); + void UnbindAllL(); + + + //------------------------------------------ + //Presence Publish + // + void T_Publish_Single_L(); + + // Maybe unneeded cases. All events should act likewise and these + // kind of situations are tested in t_sessionmng already. + void T_Publish_ErrFromPlg_Leave_L(); + void T_Publish_ErrFromPlg_CompleteWithError_L(); + + + //------------------------------------------ + //Presence interest registration + // + void T_SubscribeOwnPresence_Single_Empty_L(); + void T_SubscribeOwnPresence_Multiple_Empty_L(); + void T_SubscribeOwnPresence_Single_L(); + void T_SubscribeOwnPresence_Publish_Single_L(); + void T_SubscribeOwnPresence_Two_Clients_L(); + void T_ErrFromPlg_LeaveOnSubscribeOwnPresence_L(); + void T_NetworkUnplugError_L(); + void T_NetworkUnplugErrorMultiple_L(); + + // Plugin leaves with error, returns error. Same as above. + //void T_InterestRegistration_ErrorFromPlg_Leave_L(); + //void T_InterestRegistration_ErrorFromPlg_Error_L(); + + //------------------------------------------ + // Input data verification tests + // TODO when the mechanism for + // + // Verify that plugin receives correct input data + // - single publish + // - single registration + // - aggregated registrations + // Verify that the test case received correct data (verify plugin output data) + // - own presence event + // - UpdatePresenceL / presentity event + // - filter registration verifications on presentity events + +private: // Test helpers + + void SetupListenerReqCompleteL( CXIMPTestContextWrapper* aWrapper, TXIMPTestStatusEventTemplate aEventType ); + void SetupListenerReqCompleteAllowEventsL( CXIMPTestContextWrapper* aWrapper, TXIMPTestStatusEventTemplate aEventTypes ); + // TODO move these to some TOOL part - could be common + // among all components + + MPresenceInfo* CreateInfoLC(); + +private: // Test data + + /** + * Eunit test case table declaration. + */ + EUNIT_DECLARE_TEST_TABLE; + + // owned + CXIMPTestContextWrapperMgr* iWrapperMgr; + }; + +#endif // T_PRESENCEPUBLISHING_H + + + +// end of file + + + + diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/src/t_presencepublishing/t_presencepublishing.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/src/t_presencepublishing/t_presencepublishing.mmp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,53 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework Test Code +* +*/ + +#include "../../tsrcutils/eunitcommon/eunittstdllbase.hrh" +#include "../../tsrcutils/processmaster/pm.h" + +TARGET t_presencepublishing.dll + +SOURCEPATH . +SOURCE t_presencepublishing.cpp + + +USERINCLUDE ../../../core/srcdatamodel +USERINCLUDE ../../../presence/srcpresencedatamodel +USERINCLUDE ../../../presence/srcpresencedatamodel/presentitygroups +USERINCLUDE ../../../presence/srcpresencedatamodel/presencewatching +USERINCLUDE ../../../presence/srcpresencedatamodel/presenceauthorization +USERINCLUDE ../../../presence/srcpresencedatamodel/presencepublishing +USERINCLUDE ../../../presence/srcpresencedatamodel/presenceinfo +USERINCLUDE ../../../core/srcutils + +// TODO remove unnecessary +SYSTEMINCLUDE ../../../inc/core/base +SYSTEMINCLUDE ../../../inc/core/datamodel +SYSTEMINCLUDE ../../../inc/core/protocolplugin +SYSTEMINCLUDE ../../../inc/core/protocolpluginhost +SYSTEMINCLUDE ../../../inc/presence/presencedatamodel +SYSTEMINCLUDE ../../../inc/presence/presencemanagement +SYSTEMINCLUDE ../../../inc/presence/presenceprotocolplugin +SYSTEMINCLUDE ../../../inc/presence/presenceprotocolpluginhost + +LIBRARY ecom.lib +LIBRARY bafl.lib +LIBRARY ximpdatamodel.lib +LIBRARY presencedatamodel.lib + +// end of file + + diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/src/t_presencewatcherlistmngt/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/src/t_presencewatcherlistmngt/bld.inf Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,23 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Build information file for t_presencewatcherlistmngt.dll +* +*/ + + +PRJ_PLATFORMS +DEFAULT + +PRJ_TESTMMPFILES +t_presencewatcherlistmngt.mmp diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/src/t_presencewatcherlistmngt/t_presencewatcherlistmngt.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/src/t_presencewatcherlistmngt/t_presencewatcherlistmngt.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,1353 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework Test Code +* +*/ + + +#include "eunittools.h" + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "prfwtestpresencedatautils.h" + + + +#include "t_presencewatcherlistmngt.h" + +// watcher list related includes +#include "presencewatcherinfoimp.h" +#include "presencewatcherlisteventimp.h" + +// other data model includes +#include "ximpidentityimp.h" +#include "ximpdatasubscriptionstateimp.h" +#include "presentitygroupmemberinfoimp.h" +#include "presenceinfofilterimp.h" + +// utils includes +#include "ximpobjecthelpers.h" + +#include "ximprequestcompleteeventimp.h" + +// testing tool includes +#include "prfwtestmessaging.h" +#include "prfwtestmessenger.h" +#include "prfwtestcontextwrappermgr.h" +#include "prfwtestcontextwrapper.h" +#include "prfwtestwaithelper.h" + +#include "prfwtestfilesrvmsg.h" +#include "prfwtestfiletool.h" +#include "prfwtestlistener.h" + +#include "prfwtestrobustnesstools.h" + + + + + +/*#include "presenceinfoimp.h" +#include "presenceinfofilterimp.h" +#include "prfwtestpresencedatautils.h" +#include "ximpidentityimp.h" +#include "presentitygroupmemberinfoimp.h" +#include "ximpobjecthelpers.h" +#include "prfwtestfilesrvmsg.h" +#include "prfwtestwaithelper.h"*/ + +_LIT8( KPrefix1, "PreA_" ); +_LIT8( KPrefix2, "PreB_" ); +_LIT8( KPrefix3, "PreC_" ); +_LIT8( KPrefix4, "PreD_" ); + +// ============================ MEMBER FUNCTIONS =============================== + +// CONSTRUCTION +T_PresenceWatcherListManagement* T_PresenceWatcherListManagement::NewL() + { + T_PresenceWatcherListManagement* self = new( ELeave ) T_PresenceWatcherListManagement; + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + + return self; + } + + +T_PresenceWatcherListManagement::~T_PresenceWatcherListManagement() + { + } + + +void T_PresenceWatcherListManagement::ConstructL() + { + CEUnitTestSuiteClass::ConstructL(); + } + + +T_PresenceWatcherListManagement::T_PresenceWatcherListManagement() + { + } + + + +// =========================================================================== +// TEST CASE SETUP & TEARDOWN METHODS +// =========================================================================== +// + +void T_PresenceWatcherListManagement::Setup_L() + { + + __UHEAP_MARK; + PrfwTestRobustness::DoPreCleaning(); + + iWrapperMgr = CXIMPTestContextWrapperMgr::NewL(); + iWrapperMgr->CreateWrapperL(); + } + +void T_PresenceWatcherListManagement::SetupMultiple_L() + { + __UHEAP_MARK; + PrfwTestRobustness::DoPreCleaning(); + + iWrapperMgr = CXIMPTestContextWrapperMgr::NewL(); + iWrapperMgr->CreateWrapperL(); + iWrapperMgr->CreateWrapperL(); + iWrapperMgr->CreateWrapperL(); + } + + +void T_PresenceWatcherListManagement::BindL() + { + CXIMPTestContextWrapper* wrapper0 = iWrapperMgr->GetWrapperL( 0 ); + + wrapper0->BindL( 0 ); + } + +void T_PresenceWatcherListManagement::BindAllL() + { + for( TInt a = 0; a < iWrapperMgr->WrapperCount(); ++a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + wrapper->BindL( 0 ); + } + } + + +void T_PresenceWatcherListManagement::Teardown() + { + delete iWrapperMgr; + iWrapperMgr = NULL; + + REComSession::FinalClose(); + + PrfwTestRobustness::DoPreCleaning(); + + __UHEAP_MARKEND; + } + +void T_PresenceWatcherListManagement::UnbindL() + { + // Do unbind + CXIMPTestContextWrapper* wrapper0 = iWrapperMgr->GetWrapperL( 0 ); + wrapper0->UnbindL(); + } + +void T_PresenceWatcherListManagement::UnbindAllL() + { + for( TInt a = 0; a < iWrapperMgr->WrapperCount(); ++a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + wrapper->UnbindL(); + } + } + + +// =========================================================================== +// TEST CASES for presentity presence subscription +// =========================================================================== +// Check that this don't leak memory +void T_PresenceWatcherListManagement::T_BindUnbind_L() + { + BindL(); + UnbindL(); + } +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// Subscribe, unsubscribe - Single client +void T_PresenceWatcherListManagement::T_SubscribePresenceWatcherList_Single_L() + { + + EUNIT_PRINT( _L("Single client presence watcher list subscription") ); + + BindL(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresencePublishing& presPub = presFeat->PresencePublishing(); + + //------------------------------------------------- + // subscribe + + // Setup status event listener for RequestComplete + // --------------------------------------------- + listener2->Reset(); + + // normal request complete + TXIMPRequestId reqIdDummy; // not checked + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + + // Subscribe + TXIMPRequestId reqId = presPub.SubscribePresenceWatcherListL(); + + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Subscribe failed" ); + + // verify that SubscribePresenceWatcherListL was called + COMMONASSERT( messenger, EXIMPPlgTestSubscribePresenceWatcherListCalled, "SubscribePresenceWatcherListL was not called", ETrue, NULL ); + + //------------------------------------------------- + // refresh subscribe + + // Setup status event listener for RequestComplete + listener2->Reset(); + + evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + RPrWatLstInfoImpArray* currentList(NULL); + CPresenceWatcherListEventImp* event = CreateWatcherListEventLCX( + KNullDesC, KNullDesC, + MXIMPDataSubscriptionState::ESubscriptionActive, + MXIMPDataSubscriptionState::EDataUnavailable, + ETestPWlCurrent, currentList); + listener2->ExpectL( event ); + CleanupStack::Pop(); //event 3 to go. + // --------------------------------------------- + + // Subscribe second time + reqId = presPub.SubscribePresenceWatcherListL(); + + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Refresh failed" ); + CleanupStack::PopAndDestroy( 3 ); // rest of the items. + + // verify that SubscribePresenceWatcherListL was called + COMMONASSERT( messenger, EXIMPPlgTestSubscribePresenceWatcherListCalled, "SubscribePresenceWatcherListL was not called", ETrue, NULL ); + + + //------------------------------------------------- + // unsubscribe + + // Setup status event listener for RequestComplete + listener2->Reset(); + + evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + // register interest + reqId = presPub.UnsubscribePresenceWatcherListL(); + + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Unsubscribe failed" ); + + // verify that UnsubscribePresenceWatcherListL was called + COMMONASSERT( messenger, EXIMPPlgTestUnsubscribePresenceWatcherListCalled, "UnsubscribePresenceWatcherListL was not called", ETrue, NULL ); + + //------------------------------------------------- + // unsubscribe nonsubscribed + + // Setup status event listener for RequestComplete + listener2->Reset(); + + evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + // register interest + reqId = presPub.UnsubscribePresenceWatcherListL(); + + // Wait for events on the request + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Unsubscribe failed" ); + + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestUnsubscribePresenceWatcherListCalled, "UnsubscribePresenceWatcherListL was not called", ETrue, NULL ); + + + + listener2->SetEventSourceL( NULL ); + + UnbindL(); + + CleanupStack::PopAndDestroy( listener2 ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// Subscribe, Unsubscribe - Multiple clients +void T_PresenceWatcherListManagement::T_SubscribePresenceWatcherList_Multiple_L() + { + EUNIT_PRINT( _L("Multiple client presence watcher list subscription") ); + + BindAllL(); + + TInt countOfWrappers = iWrapperMgr->WrapperCount(); + for( TInt a = 0; a < countOfWrappers; ++a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresencePublishing& presPub = presFeat->PresencePublishing(); + + // Setup status event listener for RequestComplete + listener2->Reset(); + + TXIMPRequestId reqIdDummy; // not checked + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + // Subscribe + TXIMPRequestId reqId = presPub.SubscribePresenceWatcherListL(); + + // Wait for events on the request + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Subscribe failed" ); + + // verify that SubscribePresenceWatcherListL was called + COMMONASSERT( messenger, EXIMPPlgTestSubscribePresenceWatcherListCalled, "SubscribePresenceWatcherListL was not called", ETrue, NULL ); + + CleanupStack::PopAndDestroy( listener2 ); + } + for( TInt a = 0; a < countOfWrappers; ++a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresencePublishing& presPub = presFeat->PresencePublishing(); + + // Setup status event listener for RequestComplete + listener2->Reset(); + + TXIMPRequestId reqIdDummy; // not checked + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + // Unsubscribe + TXIMPRequestId reqId = presPub.UnsubscribePresenceWatcherListL(); + + // Wait for events on the request + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Unsubscribe failed" ); + + // verify that unsubscribe was called + COMMONASSERT( messenger, EXIMPPlgTestUnsubscribePresenceWatcherListCalled, + "UnsubscribePresenceWatcherListL was not called", + ( a < 2 ) ? EFalse : ETrue, + "UnsubscribePresenceWatcherListL was called" ); + + CleanupStack::PopAndDestroy( listener2 ); + } + + UnbindAllL(); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +void T_PresenceWatcherListManagement::SubscribeL() + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresencePublishing& presPub = presFeat->PresencePublishing(); + + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + + // Setup status event listener for RequestComplete + listener2->Reset(); + + TXIMPRequestId reqIdDummy; // not checked + CXIMPRequestCompleteEventImp* evReqComplete = + CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + // subscribe + TXIMPRequestId reqId = presPub.SubscribePresenceWatcherListL(); + + // Wait for events on the request + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Subscribe failed" ); + + COMMONASSERT( messenger, EXIMPPlgTestSubscribePresenceWatcherListCalled, "SubscribeWatcherListL was not called", ETrue, NULL ); + + CleanupStack::PopAndDestroy( listener2 ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +void T_PresenceWatcherListManagement::UnsubscribeL() + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresencePublishing& presPub = presFeat->PresencePublishing(); + + // Setup status event listener for RequestComplete + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + + // Setup status event listener for RequestComplete + listener2->Reset(); + + TXIMPRequestId reqIdDummy; // not checked + CXIMPRequestCompleteEventImp* evReqComplete = + CXIMPRequestCompleteEventImp::NewLC( reqIdDummy ); + listener2->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + + // unsubscribe + TXIMPRequestId reqId = presPub.UnsubscribePresenceWatcherListL(); + + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "Unsbscribe failed" ); + + // verify that UnsubscribeWatcherListL was called + COMMONASSERT( messenger, EXIMPPlgTestUnsubscribePresenceWatcherListCalled, "UnsubscribeWatcherListL was not called", ETrue, NULL ); + + CleanupStack::PopAndDestroy( listener2 ); + + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +void T_PresenceWatcherListManagement::T_HandlePresenceWatcherList_L() + { + EUNIT_PRINT( _L("Handle presence watcher list.") ); + + BindL(); + SubscribeL(); + + // ------------------------------------------------------ + // some startup stuff + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + + CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context ); + CleanupStack::PushL( listener2 ); + // ------------------------------------------------------ + + // Tell the protocol it should act normally + wrapper->GetMessenger()->SetNoError(); + + // ------------------------------------------------------ + // 1. Create faked server message about watcher list (empty) + SendSrvMsgL( CXIMPTestFileSrvMsg::ETestSrvMsgPresenceWatcherList ); + + // ------------------------------------------------------ + // expect empty MPresencewatcherList event. + + RPrWatLstInfoImpArray* currentList(NULL); + CPresenceWatcherListEventImp* event = CreateWatcherListEventLCX( + KNullDesC, KNullDesC, + MXIMPDataSubscriptionState::ESubscriptionActive, + MXIMPDataSubscriptionState::EDataAvailable, + ETestPWlCurrent, currentList); + + listener2->ExpectL( event ); + CleanupStack::Pop( event ); // 3 more items in cleanupstack + + //Waqas: Fixed task Ticket#22 + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "HandlePresenceWatcherListL failed" ); + CleanupStack::PopAndDestroy( 3 ); // lists + // ------------------------------------------------------ + + + // ------------------------------------------------------ + // 2. Create faked server message about watcher list (new) + listener2->Reset(); + + _LIT16( KWatcherUri1, "http://carpe.diem.com" ); + _LIT16( KWatcherDispName1, "DispnameA, LoremI" ); + + SendSrvMsgL( KWatcherUri1, + KWatcherDispName1, + CXIMPTestFileSrvMsg::ETestSrvMsgPresenceWatcherList ); + + // ------------------------------------------------------ + // MPresencewatcherList event. + + currentList = NULL; // previous one was destroyed + //Now create the actual event + event = CreateWatcherListEventLCX( // previous event was destroyed + KWatcherUri1, KWatcherDispName1, + MXIMPDataSubscriptionState::ESubscriptionActive, + MXIMPDataSubscriptionState::EDataAvailable, + ETestPWlNew, currentList); + + + listener2->ExpectL( event ); + CleanupStack::Pop( event ); // 3 more items in cleanupstack + + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "HandlePresenceWatcherListL failed" ); + CleanupStack::PopAndDestroy( 3 ); // lists + + + // ------------------------------------------------------ + // 3. Create faked server message about watcher list (disappeared) + listener2->Reset(); + + SendSrvMsgL( CXIMPTestFileSrvMsg::ETestSrvMsgPresenceWatcherList ); + // ------------------------------------------------------ + // MPresencewatcherList event. + + CXIMPIdentityImp* idForEvent = CXIMPIdentityImp::NewLC( KWatcherUri1 ); + // we need to create current list to give to the event + currentList = new ( ELeave ) RPrWatLstInfoImpArray; // previous is destroyed + CleanupDeletePushL( currentList ); + // create the group info + CPresenceWatcherInfoImp* watcherInfoForEvent = + CPresenceWatcherInfoImp::NewLC( (MPresenceWatcherInfo::TWatcherType)0, *idForEvent, KWatcherDispName1); + currentList->AppendL( watcherInfoForEvent ); + CleanupStack::Pop( watcherInfoForEvent ); + CleanupStack::Pop( currentList ); + CleanupStack::PopAndDestroy( idForEvent ); + + + //Now create the actual event + event = CreateWatcherListEventLCX( + KWatcherUri1, KWatcherDispName1, + MXIMPDataSubscriptionState::ESubscriptionActive, + MXIMPDataSubscriptionState::EDataAvailable, + ETestPWlDisappeared, currentList); + + listener2->ExpectL( event ); + CleanupStack::Pop( event ); // 3 more items in cleanupstack + + //Waqas: Fixed task Ticket#22 + EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "HandlePresenceWatcherListL failed" ); + + CleanupStack::PopAndDestroy( 3 ); // lists + + + // clean it up + UnsubscribeL(); + + /* TODO later on better time. + // ------------------------------------------------------ + // 4. Create faked server message about watcher list (no subscribers to list) + // Make sure no event is + listener2->Reset(); + + event = CreateWatcherListEventLCX( + KNullDesC, KNullDesC, + ETestPWlEmpty ); + + //EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "HandlePresenceWatcherListL failed" ); + + */ + CleanupStack::PopAndDestroy( listener2 ); + + UnbindL(); + } + +//////////////////////////////////////////////////// +//// INTIA CASE +//////////////////////////////////////////////////// +void T_PresenceWatcherListManagement::T_IndiaCase_L() + { + + EUNIT_PRINT( _L("Presence notification subscribed list, Intia") ); + + + BindL(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* presenceCtx = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + CXIMPTestListener* ctxObserver = CXIMPTestListener::NewL( presenceCtx ); + CleanupStack::PushL( ctxObserver ); // << ctxObserver + + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresencePublishing& presPub = presFeat->PresencePublishing(); + MPresentityGroups& presGroups = presFeat->PresentityGroups(); + MPresenceWatching& presWatch = presFeat->PresenceWatching(); + + MXIMPObjectFactory& objFactory = presenceCtx->ObjectFactory(); + + _LIT( KGroupId, "rakesh.harsh/Friends" ); + _LIT( KGroupDisplayName, "my_friend" ); + _LIT( KMemberId1, "user1" ); + _LIT( KMember1DisplayName, "user1DisplayName" ); + _LIT( KMemberId2, "user2" ); + _LIT( KMember2DisplayName, "user2DisplayName" ); + + + // Create test variables + MXIMPIdentity* testGroupId = objFactory.NewIdentityLC(); // << testGroupId + testGroupId->SetIdentityL( KGroupId ); + + MXIMPIdentity* member1 = objFactory.NewIdentityLC(); // << member1 + member1->SetIdentityL( KMemberId1 ); + + MXIMPIdentity* member2 = objFactory.NewIdentityLC(); // << member2 + member2->SetIdentityL( KMemberId2 ); + + ////////////////////////////////////////////////////////////////////////// + // SUBSCRIBE PRESENTITY GROUP LIST + ////////////////////////////////////////////////////////////////////////// + + // Setup status event listener for RequestComplete + TXIMPRequestId reqId; + ctxObserver->Reset(); + CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqId );// << evReqComplete + ctxObserver->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); // >> evReqComplete + + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + + // subscribe PresentityGroupList + reqId = presGroups.SubscribePresentityGroupListL(); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Subscribing presentity group list, complete with error: ") ); + + // verify that SubscribePresentityGroupListL was called + messenger->AssertSubscribePresentityGroupListCalled( ETrue ); + + + // get list request +/* TXIMPRequestId req = presGroups.SubscribePresentityGroupListL(); + ctxObserver->WaitOpToCompleteL( req ); + + CUserAfter::AfterL( 1000000 ); +*/ + + ////////////////////////////////////////////////////////////////////////// + // SUBSCRIBE PRESENTITY GROUP CONTENT + ////////////////////////////////////////////////////////////////////////// + + // Setup status event listener for RequestComplete + ctxObserver->Reset(); + evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqId ); + ctxObserver->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + SetupListenerReqCompleteL( wrapper, EXIMPTestStatusEvents_RequestOk ); + + // subscribe group content + reqId = presGroups.SubscribePresentityGroupContentL( *testGroupId ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Subscribe presentity group content, complete with error: ") ); + + COMMONASSERT( messenger, EXIMPPlgTestSubscribePresentityGroupContentCalled, "SubscribeGroupContentL was not called", ETrue, NULL ); + +/* TInt count = ctxObserver->gidcount; + // List manage request + for(TInt i = 0; iSetIdentityL( ctxObserver->gid[i] ); + // tgid->SetIdentityL( _L("rakesh.harsh/basu2@nokia.com") ); + + TXIMPRequestId req = presGroups.SubscribePresentityGroupContentL( *tgid ); + + ctxObserver->WaitOpToCompleteL( req ); + + CleanupStack::PopAndDestroy( 1 ); // tgid + } */ + + ////////////////////////////////////////////////////////////////////////// + // CREATE PRESENTITY GROUP + ///////////////////////////////////////////////////////////////////////// + + // Setup status event listener for RequestComplete + // This will also produce HandlePresentityGroupListEvent, since the + // the group is subscribed + ctxObserver->Reset(); + evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqId ); + ctxObserver->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete );//TODO??? + + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + + // Create group + reqId = presGroups.CreatePresentityGroupL( *testGroupId, KGroupDisplayName ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("CreatePresentityGroupL failed, complete with error: ") ); + + // verify that SubscribePresentityGroupListL was called + messenger->AssertCreatePresentityGroupCalled( ETrue ); + + + + // first make a test group in our roster + /* MXIMPIdentity* newGroupId = objFactory.NewIdentityLC();//1 + newGroupId->SetIdentityL( _L("rakesh.harsh/Friends") ); + + req = presGroups.CreatePresentityGroupL( *newGroupId,_L("my_friend") ); + // wait completion + ctxObserver->WaitOpToCompleteL( req ); + + CUserAfter::AfterL( 1000000 );*/ + + ////////////////////////////////////////////////////////////////////////// + // ADD PRESENTITY GROUP MEMBER + ////////////////////////////////////////////////////////////////////////// + + // Setup event listener for RequestComplete + ctxObserver->Reset(); + evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqId ); // << evReqComplete + + // group id + CXIMPIdentityImp* grid = CXIMPIdentityImp::NewLC( testGroupId->Identity() ); // << grid + evReqComplete->AppendParamL( grid ); + CleanupStack::Pop(); // >> grid + + // id for member info + CXIMPIdentityImp* miId = CXIMPIdentityImp::NewLC( KMemberId1 ); // << miId + // member info + CPresentityGroupMemberInfoImp* memInfoImp = + CPresentityGroupMemberInfoImp::NewLC( *miId, KMember1DisplayName ); // << memInfoImp + evReqComplete->AppendParamL( memInfoImp ); + CleanupStack::Pop(); // memInfoImp owned by AppendParamL // >> memInfoImp + CleanupStack::PopAndDestroy( miId ); // copy was made // >>> miId + + ctxObserver->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); // >> evReqComplete + + // do the call + reqId = presGroups.AddPresentityGroupMemberL( + *testGroupId, *member1, KMember1DisplayName ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + messenger->AssertAddPresentityGroupMemberCalled( ETrue ); + + + //add a member +/* MXIMPIdentity* testContactId = objFactory.NewIdentityLC(); + testContactId->SetIdentityL( _L("mukesh") ); + req = presGroups.AddPresentityGroupMemberL( *newGroupId, + *testContactId, + _L("h2") ); + // wait completion + ctxObserver->WaitOpToCompleteL( req ); + + + CUserAfter::AfterL( 1000000 );*/ + + + ////////////////////////////////////////////////////////////////////////// + // ADD PRESENTITY GROUP MEMBER + ////////////////////////////////////////////////////////////////////////// + + // Setup event listener for RequestComplete + ctxObserver->Reset(); + evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqId ); // << evReqComplete + + // group id + CXIMPIdentityImp* grid2 = CXIMPIdentityImp::NewLC( testGroupId->Identity() ); + evReqComplete->AppendParamL( grid2 ); + CleanupStack::Pop(); // grid2 + + // id for member info + CXIMPIdentityImp* miId2 = CXIMPIdentityImp::NewLC( KMemberId2 ); + // member info + CPresentityGroupMemberInfoImp* memInfoImp2 = + CPresentityGroupMemberInfoImp::NewLC( *miId2, KMember2DisplayName ); + evReqComplete->AppendParamL( memInfoImp2 ); + CleanupStack::Pop(); // memInfoImp owned by AppendParamL + CleanupStack::PopAndDestroy( miId2 ); // copy was made + + ctxObserver->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + // reset the variable + messenger->SetValueFor( EXIMPPlgTestAddPresentityGroupMemberCalled, 0 ); + // do the call + reqId = presGroups.AddPresentityGroupMemberL( + *testGroupId, *member2, KMember2DisplayName ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + messenger->AssertAddPresentityGroupMemberCalled( ETrue ); + + +/* testContactId->SetIdentityL( _L("bb0") ); + req = presGroups.AddPresentityGroupMemberL( *newGroupId, + *testContactId, + _L("b1") ); + // wait completion + ctxObserver->WaitOpToCompleteL( req ); + +*/ + ////////////////////////////////////////////////////////////////////////// + // SUBSCRIBE PRESENTITY GROUP MEMBERS PRESENCE + ////////////////////////////////////////////////////////////////////////// + + // Setup status event listener for RequestComplete + ctxObserver->Reset(); + evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqId ); + ctxObserver->ExpectL( evReqComplete ); + CleanupStack::Pop( evReqComplete ); + SetupListenerReqCompleteL( wrapper, EXIMPTestStatusEvents_RequestOk ); + + + // Set filter for the group + MPresenceInfoFilter* gpif = presFeat->PresenceObjectFactory().NewPresenceInfoFilterLC(); + gpif->AcceptPersonFilterL( NPresenceInfo::NFieldType::KStatusMessage ); + gpif->AcceptPersonFilterL( NPresenceInfo::NFieldType::KAvatar ); + + // register interest + reqId = presWatch.SubscribePresentityGroupMembersPresenceL( *testGroupId, *gpif ); + + CleanupStack::PopAndDestroy(); // >>> gpif + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Subscribe presentity group members, complete with error: ") ); + + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestSubscribePresentityGroupMembersPresesenceCalled, "SubscribePresentityGroupMembersPresenceL was not called", ETrue, NULL ); + + + +/* CUserAfter::AfterL( 1000000 ); + MPresenceWatching& presWatch = presenceCtx->PresenceWatching(); + MPresenceInfoFilter* infoFilt = objFactory.NewPresenceInfoFilterLC(); + req = presWatch.SubscribePresentityGroupMembersPresenceL( *newGroupId, *infoFilt ); + // wait completion + ctxObserver->WaitOpToCompleteL( req ); + + // req = presWatch.SubscribePresentityPresenceL( *testContactId, *infoFilt ); + // wait completion + // ctxObserver->WaitOpToCompleteL( req ); + //MXIMPClient* presClient1 = NULL; + // MXIMPContext* presenceCtx1 = NULL; + //CUSContextObserver* ctxObserver1 = NULL; + + /*TInt pushCount1 = DoSetupDefaultContext1LC( presClient1, + presenceCtx1, + ctxObserver1 ); + + ctxObserver->WaitOpToCompleteL( req );*/ + // CUserAfter::AfterL( 60000000 ); //60 seconds + + /*if ( !iWait.IsStarted() ) + { + iWait.Start(); // CSI: 10 # iWait is not an active object + } + */ + //code is for login with diff id + //Initialize XIMP client + /* #if 0 + MXIMPClient* presClient1 = MXIMPClient::NewClientL(); + CleanupDeletePushL( presClient ); + + //Create new sink to receive presence context events + CUSContextObserver* eventObserver1 = CUSContextObserver::NewLC(); + + //Create new presence context + MXIMPContext* presecenCtx1 = presClient->NewPresenceContextLC(); + presecenCtx1->RegisterObserverL( *eventObserver1 ); + + //Bind context to desired presence service + TUid protocolUid = TUid::Uid( KProtocolUid ); + + + //Bind context to desired presence service + req = presecenCtx1->BindToL( protocolUid, + KServerAddress, + KUserName2, + KPassword2, + KIAP ); + + //Wait with CActiveSchedulerWait the binding to complete + //If binding fails, it is handled with leave + eventObserver1->WaitOpToCompleteL( req ); + MXIMPIdentity* newGroupId1 = objFactory.NewIdentityLC();//1 + newGroupId1->SetIdentityL( _L("bb0/jaya") ); + + req = presGroups.CreatePresentityGroupL( *newGroupId1,_L("my_sweety") ); + // wait completion + ctxObserver->WaitOpToCompleteL( req ); + + CUserAfter::AfterL( 1000000 ); + presecenCtx1->UnbindL(); + eventObserver1->WaitOpToCompleteL( req ); + CleanupStack::PopAndDestroy( 4 ); //newGroupId1,presecenCtx1,eventObserver1,presClient1 + + #endif*/ + //code is for login with diff id end + + //add this user to bb0's contact list.i should recieve notification + + // delete group friend which is created above statement + //req = presGroups.DeletePresentityGroupL( *newGroupId ); + // wait completion + // ctxObserver->WaitOpToCompleteL( req ); + // CUserAfter::AfterL( 60000000 ); + //Unbind the context and wait completion + // req = presenceCtx->UnbindL(); + // ctxObserver->WaitOpToCompleteL( req ); + + //Destroy the context (it is automaticly unbind) + // CleanupStack::PopAndDestroy( 3 ); // infoFilt,testContactId,newGroupId + // CleanupStack::PopAndDestroy( pushCount ); + + + ////////////////////////////////////////////////////////////////////////// + // SEND DATA FOR GROUP MEMBER -> HANDLE PRESENTITY PRESENCE + ////////////////////////////////////////////////////////////////////////// + + + // create test message + CPresenceInfoImp* presenceInfo = CPresenceInfoImp::NewLC(); // << presenceInfo + HBufC8* packedInfo = TXIMPObjectPacker< CPresenceInfoImp >::PackL( *presenceInfo ); + CleanupStack::PopAndDestroy( presenceInfo );// >>> presenceInfo + CleanupStack::PushL( packedInfo ); // << packedInfo + + CXIMPIdentityImp* changed = CXIMPIdentityImp::NewLC( ); // << changed + changed->SetIdentityL( KMemberId1 ); + HBufC8* packedId = TXIMPObjectPacker< CXIMPIdentityImp >::PackL( *changed ); + CleanupStack::PopAndDestroy(); // >>> changed + CleanupStack::PushL( packedId );// << packedId + + RPointerArray< HBufC8 > bufferArray; + CleanupClosePushL( bufferArray ); // << bufferArray + bufferArray.AppendL( packedId ); + bufferArray.AppendL( packedInfo ); + + HBufC8* packedBufferArray = TXIMPHBuf8Packer::PackArrayL( bufferArray ); + CleanupStack::PopAndDestroy( 2 ); // >>> packedId, packedInfo + CleanupStack::PopAndDestroy(); // >>> bufferArray + CleanupStack::PushL( packedBufferArray ); // << packedBufferArray + + // Send it to plugin + CXIMPTestFileSrvMsg* srvMsg = CXIMPTestFileSrvMsg::NewL( CXIMPTestFileSrvMsg::ETestSrvMsgPresentityPresence, + *packedBufferArray ); + CleanupStack::PopAndDestroy( packedBufferArray ); // >>> packedBufferArray + + CleanupStack::PushL( srvMsg ); // << srvMsg + wrapper->FileTool().SrvMsgStoreL( srvMsg ); + CleanupStack::PopAndDestroy( srvMsg ); // >>> srvMsg + wrapper->FileTool().CleanAllL(); + + // Wait for server to handle srvmsg. + User::After( 4 * 1000000 ); + + COMMONASSERT( messenger, EXIMPPlgTestHandlePresentityPresenceCalled, "HandlePresentityPresenceL was not called", ETrue, NULL ); + + CleanupStack::PopAndDestroy( 3 ); // >>> testGroupId, member1, member2 + CleanupStack::PopAndDestroy( ctxObserver ); // >>> ctxObserver + + UnbindL(); + +} +// =========================================================================== +// SETUP HELPERS FOR THE LISTENER +// =========================================================================== +// + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// send a faked server-originated message with watcher info made +// from the given uri and displayname +// +void T_PresenceWatcherListManagement::SendSrvMsgL( + const TDesC& aUri, const TDesC& aDispName, + TInt aMsgType ) + { + // we'll use hard-coded wrapper 0 instance for now. + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + + // create a grant req info contained within the server-originated + // faked message + RXIMPObjOwningPtrArray watcherList; + CleanupClosePushL( watcherList ); + + CXIMPIdentityImp* watcherId = CXIMPIdentityImp::NewLC( aUri ); + CPresenceWatcherInfoImp* watcherItem = + CPresenceWatcherInfoImp::NewLC( + (MPresenceWatcherInfo::TWatcherType)0, + *watcherId, + aDispName ); + watcherList.AppendL( watcherItem ); + CleanupStack::Pop( watcherItem ); + CleanupStack::PopAndDestroy( watcherId ); + + HBufC8* packedArray = + TXIMPObjectPacker::PackArrayL( watcherList ); + CleanupStack::PushL( packedArray ); + + // use filetool to send it for plugin. + CXIMPTestFileSrvMsg* srvMsg = CXIMPTestFileSrvMsg::NewL( aMsgType, + *packedArray ); + CleanupStack::PushL( srvMsg ); + wrapper->FileTool().CleanAllL(); + wrapper->FileTool().SrvMsgStoreL( srvMsg ); + CleanupStack::PopAndDestroy( 3 ); // srvMsg, packedArray, watcherList + } + + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// send a faked server-originated message with empty contents +// +void T_PresenceWatcherListManagement::SendSrvMsgL( TInt aMsgType ) + { + // we'll use hard-coded wrapper 0 instance for now. + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + + // create a server-originated faked message with empty contents + RXIMPObjOwningPtrArray watcherList; + + HBufC8* packedArray = TXIMPObjectPacker::PackArrayL( watcherList ); + CleanupStack::PushL( packedArray ); + + // use filetool to send it for plugin. + CXIMPTestFileSrvMsg* srvMsg = CXIMPTestFileSrvMsg::NewL( aMsgType, + *packedArray ); + CleanupStack::PushL( srvMsg ); + wrapper->FileTool().CleanAllL(); + wrapper->FileTool().SrvMsgStoreL( srvMsg ); + CleanupStack::PopAndDestroy( 2 ); // srvMsg, packedArray + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// create a watcher list event with given arrays +// +CPresenceWatcherListEventImp* T_PresenceWatcherListManagement::CreateWatcherListEventLCX( + const TDesC& aUri, + const TDesC& aDispName, + MXIMPDataSubscriptionState::TSubscriptionState aSubscriptionState, + MXIMPDataSubscriptionState::TDataState aDataState, + TTestPWlOperation aOperation, + RPrWatLstInfoImpArray* aCurrentList) + { + // create the arrays + + + // new list + RPrWatLstInfoImpArray* newList = new ( ELeave ) RPrWatLstInfoImpArray; + CleanupDeletePushL( newList ); + + // current list, created by caller + if(!aCurrentList) // if client didnt created the list + aCurrentList = new ( ELeave ) RPrWatLstInfoImpArray; + CleanupDeletePushL( aCurrentList ); + + // disappeared list + RPrWatLstInfoImpArray* disappearedList = new ( ELeave ) RPrWatLstInfoImpArray; + CleanupDeletePushL( disappearedList ); + + // create the watcher info + CPresenceWatcherInfoImp* watcherInfoForEvent1 = NULL; + { + CXIMPIdentityImp* idForEvent = CXIMPIdentityImp::NewLC( aUri ); + watcherInfoForEvent1 = CPresenceWatcherInfoImp::NewLC( (MPresenceWatcherInfo::TWatcherType)0, *idForEvent, aDispName ); + CleanupStack::Pop( watcherInfoForEvent1 ); + CleanupStack::PopAndDestroy( idForEvent ); + CleanupStack::PushL( watcherInfoForEvent1 ); + } + + CPresenceWatcherInfoImp* watcherInfoForEvent2 = + TXIMPObjectCloner< CPresenceWatcherInfoImp >::CloneLC( *watcherInfoForEvent1 ); + + TInt count(0); + TBool found(EFalse); + TInt i(0); + + // put the given watcher info into the specified array + switch ( aOperation ) + { + case ETestPWlNew: + { + newList->AppendL( watcherInfoForEvent2 ); + CleanupStack::Pop( watcherInfoForEvent2 ); + + aCurrentList->AppendL( watcherInfoForEvent1 ); + CleanupStack::Pop( watcherInfoForEvent1 ); + } + break; + case ETestPWlCurrent: + { + // don't add, thus return what user has given + CleanupStack::PopAndDestroy( watcherInfoForEvent2 ); // watcherInfoForEvent2 + CleanupStack::PopAndDestroy( watcherInfoForEvent1 ); // watcherInfoForEvent1 + } + break; + case ETestPWlDisappeared: + { + // search the given id in current list + count = aCurrentList->Count(); + for(i=0;iWatcherId()).Identity()) == aUri ) + && ( (((*aCurrentList)[i])->WatcherDisplayName()) == aDispName )) + { + found = ETrue; + break; + } + } + if(found) // do we need to leave if error? Waqas + { + delete (*aCurrentList)[i]; + aCurrentList->Remove(i); + disappearedList->AppendL( watcherInfoForEvent2 ); + CleanupStack::Pop( watcherInfoForEvent2 ); + } + else + CleanupStack::PopAndDestroy( watcherInfoForEvent2 ); + + CleanupStack::PopAndDestroy( watcherInfoForEvent1 ); + } + break; + default: + { + User::Leave( KErrArgument ); + } + break; + }; + + CXIMPDataSubscriptionStateImp* stateImp = CXIMPDataSubscriptionStateImp::NewLC(); + stateImp->SetDataStateL( aDataState ); + stateImp->SetSubscriptionStateL( aSubscriptionState ); + CleanupStack::Pop( stateImp ); + + // create the actual event + CPresenceWatcherListEventImp* tmp = + CPresenceWatcherListEventImp::NewLC( + newList, + aCurrentList, + disappearedList, + stateImp ); + + + /* + * In cleanupstack there are 4 items, FIFO + * - new list + * - current list + * - disappeared list + * - event imp + */ + + return tmp; + } + +void T_PresenceWatcherListManagement::SetupListenerReqCompleteL( CXIMPTestContextWrapper* aWrapper, TXIMPTestStatusEventTemplate aEventType ) + { + RArray< TInt32 > array; + CleanupClosePushL( array ); + array.AppendL( MXIMPRequestCompleteEvent::KInterfaceId ); + array.Append( MXIMPContextStateEvent::KInterfaceId ); + array.Append( MPresentityPresenceEvent::KInterfaceId ); + aWrapper->SetupListenerReqCompleteL( aEventType, &array ); + CleanupStack::PopAndDestroy(); // array + } + +void T_PresenceWatcherListManagement::SetupListenerReqCompleteAllowEventsL( CXIMPTestContextWrapper* aWrapper, TXIMPTestStatusEventTemplate aEventType ) + { + RArray< TInt32 > array; + CleanupClosePushL( array ); + array.AppendL( MXIMPRequestCompleteEvent::KInterfaceId ); + array.AppendL( MXIMPContextStateEvent::KInterfaceId ); + array.AppendL( MPresentityPresenceEvent::KInterfaceId ); + aWrapper->SetupListenerReqCompleteL( aEventType, &array ); + CleanupStack::PopAndDestroy(); // array + } + +// =========================================================================== +// EVENT OBSERVER METHODS +// =========================================================================== +// +void T_PresenceWatcherListManagement::HandlePresenceContextEvent( + const MXIMPContext& aContext, + const MXIMPBase& aEvent ) + { + iLastError = KErrNone; + TInt ifId = aEvent.GetInterfaceId(); + TInt gg = MPresentityPresenceEvent::KInterfaceId; + if( ifId == MPresenceWatcherListEvent::KInterfaceId ) + { + const MPresenceWatcherListEvent* watcherListEvent = + TXIMPGetInterface< const MPresenceWatcherListEvent >::From( aEvent, MXIMPBase::EPanicIfUnknown ); + + if( watcherListEvent->NewWatchersCount() ) + { + iLastEvent = EWatcherList; + TInt count = watcherListEvent->NewWatchersCount(); + for( TInt a = 0; a < count; ++a ) + { + TRAPD( error, + CPresenceWatcherInfoImp* watcherInfo = CPresenceWatcherInfoImp::NewLC( + watcherListEvent->NewWatcher( a ).WatcherType(), + watcherListEvent->NewWatcher( a ).WatcherId(), + watcherListEvent->NewWatcher( a ).WatcherDisplayName() ); + iValidateArray.AppendL( watcherInfo ); + CleanupStack::Pop( watcherInfo ); + ); + if( error != KErrNone ) + { + iLastError = error; + return; + } + } + } + } + else if( ifId == MPresentityPresenceEvent::KInterfaceId ) + { + const MPresentityPresenceEvent* presentityPresenceEvent = + TXIMPGetInterface< const MPresentityPresenceEvent >::From( aEvent, MXIMPBase::EPanicIfUnknown ); + const MXIMPIdentity& prId = presentityPresenceEvent->PresentityId(); + const MPresenceInfo& prPif = presentityPresenceEvent->SubscribedPresence(); + const MXIMPDataSubscriptionState& prDataStae = presentityPresenceEvent->DataSubscriptionState(); + } + else + { + iLastEvent = EInvalid; + } + } + +// =========================================================================== +// TEST CASE TABLE +// =========================================================================== +// +EUNIT_BEGIN_TEST_TABLE( + T_PresenceWatcherListManagement, + "XIMP presence watching tests", + "MODULE" ) + +PRFW_DECORATED_TEST( + "Bind Unbind", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_BindUnbind_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Single client watcher list subscription", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_SubscribePresenceWatcherList_Single_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Multiple client watcher list subscription", + "", + "", + "FUNCTIONALITY", + SetupMultiple_L, + T_SubscribePresenceWatcherList_Multiple_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Handle Presence Watcher List", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_HandlePresenceWatcherList_L, + Teardown ) + + PRFW_DECORATED_TEST( + "Test India Case", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_IndiaCase_L, + Teardown ) + + +EUNIT_END_TEST_TABLE + + +// =========================================================================== +// TEST SUITE CONSTRUCTION +// =========================================================================== +// +EXPORT_C MEUnitTest* CreateTestSuiteL() + { + return T_PresenceWatcherListManagement::NewL(); + } + + +// end of file diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/src/t_presencewatcherlistmngt/t_presencewatcherlistmngt.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/src/t_presencewatcherlistmngt/t_presencewatcherlistmngt.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,179 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework Test Code +* +*/ + +#ifndef T_PRESENCEWATCHERLISTMANAGEMENT_H +#define T_PRESENCEWATCHERLISTMANAGEMENT_H + +#include +#include +#include +#include "presencetypehelpers.h" +#include "prfwteststatuseventlistener.h" +#include "prfwtestmessaging.h" + +class CXIMPTestContextWrapper; +class CXIMPTestContextWrapperMgr; +class CXIMPTestMessenger; +class CPresenceWatcherInfoImp; +class CPresenceWatcherListEventImp; + +/** + * XIMP Framework Eunit tests. + * + * Tests for XIMP presence watcher list. + * + * @since S60 v4.0 + */ +class T_PresenceWatcherListManagement : public CEUnitTestSuiteClass, + public MXIMPContextObserver + { + +public: + static T_PresenceWatcherListManagement* NewL(); + virtual ~T_PresenceWatcherListManagement(); + + +private: + T_PresenceWatcherListManagement(); + void ConstructL(); + + enum TValidateType + { + EWatcherList, + EInvalid = 1000 + }; + +private: // Test case functions + + void Setup_L(); + void SetupMultiple_L(); + void BindL(); + void BindAllL(); + void Teardown(); + void UnbindL(); + void UnbindAllL(); + void SubscribeL(); + void UnsubscribeL(); + + void T_BindUnbind_L(); + void T_SubscribePresenceWatcherList_Single_L(); + void T_SubscribePresenceWatcherList_Multiple_L(); + void T_HandlePresenceWatcherList_L(); + void T_IndiaCase_L(); + void SetupListenerReqCompleteL( CXIMPTestContextWrapper* aWrapper, + TXIMPTestStatusEventTemplate aEventType ); + + void SetupListenerReqCompleteAllowEventsL( CXIMPTestContextWrapper* aWrapper, + TXIMPTestStatusEventTemplate aEventType ); + + //TBool ValidateWatcherListEvent( RXIMPObjOwningPtrArray& aExpectedArray, TValidateType aType ); + + +private: // From MXIMPContextObserver + + void HandlePresenceContextEvent( + const MXIMPContext& aContext, + const MXIMPBase& aEvent ); + + +private: // Test helpers + + /** + * Fake a server-originated (=mobile terminated) message. + * The message appears to adaptation and framework as if + * it came from the network. Uses only one group. + * @param aUri The URI of group + * @param aDispName The display name for the group + * @param aMsgType The message type for CXIMPTestFileSrvMsg + */ + void SendSrvMsgL( + const TDesC& aUri, const TDesC& aDispName, + TInt aMsgType ); + + /** + * Fake a server-originated message with empty content. + * Whether to use this depends on the event you expect. + * @see SendSrvMsgL + */ + void SendSrvMsgL( TInt aMsgType ); + + // @see below + enum TTestPWlOperation + { + ETestPWlNew = 0, // new watchers + ETestPWlCurrent, // current watchers + ETestPWlDisappeared // disappeared watchers + }; + + + /** + * Creates an event for new watcher, current, or disappred presence watcher + * list. The caller provides an identity and current presence watcher list. + * Depending on the provided operation an event is created. + * + * In cleanupstack there are 4 items, FIFO: + * - new list + * - current list + * - disappeared list + * - event imp + * + * This is because this event won't take ownership to the arrays + * when created this way. + * + * @param aUri Uri + * @param aDispName Displayname + * @param aOperation operation for which caller wants to generates event + * @param aCurrentList Current watcher list provided by caller, method takes + * ownership of the current list, and it is included in above 3 lists. + * a NULL pointer with operation ETestPWlCurrent causes empty event. + * @return The suitably filled event. + */ + CPresenceWatcherListEventImp* CreateWatcherListEventLCX( + const TDesC& aUri, + const TDesC& aDispName, + MXIMPDataSubscriptionState::TSubscriptionState aSubscriptionState, + MXIMPDataSubscriptionState::TDataState aDataState, + TTestPWlOperation aOperation, + RPrWatLstInfoImpArray* aCurrentList = NULL + ); + + +private: // Test data + + /** + * Eunit test case table declaration. + */ + EUNIT_DECLARE_TEST_TABLE; + + // owned + CXIMPTestContextWrapperMgr* iWrapperMgr; + + // + TValidateType iLastEvent; + TInt iLastError; + RXIMPObjOwningPtrArray< CPresenceWatcherInfoImp > iValidateArray; + }; + + +#endif // T_PRESENCEWATCHERLISTMANAGEMENT_H + + + +// end of file + + + diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/src/t_presencewatcherlistmngt/t_presencewatcherlistmngt.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/src/t_presencewatcherlistmngt/t_presencewatcherlistmngt.mmp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,54 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework Test Code +* +*/ + +#include "../../tsrcutils/eunitcommon/eunittstdllbase.hrh" +#include "../../tsrcutils/processmaster/pm.h" + +TARGET t_presencewatcherlistmngt.dll + +SOURCEPATH . +SOURCE t_presencewatcherlistmngt.cpp + +USERINCLUDE ../../../core/srcdatamodel +USERINCLUDE ../../../presence/srcpresencedatamodel +USERINCLUDE ../../../presence/srcpresencedatamodel/presentitygroups +USERINCLUDE ../../../presence/srcpresencedatamodel/presencewatching +USERINCLUDE ../../../presence/srcpresencedatamodel/presenceauthorization +USERINCLUDE ../../../presence/srcpresencedatamodel/presencepublishing +USERINCLUDE ../../../presence/srcpresencedatamodel/presenceinfo +USERINCLUDE ../../../core/srcutils + +// TODO remove unnecessary +SYSTEMINCLUDE ../../../inc/core/base +SYSTEMINCLUDE ../../../inc/core/datamodel +SYSTEMINCLUDE ../../../inc/core/protocolplugin +SYSTEMINCLUDE ../../../inc/core/protocolpluginhost +SYSTEMINCLUDE ../../../inc/presence/presencedatamodel +SYSTEMINCLUDE ../../../inc/presence/presencemanagement +SYSTEMINCLUDE ../../../inc/presence/presenceprotocolplugin +SYSTEMINCLUDE ../../../inc/presence/presenceprotocolpluginhost + +LIBRARY ecom.lib +LIBRARY bafl.lib +LIBRARY ximpdatamodel.lib +LIBRARY presencedatamodel.lib +LIBRARY ximputils.lib +LIBRARY estor.lib + +// end of file + + diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/src/t_presencewatching/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/src/t_presencewatching/bld.inf Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,23 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Build information file for t_presencewatching.dll +* +*/ + + +PRJ_PLATFORMS +DEFAULT + +PRJ_TESTMMPFILES +t_presencewatching.mmp diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/src/t_presencewatching/t_presencewatching.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/src/t_presencewatching/t_presencewatching.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,1520 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework Test Code +* +*/ + + +#include "eunittools.h" + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "t_presencewatching.h" +#include "prfwteststatuseventlistener.h" +#include "prfwtestmessaging.h" +#include "prfwtestmessenger.h" +#include "prfwtestcontextwrappermgr.h" +#include "prfwtestcontextwrapper.h" + +#include "presenceinfoimp.h" +#include "presenceinfofilterimp.h" +#include "prfwtestpresencedatautils.h" +#include "ximpidentityimp.h" +#include "presentitygroupmemberinfoimp.h" +#include "ximpobjecthelpers.h" +#include "prfwtestfilesrvmsg.h" +#include "prfwtestwaithelper.h" + +#include "prfwtestrobustnesstools.h" +#include "presenceinfofieldimp.h" +#include "presenceinfofieldcollectionimp.h" +#include "presenceinfofieldvaluetextimp.h" +#include "personpresenceinfoimp.h" + +#include + +// For the protocol UID +#include "prfwtestprotocols.h" + + +_LIT8( KPrefix1, "PreA_" ); +_LIT8( KPrefix2, "PreB_" ); +_LIT8( KPrefix3, "PreC_" ); +_LIT8( KPrefix4, "PreD_" ); + +_LIT( KIdentity, "TestId@hello.world" ); +_LIT8( KIdentity8, "TestId@hello.world" ); + +_LIT( KText, "Hello World" ); + + +const TUid KTestProtocolUid = { K_PRFW_TST_PROTOCOL_1_IMPLEMENTATION_UID }; // hardcoded... + +// ============================ MEMBER FUNCTIONS =============================== + +// CONSTRUCTION +T_PresenceWatching* T_PresenceWatching::NewL() + { + T_PresenceWatching* self = new( ELeave ) T_PresenceWatching; + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + + return self; + } + + +T_PresenceWatching::~T_PresenceWatching() + { + } + + +void T_PresenceWatching::ConstructL() + { + CEUnitTestSuiteClass::ConstructL(); + } + + +T_PresenceWatching::T_PresenceWatching() + { + } + + + +// =========================================================================== +// TEST CASE SETUP & TEARDOWN METHODS +// =========================================================================== +// + +void T_PresenceWatching::Setup_L() + { + __UHEAP_MARK; + PrfwTestRobustness::DoPreCleaning(); + + iWrapperMgr = CXIMPTestContextWrapperMgr::NewL(); + iWrapperMgr->CreateWrapperL(); + + iMPresenceCacheReader = MPresenceCacheReader::NewL(); + } + +void T_PresenceWatching::SetupMultiple_L() + { + PrfwTestRobustness::DoPreCleaning(); + + iWrapperMgr = CXIMPTestContextWrapperMgr::NewL(); + iWrapperMgr->CreateWrapperL(); + iWrapperMgr->CreateWrapperL(); + iWrapperMgr->CreateWrapperL(); + } + + +void T_PresenceWatching::BindL() + { + CXIMPTestContextWrapper* wrapper0 = iWrapperMgr->GetWrapperL( 0 ); + + wrapper0->BindL( 0 ); + } + +void T_PresenceWatching::BindAllL() + { + for( TInt a = 0; a < iWrapperMgr->WrapperCount(); ++a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + wrapper->BindL( 0 ); + } + } + + +void T_PresenceWatching::Teardown() + { + delete iWrapperMgr; + iWrapperMgr = NULL; + + delete iMPresenceCacheReader; + + REComSession::FinalClose(); + + PrfwTestRobustness::DoPreCleaning(); + __UHEAP_MARKEND; + } + +void T_PresenceWatching::UnbindL() + { + // Do unbind + CXIMPTestContextWrapper* wrapper0 = iWrapperMgr->GetWrapperL( 0 ); + wrapper0->UnbindL(); + } + +void T_PresenceWatching::UnbindAllL() + { + for( TInt a = 0; a < iWrapperMgr->WrapperCount(); ++a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + wrapper->UnbindL(); + } + } + + +// =========================================================================== +// TEST CASES for presentity presence subscription +// =========================================================================== + +// Single client, empty filter +void T_PresenceWatching::T_SubscribePresentityPresence_Single_L() + { + EUNIT_PRINT( _L("Single presentity subscription") ); + +// BIND AND SETUP + + BindL(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceWatching& presWatch = presFeat->PresenceWatching(); + +// SUBSCRIBE + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + + CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 ); + CPresenceInfoFilterImp* pif = XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 ); + + // register interest + TXIMPRequestId reqId = presWatch.SubscribePresentityPresenceL( *identity, *pif ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Subscribing presentity presence, complete with error: ") ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestSubscribePresentityPresesenceCalled, "SubscribePresentityPresenceL was not called", ETrue, NULL ); + + +// REFRESH + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + messenger->SetValueFor( EXIMPPlgTestSubscribePresentityPresesenceCalled, 0 ); + + // register interest + reqId = presWatch.SubscribePresentityPresenceL( *identity, *pif ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Subscribing presentity presence, complete with error: ") ); + + // Wait for event because refresh happened + SetupListenerReqCompleteL( wrapper, EXIMPTestStatusEvents_HandlePresentityPresencePending ); + // Wait for events + wrapper->WaitAnyEvent(); + wrapper->VerifyEventStackL( _L8("Handle presence watcher list. Wrong event occurred.") ); + + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestSubscribePresentityPresesenceCalled, + "SubscribePresentityPresenceL was not called", EFalse, + "SubscribePresentityPresenceL was called" ); + +// UNSUBSCRIBE + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); // allow events after reqcomplete + + // register interest + reqId = presWatch.UnsubscribePresentityPresenceL( *identity ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("UnSubscribing presentity presence, complete with error: ") ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestUnsubscribePresentityPresesenceCalled, "UnsubscribePresentityPresenceL was not called", ETrue, NULL ); + +// UNBIND + + CleanupStack::PopAndDestroy( pif ); + CleanupStack::PopAndDestroy( identity ); + + UnbindL(); + } + +// Single client, empty filter, presence cache checking +void T_PresenceWatching::T_SubscribeHandlePresentityPresence_Single_L() + { + EUNIT_PRINT( _L("Single presentity subscription") ); + +// BIND AND SETUP + + BindL(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceWatching& presWatch = presFeat->PresenceWatching(); + +// SUBSCRIBE + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + + CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KIdentity8 ); + CPresenceInfoFilterImp* pif = XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 ); + + // register interest + TXIMPRequestId reqId = presWatch.SubscribePresentityPresenceL( *identity, *pif ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Subscribing presentity presence, complete with error: ") ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestSubscribePresentityPresesenceCalled, "SubscribePresentityPresenceL was not called", ETrue, NULL ); + +// SEND DATA + + // Create some meaningful data + CPresenceInfoImp* presenceInfo = CPresenceInfoImp::NewLC(); + + MPresenceInfoFieldValueText* value = CPresenceInfoFieldValueTextImp::NewLC(); + value->SetTextValueL(KText); + + MPresenceInfoField* infoField = CPresenceInfoFieldImp::NewLC(); + infoField->SetFieldTypeL(NPresenceInfo::NFieldType::KStatusMessage); + infoField->SetFieldValue(value); + + MPersonPresenceInfo* personPres = CPersonPresenceInfoImp::NewLC(); + MPresenceInfoFieldCollection& fieldCol = personPres->Fields(); + fieldCol.AddOrReplaceFieldL(infoField); + TInt fieldCount= fieldCol.FieldCount(); + + presenceInfo->SetPersonPresenceL(personPres); + CleanupStack::Pop(3); // value, infoField, personPres + + // Pack the data for FileTool + HBufC8* packedInfo = TXIMPObjectPacker< CPresenceInfoImp >::PackL( *presenceInfo ); + CleanupStack::PushL( packedInfo ); + HBufC8* packedId = TXIMPObjectPacker< CXIMPIdentityImp >::PackL( *identity ); + CleanupStack::PushL( packedId ); + RPointerArray< HBufC8 > bufferArray; + CleanupClosePushL( bufferArray ); + bufferArray.AppendL( packedId ); + bufferArray.AppendL( packedInfo ); + HBufC8* packedBufferArray = TXIMPHBuf8Packer::PackArrayL( bufferArray ); + CleanupStack::PopAndDestroy( 3, packedInfo ); // packedId, packedInfo, bufferArray + CleanupStack::PushL( packedBufferArray ); + + // Use filetool to send it for plugin. + CXIMPTestFileSrvMsg* srvMsg = CXIMPTestFileSrvMsg::NewL( CXIMPTestFileSrvMsg::ETestSrvMsgPresentityPresence, + *packedBufferArray ); + CleanupStack::PopAndDestroy( packedBufferArray ); + CleanupStack::PushL( srvMsg ); + wrapper->FileTool().SrvMsgStoreL( srvMsg ); + CleanupStack::PopAndDestroy( srvMsg ); + + // Wait for event + SetupListenerReqCompleteL( wrapper, EXIMPTestStatusEvents_HandlePresentityPresence ); + + // Wait for events + wrapper->WaitAnyEvent(); + wrapper->VerifyEventStackL( _L8("Handle presentity presence. Wrong event occurred.") ); + + // Verify the cache + MPresenceInfo* presInfoRead = iMPresenceCacheReader->PresenceInfoLC(*identity); + + CPresenceInfoImp* readInfo = + TXIMPGetImpClassOrPanic::From(*presInfoRead); + + + EUNIT_ASSERT( presenceInfo->EqualsContent(*readInfo) ); + + CleanupStack::PopAndDestroy( 2 ); // readInfo, presenceInfo + + +// UNSUBSCRIBE + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); // allow events after reqcomplete + + // unsubscribe + reqId = presWatch.UnsubscribePresentityPresenceL( *identity ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("UnSubscribing presentity presence, complete with error: ") ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestUnsubscribePresentityPresesenceCalled, "UnsubscribePresentityPresenceL was not called", ETrue, NULL ); + +// UNBIND + + CleanupStack::PopAndDestroy( pif ); + CleanupStack::PopAndDestroy( identity ); + + UnbindL(); + } + + +// Single client, empty filter +void T_PresenceWatching::T_SubscribePresentityPresenceChangeId_Single_L() + { + EUNIT_PRINT( _L("Single presentity subscription") ); + +// BIND AND SETUP + + BindL(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceWatching& presWatch = presFeat->PresenceWatching(); + +// ID CHANGE REQUEST TO ADAPTATION + + MXIMPIdentity* identityParam = context->ObjectFactory().NewIdentityLC(); + identityParam->SetIdentityL( KIdentity ); + + CXIMPIdentityImp* identityParamImp = + ( CXIMPIdentityImp* ) identityParam->GetInterface( + CXIMPIdentityImp::KClassId, + MXIMPBase::EPanicIfUnknown ); + HBufC8* packedId = TXIMPObjectPacker< CXIMPIdentityImp >::PackL( *identityParamImp ); + CleanupStack::PopAndDestroy(); // identityParam + CleanupStack::PushL( packedId ); + CXIMPTestFileSrvMsg* srvMsg = CXIMPTestFileSrvMsg::NewL( CXIMPTestFileSrvMsg::ETestSrvMsgReqParamIdentity, + *packedId ); + CleanupStack::PopAndDestroy( packedId ); + CleanupStack::PushL( srvMsg ); + wrapper->FileTool().SrvMsgStoreL( srvMsg ); + CleanupStack::PopAndDestroy( srvMsg ); + + // Wait for server to handle srvmsg. + CXIMPTestWaitHelper* wait = CXIMPTestWaitHelper::NewL(); + CleanupStack::PushL( wait ); + wait->WaitForL( 2 ); + CleanupStack::PopAndDestroy( wait ); + +// SUBSCRIBE + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + + CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 ); + CPresenceInfoFilterImp* pif = XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 ); + + // register interest + TXIMPRequestId reqId = presWatch.SubscribePresentityPresenceL( *identity, *pif ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Subscribing presentity presence, complete with error: ") ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestSubscribePresentityPresesenceCalled, "SubscribePresentityPresenceL was not called", ETrue, NULL ); + +// UNBIND + + CleanupStack::PopAndDestroy( pif ); + CleanupStack::PopAndDestroy( identity ); + + UnbindL(); + } + + +void T_PresenceWatching::T_UnsubscribeNotSubscribedPresentityPresence_Single_L() + { + EUNIT_PRINT( _L("Unsubscribe not subscribed presentity presence") ); + +// BIND AND SETUP + + BindL(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceWatching& presWatch = presFeat->PresenceWatching(); + + CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 ); + CPresenceInfoFilterImp* pif = XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 ); + +// UNSUBSCRIBE + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); // allow events after reqcomplete + + // register interest + TXIMPRequestId reqId = presWatch.UnsubscribePresentityPresenceL( *identity ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("UnSubscribing presentity presence, complete with error: ") ); + + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestUnsubscribePresentityPresesenceCalled, "UnsubscribePresentityPresenceL was not called", EFalse, + "UnsbuscribePresentityPresenceL was called." ); + +// UNBIND + + CleanupStack::PopAndDestroy( pif ); + CleanupStack::PopAndDestroy( identity ); + + UnbindL(); + } + +void T_PresenceWatching::T_UnsubscribeNotSubscribedPresentityPresence_Multiple_L() + { + EUNIT_PRINT( _L("Multiple client filter registration") ); + + BindAllL(); + + CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 ); + CPresenceInfoFilterImp* pif = XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 ); + + TInt countOfWrappers = iWrapperMgr->WrapperCount(); + for( TInt a = countOfWrappers - 1; a >= 1 ; --a ) // Don't subscribe the first one. + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceWatching& presWatch = presFeat->PresenceWatching(); + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + + // register interest + TXIMPRequestId reqId = presWatch.SubscribePresentityPresenceL( *identity, *pif ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestSubscribePresentityPresesenceCalled, + "SubscribePresentityPresenceL was not called", + ( a > 1 ) ? ETrue : EFalse, + "SubscribePresentityPresenceL was called" ); + } + + for( TInt a = 0; a < countOfWrappers; ++a ) // Try to unsubscribe first one first. + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceWatching& presWatch = presFeat->PresenceWatching(); + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); // allow events after reqcomplete + + // register interest + TXIMPRequestId reqId = presWatch.UnsubscribePresentityPresenceL( *identity ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Subscribing presentity presence, complete with error: ") ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestUnsubscribePresentityPresesenceCalled, + "UnsubscribePresentityPresenceL was not called", + ( a < 2 ) ? EFalse : ETrue, + "UnsubscribePresentityPresenceL was called" ); + } + + CleanupStack::PopAndDestroy( pif ); + CleanupStack::PopAndDestroy( identity ); + + UnbindAllL(); + } + + +void T_PresenceWatching::T_ErrFromPlg_LeaveOnSubscribePresentityPresence_L() + { + EUNIT_PRINT( _L("Error from plug-in in presentity presence subscribe") ); + EUNIT_PRINT( _L("Plug-in leaves from SubscribePresence().") ); + +// BIND AND SETUP + + BindL(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + messenger->SetLeave( KErrAbort ); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceWatching& presWatch = presFeat->PresenceWatching(); + +// SUBSCRIBE + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_PresentitySubscribeFailKErrAbort ); + + CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 ); + CPresenceInfoFilterImp* pif = XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 ); + + // register interest + TXIMPRequestId reqId = presWatch.SubscribePresentityPresenceL( *identity, *pif ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Subscribing presentity presence, complete with error: ") ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestSubscribePresentityPresesenceCalled, "SubscribePresentityPresenceL was not called", EFalse, "SubscribePresentityPresenceL was called" ); + +// UNBIND + + CleanupStack::PopAndDestroy( pif ); + CleanupStack::PopAndDestroy( identity ); + + messenger->SetLeave( KErrNone ); + + UnbindL(); + } + + +void T_PresenceWatching::T_ErrFromPlg_LeaveOnUnsubscribePresentityPresence_L() + { + EUNIT_PRINT( _L("Error from plug-in in presentity presence subscribe") ); + EUNIT_PRINT( _L("Plug-in leaves from SubscribePresence().") ); + +// BIND AND SETUP + + BindL(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceWatching& presWatch = presFeat->PresenceWatching(); + +// SUBSCRIBE + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + + CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 ); + CPresenceInfoFilterImp* pif = XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 ); + + // register interest + TXIMPRequestId reqId = presWatch.SubscribePresentityPresenceL( *identity, *pif ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Subscribing presentity presence, complete with error: ") ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestSubscribePresentityPresesenceCalled, "SubscribePresentityPresenceL was not called", ETrue, NULL ); + +// UNSUBSCRIBE + + messenger->SetLeave( KErrAbort ); + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_PresentitySubscribeFailKErrAbort ); // allow events after reqcomplete + + // register interest + reqId = presWatch.UnsubscribePresentityPresenceL( *identity ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("UnSubscribing presentity presence, complete with error: ") ); + + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestUnsubscribePresentityPresesenceCalled, "UnsubscribePresentityPresenceL was not called", EFalse, + "UnsbuscribePresentityPresenceL was called." ); + +// UNBIND + + CleanupStack::PopAndDestroy( pif ); + CleanupStack::PopAndDestroy( identity ); + + messenger->SetLeave( KErrNone ); + + UnbindL(); + } + + +// Multiple client, empty filter +void T_PresenceWatching::T_SubscribePresentityPresence_Multiple_L() + { + EUNIT_PRINT( _L("Multiple client filter registration") ); + + BindAllL(); + + CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 ); + CPresenceInfoFilterImp* pif = XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 ); + + TInt countOfWrappers = iWrapperMgr->WrapperCount(); + for( TInt a = 0; a < countOfWrappers; ++a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceWatching& presWatch = presFeat->PresenceWatching(); + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + + // register interest + TXIMPRequestId reqId = presWatch.SubscribePresentityPresenceL( *identity, *pif ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestSubscribePresentityPresesenceCalled, + "SubscribePresentityPresenceL was not called", + ( a == 0 ) ? ETrue : EFalse, + "SubscribePresentityPresenceL was called" ); + } + + for( TInt a = 0; a < countOfWrappers; ++a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceWatching& presWatch = presFeat->PresenceWatching(); + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + messenger->SetValueFor( EXIMPPlgTestSubscribePresentityPresesenceCalled, 0 ); + + // register interest + TXIMPRequestId reqId = presWatch.SubscribePresentityPresenceL( *identity, *pif ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Subscribing presentity presence, complete with error: ") ); + + // Wait for event because refresh happened + SetupListenerReqCompleteL( wrapper, EXIMPTestStatusEvents_HandlePresentityPresencePending ); + // Wait for events + wrapper->WaitAnyEvent(); + wrapper->VerifyEventStackL( _L8("Handle presence watcher list. Wrong event occurred.") ); + + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestSubscribePresentityPresesenceCalled, + "SubscribePresentityPresenceL was not called", EFalse, + "SubscribePresentityPresenceL was called" ); + } + + + for( TInt a = 0; a < countOfWrappers; ++a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceWatching& presWatch = presFeat->PresenceWatching(); + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); // allow events after reqcomplete + + // register interest + TXIMPRequestId reqId = presWatch.UnsubscribePresentityPresenceL( *identity ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Subscribing presentity presence, complete with error: ") ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestUnsubscribePresentityPresesenceCalled, + "UnsubscribePresentityPresenceL was not called", + ( a < 2 ) ? EFalse : ETrue, + "UnsubscribePresentityPresenceL was called" ); + } + + CleanupStack::PopAndDestroy( pif ); + CleanupStack::PopAndDestroy( identity ); + + + UnbindAllL(); + } + + +// =========================================================================== +// TEST CASES for presentity group members presence subscription +// =========================================================================== + +// Single client, empty filter +void T_PresenceWatching::T_SubscribePresentityGroupMembersPresence_Single_L() + { + EUNIT_PRINT( _L("Single presentity group members subscription") ); + + BindL(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceWatching& presWatch = presFeat->PresenceWatching(); + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + + CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 ); + CPresenceInfoFilterImp* pif = XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 ); + +// SUBSCRIBE + + // register interest + TXIMPRequestId reqId = presWatch.SubscribePresentityGroupMembersPresenceL( *identity, *pif ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestSubscribePresentityGroupMembersPresesenceCalled, "SubscribePresentityGroupMembersPresenceL was not called", ETrue, NULL ); + +// REFRESH + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + messenger->SetValueFor( EXIMPPlgTestSubscribePresentityGroupMembersPresesenceCalled, 0 ); + + // register interest + reqId = presWatch.SubscribePresentityGroupMembersPresenceL( *identity, *pif ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestSubscribePresentityGroupMembersPresesenceCalled, + "SubscribePresentityPresenceL was not called", EFalse, + "SubscribePresentityPresenceL was called" ); + +// UNSUBSCRIBE + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); // allow events after reqcomplete + + + // register interest + reqId = presWatch.UnsubscribePresentityGroupMembersPresenceL( *identity ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Subscribing presentity group members presence, complete with error: ") ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestUnsubscribePresentityGroupMembersPresesenceCalled, "UnsubscribePresentityGroupMembersPresenceL was not called", ETrue, NULL ); + + + CleanupStack::PopAndDestroy( pif ); + CleanupStack::PopAndDestroy( identity ); + + UnbindL(); + } + +void T_PresenceWatching::T_UnsubscribeNotSubscribedPresentityGroupMembersPresence_Single_L() + { + EUNIT_PRINT( _L("Unsubscribe not subscribed presentity group members presence") ); + +// BIND AND SETUP + + BindL(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceWatching& presWatch = presFeat->PresenceWatching(); + CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 ); + CPresenceInfoFilterImp* pif = XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 ); + +// UNSUBSCRIBE + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); // allow events after reqcomplete + + // register interest + TXIMPRequestId reqId = presWatch.UnsubscribePresentityGroupMembersPresenceL( *identity ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("UnSubscribing presentity presence, complete with error: ") ); + + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestUnsubscribePresentityGroupMembersPresesenceCalled, "UnsubscribePresentityGroupMembersPresenceL was not called", EFalse, + "UnsubscribePresentityGroupMembersPresenceL was called." ); + +// UNBIND + + CleanupStack::PopAndDestroy( pif ); + CleanupStack::PopAndDestroy( identity ); + + UnbindL(); + } + + +void T_PresenceWatching::T_UnsubscribeNotSubscribedPresentityGroupMembersPresence_Multiple_L() + { + EUNIT_PRINT( _L("Multiple client filter registration") ); + + BindAllL(); + + CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 ); + CPresenceInfoFilterImp* pif = XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 ); + + TInt countOfWrappers = iWrapperMgr->WrapperCount(); + for( TInt a = countOfWrappers - 1; a >= 1; --a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceWatching& presWatch = presFeat->PresenceWatching(); + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + + // register interest + TXIMPRequestId reqId = presWatch.SubscribePresentityGroupMembersPresenceL( *identity, *pif ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestSubscribePresentityGroupMembersPresesenceCalled, + "SubscribePresentityPresenceL was not called", + ( a > 1 ) ? ETrue : EFalse, + "SubscribePresentityPresenceL was called" ); + } + + for( TInt a = 0; a < countOfWrappers; ++a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceWatching& presWatch = presFeat->PresenceWatching(); + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); // allow events after reqcomplete + + // register interest + TXIMPRequestId reqId = presWatch.UnsubscribePresentityGroupMembersPresenceL( *identity ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Subscribing presentity presence, complete with error: ") ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestUnsubscribePresentityGroupMembersPresesenceCalled, + "UnsubscribePresentityPresenceL was not called", + ( a < 2 ) ? EFalse : ETrue, + "UnsubscribePresentityPresenceL was called" ); + } + + CleanupStack::PopAndDestroy( pif ); + CleanupStack::PopAndDestroy( identity ); + + UnbindAllL(); + } + + + +// Multiple client, empty filter +void T_PresenceWatching::T_SubscribeGroupMembersPresence_Multiple_L() + { + EUNIT_PRINT( _L("Multiple client filter registration") ); + + BindAllL(); + + CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 ); + CPresenceInfoFilterImp* pif = XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 ); + + TInt countOfWrappers = iWrapperMgr->WrapperCount(); + for( TInt a = 0; a < countOfWrappers; ++a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceWatching& presWatch = presFeat->PresenceWatching(); + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + + // register interest + TXIMPRequestId reqId = presWatch.SubscribePresentityGroupMembersPresenceL( *identity, *pif ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestSubscribePresentityGroupMembersPresesenceCalled, + "SubscribePresentityPresenceL was not called", + ( a == 0 ) ? ETrue : EFalse, + "SubscribePresentityPresenceL was called" ); + } + + for( TInt a = 0; a < countOfWrappers; ++a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceWatching& presWatch = presFeat->PresenceWatching(); + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + messenger->SetValueFor( EXIMPPlgTestSubscribePresentityGroupMembersPresesenceCalled, 0 ); + + // register interest + TXIMPRequestId reqId = presWatch.SubscribePresentityGroupMembersPresenceL( *identity, *pif ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Subscribing presentity presence, complete with error: ") ); + + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestSubscribePresentityGroupMembersPresesenceCalled, + "SubscribePresentityPresenceL was not called", EFalse, + "SubscribePresentityPresenceL was called" ); + } + + + for( TInt a = 0; a < countOfWrappers; ++a ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( a ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceWatching& presWatch = presFeat->PresenceWatching(); + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); // allow events after reqcomplete + + // register interest + TXIMPRequestId reqId = presWatch.UnsubscribePresentityGroupMembersPresenceL( *identity ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Subscribing presentity presence, complete with error: ") ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestUnsubscribePresentityGroupMembersPresesenceCalled, + "UnsubscribePresentityPresenceL was not called", + ( a < 2 ) ? EFalse : ETrue, + "UnsubscribePresentityPresenceL was called" ); + } + + CleanupStack::PopAndDestroy( pif ); + CleanupStack::PopAndDestroy( identity ); + + + UnbindAllL(); + } + + +void T_PresenceWatching::T_ErrFromPlg_LeaveOnSubscribePresentityGroupMembersPresence_L() + { + EUNIT_PRINT( _L("Error from plug-in in presentity group members presence subscribe") ); + EUNIT_PRINT( _L("Plug-in leaves from SubscribeGroupMembersPresence().") ); + +// BIND AND SETUP + + BindL(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + messenger->SetLeave( KErrAbort ); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceWatching& presWatch = presFeat->PresenceWatching(); + +// SUBSCRIBE + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_PresentitySubscribeFailKErrAbort ); + + CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 ); + CPresenceInfoFilterImp* pif = XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 ); + + // register interest + TXIMPRequestId reqId = presWatch.SubscribePresentityGroupMembersPresenceL( *identity, *pif ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Subscribing presentity presence, complete with error: ") ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestSubscribePresentityGroupMembersPresesenceCalled, "SubscribePresentityPresenceL was not called", EFalse, "SubscribePresentityPresenceL was called" ); + +// UNBIND + + CleanupStack::PopAndDestroy( pif ); + CleanupStack::PopAndDestroy( identity ); + + messenger->SetLeave( KErrNone ); + + UnbindL(); + } + + +void T_PresenceWatching::T_ErrFromPlg_LeaveOnUnsubscribePresentityGroupMembersPresence_L() + { + EUNIT_PRINT( _L("Error from plug-in in presentity group members presence unsubscribe") ); + EUNIT_PRINT( _L("Plug-in leaves from UnsubscribeGroupMembersPresence().") ); + +// BIND AND SETUP + + BindL(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceWatching& presWatch = presFeat->PresenceWatching(); + +// SUBSCRIBE + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + + CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 ); + CPresenceInfoFilterImp* pif = XIMPTestPresenceDataUtils::GenerateInfoFilterLC( &KPrefix1 ); + + // register interest + TXIMPRequestId reqId = presWatch.SubscribePresentityGroupMembersPresenceL( *identity, *pif ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Subscribing presentity presence, complete with error: ") ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestSubscribePresentityGroupMembersPresesenceCalled, "SubscribePresentityPresenceL was not called", ETrue, "SubscribePresentityPresenceL was called" ); + +// UNSUBSCRIBE + + messenger->SetLeave( KErrAbort ); + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_PresentitySubscribeFailKErrAbort ); // allow events after reqcomplete + + // register interest + reqId = presWatch.UnsubscribePresentityGroupMembersPresenceL( *identity ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("UnSubscribing presentity presence, complete with error: ") ); + + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestUnsubscribePresentityGroupMembersPresesenceCalled, "UnsubscribePresentityGroupMembersPresenceL was not called", EFalse, + "UnsubscribePresentityGroupMembersPresenceL was called." ); + +// UNBIND + + CleanupStack::PopAndDestroy( pif ); + CleanupStack::PopAndDestroy( identity ); + + messenger->SetLeave( KErrNone ); + + UnbindL(); + } + + +void T_PresenceWatching::T_ContentChangePresentityGroupMembersPresence_Single_L() + { + EUNIT_PRINT( _L("Presentity group members content change") ); + + BindL(); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + // Tell the protocol it should act normally + messenger->SetNoError(); + + // Get the interfaces + MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); + MPresenceWatching& presWatch = presFeat->PresenceWatching(); + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + + CXIMPIdentityImp* identity = XIMPTestPresenceDataUtils::GenerateIdentityLC( &KNullDesC8 ); + CPresenceInfoFilterImp* pif = CPresenceInfoFilterImp::NewLC(); + + + // register interest + TXIMPRequestId reqId = presWatch.SubscribePresentityGroupMembersPresenceL( *identity, *pif ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestSubscribePresentityGroupMembersPresesenceCalled, "SubscribePresentityGroupMembersPresenceL was not called", ETrue, NULL ); + + +// TODO THINGSIES + // Get the interface + MPresencePublishing& presPub = presFeat->PresencePublishing(); + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); + + // register interest + reqId = presPub.SubscribeOwnPresenceL( *pif ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + + + + // Create member to grouplist we are interested in. + // 1. Create notification + RXIMPObjOwningPtrArray groupMemberList; + CleanupClosePushL( groupMemberList ); + CPresentityGroupMemberInfoImp* info = CPresentityGroupMemberInfoImp::NewLC( *identity, KNullDesC ); + User::LeaveIfError( groupMemberList.Append( info ) ); + CleanupStack::Pop(); //info + HBufC8* packedId = TXIMPObjectPacker< CXIMPIdentityImp >::PackL( *identity ); + CleanupStack::PushL( packedId ); + HBufC8* packedArray = TXIMPObjectPacker::PackArrayL( groupMemberList ); + CleanupStack::PushL( packedArray ); + RPointerArray< HBufC8 > bufferArray; + CleanupClosePushL( bufferArray ); + bufferArray.AppendL( packedId ); + bufferArray.AppendL( packedArray ); + HBufC8* packedBufferArray = TXIMPHBuf8Packer::PackArrayL( bufferArray ); + CleanupStack::PopAndDestroy( 4 ); // packedId, bufferArray, packedArray, groupMemberList + CleanupStack::PushL( packedBufferArray ); + + // 2. Use filetool to send it for plugin. + CXIMPTestFileSrvMsg* srvMsg = CXIMPTestFileSrvMsg::NewL( CXIMPTestFileSrvMsg::ETestSrvMsgPresentityGroupMemberList, + *packedBufferArray ); + CleanupStack::PopAndDestroy( packedBufferArray ); + CleanupStack::PushL( srvMsg ); + wrapper->FileTool().CleanAllL(); + wrapper->FileTool().SrvMsgStoreL( srvMsg ); + CleanupStack::PopAndDestroy( srvMsg ); + + // 3. Send data to member + CPresenceInfoImp* presenceInfo = CPresenceInfoImp::NewLC(); + HBufC8* packedInfo = TXIMPObjectPacker< CPresenceInfoImp >::PackL( *presenceInfo ); + CleanupStack::PopAndDestroy( presenceInfo ); + CleanupStack::PushL( packedInfo ); + packedId = TXIMPObjectPacker< CXIMPIdentityImp >::PackL( *identity ); + CleanupStack::PushL( packedId ); + CleanupClosePushL( bufferArray ); + bufferArray.AppendL( packedId ); + bufferArray.AppendL( packedInfo ); + packedBufferArray = TXIMPHBuf8Packer::PackArrayL( bufferArray ); + CleanupStack::PopAndDestroy( 3, packedInfo ); // packedId, packedInfo + CleanupStack::PushL( packedBufferArray ); + + // 4. Use filetool to send it for plugin. + srvMsg = CXIMPTestFileSrvMsg::NewL( CXIMPTestFileSrvMsg::ETestSrvMsgPresentityPresence, + *packedBufferArray ); + CleanupStack::PopAndDestroy( packedBufferArray ); + CleanupStack::PushL( srvMsg ); + wrapper->FileTool().SrvMsgStoreL( srvMsg ); + CleanupStack::PopAndDestroy( srvMsg ); + + // Wait for event + // 5. Wait for event. + SetupListenerReqCompleteL( wrapper, EXIMPTestStatusEvents_HandlePresentityPresence ); + // Wait for events + wrapper->WaitAnyEvent(); + wrapper->VerifyEventStackL( _L8("Handle presence watcher list. Wrong event occurred.") ); + + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); // allow events after reqcomplete + + // register interest + reqId = presPub.UnsubscribeOwnPresenceL(); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Subscribing own presence, complete with error: ") ); + +// TODO THINGSIES + + // Setup status event listener for RequestComplete + SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); // allow events after reqcomplete + + // register interest + reqId = presWatch.UnsubscribePresentityGroupMembersPresenceL( *identity ); + + // Wait for events on the request + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Subscribing presentity group members presence, complete with error: ") ); + // verify that UpdateInterest was called + COMMONASSERT( messenger, EXIMPPlgTestUnsubscribePresentityGroupMembersPresesenceCalled, "UnsubscribePresentityGroupMembersPresenceL was not called", ETrue, NULL ); + + CleanupStack::PopAndDestroy( 2, identity ); //pif, identity + + UnbindL(); + } + + +// =========================================================================== +// SETUP HELPERS FOR THE LISTENER +// =========================================================================== +// +void T_PresenceWatching::SetupListenerReqCompleteL( CXIMPTestContextWrapper* aWrapper, TXIMPTestStatusEventTemplate aEventType ) + { + RArray< TInt32 > array; + CleanupClosePushL( array ); + array.Append( MXIMPContextStateEvent::KInterfaceId ); + array.Append( MPresentityPresenceEvent::KInterfaceId ); + aWrapper->SetupListenerReqCompleteL( aEventType, &array ); + CleanupStack::PopAndDestroy(); // array + } + +void T_PresenceWatching::SetupListenerReqCompleteAllowEventsL( CXIMPTestContextWrapper* aWrapper, TXIMPTestStatusEventTemplate aEventType ) + { + RArray< TInt32 > array; + CleanupClosePushL( array ); + array.AppendL( MXIMPRequestCompleteEvent::KInterfaceId ); + array.AppendL( MXIMPContextStateEvent::KInterfaceId ); + array.AppendL( MPresentityPresenceEvent::KInterfaceId ); + aWrapper->SetupListenerReqCompleteL( aEventType, &array ); + CleanupStack::PopAndDestroy(); // array + } + +// =========================================================================== +// TEST CASE TABLE +// =========================================================================== +// +EUNIT_BEGIN_TEST_TABLE( + T_PresenceWatching, + "XIMP presence watching tests", + "MODULE" ) + +PRFW_DECORATED_TEST( + "Subscribe single presence", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_SubscribePresentityPresence_Single_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Subscribe single presence and handle the presence data with cache checking", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_SubscribeHandlePresentityPresence_Single_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Subscribe single presence change id", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_SubscribePresentityPresenceChangeId_Single_L, + Teardown ) + + +PRFW_DECORATED_TEST( + "Unsubscribe single presence", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_UnsubscribeNotSubscribedPresentityPresence_Single_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Unsubscribe multiple presence", + "", + "", + "FUNCTIONALITY", + SetupMultiple_L, + T_UnsubscribeNotSubscribedPresentityPresence_Multiple_L, + Teardown ) + + +PRFW_DECORATED_TEST( + "Error From Plugin -> Leave when presentity subscribe is called", + "", + "", + "ERROHANDLING", + Setup_L, + T_ErrFromPlg_LeaveOnSubscribePresentityPresence_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Error From Plugin -> Leave when presentity unsubscribe is called", + "", + "", + "ERROHANDLING", + Setup_L, + T_ErrFromPlg_LeaveOnUnsubscribePresentityPresence_L, + Teardown ) + + +PRFW_DECORATED_TEST( + "Subscribe multiple presence", + "", + "", + "FUNCTIONALITY", + SetupMultiple_L, + T_SubscribePresentityPresence_Multiple_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Subscribe group members single presence", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_SubscribePresentityGroupMembersPresence_Single_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Unsubscribe single group members presence", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_UnsubscribeNotSubscribedPresentityGroupMembersPresence_Single_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Unsubscribe multiple group members presence", + "", + "", + "FUNCTIONALITY", + SetupMultiple_L, + T_UnsubscribeNotSubscribedPresentityGroupMembersPresence_Multiple_L, + Teardown ) + + +PRFW_DECORATED_TEST( + "Subscribe multiple presence for group members", + "", + "", + "FUNCTIONALITY", + SetupMultiple_L, + T_SubscribeGroupMembersPresence_Multiple_L, + Teardown ) + + +PRFW_DECORATED_TEST( + "Error From Plugin -> Leave when presentity group members subscribe is called", + "", + "", + "ERROHANDLING", + Setup_L, + T_ErrFromPlg_LeaveOnSubscribePresentityGroupMembersPresence_L, + Teardown ) + +PRFW_DECORATED_TEST( + "Error From Plugin -> Leave when presentity group members unsubscribe is called", + "", + "", + "ERROHANDLING", + Setup_L, + T_ErrFromPlg_LeaveOnUnsubscribePresentityGroupMembersPresence_L, + Teardown ) + + +PRFW_DECORATED_TEST( + "Handle group members single presence", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_ContentChangePresentityGroupMembersPresence_Single_L, + Teardown ) + + +EUNIT_END_TEST_TABLE + + +// =========================================================================== +// TEST SUITE CONSTRUCTION +// =========================================================================== +// +EXPORT_C MEUnitTest* CreateTestSuiteL() + { + return T_PresenceWatching::NewL(); + } + + +// end of file diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/src/t_presencewatching/t_presencewatching.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/src/t_presencewatching/t_presencewatching.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,108 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework Test Code +* +*/ + +#ifndef T_PRESENCEWATCHING_H +#define T_PRESENCEWATCHING_H + +#include +#include +#include "prfwteststatuseventlistener.h" +#include "prfwtestmessaging.h" + +class CXIMPTestContextWrapper; +class CXIMPTestContextWrapperMgr; +class CXIMPTestMessenger; +class MPresenceCacheReader; + +/** + * XIMP Framework Eunit tests. + * + * Tests for XIMP session management services. + * + * @since S60 v4.0 + */ +class T_PresenceWatching : public CEUnitTestSuiteClass + { + +public: + static T_PresenceWatching* NewL(); + virtual ~T_PresenceWatching(); + + +private: + T_PresenceWatching(); + void ConstructL(); + + + +private: // Test case functions + + void Setup_L(); + void SetupMultiple_L(); + void BindL(); + void BindAllL(); + void Teardown(); + void UnbindL(); + void UnbindAllL(); + + void T_SubscribePresentityPresence_Single_L(); + void T_SubscribeHandlePresentityPresence_Single_L(); + void T_SubscribePresentityPresenceChangeId_Single_L(); + void T_UnsubscribeNotSubscribedPresentityPresence_Single_L(); + void T_UnsubscribeNotSubscribedPresentityPresence_Multiple_L(); + + void T_SubscribePresentityPresence_Multiple_L(); + void T_SubscribePresentityGroupMembersPresence_Single_L(); + void T_UnsubscribeNotSubscribedPresentityGroupMembersPresence_Single_L(); + void T_UnsubscribeNotSubscribedPresentityGroupMembersPresence_Multiple_L(); + void T_ContentChangePresentityGroupMembersPresence_Single_L(); + + void T_ErrFromPlg_LeaveOnSubscribePresentityPresence_L(); + void T_ErrFromPlg_LeaveOnSubscribePresentityGroupMembersPresence_L(); + void T_ErrFromPlg_LeaveOnUnsubscribePresentityPresence_L(); + void T_ErrFromPlg_LeaveOnUnsubscribePresentityGroupMembersPresence_L(); + + void T_SubscribeGroupMembersPresence_Multiple_L(); + +private: // Test helpers + + void SetupListenerReqCompleteL( CXIMPTestContextWrapper* aWrapper, TXIMPTestStatusEventTemplate aEventType ); + void SetupListenerReqCompleteAllowEventsL( CXIMPTestContextWrapper* aWrapper, TXIMPTestStatusEventTemplate aEventTypes ); + +private: // Test data + + /** + * Eunit test case table declaration. + */ + EUNIT_DECLARE_TEST_TABLE; + + // owned + CXIMPTestContextWrapperMgr* iWrapperMgr; + + MPresenceCacheReader* iMPresenceCacheReader; + }; + + +#endif // T_PRESENCEWATCHING_H + + + +// end of file + + + + diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/src/t_presencewatching/t_presencewatching.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/src/t_presencewatching/t_presencewatching.mmp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,59 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework Test Code +* +*/ + +#include "../../tsrcutils/eunitcommon/eunittstdllbase.hrh" +#include "../../tsrcutils/processmaster/pm.h" + +TARGET t_presencewatching.dll + +SOURCEPATH . +SOURCE t_presencewatching.cpp + + +USERINCLUDE ../../../core/srcdatamodel +USERINCLUDE ../../../presence/srcpresencedatamodel +USERINCLUDE ../../../presence/srcpresencedatamodel/presentitygroups +USERINCLUDE ../../../presence/srcpresencedatamodel/presencewatching +USERINCLUDE ../../../presence/srcpresencedatamodel/presenceauthorization +USERINCLUDE ../../../presence/srcpresencedatamodel/presencepublishing +USERINCLUDE ../../../presence/srcpresencedatamodel/presenceinfo +USERINCLUDE ../../../core/srcutils + +USERINCLUDE ../../tsrcprotocols + +// TODO remove unnecessary +SYSTEMINCLUDE ../../../inc/core/base +SYSTEMINCLUDE ../../../inc/core/datamodel +SYSTEMINCLUDE ../../../inc/core/protocolplugin +SYSTEMINCLUDE ../../../inc/core/protocolpluginhost +SYSTEMINCLUDE ../../../inc/presence/presencedatamodel +SYSTEMINCLUDE ../../../inc/presence/presencemanagement +SYSTEMINCLUDE ../../../inc/presence/presenceprotocolplugin +SYSTEMINCLUDE ../../../inc/presence/presenceprotocolpluginhost + + +LIBRARY ecom.lib +LIBRARY bafl.lib +LIBRARY ximpdatamodel.lib +LIBRARY estor.lib +LIBRARY presencedatamodel.lib +LIBRARY ximputils.lib + + +// end of file + + diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/src/t_rootservices/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/src/t_rootservices/bld.inf Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,23 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Build information file for t_rootservices.dll +* +*/ + + +PRJ_PLATFORMS +DEFAULT + +PRJ_TESTMMPFILES +t_rootservices.mmp diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/src/t_rootservices/t_rootservices.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/src/t_rootservices/t_rootservices.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,221 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework Test Code +* +*/ + +#include "t_rootservices.h" + +#include "eunittools.h" +#include +#include +#include + +//XIMP headers +#include +#include +#include +#include + +#include "prfwtestrobustnesstools.h" +#include "prfwtestprotocols.h" + + + +// ============================ MEMBER FUNCTIONS =============================== + +// CONSTRUCTION +T_RootServices* T_RootServices::NewL() + { + T_RootServices* self = new( ELeave ) T_RootServices; + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + + return self; + } + + +T_RootServices::~T_RootServices() + { + } + + +void T_RootServices::ConstructL() + { + CEUnitTestSuiteClass::ConstructL(); + } + + +T_RootServices::T_RootServices() + { + } + + + +// =========================================================================== +// TEST CASE SETUP & TEARDOWN METHODS +// =========================================================================== +// +void T_RootServices::Setup_L() + { + PrfwTestRobustness::DoPreCleaning(); + } + + + +void T_RootServices::Teardown() + { + REComSession::FinalClose(); + PrfwTestRobustness::DoPreCleaning(); + } + + + +// =========================================================================== +// USAGE SCENARIO: +// +// =========================================================================== +// +void T_RootServices::Test_ListProtocolsAndTheirCapabilities_L() + { + //Initialize XIMP client + MXIMPClient* presClient = MXIMPClient::NewClientL(); + CleanupDeletePushL( presClient ); + + RXIMPObjOwningPtrArray< MXIMPProtocolInfo > protocolList; + CleanupClosePushL( protocolList ); + + //List & dump all available protocols + presClient->GetProtocolsL( protocolList ); + __DumpProtocolListL( protocolList ); + + //Verify that atleast main test protocol exist in list + //And for it is reported corect properties + TBool mainTestProtocolFound( EFalse ); + for ( TInt index( 0 ); index < protocolList.Count(); index++ ) + { + MXIMPProtocolInfo& protocol = *protocolList[ index ]; + if (protocol.DisplayName() == K_PRFW_TST_PROTOCOL_1_DISPLAY_NAME ) + { + if ( protocol.ImplementationUid() == TUid::Uid( K_PRFW_TST_PROTOCOL_1_IMPLEMENTATION_UID ) ) + { + mainTestProtocolFound = ETrue; + break; + } + } + } + + EUNIT_ASSERT_DESC( mainTestProtocolFound, "Primary test protocol not found." ); + + CleanupStack::PopAndDestroy(); //protocolList + CleanupStack::PopAndDestroy(); //presClient + } + + + + +// =========================================================================== +// HELPERS +// =========================================================================== +// +void T_RootServices::__DumpProtocolListL( + RXIMPObjOwningPtrArray< MXIMPProtocolInfo >& aProtocolList ) + { + const TInt count = aProtocolList.Count(); + EUNIT_PRINT( _L( "Dumping %d protocols:"), count ); + + //Iterate through the list of protocols and dump details + for( TInt ix = 0; ix < count; ix++ ) + { + MXIMPProtocolInfo& protocol = *aProtocolList[ ix ]; + MXIMPFeatureInfo* feats = protocol.GetProtocolFeaturesLC(); + + { + TBuf< 1000 > buffer; + + //Print protocol details + buffer.AppendFormat( _L(" Protocol %d: [%08x] [%S]"), + ix, + protocol.ImplementationUid(), + &protocol.DisplayName() ); + EUNIT_PRINT( buffer ); + + + //Print feature details + const MDesC8Array& featureIds = feats->FeatureIds(); + + const TInt featCount = featureIds.MdcaCount(); + buffer.Zero(); + buffer.AppendFormat( _L(" Supported features %d: "), featCount ); + + for( TInt ix = 0; ix < featCount; ix++ ) + { + TBuf< 50 > tmpBuf; + tmpBuf.Copy( featureIds.MdcaPoint( ix ) ); + buffer.AppendFormat( _L("%S "), &tmpBuf ); + } + + EUNIT_PRINT( buffer ); + } + + CleanupStack::PopAndDestroy(); //feats + } + } + + + + +// =========================================================================== +// TEST CASE TABLE +// =========================================================================== +// +EUNIT_BEGIN_TEST_TABLE( + T_RootServices, + "XIMP root services", + "MODULE" ) + + PRFW_NOT_DECORATED_TEST( + "List available protocols and their capabilities", + "", + "", + "FUNCTIONALITY", + Setup_L, + Test_ListProtocolsAndTheirCapabilities_L, + Teardown ) + + +EUNIT_END_TEST_TABLE + + + + + +// =========================================================================== +// TEST SUITE CONSTRUCTION +// =========================================================================== +// +EXPORT_C MEUnitTest* CreateTestSuiteL() + { + return T_RootServices::NewL(); + } + + +// end of file + + + + + + diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/src/t_rootservices/t_rootservices.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/src/t_rootservices/t_rootservices.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,85 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework Test Code +* +*/ + +#ifndef T_ROOTSERVICES_H__ +#define T_ROOTSERVICES_H__ + +#include +#include + +class MXIMPProtocolInfo; +class MXIMPClient; +class MXIMPContext; +class CUSContextObserver; + + +/** + * XIMP Framework Eunit tests. + * + * Tests for XIMP root services. + * + * @since S60 v3.2 + */ +class T_RootServices : public CEUnitTestSuiteClass + { +public: + static T_RootServices* NewL(); + virtual ~T_RootServices(); + + +private: + T_RootServices(); + void ConstructL(); + + + +private: // Test case functions + + void Setup_L(); + void Teardown(); + + void Test_ListProtocolsAndTheirCapabilities_L(); + + +private: // Test helpers + + void __DumpProtocolListL( + RXIMPObjOwningPtrArray< MXIMPProtocolInfo >& aProtocolList ); + + + +private: // Test data + + + /** + * Eunit test case table declaration. + */ + EUNIT_DECLARE_TEST_TABLE; + + + }; + + +#endif // T_ROOTSERVICES_H__ + + + +// end of file + + + + diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/src/t_rootservices/t_rootservices.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/src/t_rootservices/t_rootservices.mmp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,43 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework Test Code +* +*/ + +#include "../../tsrcutils/eunitcommon/eunittstdllbase.hrh" +#include "../../tsrcutils/processmaster/pm.h" + +TARGET t_rootservices.dll + +SOURCEPATH . +SOURCE t_rootservices.cpp + +USERINCLUDE ../../../core/srcdatamodel +USERINCLUDE ../../../presence/srcpresencedatamodel +USERINCLUDE ../../../presence/srcpresencedatamodel/presentitygroups +USERINCLUDE ../../../presence/srcpresencedatamodel/presencewatching +USERINCLUDE ../../../presence/srcpresencedatamodel/presenceauthorization +USERINCLUDE ../../../presence/srcpresencedatamodel/presencepublishing +USERINCLUDE ../../../presence/srcpresencedatamodel/presenceinfo +USERINCLUDE ../../../core/srcutils + + +USERINCLUDE ../../tsrcprotocols + +LIBRARY ecom.lib +LIBRARY bafl.lib + +// end of file + + diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/src/t_sessionmng/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/src/t_sessionmng/bld.inf Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,23 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Build information file for t_sessionmng.dll +* +*/ + + +PRJ_PLATFORMS +DEFAULT + +PRJ_TESTMMPFILES +t_sessionmng.mmp diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/src/t_sessionmng/t_sessionmng.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/src/t_sessionmng/t_sessionmng.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,872 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework Test Code +* +*/ + +#include +#include +#include +#include + +#include "t_sessionmng.h" +#include "prfwteststatuseventlistener.h" +#include "prfwtestmessaging.h" +#include "prfwtestmessenger.h" +#include "prfwtestcontextwrappermgr.h" +#include "prfwtestcontextwrapper.h" +#include "prfwtestfiletool.h" +#include "userafter.h" + +#include "eunittools.h" +#include "prfwtestrobustnesstools.h" +#include "prfwtestprotocols.h" + +#include +#include +#include +#include +#include +#include +#include + + + + + + + +// ============================ MEMBER FUNCTIONS =============================== + +// CONSTRUCTION +T_SessionMng* T_SessionMng::NewL() + { + T_SessionMng* self = new( ELeave ) T_SessionMng; + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + + return self; + } + + +T_SessionMng::~T_SessionMng() + { + delete iWrapperMgr; + + CXIMPTestFileTool::CleanAllL(); + } + + +void T_SessionMng::ConstructL() + { + CEUnitTestSuiteClass::ConstructL(); + CXIMPTestFileTool::CleanAllL(); + } + + +T_SessionMng::T_SessionMng() + { + } + + + +// =========================================================================== +// TEST CASE SETUP & TEARDOWN METHODS +// =========================================================================== +// + +void T_SessionMng::Setup_L() + { + PrfwTestRobustness::DoPreCleaning(); + + // now we're using only one connection + iWrapperMgr = CXIMPTestContextWrapperMgr::NewL(); + iWrapperMgr->CreateWrapperL(); + } + + +void T_SessionMng::Setup_2_L() + { + iWrapperMgr = CXIMPTestContextWrapperMgr::NewL(); + + // two wrappers + iWrapperMgr->CreateWrapperL(); + iWrapperMgr->CreateWrapperL(); + } + + +void T_SessionMng::Setup_3_L() + { + iWrapperMgr = CXIMPTestContextWrapperMgr::NewL(); + + // three wrappers for unbalanced bind/share unbind/unshare test + iWrapperMgr->CreateWrapperL(); + iWrapperMgr->CreateWrapperL(); + iWrapperMgr->CreateWrapperL(); + } + + +void T_SessionMng::Teardown() + { + delete iWrapperMgr; + iWrapperMgr = NULL; + + REComSession::FinalClose(); + + PrfwTestRobustness::DoPreCleaning(); + } + + + +// =========================================================================== +// TEST CASE +// =========================================================================== +void T_SessionMng::T_Simple_Bind_Wait_Unbind_L() + { + EUNIT_PRINT( _L("Simple context Bind/Unbind test.") ); + EUNIT_PRINT( _L("Client side waits bind completion before issuing unbind.") ); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestStatusEventListener* eventListener = wrapper->GetEventListener(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + //Do bind, wait and verify events + wrapper->SetupListenerL( EXIMPTestStatusEvents_BindingOk ); + + messenger->SetPluginIndex( 0 ); + messenger->SetNoError(); + + TXIMPRequestId reqId; + reqId = BindContextToDefaultL( context ); + EUNIT_ASSERT( reqId != TXIMPRequestId::Null() ); + + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Binding single context: ") ); + + messenger->AssertOpenSessionCalled( ETrue ); + + //Verify features availability + MXIMPFeatureInfo* ctxFeats = context->GetContextFeaturesLC(); + EUNIT_ASSERT_DESC( ctxFeats->FeatureIds().MdcaCount() > 0, "No features from context" ); + CleanupStack::PopAndDestroy(); //ctxFeats + + //Do unbind, wait and verify events + wrapper->SetupListenerL( EXIMPTestStatusEvents_UnbindingOk ); + messenger->SetNoError(); + reqId = context->UnbindL(); + EUNIT_ASSERT( reqId != TXIMPRequestId::Null() ); + + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Unbinding single context: ") ); + + messenger->AssertCloseSessionCalled( ETrue ); + messenger->AssertPluginDied( ETrue ); + } + +// =========================================================================== +// TEST CASE +// =========================================================================== +void T_SessionMng::T_Settings_Bind_Wait_Unbind_L() + { + EUNIT_PRINT( _L("Context Bind with Settings id/Unbind test.") ); + EUNIT_PRINT( _L("Client side waits bind completion before issuing unbind.") ); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestStatusEventListener* eventListener = wrapper->GetEventListener(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + //Do bind, wait and verify events + wrapper->SetupListenerL( EXIMPTestStatusEvents_BindingOk ); + + messenger->SetPluginIndex( 0 ); + messenger->SetNoError(); + + TXIMPRequestId reqId; + TUid protocol = { K_PRFW_TST_PROTOCOL_1_IMPLEMENTATION_UID }; + reqId = context->BindToL( protocol, 0 ); + + EUNIT_ASSERT( reqId != TXIMPRequestId::Null() ); + + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Binding single context: ") ); + + messenger->AssertOpenSessionCalled( ETrue ); + + //Verify features availability + MXIMPFeatureInfo* ctxFeats = context->GetContextFeaturesLC(); + EUNIT_ASSERT_DESC( ctxFeats->FeatureIds().MdcaCount() > 0, "No features from context" ); + CleanupStack::PopAndDestroy(); //ctxFeats + + //Do unbind, wait and verify events + wrapper->SetupListenerL( EXIMPTestStatusEvents_UnbindingOk ); + messenger->SetNoError(); + reqId = context->UnbindL(); + EUNIT_ASSERT( reqId != TXIMPRequestId::Null() ); + + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Unbinding single context: ") ); + + messenger->AssertCloseSessionCalled( ETrue ); + messenger->AssertPluginDied( ETrue ); + } + + +// =========================================================================== +// TEST CASE +// =========================================================================== +void T_SessionMng::T_Simple_Bind_Wait_OOM_L() + { + EUNIT_PRINT( _L("Simple context Bind OOM test.") ); + EUNIT_PRINT( _L("Client side waits bind completion in alloc heaven.") ); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + //Do bind, wait and verify events + wrapper->SetupListenerReqCompleteL( EXIMPTestStatusEvents_RequestOk ); + + messenger->SetPluginIndex( 0 ); + messenger->SetNoError(); + + TXIMPRequestId reqId; + reqId = BindContextToDefaultL( context ); + EUNIT_ASSERT( reqId != TXIMPRequestId::Null() ); + + wrapper->WaitRequestAndStackEvents( reqId ); + + CXIMPTestStatusEventListener* eventListener = wrapper->GetEventListener(); + TInt reqCompleteErr = eventListener->GetReqCompletionErrL( reqId ); + User::LeaveIfError( reqCompleteErr ); + + wrapper->VerifyEventStackL( _L8("Binding single context in OOM: ") ); + } + + +// =========================================================================== +// TEST CASE +// =========================================================================== +void T_SessionMng::T_Simple_Bind_Wait_Unbind_WithReqCompleteEventFilter_L() + { + EUNIT_PRINT( _L("Simple context Bind/Unbind test.") ); + EUNIT_PRINT( _L("Client side waits bind completion before issuing unbind.") ); + EUNIT_PRINT( _L("Client event filter accepts only request completion events") ); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestStatusEventListener* eventListener = wrapper->GetEventListener(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + //Accept only ReqComplete events + wrapper->SetupListenerReqCompleteL( EXIMPTestStatusEvents_RequestOk ); + + messenger->SetPluginIndex( 0 ); + messenger->SetNoError(); + + + //Do bind, wait and verify events + TXIMPRequestId reqId = BindContextToDefaultL( context ); + + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Binding single context, accepting only reqComplete events: ") ); + messenger->AssertOpenSessionCalled( ETrue ); + + + //Accept only ReqComplete events + wrapper->SetupListenerReqCompleteL( EXIMPTestStatusEvents_RequestOk ); + messenger->SetNoError(); + + //Do unbind, wait and verify events + reqId = context->UnbindL(); + + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Unbinding single context, accepting only reqComplete events: ") ); + + messenger->AssertCloseSessionCalled( ETrue ); + } + + + +// =========================================================================== +// TEST CASE +// =========================================================================== +// +void T_SessionMng::T_Simple_Bind_Wait_CloseHandle_L() + { + EUNIT_PRINT( _L("Simple context Bind/CloseHandle test.") ); + EUNIT_PRINT( _L("Client side waits bind completion before closing the handle.") ); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestStatusEventListener* eventListener = wrapper->GetEventListener(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + //Do bind, wait and verify events + wrapper->SetupListenerL( EXIMPTestStatusEvents_BindingOk ); + + messenger->SetPluginIndex( 0 ); + messenger->SetNoError(); + + TXIMPRequestId reqId = BindContextToDefaultL( context ); + + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Binding single context: ") ); + + messenger->AssertOpenSessionCalled( ETrue ); + + + //Close handle and verify events + wrapper->ClearListener(); + messenger->SetNoError(); + wrapper->DeletePresenceContext(); + + + // we give 10 sec to plugin to die + CUserAfter::AfterSecondsL( 10 ); + + + messenger->AssertCloseSessionCalled( ETrue ); + messenger->AssertPluginDied( ETrue ); + + wrapper->VerifyEventStackL( _L8("Closing single context handle: ") ); + } + + + +// =========================================================================== +// TEST CASE +// =========================================================================== +// +void T_SessionMng::T_Simple_Bind_Direct_Unbind_L() + { + EUNIT_PRINT( _L("Simple context Bind/Unbind test.") ); + EUNIT_PRINT( _L("Client side deletes context while the binding is still active.") ); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestStatusEventListener* eventListener = wrapper->GetEventListener(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + wrapper->SetupListenerL( EXIMPTestStatusEvents_BindingOk ); + wrapper->AppendToTraitsL( EXIMPTestStatusEvents_UnbindingOk ); + + + messenger->SetPluginIndex( 0 ); + messenger->SetNoError(); //For binding + + + TXIMPRequestId bindReqId = BindContextToDefaultL( context ); + + + messenger->AssertOpenSessionCalled( ETrue ); + + messenger->SetNoError(); // for unbinding + TXIMPRequestId unbindReqId = context->UnbindL(); + + wrapper->WaitRequestAndStackEvents( bindReqId ); + wrapper->WaitRequestAndStackEvents( unbindReqId ); + + wrapper->VerifyEventStackL( _L8("Direct Bind/Unbind single context: ") ); + + messenger->AssertCloseSessionCalled( ETrue ); + messenger->AssertPluginDied( ETrue ); + } + + + + +// =========================================================================== +// TEST CASE +// =========================================================================== +// +void T_SessionMng::T_Simple_Bind_Direct_CloseHandle_L() + { + EUNIT_PRINT( _L("Simple context Bind/Unbind test.") ); + EUNIT_PRINT( _L("Client side closes context handle while the binding is still active.") ); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestStatusEventListener* eventListener = wrapper->GetEventListener(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + + messenger->SetPluginIndex( 0 ); + messenger->SetNoError(); + + + TXIMPRequestId reqId = BindContextToDefaultL( context ); + + messenger->AssertOpenSessionCalled( ETrue ); + wrapper->DeletePresenceContext(); + + // wait for plugin to die properly here + CUserAfter::AfterSecondsL( 10 ); + + messenger->AssertCloseSessionCalled( ETrue ); + messenger->AssertPluginDied( ETrue ); + } + + + + +// =========================================================================== +// TEST CASE +// =========================================================================== +// +void T_SessionMng::T_ErrFromPlg_LeaveOnOpenSession_L() + { + EUNIT_PRINT( _L("Error from plug-in in bind/unbind." ) ); + EUNIT_PRINT( _L("Plug-in leaves from OpenSessionL()." ) ); + + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestStatusEventListener* eventListener = wrapper->GetEventListener(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + { + wrapper->SetupListenerL( EXIMPTestStatusEvents_BindingFailKErrAbort ); + messenger->SetLeave( KErrAbort ); + messenger->SetPluginIndex( 0 ); + + TXIMPRequestId reqId = BindContextToDefaultL( context ); + + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Binding single context: ") ); + + //Verify that features are not available + TRAPD( featLoadErr, + MXIMPFeatureInfo* ctxFeats = context->GetContextFeaturesLC(); + CleanupStack::PopAndDestroy(); //ctxFeats + ); + EUNIT_ASSERT_NOT_EQUALS( featLoadErr, KErrNone ); + + // plugin should've been unloaded without calling CloseSession + EUNIT_ASSERT_DESC( ! messenger->GetBoolean( EXIMPPlgTestCloseSessionCalled ), "CloseSession was called" ); + + messenger->AssertPluginDied( ETrue ); + } + } + + +// =========================================================================== +// TEST CASE: +// =========================================================================== +// +void T_SessionMng::T_ErrFromPlg_ErrorResultOnOpenSession_L() + { + EUNIT_PRINT( _L("Error from plug-in in bind/unbind") ); + EUNIT_PRINT( _L("Plug-in completes OpenSessionL() with error") ); + EUNIT_PRINT( _L("Clint ctx can be reused for second bind.") ); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestStatusEventListener* eventListener = wrapper->GetEventListener(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + { + wrapper->SetupListenerL( EXIMPTestStatusEvents_BindingFailKErrAbort ); + + messenger->SetError( KErrAbort ); + + messenger->SetPluginIndex( 0 ); + + TXIMPRequestId reqId = BindContextToDefaultL( context ); + + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Binding single context: ") ); + + + // plugin should've been unloaded without calling CloseSession + EUNIT_ASSERT_DESC( ! messenger->GetBoolean( EXIMPPlgTestCloseSessionCalled ), "CloseSession was called" ); + messenger->AssertPluginDied( ETrue ); + } + + + //It should be possible to reuse client ctx for second bind + { + //Do bind, wait and verify events + wrapper->SetupListenerL( EXIMPTestStatusEvents_BindingOk ); + + messenger->SetPluginIndex( 0 ); + messenger->SetNoError(); + + TXIMPRequestId reqId; + reqId = BindContextToDefaultL( context ); + EUNIT_ASSERT( reqId != TXIMPRequestId::Null() ); + + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Binding single context: ") ); + + messenger->AssertOpenSessionCalled( ETrue ); + + //Verify features availability + MXIMPFeatureInfo* ctxFeats = context->GetContextFeaturesLC(); + EUNIT_ASSERT_DESC( ctxFeats->FeatureIds().MdcaCount() > 0, "No features from context" ); + CleanupStack::PopAndDestroy(); //ctxFeats + + //Do unbind, wait and verify events + wrapper->SetupListenerL( EXIMPTestStatusEvents_UnbindingOk ); + messenger->SetNoError(); + reqId = context->UnbindL(); + EUNIT_ASSERT( reqId != TXIMPRequestId::Null() ); + + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Unbinding single context: ") ); + + messenger->AssertCloseSessionCalled( ETrue ); + messenger->AssertPluginDied( ETrue ); + } + } + + +// =========================================================================== +// TEST CASE: +// Simple bind, bind error +// =========================================================================== +// +void T_SessionMng::T_ErrFromPlg_InvalidReqIdOnOpenSession_L() + { + EUNIT_PRINT( _L("Error from plug-in in bind/unbind") ); + EUNIT_PRINT( _L("Plug-in completes OpenSessionL() with faulty ReqId") ); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestStatusEventListener* eventListener = wrapper->GetEventListener(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + { + wrapper->SetupListenerL( EXIMPTestStatusEvents_BindingFailInvalidReqId ); + messenger->SetBoolean( EXIMPTestPlgBehaveInvalidReqId ); + messenger->SetPluginIndex( 0 ); + + TXIMPRequestId reqId = BindContextToDefaultL( context ); + + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Binding single context: ") ); + } + + } + + + +// =========================================================================== +// TEST CASE: +// =========================================================================== +// +void T_SessionMng::T_ErrFromPlg_ErrorResultOnCloseSession_L() + { + EUNIT_PRINT( _L("Error from plug-in in bind/unbind") ); + EUNIT_PRINT( _L("Plug-in completes CloseSession() with error") ); + + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestStatusEventListener* eventListener = wrapper->GetEventListener(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + //Do bind, wait and verify events + wrapper->SetupListenerL( EXIMPTestStatusEvents_BindingOk ); + + messenger->SetNoError(); + + messenger->SetPluginIndex( 0 ); + + TXIMPRequestId reqId = BindContextToDefaultL( context ); + + + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Binding single context: ") ); + + messenger->AssertOpenSessionCalled( ETrue ); + + //Do unbind, wait and verify events + wrapper->SetupListenerL( EXIMPTestStatusEvents_UnbindingOk ); + + messenger->SetError( KErrCouldNotDisconnect ); + reqId = context->UnbindL(); + + wrapper->WaitRequestAndStackEvents( reqId ); + wrapper->VerifyEventStackL( _L8("Unbinding single context: ") ); + + messenger->AssertPluginDied( ETrue ); + } + + + + + +// =========================================================================== +// TEST CASE +// =========================================================================== +// +void T_SessionMng::T_Multi_Bind_Unbind_WithWaits_L() + { + EUNIT_PRINT( _L("Multiple context Bind/Unbind test.") ); + EUNIT_PRINT( _L("Client performs multiple bind & unbinds for a separated context sharing a connection.") ); + + TInt ix; + + // bind contexts + for ( ix = 0; ix < 3; ix++ ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( ix ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestStatusEventListener* eventListener = wrapper->GetEventListener(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + if ( ix == 1 ) + { + // fail the middle one + wrapper->SetupListenerL( EXIMPTestStatusEvents_BindingFailKErrAbort ); + messenger->SetError( KErrAbort ); // for binding + } + else + { + wrapper->SetupListenerL( EXIMPTestStatusEvents_BindingOk ); + messenger->SetNoError(); // for binding + } + + messenger->SetPluginIndex( ix ); + + TUid protocol = { K_PRFW_TST_PROTOCOL_1_IMPLEMENTATION_UID }; + const TDesC16& instanceId = wrapper->InstanceId(); + TXIMPRequestId reqId = context->BindToL( protocol, + _L("www.imps.no/wv"), + _L("user"), + _L("password"), + instanceId, + ix ); + + wrapper->WaitRequestAndStackEvents( reqId ); + + TBuf8<100> title; + title.AppendFormat( _L8("Bind [%d]: "), ix ); + wrapper->VerifyEventStackL( title ); + + switch ( ix ) + { + case 0 : + case 1 : + case 2 : + { + messenger->AssertOpenSessionCalled( ETrue ); + break; + } + default : + { + break; + } + } + } + + + // now context has been bound. + // one has failed, but two are okay. do 3 unbinds. + for( ix = 0; ix < 3; ix++ ) + { + CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( ix ); + MXIMPContext* context = wrapper->GetContext(); + CXIMPTestStatusEventListener* eventListener = wrapper->GetEventListener(); + CXIMPTestMessenger* messenger = wrapper->GetMessenger(); + + if ( ix == 1 ) + { + // the middle one has failed + TRAPD( err, context->UnbindL() ); + EUNIT_ASSERT_EQUALS( err, KErrNotReady ); + } + + else + { + // we expect all unbinds to be okay from client point of view + wrapper->SetupListenerL( EXIMPTestStatusEvents_UnbindingOk ); + messenger->SetNoError(); // For unbinding + + TXIMPRequestId reqId = context->UnbindL(); + wrapper->WaitRequestAndStackEvents( reqId ); + + TBuf8<100> title; + title.AppendFormat( _L8("Unbind [%d]: "), ix ); + wrapper->VerifyEventStackL( title ); + messenger->AssertCloseSessionCalled( ETrue ); + } + } + } + + +TXIMPRequestId T_SessionMng::BindContextToDefaultL( MXIMPContext* aContext ) + { + TUid protocol = { K_PRFW_TST_PROTOCOL_1_IMPLEMENTATION_UID }; + return aContext->BindToL( protocol, + _L("www.imps.no/wv"), + _L("user"), + _L("password"), + 0 ); + } + + + +// =========================================================================== +// TEST CASE TABLE +// =========================================================================== +// +EUNIT_BEGIN_TEST_TABLE( + T_SessionMng, + "XIMP session management tests", + "MODULE" ) + + +PRFW_NOT_DECORATED_TEST( + "Simple bind wait unbind", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_Simple_Bind_Wait_Unbind_L, + Teardown ) + + PRFW_NOT_DECORATED_TEST( + "Settings bind wait unbind", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_Settings_Bind_Wait_Unbind_L, + Teardown ) + +EUNIT_ALLOC_TEST( + "Simple bind in OOM", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_Simple_Bind_Wait_OOM_L, + Teardown ) + + +PRFW_NOT_DECORATED_TEST( + "Simple bind wait unbind with reqComplete event filter", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_Simple_Bind_Wait_Unbind_WithReqCompleteEventFilter_L, + Teardown ) + +PRFW_NOT_DECORATED_TEST( + "Simple bind wait close handle", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_Simple_Bind_Wait_CloseHandle_L, + Teardown ) + + +PRFW_NOT_DECORATED_TEST( + "Simple bind direct unbind", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_Simple_Bind_Direct_Unbind_L, + Teardown ) + + +PRFW_NOT_DECORATED_TEST( + "Simple bind direct close handle", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_Simple_Bind_Direct_CloseHandle_L, + Teardown ) + + +// opensession errors +PRFW_NOT_DECORATED_TEST( + "ErrFromPlg leave OpenSession", + "", + "", + "ERROHANDLING", + Setup_L, + T_ErrFromPlg_LeaveOnOpenSession_L, + Teardown ) + +PRFW_NOT_DECORATED_TEST( + "ErrFromPlg OpenSession", + "", + "", + "ERROHANDLING", + Setup_L, + T_ErrFromPlg_ErrorResultOnOpenSession_L, + Teardown ) + + + +PRFW_NOT_DECORATED_TEST( + "ErrFromPlg Invalid ReqId", + "", + "", + "ERROHANDLING", + Setup_L, + T_ErrFromPlg_InvalidReqIdOnOpenSession_L, + Teardown ) + + +// closesession errors +PRFW_NOT_DECORATED_TEST( + "ErrFromPlg CloseSession", + "", + "", + "ERROHANDLING", + Setup_L, + T_ErrFromPlg_ErrorResultOnCloseSession_L, + Teardown ) + + +// multiple bind + unbind tests +PRFW_NOT_DECORATED_TEST( + "Multiple context Bind/Unbind test.", + "", + "", + "ERROHANDLING", + Setup_3_L, + T_Multi_Bind_Unbind_WithWaits_L, + Teardown ) + + +EUNIT_END_TEST_TABLE + + +// =========================================================================== +// TEST SUITE CONSTRUCTION +// =========================================================================== +// +EXPORT_C MEUnitTest* CreateTestSuiteL() + { + return T_SessionMng::NewL(); + } + + +// end of file + + + + + + diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/src/t_sessionmng/t_sessionmng.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/src/t_sessionmng/t_sessionmng.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,110 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework Test Code +* +*/ + +#ifndef T_SESSIONMNG_H__ +#define T_SESSIONMNG_H__ + +#include +#include + +#include "prfwteststatuseventlistener.h" + + +class CXIMPTestContextWrapperMgr; +class MXIMPContext; + +/** + * XIMP Framework Eunit tests. + * + * Tests for XIMP session management services. + * + * @since S60 v4.0 + */ +class T_SessionMng : public CEUnitTestSuiteClass + { + +public: + static T_SessionMng* NewL(); + virtual ~T_SessionMng(); + + +private: + T_SessionMng(); + void ConstructL(); + + + +private: // Test case functions + + void Teardown(); + + void Setup_L(); + void Setup_2_L(); + void Setup_3_L(); + + + void T_Simple_Bind_Wait_Unbind_L(); + void T_Settings_Bind_Wait_Unbind_L(); + void T_Simple_Bind_Wait_OOM_L(); + + void T_Simple_Bind_Wait_Unbind_WithReqCompleteEventFilter_L(); + void T_Simple_Bind_Wait_CloseHandle_L(); + void T_Simple_Bind_Direct_Unbind_L(); + void T_Simple_Bind_Direct_CloseHandle_L(); + + + + void T_ErrFromPlg_LeaveOnOpenSession_L(); + void T_ErrFromPlg_ErrorResultOnOpenSession_L(); + void T_ErrFromPlg_ErrorResultOnCloseSession_L(); + + void T_ErrFromPlg_InvalidReqIdOnOpenSession_L(); + void T_Multi_Bind_Unbind_WithWaits_L(); + + + +private: // Test helpers + + TXIMPRequestId BindContextToDefaultL( MXIMPContext* aContext ); + + + + + +private: // Test data + + /** + * Eunit test case table declaration. + */ + EUNIT_DECLARE_TEST_TABLE; + + /** + * Context Wrapper Manager + */ + CXIMPTestContextWrapperMgr* iWrapperMgr; + + }; + +#endif // T_SESSIONMNG_H__ + + + +// end of file + + + + diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/src/t_sessionmng/t_sessionmng.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/src/t_sessionmng/t_sessionmng.mmp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,44 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework Test Code +* +*/ + +#include "../../tsrcutils/eunitcommon/eunittstdllbase.hrh" +#include "../../tsrcutils/processmaster/pm.h" + +TARGET t_sessionmng.dll + +SOURCEPATH . +SOURCE t_sessionmng.cpp + +USERINCLUDE ../../../core/srcdatamodel +USERINCLUDE ../../../presence/srcpresencedatamodel +USERINCLUDE ../../../presence/srcpresencedatamodel/presentitygroups +USERINCLUDE ../../../presence/srcpresencedatamodel/presencewatching +USERINCLUDE ../../../presence/srcpresencedatamodel/presenceauthorization +USERINCLUDE ../../../presence/srcpresencedatamodel/presencepublishing +USERINCLUDE ../../../presence/srcpresencedatamodel/presenceinfo +USERINCLUDE ../../../core/srcutils +USERINCLUDE ../../tsrcprotocols + + +LIBRARY ecom.lib +LIBRARY bafl.lib +LIBRARY ximpdatamodel.lib +LIBRARY presencedatamodel.lib + +// end of file + + diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/src/t_utils/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/src/t_utils/bld.inf Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,23 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Build information file for t_utils.dll + * +*/ + + +PRJ_PLATFORMS +DEFAULT + +PRJ_TESTMMPFILES +t_utils.mmp diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/src/t_utils/t_utils.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/src/t_utils/t_utils.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,641 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework Test Code +* +*/ + + +#include +#include +#include +#include +#include +#include + +#include "t_utils.h" + +#include "eunittools.h" + +#include +#include + +#include "ximpeventcodec.h" +#include "ownpresenceeventimp.h" +#include "prfwtestfiletool.h" +#include "ximppanics.h" + +#include "prfwtestrobustnesstools.h" + +#include "ximpobjectfactoryimp.h" +#include "ximpobjectcollection.h" +#include "ximprestrictedobjectcollection.h" +#include "ximpidentityimp.h" +#include "ximpstatusimp.h" +#include "ximprequestidbuilder.h" + + + +// ============================ MEMBER FUNCTIONS =============================== + +// CONSTRUCTION +T_Utils* T_Utils::NewL() + { + T_Utils* self = new( ELeave ) T_Utils; + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + + return self; + } + + +T_Utils::~T_Utils() + { + } + + +void T_Utils::ConstructL() + { + CEUnitTestSuiteClass::ConstructL(); + } + + +T_Utils::T_Utils() + { + } + +// =========================================================================== +// TEST CASE SETUP & TEARDOWN METHODS +// =========================================================================== +// + +void T_Utils::Setup_L() + { + } + +void T_Utils::Teardown() + { + } + +// =========================================================================== +// TEST CASE +// =========================================================================== +void T_Utils::T_FileToolTest_L() + { + // TODO add more brains to the test + EUNIT_PRINT( _L("FileTool test.") ); + + /* + CXIMPTestFileTool* tool = CXIMPTestFileTool::NewL(); + CleanupStack::PushL( tool ); + tool->CleanL( 0 ); + tool->PrepareL( 0 ); + TInt files = tool->NumObjectsL( 0 ); + + EUNIT_ASSERT_DESC( files == 0, "Non-zero count of files, Clean or Prepare did not work" ); + + // make a proper object and store it. + MPresenceInfo::TPresenceInfoStatus status; + status = MPresenceInfo::EDataSubscriptionPending; + COwnPresenceEventImp* event = COwnPresenceEventImp::NewLC( status ); + + CBufFlat* buf = CBufFlat::NewL( 50 ); + CleanupStack::PushL( buf ); + TInt32 eventType = 0; + XIMPEventCodec::PackL( *event, eventType, buf ); + HBufC8* extObj = buf->Ptr( 0 ).AllocLC(); + + // create more objects + tool->StoreL( 0, *extObj ); + tool->StoreL( 0, *extObj ); + tool->StoreL( 0, *extObj ); + tool->StoreL( 0, *extObj ); + tool->StoreL( 0, *extObj ); + + files = tool->NumObjectsL( 0 ); + EUNIT_ASSERT_DESC( files == 5, "Bad count of files" ); + + COwnPresenceEventImp* object = static_cast( tool->RestoreLC( 0, 2 ) ); + EUNIT_ASSERT_DESC( status == object->Status(), "Wrong status from restored object." ); + + CleanupStack::PopAndDestroy( 4, event ); // object, extObj, buf, event + + CleanupStack::PopAndDestroy( tool ); + */ + } + +// =========================================================================== +// TEST CASE +// =========================================================================== +void T_Utils::T_KillServers_L() + { + EUNIT_PRINT( _L("Utility to kill the servers. Always succeeds.") ); + + PrfwTestRobustness::DoPreCleaning(); + } + +_LIT8( KTestObjectName, "John Doe" ); // regular +_LIT8( KTestObjectName2, "Jane Doe" ); // regular +_LIT8( KTestObjectNameWC, "Jo* Doe" ); // wildcards +_LIT8( KTestObjectNameWC2, "Ja* Doe" ); // wildcards + +_LIT( KIdentity1, "Identity 1" ); +_LIT( KIdentity2, "Identity 2" ); + +// =========================================================================== +// TEST CASE +// =========================================================================== +void T_Utils::T_ObjectCollection_Unnamed_L() + { + EUNIT_PRINT( _L("Object collection unnamed tests.") ); + + CXIMPObjectFactoryImp* factory = CXIMPObjectFactoryImp::NewL(); + CleanupStack::PushL( factory ); + + MXIMPObjectCollection* collection = factory->NewObjectCollectionLC(); + + // LookupByType should not find anything + const MXIMPBase* obj = NULL; + collection->LookupByType( obj, MXIMPIdentity::KInterfaceId ); + EUNIT_ASSERT_DESC( obj == NULL, "LookupByType found an object" ); + + // LookupByTypeAndName should not find anything + collection->LookupByTypeAndName( obj, MXIMPIdentity::KInterfaceId, KTestObjectName ); + EUNIT_ASSERT_DESC( obj == NULL, "LookupByTypeAndName found an object" ); + + collection->LookupByTypeAndName( obj, MXIMPIdentity::KInterfaceId, KTestObjectNameWC ); + EUNIT_ASSERT_DESC( obj == NULL, "LookupByTypeAndName with wildcard found an object" ); + + // add some + MXIMPIdentity* identity2 = factory->NewIdentityLC(); + identity2->SetIdentityL( KIdentity2 ); + + MXIMPStatus* status = factory->NewStatusLC(); + status->SetResultCode( KErrArgument ); + + MXIMPIdentity* identity1 = factory->NewIdentityLC(); + identity1->SetIdentityL( KIdentity1 ); + + collection->AddObjectL( identity1 ); + CleanupStack::Pop(); // identity1 + + collection->AddObjectL( status ); + CleanupStack::Pop(); // status + + collection->AddObjectL( identity2 ); + CleanupStack::Pop(); // identity2 + + // get and verify the status + MXIMPBase* getObj = NULL; + collection->GetByType( getObj, MXIMPStatus::KInterfaceId ); + EUNIT_ASSERT_DESC( getObj != NULL, "LookupByType did not find an object" ); + + MXIMPStatus* gotStatus = ( MXIMPStatus* ) getObj->GetInterface( MXIMPStatus::KInterfaceId, MXIMPBase::EPanicIfUnknown ); + CleanupDeletePushL( gotStatus ); + EUNIT_ASSERT_DESC( gotStatus->ResultCode() == KErrArgument, "Status got corrupted" ); + CleanupStack::PopAndDestroy(); // gotStatus + + // check that status can't be found anymore + obj = NULL; + collection->LookupByType( obj, MXIMPStatus::KInterfaceId ); + EUNIT_ASSERT_DESC( obj == NULL, "LookupByType found an object" ); + + collection->LookupByTypeAndName( obj, MXIMPStatus::KInterfaceId, KTestObjectName ); + EUNIT_ASSERT_DESC( obj == NULL, "LookupByTypeAndName found an object" ); + + collection->LookupByTypeAndName( obj, MXIMPStatus::KInterfaceId, KTestObjectNameWC ); + EUNIT_ASSERT_DESC( obj == NULL, "LookupByTypeAndName with wildcard found an object" ); + + // get and verify the two identities + // first identity + getObj = NULL; + collection->GetByType( getObj, MXIMPIdentity::KInterfaceId ); + EUNIT_ASSERT_DESC( getObj != NULL, "LookupByType did not find an object" ); + + MXIMPIdentity* gotIdentity = ( MXIMPIdentity* ) getObj->GetInterface( MXIMPIdentity::KInterfaceId, MXIMPBase::EPanicIfUnknown ); + CleanupDeletePushL( gotIdentity ); + EUNIT_ASSERT_DESC( 0 == gotIdentity->Identity().Compare( KIdentity1 ), "Wrong identity object found" ); + CleanupStack::PopAndDestroy(); // gotIdentity + + // second identity + getObj = NULL; + collection->GetByType( getObj, MXIMPIdentity::KInterfaceId ); + EUNIT_ASSERT_DESC( getObj != NULL, "LookupByType did not find an object" ); + + gotIdentity = ( MXIMPIdentity* ) getObj->GetInterface( MXIMPIdentity::KInterfaceId, MXIMPBase::EPanicIfUnknown ); + CleanupDeletePushL( gotIdentity ); + EUNIT_ASSERT_DESC( 0 == gotIdentity->Identity().Compare( KIdentity2 ), "Wrong identity object found" ); + CleanupStack::PopAndDestroy(); // gotIdentity + + // now there should not be anything anymore + obj = NULL; + collection->LookupByType( obj, MXIMPIdentity::KInterfaceId ); + EUNIT_ASSERT_DESC( obj == NULL, "LookupByType found an object" ); + + CleanupStack::PopAndDestroy(); // collection + CleanupStack::PopAndDestroy( factory ); + } + +// =========================================================================== +// TEST CASE +// =========================================================================== +void T_Utils::T_ObjectCollection_Named_L() + { + EUNIT_PRINT( _L("Object collection named tests.") ); + + CXIMPObjectFactoryImp* factory = CXIMPObjectFactoryImp::NewL(); + CleanupStack::PushL( factory ); + + MXIMPObjectCollection* collection = factory->NewObjectCollectionLC(); + + // LookupByType should not find anything + const MXIMPBase* obj = NULL; + collection->LookupByType( obj, MXIMPIdentity::KInterfaceId ); + EUNIT_ASSERT_DESC( obj == NULL, "LookupByType found an object" ); + + // LookupByTypeAndName should not find anything + collection->LookupByTypeAndName( obj, MXIMPIdentity::KInterfaceId, KTestObjectName ); + EUNIT_ASSERT_DESC( obj == NULL, "LookupByTypeAndName found an object" ); + + collection->LookupByTypeAndName( obj, MXIMPIdentity::KInterfaceId, KTestObjectNameWC ); + EUNIT_ASSERT_DESC( obj == NULL, "LookupByTypeAndName with wildcard found an object" ); + + // add some + MXIMPIdentity* identity2 = factory->NewIdentityLC(); + identity2->SetIdentityL( KIdentity2 ); + + MXIMPStatus* status = factory->NewStatusLC(); + status->SetResultCode( KErrArgument ); + + MXIMPIdentity* identity1 = factory->NewIdentityLC(); + identity1->SetIdentityL( KIdentity1 ); + + collection->AddObjectWithNameL( identity1, KTestObjectName ); + CleanupStack::Pop(); // identity1 + + TRAPD( err, collection->AddObjectWithNameL( status, KTestObjectNameWC ) ); + EUNIT_ASSERT_DESC( err == KErrBadName, "Did not leave when given wildcards" ); + CleanupStack::PopAndDestroy(); // status + + collection->AddObjectWithNameL( identity2, KTestObjectName2 ); + CleanupStack::Pop(); // identity2 + + // should not find the status object + MXIMPBase* getObj = NULL; + collection->GetByType( getObj, MXIMPStatus::KInterfaceId ); + EUNIT_ASSERT_DESC( getObj == NULL, "LookupByType found wrong object" ); + + // get and verify the two identities + // first identity + getObj = NULL; + collection->GetByTypeAndName( getObj, MXIMPIdentity::KInterfaceId, KTestObjectName ); + EUNIT_ASSERT_DESC( getObj != NULL, "LookupByType did not find an object" ); + + MXIMPIdentity* gotIdentity = ( MXIMPIdentity* ) getObj->GetInterface( MXIMPIdentity::KInterfaceId, MXIMPBase::EPanicIfUnknown ); + CleanupDeletePushL( gotIdentity ); + EUNIT_ASSERT_DESC( 0 == gotIdentity->Identity().Compare( KIdentity1 ), "Wrong identity object found" ); + CleanupStack::PopAndDestroy(); // gotIdentity + + // second identity + getObj = NULL; + collection->GetByTypeAndName( getObj, MXIMPIdentity::KInterfaceId, KTestObjectNameWC2 ); + EUNIT_ASSERT_DESC( getObj != NULL, "LookupByType did not find an object" ); + + gotIdentity = ( MXIMPIdentity* ) getObj->GetInterface( MXIMPIdentity::KInterfaceId, MXIMPBase::EPanicIfUnknown ); + CleanupDeletePushL( gotIdentity ); + EUNIT_ASSERT_DESC( 0 == gotIdentity->Identity().Compare( KIdentity2 ), "Wrong identity object found" ); + CleanupStack::PopAndDestroy(); // gotIdentity + + // now there should not be anything anymore + obj = NULL; + collection->LookupByType( obj, MXIMPIdentity::KInterfaceId ); + EUNIT_ASSERT_DESC( obj == NULL, "LookupByType found an object" ); + + CleanupStack::PopAndDestroy(); // collection + CleanupStack::PopAndDestroy( factory ); + } + +// =========================================================================== +// TEST CASE +// =========================================================================== +void T_Utils::T_RestrictedObjectCollection_L() + { + EUNIT_PRINT( _L("Restricted object collection tests.") ); + + CXIMPObjectFactoryImp* factory = CXIMPObjectFactoryImp::NewL(); + CleanupStack::PushL( factory ); + + MXIMPRestrictedObjectCollection* resColl = factory->NewRestrictedObjectCollectionLC(); + + // LookupByType should not find anything, empty collection + const MXIMPBase* obj = NULL; + resColl->LookupByType( obj, MXIMPIdentity::KInterfaceId ); + EUNIT_ASSERT_DESC( obj == NULL, "LookupByType found an object" ); + + // add some + MXIMPIdentity* identity2 = factory->NewIdentityLC(); + identity2->SetIdentityL( KIdentity2 ); + + MXIMPStatus* status = factory->NewStatusLC(); + status->SetResultCode( KErrArgument ); + + MXIMPIdentity* identity1 = factory->NewIdentityLC(); + identity1->SetIdentityL( KIdentity1 ); + + resColl->AddOrReplaceTypeL( identity1 ); + CleanupStack::Pop(); // identity1 + + resColl->AddOrReplaceTypeL( status ); + CleanupStack::Pop(); // identity1 + + resColl->AddOrReplaceTypeL( identity2 ); + CleanupStack::Pop(); // identity2 + + // there should only be {identity2, status} in the collection + obj = NULL; + resColl->LookupByType( obj, MXIMPIdentity::KInterfaceId ); + EUNIT_ASSERT_DESC( obj != NULL, "LookupByType did not find an object" ); + + obj = NULL; + resColl->LookupByType( obj, MXIMPStatus::KInterfaceId ); + EUNIT_ASSERT_DESC( obj != NULL, "LookupByType did not find an object" ); + + // get the objects and verify their contents + + // 1. identity + MXIMPBase* getObj = NULL; + resColl->GetByType( getObj, MXIMPIdentity::KInterfaceId ); + EUNIT_ASSERT_DESC( getObj != NULL, "LookupByType did not find an object" ); + + MXIMPIdentity* gotIdentity = ( MXIMPIdentity* ) getObj->GetInterface( MXIMPIdentity::KInterfaceId, MXIMPBase::EPanicIfUnknown ); + CleanupDeletePushL( gotIdentity ); + EUNIT_ASSERT_DESC( 0 == gotIdentity->Identity().Compare( KIdentity2 ), "Second identity object did not replace the first one" ); + CleanupStack::PopAndDestroy(); // gotIdentity + + // 2. status + getObj = NULL; + resColl->GetByType( getObj, MXIMPStatus::KInterfaceId ); + EUNIT_ASSERT_DESC( getObj != NULL, "LookupByType did not find an object" ); + + MXIMPStatus* gotStatus = ( MXIMPStatus* ) getObj->GetInterface( MXIMPStatus::KInterfaceId, MXIMPBase::EPanicIfUnknown ); + CleanupDeletePushL( gotStatus ); + EUNIT_ASSERT_DESC( KErrArgument == gotStatus->ResultCode(), "Status object was corrupted" ); + CleanupStack::PopAndDestroy(); // gotStatus + + // now there should not be anything anymore + obj = NULL; + resColl->LookupByType( obj, MXIMPIdentity::KInterfaceId ); + EUNIT_ASSERT_DESC( obj == NULL, "LookupByType found an identity object although it was removed" ); + + obj = NULL; + resColl->LookupByType( obj, MXIMPStatus::KInterfaceId ); + EUNIT_ASSERT_DESC( obj == NULL, "LookupByType found a status object although it was removed" ); + + CleanupStack::PopAndDestroy(); // collection + CleanupStack::PopAndDestroy( factory ); + } + +void T_Utils::T_DataSubscriptionState_L() + { + EUNIT_PRINT( _L("Data subscription state tests.") ); + + CXIMPObjectFactoryImp* factory = CXIMPObjectFactoryImp::NewL(); + CleanupStack::PushL( factory ); + + MXIMPDataSubscriptionState* dataState = factory->NewDataSubscriptionStateLC(); + + EUNIT_ASSERT_DESC( dataState->DataState() == MXIMPDataSubscriptionState::EDataUnavailable, + "Data was available." ); + EUNIT_ASSERT_DESC( dataState->SubscriptionState() == MXIMPDataSubscriptionState::ESubscriptionInactive, + "Subscription was active." ); + + dataState->SetDataStateL( MXIMPDataSubscriptionState::EDataAvailable ); + dataState->SetSubscriptionStateL( MXIMPDataSubscriptionState::ESubscriptionActive ); + + EUNIT_ASSERT_DESC( dataState->DataState() == MXIMPDataSubscriptionState::EDataAvailable, + "Data was unavailable." ); + EUNIT_ASSERT_DESC( dataState->SubscriptionState() == MXIMPDataSubscriptionState::ESubscriptionActive, + "Subscription was inactive." ); + + CleanupStack::PopAndDestroy(); // collection + CleanupStack::PopAndDestroy( factory ); + } + + + +void T_Utils::T_TXIMPRequestIdBuilder_Test_L() + { + EUNIT_PRINT( _L("TXIMPRequestIdbuilder test.") ); + + TXIMPRequestIdBuilder builder; + builder.SetProtocolId( 1 ); + builder.SetSessionId( 1 ); + builder.SetRequestId( 1 ); + + TXIMPRequestId id1 = builder.BuildRequestId(); + EUNIT_ASSERT( id1 == id1 ); + EUNIT_ASSERT( id1 != TXIMPRequestId::Null() ); + + + { + builder.SetProtocolId( 2 ); + TXIMPRequestId id2 = builder.BuildRequestId(); + EUNIT_ASSERT( id2 == id2 ); + EUNIT_ASSERT( id1 != id2 ); + EUNIT_ASSERT( id2 != id1 ); + EUNIT_ASSERT( id2 != TXIMPRequestId::Null() ); + } + + { + builder.SetSessionId( 2 ); + TXIMPRequestId id3 = builder.BuildRequestId(); + EUNIT_ASSERT( id3 == id3 ); + EUNIT_ASSERT( id1 != id3 ); + EUNIT_ASSERT( id3 != id1 ); + EUNIT_ASSERT( id3 != TXIMPRequestId::Null() ); + } + + + { + builder.SetRequestId( 2 ); + TXIMPRequestId id4 = builder.BuildRequestId(); + EUNIT_ASSERT( id4 == id4 ); + EUNIT_ASSERT( id1 != id4 ); + EUNIT_ASSERT( id4 != id1 ); + EUNIT_ASSERT( id4 != TXIMPRequestId::Null() ); + } + + + { + builder.SetProtocolId( 33333333 ); + builder.SetSessionId( 44444444 ); + builder.SetRequestId( 55555555 ); + + TXIMPRequestId id5 = builder.BuildRequestId(); + EUNIT_ASSERT( id5 == id5 ); + EUNIT_ASSERT( id1 != id5 ); + EUNIT_ASSERT( id5 != id1 ); + EUNIT_ASSERT( id5 != TXIMPRequestId::Null() ); + } + } + + +void T_Utils::T_TXIMPRequestId_Test_L() + { + EUNIT_PRINT( _L("TXIMPRequestIdbuilder test.") ); + + TXIMPRequestId id0 = TXIMPRequestId::Null(); + EUNIT_ASSERT( id0 == TXIMPRequestId::Null() ); + + { + TXIMPRequestId id1 = TXIMPRequestId::Init( 1 ); + EUNIT_ASSERT( id1 != TXIMPRequestId::Null() ); + } + + + { + TXIMPRequestId id2 = TXIMPRequestId::Init( 2); + EUNIT_ASSERT( id0 != id2 ); + } + + + { + TXIMPRequestId id3 = TXIMPRequestId::Init( KMaxTInt ); + EUNIT_ASSERT( id0 != id3 ); + } + + + { + TXIMPRequestId id4 = TXIMPRequestId::Init( 33333333 ); + EUNIT_ASSERT( id0 != id4 ); + } + + { + TXIMPRequestId id5 = TXIMPRequestId::Init( KMaxTInt ); + TXIMPRequestId id6 = TXIMPRequestId::Init( KMinTInt ); + EUNIT_ASSERT( id0 != id5 ); + EUNIT_ASSERT( id0 != id6 ); + EUNIT_ASSERT( id5 != id6 ); + } + + } + + + + +// =========================================================================== +// TEST CASE TABLE +// =========================================================================== +// +EUNIT_BEGIN_TEST_TABLE( + T_Utils, + "XIMP test utils tests", + "MODULE" ) + + PRFW_NOT_DECORATED_TEST( + "Kill servers", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_KillServers_L, + Teardown ) + +PRFW_NOT_DECORATED_TEST( + "Object collection without names", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_ObjectCollection_Unnamed_L, + Teardown ) + +PRFW_NOT_DECORATED_TEST( + "Object collection using names", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_ObjectCollection_Named_L, + Teardown ) + +PRFW_NOT_DECORATED_TEST( + "Restricted object collection", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_RestrictedObjectCollection_L, + Teardown ) + +PRFW_NOT_DECORATED_TEST( + "Data subscription state", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_DataSubscriptionState_L, + Teardown ) + + +PRFW_NOT_DECORATED_TEST( + "TXIMPRequestIdBuilder test", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_TXIMPRequestIdBuilder_Test_L, + Teardown ) + + +PRFW_NOT_DECORATED_TEST( + "TXIMPRequestId test", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_TXIMPRequestId_Test_L, + Teardown ) + + +/* PRFW_NOT_DECORATED_TEST( + "FileTool test", + "", + "", + "FUNCTIONALITY", + Setup_L, + T_FileToolTest_L, + Teardown ) */ + + +EUNIT_END_TEST_TABLE + + +// =========================================================================== +// TEST SUITE CONSTRUCTION +// =========================================================================== +// +EXPORT_C MEUnitTest* CreateTestSuiteL() + { + return T_Utils::NewL(); + } + + +// end of file + + + + + + diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/src/t_utils/t_utils.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/src/t_utils/t_utils.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,80 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework Test Code +* +*/ + +#ifndef T_UTILS_H__ +#define T_UTILS_H__ + +#include +#include + +#include "prfwteststatuseventlistener.h" +#include "prfwwaitobserver.h" + +class CXIMPTestContextWrapperMgr; + +/** + * XIMP Framework Eunit tests. + * + * Tests for XIMP session management services. + * + * @since S60 v4.0 + */ +class T_Utils : public CEUnitTestSuiteClass + { + +public: + static T_Utils* NewL(); + virtual ~T_Utils(); + +private: + T_Utils(); + void ConstructL(); + +private: // Test case functions + + void Setup_L(); + void Teardown(); + + void T_FileToolTest_L(); + + void T_KillServers_L(); + + void T_ObjectCollection_Unnamed_L(); + void T_ObjectCollection_Named_L(); + void T_RestrictedObjectCollection_L(); + void T_DataSubscriptionState_L(); + + void T_TXIMPRequestIdBuilder_Test_L(); + void T_TXIMPRequestId_Test_L(); + +private: // Test helpers + +private: // Test data + + /** + * Eunit test case table declaration. + */ + EUNIT_DECLARE_TEST_TABLE; + }; + +#endif // T_UTILS_H__ + +// end of file + + + + diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/src/t_utils/t_utils.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/src/t_utils/t_utils.mmp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,54 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework Test Code +* +*/ + +#include "../../tsrcutils/eunitcommon/eunittstdllbase.hrh" + +TARGET t_utils.dll + +SOURCEPATH . +SOURCE t_utils.cpp + +#include "../../tsrcutils/processmaster/pm.h" + +USERINCLUDE ../../../core/srcdatamodel +USERINCLUDE ../../../presence/srcpresencedatamodel +USERINCLUDE ../../../presence/srcpresencedatamodel/presentitygroups +USERINCLUDE ../../../presence/srcpresencedatamodel/presencewatching +USERINCLUDE ../../../presence/srcpresencedatamodel/presenceauthorization +USERINCLUDE ../../../presence/srcpresencedatamodel/presencepublishing +USERINCLUDE ../../../presence/srcpresencedatamodel/presenceinfo +USERINCLUDE ../../../core/srcutils + +// TODO remove unnecessary +SYSTEMINCLUDE ../../../inc/core/base +SYSTEMINCLUDE ../../../inc/core/datamodel +SYSTEMINCLUDE ../../../inc/core/protocolplugin +SYSTEMINCLUDE ../../../inc/core/protocolpluginhost +SYSTEMINCLUDE ../../../inc/presence/presencedatamodel +SYSTEMINCLUDE ../../../inc/presence/presencemanagement +SYSTEMINCLUDE ../../../inc/presence/presenceprotocolplugin +SYSTEMINCLUDE ../../../inc/presence/presenceprotocolpluginhost + + +LIBRARY ecom.lib +LIBRARY bafl.lib +LIBRARY ximpdatamodel.lib +LIBRARY ximputils.lib + +// end of file + + diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/tsrcprotocols/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/tsrcprotocols/bld.inf Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,26 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Build information file for PrFw test protocols + * +*/ + +PRJ_PLATFORMS +DEFAULT + +PRJ_TESTMMPFILES + +pr_prfwtestprotocol/pr_prfwtestprotocol.mmp + + + diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/tsrcprotocols/pr_prfwtestprotocol/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/tsrcprotocols/pr_prfwtestprotocol/bld.inf Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,29 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Build information file for project Presence Framework +* +*/ + + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +PRJ_TESTMMPFILES +pr_prfwtestprotocol.mmp + + + +PRJ_TESTEXPORTS diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/tsrcprotocols/pr_prfwtestprotocol/pr_prfwtestprotocol.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/tsrcprotocols/pr_prfwtestprotocol/pr_prfwtestprotocol.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,1519 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Test Protocol implementation for XIMP Framework + * +*/ + + +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +#include "pr_prfwtestprotocol.h" +#include "prfwgeneralwaiter.h" +#include "prfwtestmessaging.h" +#include "prfwtestmessenger.h" +#include "prfwtestfilelogichelper.h" +#include "prfwtestfiletool.h" +#include "ximprequestidbuilder.h" +#include "prfwtestprotocols.h" + + + +const TInt KWaitTime = 1; + +T_XIMPTestConnection::ClientWrapper* T_XIMPTestConnection::ClientWrapper::NewLC( const TDesC& aClientId ) + { + ClientWrapper* self = new ( ELeave ) ClientWrapper; + CleanupStack::PushL( self ); + self->ConstructL( aClientId ); + return self; + } + +void T_XIMPTestConnection::ClientWrapper::ConstructL( const TDesC& aClientId ) + { + iId.CreateL( aClientId ); + } + +void T_XIMPTestConnection::ClientWrapper::InitializeL( MXIMPProtocolConnectionHost& aConnectionHost ) + { + if( !iMessenger ) + { + TLex lex( iId ); + TInt index = 0; + User::LeaveIfError( lex.Val( index ) ); + // TEST CODE + __ASSERT_ALWAYS( index != -1, User::Panic(_L("Protocol"), 666)); + iMessenger = CXIMPTestMessenger::NewForAdaptationSideL( index ); + iPluginIndex = index; + } + + if( !iFileLogicHelper ) + { + iFileLogicHelper = CXIMPTestFileLogicHelper::NewL( aConnectionHost, *iMessenger ); + } + + if( !iFileTool ) + { + // TODO FIX FILETOOL CREATION + iFileTool = CXIMPTestFileTool::NewL( K_PRFW_TST_PROTOCOL_1_IMPLEMENTATION_UID, iId ); + iFileTool->RegisterObserverL( iFileLogicHelper ); + } + } + +T_XIMPTestConnection::ClientWrapper::~ClientWrapper() + { + if( iFileTool && iFileLogicHelper ) + { + iFileTool->UnregisterObserver( iFileLogicHelper ); + } + delete iFileTool; + delete iFileLogicHelper; + delete iMessenger; + + iId.Close(); + } + +// --------------------------------------------------------------------------- +// OrderOfClients() +// --------------------------------------------------------------------------- +// +TInt T_XIMPTestConnection::OrderOfClients( const T_XIMPTestConnection::ClientWrapper& aFirst, + const T_XIMPTestConnection::ClientWrapper& aSecond ) + { + return aFirst.iId.Compare( aSecond.iId ); + } + +// ======== MEMBER FUNCTIONS ======== + + +// --------------------------------------------------------------------------- +// OrderOfConnections() +// --------------------------------------------------------------------------- +// +TInt T_XIMPTestConnection::OrderOfConnections( const T_XIMPTestConnection& aFirst, + const T_XIMPTestConnection& aSecond ) + { + TInt retVal = aFirst.iServerAddress->Compare( *aSecond.iServerAddress ); + if( retVal != 0 ) + { + return retVal; + } + retVal = aFirst.iUserName->Compare( *aSecond.iUserName ); + if( retVal != 0 ) + { + return retVal; + } + + return aFirst.iPassword->Compare( *aSecond.iPassword ); + } + + +// --------------------------------------------------------------------------- +// T_XIMPTestConnection::T_XIMPTestConnection() +// --------------------------------------------------------------------------- +// +T_XIMPTestConnection::T_XIMPTestConnection() + { + } + + +// --------------------------------------------------------------------------- +// T_XIMPTestConnection::ConstructL() +// --------------------------------------------------------------------------- +// +void T_XIMPTestConnection::ConstructL( const MXIMPServiceInfo& aServiceInfo, + const MXIMPContextClientInfo& aClientCtxInfo ) + { + iWaitter = CXIMPTestGeneralWaiter::NewL( this ); + + iAuxTimer = CPeriodic::NewL( CActive::EPriorityIdle ); + + iServerAddress = aServiceInfo.ServiceAddress().AllocL(); + iUserName = aServiceInfo.UserId().AllocL(); + iPassword = aServiceInfo.Password().AllocL(); + iClientId = aClientCtxInfo.ClientId().Identity().AllocL(); + } + + +// --------------------------------------------------------------------------- +// T_XIMPTestConnection::NewLC() +// --------------------------------------------------------------------------- +// +T_XIMPTestConnection* T_XIMPTestConnection::NewLC( const MXIMPServiceInfo& aServiceInfo, + const MXIMPContextClientInfo& aClientCtxInfo ) + { + T_XIMPTestConnection* self = new( ELeave ) T_XIMPTestConnection( ); + CleanupStack::PushL( self ); + self->ConstructL( aServiceInfo, aClientCtxInfo ); + return self; + } + + +// --------------------------------------------------------------------------- +// T_XIMPTestConnection::NewL() +// --------------------------------------------------------------------------- +// +T_XIMPTestConnection* T_XIMPTestConnection::NewL( const MXIMPServiceInfo& aServiceInfo, + const MXIMPContextClientInfo& aClientCtxInfo ) + { + T_XIMPTestConnection* self = T_XIMPTestConnection::NewLC( aServiceInfo, aClientCtxInfo ); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// T_XIMPTestConnection::~T_XIMPTestConnection() +// --------------------------------------------------------------------------- +// +T_XIMPTestConnection::~T_XIMPTestConnection() + { + SetBoolean( EXIMPPlgTestDeath ); + + if ( iAuxTimer ) + { + iAuxTimer->Deque(); + } + delete iAuxTimer; + + delete iWaitter; + + iClients.ResetAndDestroy(); + + delete iServerAddress; + delete iUserName; + delete iPassword; + delete iClientId; + + delete iClientToBeDeleted; + } + + +// --------------------------------------------------------------------------- +// T_XIMPTestConnection::PrimeHost() +// --------------------------------------------------------------------------- +// +void T_XIMPTestConnection::PrimeHost( MXIMPProtocolConnectionHost& aHost ) + { + iConnectionHost = &aHost; + } + +// --------------------------------------------------------------------------- +// T_XIMPTestConnection::PresenceFeatures() +// --------------------------------------------------------------------------- +// +MProtocolPresenceFeatures& T_XIMPTestConnection::ProtocolPresenceFeatures() + { + return *this; + } + + +// --------------------------------------------------------------------------- +// T_XIMPTestConnection::PresenceFeatures() +// --------------------------------------------------------------------------- +// MProtocolImFeatures* ProtocolImFeatures(); +//MProtocolImFeatures* T_XIMPTestConnection::ProtocolImFeatures() +// { +// return NULL; +// } +// --------------------------------------------------------------------------- +// T_XIMPTestConnection::GetProtocolInterface() +// --------------------------------------------------------------------------- +TAny* T_XIMPTestConnection::GetProtocolInterface(TInt aInterfaceId) + { + return NULL ; + } + + + +// --------------------------------------------------------------------------- +// T_XIMPTestConnection::PresenceWatching() +// --------------------------------------------------------------------------- +// +MProtocolPresenceWatching& T_XIMPTestConnection::PresenceWatching() + { + return *this; + } +// --------------------------------------------------------------------------- +// T_XIMPTestConnection::PresencePublishing() +// --------------------------------------------------------------------------- +// +MProtocolPresencePublishing& T_XIMPTestConnection::PresencePublishing() + { + return *this; + } +// --------------------------------------------------------------------------- +// T_XIMPTestConnection::PresentityGroups() +// --------------------------------------------------------------------------- +// +MProtocolPresentityGroups& T_XIMPTestConnection::PresentityGroups() + { + return *this; + } +// --------------------------------------------------------------------------- +// T_XIMPTestConnection::PresenceAuthorization() +// --------------------------------------------------------------------------- +// +MProtocolPresenceAuthorization& T_XIMPTestConnection::PresenceAuthorization() + { + return *this; + } + +// --------------------------------------------------------------------------- +// T_XIMPTestConnection::HandleProtocolConnectionHostEvent() +// --------------------------------------------------------------------------- +// +void T_XIMPTestConnection::HandleProtocolConnectionHostEvent( + const MXIMPProtocolConnectionHost& aHost, + const MXIMPBase& aEvent ) + { + if( &aHost != iConnectionHost ) + { + User::Panic(_L("Protocol"), -42 ); + } + + + if( aEvent.GetInterfaceId() == MXIMPProtocolRequestCompleteEvent::KInterfaceId ) + { + const MXIMPProtocolRequestCompleteEvent* eventIf = + TXIMPGetInterface< const MXIMPProtocolRequestCompleteEvent >::From( aEvent, + MXIMPBase::EPanicIfUnknown ); + RDebug::Print( _L(" T_XIMPTestConnection: received ProtocolRequestCompleteEvent with result [%d]"), + eventIf->ResultCode() ); + } + } + + + +// --------------------------------------------------------------------------- +// T_XIMPTestConnection::OpenSessionL() +// --------------------------------------------------------------------------- +// +void T_XIMPTestConnection::OpenSessionL( const MXIMPContextClientInfo& aClientCtxInfo, + TXIMPRequestId aReqId ) + { + iConnectionHost->RegisterObserverL( *this ); + + ClientWrapper* client = ClientWrapper::NewLC( aClientCtxInfo.ClientId().Identity() ); + + TLinearOrder< T_XIMPTestConnection::ClientWrapper > order( T_XIMPTestConnection::OrderOfClients ); + TInt indexOfClient = iClients.FindInOrder( client, order ); + + if( indexOfClient != KErrNotFound ) + { + User::LeaveIfError( indexOfClient ); + CleanupStack::PopAndDestroy(); //id + client = iClients[ indexOfClient ]; + } + else + { + client->InitializeL( *iConnectionHost ); + iCurrentMessenger = client->iMessenger; + } + + PluginAPIMethodCommonL( aReqId ); + + if( indexOfClient == KErrNotFound ) + { + iClients.InsertInOrderL( client, order ); + CleanupStack::Pop(); //id + } + + + SetBooleanToCurrent( EXIMPPlgTestOpenSessionCalled ); + iWaitter->WaitForL( KWaitTime ); + } + +// --------------------------------------------------------------------------- +// T_XIMPTestConnection::OpenSessionL() +// --------------------------------------------------------------------------- +// +void T_XIMPTestConnection::OpenSessionL( + const TInt& aSettingsId, + TXIMPRequestId aReqId ) + + { + iConnectionHost->RegisterObserverL( *this ); + + ClientWrapper* client = ClientWrapper::NewLC( _L("0") ); + + TLinearOrder< T_XIMPTestConnection::ClientWrapper > order( T_XIMPTestConnection::OrderOfClients ); + TInt indexOfClient = iClients.FindInOrder( client, order ); + + if( indexOfClient != KErrNotFound ) + { + User::LeaveIfError( indexOfClient ); + CleanupStack::PopAndDestroy(); //id + client = iClients[ indexOfClient ]; + } + else + { + client->InitializeL( *iConnectionHost ); + iCurrentMessenger = client->iMessenger; + } + + PluginAPIMethodCommonL( aReqId ); + + if( indexOfClient == KErrNotFound ) + { + iClients.InsertInOrderL( client, order ); + CleanupStack::Pop(); //id + } + + + SetBooleanToCurrent( EXIMPPlgTestOpenSessionCalled ); + iWaitter->WaitForL( KWaitTime ); + } + + + +// --------------------------------------------------------------------------- +// T_XIMPTestConnection::CloseSession() +// --------------------------------------------------------------------------- +// +void T_XIMPTestConnection::CloseSession( const MXIMPContextClientInfo& aClientCtxInfo, + TXIMPRequestId aReqId ) + { + PluginAPIMethodCommonL( aReqId ); + + iClientToBeDeleted = NULL; + TInt count = iClients.Count(); + TBool found(EFalse); + for( TInt a = 0; a < count && !iClientToBeDeleted; ++a ) + { + if( aClientCtxInfo.ClientId().Identity().Compare( iClients[ a ]->iId ) == 0 ) + { + iClientToBeDeleted = iClients[ a ]; + iClients.Remove( a ); + found = ETrue; + } + } + + SetBooleanToCurrent( EXIMPPlgTestCloseSessionCalled ); + + if(found) + iWaitter->WaitForL( KWaitTime ); + else + { + MXIMPStatus* status = iConnectionHost->ObjectFactory().NewStatusLC(); + CleanupStack::Pop(); // status. + status->SetResultCode(KErrNone); + iConnectionHost->HandleRequestCompleted( aReqId, status); + } + + + + } + + +// --------------------------------------------------------------------------- +// T_XIMPTestConnection::GetSupportedFeaturesL() +// --------------------------------------------------------------------------- +// +void T_XIMPTestConnection::GetSupportedFeaturesL( CDesC8Array& aFeatures ) const + { + if ( ! iClients.Count() ) + { + User::LeaveIfError( KErrNotReady ); + } + + // first empty the whole array + aFeatures.Reset(); + + // then add two features there: 1 supported by XIMP, 1 not + aFeatures.AppendL( _L8("feat/pres/pub") ); + aFeatures.AppendL( _L8("feat/worlddomination") ); + } + +// --------------------------------------------------------------------------- +// T_XIMPTestConnection::DoSubscribeOwnPresenceL +// --------------------------------------------------------------------------- +// +void T_XIMPTestConnection::DoSubscribeOwnPresenceL( const MPresenceInfoFilter& aPif, + TXIMPRequestId aReqId ) + { + PluginAPIMethodCommonL( aReqId ); + + SetBooleanToCurrent( EXIMPPlgTestSubscribeOwnPresenceCalled ); + + // TODO do something, like in PublishPresence + + iWaitter->WaitForL( KWaitTime ); + } + +// --------------------------------------------------------------------------- +// T_XIMPTestConnection::DoUpdateOwnPresenceSubscriptionL +// --------------------------------------------------------------------------- +// +void T_XIMPTestConnection::DoUpdateOwnPresenceSubscriptionPifL( const MPresenceInfoFilter& aPif, + TXIMPRequestId aReqId ) + { + PluginAPIMethodCommonL( aReqId ); + + SetBooleanToCurrent( EXIMPPlgTestUpdateOwnSubscriptionCalled ); + + // TODO do something, like in PublishPresence + + iWaitter->WaitForL( KWaitTime ); + } + + +// --------------------------------------------------------------------------- +// From MPscPlugin class. +// T_XIMPTestConnection::DoSubscribePresenceWatcherListL() +// --------------------------------------------------------------------------- +// +void T_XIMPTestConnection::DoSubscribePresenceWatcherListL( TXIMPRequestId aReqId ) + { + PluginAPIMethodCommonL( aReqId ); + + SetBooleanToCurrent( EXIMPPlgTestSubscribePresenceWatcherListCalled ); + + // TODO do something, like in PublishPresence + + iWaitter->WaitForL( KWaitTime ); + } + +// --------------------------------------------------------------------------- +// From MPscPlugin class. +// T_XIMPTestConnection::DoUnsubscribePresenceWatcherListL() +// --------------------------------------------------------------------------- +// +void T_XIMPTestConnection::DoUnsubscribePresenceWatcherListL( TXIMPRequestId aReqId ) + { + PluginAPIMethodCommonL( aReqId ); + + SetBooleanToCurrent( EXIMPPlgTestUnsubscribePresenceWatcherListCalled ); + + // TODO do something, like in PublishPresence + + iWaitter->WaitForL( KWaitTime ); + } + +// --------------------------------------------------------------------------- +// T_XIMPTestConnection::DoSubscribePresentityGroupListL +// --------------------------------------------------------------------------- +// +void T_XIMPTestConnection::DoSubscribePresentityGroupListL( TXIMPRequestId aReqId ) + { + PluginAPIMethodCommonL( aReqId ); + + SetBooleanToCurrent( EXIMPPlgTestSubscribeGroupListCalled ); + + // TODO do something, like in PublishPresence + + iWaitter->WaitForL( KWaitTime ); + } + +// --------------------------------------------------------------------------- +// T_XIMPTestConnection::DoUnsubscribePresentityGroupListL +// --------------------------------------------------------------------------- +// +void T_XIMPTestConnection::DoUnsubscribePresentityGroupListL( TXIMPRequestId aReqId ) + { + PluginAPIMethodCommonL( aReqId ); + + SetBooleanToCurrent( EXIMPPlgTestUnsubscribeGroupListCalled ); + + // TODO do something, like in PublishPresence + + iWaitter->WaitForL( KWaitTime ); + } + + +// --------------------------------------------------------------------------- +// T_XIMPTestConnection::PublishPresenceL() +// --------------------------------------------------------------------------- +// +void T_XIMPTestConnection::DoPublishOwnPresenceL( + const MPresenceInfo& aPresence, + TXIMPRequestId aReqId ) + { + // With SetupLeave we leave here + PluginAPIMethodCommonL( aReqId ); + + SetBooleanToCurrent( EXIMPPlgTestPublishPresenceCalled ); + + MProtocolPresenceDataHost& presHost = iConnectionHost->ProtocolPresenceDataHost(); + // Set own presence data in data cache + MPresenceInfo* presence = presHost.PresenceObjectFactory().NewPresenceInfoLC(); + TXIMPRequestId reqid = presHost.PublishingDataHost().HandleSubscribedOwnPresenceL( presence ); + CleanupStack::Pop(); //presence + + + if(iCurrentMessenger->GetError()==KErrTimedOut) + { + MXIMPStatus* status1 = iConnectionHost->ObjectFactory().NewStatusLC(); + iConnectionHost->HandleConnectionTerminated(status1); + + CleanupStack::PopAndDestroy(1); + } + + iWaitter->WaitForL( KWaitTime ); + + // TODO when implemented, write the data received for test case verification + } + +// --------------------------------------------------------------------------- +// T_XIMPTestConnection::DoUnsubscribeOwnPresenceL() +// --------------------------------------------------------------------------- +// +void T_XIMPTestConnection::DoUnsubscribeOwnPresenceL( TXIMPRequestId aReqId ) + { + PluginAPIMethodCommonL( aReqId ); + + // prepare the message for test code + SetBooleanToCurrent( EXIMPPlgTestUnsubscribeOwnPresenceCalled ); + // TODO when implemented, read the data given by test case and + // generate the required events + iWaitter->WaitForL( KWaitTime ); + } + +// --------------------------------------------------------------------------- +// T_XIMPTestConnection::DoCreatePresentityGroupL +// --------------------------------------------------------------------------- +// +void T_XIMPTestConnection::DoCreatePresentityGroupL( const MXIMPIdentity& aIdentity, + const TDesC16& aDisplayName, + TXIMPRequestId aReqId ) + { + PluginAPIMethodCommonL( aReqId ); + + // prepare the message for test code + SetBooleanToCurrent( EXIMPPlgTestCreatePresentityGroupCalled ); + // TODO when implemented, read the data given by test case and + // generate the required events + iWaitter->WaitForL( KWaitTime ); + } + +// --------------------------------------------------------------------------- +// T_XIMPTestConnection::DoCreatePresentityGroupL +// --------------------------------------------------------------------------- +// +void T_XIMPTestConnection::DoDeletePresentityGroupL( const MXIMPIdentity& aIdentity, + TXIMPRequestId aReqId ) + { + PluginAPIMethodCommonL( aReqId ); + + // prepare the message for test code + SetBooleanToCurrent( EXIMPPlgTestDeletePresentityGroupCalled ); + // TODO when implemented, read the data given by test case and + // generate the required events + iWaitter->WaitForL( KWaitTime ); + } + +// --------------------------------------------------------------------------- +// T_XIMPTestConnection::DoCreatePresentityGroupL +// --------------------------------------------------------------------------- +// +void T_XIMPTestConnection::DoUpdatePresentityGroupDisplayNameL( const MXIMPIdentity& aIdentity, + const TDesC16& aDisplayName, + TXIMPRequestId aReqId ) + { + PluginAPIMethodCommonL( aReqId ); + + // prepare the message for test code + SetBooleanToCurrent( EXIMPPlgTestUpdatePresentityGroupDisplayNameCalled ); + // TODO when implemented, read the data given by test case and + // generate the required events + iWaitter->WaitForL( KWaitTime ); + } + +// --------------------------------------------------------------------------- +// T_XIMPTestConnection::DoSubscribePresentityPresenceL +// --------------------------------------------------------------------------- +// +void T_XIMPTestConnection::DoSubscribePresentityPresenceL( + const MXIMPIdentity& aIdentity, + const MPresenceInfoFilter& aPif, + TXIMPRequestId aReqId ) + { + PluginAPIMethodCommonL( aReqId ); + + // prepare the message for test code + SetBooleanToCurrent( EXIMPPlgTestSubscribePresentityPresesenceCalled ); + // TODO when implemented, read the data given by test case and + // generate the required events + iWaitter->WaitForL( KWaitTime ); + } + +// --------------------------------------------------------------------------- +// T_XIMPTestConnection::DoUpdatePresentityPresenceSubscriptionL +// --------------------------------------------------------------------------- +// +void T_XIMPTestConnection::DoUpdatePresentityPresenceSubscriptionPifL( + const MXIMPIdentity& aIdentity, + const MPresenceInfoFilter& aPif, + TXIMPRequestId aReqId ) + { + PluginAPIMethodCommonL( aReqId ); + + // prepare the message for test code + SetBooleanToCurrent( EXIMPPlgTestUpdatePresentityPresesenceCalled ); + // TODO when implemented, read the data given by test case and + // generate the required events + iWaitter->WaitForL( KWaitTime ); + } + +// --------------------------------------------------------------------------- +// T_XIMPTestConnection::DoUnsubscribePresentityPresenceL +// --------------------------------------------------------------------------- +// +void T_XIMPTestConnection::DoUnsubscribePresentityPresenceL( + const MXIMPIdentity& aIdentity, + TXIMPRequestId aReqId ) + { + PluginAPIMethodCommonL( aReqId ); + + // prepare the message for test code + SetBooleanToCurrent( EXIMPPlgTestUnsubscribePresentityPresesenceCalled ); + // TODO when implemented, read the data given by test case and + // generate the required events + iWaitter->WaitForL( KWaitTime ); + } + + +// --------------------------------------------------------------------------- +// T_XIMPTestConnection::DoSubscribePresentityGroupMembersPresenceL +// --------------------------------------------------------------------------- +// +void T_XIMPTestConnection::DoSubscribePresentityGroupMembersPresenceL( + const MXIMPIdentity& aIdentity, + const MPresenceInfoFilter& aPif, + TXIMPRequestId aReqId ) + { + PluginAPIMethodCommonL( aReqId ); + + // prepare the message for test code + SetBooleanToCurrent( EXIMPPlgTestSubscribePresentityGroupMembersPresesenceCalled ); + // TODO when implemented, read the data given by test case and + // generate the required events + iWaitter->WaitForL( KWaitTime ); + } + +// --------------------------------------------------------------------------- +// T_XIMPTestConnection::DoUpdatePresentityPresenceSubscriptionL +// --------------------------------------------------------------------------- +// +void T_XIMPTestConnection::DoUpdatePresentityGroupMembersPresenceSubscriptionPifL( + const MXIMPIdentity& aIdentity, + const MPresenceInfoFilter& aPif, + TXIMPRequestId aReqId ) + { + PluginAPIMethodCommonL( aReqId ); + + // prepare the message for test code + SetBooleanToCurrent( EXIMPPlgTestUpdatePresentityGroupMembersPresesenceCalled ); + // TODO when implemented, read the data given by test case and + // generate the required events + iWaitter->WaitForL( KWaitTime ); + } + +// --------------------------------------------------------------------------- +// T_XIMPTestConnection::DoUnsubscribePresentityPresenceL +// --------------------------------------------------------------------------- +// +void T_XIMPTestConnection::DoUnsubscribePresentityGroupMembersPresenceL( + const MXIMPIdentity& aIdentity, + TXIMPRequestId aReqId ) + { + PluginAPIMethodCommonL( aReqId ); + + // prepare the message for test code + SetBooleanToCurrent( EXIMPPlgTestUnsubscribePresentityGroupMembersPresesenceCalled ); + // TODO when implemented, read the data given by test case and + // generate the required events + iWaitter->WaitForL( KWaitTime ); + } + + + +// --------------------------------------------------------------------------- +// From MPscPlugin class. +// T_XIMPTestConnection::DoSubscribePresentityGroupContentL +// --------------------------------------------------------------------------- +// +void T_XIMPTestConnection::DoSubscribePresentityGroupContentL( + const MXIMPIdentity& aGroupId, + TXIMPRequestId aReqId ) + { + PluginAPIMethodCommonL( aReqId ); + + // prepare the message for test code + SetBooleanToCurrent( EXIMPPlgTestSubscribePresentityGroupContentCalled ); + // TODO when implemented, read the data given by test case and + // generate the required events + iWaitter->WaitForL( KWaitTime ); + } + +// --------------------------------------------------------------------------- +// From MPscPlugin class. +// T_XIMPTestConnection::DoUnsubscribePresentityGroupContentL +// --------------------------------------------------------------------------- +// +void T_XIMPTestConnection::DoUnsubscribePresentityGroupContentL( + const MXIMPIdentity& aGroupId, + TXIMPRequestId aReqId ) + { + PluginAPIMethodCommonL( aReqId ); + // prepare the message for test code + SetBooleanToCurrent( EXIMPPlgTestUnsubscribePresentityGroupContentCalled ); + // TODO when implemented, read the data given by test case and + // generate the required events + iWaitter->WaitForL( KWaitTime ); + + } + +// --------------------------------------------------------------------------- +// From MPscPlugin class. +// T_XIMPTestConnection::DoAddPresentityGroupMemberL +// --------------------------------------------------------------------------- +// +void T_XIMPTestConnection::DoAddPresentityGroupMemberL( + const MXIMPIdentity& aGroupId, + const MXIMPIdentity& aMemberId, + const TDesC16& aMemberDisplayName, + TXIMPRequestId aReqId ) + { + /* + //Req complete parameter template + { + MXIMPRestrictedObjectCollection* collection = + iConnectionHost->ObjectFactory().NewRestrictedObjectCollectionLC(); + + MXIMPIdentity* identityClone = iConnectionHost->ObjectFactory().NewIdentityLC(); + identityClone->SetIdentityL( aMemberId.Identity() ); + + MPresentityGroupMemberInfo* grpMember = + iConnectionHost->ObjectFactory().NewPresentityGroupMemberInfoLC( *identityClone, + _L("AlteredDisplayname") ); + CleanupStack::Pop(); //grpMember + CleanupStack::PopAndDestroy(); //identityClone + + CleanupDeletePushL( grpMember ); + collection->AddOrReplaceTypeL( grpMember ); + CleanupStack::Pop(); //grpMember + + delete iReqCompleteParams; + iReqCompleteParams = NULL; + iReqCompleteParams = collection; + + CleanupStack::Pop(); //collection + } + */ + + PluginAPIMethodCommonL( aReqId ); + + // prepare the message for test code + SetBooleanToCurrent( EXIMPPlgTestAddPresentityGroupMemberCalled ); + // TODO when implemented, read the data given by test case and + // generate the required events + iWaitter->WaitForL( KWaitTime ); + } + +// --------------------------------------------------------------------------- +// From MPscPlugin class. +// T_XIMPTestConnection::DoRemovePresentityGroupMemberL +// --------------------------------------------------------------------------- +// +void T_XIMPTestConnection::DoRemovePresentityGroupMemberL( + const MXIMPIdentity& aGroupId, + const MXIMPIdentity& aMemberId, + TXIMPRequestId aReqId ) + { + PluginAPIMethodCommonL( aReqId ); + + // prepare the message for test code + SetBooleanToCurrent( EXIMPPlgTestRemovePresentityGroupMemberCalled ); + // TODO when implemented, read the data given by test case and + // generate the required events + iWaitter->WaitForL( KWaitTime ); + } + +// --------------------------------------------------------------------------- +// From MPscPlugin class. +// T_XIMPTestConnection::DoUpdatePresentityGroupMemberDisplayNameL +// --------------------------------------------------------------------------- +// +void T_XIMPTestConnection::DoUpdatePresentityGroupMemberDisplayNameL( + const MXIMPIdentity& aGroupId, + const MXIMPIdentity& aMemberId, + const TDesC16& aMemberDisplayName, + TXIMPRequestId aReqId ) + { + PluginAPIMethodCommonL( aReqId ); + + // prepare the message for test code + SetBooleanToCurrent( EXIMPPlgTestUpdatePresentityGroupMemberDisplayNameCalled ); + // TODO when implemented, read the data given by test case and + // generate the required events + iWaitter->WaitForL( KWaitTime ); + } + + +// --------------------------------------------------------------------------- +// From MPscPlugin class. +// T_XIMPTestConnection::DoSubscribePresenceGrantRequestListL +// --------------------------------------------------------------------------- +// +void T_XIMPTestConnection::DoSubscribePresenceGrantRequestListL( TXIMPRequestId aReqId ) + { + PluginAPIMethodCommonL( aReqId ); + + SetBooleanToCurrent( EXIMPPlgTestSubscribePresenceGrantRequestListCalled ); + + // TODO do something, like in PublishPresence + + iWaitter->WaitForL( KWaitTime ); + } + +// --------------------------------------------------------------------------- +// From MPscPlugin class. +// T_XIMPTestConnection::DoUnsubscribePresenceGrantRequestListL +// --------------------------------------------------------------------------- +// +void T_XIMPTestConnection::DoUnsubscribePresenceGrantRequestListL( TXIMPRequestId aReqId ) + { + PluginAPIMethodCommonL( aReqId ); + + SetBooleanToCurrent( EXIMPPlgTestUnsubscribePresenceGrantRequestListCalled ); + + // TODO do something, like in PublishPresence + + iWaitter->WaitForL( KWaitTime ); + } + + +void T_XIMPTestConnection::DoGrantPresenceForPresentityL( const MXIMPIdentity& aIdentity, + const MPresenceInfoFilter& aPif, + TXIMPRequestId aReqId ) + { + PluginAPIMethodCommonL( aReqId ); + + SetBooleanToCurrent( EXIMPPlgTestGrantPresenceForPresentityCalled ); + + // TODO do something, like in PublishPresence + + iWaitter->WaitForL( KWaitTime ); + + } +void T_XIMPTestConnection::DoGrantPresenceForPresentityGroupMembersL( const MXIMPIdentity& aGroupId, + const MPresenceInfoFilter& aPif, + TXIMPRequestId aReqId ) + { + PluginAPIMethodCommonL( aReqId ); + + SetBooleanToCurrent( EXIMPPlgTestGrantPresenceForPresentityGroupMembersCalled ); + + // TODO do something, like in PublishPresence + + iWaitter->WaitForL( KWaitTime ); + + } + +void T_XIMPTestConnection::DoGrantPresenceForEveryoneL( const MPresenceInfoFilter& aPif, + TXIMPRequestId aReqId ) + { + PluginAPIMethodCommonL( aReqId ); + + SetBooleanToCurrent( EXIMPPlgTestGrantPresenceForEveryoneCalled ); + + // TODO do something, like in PublishPresence + + iWaitter->WaitForL( KWaitTime ); + + } + + +void T_XIMPTestConnection::DoUpdatePresenceGrantPifForPresentityL( const MXIMPIdentity& aIdentity, + const MPresenceInfoFilter& aPif, + TXIMPRequestId aReqId ) + { + PluginAPIMethodCommonL( aReqId ); + + SetBooleanToCurrent( EXIMPPlgTestUpdateGrantPresenceForPresentityCalled ); + + // TODO do something, like in PublishPresence + + iWaitter->WaitForL( KWaitTime ); + + } + +void T_XIMPTestConnection::DoUpdatePresenceGrantPifForPresentityGroupMembersL( const MXIMPIdentity& aGroupId, + const MPresenceInfoFilter& aPif, + TXIMPRequestId aReqId ) + { + PluginAPIMethodCommonL( aReqId ); + + SetBooleanToCurrent( EXIMPPlgTestUpdateGrantPresenceForPresentityGroupMembersCalled ); + + // TODO do something, like in PublishPresence + + iWaitter->WaitForL( KWaitTime ); + + } + +void T_XIMPTestConnection::DoUpdatePresenceGrantPifForEveryoneL( const MPresenceInfoFilter& aPif, + TXIMPRequestId aReqId ) + { + PluginAPIMethodCommonL( aReqId ); + + SetBooleanToCurrent( EXIMPPlgTestUpdateGrantPresenceForEveryoneCalled ); + + // TODO do something, like in PublishPresence + + iWaitter->WaitForL( KWaitTime ); + + } + + +void T_XIMPTestConnection::DoWithdrawPresenceGrantFromPresentityL( const MXIMPIdentity& aIdentity, TXIMPRequestId aReqId ) + { + PluginAPIMethodCommonL( aReqId ); + + SetBooleanToCurrent( EXIMPPlgTestWithdrawPresenceFromPresentityCalled ); + + // TODO do something, like in PublishPresence + + iWaitter->WaitForL( KWaitTime ); + + } + +void T_XIMPTestConnection::DoWithdrawPresenceGrantFromEveryoneL( TXIMPRequestId aReqId ) + { + PluginAPIMethodCommonL( aReqId ); + + SetBooleanToCurrent( EXIMPPlgTestWithdrawPresenceFromEveryoneCalled ); + + // TODO do something, like in PublishPresence + + iWaitter->WaitForL( KWaitTime ); + + } + +void T_XIMPTestConnection::DoWithdrawPresenceGrantFromPresentityGroupMembersL( const MXIMPIdentity& aGroupId, + TXIMPRequestId aReqId ) + { + PluginAPIMethodCommonL( aReqId ); + + SetBooleanToCurrent( EXIMPPlgTestWithdrawPresenceFromPresentityGroupMembersCalled ); + + // TODO do something, like in PublishPresence + + iWaitter->WaitForL( KWaitTime ); + + } + +void T_XIMPTestConnection::DoSubscribePresenceBlockListL( TXIMPRequestId aReqId ) + { + PluginAPIMethodCommonL( aReqId ); + + SetBooleanToCurrent( EXIMPPlgTestSubscribePresenceBlockListCalled ); + + // TODO do something, like in PublishPresence + + iWaitter->WaitForL( KWaitTime ); + + } + +void T_XIMPTestConnection::DoUnsubscribePresenceBlockListL( TXIMPRequestId aReqId ) + { + PluginAPIMethodCommonL( aReqId ); + + SetBooleanToCurrent( EXIMPPlgTestUnsubscribePresenceBlockListCalled ); + + // TODO do something, like in PublishPresence + + iWaitter->WaitForL( KWaitTime ); + + } +void T_XIMPTestConnection::DoBlockPresenceForPresentityL( const MXIMPIdentity& aPresentityId, + TXIMPRequestId aReqId ) + { + PluginAPIMethodCommonL( aReqId ); + + SetBooleanToCurrent( EXIMPPlgTestBlockPresenceForPresentityCalled ); + + // TODO do something, like in PublishPresence + + iWaitter->WaitForL( KWaitTime ); + + } +void T_XIMPTestConnection::DoCancelPresenceBlockFromPresentityL( const MXIMPIdentity& aPresentityId, + TXIMPRequestId aReqId ) + { + PluginAPIMethodCommonL( aReqId ); + + SetBooleanToCurrent( EXIMPPlgTestCancelPresenceBlockFromPresentityCalled ); + + // TODO do something, like in PublishPresence + + iWaitter->WaitForL( KWaitTime ); + + } + + + +// --------------------------------------------------------------------------- +// T_XIMPTestConnection::PluginAPIMethodCommonL +// --------------------------------------------------------------------------- +// +void T_XIMPTestConnection::PluginAPIMethodCommonL( TXIMPRequestId& aOpId ) + { + iReqId = aOpId; + + TInt index = CXIMPTestMessenger::GetPluginIndex(); + TInt count = iClients.Count(); + for( TInt a = 0; a < count; ++a ) + { + if( iClients[ a ]->iPluginIndex == index ) + { + iCurrentMessenger = iClients[ a ]->iMessenger; + } + } + iCurrentMessenger->HandleLeaveL(); + // handle other errors here + if ( iCurrentMessenger->GetBoolean( EXIMPTestPlgBehaveInvalidReqId ) ) + { + // arbitrarily mangle the given request id + TXIMPRequestIdBuilder idBuilder; + idBuilder.SetProtocolId( 123 ); + idBuilder.SetSessionId( 456 ); + idBuilder.SetRequestId( 789 ); + //iReqId = TXIMPRequestId( 123, 456, 789 ); + iReqId = idBuilder.BuildRequestId(); + } + } + +// --------------------------------------------------------------------------- +// T_XIMPTestConnection::WaitCompleted() +// --------------------------------------------------------------------------- +// +void T_XIMPTestConnection::WaitCompleted( TInt /* aRetVal */ ) + { + TInt errorCode = iCurrentMessenger->GetError(); + +/* + if ( iSessionLostFailReconnects ) + { + // fail all reconnects + errorCode = KErrTimedOut; + iConnectedClients = 0; + } +*/ + MXIMPStatus* status = iConnectionHost->ObjectFactory().NewStatusLC(); + CleanupStack::Pop(); // status. + status->SetResultCode( errorCode ); + + MXIMPRestrictedObjectCollection* reqCompleteParams = iCurrentMessenger->GetReqCompleteParams(); + + if( reqCompleteParams ) + { + iConnectionHost->HandleRequestCompleted( iReqId, status, reqCompleteParams ); + reqCompleteParams = NULL; + } + else + { + iConnectionHost->HandleRequestCompleted( iReqId, status ); + } + + if ( iSessionLostFailReconnects ) + { + // doing a sequence of failing reconnects + return; + } + + // check if test code wants us to fake session lost + TInt val = iCurrentMessenger->GetValueFor( EXIMPTestPlgSessionLostStrategy ); + + if ( val != EXIMPPrtValSessionLostEmpty ) + { + // yep, fake session lost + + // reset the old value! otherwise timer will restart upon next operation. + iCurrentMessenger->SetValueFor( EXIMPTestPlgSessionLostStrategy, EXIMPPrtValSessionLostEmpty ); + + iSessionLostReconnect = val == EXIMPPrtValSessionLostReconnect; + iSessionLostFailReconnects = val == EXIMPPrtValSessionLostReconnectExhaustAttempts; + + // start another wait (5 sec) with callback. + TInt time = 1000000 * 5; + TCallBack callback( ReconnectSimulator, this ); + iAuxTimer->Start( time, time, callback ); + } + + delete iClientToBeDeleted; + iClientToBeDeleted = NULL; + + } + +// --------------------------------------------------------------------------- +// RECONNECTION SIMULATOR ROUTINES +// --------------------------------------------------------------------------- +// +TInt T_XIMPTestConnection::ReconnectSimulator( TAny* aMyself ) + { +// (static_cast(aMyself))->DoReconnectSimulator(); + return 0; // ignored by CPeriodic + } + +void T_XIMPTestConnection::DoReconnectSimulator() + { +/* TRAPD( err, DoReconnectSimulatorL() ); + if ( err != KErrNone ) + { + // TODO what to do? is this enough to fail testcode + User::Panic( _L("XIMPTestPrt"), 424242 ); + } + */ + } + +void T_XIMPTestConnection::DoReconnectSimulatorL() + { + iAuxTimer->Cancel(); // must stop it from running again +/* + // connection dies. + iConnectedClients = 0; + + if ( iSessionLostReconnect || iSessionLostFailReconnects ) + { + // tell host to try to reconnect + iConnectionHost->HandleConnectionLost( iStatus ); + } + else + { + // tell host to kill connection + iConnectionHost->HandleConnectionTerminated( iStatus ); + } +*/ + } + +void T_XIMPTestConnection::SetBooleanToCurrent( TXIMPTestPropertyKeys aKey ) + { + if( iCurrentMessenger ) + { + iCurrentMessenger->SetBoolean( aKey ); + } + } + +void T_XIMPTestConnection::SetBoolean( TXIMPTestPropertyKeys aKey ) + { + TInt count = iClients.Count(); + for( TInt a = 0; a < count ; ++a ) + { + iClients[ a ]->iMessenger->SetBoolean( aKey ); + } + } + +// --------------------------------------------------------------------------- +// T_XIMPTestConnection::GetInterface() +// --------------------------------------------------------------------------- +// +TAny* T_XIMPTestConnection::GetInterface( + TInt32 aInterfaceId, + TIfGetOps /* aOptions */ ) + { + if ( aInterfaceId == MXIMPProtocolConnection::KInterfaceId ) + { + // caller wants this interface + MXIMPProtocolConnection* myIf = this; + return myIf; + } + else if( aInterfaceId == MProtocolPresencePublishing::KInterfaceId ) + { + // caller wants this interface + MProtocolPresencePublishing* myIf = this; + return myIf; + } + else if( aInterfaceId == MProtocolPresenceWatching::KInterfaceId ) + { + // caller wants this interface + MProtocolPresenceWatching* myIf = this; + return myIf; + } + else if( aInterfaceId == MProtocolPresenceAuthorization::KInterfaceId ) + { + // caller wants this interface + MProtocolPresenceAuthorization* myIf = this; + return myIf; + } + else if( aInterfaceId == MProtocolPresentityGroups::KInterfaceId ) + { + // caller wants this interface + MProtocolPresentityGroups* myIf = this; + return myIf; + } + else if( aInterfaceId == T_XIMPTestConnection::KClassId ) + { + return this; + } + else + { + return NULL; + } + } + +// --------------------------------------------------------------------------- +// T_XIMPTestConnection::GetInterface() +// --------------------------------------------------------------------------- +// +const TAny* T_XIMPTestConnection::GetInterface( + TInt32 aInterfaceId, + TIfGetOps /* aOptions */ ) const + { + if ( aInterfaceId == MXIMPProtocolConnection::KInterfaceId ) + { + // caller wants this interface + const MXIMPProtocolConnection* myIf = this; + return myIf; + } + else if( aInterfaceId == MProtocolPresencePublishing::KInterfaceId ) + { + // caller wants this interface + const MProtocolPresencePublishing* myIf = this; + return myIf; + } + else if( aInterfaceId == MProtocolPresenceWatching::KInterfaceId ) + { + // caller wants this interface + const MProtocolPresenceWatching* myIf = this; + return myIf; + } + else if( aInterfaceId == MProtocolPresenceAuthorization::KInterfaceId ) + { + // caller wants this interface + const MProtocolPresenceAuthorization* myIf = this; + return myIf; + } + else if( aInterfaceId == MProtocolPresentityGroups::KInterfaceId ) + { + // caller wants this interface + const MProtocolPresentityGroups* myIf = this; + return myIf; + } + else if( aInterfaceId == T_XIMPTestConnection::KClassId ) + { + return this; + } + else + { + return NULL; + } + } + +// --------------------------------------------------------------------------- +// T_XIMPTestConnection::GetInterfaceId() +// --------------------------------------------------------------------------- +// +TInt32 T_XIMPTestConnection::GetInterfaceId() const + { + return MXIMPProtocolConnection::KInterfaceId; + } + + +// --------------------------------------------------------------------------- +// Key value pair table to identify correct constructor +// function for the requested interface. +// --------------------------------------------------------------------------- +// +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY( K_PRFW_TST_PROTOCOL_1_IMPLEMENTATION_UID, + T_XIMPTestProtocol::NewL ) + }; + + +// --------------------------------------------------------------------------- +// Exported function to return the implementation proxy table +// --------------------------------------------------------------------------- +// +EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount ) + { + aTableCount = sizeof( ImplementationTable ) / sizeof( TImplementationProxy ); + return ImplementationTable; + } + +// --------------------------------------------------------------------------- +// T_XIMPTestProtocol::T_XIMPTestProtocol() +// --------------------------------------------------------------------------- +// +T_XIMPTestProtocol::T_XIMPTestProtocol() + { + } + + +// --------------------------------------------------------------------------- +// T_XIMPTestProtocol::ConstructL() +// --------------------------------------------------------------------------- +// +void T_XIMPTestProtocol::ConstructL() + { + } + + +// --------------------------------------------------------------------------- +// T_XIMPTestProtocol::NewLC() +// --------------------------------------------------------------------------- +// +T_XIMPTestProtocol* T_XIMPTestProtocol::NewLC() + { + T_XIMPTestProtocol* self = new( ELeave ) T_XIMPTestProtocol(); + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + + +// --------------------------------------------------------------------------- +// T_XIMPTestProtocol::NewL() +// --------------------------------------------------------------------------- +// +T_XIMPTestProtocol* T_XIMPTestProtocol::NewL() + { + T_XIMPTestProtocol* self = T_XIMPTestProtocol::NewLC(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// T_XIMPTestProtocol::~T_XIMPTestProtocol() +// --------------------------------------------------------------------------- +// +T_XIMPTestProtocol::~T_XIMPTestProtocol() + { + iConnections.Close(); + } + +// --------------------------------------------------------------------------- +// T_XIMPTestProtocol::PrimeHost() +// --------------------------------------------------------------------------- +// +void T_XIMPTestProtocol::PrimeHost( MXIMPProtocolPluginHost& aHost ) + { + iHost = &aHost; + } + +// --------------------------------------------------------------------------- +// T_XIMPTestProtocol::AcquireConnectionL() +// --------------------------------------------------------------------------- +// +MXIMPProtocolConnection& T_XIMPTestProtocol::AcquireConnectionL( + const MXIMPServiceInfo& aServiceInfo, + const MXIMPContextClientInfo& aClientCtxInfo ) + { + T_XIMPTestConnection* newConnection = T_XIMPTestConnection::NewLC( aServiceInfo, aClientCtxInfo ); + TLinearOrder< T_XIMPTestConnection > order( T_XIMPTestConnection::OrderOfConnections ); + TInt index = iConnections.FindInOrder( newConnection, order ); + if( index != KErrNotFound ) + { + User::LeaveIfError( index ); + CleanupStack::PopAndDestroy(); // newConnection + newConnection = iConnections[ index ]; + } + else + { + iConnections.InsertInOrderL( newConnection, order ); + CleanupStack::Pop(); //newConnection + } + return *newConnection; + } + +// --------------------------------------------------------------------------- +// T_XIMPTestProtocol::ReleaseConnection() +// --------------------------------------------------------------------------- +// +void T_XIMPTestProtocol::ReleaseConnection( MXIMPProtocolConnection& aConnection ) + { + TLinearOrder< T_XIMPTestConnection > order( T_XIMPTestConnection::OrderOfConnections ); + T_XIMPTestConnection* connection = ( T_XIMPTestConnection* )( aConnection.GetInterface( + T_XIMPTestConnection::KClassId, + MXIMPBase::EPanicIfUnknown ) ); + TInt index = iConnections.FindInOrder( connection, order ); + if( index >= 0 ) + { + iConnections.Remove( index ); + } + delete connection; + } + +// --------------------------------------------------------------------------- +// T_XIMPTestProtocol::GetInterface() +// --------------------------------------------------------------------------- +// +TAny* T_XIMPTestProtocol::GetInterface( + TInt32 aInterfaceId, + TIfGetOps /* aOptions */ ) + { + if ( aInterfaceId == MXIMPProtocolPlugin::KInterfaceId ) + { + // caller wants this interface + MXIMPProtocolPlugin* myIf = this; + return myIf; + } + else + { + return NULL; + } + } + +// --------------------------------------------------------------------------- +// T_XIMPTestProtocol::GetInterface() +// --------------------------------------------------------------------------- +// +const TAny* T_XIMPTestProtocol::GetInterface( + TInt32 aInterfaceId, + TIfGetOps /* aOptions */ ) const + { + if ( aInterfaceId == MXIMPProtocolPlugin::KInterfaceId ) + { + // caller wants this interface + const MXIMPProtocolPlugin* myIf = this; + return myIf; + } + else + { + return NULL; + } + } + +// --------------------------------------------------------------------------- +// T_XIMPTestProtocol::GetInterfaceId() +// --------------------------------------------------------------------------- +// +TInt32 T_XIMPTestProtocol::GetInterfaceId() const + { + return MXIMPProtocolPlugin::KInterfaceId; + } + + + +// End of file + diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/tsrcprotocols/pr_prfwtestprotocol/pr_prfwtestprotocol.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/tsrcprotocols/pr_prfwtestprotocol/pr_prfwtestprotocol.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,403 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Test Protocol implementation for XIMP Framework + * +*/ + + +#ifndef T_PRFWTESTPROTOCOL_H +#define T_PRFWTESTPROTOCOL_H + + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "prfwwaitobserver.h" + +#include "prfwtestmessaging.h" + +class CXIMPTestGeneralWaiter; +class CXIMPTestMessenger; +class CPeriodic; +class CXIMPTestFileLogicHelper; +class CXIMPTestFileTool; +class MXIMPRestrictedObjectCollection; +class MProtocolImFeatures; +#define PRIMP_CLSID_CPRESENTITYGROUPINFOIMP 15000 + +class T_XIMPTestConnection :public CBase, + public MXIMPProtocolConnection, + public MProtocolPresenceFeatures, + public MProtocolPresencePublishing, + public MProtocolPresenceWatching, + public MProtocolPresenceAuthorization, + public MProtocolPresentityGroups, + public MXIMPProtocolConnectionHostObserver, + public T_MWaitObserver + + { + public: + /** The class ID. */ + enum { KClassId = PRIMP_CLSID_CPRESENTITYGROUPINFOIMP }; + + + class ClientWrapper : public CBase + { + private: + + void ConstructL( const TDesC& aClientId ); + + public: + + static ClientWrapper* NewLC( const TDesC& aClientId ); + void InitializeL( MXIMPProtocolConnectionHost& aConnectionHost ); + ~ClientWrapper(); + + public: + + RBuf iId; + CXIMPTestFileTool* iFileTool; + CXIMPTestMessenger* iMessenger; + CXIMPTestFileLogicHelper* iFileLogicHelper; + TInt iPluginIndex; + }; + + public: + + static T_XIMPTestConnection* NewL( const MXIMPServiceInfo& aServiceInfo, + const MXIMPContextClientInfo& aClientCtxInfo ); + static T_XIMPTestConnection* NewLC( const MXIMPServiceInfo& aServiceInfo, + const MXIMPContextClientInfo& aClientCtxInfo ); + + ~T_XIMPTestConnection(); + + + private: + + T_XIMPTestConnection(); + void ConstructL( const MXIMPServiceInfo& aServiceInfo, + const MXIMPContextClientInfo& aClientCtxInfo ); + + public: // From MXIMPProtocolConnection + + /** + * host for connection + */ + void PrimeHost( MXIMPProtocolConnectionHost& aHost ); + + void OpenSessionL( const MXIMPContextClientInfo& aClientCtxInfo, + TXIMPRequestId aReqId ); + + + void OpenSessionL( + const TInt& aSettingsId, + TXIMPRequestId aReqId ); + + void CloseSession( const MXIMPContextClientInfo& aClientCtxInfo, + TXIMPRequestId aReqId ); + + MProtocolPresenceFeatures& ProtocolPresenceFeatures(); + + //MProtocolImFeatures* ProtocolImFeatures(); + + TAny* GetProtocolInterface(TInt aInterfaceId); + + public: // MProtocolPresenceFeatures + MProtocolPresenceWatching& PresenceWatching(); + MProtocolPresencePublishing& PresencePublishing(); + MProtocolPresentityGroups& PresentityGroups(); + MProtocolPresenceAuthorization& PresenceAuthorization(); + + + public: // From MXIMPProtocolConnectionHostObserver + + void HandleProtocolConnectionHostEvent( + const MXIMPProtocolConnectionHost& aHost, + const MXIMPBase& aEvent ); + + + public: // from MPscPlugin + + + void GetSupportedFeaturesL( + CDesC8Array& aFeatures ) const; + + void DoPublishOwnPresenceL( + const MPresenceInfo& aPresence, + TXIMPRequestId aReqId ); + + void DoSubscribeOwnPresenceL( const MPresenceInfoFilter& aPif, + TXIMPRequestId aReqId ); + + void DoUnsubscribeOwnPresenceL( TXIMPRequestId aReqId ); + + void DoUpdateOwnPresenceSubscriptionPifL( const MPresenceInfoFilter& aPif, + TXIMPRequestId aReqId ); + + + void DoSubscribePresenceWatcherListL( TXIMPRequestId aReqId ); + void DoUnsubscribePresenceWatcherListL( TXIMPRequestId aReqId ); + + void DoSubscribePresentityGroupListL( TXIMPRequestId aReqId ); + void DoUnsubscribePresentityGroupListL( TXIMPRequestId aReqId ); + + void DoCreatePresentityGroupL( const MXIMPIdentity& aIdentity, + const TDesC16& aDisplayName, + TXIMPRequestId aReqId ); + void DoDeletePresentityGroupL( const MXIMPIdentity& aIdentity, + TXIMPRequestId aReqId ); + void DoUpdatePresentityGroupDisplayNameL( const MXIMPIdentity& aIdentity, + const TDesC16& aDisplayName, + TXIMPRequestId aReqId ); + void DoSubscribePresentityPresenceL( + const MXIMPIdentity& aIdentity, + const MPresenceInfoFilter& aPif, + TXIMPRequestId aReqId ); + void DoUpdatePresentityPresenceSubscriptionPifL( + const MXIMPIdentity& aIdentity, + const MPresenceInfoFilter& aPif, + TXIMPRequestId aReqId ); + void DoUnsubscribePresentityPresenceL( const MXIMPIdentity& aIdentity, + TXIMPRequestId aReqId ); + + void DoSubscribePresentityGroupContentL( const MXIMPIdentity& aGroupId, + TXIMPRequestId aReqId ); + + void DoUnsubscribePresentityGroupContentL( const MXIMPIdentity& aGroupId, + TXIMPRequestId aReqId ); + + void DoAddPresentityGroupMemberL( const MXIMPIdentity& aGroupId, + const MXIMPIdentity& aMemberId, + const TDesC16& aMemberDisplayName, + TXIMPRequestId aReqId ); + + void DoRemovePresentityGroupMemberL( const MXIMPIdentity& aGroupId, + const MXIMPIdentity& aMemberId, + TXIMPRequestId aReqId ); + + void DoUpdatePresentityGroupMemberDisplayNameL( const MXIMPIdentity& aGroupId, + const MXIMPIdentity& aMemberId, + const TDesC16& aMemberDisplayName, + TXIMPRequestId aReqId ); + void DoSubscribePresentityGroupMembersPresenceL( + const MXIMPIdentity& aIdentity, + const MPresenceInfoFilter& aPif, + TXIMPRequestId aReqId ); + + void DoUpdatePresentityGroupMembersPresenceSubscriptionPifL( + const MXIMPIdentity& aIdentity, + const MPresenceInfoFilter& aPif, + TXIMPRequestId aReqId ); + + void DoUnsubscribePresentityGroupMembersPresenceL( const MXIMPIdentity& aIdentity, + TXIMPRequestId aReqId ); + + void DoSubscribePresenceGrantRequestListL( TXIMPRequestId aReqId ); + + void DoUnsubscribePresenceGrantRequestListL( TXIMPRequestId aReqId ); + + void DoGrantPresenceForPresentityL( const MXIMPIdentity& aIdentity, + const MPresenceInfoFilter& aPif, + TXIMPRequestId aReqId ); + void DoGrantPresenceForPresentityGroupMembersL( const MXIMPIdentity& aGroupId, + const MPresenceInfoFilter& aPif, + TXIMPRequestId aReqId ); + + void DoGrantPresenceForEveryoneL( const MPresenceInfoFilter& aPif, + TXIMPRequestId aReqId ); + + void DoUpdatePresenceGrantPifForPresentityL( const MXIMPIdentity& aIdentity, + const MPresenceInfoFilter& aPif, + TXIMPRequestId aReqId ); + + void DoUpdatePresenceGrantPifForPresentityGroupMembersL( const MXIMPIdentity& aGroupId, + const MPresenceInfoFilter& aPif, + TXIMPRequestId aReqId ); + + void DoUpdatePresenceGrantPifForEveryoneL( const MPresenceInfoFilter& aPif, + TXIMPRequestId aReqId ); + + void DoWithdrawPresenceGrantFromPresentityL( const MXIMPIdentity& aIdentity, TXIMPRequestId aReqId ); + + void DoWithdrawPresenceGrantFromPresentityGroupMembersL( const MXIMPIdentity& aGroupId, + TXIMPRequestId aReqId ); + + void DoWithdrawPresenceGrantFromEveryoneL( TXIMPRequestId aReqId ); + + void DoSubscribePresenceBlockListL( TXIMPRequestId aReqId ); + void DoUnsubscribePresenceBlockListL( TXIMPRequestId aReqId ); + void DoBlockPresenceForPresentityL( const MXIMPIdentity& aPresentityId, + TXIMPRequestId aReqId ); + void DoCancelPresenceBlockFromPresentityL( const MXIMPIdentity& aPresentityId, + TXIMPRequestId aReqId ); + + public: // from T_MWaitObserver + + void WaitCompleted( TInt aRetVal ); + + + public: // from MXIMPBase + + TAny* GetInterface( + TInt32 aInterfaceId, + TIfGetOps aOptions ); + + const TAny* GetInterface( + TInt32 aInterfaceId, + TIfGetOps aOptions ) const; + + TInt32 GetInterfaceId() const; + + private: + /** + * All plugin API methods should call this method + * to handle test code to plugin communication + * properly. + * Add more common stuff here (such as new special messages + * which behave in a common way to all plugin API calls, etc.) + * @param aOpId The request id + */ + void PluginAPIMethodCommonL( TXIMPRequestId& aOpId ); + + /** + * Callback for aux timer + * @see TCallBack + */ + static TInt ReconnectSimulator( TAny* aMyself ); + + /** + * Actual callback called from ReconnectSimulator + */ + void DoReconnectSimulator(); + + /** + * Leaving version of aux timer callback. + */ + void DoReconnectSimulatorL(); + + void SetBooleanToCurrent( TXIMPTestPropertyKeys aKey ); + void SetBoolean( TXIMPTestPropertyKeys aKey ); + + public: + static TInt OrderOfConnections( const T_XIMPTestConnection& aFirst, + const T_XIMPTestConnection& aSecond ); + + private: + + static TInt OrderOfClients( const ClientWrapper& aFirst, + const ClientWrapper& aSecond ); + private: + + HBufC* iServerAddress; + HBufC* iUserName; + HBufC* iPassword; + HBufC* iClientId; + + //TInt iConnectedClients; + + RPointerArray< ClientWrapper > iClients; + ClientWrapper* iClientToBeDeleted; + + TXIMPRequestId iReqId; + CXIMPTestGeneralWaiter* iWaitter; + + MXIMPStatus* iStatus; + + // last received message + TXIMPTestMsg iLastMsg; + + // ETrue if reconnect is to be faked for session lost. + TBool iSessionLostReconnect; + + // ETrue if all reconnects are to be failed. + TBool iSessionLostFailReconnects; + + // auxiliary timer (session lost simulation) + CPeriodic* iAuxTimer; + + + /** + * File tool for monitoring events. + */ + //CXIMPTestFileTool* iFileTool; + + /** + * Host for connection + */ + MXIMPProtocolConnectionHost* iConnectionHost; + + CXIMPTestMessenger* iCurrentMessenger; + }; + +/** + * Example protocol plugin + * + * + * @lib ?library + * @since S60 v4.0 + */ +class T_XIMPTestProtocol : public CXIMPProtocolPluginBase + { + public: + + static T_XIMPTestProtocol* NewL(); + static T_XIMPTestProtocol* NewLC(); + + ~T_XIMPTestProtocol(); + + private: + + T_XIMPTestProtocol(); + void ConstructL(); + + public: // From MXIMPProtocolPlugin + + void PrimeHost( MXIMPProtocolPluginHost& aHost ); + + MXIMPProtocolConnection& AcquireConnectionL( + const MXIMPServiceInfo& aServiceInfo, + const MXIMPContextClientInfo& aClientCtxInfo ); + void ReleaseConnection( + MXIMPProtocolConnection& aConnection ); + + public: // from MXIMPBase + + TAny* GetInterface( + TInt32 aInterfaceId, + TIfGetOps aOptions ); + + const TAny* GetInterface( + TInt32 aInterfaceId, + TIfGetOps aOptions ) const; + + TInt32 GetInterfaceId() const; + + + private: // Data + + // Prime host + MXIMPProtocolPluginHost* iHost; + RXIMPObjOwningPtrArray< T_XIMPTestConnection > iConnections; + }; + +#endif // T_PRFWTESTPROTOCOL_H diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/tsrcprotocols/pr_prfwtestprotocol/pr_prfwtestprotocol.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/tsrcprotocols/pr_prfwtestprotocol/pr_prfwtestprotocol.mmp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,80 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project definition file for Presence Framework Test Protocol +* +*/ + +#include +#include "../prfwtestprotocols_resource.hrh" + +TARGET pr_prfwtestprotocol.dll +TARGETTYPE PLUGIN +UID XIMP_DLL_UID_ECOM_PLUGIN PRFW_DLL_UID_PR_PRFWTESTPROTOCOL +VENDORID VID_DEFAULT +CAPABILITY ALL -TCB + + +//ECOM RESOURCE +START RESOURCE pr_prfwtestprotocol.rss +TARGET pr_prfwtestprotocol.rsc +END // RESOURCE + +SOURCEPATH . +SOURCE pr_prfwtestprotocol.cpp + +SOURCEPATH ../../tsrcutils/testcaseutils +SOURCE prfwtestfilelogichelper.cpp +SOURCE prfwtestfiletool.cpp + +USERINCLUDE ../../../core/srcdatamodel +USERINCLUDE ../../../presence/srcpresencedatamodel +USERINCLUDE ../../../presence/srcpresencedatamodel/presentitygroups +USERINCLUDE ../../../presence/srcpresencedatamodel/presencewatching +USERINCLUDE ../../../presence/srcpresencedatamodel/presenceauthorization +USERINCLUDE ../../../presence/srcpresencedatamodel/presencepublishing +USERINCLUDE ../../../presence/srcpresencedatamodel/presenceinfo +USERINCLUDE ../../../core/srcutils +USERINCLUDE ../../tsrcprotocols +USERINCLUDE ../../tsrcutils/testcaseutils + +// TODO remove unnecessary +SYSTEMINCLUDE ../../../inc/core/base +SYSTEMINCLUDE ../../../inc/core/datamodel +SYSTEMINCLUDE ../../../inc/core/protocolplugin +SYSTEMINCLUDE ../../../inc/core/protocolpluginhost +SYSTEMINCLUDE ../../../inc/presence/presencedatamodel +SYSTEMINCLUDE ../../../inc/presence/presencemanagement +SYSTEMINCLUDE ../../../inc/presence/presenceprotocolplugin +SYSTEMINCLUDE ../../../inc/presence/presenceprotocolpluginhost + + + +MW_LAYER_SYSTEMINCLUDE +SYSTEMINCLUDE /epoc32/include/ecom + + +LIBRARY euser.lib +LIBRARY ecom.lib +LIBRARY bafl.lib +LIBRARY estor.lib +LIBRARY efsrv.lib +LIBRARY flogger.lib + +LIBRARY ximpdatamodel.lib +LIBRARY presencedatamodel.lib +LIBRARY ximputils.lib +LIBRARY prfwtestcaseutils.lib + + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/tsrcprotocols/pr_prfwtestprotocol/pr_prfwtestprotocol.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/tsrcprotocols/pr_prfwtestprotocol/pr_prfwtestprotocol.rss Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,53 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ECOM registery info for Presence Framework Test Protocol +* +*/ + +#include +#include + +#include "prfwtestprotocols_resource.hrh" + + + +// --------------------------------------------------------------------------- +// ECOM registery info for Presence Framework ECOM hook +// --------------------------------------------------------------------------- +// +RESOURCE REGISTRY_INFO theInfo + { + resource_format_version = RESOURCE_FORMAT_VERSION_2; + dll_uid = PRFW_DLL_UID_PR_PRFWTESTPROTOCOL; + + interfaces = + { + INTERFACE_INFO + { + interface_uid = XIMP_ECOM_IF_UID_PROTOCOL_PLUGIN_BASE_INTERFACE; + + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = PRFW_TST_PROTOCOL_1_IMPLEMENTATION_UID; + version_no = PRFW_TST_PROTOCOL_1_VERSION_NO; + display_name = PRFW_TST_PROTOCOL_1_DISPLAY_NAME; + default_data = PRFW_TST_PROTOCOL_1_DEFAULT_DATA; + opaque_data = PRFW_TST_PROTOCOL_1_OPAQUE_DATA; + } + }; + } + }; + } diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/tsrcprotocols/prfwtestprotocols.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/tsrcprotocols/prfwtestprotocols.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,49 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework Test Code +* +*/ + +#ifndef PRFWTESTPROTOCOLS_H +#define PRFWTESTPROTOCOLS_H + +#include + + +/** + * C++ compatible definitions for XIMP test protocols. + * + * This must be kept in-sync with definitions in + * "prfwtestprotocols_resource.hrh" + */ + +//XIMP primary test protocol +const TInt K_PRFW_TST_PROTOCOL_1_IMPLEMENTATION_UID = 0x10282DDF; +const TInt K_PRFW_TST_PROTOCOL_1_VERSION_NO = 1; +_LIT( K_PRFW_TST_PROTOCOL_1_DISPLAY_NAME, "XIMP primary test protocol" ); +_LIT( K_PRFW_TST_PROTOCOL_1_DEFAULT_DATA, "" ); +_LIT( K_PRFW_TST_PROTOCOL_1_OPAQUE_DATA, "

Nokiafeat/pres/pubfeat/pres/fetchfeat/pres/subssip" ); + + + +//XIMP secondary test protocols +const TInt K_PRFW_TST_PROTOCOL_2_IMPLEMENTATION_UID = 0x10282DE0; +const TInt K_PRFW_TST_PROTOCOL_3_IMPLEMENTATION_UID = 0x10282DE1; +const TInt K_PRFW_TST_PROTOCOL_4_IMPLEMENTATION_UID = 0x10282DE2; +const TInt K_PRFW_TST_PROTOCOL_5_IMPLEMENTATION_UID = 0x10282DE3; + + + +#endif // PRFWTESTPROTOCOLS_H + diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/tsrcprotocols/prfwtestprotocols_resource.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/tsrcprotocols/prfwtestprotocols_resource.hrh Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,62 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework Test Code +* +*/ + +#ifndef PRFWTESTPROTOCOLS_RESOURCE_HRH +#define PRFWTESTPROTOCOLS_RESOURCE_HRH + + + +/** + * System wide UID 2:s for ECom plugin dlls. + */ +#define XIMP_DLL_UID_ECOM_PLUGIN 0x10009D8D + + +/** + * Officially reserved UID 3 for the Presence Framework + * test protocol dll. + */ +#define PRFW_DLL_UID_PR_PRFWTESTPROTOCOL 0x10282DDD + + + +/** + * Resource file compatible defintions for PrFw test protocols. + * + * This must be kept in-sync with definitions in + * "prfwtestprotocols.h" + */ + +//PrFw primary test protocol +#define PRFW_TST_PROTOCOL_1_IMPLEMENTATION_UID 0x10282DDF +#define PRFW_TST_PROTOCOL_1_VERSION_NO 1 +#define PRFW_TST_PROTOCOL_1_DISPLAY_NAME "PrFw primary test protocol" +#define PRFW_TST_PROTOCOL_1_DEFAULT_DATA "" +#define PRFW_TST_PROTOCOL_1_OPAQUE_DATA "

Nokiafeat/pres/pubfeat/pres/fetchfeat/pres/subssip" + + + +//PrFw secondary test protocols +#define PRFW_TST_PROTOCOL_2_IMPLEMENTATION_UID 0x10282DE0 +#define PRFW_TST_PROTOCOL_3_IMPLEMENTATION_UID 0x10282DE1 +#define PRFW_TST_PROTOCOL_4_IMPLEMENTATION_UID 0x10282DE2 +#define PRFW_TST_PROTOCOL_5_IMPLEMENTATION_UID 0x10282DE3 + + + +#endif // PRFWTESTPROTOCOLS_RESOURCE_HRH + diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/tsrcutils/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/tsrcutils/bld.inf Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,22 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Build information file for prfwtestcaseutils.dll +* +*/ + + +#include "testcaseutils/bld.inf" +#include "processmaster/bld.inf" + +//#include "eunitcommon/move_tests_to_eunit.inf" diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/tsrcutils/bwins/prfwtestcaseutilsu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/tsrcutils/bwins/prfwtestcaseutilsu.def Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,113 @@ +EXPORTS + ??0TXIMPTestStatusEventSnapshot@@QAE@HHH@Z @ 1 NONAME ; TXIMPTestStatusEventSnapshot::TXIMPTestStatusEventSnapshot(int, int, int) + ??0TXIMPTestStatusEventSnapshot@@QAE@XZ @ 2 NONAME ; TXIMPTestStatusEventSnapshot::TXIMPTestStatusEventSnapshot(void) + ?AcceptedEventTypes@CXIMPTestStatusEventListener@@QAEAAV?$RArray@J@@XZ @ 3 NONAME ; class RArray & CXIMPTestStatusEventListener::AcceptedEventTypes(void) + ?AppendToTraitsL@CXIMPTestContextWrapper@@QAEXW4TXIMPTestStatusEventTemplate@@@Z @ 4 NONAME ; void CXIMPTestContextWrapper::AppendToTraitsL(enum TXIMPTestStatusEventTemplate) + ?AssertAddPresentityGroupMemberCalled@CXIMPTestMessenger@@QAEXH@Z @ 5 NONAME ; void CXIMPTestMessenger::AssertAddPresentityGroupMemberCalled(int) + ?AssertCloseSessionCalled@CXIMPTestMessenger@@QAEXH@Z @ 6 NONAME ; void CXIMPTestMessenger::AssertCloseSessionCalled(int) + ?AssertCreatePresentityGroupCalled@CXIMPTestMessenger@@QAEXH@Z @ 7 NONAME ; void CXIMPTestMessenger::AssertCreatePresentityGroupCalled(int) + ?AssertEquality@XIMPTestPresenceDataUtils@@SAXAAVMPresenceInfo@@0@Z @ 8 NONAME ; void XIMPTestPresenceDataUtils::AssertEquality(class MPresenceInfo &, class MPresenceInfo &) + ?AssertOpenSessionCalled@CXIMPTestMessenger@@QAEXH@Z @ 9 NONAME ; void CXIMPTestMessenger::AssertOpenSessionCalled(int) + ?AssertPluginDied@CXIMPTestMessenger@@QAEXH@Z @ 10 NONAME ; void CXIMPTestMessenger::AssertPluginDied(int) + ?AssertRemovePresentityGroupMemberCalled@CXIMPTestMessenger@@QAEXH@Z @ 11 NONAME ; void CXIMPTestMessenger::AssertRemovePresentityGroupMemberCalled(int) + ?AssertShareSessionCalled@CXIMPTestMessenger@@QAEXH@Z @ 12 NONAME ; void CXIMPTestMessenger::AssertShareSessionCalled(int) + ?AssertSubscribePresentityGroupContentCalled@CXIMPTestMessenger@@QAEXH@Z @ 13 NONAME ; void CXIMPTestMessenger::AssertSubscribePresentityGroupContentCalled(int) + ?AssertSubscribePresentityGroupListCalled@CXIMPTestMessenger@@QAEXH@Z @ 14 NONAME ; void CXIMPTestMessenger::AssertSubscribePresentityGroupListCalled(int) + ?AssertUnshareSessionCalled@CXIMPTestMessenger@@QAEXH@Z @ 15 NONAME ; void CXIMPTestMessenger::AssertUnshareSessionCalled(int) + ?AssertUnsubscribePresentityGroupContentCalled@CXIMPTestMessenger@@QAEXH@Z @ 16 NONAME ; void CXIMPTestMessenger::AssertUnsubscribePresentityGroupContentCalled(int) + ?AssertUnsubscribePresentityGroupListCalled@CXIMPTestMessenger@@QAEXH@Z @ 17 NONAME ; void CXIMPTestMessenger::AssertUnsubscribePresentityGroupListCalled(int) + ?AssertUpdatePresentityGroupDisplayNameCalled@CXIMPTestMessenger@@QAEXH@Z @ 18 NONAME ; void CXIMPTestMessenger::AssertUpdatePresentityGroupDisplayNameCalled(int) + ?AssertUpdatePresentityGroupMemberDisplayNameCalled@CXIMPTestMessenger@@QAEXH@Z @ 19 NONAME ; void CXIMPTestMessenger::AssertUpdatePresentityGroupMemberDisplayNameCalled(int) + ?BindL@CXIMPTestContextWrapper@@QAEXH@Z @ 20 NONAME ; void CXIMPTestContextWrapper::BindL(int) + ?BindL@CXIMPTestContextWrapper@@QAEXVTUid@@ABVTDesC16@@11@Z @ 21 NONAME ; void CXIMPTestContextWrapper::BindL(class TUid, class TDesC16 const &, class TDesC16 const &, class TDesC16 const &) + ?BindWithSettingsL@CXIMPTestContextWrapper@@QAEXH@Z @ 22 NONAME ; void CXIMPTestContextWrapper::BindWithSettingsL(int) + ?CleanAllL@CXIMPTestFileTool@@SAXXZ @ 23 NONAME ; void CXIMPTestFileTool::CleanAllL(void) + ?ClearListener@CXIMPTestContextWrapper@@QAEXXZ @ 24 NONAME ; void CXIMPTestContextWrapper::ClearListener(void) + ?CommonAssert@CXIMPTestMessenger@@ABEXW4TXIMPTestPropertyKeys@@HABVTDesC8@@1@Z @ 25 NONAME ; void CXIMPTestMessenger::CommonAssert(enum TXIMPTestPropertyKeys, int, class TDesC8 const &, class TDesC8 const &) const + ?Contains@XIMPTestPresenceDataUtils@@QBEHAAVMPresenceInfo@@0@Z @ 26 NONAME ; int XIMPTestPresenceDataUtils::Contains(class MPresenceInfo &, class MPresenceInfo &) const + ?CreateGroupContentEventLCX@XIMPTestEventFactory@@SAPAVCPresentityGroupContentEventImp@@ABVTDesC16@@00W4TTestPGLContentArraySpecifier@1@00W4TSubscriptionState@MXIMPDataSubscriptionState@@W4TDataState@6@@Z @ 27 NONAME ; class CPresentityGroupContentEventImp * XIMPTestEventFactory::CreateGroupContentEventLCX(class TDesC16 const &, class TDesC16 const &, class TDesC16 const &, enum XIMPTestEventFactory::TTestPGLContentArraySpecifier, class TDesC16 const &, class TDesC16 const &, enum MXIMPDataSubscriptionState::TSubscriptionState, enum MXIMPDataSubscriptionState::TDataState) + ?CreateGroupListEventLCX@XIMPTestEventFactory@@SAPAVCPresentityGroupListEventImp@@ABVTDesC16@@0W4TTestPGLArraySpecifier@1@00W4TSubscriptionState@MXIMPDataSubscriptionState@@W4TDataState@6@@Z @ 28 NONAME ; class CPresentityGroupListEventImp * XIMPTestEventFactory::CreateGroupListEventLCX(class TDesC16 const &, class TDesC16 const &, enum XIMPTestEventFactory::TTestPGLArraySpecifier, class TDesC16 const &, class TDesC16 const &, enum MXIMPDataSubscriptionState::TSubscriptionState, enum MXIMPDataSubscriptionState::TDataState) + ?CreateWrapperL@CXIMPTestContextWrapperMgr@@QAEXH@Z @ 29 NONAME ; void CXIMPTestContextWrapperMgr::CreateWrapperL(int) + ?DeletePresenceContext@CXIMPTestContextWrapper@@QAEXXZ @ 30 NONAME ; void CXIMPTestContextWrapper::DeletePresenceContext(void) + ?DeletePubSubKeys@CXIMPTestMessenger@@QAEXXZ @ 31 NONAME ; void CXIMPTestMessenger::DeletePubSubKeys(void) + ?Equals@TXIMPTestStatusEventSnapshot@@QBEHABV1@@Z @ 32 NONAME ; int TXIMPTestStatusEventSnapshot::Equals(class TXIMPTestStatusEventSnapshot const &) const + ?Equals@XIMPTestPresenceDataUtils@@QBEHAAVCPresenceInfoImp@@0@Z @ 33 NONAME ; int XIMPTestPresenceDataUtils::Equals(class CPresenceInfoImp &, class CPresenceInfoImp &) const + ?ExpectL@CXIMPTestListener@@QAEXPAVCXIMPApiObjBase@@@Z @ 34 NONAME ; void CXIMPTestListener::ExpectL(class CXIMPApiObjBase *) + ?ExternalizeL@CXIMPTestFileSrvMsg@@QBEXAAVRWriteStream@@@Z @ 35 NONAME ; void CXIMPTestFileSrvMsg::ExternalizeL(class RWriteStream &) const + ?FileTool@CXIMPTestContextWrapper@@QBEAAVCXIMPTestFileTool@@XZ @ 36 NONAME ; class CXIMPTestFileTool & CXIMPTestContextWrapper::FileTool(void) const + ?GenerateIdentityLC@XIMPTestPresenceDataUtils@@SAPAVCXIMPIdentityImp@@PBVTDesC8@@W4TPresenceDataGroup@1@@Z @ 37 NONAME ; class CXIMPIdentityImp * XIMPTestPresenceDataUtils::GenerateIdentityLC(class TDesC8 const *, enum XIMPTestPresenceDataUtils::TPresenceDataGroup) + ?GenerateInfoFilterLC@XIMPTestPresenceDataUtils@@SAPAVCPresenceInfoFilterImp@@PBVTDesC8@@W4TPresenceDataGroup@1@@Z @ 38 NONAME ; class CPresenceInfoFilterImp * XIMPTestPresenceDataUtils::GenerateInfoFilterLC(class TDesC8 const *, enum XIMPTestPresenceDataUtils::TPresenceDataGroup) + ?GenerateInfoLC@XIMPTestPresenceDataUtils@@SAPAVCPresenceInfoImp@@PBVTDesC8@@W4TPresenceDataGroup@1@@Z @ 39 NONAME ; class CPresenceInfoImp * XIMPTestPresenceDataUtils::GenerateInfoLC(class TDesC8 const *, enum XIMPTestPresenceDataUtils::TPresenceDataGroup) + ?GetBoolean@CXIMPTestMessenger@@QBEHW4TXIMPTestPropertyKeys@@@Z @ 40 NONAME ; int CXIMPTestMessenger::GetBoolean(enum TXIMPTestPropertyKeys) const + ?GetClient@CXIMPTestContextWrapper@@QAEPAVMXIMPClient@@XZ @ 41 NONAME ; class MXIMPClient * CXIMPTestContextWrapper::GetClient(void) + ?GetContext@CXIMPTestContextWrapper@@QAEPAVMXIMPContext@@XZ @ 42 NONAME ; class MXIMPContext * CXIMPTestContextWrapper::GetContext(void) + ?GetError@CXIMPTestMessenger@@QAEHXZ @ 43 NONAME ; int CXIMPTestMessenger::GetError(void) + ?GetEventListener@CXIMPTestContextWrapper@@QAEPAVCXIMPTestStatusEventListener@@XZ @ 44 NONAME ; class CXIMPTestStatusEventListener * CXIMPTestContextWrapper::GetEventListener(void) + ?GetEventTemplateL@CXIMPTestStatusEventListener@@QAEXAAV?$RArray@VTXIMPTestStatusEventSnapshot@@@@W4TXIMPTestStatusEventTemplate@@@Z @ 45 NONAME ; void CXIMPTestStatusEventListener::GetEventTemplateL(class RArray &, enum TXIMPTestStatusEventTemplate) + ?GetLeave@CXIMPTestMessenger@@QAEHXZ @ 46 NONAME ; int CXIMPTestMessenger::GetLeave(void) + ?GetMessenger@CXIMPTestContextWrapper@@QAEPAVCXIMPTestMessenger@@XZ @ 47 NONAME ; class CXIMPTestMessenger * CXIMPTestContextWrapper::GetMessenger(void) + ?GetPluginIndex@CXIMPTestMessenger@@SAHXZ @ 48 NONAME ; int CXIMPTestMessenger::GetPluginIndex(void) + ?GetPresenceFeatures@CXIMPTestContextWrapper@@QAEPAVMPresenceFeatures@@XZ @ 49 NONAME ; class MPresenceFeatures * CXIMPTestContextWrapper::GetPresenceFeatures(void) + ?GetReqCompleteParams@CXIMPTestMessenger@@QAEPAVMXIMPRestrictedObjectCollection@@XZ @ 50 NONAME ; class MXIMPRestrictedObjectCollection * CXIMPTestMessenger::GetReqCompleteParams(void) + ?GetReqCompletionErrL@CXIMPTestStatusEventListener@@QBEHABVTXIMPRequestId@@@Z @ 51 NONAME ; int CXIMPTestStatusEventListener::GetReqCompletionErrL(class TXIMPRequestId const &) const + ?GetStatusTraits@CXIMPTestContextWrapper@@QAEPAV?$RArray@VTXIMPTestStatusEventSnapshot@@@@XZ @ 52 NONAME ; class RArray * CXIMPTestContextWrapper::GetStatusTraits(void) + ?GetValueFor@CXIMPTestMessenger@@QBEHW4TXIMPTestPropertyKeys@@@Z @ 53 NONAME ; int CXIMPTestMessenger::GetValueFor(enum TXIMPTestPropertyKeys) const + ?GetWrapperL@CXIMPTestContextWrapperMgr@@QAEPAVCXIMPTestContextWrapper@@H@Z @ 54 NONAME ; class CXIMPTestContextWrapper * CXIMPTestContextWrapperMgr::GetWrapperL(int) + ?HandleLeaveL@CXIMPTestMessenger@@QAEXXZ @ 55 NONAME ; void CXIMPTestMessenger::HandleLeaveL(void) + ?InsertPrefixL@XIMPTestPresenceDataUtils@@SAXPBVTDesC8@@AAVRBuf8@@@Z @ 56 NONAME ; void XIMPTestPresenceDataUtils::InsertPrefixL(class TDesC8 const *, class RBuf8 &) + ?InstanceId@CXIMPTestContextWrapper@@QBEABVTDesC16@@XZ @ 57 NONAME ; class TDesC16 const & CXIMPTestContextWrapper::InstanceId(void) const + ?InstanceId@CXIMPTestFileTool@@QBEABVTDesC16@@XZ @ 58 NONAME ; class TDesC16 const & CXIMPTestFileTool::InstanceId(void) const + ?InternalizeL@CXIMPTestFileSrvMsg@@QAEXAAVRReadStream@@@Z @ 59 NONAME ; void CXIMPTestFileSrvMsg::InternalizeL(class RReadStream &) + ?NewForAdaptationSideL@CXIMPTestMessenger@@SAPAV1@H@Z @ 60 NONAME ; class CXIMPTestMessenger * CXIMPTestMessenger::NewForAdaptationSideL(int) + ?NewForClientSideL@CXIMPTestMessenger@@SAPAV1@H@Z @ 61 NONAME ; class CXIMPTestMessenger * CXIMPTestMessenger::NewForClientSideL(int) + ?NewL@CXIMPTestContextWrapper@@SAPAV1@HPAVMXIMPClient@@@Z @ 62 NONAME ; class CXIMPTestContextWrapper * CXIMPTestContextWrapper::NewL(int, class MXIMPClient *) + ?NewL@CXIMPTestContextWrapperMgr@@SAPAV1@XZ @ 63 NONAME ; class CXIMPTestContextWrapperMgr * CXIMPTestContextWrapperMgr::NewL(void) + ?NewL@CXIMPTestFileSrvMsg@@SAPAV1@HABVTDesC8@@@Z @ 64 NONAME ; class CXIMPTestFileSrvMsg * CXIMPTestFileSrvMsg::NewL(int, class TDesC8 const &) + ?NewL@CXIMPTestFileTool@@SAPAV1@KABVTDesC16@@@Z @ 65 NONAME ; class CXIMPTestFileTool * CXIMPTestFileTool::NewL(unsigned long, class TDesC16 const &) + ?NewL@CXIMPTestFileTool@@SAPAV1@KH@Z @ 66 NONAME ; class CXIMPTestFileTool * CXIMPTestFileTool::NewL(unsigned long, int) + ?NewL@CXIMPTestGeneralWaiter@@SAPAV1@PAVT_MWaitObserver@@@Z @ 67 NONAME ; class CXIMPTestGeneralWaiter * CXIMPTestGeneralWaiter::NewL(class T_MWaitObserver *) + ?NewL@CXIMPTestListener@@SAPAV1@PAVMXIMPContext@@@Z @ 68 NONAME ; class CXIMPTestListener * CXIMPTestListener::NewL(class MXIMPContext *) + ?NewL@CXIMPTestStatusEventListener@@SAPAV1@HPAVMXIMPContext@@@Z @ 69 NONAME ; class CXIMPTestStatusEventListener * CXIMPTestStatusEventListener::NewL(int, class MXIMPContext *) + ?NewL@CXIMPTestWaitHelper@@SAPAV1@XZ @ 70 NONAME ; class CXIMPTestWaitHelper * CXIMPTestWaitHelper::NewL(void) + ?NewLC@CXIMPTestFileSrvMsg@@SAPAV1@XZ @ 71 NONAME ; class CXIMPTestFileSrvMsg * CXIMPTestFileSrvMsg::NewLC(void) + ?NumObjectsL@CXIMPTestFileTool@@QAEHXZ @ 72 NONAME ; int CXIMPTestFileTool::NumObjectsL(void) + ?NumSrvMsgL@CXIMPTestFileTool@@QAEHXZ @ 73 NONAME ; int CXIMPTestFileTool::NumSrvMsgL(void) + ?PayloadL@CXIMPTestFileSrvMsg@@QAEAAVTDesC8@@XZ @ 74 NONAME ; class TDesC8 & CXIMPTestFileSrvMsg::PayloadL(void) + ?PluginRestoreLC@CXIMPTestFileTool@@QAEPAVCXIMPApiEventBase@@H@Z @ 75 NONAME ; class CXIMPApiEventBase * CXIMPTestFileTool::PluginRestoreLC(int) + ?PluginStoreL@CXIMPTestFileTool@@QAEXABVTDesC8@@@Z @ 76 NONAME ; void CXIMPTestFileTool::PluginStoreL(class TDesC8 const &) + ?PrepareL@CXIMPTestFileTool@@QAEXXZ @ 77 NONAME ; void CXIMPTestFileTool::PrepareL(void) + ?ReRegisterEventFilterL@CXIMPTestStatusEventListener@@QAEXXZ @ 78 NONAME ; void CXIMPTestStatusEventListener::ReRegisterEventFilterL(void) + ?Reset@CXIMPTestListener@@QAEXXZ @ 79 NONAME ; void CXIMPTestListener::Reset(void) + ?ResetEventStack@CXIMPTestStatusEventListener@@QAEXXZ @ 80 NONAME ; void CXIMPTestStatusEventListener::ResetEventStack(void) + ?ResetEventTypeStack@CXIMPTestStatusEventListener@@QAEXXZ @ 81 NONAME ; void CXIMPTestStatusEventListener::ResetEventTypeStack(void) + ?ResetListener@CXIMPTestContextWrapper@@QAEXXZ @ 82 NONAME ; void CXIMPTestContextWrapper::ResetListener(void) + ?ResetPubSub@CXIMPTestMessenger@@QAEXXZ @ 83 NONAME ; void CXIMPTestMessenger::ResetPubSub(void) + ?SetBoolean@CXIMPTestMessenger@@QAEXW4TXIMPTestPropertyKeys@@@Z @ 84 NONAME ; void CXIMPTestMessenger::SetBoolean(enum TXIMPTestPropertyKeys) + ?SetError@CXIMPTestMessenger@@QAEXH@Z @ 85 NONAME ; void CXIMPTestMessenger::SetError(int) + ?SetEventObserver@CXIMPTestListener@@QAEXPAVMXIMPContextObserver@@@Z @ 86 NONAME ; void CXIMPTestListener::SetEventObserver(class MXIMPContextObserver *) + ?SetEventObserver@CXIMPTestStatusEventListener@@QAEXPAVMXIMPContextObserver@@@Z @ 87 NONAME ; void CXIMPTestStatusEventListener::SetEventObserver(class MXIMPContextObserver *) + ?SetEventSourceL@CXIMPTestListener@@QAEXPAVMXIMPContext@@@Z @ 88 NONAME ; void CXIMPTestListener::SetEventSourceL(class MXIMPContext *) + ?SetEventSourceL@CXIMPTestStatusEventListener@@QAEXPAVMXIMPContext@@@Z @ 89 NONAME ; void CXIMPTestStatusEventListener::SetEventSourceL(class MXIMPContext *) + ?SetLeave@CXIMPTestMessenger@@QAEXH@Z @ 90 NONAME ; void CXIMPTestMessenger::SetLeave(int) + ?SetNoError@CXIMPTestMessenger@@QAEXXZ @ 91 NONAME ; void CXIMPTestMessenger::SetNoError(void) + ?SetPluginIndex@CXIMPTestMessenger@@QAEXH@Z @ 92 NONAME ; void CXIMPTestMessenger::SetPluginIndex(int) + ?SetReqCompleteParams@CXIMPTestMessenger@@QAEXPAVMXIMPRestrictedObjectCollection@@@Z @ 93 NONAME ; void CXIMPTestMessenger::SetReqCompleteParams(class MXIMPRestrictedObjectCollection *) + ?SetValueFor@CXIMPTestMessenger@@QAEXW4TXIMPTestPropertyKeys@@H@Z @ 94 NONAME ; void CXIMPTestMessenger::SetValueFor(enum TXIMPTestPropertyKeys, int) + ?SetupEmptyListener@CXIMPTestContextWrapper@@QAEXXZ @ 95 NONAME ; void CXIMPTestContextWrapper::SetupEmptyListener(void) + ?SetupListenerL@CXIMPTestContextWrapper@@QAEXW4TXIMPTestStatusEventTemplate@@@Z @ 96 NONAME ; void CXIMPTestContextWrapper::SetupListenerL(enum TXIMPTestStatusEventTemplate) + ?SetupListenerReqCompleteL@CXIMPTestContextWrapper@@QAEXW4TXIMPTestStatusEventTemplate@@PAV?$RArray@J@@@Z @ 97 NONAME ; void CXIMPTestContextWrapper::SetupListenerReqCompleteL(enum TXIMPTestStatusEventTemplate, class RArray *) + ?SrvMsgId@CXIMPTestFileSrvMsg@@QAEHXZ @ 98 NONAME ; int CXIMPTestFileSrvMsg::SrvMsgId(void) + ?SrvMsgRestoreLC@CXIMPTestFileTool@@QAEPAVCXIMPTestFileSrvMsg@@H@Z @ 99 NONAME ; class CXIMPTestFileSrvMsg * CXIMPTestFileTool::SrvMsgRestoreLC(int) + ?SrvMsgStoreL@CXIMPTestFileTool@@QAEXPAVCXIMPTestFileSrvMsg@@@Z @ 100 NONAME ; void CXIMPTestFileTool::SrvMsgStoreL(class CXIMPTestFileSrvMsg *) + ?UnbindL@CXIMPTestContextWrapper@@QAEXXZ @ 101 NONAME ; void CXIMPTestContextWrapper::UnbindL(void) + ?VerifyEventStackL@CXIMPTestContextWrapper@@QAEXABVTPtrC8@@@Z @ 102 NONAME ; void CXIMPTestContextWrapper::VerifyEventStackL(class TPtrC8 const &) + ?VerifyEventStackL@CXIMPTestStatusEventListener@@QBEXABV?$TArray@VTXIMPTestStatusEventSnapshot@@@@ABVTDesC8@@@Z @ 103 NONAME ; void CXIMPTestStatusEventListener::VerifyEventStackL(class TArray const &, class TDesC8 const &) const + ?WaitAndAssertL@CXIMPTestListener@@QAEHXZ @ 104 NONAME ; int CXIMPTestListener::WaitAndAssertL(void) + ?WaitAnyEvent@CXIMPTestContextWrapper@@QAEXXZ @ 105 NONAME ; void CXIMPTestContextWrapper::WaitAnyEvent(void) + ?WaitAnyEvent@CXIMPTestStatusEventListener@@QAEXXZ @ 106 NONAME ; void CXIMPTestStatusEventListener::WaitAnyEvent(void) + ?WaitForL@CXIMPTestGeneralWaiter@@QAEXH@Z @ 107 NONAME ; void CXIMPTestGeneralWaiter::WaitForL(int) + ?WaitForL@CXIMPTestWaitHelper@@QAEXH@Z @ 108 NONAME ; void CXIMPTestWaitHelper::WaitForL(int) + ?WaitRequestAndStackEvents@CXIMPTestContextWrapper@@QAEXVTXIMPRequestId@@@Z @ 109 NONAME ; void CXIMPTestContextWrapper::WaitRequestAndStackEvents(class TXIMPRequestId) + ?WaitRequestAndStackEvents@CXIMPTestStatusEventListener@@QAEXABVTXIMPRequestId@@H@Z @ 110 NONAME ; void CXIMPTestStatusEventListener::WaitRequestAndStackEvents(class TXIMPRequestId const &, int) + ?WrapperCount@CXIMPTestContextWrapperMgr@@QBEHXZ @ 111 NONAME ; int CXIMPTestContextWrapperMgr::WrapperCount(void) const + diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/tsrcutils/eabi/prfwtestcaseutilsu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/tsrcutils/eabi/prfwtestcaseutilsu.def Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,132 @@ +EXPORTS + _ZN17CXIMPTestFileTool10NumSrvMsgLEv @ 1 NONAME + _ZN17CXIMPTestFileTool11NumObjectsLEv @ 2 NONAME + _ZN17CXIMPTestFileTool12PluginStoreLERK6TDesC8 @ 3 NONAME + _ZN17CXIMPTestFileTool12SrvMsgStoreLEP19CXIMPTestFileSrvMsg @ 4 NONAME + _ZN17CXIMPTestFileTool15PluginRestoreLCEi @ 5 NONAME + _ZN17CXIMPTestFileTool15SrvMsgRestoreLCEi @ 6 NONAME + _ZN17CXIMPTestFileTool4NewLEmRK7TDesC16 @ 7 NONAME + _ZN17CXIMPTestFileTool4NewLEmi @ 8 NONAME + _ZN17CXIMPTestFileTool8PrepareLEv @ 9 NONAME + _ZN17CXIMPTestFileTool9CleanAllLEv @ 10 NONAME + _ZN17CXIMPTestListener14WaitAndAssertLEv @ 11 NONAME + _ZN17CXIMPTestListener15SetEventSourceLEP12MXIMPContext @ 12 NONAME + _ZN17CXIMPTestListener16SetEventObserverEP20MXIMPContextObserver @ 13 NONAME + _ZN17CXIMPTestListener4NewLEP12MXIMPContext @ 14 NONAME + _ZN17CXIMPTestListener5ResetEv @ 15 NONAME + _ZN17CXIMPTestListener7ExpectLEP15CXIMPApiObjBase @ 16 NONAME + _ZN18CXIMPTestMessenger10SetBooleanE21TXIMPTestPropertyKeys @ 17 NONAME + _ZN18CXIMPTestMessenger10SetNoErrorEv @ 18 NONAME + _ZN18CXIMPTestMessenger11ResetPubSubEv @ 19 NONAME + _ZN18CXIMPTestMessenger11SetValueForE21TXIMPTestPropertyKeysi @ 20 NONAME + _ZN18CXIMPTestMessenger12HandleLeaveLEv @ 21 NONAME + _ZN18CXIMPTestMessenger14GetPluginIndexEv @ 22 NONAME + _ZN18CXIMPTestMessenger14SetPluginIndexEi @ 23 NONAME + _ZN18CXIMPTestMessenger16AssertPluginDiedEi @ 24 NONAME + _ZN18CXIMPTestMessenger16DeletePubSubKeysEv @ 25 NONAME + _ZN18CXIMPTestMessenger17NewForClientSideLEi @ 26 NONAME + _ZN18CXIMPTestMessenger20GetReqCompleteParamsEv @ 27 NONAME + _ZN18CXIMPTestMessenger20SetReqCompleteParamsEP31MXIMPRestrictedObjectCollection @ 28 NONAME + _ZN18CXIMPTestMessenger21NewForAdaptationSideLEi @ 29 NONAME + _ZN18CXIMPTestMessenger23AssertOpenSessionCalledEi @ 30 NONAME + _ZN18CXIMPTestMessenger24AssertCloseSessionCalledEi @ 31 NONAME + _ZN18CXIMPTestMessenger24AssertShareSessionCalledEi @ 32 NONAME + _ZN18CXIMPTestMessenger26AssertUnshareSessionCalledEi @ 33 NONAME + _ZN18CXIMPTestMessenger33AssertCreatePresentityGroupCalledEi @ 34 NONAME + _ZN18CXIMPTestMessenger36AssertAddPresentityGroupMemberCalledEi @ 35 NONAME + _ZN18CXIMPTestMessenger39AssertRemovePresentityGroupMemberCalledEi @ 36 NONAME + _ZN18CXIMPTestMessenger40AssertSubscribePresentityGroupListCalledEi @ 37 NONAME + _ZN18CXIMPTestMessenger42AssertUnsubscribePresentityGroupListCalledEi @ 38 NONAME + _ZN18CXIMPTestMessenger43AssertSubscribePresentityGroupContentCalledEi @ 39 NONAME + _ZN18CXIMPTestMessenger44AssertUpdatePresentityGroupDisplayNameCalledEi @ 40 NONAME + _ZN18CXIMPTestMessenger45AssertUnsubscribePresentityGroupContentCalledEi @ 41 NONAME + _ZN18CXIMPTestMessenger50AssertUpdatePresentityGroupMemberDisplayNameCalledEi @ 42 NONAME + _ZN18CXIMPTestMessenger8GetErrorEv @ 43 NONAME + _ZN18CXIMPTestMessenger8GetLeaveEv @ 44 NONAME + _ZN18CXIMPTestMessenger8SetErrorEi @ 45 NONAME + _ZN18CXIMPTestMessenger8SetLeaveEi @ 46 NONAME + _ZN19CXIMPTestFileSrvMsg12InternalizeLER11RReadStream @ 47 NONAME + _ZN19CXIMPTestFileSrvMsg4NewLEiRK6TDesC8 @ 48 NONAME + _ZN19CXIMPTestFileSrvMsg5NewLCEv @ 49 NONAME + _ZN19CXIMPTestFileSrvMsg8PayloadLEv @ 50 NONAME + _ZN19CXIMPTestFileSrvMsg8SrvMsgIdEv @ 51 NONAME + _ZN19CXIMPTestWaitHelper4NewLEv @ 52 NONAME + _ZN19CXIMPTestWaitHelper8WaitForLEi @ 53 NONAME + _ZN20XIMPTestEventFactory23CreateGroupListEventLCXERK7TDesC16S2_NS_22TTestPGLArraySpecifierES2_S2_N26MXIMPDataSubscriptionState18TSubscriptionStateENS4_10TDataStateE @ 54 NONAME + _ZN20XIMPTestEventFactory26CreateGroupContentEventLCXERK7TDesC16S2_S2_NS_29TTestPGLContentArraySpecifierES2_S2_N26MXIMPDataSubscriptionState18TSubscriptionStateENS4_10TDataStateE @ 55 NONAME + _ZN22CXIMPTestGeneralWaiter4NewLEP15T_MWaitObserver @ 56 NONAME + _ZN22CXIMPTestGeneralWaiter8WaitForLEi @ 57 NONAME + _ZN23CXIMPTestContextWrapper10GetContextEv @ 58 NONAME + _ZN23CXIMPTestContextWrapper12GetMessengerEv @ 59 NONAME + _ZN23CXIMPTestContextWrapper12WaitAnyEventEv @ 60 NONAME + _ZN23CXIMPTestContextWrapper13ClearListenerEv @ 61 NONAME + _ZN23CXIMPTestContextWrapper13ResetListenerEv @ 62 NONAME + _ZN23CXIMPTestContextWrapper14SetupListenerLE28TXIMPTestStatusEventTemplate @ 63 NONAME + _ZN23CXIMPTestContextWrapper15AppendToTraitsLE28TXIMPTestStatusEventTemplate @ 64 NONAME + _ZN23CXIMPTestContextWrapper15GetStatusTraitsEv @ 65 NONAME + _ZN23CXIMPTestContextWrapper16GetEventListenerEv @ 66 NONAME + _ZN23CXIMPTestContextWrapper17BindWithSettingsLEi @ 67 NONAME + _ZN23CXIMPTestContextWrapper17VerifyEventStackLERK6TPtrC8 @ 68 NONAME + _ZN23CXIMPTestContextWrapper18SetupEmptyListenerEv @ 69 NONAME + _ZN23CXIMPTestContextWrapper19GetPresenceFeaturesEv @ 70 NONAME + _ZN23CXIMPTestContextWrapper21DeletePresenceContextEv @ 71 NONAME + _ZN23CXIMPTestContextWrapper25SetupListenerReqCompleteLE28TXIMPTestStatusEventTemplateP6RArrayIlE @ 72 NONAME + _ZN23CXIMPTestContextWrapper25WaitRequestAndStackEventsE14TXIMPRequestId @ 73 NONAME + _ZN23CXIMPTestContextWrapper4NewLEiP11MXIMPClient @ 74 NONAME + _ZN23CXIMPTestContextWrapper5BindLE4TUidRK7TDesC16S3_S3_ @ 75 NONAME + _ZN23CXIMPTestContextWrapper5BindLEi @ 76 NONAME + _ZN23CXIMPTestContextWrapper7UnbindLEv @ 77 NONAME + _ZN23CXIMPTestContextWrapper9GetClientEv @ 78 NONAME + _ZN25XIMPTestPresenceDataUtils13InsertPrefixLEPK6TDesC8R5RBuf8 @ 79 NONAME + _ZN25XIMPTestPresenceDataUtils14AssertEqualityER13MPresenceInfoS1_ @ 80 NONAME + _ZN25XIMPTestPresenceDataUtils14GenerateInfoLCEPK6TDesC8NS_18TPresenceDataGroupE @ 81 NONAME + _ZN25XIMPTestPresenceDataUtils18GenerateIdentityLCEPK6TDesC8NS_18TPresenceDataGroupE @ 82 NONAME + _ZN25XIMPTestPresenceDataUtils20GenerateInfoFilterLCEPK6TDesC8NS_18TPresenceDataGroupE @ 83 NONAME + _ZN26CXIMPTestContextWrapperMgr11GetWrapperLEi @ 84 NONAME + _ZN26CXIMPTestContextWrapperMgr14CreateWrapperLEi @ 85 NONAME + _ZN26CXIMPTestContextWrapperMgr4NewLEv @ 86 NONAME + _ZN28CXIMPTestStatusEventListener12WaitAnyEventEv @ 87 NONAME + _ZN28CXIMPTestStatusEventListener15ResetEventStackEv @ 88 NONAME + _ZN28CXIMPTestStatusEventListener15SetEventSourceLEP12MXIMPContext @ 89 NONAME + _ZN28CXIMPTestStatusEventListener16SetEventObserverEP20MXIMPContextObserver @ 90 NONAME + _ZN28CXIMPTestStatusEventListener17GetEventTemplateLER6RArrayI28TXIMPTestStatusEventSnapshotE28TXIMPTestStatusEventTemplate @ 91 NONAME + _ZN28CXIMPTestStatusEventListener18AcceptedEventTypesEv @ 92 NONAME + _ZN28CXIMPTestStatusEventListener19ResetEventTypeStackEv @ 93 NONAME + _ZN28CXIMPTestStatusEventListener22ReRegisterEventFilterLEv @ 94 NONAME + _ZN28CXIMPTestStatusEventListener25WaitRequestAndStackEventsERK14TXIMPRequestIdi @ 95 NONAME + _ZN28CXIMPTestStatusEventListener4NewLEiP12MXIMPContext @ 96 NONAME + _ZN28TXIMPTestStatusEventSnapshotC1Eiii @ 97 NONAME + _ZN28TXIMPTestStatusEventSnapshotC1Ev @ 98 NONAME + _ZN28TXIMPTestStatusEventSnapshotC2Eiii @ 99 NONAME + _ZN28TXIMPTestStatusEventSnapshotC2Ev @ 100 NONAME + _ZNK17CXIMPTestFileTool10InstanceIdEv @ 101 NONAME + _ZNK18CXIMPTestMessenger10GetBooleanE21TXIMPTestPropertyKeys @ 102 NONAME + _ZNK18CXIMPTestMessenger11GetValueForE21TXIMPTestPropertyKeys @ 103 NONAME + _ZNK19CXIMPTestFileSrvMsg12ExternalizeLER12RWriteStream @ 104 NONAME + _ZNK23CXIMPTestContextWrapper10InstanceIdEv @ 105 NONAME + _ZNK23CXIMPTestContextWrapper8FileToolEv @ 106 NONAME + _ZNK25XIMPTestPresenceDataUtils6EqualsER16CPresenceInfoImpS1_ @ 107 NONAME + _ZNK25XIMPTestPresenceDataUtils8ContainsER13MPresenceInfoS1_ @ 108 NONAME + _ZNK26CXIMPTestContextWrapperMgr12WrapperCountEv @ 109 NONAME + _ZNK28CXIMPTestStatusEventListener17VerifyEventStackLERK6TArrayI28TXIMPTestStatusEventSnapshotERK6TDesC8 @ 110 NONAME + _ZNK28CXIMPTestStatusEventListener20GetReqCompletionErrLERK14TXIMPRequestId @ 111 NONAME + _ZNK28TXIMPTestStatusEventSnapshot6EqualsERKS_ @ 112 NONAME + _ZTI17CXIMPTestFileTool @ 113 NONAME ; ## + _ZTI17CXIMPTestListener @ 114 NONAME ; ## + _ZTI18CXIMPTestMessenger @ 115 NONAME ; ## + _ZTI19CXIMPTestFileSrvMsg @ 116 NONAME ; ## + _ZTI19CXIMPTestWaitHelper @ 117 NONAME ; ## + _ZTI22CXIMPTestGeneralWaiter @ 118 NONAME ; ## + _ZTI23CXIMPTestContextWrapper @ 119 NONAME ; ## + _ZTI26CXIMPTestContextWrapperMgr @ 120 NONAME ; ## + _ZTI28CXIMPTestStatusEventListener @ 121 NONAME ; ## + _ZTV17CXIMPTestFileTool @ 122 NONAME ; ## + _ZTV17CXIMPTestListener @ 123 NONAME ; ## + _ZTV18CXIMPTestMessenger @ 124 NONAME ; ## + _ZTV19CXIMPTestFileSrvMsg @ 125 NONAME ; ## + _ZTV19CXIMPTestWaitHelper @ 126 NONAME ; ## + _ZTV22CXIMPTestGeneralWaiter @ 127 NONAME ; ## + _ZTV23CXIMPTestContextWrapper @ 128 NONAME ; ## + _ZTV26CXIMPTestContextWrapperMgr @ 129 NONAME ; ## + _ZTV28CXIMPTestStatusEventListener @ 130 NONAME ; ## + diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/tsrcutils/eunitcommon/cglobalwaitingnote.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/tsrcutils/eunitcommon/cglobalwaitingnote.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,205 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework Test Code +* +*/ + +#ifndef CGLOBALWAITINGNOTE_H +#define CGLOBALWAITINGNOTE_H + +// INCLUDES +#include +#include +#include + + + +/** + * Global waiting message for XIMP Framework Eunit tests. + */ +class CGlobalWaitingNote : public CActive + { + public: + + /** + * Shows the waiting message with progress bar. + * + * @param aMessage The message text to show. + * @param aTotalShowTime The show time in milliseconds. + * @param aProgressSteps How many progress steps the progress bar should have. + */ + inline static void ShowMsgL( const TDesC& aMessage, + TInt aTotalShowTime, + TInt aProgressSteps ); + + + private: + + inline CGlobalWaitingNote(); + inline ~CGlobalWaitingNote(); + inline void ConstructL(); + + inline void DoShowMsgL( const TDesC& aMessage, + TInt aTotalShowTime, + TInt aProgressSteps ); + + inline static TInt ProgressTickCb( TAny* aSelf ); + inline TInt HandleProgressTick(); + + inline void RunL(); + inline TInt RunError( TInt aError ); + inline void DoCancel(); + + + + private: //data + + //OWN: Active Scheduler wait + CActiveSchedulerWait iWait; + + //OWN: Progress ticker + CPeriodic* iProgressTicker; + + //OWN: The global note. + CAknGlobalProgressDialog* iGlobalNote; + + //OWN: Total show time + TInt iTotalShowTime; + + //OWN: Progress interval + TInt iProgressInterval; + + //OWN: Current progress value + TInt iCurrentProgress; + }; + + + + + +// ----------------------------------------------------------------------------- +// CGlobalWaitingNote public functions +// ----------------------------------------------------------------------------- +// +void CGlobalWaitingNote::ShowMsgL( const TDesC& aMessage, + TInt aTotalShowTime, + TInt aProgressSteps ) + { + CGlobalWaitingNote* self = new (ELeave) CGlobalWaitingNote; + CleanupStack::PushL( self ); + self->ConstructL(); + self->DoShowMsgL( aMessage, + aTotalShowTime, + aProgressSteps ); + + CleanupStack::PopAndDestroy(); + } + + + +// ----------------------------------------------------------------------------- +// CGlobalWaitingNote private functions +// ----------------------------------------------------------------------------- +// +CGlobalWaitingNote::CGlobalWaitingNote() + : CActive( CActive::EPriorityStandard ) + { + } + + +CGlobalWaitingNote::~CGlobalWaitingNote() + { + delete iProgressTicker; + delete iGlobalNote; + } + + +void CGlobalWaitingNote::ConstructL() + { + CActiveScheduler::Add( this ); + iGlobalNote = CAknGlobalProgressDialog::NewL(); + + iProgressTicker = CPeriodic::NewL( CActive::EPriorityStandard ); + } + + + +void CGlobalWaitingNote::DoShowMsgL( const TDesC& aMessage, + TInt aTotalShowTime, + TInt aProgressSteps ) + { + iGlobalNote->ShowProgressDialogL( iStatus, + aMessage, + R_AVKON_SOFTKEYS_OK_EMPTY, + aTotalShowTime ); + SetActive(); + + iProgressInterval = aTotalShowTime / aProgressSteps; + iTotalShowTime = aTotalShowTime; + iCurrentProgress = 0; + + TCallBack progressCb( CGlobalWaitingNote::ProgressTickCb, this ); + iProgressTicker->Start( iProgressInterval, iProgressInterval, progressCb ); + + iWait.Start(); + } + + +TInt CGlobalWaitingNote::ProgressTickCb( TAny* aSelf ) + { + return ( (CGlobalWaitingNote*) aSelf )->HandleProgressTick(); + } + + +TInt CGlobalWaitingNote::HandleProgressTick() + { + if( iCurrentProgress < iTotalShowTime ) + { + iCurrentProgress += iProgressInterval; + iGlobalNote->UpdateProgressDialog( iCurrentProgress, iTotalShowTime ); + } + + else + { + iGlobalNote->ProcessFinished(); + } + + return KErrNone; + } + + + +void CGlobalWaitingNote::RunL() + { + iWait.AsyncStop(); + } + + +TInt CGlobalWaitingNote::RunError( TInt /*aError*/ ) + { + return KErrNone; + } + + +void CGlobalWaitingNote::DoCancel() + { + iGlobalNote->ProcessFinished(); + } + +#endif // CGLOBALWAITINGNOTE_H + +// end of file + + + diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/tsrcutils/eunitcommon/eunit_test_mover.pl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/tsrcutils/eunitcommon/eunit_test_mover.pl Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,80 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: XIMP Framework Test Code +# +#!perl +# +use strict; +use File::Path; + +$|=1; # ensures that any progress information sent to the screen is displayed immediately and not buffered + +# When this script is used with build tools, move is done only for WINSCW platform +if ( exists($ENV{'PLATFORM'}) && + ($ENV{'PLATFORM'} ne 'WINSCW' ) ) + { + print "\nEUnit Test DLL Mover: nothing to do for platform.\n"; + exit 0; + } + + +# destination folder where EUnit test dlls are placed +my $destFolder = "\\epoc32\\release\\winscw\\udeb\\z\\sys\\bin"; + +# ABLD command +# If this script is used with build chain, then "TO_BLDINF" env. variable points to the ABLD folder +# else use ABLD from current folder +my $abldCommand = ""; +if (exists($ENV{'TO_BLDINF'})) + { + $abldCommand = $ENV{'TO_BLDINF'} . "\\abld build winscw udeb -what"; + } +else + { + $abldCommand = "abld build winscw udeb -what"; + } + +# get option +my $option = $ARGV[0]; + +# get all the files produced by the ABLD +my @allProducedFiles = `$abldCommand`; + +# we're interested only from dlls +my @dllList = grep{ $_=~m#^.+\.dll$#i }@allProducedFiles; + +print "\n"; +foreach my $dll (@dllList) + { + chomp($dll); + + # skip those which are not mt_, ut_, t_, dec_ + my @paths = split(/\\/, $dll); + next unless (grep { $paths[-1] =~ m#^$_.+$#i; } (qw(mt_ ut_ t_ dec_))); + + if( $option eq "-wipe" ) + { + my($dllPath, $dllName) = $dll =~ m/(.*\\)(.*)$/; + $dll = $destFolder . "\\" . $dllName; + print "EUnit Test DLL Mover: CLEANING $dll\n"; + rmtree $dll; + } + else + { + print "EUnit Test DLL Mover: COPYING $dll to $destFolder\n"; + system "copy $dll ${destFolder}"; + } + } + + diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/tsrcutils/eunitcommon/eunittools.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/tsrcutils/eunitcommon/eunittools.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,164 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework Test Code +* +*/ + +#ifndef EUNITTOOLS_H +#define EUNITTOOLS_H + +#include +#include +#include +#include +#include +#include "cglobalwaitingnote.h" + + + +// ----------------------------------------------------------------------------- +// ASSERTION HELPER +// Leaves if the provided error code is decorator error. +// ----------------------------------------------------------------------------- +// +#define LEAVE_IF_DECORATOR_ERROR( aErr ) \ + { \ + if( aErr == KErrNoMemory ) \ + { \ + User::Leave( KErrNoMemory ); \ + } \ + } + + + +// ----------------------------------------------------------------------------- +// ASSERTION HELPER +// Returns from current function if the provided error code is decorator error. +// ----------------------------------------------------------------------------- +// +#define RETURN_IF_DECORATOR_ERROR( aErr ) \ + { \ + if( aErr == KErrNoMemory ) \ + { \ + return KErrNoMemory; \ + } \ + } + + + +// ----------------------------------------------------------------------------- +// MEMORY LEAK TRACKING HELPER +// Performs __UHEAP_MARK and shows visual notify. +// (Visual notify gives time to reset HookLogger heap checks.) +// ----------------------------------------------------------------------------- +// +#define __UHEAP_MARK_WITH_VISUAL_NOTIFY \ + { \ + __UHEAP_MARK; \ + EUnitTools::NotifyFromTestEnterL(); \ + } + + +// ----------------------------------------------------------------------------- +// MEMORY LEAK TRACKING HELPER +// Performs __UHEAP_MARKEND with JIT debugger on. +// ----------------------------------------------------------------------------- +// +#define __UHEAP_MARKEND_WITH_DEBUGGER \ + { \ + TBool __justInTime = User::JustInTime(); \ + User::SetJustInTime( ETrue ); \ + __UHEAP_MARKEND; \ + User::SetJustInTime( __justInTime ); \ + } + + + + + +// ----------------------------------------------------------------------------- +// TEST CASE DECLARATION +// Defines not decorated test case. +// ----------------------------------------------------------------------------- +// +#define PRFW_NOT_DECORATED_TEST( aDescription, aClass, aMethods, aCategory, aSetupMethod, aTestMethod, aTeardownMethod )\ +EUNIT_NOT_DECORATED_TEST( aDescription, aClass, aMethods, aCategory, aSetupMethod, aTestMethod, aTeardownMethod ) + +// ----------------------------------------------------------------------------- +// TEST CASE DECLARATION +// Defines decorated test case. +// ----------------------------------------------------------------------------- +// +#define PRFW_DECORATED_TEST( aDescription, aClass, aMethods, aCategory, aSetupMethod, aTestMethod, aTeardownMethod )\ +EUNIT_TEST( aDescription, aClass, aMethods, aCategory, aSetupMethod, aTestMethod, aTeardownMethod ) + +#define PRFW_ASSERT_DESC( aCondition, aDescription ) \ + if ( aCondition ) { } else { \ + TEUnitAssertionInfo __eunit_assert_info = { \ + __EUNIT_INTERNAL_ASSERT_BASE( aCondition, aDescription ), \ + NULL }; \ + EUnit::AssertionFailedL( __eunit_assert_info ); } + + +/** + * Collection of EUnit Tools + */ +class EUnitTools + { + public: + static inline void NotifyFromTestEnterL(); + + }; + + + +inline void EUnitTools::NotifyFromTestEnterL() + { + __UHEAP_MARK; + + TInt decoratorfailCount = -1; + CEUnitTestCaseDecorator* decorator = CEUnitTestCaseDecorator::ActiveTestCaseDecorator( KNullDesC ); //Any decorator + if( decorator ) + { + decorator->GetParameter( _L("ErrorCount"), //Run loop counter value + decoratorfailCount ); + } + + if( !decorator || + ( decoratorfailCount == 1 ) ) + { + EUNIT_DISABLE_ANY_DECORATOR; + + TFileName processImage = RProcess().FileName(); + TBuf<350> msg; + msg.Append( _L("Entering to test case. Test process:") ); + msg.Append( processImage ); + + CGlobalWaitingNote::ShowMsgL( msg, 15000000, 15 ); //15 seconds, 1 second steps + + EUNIT_ENABLE_ANY_DECORATOR; + } + } + + + +#endif // EUNITTOOLS_H + + + +// end of file + + + + diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/tsrcutils/eunitcommon/eunittstdll_armv5u.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/tsrcutils/eunitcommon/eunittstdll_armv5u.def Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + _Z16CreateTestSuiteLv @ 1 NONAME + diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/tsrcutils/eunitcommon/eunittstdll_winsu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/tsrcutils/eunitcommon/eunittstdll_winsu.def Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + ?CreateTestSuiteL@@YAPAVMEUnitTest@@XZ @ 1 NONAME ; class MEUnitTest * CreateTestSuiteL(void) + diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/tsrcutils/eunitcommon/eunittstdllbase.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/tsrcutils/eunitcommon/eunittstdllbase.hrh Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,53 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework Test code +* +*/ + +// To get the MW_LAYER_SYSTEMINCLUDE-definition +#include + +// DEFINES +#define KEUnitUid3 0x1000af59 +#define KEUnitTestDllUid2 0x1000af5a + + +// COMMON TEST DLL TARGET DEFINITIONS +#if defined(ARMCC) +deffile ./eunittstdll_armv5.def +#elif defined(MARM) +deffile ./eunittstdll_marm.def +#elif defined(WINS) +deffile ./eunittstdll_wins.def +#endif + +UID KEUnitTestDllUid2 KEUnitUid3 +TARGETTYPE dll +CAPABILITY ALL -TCB +VENDORID VID_DEFAULT +NOEXPORTLIBRARY + + +// COMMON TEST DLL INCLUDE PATHS +// Default system include paths for middleware layer modules. +MW_LAYER_SYSTEMINCLUDE +SYSTEMINCLUDE /epoc32/include/digia/eunit +USERINCLUDE . + + +// COMMON TEST DLL DEPENDENCIES TO SYSTEM COMPONENTS +LIBRARY euser.lib +LIBRARY eunit.lib +LIBRARY eunitutil.lib +LIBRARY aknnotify.lib diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/tsrcutils/eunitcommon/move_tests_to_eunit.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/tsrcutils/eunitcommon/move_tests_to_eunit.inf Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,26 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework Test Code +* +*/ +//////////////////////////////////////////////////////////// +// bld.inf extension +// Part of Presence Engine EUnit tests + +PRJ_EXPORTS +eunit_test_mover.pl /epoc32/tools/eunit_test_mover.pl + + +PRJ_TESTMMPFILES +gnumakefile move_tests_to_eunit.mk \ No newline at end of file diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/tsrcutils/eunitcommon/move_tests_to_eunit.mk --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/tsrcutils/eunitcommon/move_tests_to_eunit.mk Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,40 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: XIMP Framework Test Code +# + +do_nothing : + @rem do_nothing + +MAKMAKE : do_nothing + +BLD : do_nothing + +CLEAN : + @\epoc32\tools\eunit_test_mover.pl -wipe + +LIB : do_nothing + +CLEANLIB : do_nothing + +RESOURCE : do_nothing + +FREEZE : do_nothing + +SAVESPACE : do_nothing + +RELEASABLES : do_nothing + +FINAL : + @\epoc32\tools\eunit_test_mover.pl diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/tsrcutils/processmaster/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/tsrcutils/processmaster/bld.inf Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,23 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: prfwtestprocessmaster.mmp +* +*/ +// Platforms +PRJ_PLATFORMS +DEFAULT + +// Server components +PRJ_TESTMMPFILES +prfwtestprocessmaster.mmp diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/tsrcutils/processmaster/pm.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/tsrcutils/processmaster/pm.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,27 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework Test code pm.h +* +*/ + + +// assume tests in /internal/tsrc/t_blah + +USERINCLUDE ../../tsrcutils/processmaster +USERINCLUDE ../../tsrcutils/testcaseutils +USERINCLUDE ../../../core/srcpscserver +USERINCLUDE ../../../core/srcrootserver + +LIBRARY efsrv.lib +LIBRARY prfwtestcaseutils.lib diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/tsrcutils/processmaster/prfwtestprocessmaster.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/tsrcutils/processmaster/prfwtestprocessmaster.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,99 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework Test Code prfwtestprocessmaster.cpp + * +*/ + +#include +#include "prfwtestprocessmaster.h" + + +// ============================================================== +// ============ DoKillProcessL() ============= +// ============================================================== +void DoKillProcessL( const TDesC& aProcessName ) + { + TFullName psName; + psName.Append( _L("*") ); + psName.Append( aProcessName ); + psName.Append( _L("*") ); + + TFindProcess psFinder; + psFinder.Find( psName ); + + TInt killCount( 0 ); + while( psFinder.Next( psName ) != KErrNotFound ) + { + RProcess ps; + User::LeaveIfError( ps.Open( psFinder ) ); + ps.Kill( -666 ); + ps.Close(); + killCount++; + } + + User::Leave( killCount ); + } + + +// ============================================================== +// ============ E32MainL() ============= +// ============================================================== +void E32MainL() + { + TInt theCommand; + User::LeaveIfError( User::GetTIntParameter( PrfwTestProcessMaster::EMsgSlot_Command, theCommand ) ); + + TBuf< PrfwTestProcessMaster::EMaxMsgDataLength > theDesC16; + User::LeaveIfError( User::GetDesParameter( PrfwTestProcessMaster::EMsgSlot_Desc16Data, theDesC16 ) ); + + switch( theCommand ) + { + case PrfwTestProcessMaster::EKillProcess: + { + DoKillProcessL( theDesC16 ); + break; + } + + default: + { + User::Leave( KErrNotSupported ); + break; + } + } + } + + +// ============================================================== +// ============ E32Main() ============= +// ============================================================== +GLDEF_C TInt E32Main() + { + CTrapCleanup* tc = CTrapCleanup::New(); + if( !tc ) + { + return KErrNoMemory; + } + + __UHEAP_MARK; + TRAPD( err, E32MainL() ); + __UHEAP_MARKEND; + + delete tc; + + RProcess::Rendezvous( err ); + return err; + } + + +//End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/tsrcutils/processmaster/prfwtestprocessmaster.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/tsrcutils/processmaster/prfwtestprocessmaster.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,148 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework Test Code prfwtestprocessmaster.h + * +*/ + +#ifndef PRFWTESTPROCESSMASTER_H__ +#define PRFWTESTPROCESSMASTER_H__ + + +// INCLUDES +#include +#include +#include +#include + +#include "ximpserverdefs.h" +#include "ximprootserverdefs.h" + +// CLASS DESCRIPTION + +/** + * Test utility for managing Presence Engine processies + */ +class PrfwTestProcessMaster + { + public: //enumerations + enum TPEngProcessMasterEnums + { + EMsgSlot_Command = 1, + EMsgSlot_Desc16Data = 2, + + EKillProcess = 100, + EMaxMsgDataLength = 256 + }; + + public: //Public functions + + /** + * + * + * + * + * + */ + static inline TInt KillPscServers(); + static inline TInt KillRootServer(); + + private: //Helper functions + static inline TInt DoKillServer( const TDesC& aServer ); + + }; + + + + +// ----------------------------------------------------------------------------- +// PrfwTestProcessMaster public functions +// ----------------------------------------------------------------------------- +// +inline TInt PrfwTestProcessMaster::KillPscServers() + { + return PrfwTestProcessMaster::DoKillServer( NXIMPSrv::NName::KServerPattern ); + } + +inline TInt PrfwTestProcessMaster::KillRootServer() + { + return PrfwTestProcessMaster::DoKillServer( NRootSrv::NName::KServerPattern ); + } + +// ----------------------------------------------------------------------------- +// PrfwTestProcessMaster private functions +// ----------------------------------------------------------------------------- +// +inline TInt PrfwTestProcessMaster::DoKillServer( const TDesC& aServer ) + { + //Compose full executable name + TFileName processMasterExe; + + // TODO this code shouldn't leave? does it? it was TRAP+L elsewhere. + TFileName dllPath; + Dll::FileName( dllPath ); + TParsePtrC dllPathParser( dllPath ); + processMasterExe.Insert( 0, dllPathParser.Drive() ); + + processMasterExe.Append( KDC_PROGRAMS_DIR ); + processMasterExe.Append( _L("prfwtestprocessmaster.exe") ); + + //Initialize ProcessMaster process + RProcess processMaster; + TInt err = processMaster.Create( processMasterExe, KNullDesC ); + if( err != KErrNone ) + { + processMaster.Close(); + return err; + } + + err = processMaster.SetParameter( PrfwTestProcessMaster::EMsgSlot_Command, + PrfwTestProcessMaster::EKillProcess ); + if( err != KErrNone ) + { + processMaster.Close(); + return err; + } + + + err = processMaster.SetParameter( PrfwTestProcessMaster::EMsgSlot_Desc16Data, + aServer ); + if( err != KErrNone ) + { + processMaster.Close(); + return err; + } + + //Execute ProcessMaster + TRequestStatus rendezvousStatus; + processMaster.Rendezvous( rendezvousStatus ); + processMaster.Resume(); + User::WaitForRequest( rendezvousStatus ); + err = rendezvousStatus.Int(); + + + //Get exit statuses for debuging purposes + TExitType exitType = processMaster.ExitType(); + TExitCategoryName exitCategory = processMaster.ExitCategory(); + TInt exitReason = processMaster.ExitReason(); + + processMaster.Close(); + + return err; + } + + +#endif // PRFWTESTPROCESSMASTER_H__ + +// End of File + diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/tsrcutils/processmaster/prfwtestprocessmaster.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/tsrcutils/processmaster/prfwtestprocessmaster.mmp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,41 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework Test Code prfwtestprocessmaster.mmp +* +*/ + +// To get the MW_LAYER_SYSTEMINCLUDE-definition +#include + +TARGET prfwtestprocessmaster.exe +TARGETTYPE exe +UID 0x0 0x10282DDE +VENDORID VID_DEFAULT +CAPABILITY CAP_SERVER ProtServ PowerMgmt AllFiles ReadDeviceData + +TARGETPATH /system/libs +SOURCEPATH . +SOURCE prfwtestprocessmaster.cpp + + +MW_LAYER_SYSTEMINCLUDE +USERINCLUDE ../testcaseutils +USERINCLUDE ../../../core/srcrootserver +USERINCLUDE ../../../core/srcpscserver + + +LIBRARY euser.lib + +// End of File + diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/tsrcutils/testcaseutils/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/tsrcutils/testcaseutils/bld.inf Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,23 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Build information file for prfwtestcaseutils.dll +* +*/ + + +PRJ_PLATFORMS +DEFAULT + +PRJ_TESTMMPFILES +prfwtestcaseutils.mmp diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/tsrcutils/testcaseutils/prfwgeneralwaiter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/tsrcutils/testcaseutils/prfwgeneralwaiter.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,110 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework Test code +* +*/ + + + +#include + +#include "prfwgeneralwaiter.h" +#include "prfwwaitobserver.h" + + + +// ======== LOCAL FUNCTIONS ======== + + +// ======== MEMBER FUNCTIONS ======== + + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +CXIMPTestGeneralWaiter::CXIMPTestGeneralWaiter( T_MWaitObserver* aObserver ) : + CActive( EPriorityNormal ), + iObserver( aObserver ) + { + CActiveScheduler::Add( this ); + } + + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +void CXIMPTestGeneralWaiter::ConstructL() + { + iTimer.CreateLocal(); + } + + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +EXPORT_C CXIMPTestGeneralWaiter* CXIMPTestGeneralWaiter::NewL( T_MWaitObserver* aObserver ) + { + CXIMPTestGeneralWaiter* self = new( ELeave ) CXIMPTestGeneralWaiter( aObserver ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +CXIMPTestGeneralWaiter::~CXIMPTestGeneralWaiter() + { + iTimer.Close(); + } + + +// --------------------------------------------------------------------------- +// ?implementation_description +// --------------------------------------------------------------------------- +// +EXPORT_C void CXIMPTestGeneralWaiter::WaitForL( TInt aSeconds ) + { + TTimeIntervalMicroSeconds32 timeToWait( aSeconds * 1000000 ); + iTimer.After( iStatus, timeToWait ); + SetActive(); + } + + +void CXIMPTestGeneralWaiter::RunL() + { + iObserver->WaitCompleted( KErrNone ); + } + + +void CXIMPTestGeneralWaiter::DoCancel() + { + + } + + +TInt CXIMPTestGeneralWaiter::RunErrorL( TInt /* aError */ ) + { + iObserver->WaitCompleted( KErrGeneral ); + return 0; + } + + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/tsrcutils/testcaseutils/prfwgeneralwaiter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/tsrcutils/testcaseutils/prfwgeneralwaiter.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,87 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework Test code +* +*/ + + + +#ifndef CPRFWTESTGENERALWAITER_H +#define CPRFWTESTGENERALWAITER_H + + +#include + + +class T_MWaitObserver; + + +/** + * ?one_line_short_description + * + * ?more_complete_description + * + * @lib ?library + * @since S60 v4.0 + */ +class CXIMPTestGeneralWaiter : public CActive + { +public: + + IMPORT_C static CXIMPTestGeneralWaiter* NewL( T_MWaitObserver* aObserver ); + + + virtual ~CXIMPTestGeneralWaiter(); + + +private: + + CXIMPTestGeneralWaiter( T_MWaitObserver* aObserver ); + void ConstructL(); + + +public: + + /** + * ?description + * + * @since S60 ?S60_version + * @param ?arg1 ?description + * @param ?arg2 ?description + * @return ?description + */ + IMPORT_C void WaitForL( TInt aSeconds ); + + +private: + + void RunL(); + + + void DoCancel(); + + + TInt RunErrorL( TInt aError ); + + +private: // data + + + T_MWaitObserver* iObserver; + + RTimer iTimer; + + }; + +#endif // CPRFWTESTGENERALWAITER_H diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/tsrcutils/testcaseutils/prfwsrvtestclient.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/tsrcutils/testcaseutils/prfwsrvtestclient.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,184 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework server test client implementation +* +*/ + + +// INCLUDE FILES +#include "ximpbase.h" +#include "ximpsrvtestclient.h" +#include "ximpprocessstarter.h" +#include "ximprootserverdefs.h" +#include "ximpserverdefs.h" +#include "prfwtestserverdefs.h" + +#include +#include + + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// RXIMPSrvRootClient::RXIMPSrvRootClient() +// --------------------------------------------------------------------------- +// +RXIMPSrvTestClient::RXIMPSrvTestClient() + { + } + + +// --------------------------------------------------------------------------- +// RXIMPSrvRootClient::Connect() +// --------------------------------------------------------------------------- +// +TInt RXIMPSrvTestClient::Connect() + { + TFileName fullExePath; + XIMPProcessStarter::FullExePathForClienLocation( NRootSrv::NName::KExecutable, + fullExePath ); + + TInt ret = XIMPProcessStarter::ConnectToServer( fullExePath, + KNullDesC, + NULL, + *this, + NRootSrv::NName::KSymbianServer, + TVersion( NRootSrv::NVersion::KMajor, + NRootSrv::NVersion::KMinor, + NRootSrv::NVersion::KBuild ), + NRootSrv::NRequest::KMsgSlotCount ); + + if ( ret == KErrNone ) + { + TIpcArgs msgArgs; + ret = SendReceive( NTestSrv::NRequest::EInstantiateTestSession, msgArgs ); + } + + return ret; + } + +// --------------------------------------------------------------------------- +// RXIMPSrvContextClient::Connect() +// --------------------------------------------------------------------------- +// +void RXIMPSrvTestClient::ConnectL( TUid aProtocolImpUid ) + { + // create the server name: "!XIMPCtxSrv9bde667a" + HBufC* serverName = HBufC::NewLC( NXIMPSrv::NName::KSymbianServer().Length() + + NXIMPSrv::NStartupParam::KProtocolUidMaxLen + + 1 ); + + serverName->Des().Copy( NXIMPSrv::NName::KSymbianServer ); + serverName->Des().AppendNumFixedWidth( aProtocolImpUid.iUid, + EHex, + NXIMPSrv::NStartupParam::KProtocolUidMaxLen ); + + // Pass the UID to server side. + // For security reasons it was not allowed to pass the complete + // server name descriptor but just the UID part + RArray< TXIMPProcessStartupParam > params; + CleanupClosePushL( params ); + + TXIMPProcessStartupParam paramUid; + paramUid.Set( NXIMPSrv::NStartupParam::KProtocolUidIndex, + aProtocolImpUid.iUid ); + + User::LeaveIfError( params.Append( paramUid ) ); + TArray< TXIMPProcessStartupParam > array = params.Array(); + + + //Get path to correct exe to launch + TFileName fullExePath; + XIMPProcessStarter::FullExePathForClienLocation( NXIMPSrv::NName::KExecutable, + fullExePath ); + + //Create a connection + TInt ret = XIMPProcessStarter::ConnectToServer( fullExePath, + KNullDesC, + &array, + *this, + *serverName, + TVersion( NXIMPSrv::NVersion::KMajor, + NXIMPSrv::NVersion::KMinor, + NXIMPSrv::NVersion::KBuild ), + NXIMPSrv::NRequest::KMsgSlotCount ); + User::LeaveIfError( ret ); + CleanupStack::PopAndDestroy( 2, serverName ); // params, serverName + + //Mutate the server side session to correct type + ret = SendReceive( NTestSrv::NRequest::EInstantiateTestSession ); + User::LeaveIfError( ret ); + } + +// --------------------------------------------------------------------------- +// RXIMPSrvRootClient::Close() +// --------------------------------------------------------------------------- +// +void RXIMPSrvTestClient::Close() + { + RSessionBase::Close(); + } + + +// --------------------------------------------------------------------------- +// RXIMPSrvTestClient::SetAllocFailureL() +// --------------------------------------------------------------------------- +// +void RXIMPSrvTestClient::SetAllocFailure( TInt aRate ) + { + TPckgBuf< TInt > rateBuf( aRate ); + TIpcArgs msgArgs; + msgArgs.Set( 0, &rateBuf ); + + SendReceive( NTestSrv::NRequest::ESetAllocFail, msgArgs ); + } + +// --------------------------------------------------------------------------- +// RXIMPSrvRootClient::GetLastError() +// --------------------------------------------------------------------------- +// +NTestSrv::SErrorData RXIMPSrvTestClient::FetchErrorData() + { + NTestSrv::SErrorData errorData; + TPckgBuf< NTestSrv::SErrorData > errorBuf( errorData ); + TIpcArgs msgArgs; + msgArgs.Set( 0, &errorBuf ); + TInt retVal = SendReceive( NTestSrv::NRequest::EPrepareErrorData, msgArgs ); + __ASSERT_ALWAYS( retVal >= 0, User::Panic( _L( "SendReceive failed" ), retVal ) ); + errorData = errorBuf(); + return errorData; +// return GetData( NTestSrv::NRequest::EPrepareErrorData ); + } + +// --------------------------------------------------------------------------- +// RXIMPSrvRootClient::GetDataL() +// --------------------------------------------------------------------------- +// +NTestSrv::SErrorData RXIMPSrvTestClient::GetData( TInt aMsg ) + { +/* TInt bufSize = SendReceive( aMsg ); + __ASSERT_ALWAYS( bufSize == NTestSrv::KErrorDataSize, User::Panic( _L( "Wrong bufsize" ), KErrArgument ) ); + + NTestSrv::SErrorData errorData; + TPckgBuf< NTestSrv::SErrorData > errorBuf( errorData ); + TIpcArgs msgArgs; + msgArgs.Set( 0, &errorBuf ); + __ASSERT_ALWAYS( SendReceive( NTestSrv::NRequest::EFetchData, msgArgs ) >= 0, + User::Panic( _L( "SendReceive failed" ) ) ); + return errorData;*/ + } + + +// End of file + diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/tsrcutils/testcaseutils/prfwsrvtestclient.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/tsrcutils/testcaseutils/prfwsrvtestclient.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,72 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework server test session. +* +*/ + +#ifndef PRFWSRVTESTCLIENT_H__ +#define PRFWSRVTESTCLIENT_H__ + +#include +#include +#include "prfwtestserverdefs.h" + + +/** + * XIMP Framework server test session. + * + * @lib ximpsrvclient.dll + * @since S60 v3.2 + */ +class RXIMPSrvTestClient : public RSessionBase + { +public: + + /** + * Default constructor. + */ + RXIMPSrvTestClient(); + + /** + * Session connection method. + * + * @return Error code from creating server connection. + */ + TInt Connect(); + void ConnectL( TUid aProtocolImpUid ); + + /** + * Closes server connection. + */ + void Close(); + + /** + * Set alloc failure + */ + void SetAllocFailure( TInt aRate ); + NTestSrv::SErrorData RXIMPSrvTestClient::FetchErrorData(); + +private: + + /** + * Helper to get data from server side. + * @return Externalized object to be passed onward + */ + NTestSrv::SErrorData GetData( TInt aMsg ); + }; + + +#endif // PRFWSRVTESTCLIENT_H__ + +// END OF FILE diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/tsrcutils/testcaseutils/prfwtestcaseutils.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/tsrcutils/testcaseutils/prfwtestcaseutils.mmp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,92 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: prfwtestdlluids dll mmp file +* +*/ + +#include +#include "prfwtestdlluids.hrh" + +TARGET prfwtestcaseutils.dll +TARGETTYPE dll +UID PRFWTEST_DLL_UID_STATIC_INTERFACE PRFWTEST_DLL_UID_COMMON + +CAPABILITY ALL -TCB +VENDORID VID_DEFAULT + + +SOURCEPATH . +SOURCE prfwteststatuseventlistener.cpp +SOURCE prfwtestmessenger.cpp +SOURCE prfwtestfilesrvmsg.cpp +SOURCE prfwtestfiletool.cpp +SOURCE prfwtestcontextwrapper.cpp +SOURCE prfwtestcontextwrappermgr.cpp +SOURCE prfwgeneralwaiter.cpp +SOURCE prfwtestpresencedatautils.cpp +SOURCE prfwtestlistener.cpp +SOURCE prfwtestwaithelper.cpp +SOURCE prfwtesteventfactory.cpp + +USERINCLUDE ../../../core/srcdatamodel +USERINCLUDE ../../../presence/srcpresencedatamodel +USERINCLUDE ../../../presence/srcpresencedatamodel/presentitygroups +USERINCLUDE ../../../presence/srcpresencedatamodel/presencewatching +USERINCLUDE ../../../presence/srcpresencedatamodel/presenceauthorization +USERINCLUDE ../../../presence/srcpresencedatamodel/presencepublishing +USERINCLUDE ../../../presence/srcpresencedatamodel/presenceinfo +USERINCLUDE ../../../core/srcutils + + +USERINCLUDE ../../../core/srcclient +USERINCLUDE ../../../core/srcpscserver +USERINCLUDE ../../../core/srcrootserver + +USERINCLUDE . +USERINCLUDE ../../tsrcutils/eunitcommon +USERINCLUDE ../../tsrcutils/processmaster +USERINCLUDE ../../tsrcprotocols + + +// TODO remove unnecessary +SYSTEMINCLUDE ../../../inc/core/base +SYSTEMINCLUDE ../../../inc/core/datamodel +SYSTEMINCLUDE ../../../inc/core/protocolplugin +SYSTEMINCLUDE ../../../inc/core/protocolpluginhost +SYSTEMINCLUDE ../../../inc/presence/presencedatamodel +SYSTEMINCLUDE ../../../inc/presence/presencemanagement +SYSTEMINCLUDE ../../../inc/presence/presenceprotocolplugin +SYSTEMINCLUDE ../../../inc/presence/presenceprotocolpluginhost + +SYSTEMINCLUDE /epoc32/include/digia/eunit +MW_LAYER_SYSTEMINCLUDE + + +LIBRARY ecom.lib +LIBRARY bafl.lib +LIBRARY euser.lib +LIBRARY estor.lib +LIBRARY efsrv.lib +LIBRARY eunit.lib +LIBRARY eunitutil.lib +LIBRARY ximpsrvclient.lib +LIBRARY ximpdatamodel.lib +LIBRARY presencedatamodel.lib +LIBRARY ximputils.lib + +EXPORTUNFROZEN + +// end of file + + diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/tsrcutils/testcaseutils/prfwtestcaseutilspanics.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/tsrcutils/testcaseutils/prfwtestcaseutilspanics.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,57 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework panic defines. + * +*/ + +#ifndef PRFWTESTCASEUTILSPANICS_H +#define PRFWTESTCASEUTILSPANICS_H + +#include + +/** + * Panic category and reason codes for XIMP Framework + * test case utils failures. + */ +namespace NXIMPTestCaseUtilsPanic + { + _LIT( KCategory, "XIMPTestUtils" ); + + enum TReason + { + EStatusEventListenerBadMaxCount, + EStatusEventListenerAlreadyWaiting, + EStatusEventListenerUnknownEventTemplate, + EAddSnapshotOverflow, + ESnapshotIndexOutOfBounds, + EReceivingEventFromWrongContext, + EReceivedNotAcceptedEventType, + EUnsupportedEventTypeInVerification + }; + + + inline void Panic( NXIMPTestCaseUtilsPanic::TReason aReason ) + { + User::Panic( KCategory, aReason ); + + } + } + + +#endif //PRFWTESTCASEUTILSPANICS_H + + + + + diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/tsrcutils/testcaseutils/prfwtestcontextwrapper.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/tsrcutils/testcaseutils/prfwtestcontextwrapper.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,453 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Testing context wrapper + * +*/ + + + +#include + +#include + +#include "prfwtestcontextwrapper.h" +#include +#include +#include +#include +#include +#include + + +#include "prfwteststatuseventlistener.h" +#include "prfwtestmessenger.h" +#include "prfwtestmessaging.h" +#include "prfwtestfiletool.h" +#include "prfwtestprotocols.h" + +_LIT( KInstanceAsNumber, "%d" ); +// ======== LOCAL FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// Length of number in characters (e.g. 501 --> 3) +// --------------------------------------------------------------------------- +// +TInt NumLenInChars( TInt aNum ) + { + TInt len = 0; + TInt tmp = aNum; + do + { + tmp /= 10; // number is base-10 + len++; + } + while ( tmp > 0 ); + return len; + } + + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// Instance id +// --------------------------------------------------------------------------- +// +EXPORT_C const TDesC16& CXIMPTestContextWrapper::InstanceId() const + { + return *iInstance; + } + + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +CXIMPTestContextWrapper::CXIMPTestContextWrapper( TInt aIndex, + MXIMPClient* aClient ) : + iIndex( aIndex ), + iClient( aClient ) + { + } + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +void CXIMPTestContextWrapper::ConstructL() + { + iContext = iClient->NewPresenceContextLC(); + CleanupStack::Pop(); // iContext + iListener = CXIMPTestStatusEventListener::NewL( 20, iContext ); + iMessenger = CXIMPTestMessenger::NewForClientSideL( iIndex ); + iPresFeatures = MPresenceFeatures::NewL(iContext); + TInt instanceLength = NumLenInChars( iIndex ); + iInstance = HBufC::NewL( instanceLength ); + iInstance->Des().AppendFormat( KInstanceAsNumber, iIndex ); + } + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +EXPORT_C CXIMPTestContextWrapper* CXIMPTestContextWrapper::NewL( + TInt aIndex, MXIMPClient* aClient ) + { + CXIMPTestContextWrapper* self = new( ELeave ) CXIMPTestContextWrapper( aIndex, aClient ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +CXIMPTestContextWrapper::~CXIMPTestContextWrapper() + { + iStatusEventTraits.Close(); + + delete iMessenger; + delete iListener; + delete iContext; + delete iFileTool; + delete iInstance; + delete iPresFeatures; + } + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +EXPORT_C MXIMPContext* CXIMPTestContextWrapper::GetContext() + { + return iContext; + } + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +EXPORT_C MPresenceFeatures* CXIMPTestContextWrapper::GetPresenceFeatures() + { + return iPresFeatures; + } +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +EXPORT_C CXIMPTestStatusEventListener* CXIMPTestContextWrapper::GetEventListener() + { + return iListener; + } + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +EXPORT_C CXIMPTestMessenger* CXIMPTestContextWrapper::GetMessenger() + { + return iMessenger; + } + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +EXPORT_C MXIMPClient* CXIMPTestContextWrapper::GetClient() + { + return iClient; + } + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +EXPORT_C void CXIMPTestContextWrapper::DeletePresenceContext() + { + // used to test abrupt handle closings + iListener->SetEventSourceL( NULL ); + delete iContext; + iContext = NULL; + } + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +EXPORT_C void CXIMPTestContextWrapper::SetupEmptyListener() + { + iListener->ResetEventStack(); + iStatusEventTraits.Reset(); + } + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +EXPORT_C RArray* CXIMPTestContextWrapper::GetStatusTraits() + { + return &iStatusEventTraits; + } + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +EXPORT_C void CXIMPTestContextWrapper::SetupListenerL( TXIMPTestStatusEventTemplate aEventType ) + { + ResetListener(); + iListener->GetEventTemplateL( iStatusEventTraits, aEventType ); + iMessenger->SetPluginIndex( iIndex ); + } + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +EXPORT_C void CXIMPTestContextWrapper::AppendToTraitsL( TXIMPTestStatusEventTemplate aEventType ) + { + iListener->GetEventTemplateL( iStatusEventTraits, aEventType ); + } + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +EXPORT_C void CXIMPTestContextWrapper::SetupListenerReqCompleteL( + TXIMPTestStatusEventTemplate aEventType, + RArray< TInt32 >* aAdditionalEvents ) + { + iListener->ResetEventStack(); + iListener->AcceptedEventTypes().Reset(); + iListener->AcceptedEventTypes().AppendL( MXIMPRequestCompleteEvent::KInterfaceId ); + + if ( aAdditionalEvents ) + { + for ( TInt i = 0; i < aAdditionalEvents->Count(); i++ ) + { + iListener->AcceptedEventTypes().AppendL( (*aAdditionalEvents)[ i ] ); + } + } + + iListener->ReRegisterEventFilterL(); + iStatusEventTraits.Reset(); + iListener->GetEventTemplateL( iStatusEventTraits, aEventType ); + + iMessenger->SetPluginIndex( iIndex ); + } + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +EXPORT_C void CXIMPTestContextWrapper::ClearListener() + { + iListener->ResetEventStack(); + iListener->SetEventSourceL( NULL ); + + iStatusEventTraits.Reset(); + } + + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +EXPORT_C void CXIMPTestContextWrapper::ResetListener() + { + iListener->ResetEventStack(); + iListener->ResetEventTypeStack(); + iStatusEventTraits.Reset(); + iListener->ReRegisterEventFilterL(); + } + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +EXPORT_C void CXIMPTestContextWrapper::WaitRequestAndStackEvents( TXIMPRequestId aReqId ) + { + iListener->WaitRequestAndStackEvents( aReqId ); + } + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +EXPORT_C void CXIMPTestContextWrapper::VerifyEventStackL( const TPtrC8& aDesc ) + { + iListener->VerifyEventStackL( iStatusEventTraits.Array(), aDesc ); + } + +// --------------------------------------------------------------------------- +// CXIMPTestContextWrapper::WaitAnyEvent +// --------------------------------------------------------------------------- +// +EXPORT_C void CXIMPTestContextWrapper::WaitAnyEvent() + { + iListener->WaitAnyEvent(); + } + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +EXPORT_C void CXIMPTestContextWrapper::BindL( + TUid aUid, + const TDesC& aServer, + const TDesC& aUser, + const TDesC& aPassword ) + { + SetupListenerL( EXIMPTestStatusEvents_BindingOk ); + iMessenger->SetNoError(); + iMessenger->SetPluginIndex( iIndex ); + + delete iFileTool; + iFileTool = NULL; + iFileTool = CXIMPTestFileTool::NewL( aUid.iUid, iIndex ); + + TXIMPRequestId reqId = iContext->BindToL( + aUid, + aServer, + aUser, + aPassword, + *iInstance, + iIndex ); + + WaitRequestAndStackEvents( reqId ); + VerifyEventStackL( _L8("Binding (wrapper BindL): ") ); + + EUNIT_ASSERT_DESC( iMessenger->GetBoolean( EXIMPPlgTestOpenSessionCalled ) || + iMessenger->GetBoolean( EXIMPPlgTestShareSessionCalled ), "OpenSessionL was not called" ); + } + +// --------------------------------------------------------------------------- +// Bind alternative +// --------------------------------------------------------------------------- +// +const TUid KTestProtocolUid = { K_PRFW_TST_PROTOCOL_1_IMPLEMENTATION_UID }; // hardcoded... + +_LIT( KTestFakeServer, "www.imps%d.no/wv" ); +_LIT( KTestFakeUser, "user%d" ); +_LIT( KTestFakePassword, "password%d" ); + +EXPORT_C void CXIMPTestContextWrapper::BindL( TInt aId ) + { + SetupListenerL( EXIMPTestStatusEvents_BindingOk ); + iMessenger->SetNoError(); + iMessenger->SetPluginIndex( aId ); + + // create fake info + TInt extraLength = 8; // bad style... but length is enough + + HBufC* fakeSrv = HBufC::NewLC( KTestFakeServer().Length() + extraLength ); + fakeSrv->Des().AppendFormat( KTestFakeServer, aId ); + + HBufC* fakeUser = HBufC::NewLC( KTestFakeUser().Length() + extraLength ); + fakeUser->Des().AppendFormat( KTestFakeUser, aId ); + + HBufC* fakePass = HBufC::NewLC( KTestFakePassword().Length() + extraLength ); + fakePass->Des().AppendFormat( KTestFakePassword, aId ); + + delete iFileTool; + iFileTool = NULL; + iFileTool = CXIMPTestFileTool::NewL( KTestProtocolUid.iUid, iIndex ); + + TXIMPRequestId reqId = iContext->BindToL( + KTestProtocolUid, + *fakeSrv, + *fakeUser, + *fakePass, + *iInstance, + aId ); + + CleanupStack::PopAndDestroy( 3, fakeSrv ); + + WaitRequestAndStackEvents( reqId ); + VerifyEventStackL( _L8("Binding (wrapper BindL): ") ); + + EUNIT_ASSERT_DESC( iMessenger->GetBoolean( EXIMPPlgTestOpenSessionCalled ) || + iMessenger->GetBoolean( EXIMPPlgTestShareSessionCalled ), "OpenSessionL was not called" ); + } + + + + ///NEW BIND + EXPORT_C void CXIMPTestContextWrapper::BindWithSettingsL( TInt aId ) + { + SetupListenerL( EXIMPTestStatusEvents_BindingOk ); + iMessenger->SetNoError(); + iMessenger->SetPluginIndex( 0/*aId*/ ); + + // create fake info + TInt extraLength = 8; // bad style... but length is enough + + HBufC* fakeSrv = HBufC::NewLC( KTestFakeServer().Length() + extraLength ); + fakeSrv->Des().AppendFormat( KTestFakeServer, aId ); + + HBufC* fakeUser = HBufC::NewLC( KTestFakeUser().Length() + extraLength ); + fakeUser->Des().AppendFormat( KTestFakeUser, aId ); + + HBufC* fakePass = HBufC::NewLC( KTestFakePassword().Length() + extraLength ); + fakePass->Des().AppendFormat( KTestFakePassword, aId ); + + delete iFileTool; + iFileTool = NULL; + iFileTool = CXIMPTestFileTool::NewL( KTestProtocolUid.iUid, iIndex ); + + TXIMPRequestId reqId = iContext->BindToL( + KTestProtocolUid, aId ); + + CleanupStack::PopAndDestroy( 3, fakeSrv ); + + WaitRequestAndStackEvents( reqId ); + VerifyEventStackL( _L8("Binding (wrapper BindWithSettingsL): ") ); + + EUNIT_ASSERT_DESC( iMessenger->GetBoolean( EXIMPPlgTestOpenSessionCalled ) || + iMessenger->GetBoolean( EXIMPPlgTestShareSessionCalled ), "OpenSessionL was not called" ); + } + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +EXPORT_C void CXIMPTestContextWrapper::UnbindL() + { + SetupListenerL( EXIMPTestStatusEvents_UnbindingOk ); + iMessenger->SetNoError(); + TXIMPRequestId reqId = iContext->UnbindL(); + + WaitRequestAndStackEvents( reqId ); + VerifyEventStackL( _L8("Unbinding (wrapper UnbindL): ") ); + + EUNIT_ASSERT_DESC( iMessenger->GetBoolean( EXIMPPlgTestCloseSessionCalled ) || + iMessenger->GetBoolean( EXIMPPlgTestUnshareSessionCalled ) , "CloseSession was not called" ); + if( iMessenger->GetBoolean( EXIMPPlgTestCloseSessionCalled ) ) + { + DeletePresenceContext(); + //EUNIT_ASSERT_DESC( iMessenger->GetBoolean( EXIMPPlgTestDeath ), "Plugin did not die, destructor not called."); + } + } + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +EXPORT_C CXIMPTestFileTool& CXIMPTestContextWrapper::FileTool() const + { + return *iFileTool; + } + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/tsrcutils/testcaseutils/prfwtestcontextwrapper.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/tsrcutils/testcaseutils/prfwtestcontextwrapper.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,197 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Testing context wrapper + * +*/ + + +#ifndef CPRFWTESTCONTEXTWRAPPER_H +#define CPRFWTESTCONTEXTWRAPPER_H + +#include + +#include "prfwteststatuseventlistener.h" + +class MXIMPClient; +class MXIMPContext; +class CXIMPTestStatusEventListener; +class CXIMPTestMessenger; +class CXIMPTestFileTool; +class MPresenceFeatures; + +/** + * Wrapper for testing. + * Owns the things needed to test one host-plugin connection. + * + * @since S60 v4.0 + */ +class CXIMPTestContextWrapper : public CBase + { + public: + + /** + * @param aIndex Index of wrapper (used for pubsub-messaging + * between test plugin and test code). + */ + IMPORT_C static CXIMPTestContextWrapper* NewL( TInt aIndex, MXIMPClient* aClient ); + virtual ~CXIMPTestContextWrapper(); + + private: + + CXIMPTestContextWrapper( TInt aIndex, MXIMPClient* aClient ); + void ConstructL(); + + public: + + // accessors + IMPORT_C MXIMPContext* GetContext(); + IMPORT_C CXIMPTestStatusEventListener* GetEventListener(); + IMPORT_C CXIMPTestMessenger* GetMessenger(); + IMPORT_C MXIMPClient* GetClient(); + IMPORT_C RArray* GetStatusTraits(); + IMPORT_C MPresenceFeatures* GetPresenceFeatures(); + + // low-level test support - see e.g. t_sessionmng test for usage + // + /** + * Delete the presence context and set it to NULL. + */ + IMPORT_C void DeletePresenceContext(); + + /** + * Like SetupListenerL but sets no event template. Use AppendToTraitsL to set + * the desired templates. Useful for certain test cases. + */ + IMPORT_C void SetupEmptyListener(); + + /** + * Setup a listener using the given event template for the traits. + * @param aEventType The event template to listen to. + */ + IMPORT_C void SetupListenerL( TXIMPTestStatusEventTemplate aEventType ); + + /** + * Append the given template to the internal traits. + * @param aEventType The event template to add. + */ + IMPORT_C void AppendToTraitsL( TXIMPTestStatusEventTemplate aEventType ); + + /** + * Setup a listener for a request complete event. All other events from the + * given template are ignored (except those given by aAdditionalEvents). + * @param aEventType The event template. + * @param aAdditionalEvents Additional events to listen to. + */ + IMPORT_C void SetupListenerReqCompleteL( + TXIMPTestStatusEventTemplate aEventType, + RArray< TInt32 >* aAdditionalEvents = NULL ); + + /** + * Clear the listener. + */ + IMPORT_C void ClearListener(); + + /** + * Back to begin state of listener. + */ + IMPORT_C void ResetListener(); + + /** + * Wait for the events and a request complete event for the given request id. + * @param aReqId The request id for which a req. complete ends the wait + */ + IMPORT_C void WaitRequestAndStackEvents( TXIMPRequestId aReqId ); + + /** + * Wait for any event to occur. Event ends the wait. + */ + IMPORT_C void WaitAnyEvent(); + + /** + * Verify the event stack against the previously set template(s). + * The description is printed to the EUnit log. + * @param aDesc The description + */ + IMPORT_C void VerifyEventStackL( const TPtrC8& aDesc ); + + // high-level test support + /** + * Happy-path binding. + */ + IMPORT_C void BindL( + TUid aUid, + const TDesC& aServer, + const TDesC& aUser, + const TDesC& aPassword ); + + /** + * Happy-path binding alternative method. + * The server, userid and password are automatically modified + * based on the given id: + * Server: www.imps%d.no/wv + * User: user%d + * Password: password%d. + * @param aId An id used to modify server login data. + */ + IMPORT_C void BindL( TInt aId ); + + IMPORT_C void BindWithSettingsL( TInt aId ); + /** + * Happy-path unbinding + */ + IMPORT_C void UnbindL(); + + /** + * Access to filetool of wrapper. + */ + IMPORT_C CXIMPTestFileTool& FileTool() const; + + /** + * @return Instance id + */ + IMPORT_C const TDesC16& InstanceId() const; + + private: // data + + // not owned + MXIMPClient* iClient; + + // owned + MXIMPContext* iContext; + + // owned + MPresenceFeatures* iPresFeatures; + + + // owned + CXIMPTestStatusEventListener* iListener; + + // owned + CXIMPTestMessenger* iMessenger; + + // owned + RArray< TXIMPTestStatusEventSnapshot > iStatusEventTraits; + + TInt iIndex; + + /** + * Filetool + */ + CXIMPTestFileTool* iFileTool; + + HBufC16* iInstance; // the global instance id + + }; + +#endif // CPRFWTESTCONTEXTWRAPPER_H diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/tsrcutils/testcaseutils/prfwtestcontextwrappermgr.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/tsrcutils/testcaseutils/prfwtestcontextwrappermgr.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,124 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Testing context wrapper + * +*/ + + + +#include + +#include +#include +#include "prfwtestcontextwrappermgr.h" +#include "prfwtestcontextwrapper.h" +#include +#include "prfwteststatuseventlistener.h" +#include "prfwtestmessenger.h" +#include "prfwtestmessaging.h" + +// ======== LOCAL FUNCTIONS ======== + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +CXIMPTestContextWrapperMgr::CXIMPTestContextWrapperMgr() + { + } + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +void CXIMPTestContextWrapperMgr::ConstructL() + { + // TODO + } + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +EXPORT_C CXIMPTestContextWrapperMgr* CXIMPTestContextWrapperMgr::NewL() + { + CXIMPTestContextWrapperMgr* self = new( ELeave ) CXIMPTestContextWrapperMgr(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +CXIMPTestContextWrapperMgr::~CXIMPTestContextWrapperMgr() + { + iWrappers.Close(); + iPrClients.Close(); + } + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +EXPORT_C void CXIMPTestContextWrapperMgr::CreateWrapperL( TInt aClientIndex /* = KErrNotFound */ ) + { + // make sure we've the client + MXIMPClient* client = NULL; + + if ( aClientIndex == KErrNotFound ) + { + if( iPrClients.Count() == 0 ) + { + // make a new one + client = MXIMPClient::NewClientL(); + iPrClients.AppendL( client ); + } + else + { + client = iPrClients[ 0 ]; + } + } + else + { + // if the index was bad, everything will blow. it's up to the client to instruct + // us correctly + client = iWrappers[ aClientIndex ]->GetClient(); + } + + CXIMPTestContextWrapper* tmp = CXIMPTestContextWrapper::NewL( iIndex, client ); + iWrappers.AppendL( tmp ); + + iIndex++; + } + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +EXPORT_C CXIMPTestContextWrapper* CXIMPTestContextWrapperMgr::GetWrapperL( TInt aIndex ) + { + return iWrappers[ aIndex ]; + } + +EXPORT_C TInt CXIMPTestContextWrapperMgr::WrapperCount() const + { + return iWrappers.Count(); + } + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/tsrcutils/testcaseutils/prfwtestcontextwrappermgr.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/tsrcutils/testcaseutils/prfwtestcontextwrappermgr.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,81 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Testing context wrapper + * +*/ + + +#ifndef CPRFWTESTCONTEXTWRAPPERMGR_H +#define CPRFWTESTCONTEXTWRAPPERMGR_H + +#include +#include + +#include "prfwteststatuseventlistener.h" + +class MXIMPClient; +class CXIMPTestContextWrapper; +class MXIMPContext; +class CXIMPTestStatusEventListener; +class CXIMPTestMessenger; + +/** + * Manager for wrappers. + * Owns the wrappers and provides convenience methods for + * test code. + * + * @since S60 v4.0 + */ +class CXIMPTestContextWrapperMgr : public CBase + { + public: + + IMPORT_C static CXIMPTestContextWrapperMgr* NewL(); + virtual ~CXIMPTestContextWrapperMgr(); + + private: + + CXIMPTestContextWrapperMgr(); + void ConstructL(); + + public: + + /** + * Creates a wrapper. The presence client can be given for wrappers + * which share a presence client. + * @param aClientIndex Use the client from this wrapper + * If aClientIndex is KErrNotFound, creates a new client. + */ + IMPORT_C void CreateWrapperL( TInt aClientIndex = KErrNotFound ); + + /** + * Direct access to a wrapper. Ownership NOT transferred. + * @param aIndex The index of desired wrapper + */ + IMPORT_C CXIMPTestContextWrapper* GetWrapperL( TInt aIndex ); + + /** + * Count of wrappers + */ + IMPORT_C TInt WrapperCount() const; + + private: // data + + RXIMPObjOwningPtrArray iWrappers; + RXIMPObjOwningPtrArray iPrClients; + + TInt iIndex; + }; + +#endif // CPRFWTESTCONTEXTWRAPPERMGR_H diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/tsrcutils/testcaseutils/prfwtestdlluids.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/tsrcutils/testcaseutils/prfwtestdlluids.hrh Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,40 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Presence Framework Eunit tests. +* +*/ + +#ifndef PRFWTESTDLLUIDS_HRH +#define PRFWTESTDLLUIDS_HRH + + +// ----------------------------------------------------------------------------- +// These are system wide UID 2:s for the various dll types. +// +// ----------------------------------------------------------------------------- +// +#define PRFWTEST_DLL_UID_STATIC_INTERFACE 0x1000008d +#define PRFWTEST_DLL_UID_ECOM_PLUGIN 0x10009D8D + +// ----------------------------------------------------------------------------- +// These are the UID 3:s for the Presence Framework test dlls. +// +// ----------------------------------------------------------------------------- +// +#define PRFWTEST_DLL_UID_COMMON 0x1110ff50 // TODO + + +#endif // PRFWDLLUIDS_HRH + + diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/tsrcutils/testcaseutils/prfwtesteventfactory.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/tsrcutils/testcaseutils/prfwtesteventfactory.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,426 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework XIMPTestEventFactory +* +*/ + + +#include "prfwtestcaseutilspanics.h" +#include "prfwtesteventfactory.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "ximpidentityimp.h" +#include "presencetypehelpers.h" +#include "presentitygroupinfoimp.h" +#include "presentitygroupmemberinfoimp.h" +#include "presentitygroupcontenteventimp.h" +#include "presentitygrouplisteventimp.h" + + + +using namespace NXIMPTestCaseUtilsPanic; + + + +// ============================ MEMBER FUNCTIONS =============================== + +// --------------------------------------------------------------------------- +// create a group content event with given arrays +// --------------------------------------------------------------------------- +// +EXPORT_C CPresentityGroupContentEventImp* +XIMPTestEventFactory::CreateGroupContentEventLCX( + const TDesC& aGroupId, + const TDesC& aIdentityForDelta, + const TDesC& aDispNameForDelta, + TTestPGLContentArraySpecifier aArraySpec, + const TDesC& aIdentityCurrent, + const TDesC& aDispNameCurrent, + MXIMPDataSubscriptionState::TSubscriptionState aSubscriptionState, + MXIMPDataSubscriptionState::TDataState aDataState + ) + { + // id for group + CXIMPIdentityImp* idForGroup = CXIMPIdentityImp::NewLC( aGroupId ); + + // create the arrays + RPrGrpMemInfoImpArray* addedList = new ( ELeave ) RPrGrpMemInfoImpArray; + CleanupDeletePushL( addedList ); + + RPrGrpMemInfoImpArray* updatedList = new ( ELeave ) RPrGrpMemInfoImpArray; + CleanupDeletePushL( updatedList ); + + RPrGrpMemInfoImpArray* removedList = new ( ELeave ) RPrGrpMemInfoImpArray; + CleanupDeletePushL( removedList ); + + RPrGrpMemInfoImpArray* currentList = new ( ELeave ) RPrGrpMemInfoImpArray; + CleanupDeletePushL( currentList ); + + // populate the current list + if ( aIdentityCurrent.Length() > 0 ) + { + // but don't put "KNullDesC" there if it's really empty + CXIMPIdentityImp* idForCurrent = CXIMPIdentityImp::NewLC( aIdentityCurrent ); + CPresentityGroupMemberInfoImp* grpInfoForCurrent = + CPresentityGroupMemberInfoImp::NewLC( *idForCurrent, aDispNameCurrent ); + currentList->AppendL( grpInfoForCurrent ); + CleanupStack::Pop( grpInfoForCurrent ); + CleanupStack::PopAndDestroy( idForCurrent ); + } + + // create the delta list + CXIMPIdentityImp* idForEvent = CXIMPIdentityImp::NewLC( aIdentityForDelta ); + CPresentityGroupMemberInfoImp* grpInfoForEvent = + CPresentityGroupMemberInfoImp::NewLC( *idForEvent, aDispNameForDelta ); + + // notice the cleanup stack usage. AppendL takes ownership, but + // it might not be done always. + TBool didAppend = EFalse; + + // put the given group info into the specified array. + switch ( aArraySpec ) + { + case ETestPGLCntAdded : + { + if ( aIdentityForDelta.Length() > 0 ) + { + addedList->AppendL( grpInfoForEvent ); + didAppend = ETrue; + } + break; + } + + case ETestPGLCntUpdated : + { + if ( aIdentityForDelta.Length() > 0 ) + { + updatedList->AppendL( grpInfoForEvent ); + didAppend = ETrue; + } + break; + } + + case ETestPGLCntRemoved : + { + if ( aIdentityForDelta.Length() > 0 ) + { + removedList->AppendL( grpInfoForEvent ); + didAppend = ETrue; + } + break; + } + + case ETestPGLCntEmpty : + { + // don't add, thus creating an empty array. + break; + } + + default: + { + User::Leave( KErrArgument ); + break; + } + }; + + // remove the event and id from cleanupstack. removal + // method depends on whether we did append or not + if ( didAppend ) + { + CleanupStack::Pop( grpInfoForEvent ); + CleanupStack::PopAndDestroy( idForEvent ); + } + else + { + CleanupStack::PopAndDestroy( 2, idForEvent ); + } + + CXIMPDataSubscriptionStateImp* stateImp = CXIMPDataSubscriptionStateImp::NewLC(); + stateImp->SetSubscriptionStateL( aSubscriptionState ); + stateImp->SetDataStateL( aDataState ); + + // create the actual event + CPresentityGroupContentEventImp* tmp = + CPresentityGroupContentEventImp::NewLC( + *idForGroup, + addedList, + updatedList, + removedList, + currentList, + stateImp + ); + CleanupStack::Pop( 2, stateImp ); + CleanupStack::PushL( tmp ); + + // test the accessors + if ( aIdentityForDelta.Length() > 0 ) + { + switch ( aArraySpec ) + { + case ETestPGLCntAdded : + { + EUNIT_ASSERT_DESC( tmp->NewMembersCount() == 1, "Added group member count mismatch" ); + TBool same = 0 == tmp->NewMember( 0 ).GroupMemberId().Identity().Compare( aIdentityForDelta ); + EUNIT_ASSERT_DESC( same, "Added group member id mismatch" ); + break; + } + + case ETestPGLCntUpdated : + { + EUNIT_ASSERT_DESC( tmp->UpdatedMembersCount() == 1, "Updated group member count mismatch" ); + TBool same = 0 == tmp->UpdatedMember( 0 ).GroupMemberId().Identity().Compare( aIdentityForDelta ); + EUNIT_ASSERT_DESC( same, "Updated group member id mismatch" ); + break; + } + + case ETestPGLCntRemoved : + { + EUNIT_ASSERT_DESC( tmp->DisappearedMembersCount() == 1, "Removed group member count mismatch" ); + TBool same = 0 == tmp->DisappearedMember( 0 ).GroupMemberId().Identity().Compare( aIdentityForDelta ); + EUNIT_ASSERT_DESC( same, "Removed group member id mismatch" ); + break; + } + + case ETestPGLCntEmpty : + { + // don't add, thus creating an empty array. + break; + } + + default : + { + break; + } + } + } + + if ( aIdentityCurrent.Length() > 0 ) + { + EUNIT_ASSERT_DESC( tmp->CurrentMembersCount() == 1, "Current group member count mismatch" ); + + TBool same = 0 == tmp->CurrentMember( 0 ).GroupMemberId().Identity().Compare( aIdentityCurrent ); + EUNIT_ASSERT_DESC( same, "Current group member id mismatch" ); + + same = 0 == tmp->CurrentMember( 0 ).GroupMemberDisplayName().Compare( aDispNameCurrent ); + EUNIT_ASSERT_DESC( same, "Current group member display name mismatch" ); + } + else + { + EUNIT_ASSERT_DESC( tmp->CurrentMembersCount() == 0, "Current group member count mismatch" ); + } + + /* + * In cleanupstack there are 6 items, FIFO: + * - identity object + * - added list + * - updated list + * - removed list + * - current member list + * - event imp + */ + + return tmp; + } + + +// --------------------------------------------------------------------------- +// create a group list event with given arrays +// --------------------------------------------------------------------------- +// +EXPORT_C CPresentityGroupListEventImp* XIMPTestEventFactory::CreateGroupListEventLCX( + const TDesC& aUri, + const TDesC& aDispName, + TTestPGLArraySpecifier aArraySpec, + const TDesC& aUriCurrent, + const TDesC& aDispNameCurrent, + MXIMPDataSubscriptionState::TSubscriptionState aSubscriptionState, + MXIMPDataSubscriptionState::TDataState aDataState + ) + { + // create the arrays + RPrGrpInfoImpArray* createdList = new ( ELeave ) RPrGrpInfoImpArray; + CleanupDeletePushL( createdList ); + + RPrGrpInfoImpArray* updatedList = new ( ELeave ) RPrGrpInfoImpArray; + CleanupDeletePushL( updatedList ); + + RPrGrpInfoImpArray* deletedList = new ( ELeave ) RPrGrpInfoImpArray; + CleanupDeletePushL( deletedList ); + + RPrGrpInfoImpArray* currentList = new ( ELeave ) RPrGrpInfoImpArray; + CleanupDeletePushL( currentList ); + + // create the group info + CXIMPIdentityImp* idForEvent = CXIMPIdentityImp::NewLC( aUri ); + CPresentityGroupInfoImp* grpInfoForEvent = + CPresentityGroupInfoImp::NewLC( *idForEvent, aDispName ); + + // populate the current list + if ( aUriCurrent.Length() > 0 ) + { + // but don't put "KNullDesC" there if it's really empty + CXIMPIdentityImp* idForCurrent = CXIMPIdentityImp::NewLC( aUriCurrent ); + CPresentityGroupInfoImp* grpInfoForCurrent = + CPresentityGroupInfoImp::NewLC( *idForCurrent, aDispNameCurrent ); + currentList->AppendL( grpInfoForCurrent ); + CleanupStack::Pop( grpInfoForCurrent ); + CleanupStack::PopAndDestroy( idForCurrent ); + } + + // notice the cleanup stack usage. AppendL takes ownership, but + // it might not be done always. + TBool didAppend = EFalse; + + // put the given group info into the specified array + switch ( aArraySpec ) + { + case ETestPGLCreated : + { + if ( aUri.Length() > 0 ) + { + createdList->AppendL( grpInfoForEvent ); + didAppend = ETrue; + } + break; + } + + case ETestPGLUpdated : + { + if ( aUri.Length() > 0 ) + { + updatedList->AppendL( grpInfoForEvent ); + didAppend = ETrue; + } + break; + } + + case ETestPGLDeleted : + { + if ( aUri.Length() > 0 ) + { + deletedList->AppendL( grpInfoForEvent ); + didAppend = ETrue; + } + break; + } + + case ETestPGLEmpty : + { + // don't add, thus creating an empty array + break; + } + + default: + { + User::Leave( KErrArgument ); + break; + } + }; + + // remove the event and id from cleanupstack. removal + // method depends on whether we did append or not + if ( didAppend ) + { + CleanupStack::Pop( grpInfoForEvent ); + CleanupStack::PopAndDestroy( idForEvent ); + } + else + { + CleanupStack::PopAndDestroy( 2, idForEvent ); + } + + CXIMPDataSubscriptionStateImp* stateImp = CXIMPDataSubscriptionStateImp::NewLC(); + stateImp->SetSubscriptionStateL( aSubscriptionState ); + stateImp->SetDataStateL( aDataState ); + + // create the actual event + CPresentityGroupListEventImp* tmp = + CPresentityGroupListEventImp::NewLC( + createdList, + updatedList, + deletedList, + currentList, + stateImp + ); + CleanupStack::Pop( 2, stateImp ); + CleanupStack::PushL( tmp ); + + // verify that the event contains correct information + if ( aUri.Length() > 0 ) + { + switch ( aArraySpec ) + { + case ETestPGLCreated : + { + EUNIT_ASSERT_DESC( tmp->NewGroupsCount() == 1, "Created group count mismatch" ); + TBool same = 0 == tmp->NewGroup( 0 ).GroupId().Identity().Compare( aUri ); + EUNIT_ASSERT_DESC( same, "Created group id mismatch" ); + break; + } + + case ETestPGLUpdated : + { + EUNIT_ASSERT_DESC( tmp->UpdatedGroupsCount() == 1, "Updated group count mismatch" ); + TBool same = 0 == tmp->UpdatedGroup( 0 ).GroupId().Identity().Compare( aUri ); + EUNIT_ASSERT_DESC( same, "Updated group id mismatch" ); + break; + } + + case ETestPGLDeleted : + { + EUNIT_ASSERT_DESC( tmp->DisappearedGroupsCount() == 1, "Deleted group count mismatch" ); + TBool same = 0 == tmp->DisappearedGroup( 0 ).GroupId().Identity().Compare( aUri ); + EUNIT_ASSERT_DESC( same, "Deleted group id mismatch" ); + break; + } + } + } + + if ( aUriCurrent.Length() > 0 ) + { + EUNIT_ASSERT_DESC( tmp->CurrentGroupsCount() == 1, "Current group count mismatch" ); + + TBool same = 0 == tmp->CurrentGroup( 0 ).GroupId().Identity().Compare( aUriCurrent ); + EUNIT_ASSERT_DESC( same, "Current group id mismatch" ); + + same = 0 == tmp->CurrentGroup( 0 ).GroupDisplayName().Compare( aDispNameCurrent ); + EUNIT_ASSERT_DESC( same, "Current group display name mismatch" ); + } + else + { + EUNIT_ASSERT_DESC( tmp->CurrentGroupsCount() == 0, "Current group count mismatch, expected 0" ); + } + + /* + * In cleanupstack there are 5 items, FIFO: + * - created list + * - updated list + * - deleted list + * - current list + * - event imp + */ + + return tmp; + } + +// end of file + diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/tsrcutils/testcaseutils/prfwtesteventfactory.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/tsrcutils/testcaseutils/prfwtesteventfactory.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,140 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework XIMPTestEventFactory +* +*/ + + +#ifndef PRFWTESTEVENTFACTORY_H__ +#define PRFWTESTEVENTFACTORY_H__ + +#include +#include + +// CLASS DESCRIPTION + +class CPresentityGroupListEventImp; +class CPresentityGroupContentEventImp; +class CXIMPDataSubscriptionStateImp; + +/** + * Presence event factory for use in tests. + */ +class XIMPTestEventFactory + { + public: + + // @see below + enum TTestPGLArraySpecifier + { + ETestPGLCreated = 0, // group info is created + ETestPGLUpdated, // group info is updated + ETestPGLDeleted, // group info is deleted + ETestPGLEmpty, // make an empty array for empty event + }; + + /** + * Places an identity (uri-displayname pair) inside a group info into the + * array defined by aArraySpec, and returns the created event. + * + * In cleanupstack there are 5 items, FIFO: + * - created list + * - updated list + * - deleted list + * - current list + * - event imp + * + * This is because this event won't take ownership to the arrays + * when created this way. + * + * @param aUri URI of group + * @param aDispName Displayname + * @param aArraySpec Defines into which array to put the group info + * @param aUriCurrent The URI of group in "current"-list + * @param aDispNameCurrent The display name of the group in + * "current"-list + * @param aStatus The subscription status + * @return The suitably filled event. + */ + IMPORT_C static CPresentityGroupListEventImp* CreateGroupListEventLCX( + const TDesC& aUri, + const TDesC& aDispName, + + TTestPGLArraySpecifier aArraySpec, + + const TDesC& aUriCurrent, + const TDesC& aDispNameCurrent, + + MXIMPDataSubscriptionState::TSubscriptionState aSubscriptionState, + MXIMPDataSubscriptionState::TDataState aDataState + ); + + // @see below + enum TTestPGLContentArraySpecifier + { + ETestPGLCntAdded = 0, // group content is added + ETestPGLCntUpdated, // group content is updated + ETestPGLCntRemoved, // group content is deleted + ETestPGLCntEmpty, // make an empty array for empty event + }; + + /** + * Places an group member (identity-displayname pair) inside + * a group content info into the delta array defined by aArraySpec, + * and returns the created event. + * + * The current member list will contain only the group member + * specified by parameters aIdentityCurrent and aDispNameCurrent. + * To support more members than 1 this method needs to be changed, + * but for now, it suffices for our testing. + * + * In cleanupstack there are 5 items, FIFO: + * - added list + * - updated list + * - removed list + * - current member list + * - event imp + * + * This is because this event won't take ownership to the arrays + * when created this way. + * + * @param aGroupId The group id + * @param aUri Uri + * @param aDispName Displayname + * @param aArraySpec Defines into which delta array to put the member + * @param aIdentityCurrent Identity part of current member + * @param aDispNameCurrent Display name part of current member + * @param aStatus The subscription status + * @return The suitably filled event. + */ + IMPORT_C static CPresentityGroupContentEventImp* + CreateGroupContentEventLCX( + const TDesC& aGroupId, + + const TDesC& aIdentityForDelta, + const TDesC& aDispNameForDelta, + + TTestPGLContentArraySpecifier aArraySpec, + + const TDesC& aIdentityCurrent, + const TDesC& aDispNameCurrent, + + MXIMPDataSubscriptionState::TSubscriptionState aSubscriptionState, + MXIMPDataSubscriptionState::TDataState aDataState + ); + }; + +#endif //PRFWTESTEVENTFACTORY_H__ + + diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/tsrcutils/testcaseutils/prfwtestfilelogichelper.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/tsrcutils/testcaseutils/prfwtestfilelogichelper.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,317 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Test support file tool + * +*/ + + +#include +#include +#include +#include +#include +#include +#include +#include "prfwtestfilelogichelper.h" +#include "prfwtestfilesrvmsg.h" +#include "presentitygroupinfoimp.h" +#include "presentitygroupmemberinfoimp.h" +#include "presencewatcherinfoimp.h" +#include "presencegrantrequestinfoimp.h" +#include "presenceblockinfoimp.h" +#include "ximpidentityimp.h" +#include "ximpobjecthelpers.h" +#include "prfwtestmessenger.h" +#include "ximprestrictedobjectcollectionimp.h" +#include "ximpobjectcollectionimp.h" +#include "presenceinfoimp.h" + +// ======== LOCAL FUNCTIONS ======== + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +CXIMPTestFileLogicHelper::CXIMPTestFileLogicHelper( MXIMPProtocolConnectionHost& aHost, CXIMPTestMessenger& aMessenger ) +: iHost( aHost ), iMessenger( aMessenger ) + { + } + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +void CXIMPTestFileLogicHelper::ConstructL() + { + } + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +EXPORT_C CXIMPTestFileLogicHelper* CXIMPTestFileLogicHelper::NewL( MXIMPProtocolConnectionHost& aHost, CXIMPTestMessenger& aMessenger ) + { + CXIMPTestFileLogicHelper* self = new( ELeave ) CXIMPTestFileLogicHelper( aHost, aMessenger ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +CXIMPTestFileLogicHelper::~CXIMPTestFileLogicHelper() + { + } + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +void CXIMPTestFileLogicHelper::HandleL( TInt aCommandType, TDesC8& aCommand ) + { + switch( aCommandType ) + { + case CXIMPTestFileSrvMsg::ETestSrvMsgPresenceGrantRequestList: + { + RXIMPObjOwningPtrArray< CPresenceGrantRequestInfoImp > array; + CleanupClosePushL( array ); + TXIMPObjectPacker::UnPackArrayL( array, aCommand ); + CXIMPObjectCollectionImp* objCollection = CXIMPObjectCollectionImp::NewLC(); + for( TInt a = 0; a < array.Count(); ++a ) + { + objCollection->AddObjectL( array[ a ] ); + array[ a ] = NULL; + } + + iHost.ProtocolPresenceDataHost().AuthorizationDataHost().HandlePresenceGrantRequestListL( objCollection ); + CleanupStack::Pop( objCollection ); + CleanupStack::PopAndDestroy(); //array + break; + } + case CXIMPTestFileSrvMsg::ETestSrvMsgPresenceGrantRequestReceived: + { + CPresenceGrantRequestInfoImp* infoFromServer = + CPresenceGrantRequestInfoImp::NewLC(); + TXIMPObjectPacker::UnPackL( + *infoFromServer, aCommand ); + + iHost.ProtocolPresenceDataHost().AuthorizationDataHost().HandlePresenceGrantRequestReceivedL( infoFromServer ); + CleanupStack::Pop( infoFromServer ); + break; + } + case CXIMPTestFileSrvMsg::ETestSrvMsgPresenceGrantRequestObsoleted: + { + CXIMPIdentityImp* idFromServer = CXIMPIdentityImp::NewLC(); + TXIMPObjectPacker::UnPackL( *idFromServer, + aCommand ); + + iHost.ProtocolPresenceDataHost().AuthorizationDataHost().HandlePresenceGrantRequestObsoletedL( idFromServer ); + CleanupStack::Pop( idFromServer ); + break; + } + case CXIMPTestFileSrvMsg::ETestSrvMsgPresentityGroupList: + { + RXIMPObjOwningPtrArray< CPresentityGroupInfoImp > array; + CleanupClosePushL( array ); + TXIMPObjectPacker::UnPackArrayL( array, aCommand ); + CXIMPObjectCollectionImp* objCollection = CXIMPObjectCollectionImp::NewLC(); + for( TInt a = 0; a < array.Count(); ++a ) + { + objCollection->AddObjectL( array[ a ] ); + array[ a ] = NULL; + } + iHost.ProtocolPresenceDataHost().GroupsDataHost().HandlePresentityGroupListL( objCollection ); + CleanupStack::Pop( objCollection ); + CleanupStack::PopAndDestroy(); //array + break; + } + case CXIMPTestFileSrvMsg::ETestSrvMsgPresentityGroupCreate: + case CXIMPTestFileSrvMsg::ETestSrvMsgPresentityGroupUpdate: + { + CPresentityGroupInfoImp* infoFromServer = + CPresentityGroupInfoImp::NewLC(); + TXIMPObjectPacker::UnPackL( + *infoFromServer, aCommand ); + + if( aCommandType == CXIMPTestFileSrvMsg::ETestSrvMsgPresentityGroupCreate ) + { + iHost.ProtocolPresenceDataHost().GroupsDataHost().HandlePresentityGroupCreatedL( infoFromServer ); + } + else + { + iHost.ProtocolPresenceDataHost().GroupsDataHost().HandlePresentityGroupDisplayNameUpdatedL( infoFromServer ); + } + CleanupStack::Pop( infoFromServer ); + break; + } + case CXIMPTestFileSrvMsg::ETestSrvMsgPresentityGroupDelete: + { + CXIMPIdentityImp* idFromServer = CXIMPIdentityImp::NewLC(); + TXIMPObjectPacker::UnPackL( *idFromServer, + aCommand ); + iHost.ProtocolPresenceDataHost().GroupsDataHost().HandlePresentityGroupDeletedL( idFromServer ); + CleanupStack::Pop( idFromServer ); + break; + } + case CXIMPTestFileSrvMsg::ETestSrvMsgPresentityGroupMemberList: + { + RPointerArray< HBufC8 > bufferArray; + CleanupClosePushL( bufferArray ); + TXIMPHBuf8Packer::UnPackArrayL( bufferArray, aCommand ); + HBufC8* groupIdBuf = bufferArray[ 0 ]; + HBufC8* array = bufferArray[ 1 ]; + CleanupStack::PopAndDestroy(); // BufferArray + CleanupStack::PushL( groupIdBuf ); + CleanupStack::PushL( array ); + + CXIMPIdentityImp* groupId = CXIMPIdentityImp::NewLC(); + TXIMPObjectPacker< CXIMPIdentityImp >::UnPackL( *groupId, *groupIdBuf ); + + RXIMPObjOwningPtrArray< CPresentityGroupMemberInfoImp > memberArray; + CleanupClosePushL( memberArray ); + TXIMPObjectPacker::UnPackArrayL( memberArray, *array ); + CXIMPObjectCollectionImp* objCollection = CXIMPObjectCollectionImp::NewLC(); + for( TInt a = 0; a < memberArray.Count(); ++a ) + { + objCollection->AddObjectL( memberArray[ a ] ); + memberArray[ a ] = NULL; + } + iHost.ProtocolPresenceDataHost().GroupsDataHost().HandlePresentityGroupContentL( groupId, objCollection ); + CleanupStack::Pop( objCollection ); + CleanupStack::PopAndDestroy(); //memberArray + CleanupStack::Pop( groupId ); + CleanupStack::PopAndDestroy( 2, groupIdBuf ); + break; + } + case CXIMPTestFileSrvMsg::ETestCheckIfGroupMemberExists: + { + CXIMPIdentityImp* groupId = CXIMPIdentityImp::NewLC(); + TXIMPObjectPacker< CXIMPIdentityImp >::UnPackL( *groupId, aCommand ); + // Write to pubsub + const MXIMPDataSubscriptionState& state = + iHost.ProtocolPresenceDataHost().GroupsDataHost().PresentityGroupContentDataSubscriptionState( *groupId ); + if( state.DataState() == MXIMPDataSubscriptionState::EDataAvailable ) + { + iMessenger.SetValueFor( EXIMPPlgTestExistsGroupContentInCache, 1 ); + } + else + { + iMessenger.SetValueFor( EXIMPPlgTestExistsGroupContentInCache, KErrNotFound ); + } + CleanupStack::PopAndDestroy( groupId ); + break; + } + case CXIMPTestFileSrvMsg::ETestSrvMsgPresenceWatcherList: + { + RXIMPObjOwningPtrArray< CPresenceWatcherInfoImp > array; + CleanupClosePushL( array ); + TXIMPObjectPacker< CPresenceWatcherInfoImp >::UnPackArrayL( array, aCommand ); + CXIMPObjectCollectionImp* objCollection = CXIMPObjectCollectionImp::NewLC(); + for( TInt a = 0; a < array.Count(); ++a ) + { + objCollection->AddObjectL( array[ a ] ); + array[ a ] = NULL; + } + + iHost.ProtocolPresenceDataHost().PublishingDataHost().HandlePresenceWatcherListL( objCollection ); + CleanupStack::Pop( objCollection ); + CleanupStack::PopAndDestroy(); //, array + break; + } + case CXIMPTestFileSrvMsg::ETestSrvMsgPresentityPresence: + { + RPointerArray< HBufC8 > bufferArray; + CleanupClosePushL( bufferArray ); + TXIMPHBuf8Packer::UnPackArrayL( bufferArray, aCommand ); + HBufC8* presenceIdBuf = bufferArray[ 0 ]; + HBufC8* presenceInfoBuf = bufferArray[ 1 ]; + CleanupStack::PopAndDestroy(); // BufferArray + CleanupStack::PushL( presenceIdBuf ); + CleanupStack::PushL( presenceInfoBuf ); + + CXIMPIdentityImp* presenceId = CXIMPIdentityImp::NewLC(); + TXIMPObjectPacker< CXIMPIdentityImp >::UnPackL( *presenceId, *presenceIdBuf ); + + CPresenceInfoImp* presenceInfo = CPresenceInfoImp::NewLC(); + TXIMPObjectPacker< CPresenceInfoImp >::UnPackL( *presenceInfo, *presenceInfoBuf ); + + iHost.ProtocolPresenceDataHost().WatchingDataHost().HandleSubscribedPresentityPresenceL( presenceId, presenceInfo ); + + CleanupStack::Pop( 2, presenceId ); + CleanupStack::PopAndDestroy( 2, presenceIdBuf ); + break; + } + case CXIMPTestFileSrvMsg::ETestSrvMsgPresenceBlockList: + { + RXIMPObjOwningPtrArray< CPresenceBlockInfoImp > array; + CleanupClosePushL( array ); + TXIMPObjectPacker< CPresenceBlockInfoImp >::UnPackArrayL( array, aCommand ); + CXIMPObjectCollectionImp* objCollection = CXIMPObjectCollectionImp::NewLC(); + for( TInt a = 0; a < array.Count(); ++a ) + { + objCollection->AddObjectL( array[ a ] ); + array[ a ] = NULL; + } + + iHost.ProtocolPresenceDataHost().AuthorizationDataHost().HandlePresenceBlockListL( objCollection ); + CleanupStack::Pop( objCollection ); + CleanupStack::PopAndDestroy(); // array + break; + } + case CXIMPTestFileSrvMsg::ETestSrvMsgPresenceBlocked: + { + CPresenceBlockInfoImp* infoFromServer = + CPresenceBlockInfoImp::NewLC(); + TXIMPObjectPacker::UnPackL( + *infoFromServer, aCommand ); + iHost.ProtocolPresenceDataHost().AuthorizationDataHost().HandlePresenceBlockedL( infoFromServer ); + CleanupStack::Pop( infoFromServer ); + break; + } + case CXIMPTestFileSrvMsg::ETestSrvMsgPresenceBlockCanceled: + { + CXIMPIdentityImp* idFromServer = CXIMPIdentityImp::NewLC(); + TXIMPObjectPacker::UnPackL( *idFromServer, + aCommand ); + + iHost.ProtocolPresenceDataHost().AuthorizationDataHost().HandlePresenceBlockCanceledL( idFromServer ); + + CleanupStack::Pop( idFromServer ); + break; + } + + case CXIMPTestFileSrvMsg::ETestSrvMsgReqParamIdentity: + { + CXIMPIdentityImp* groupId = CXIMPIdentityImp::NewLC(); + TXIMPObjectPacker< CXIMPIdentityImp >::UnPackL( *groupId, aCommand ); + CXIMPRestrictedObjectCollectionImp* paramCollection = CXIMPRestrictedObjectCollectionImp::NewLC(); + paramCollection->AddOrReplaceTypeL( groupId ); + iMessenger.SetReqCompleteParams( paramCollection ); + CleanupStack::Pop( 2, groupId ); + break; + } + default: + { + User::Panic( _L( "Not valid commandtype" ), 59 ); + break; + } + } + } + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/tsrcutils/testcaseutils/prfwtestfilelogichelper.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/tsrcutils/testcaseutils/prfwtestfilelogichelper.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,66 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Test support file tool + * +*/ + + +#ifndef CPRFWTESTFILELOGICHELPER_H +#define CPRFWTESTFILELOGICHELPER_H + +#include +#include "prfwtestfileobserver.h" + +class MXIMPProtocolConnectionHost; +class CXIMPTestMessenger; + +/** + * @since S60 v4.0 + */ +class CXIMPTestFileLogicHelper : public CBase, public MXIMPTestFileObserver + { + public: + + IMPORT_C static CXIMPTestFileLogicHelper* NewL( MXIMPProtocolConnectionHost& aHost, CXIMPTestMessenger& aMessenger ); + virtual ~CXIMPTestFileLogicHelper(); + + private: + + CXIMPTestFileLogicHelper( MXIMPProtocolConnectionHost& aHost, CXIMPTestMessenger& aMessenger ); + void ConstructL(); + + public: + + + private: // From MXIMPTestFileObserver + + /** + * @see MXIMPTestFileObserver + */ + virtual void HandleL( TInt aCommandType, TDesC8& aCommand ); + + private: // data + + /** + * Access to host for server messages. + */ + MXIMPProtocolConnectionHost& iHost; + + /** + * Does not own. Messenger for signaling. + */ + CXIMPTestMessenger& iMessenger; + }; + +#endif // CPRFWTESTFILELOGICHELPER_H diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/tsrcutils/testcaseutils/prfwtestfileobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/tsrcutils/testcaseutils/prfwtestfileobserver.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,40 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Test support file tool + * +*/ + + +#ifndef MPRFWTESTFILEOBSERVER_H +#define MPRFWTESTFILEOBSERVER_H + +/** + * @since S60 v4.0 + */ +class MXIMPTestFileObserver + { + protected: + + /** + * Cannot be deleted through this interface + */ + virtual ~MXIMPTestFileObserver(){} + + public: // Interface + + virtual void HandleL( TInt aCommandType, TDesC8& aCommand ) = 0; + + }; + +#endif // CPRFWTESTFILELOGICHELPER_H \ No newline at end of file diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/tsrcutils/testcaseutils/prfwtestfilesrvmsg.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/tsrcutils/testcaseutils/prfwtestfilesrvmsg.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,149 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Test support file tool server message + * +*/ + + + +#include +#include +#include + +#include "prfwtestfilesrvmsg.h" + +// ======== LOCAL FUNCTIONS ======== + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +CXIMPTestFileSrvMsg::CXIMPTestFileSrvMsg() + { + } + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +void CXIMPTestFileSrvMsg::ConstructL() + { + iPayload = HBufC8::NewL(0); + } + + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +EXPORT_C CXIMPTestFileSrvMsg* CXIMPTestFileSrvMsg::NewLC() + { + CXIMPTestFileSrvMsg* self = new( ELeave ) CXIMPTestFileSrvMsg(); + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +void CXIMPTestFileSrvMsg::ConstructL( const TDesC8& aPayload ) + { + iPayload = aPayload.AllocL(); + } + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +CXIMPTestFileSrvMsg::CXIMPTestFileSrvMsg( TInt aSrvMsgId ) : + iSrvMsgId( aSrvMsgId ) + { + } + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +EXPORT_C CXIMPTestFileSrvMsg* CXIMPTestFileSrvMsg::NewL( + TInt aSrvMsgId, + const TDesC8& aPayload ) + { + CXIMPTestFileSrvMsg* self = new( ELeave ) CXIMPTestFileSrvMsg( aSrvMsgId ); + CleanupStack::PushL( self ); + self->ConstructL( aPayload ); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +CXIMPTestFileSrvMsg::~CXIMPTestFileSrvMsg() + { + delete iPayload; + } + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +EXPORT_C void CXIMPTestFileSrvMsg::ExternalizeL( RWriteStream& aStream ) const + { + aStream.WriteUint32L( iSrvMsgId ); + aStream.WriteUint32L( iPayload->Length() ); + aStream.WriteL( *iPayload ); + } + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +EXPORT_C void CXIMPTestFileSrvMsg::InternalizeL( RReadStream& aStream ) + { + iSrvMsgId = aStream.ReadUint32L(); + TInt len = aStream.ReadUint32L(); + + HBufC8* buffer = HBufC8::NewLC( len ); + TPtr8 ptr = buffer->Des(); + aStream.ReadL( ptr, len ); + + delete iPayload; + CleanupStack::Pop( buffer ); + iPayload = buffer; + } + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +EXPORT_C TDesC8& CXIMPTestFileSrvMsg::PayloadL() + { + return *iPayload; + } + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +EXPORT_C TInt CXIMPTestFileSrvMsg::SrvMsgId() + { + return iSrvMsgId; + } + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/tsrcutils/testcaseutils/prfwtestfilesrvmsg.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/tsrcutils/testcaseutils/prfwtestfilesrvmsg.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,106 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Test support file tool server message + * +*/ + + +#ifndef CPRFWTESTFILESRVMSG_H +#define CPRFWTESTFILESRVMSG_H + +#include +#include + +/** + * Support for servermessage files. + * + * @since S60 v4.0 + */ +class CXIMPTestFileSrvMsg : public CBase + { + public: + + enum TTestSrvMsgType + { + ETestSrvMsgPresenceBlockList, + ETestSrvMsgPresenceBlocked, + ETestSrvMsgPresenceBlockCanceled, + ETestSrvMsgPresenceGrantRequestList, + ETestSrvMsgPresenceGrantRequestReceived, + ETestSrvMsgPresenceGrantRequestObsoleted, + ETestSrvMsgPresentityGroupList, + ETestSrvMsgPresentityGroupCreate, + ETestSrvMsgPresentityGroupDelete, + ETestSrvMsgPresentityGroupUpdate, + ETestSrvMsgPresentityGroupMemberList, + ETestCheckIfGroupMemberExists, + ETestSrvMsgPresenceWatcherList, + ETestSrvMsgPresentityPresence, + ETestSrvMsgReqParamIdentity, + }; + + public: + + IMPORT_C static CXIMPTestFileSrvMsg* NewLC(); + + IMPORT_C static CXIMPTestFileSrvMsg* NewL( + TInt aSrvMsgId, + const TDesC8& aPayload ); + + virtual ~CXIMPTestFileSrvMsg(); + + private: + + CXIMPTestFileSrvMsg(); + + void ConstructL(); + + CXIMPTestFileSrvMsg( TInt aSrvMsgId ); + + void ConstructL( const TDesC8& aPayload ); + + public: + + /** + * Extenalizes object data to given stream. + * @param aStream Stream to write. + */ + IMPORT_C void ExternalizeL( RWriteStream& aStream ) const; + + /** + * Internalizes object data from given stream. + * @param aStream Stream to read. + */ + IMPORT_C void InternalizeL( RReadStream& aStream ); + + /** + * Getter for the data stored inside this class. + * @return Reference to the data + */ + IMPORT_C TDesC8& PayloadL(); + + /** + * Server message identifier specifies what kind of + * server-originated message this is. + * @return Server message identifier + */ + IMPORT_C TInt SrvMsgId(); + + private: // data + + TInt iSrvMsgId; + HBufC8* iPayload; + }; + +#endif // CPRFWTESTFILESRVMSG_H diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/tsrcutils/testcaseutils/prfwtestfiletool.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/tsrcutils/testcaseutils/prfwtestfiletool.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,502 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Test support file tool + * +*/ + + + +#include +#include +#include + +#include "prfwtestfiletool.h" +#include "prfwtestfilesrvmsg.h" +#include "ximpeventcodec.h" +#include "prfwtestfileobserver.h" + +/* Hierarchy under C:/temp/prfw/: + * /protocoluid/instancenumber/Plugin\ + * /protocoluid/instancenumber/SrvMsg\ + */ + +_LIT( KFileToolMainDirFull, "c:\\temp\\prfw" ); + +_LIT( KFileToolBackslash, "\\" ); +_LIT( KFileToolDirUid, "%d" ); +_LIT( KInstanceAsNumber, "%d" ); + +_LIT( KFileToolPluginDirBase, "Plugin" ); +_LIT( KFileToolSrvDirBase, "SrvMsg" ); + +_LIT( KFileToolWildcard, "file*.prfw" ); +_LIT( KFileToolFileBase, "file%d.prfw" ); + +// ======== LOCAL FUNCTIONS ======== + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +CXIMPTestFileTool::CXIMPTestFileTool( TUint32 aUid ) : + iUid( aUid ) + { + iFs.Connect(); + } + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +void CXIMPTestFileTool::ConstructL( const TDesC16& aInstanceId ) + { + iTimer = CPeriodic::NewL( CActive::EPriorityStandard ); + iInstance = aInstanceId.AllocL(); + } + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +void CXIMPTestFileTool::ConstructL( TInt aInstanceIdAsNum ) + { + TInt instanceLength = NumLenInChars( aInstanceIdAsNum ); + HBufC* instance = HBufC::NewLC( instanceLength ); + instance->Des().AppendFormat( KInstanceAsNumber, aInstanceIdAsNum ); + ConstructL( *instance ); + CleanupStack::PopAndDestroy( instance ); + } + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +EXPORT_C CXIMPTestFileTool* CXIMPTestFileTool::NewL( TUint32 aUid, const TDesC16& aInstanceId ) + { + CXIMPTestFileTool* self = new( ELeave ) CXIMPTestFileTool( aUid ); + CleanupStack::PushL( self ); + self->ConstructL( aInstanceId ); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +EXPORT_C CXIMPTestFileTool* CXIMPTestFileTool::NewL( TUint32 aUid, TInt aInstanceIdAsNum ) + { + CXIMPTestFileTool* self = new( ELeave ) CXIMPTestFileTool( aUid ); + CleanupStack::PushL( self ); + self->ConstructL( aInstanceIdAsNum ); + CleanupStack::Pop( self ); + return self; + } + + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +CXIMPTestFileTool::~CXIMPTestFileTool() + { + iFs.Close(); + if ( iTimer ) + { + iTimer->Deque(); + } + delete iTimer; + iObservers.Close(); + delete iInstance; + } + +// --------------------------------------------------------------------------- +// Remove the entire prfw directory +// --------------------------------------------------------------------------- +// +EXPORT_C void CXIMPTestFileTool::CleanAllL() + { + RFs fs; + fs.Connect(); + CleanupClosePushL( fs ); + + CFileMan* fileMan = CFileMan::NewL( fs ); + CleanupStack::PushL( fileMan ); + + // remove the files and the directory + fileMan->RmDir( KFileToolMainDirFull ); + + CleanupStack::PopAndDestroy( 2 ); // fileman, fs + } + +// --------------------------------------------------------------------------- +// Prepare everything, after this objects can be externalized and +// internalized +// --------------------------------------------------------------------------- +// +EXPORT_C void CXIMPTestFileTool::PrepareL() + { + // create the directory structure + HBufC* dirName = GetDirNameAndBackslashLC( KFileToolPluginDirBase ); + iFs.MkDirAll( *dirName ); + CleanupStack::PopAndDestroy( dirName ); + + dirName = GetDirNameAndBackslashLC( KFileToolSrvDirBase ); + iFs.MkDirAll( *dirName ); + CleanupStack::PopAndDestroy( dirName ); + } + +// --------------------------------------------------------------------------- +// Write the file to correct directory. +// --------------------------------------------------------------------------- +// +EXPORT_C void CXIMPTestFileTool::PluginStoreL( const TDesC8& aExternalizedObject ) + { + HBufC* fileName = GetFileNameLC( + KFileToolPluginDirBase, + iObjIndex ); + + RFileWriteStream out; + CleanupClosePushL( out ); + out.Create( iFs, *fileName, EFileWrite|EFileStream|EFileShareAny ); + + // write the file + TUint32 len = aExternalizedObject.Length(); + out.WriteUint32L( len ); + out.WriteL( aExternalizedObject ); + CleanupStack::PopAndDestroy(); // out + + CleanupStack::PopAndDestroy( fileName ); // fileName + + // next file will have a new index + iObjIndex++; + } + +// --------------------------------------------------------------------------- +// Restore the file from given directory and given index +// --------------------------------------------------------------------------- +// +EXPORT_C CXIMPApiEventBase* CXIMPTestFileTool::PluginRestoreLC( + TInt aObjIndex ) + { + HBufC* fileName = GetFileNameLC( + KFileToolPluginDirBase, + aObjIndex ); + + // try to instantiate it + RFileReadStream in; + CleanupClosePushL( in ); + + in.Open( iFs, *fileName, EFileStream ); + TInt len = in.ReadUint32L(); + HBufC8* buffer = HBufC8::NewLC( len ); + TPtr8 ptr = buffer->Des(); + in.ReadL( ptr ); + + // instantiate the object + TInt32 dummy = 0; + CXIMPApiEventBase* object = XIMPEventCodec::UnPackL( *buffer, dummy ); + + CleanupStack::PopAndDestroy( 2 ); // buffer, in + + // delete the just read object + iFs.Delete( *fileName ); + + CleanupStack::PopAndDestroy( fileName ); + + CleanupStack::PushL( object ); + return object; + } + +// --------------------------------------------------------------------------- +// Write the server message object to correct directory. +// --------------------------------------------------------------------------- +// +EXPORT_C void CXIMPTestFileTool::SrvMsgStoreL( + CXIMPTestFileSrvMsg* aSrvMsg ) + { + TInt nextObjIndex = NumSrvMsgL(); + HBufC* fileName = GetFileNameLC( + KFileToolSrvDirBase, + nextObjIndex); + + RFileWriteStream out; + CleanupClosePushL( out ); + TInt retVal = out.Create( iFs, *fileName, EFileWrite|EFileStream|EFileShareAny ); + User::LeaveIfError( retVal ); + + aSrvMsg->ExternalizeL( out ); + + CleanupStack::PopAndDestroy( 2, fileName ); // out, fileName + + // next file will have a new index + //iSrvObjIndex++; + } + +// --------------------------------------------------------------------------- +// Restore the file from given directory and given index +// --------------------------------------------------------------------------- +// +EXPORT_C CXIMPTestFileSrvMsg* CXIMPTestFileTool::SrvMsgRestoreLC( + TInt aObjIndex ) + { + CXIMPTestFileSrvMsg* msg = CXIMPTestFileSrvMsg::NewLC(); + + HBufC* fileName = GetFileNameLC( + KFileToolSrvDirBase, + aObjIndex ); + + // try to instantiate it + RFileReadStream in; + CleanupClosePushL( in ); + + in.Open( iFs, *fileName, EFileStream ); + + msg->InternalizeL( in ); + + CleanupStack::PopAndDestroy(); // in + + // delete the just read object + iFs.Delete( *fileName ); + + CleanupStack::PopAndDestroy( fileName ); // fileName + return msg; + } + +// --------------------------------------------------------------------------- +// Common file counting helper +// --------------------------------------------------------------------------- +// +TInt CXIMPTestFileTool::DoNumObjectsL( const TDesC& aTemplate ) + { + CDir* dir = GetDirListL( aTemplate ); + TInt count = dir->Count(); + delete dir; + return count; + } + +// --------------------------------------------------------------------------- +// Number of objects (files) in a given directory +// --------------------------------------------------------------------------- +// +EXPORT_C TInt CXIMPTestFileTool::NumObjectsL() + { + return DoNumObjectsL( KFileToolPluginDirBase ); + } + +// --------------------------------------------------------------------------- +// Number of server-originated objects (files) in a given directory +// --------------------------------------------------------------------------- +// +EXPORT_C TInt CXIMPTestFileTool::NumSrvMsgL() + { + // returns the number of objects in the directory + // get file listing and derive the count from that + return DoNumObjectsL( KFileToolSrvDirBase ); + } + +// --------------------------------------------------------------------------- +// Instace id +// --------------------------------------------------------------------------- +// +EXPORT_C const TDesC16& CXIMPTestFileTool::InstanceId() const + { + return *iInstance; + } + +// --------------------------------------------------------------------------- +// Length of number in characters (e.g. 501 --> 3) +// --------------------------------------------------------------------------- +// +TInt CXIMPTestFileTool::NumLenInChars( TInt aNum ) + { + TInt len = 0; + TInt tmp = aNum; + do + { + tmp /= 10; // number is base-10 + len++; + } + while ( tmp > 0 ); + return len; + } + +// --------------------------------------------------------------------------- +// Gets properly expanded directory name with backslash appended +// --------------------------------------------------------------------------- +// +HBufC* CXIMPTestFileTool::GetDirNameAndBackslashLC( + const TDesC& aTemplate ) + { + TInt uidLength = NumLenInChars( iUid ); + TInt instanceLength = iInstance->Length(); + + HBufC* dirName = HBufC::NewLC( + KFileToolMainDirFull().Length() + + KFileToolBackslash().Length() + + KFileToolDirUid().Length() + -2 // "%d" gets modified to be the number + + KFileToolBackslash().Length() + + uidLength + instanceLength + + KFileToolBackslash().Length() + + aTemplate.Length() + + KFileToolBackslash().Length() // added for later use by GetDirNameAndBackslashLC. + ); + + dirName->Des().Append( KFileToolMainDirFull ); + dirName->Des().Append( KFileToolBackslash ); + dirName->Des().AppendFormat( KFileToolDirUid, iUid ); + dirName->Des().Append( KFileToolBackslash ); + dirName->Des().Append( *iInstance ); + dirName->Des().Append( KFileToolBackslash ); + dirName->Des().Append( aTemplate ); + + dirName->Des().Append( KFileToolBackslash ); + iFs.MkDirAll( *dirName ); + return dirName; + } + +// --------------------------------------------------------------------------- +// Get full path wildcard for files residing in a directory +// with given index +// --------------------------------------------------------------------------- +// +HBufC* CXIMPTestFileTool::GetWildcardLC( + const TDesC& aDirTemplate ) + { + HBufC* dirName = GetDirNameAndBackslashLC( aDirTemplate ); + HBufC* wildcard = HBufC::NewLC( + dirName->Length() + KFileToolWildcard().Length() ); + wildcard->Des().Append( *dirName ); + wildcard->Des().Append( KFileToolWildcard ); + + CleanupStack::Pop( 2 ); // wildcard, dirName + delete dirName; + + CleanupStack::PushL( wildcard ); + return wildcard; + } + +// --------------------------------------------------------------------------- +// Get a list of files in a given directory +// --------------------------------------------------------------------------- +// +CDir* CXIMPTestFileTool::GetDirListL( const TDesC& aTemplate ) + { + HBufC* wildcard = GetWildcardLC( aTemplate ); + + CDir* dirList = NULL; + iFs.GetDir( *wildcard, KEntryAttNormal, ESortByName, dirList ); + CleanupStack::PopAndDestroy( wildcard ); + + return dirList; + } + +// --------------------------------------------------------------------------- +// Get fully qualified file name +// --------------------------------------------------------------------------- +// +HBufC* CXIMPTestFileTool::GetFileNameLC( + const TDesC& aDirTemplate, + TInt aObjIndex ) + { + // create file name + HBufC* dirName = GetDirNameAndBackslashLC( aDirTemplate ); + + TInt numLen = NumLenInChars( aObjIndex ); + HBufC* fileName = HBufC::NewLC( + dirName->Length() + + KFileToolFileBase().Length() + + numLen + - 2 // "%d" gets modified to be the number + ); + fileName->Des().Append( *dirName ); + fileName->Des().AppendFormat( KFileToolFileBase, aObjIndex ); + + CleanupStack::Pop( fileName ); + CleanupStack::PopAndDestroy( dirName ); + CleanupStack::PushL( fileName ); + + // now we have the filename + return fileName; + } + +const TInt KSecond = 1000000; + +// --------------------------------------------------------------------------- +// CXIMPTestFileTool::RegisterObserverL +// --------------------------------------------------------------------------- +// +void CXIMPTestFileTool::RegisterObserverL( MXIMPTestFileObserver* aObserver ) + { + iObservers.AppendL( aObserver ); + if( !iTimer->IsActive() ) + { + TCallBack callback( Process, this ); + iTimer->Start( KSecond, KSecond, callback ); + } + } + +// --------------------------------------------------------------------------- +// CXIMPTestFileTool::UnregisterObserver +// --------------------------------------------------------------------------- +// +void CXIMPTestFileTool::UnregisterObserver( MXIMPTestFileObserver* aObserver ) + { + TInt index = iObservers.Find( aObserver ); + if( index != KErrNotFound ) + { + iObservers.Remove( index ); + } + if( iObservers.Count() == 0 ) + { + iTimer->Cancel(); + } + } + + +// --------------------------------------------------------------------------- +// CXIMPTestFileTool::RunL +// --------------------------------------------------------------------------- +// +TInt CXIMPTestFileTool::Process( TAny* aMyself ) + { + TRAPD( ignore, ( static_cast< CXIMPTestFileTool* >( aMyself ) )->DoProcessL() ); + return 0; // ignored by CPeriodic + } + +// --------------------------------------------------------------------------- +// CXIMPTestFileTool::RunL +// --------------------------------------------------------------------------- +// +void CXIMPTestFileTool::DoProcessL() + { + TInt countOfSrvMsg = NumSrvMsgL(); + TInt countOfObservers = iObservers.Count(); + + for( TInt a = 0; a < countOfSrvMsg; ++a ) + { + CXIMPTestFileSrvMsg* newMsg = SrvMsgRestoreLC( a ); + for( TInt b = 0;b < countOfObservers; ++b ) + { + iObservers[ b ]->HandleL( newMsg->SrvMsgId(), newMsg->PayloadL() ); + } + CleanupStack::PopAndDestroy( newMsg ); + } + } + + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/tsrcutils/testcaseutils/prfwtestfiletool.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/tsrcutils/testcaseutils/prfwtestfiletool.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,199 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Test support file tool + * +*/ + + +#ifndef CPRFWTESTFILETOOL_H +#define CPRFWTESTFILETOOL_H + +#include +#include + +class CXIMPApiEventBase; +class CXIMPTestFileSrvMsg; +class MXIMPTestFileObserver; + +/** + * File support for tests. + * Support functions for externalizing a class to a known directory and + * retrieving the classes. + * + * This is a sort of "pseudo-IPC" from the test protocol (ecom plugin) + * to EUnit test code. A server could also be used, but this is faster + * to do and simpler. + * + * @since S60 v4.0 + */ +class CXIMPTestFileTool : public CBase + { + public: + + IMPORT_C static CXIMPTestFileTool* NewL( TUint32 aUid, const TDesC16& aInstanceId ); + IMPORT_C static CXIMPTestFileTool* NewL( TUint32 aUid, TInt aInstanceIdAsNum ); + virtual ~CXIMPTestFileTool(); + + private: + + CXIMPTestFileTool( TUint32 aUid ); + void ConstructL( const TDesC16& aInstanceId ); + void ConstructL( TInt aInstanceIdAsNum ); + + public: + + /** + * Clean all files from the filetool directory. + * Remove also the directory itself. + * Removes EVERYTHING from ALL DIRECTORIES used + * by filetool!!! So don't call it everytime, only once + * upon test case startup. + */ + IMPORT_C static void CleanAllL(); + + /** + * Prepares for writing only the directory used by this + * filetool instance + */ + IMPORT_C void PrepareL(); + + /** + * Store the object to file. + * The given descriptor is externalized as given, + * with the length of the descriptor written first, + * as a 32-bit TUint: + * + * @param aExternalizedObject The externalized object + */ + IMPORT_C void PluginStoreL( const TDesC8& aExternalizedObject ); + + /** + * Restore a stored object from file. + * Ownership is transferred! + * @param aObjIndex The index for the object + */ + IMPORT_C CXIMPApiEventBase* PluginRestoreLC( TInt aObjIndex ); + + /** + * Store the object to file. (SERVER MESSAGE) + * The given descriptor is externalized as given, + * with the length of the descriptor written first, + * as a 32-bit TUint: + * + * @param aExternalizedObject The externalized object + */ + IMPORT_C void SrvMsgStoreL( CXIMPTestFileSrvMsg* aSrvMsg ); + + /** + * Restore a stored object from file. (SERVER MESSAGE) + * Ownership is transferred! + * @param aIndex The index for the object + */ + IMPORT_C CXIMPTestFileSrvMsg* SrvMsgRestoreLC( TInt aIndex ); + + /** + * Return the number of objects currently stored in the directory. + */ + IMPORT_C TInt NumObjectsL(); + + /** + * Return the number of objects depicting server-originated + * message currently stored in the directory. + */ + IMPORT_C TInt NumSrvMsgL(); + + /** + * @return Instance id + */ + IMPORT_C const TDesC16& InstanceId() const; + + private: + + /** + * @return The directory name (with backslash) + * (E.g. "C:/temp/prfw/1234/0/SrvMsg/") + */ + HBufC* GetDirNameAndBackslashLC( + const TDesC& aTemplate ); + + /** + * @return Wildcard for file deletion + * (E.g. "C:/temp/prfw/1234/0/SrvMsg/file*.prfw") + * @param aDirTemplate The directory template for the wildcard + */ + HBufC* GetWildcardLC( + const TDesC& aDirTemplate ); + + /** + * Get the full file name, properly expanded. + * @param aDirTemplate The template for the dirs + * @param aObjIndex The object index + */ + HBufC* GetFileNameLC( + const TDesC& aDirTemplate, + TInt aObjIndex ); + + /** + * @return Length of the given number as if it were a string. + * @param aNum The number + */ + TInt NumLenInChars( TInt aNum ); + + /** + * @return Listing of the directory + * @param aTemplate The wildcard template for the files + */ + CDir* GetDirListL( const TDesC& aTemplate ); + + /** + * Common helper for NumObjects methods. + */ + TInt DoNumObjectsL( const TDesC& aTemplate ); + + /** + * + */ + static TInt Process( TAny* aMyself ); + void DoProcessL(); + + public: + + /** + * Observer registration + */ + void RegisterObserverL( MXIMPTestFileObserver* aObserver ); + void UnregisterObserver( MXIMPTestFileObserver* aObserver ); + + + private: // data + + TUint32 iUid; // protocoluid + HBufC16* iInstance; // the global instance id + + TInt iObjIndex; // object index for created objects + TInt iSrvObjIndex; // object index for created srvmsg objects + RFs iFs; + + + /** + * Monitor on when there is observers. + * Call HandleL for observers for every new file. + */ + RPointerArray< MXIMPTestFileObserver > iObservers; + + // timer + CPeriodic* iTimer; + }; + +#endif // CPRFWTESTFILETOOL_H diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/tsrcutils/testcaseutils/prfwtestlistener.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/tsrcutils/testcaseutils/prfwtestlistener.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,280 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework CXIMPTestListener +* +*/ + +#include "prfwtestlistener.h" +#include "prfwtestcaseutilspanics.h" +#include "prfwgeneralwaiter.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include "ximpapiobjbase.h" +#include "ximpapieventbase.h" + + +using namespace NXIMPTestCaseUtilsPanic; + +const TInt KWaitAfterEvents = 2; + +// ============================ MEMBER FUNCTIONS =============================== +EXPORT_C CXIMPTestListener* CXIMPTestListener::NewL( + MXIMPContext* aEventSource ) + { + CXIMPTestListener* self = new (ELeave) CXIMPTestListener( aEventSource ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + + +CXIMPTestListener::~CXIMPTestListener() + { + if( iEventSource ) + { + iEventSource->UnregisterObserver( *this ); + } + + iDescription.Close(); + + if ( iWait.IsStarted() ) + { + iWait.AsyncStop(); + } + } + + +CXIMPTestListener::CXIMPTestListener( MXIMPContext* aEventSource ) : + iEventSource( aEventSource ) + { + } + + +void CXIMPTestListener::ConstructL() + { + if( iEventSource ) + { + iEventSource->RegisterObserverL( *this, NULL ); + } + + iDescription.CreateL( 512 ); + } + + +// =========================================================================== +// PUBLIC FUNCTIONS +// =========================================================================== +// +EXPORT_C void CXIMPTestListener::SetEventSourceL( + MXIMPContext* aEventSource ) + { + if( iEventSource ) + { + iEventSource->UnregisterObserver( *this ); + } + + if( aEventSource ) + { + aEventSource->RegisterObserverL( *this, NULL ); + } + + iEventSource = aEventSource; + } + +// clear the stack +EXPORT_C void CXIMPTestListener::Reset() + { + iEventStack.ResetAndDestroy(); + } + +// expect the given event +EXPORT_C void CXIMPTestListener::ExpectL( CXIMPApiObjBase* aEvent ) + { + iEventStack.AppendL( aEvent ); + + iDescription.Zero(); + iDescription.AppendFormat( _L8("Eventstack has [%d] items."), iEventStack.Count() ); + EUNIT_PRINT( iDescription ); + } + +// wait for req complete and events (must come in the given order!) +EXPORT_C TInt CXIMPTestListener::WaitAndAssertL() + { + __ASSERT_ALWAYS( !iWait.IsStarted(), + Panic( EStatusEventListenerAlreadyWaiting ) ); + + iCoolDownActive = EFalse; + iError = KErrNone; + iReceivedEventCount = 0; + iWait.Start(); + + // start a timer to catch excess events, 2 seconds should + // be enough. such events are caught by DoHandleEventL and printed. + // if any events arrived, iError will be set. + + iCoolDownActive = ETrue; + CXIMPTestGeneralWaiter* waiter = CXIMPTestGeneralWaiter::NewL( this ); + CleanupStack::PushL( waiter ); + waiter->WaitForL( KWaitAfterEvents ); + iWait.Start(); + + // waiter callback will have ended the wait + CleanupStack::PopAndDestroy( waiter ); + + return iError; + } + +// the event observer where to pass the events +EXPORT_C void CXIMPTestListener::SetEventObserver( MXIMPContextObserver* aObserver ) + { + iObserver = aObserver; + } + +// =========================================================================== +// FROM MPRFWPRESENCECONTEXTOBSERVER +// =========================================================================== +// +void CXIMPTestListener::DoHandlePresenceContextEventL( + const MXIMPContext& aContext, + const MXIMPBase& aEvent ) + { + const TInt32 eventType = aEvent.GetInterfaceId(); + + __ASSERT_ALWAYS( iEventSource == &aContext, + Panic( EReceivingEventFromWrongContext ) ); + + if( iObserver ) + { + // give the event to the observer, if any, at the earliest possible + // phase + iObserver->HandlePresenceContextEvent( aContext, aEvent ); + + // XXX should this be done when cool-down is active? + } + + if ( iCoolDownActive ) + { + iDescription.Zero(); + iDescription.AppendFormat( _L8("Excess event with interface id [%d]"), aEvent.GetInterfaceId() ); + EUNIT_PRINT( iDescription ); + + iError = KErrGeneral; + + // just ignore it + return; + } + + iDescription.Zero(); + iDescription.AppendFormat( _L8("Expecting event to stack pos [%d]"), iReceivedEventCount ); + EUNIT_PRINT( iDescription ); + + // try to find the received event from the stack - the given stack must + // be in order + TBool found = EFalse; + TInt stackId = iEventStack[ 0 ]->Base().GetInterfaceId(); + found = stackId == aEvent.GetInterfaceId(); + + if ( ! found ) + { + // unexpected event + iDescription.Zero(); + iDescription.AppendFormat( _L8("Expected interface id [%d], got [%d]"), stackId, aEvent.GetInterfaceId() ); + EUNIT_PRINT( iDescription ); + + iDescription.Zero(); + iDescription.AppendFormat( _L8("Received unexpected event at pos [%d]"), iReceivedEventCount ); + EUNIT_PRINT( iDescription ); + + // get out + User::Leave( KErrGeneral ); + } + + // found the received event from the stack of expected events. + // remove the event from the stack of expected events, then handle it. + CXIMPApiEventBase* expected = ( CXIMPApiEventBase* ) iEventStack[ 0 ]; + CleanupStack::PushL( expected ); + iEventStack.Remove( 0 ); + + CXIMPApiEventBase* received = ( CXIMPApiEventBase* ) ( aEvent.GetInterface( XIMPIMP_CLSID_CXIMPAPIEVENTBASE, MXIMPBase::EPanicIfUnknown ) ); + + if ( ! expected->EqualsContent( *received ) ) + { + // expected event mismatches with the received event + iDescription.Zero(); + iDescription.AppendFormat( _L8("Received event with mismatching content at pos [%d]"), iReceivedEventCount ); + EUNIT_PRINT( iDescription ); + + // get out + User::Leave( KErrGeneral ); + } + + CleanupStack::PopAndDestroy( expected ); + + iDescription.Zero(); + iDescription.AppendFormat( _L8("Got correct event to stack pos [%d]"), iReceivedEventCount ); + EUNIT_PRINT( iDescription ); + + // we've processed a received event successfully + iReceivedEventCount++; + + if ( iEventStack.Count() <= 0 ) + { + // no more events to expect + if( iWait.IsStarted() ) + { + iWait.AsyncStop(); + } + } + } + + +void CXIMPTestListener::HandlePresenceContextEvent( + const MXIMPContext& aContext, + const MXIMPBase& aEvent ) + { + TRAPD( err, DoHandlePresenceContextEventL( aContext, aEvent ) ); + + if ( err != KErrNone ) + { + // something evil happened, stop async wait + + iError = err; + + if( iWait.IsStarted() ) + { + iWait.AsyncStop(); + } + } + } + +void CXIMPTestListener::WaitCompleted( TInt aRetVal ) + { + if( iWait.IsStarted() ) + { + iWait.AsyncStop(); + } + } + +// end of file + diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/tsrcutils/testcaseutils/prfwtestlistener.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/tsrcutils/testcaseutils/prfwtestlistener.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,152 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework CXIMPTestListener +* +*/ + + +#ifndef CPRFWTESTLISTENER_H__ +#define CPRFWTESTLISTENER_H__ + + +#include +#include +#include + +#include "prfwwaitobserver.h" + +// CLASS DESCRIPTION +class CXIMPApiObjBase; + +/** + * Presence test listener to record events + * and to wait request completion. + */ +class CXIMPTestListener : public CBase, + public MXIMPContextObserver, + public T_MWaitObserver + { + public: + + /** + * Instantiates new listener object. + * + * If valid event source is given, reqisters this object as + * event observer to it. + */ + IMPORT_C static CXIMPTestListener* CXIMPTestListener::NewL( + MXIMPContext* aEventSource ); + + ~CXIMPTestListener(); + + private: + + CXIMPTestListener( MXIMPContext* aEventSource ); + + void ConstructL(); + + public: + + /** + * Sets new event source from where to listen events. + * Unregisters from previous one. + * Can be NULL, in which case just performs the + * unregistration. + */ + IMPORT_C void SetEventSourceL( MXIMPContext* aEventSource ); + + /** + * Clears the event trait template. After this call, + * you must call ExpectL to tell listener what events to expect. + */ + IMPORT_C void Reset(); + + /** + * Add the given event to the list of expected events. + * The order of ExpectL calls is significant. + * Ownership of given event is transferred to this class. + * @param aEvent The event to expect + */ + IMPORT_C void ExpectL( CXIMPApiObjBase* aEvent ); + + /** + * Method to wait with CActiveSchedulerWait + * a request complete, then any events which are expected. + * When all events are received, the method returns. If not all events + * come, the test case will timeout. If a wrong event or event with wrong + * data is received, the method will barf in EUNIT_ASSERT. + * + * @return Error code, if any + */ + IMPORT_C TInt WaitAndAssertL(); + + /** + * Forward the received events to the given event observer, if set. + * Set to NULL to disable forwarding. + * @param aObserver The observer + */ + IMPORT_C void SetEventObserver( MXIMPContextObserver* aObserver ); + + public: // from T_MWaitObserver + + void WaitCompleted( TInt aRetVal ); + + private: //From MXIMPContextObserver + + void HandlePresenceContextEvent( + const MXIMPContext& aContext, + const MXIMPBase& aEvent ); + + void DoHandlePresenceContextEventL( + const MXIMPContext& aContext, + const MXIMPBase& aEvent ); + + + private: //Helpers + + private: //Data + + //OWN: Active scheduler wait for waiting the completion + CActiveSchedulerWait iWait; + + //REF: Context from where receiving events + MXIMPContext* iEventSource; + + //OWN: Description buffer to hold the failure description + mutable RBuf8 iDescription; + + // To handle event by observer. + MXIMPContextObserver* iObserver; + + // OWN: the event stack (and the objects) + RXIMPObjOwningPtrArray< CXIMPApiObjBase > iEventStack; + + // current error state. WaitAndAssertL + // always clears the error + TInt iError; + + // number of received events + TInt iReceivedEventCount; + + // ETrue if we're doing a "cool-down" period, that is, + // we are waiting for any events which might come after + // we've successfully exhausted our stack of expected events. + // This is so that we can spot any excess events + // during testing. + TBool iCoolDownActive; + }; + +#endif //CPRFWTESTLISTENER_H__ + + diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/tsrcutils/testcaseutils/prfwtestmessaging.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/tsrcutils/testcaseutils/prfwtestmessaging.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,163 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework Test Code prfwtestmessaging.h +* +*/ + + +#ifndef T_PRFWTESTMESSAGING_H_ +#define T_PRFWTESTMESSAGING_H_ + +#include +#include + +// FIXME change this? +// base UID for pubsub keys +const TUid KXIMPTestPropertyCatBase = { 0x10012345 }; + +enum TXIMPTestPropertyValues + { + // values for EXIMPPlgTestDeath + EXIMPPrtValPluginDeathEmpty = 0, + EXIMPPrtValPluginDeathDied = 1, + + // values for EXIMPTestPlgSessionLostStrategy + EXIMPPrtValSessionLostEmpty = 0, + EXIMPPrtValSessionLostReconnect, + EXIMPPrtValSessionLostTeardown, + EXIMPPrtValSessionLostReconnectExhaustAttempts, + + // values for EXIMPTestPlgBehaveGeneric + EXIMPPrtValBehaveNothing = 0, // do nothing + }; + +// pubsub keys +enum TXIMPTestPropertyKeys + { + // meta things (message queue internal) + EXIMPTestMetaPubSubDefined, // pubsub stuff has been defined (1) + EXIMPTestMetaPluginIndex, // protocol plugin reads its index from this (-1=undefined) + + // p = plugin, h = host, t = test code. + // direction also encoded into the property name + + // Instructions for plugin behaviour (t->p). + // next call to plugin API method will cause the requested behavior (e.g. leave) + EXIMPTestPlgBehaveLeave, // leave with given code + EXIMPTestPlgBehaveError, // cause error with given code + + // boolean valued + EXIMPTestPlgBehaveCloseHandle, // abrupt close handle (1) + EXIMPTestPlgBehaveInvalidReqId, // complete next call with invalid req. id (1) + + // API method called -messages (p->t) + // value is boolean (set or unset, 1 or 0) + EXIMPPlgTestOpenSessionCalled, // OpenSessionL + EXIMPPlgTestShareSessionCalled, // ShareSessionL + EXIMPPlgTestUnshareSessionCalled, // ShareSessionL + EXIMPPlgTestCloseSessionCalled, // CloseSessionL + EXIMPPlgTestPublishPresenceCalled, // PublishPresenceL + EXIMPPlgTestUpdateInterestCalled, // UpdatePresenceInterestL + EXIMPPlgTestSubscribeOwnPresenceCalled, // DoSubscribeOwnPresenceL + EXIMPPlgTestUnsubscribeOwnPresenceCalled, // DoUnsubscribeOwnPresenceL + EXIMPPlgTestUpdateOwnSubscriptionCalled, // DoUpdateOwnPresenceSubscriptionL + EXIMPPlgTestSubscribeGroupListCalled, // DoSubscribePresentityGroupListL + EXIMPPlgTestUnsubscribeGroupListCalled, // DoUnsubscribePresentityGroupListL + EXIMPPlgTestCreatePresentityGroupCalled, // DoCreatePresentityGroupL + EXIMPPlgTestDeletePresentityGroupCalled, // DoDeletePresentityGroupL + EXIMPPlgTestUpdatePresentityGroupDisplayNameCalled, // DoUpdatePresentityGroupDisplayNameL + EXIMPPlgTestSubscribePresentityPresesenceCalled, // DoSubscribePresentityPresenceL + EXIMPPlgTestUpdatePresentityPresesenceCalled, // DoUpdatePresentityPresenceSubscriptionL + EXIMPPlgTestUnsubscribePresentityPresesenceCalled, // DoUnsubscribePresentityPresenceL + EXIMPPlgTestSubscribePresentityGroupMembersPresesenceCalled, // DoSubscribePresentityGroupMembersPresenceL + EXIMPPlgTestUpdatePresentityGroupMembersPresesenceCalled, // DoUpdatePresentityGroupMembersPresenceSubscriptionL + EXIMPPlgTestUnsubscribePresentityGroupMembersPresesenceCalled, // DoUnsubscribePresentityGroupMembersPresenceL + + EXIMPPlgTestSubscribePresentityGroupContentCalled, // DoSubscribePresentityGroupContentL + EXIMPPlgTestUnsubscribePresentityGroupContentCalled, // DoUnsubscribePresentityGroupContentL + EXIMPPlgTestAddPresentityGroupMemberCalled, // DoAddPresentityGroupMemberL + EXIMPPlgTestRemovePresentityGroupMemberCalled, // DoRemovePresentityGroupMemberL + EXIMPPlgTestUpdatePresentityGroupMemberDisplayNameCalled, // DoUpdatePresentityGroupMemberDisplayNameL + EXIMPPlgTestSubscribePresenceWatcherListCalled, // DoSubscribePresenceWatcherListL + EXIMPPlgTestUnsubscribePresenceWatcherListCalled, // DoUnsubscribePresenceWatcherListL + + EXIMPPlgTestSubscribePresenceGrantRequestListCalled, // DoSubscribePresenceGrantRequestListL + EXIMPPlgTestUnsubscribePresenceGrantRequestListCalled, // DoUnsubscribePresenceGrantRequestListL + + EXIMPPlgTestGrantPresenceForPresentityCalled, // EXIMPPlgTestGrantPresenceForPresentityCalled + EXIMPPlgTestGrantPresenceForPresentityGroupMembersCalled, // EXIMPPlgTestGrantPresenceForPresentityGroupMembersCalled + EXIMPPlgTestGrantPresenceForEveryoneCalled, // EXIMPPlgTestGrantPresenceForEveryoneCalled + EXIMPPlgTestUpdateGrantPresenceForPresentityCalled, // EXIMPPlgTestUpdateGrantPresenceForPresentityCalled + EXIMPPlgTestUpdateGrantPresenceForEveryoneCalled, // EXIMPPlgTestUpdateGrantPresenceForEveryoneCalled + EXIMPPlgTestUpdateGrantPresenceForPresentityGroupMembersCalled, // EXIMPPlgTestUpdateGrantPresenceForPresentityGroupMembersCalled + EXIMPPlgTestWithdrawPresenceFromPresentityCalled, // EXIMPPlgTestWithdrawPresenceFromPresentityCalled + EXIMPPlgTestWithdrawPresenceFromPresentityGroupMembersCalled, // EXIMPPlgTestWithdrawPresenceFromPresentityGroupMembersCalled + EXIMPPlgTestWithdrawPresenceFromEveryoneCalled, // EXIMPPlgTestWithdrawPresenceFromEveryoneCalled + EXIMPPlgTestSubscribePresenceBlockListCalled, // EXIMPPlgTestSubscribePresenceBlockListCalled + EXIMPPlgTestUnsubscribePresenceBlockListCalled, // EXIMPPlgTestUnubscribePresenceBlockListCalled + EXIMPPlgTestBlockPresenceForPresentityCalled, // EXIMPPlgTestBlockPresenceForPresentityCalled + EXIMPPlgTestCancelPresenceBlockFromPresentityCalled, // EXIMPPlgTestCancelPresenceBlockFromPresentityCalled + + EXIMPPlgTestSubscribePresentityGroupListCalled, // DoSubscribePresentityGroupListL + EXIMPPlgTestUnsubscribePresentityGroupListCalled, // DoUnsubscribePresentityGroupListL + EXIMPPlgTestHandlePresentityGroupListCalled, //EXIMPPlgTestHandlePresentityGroupListCalled + EXIMPPlgTestHandlePresentityPresenceCalled, + + + + // For signaling some situations checked by adaptation + EXIMPPlgTestExistsGroupContentInCache, // Check if group content exists in cache. + + // signal Plg destruction (p->t) + EXIMPPlgTestDeath, + + // simulate session lost with given strategy (t->p) + EXIMPTestPlgSessionLostStrategy, + }; + +// T-class for internal use +class TXIMPTestMsg + { +public: + TXIMPTestPropertyKeys iKey; // pubsub key + TInt iVal; // pubsub value + }; + + /** + * @param aIndex The index for the testing context + * @param aDescription Description for failed test. + * @param aModifier If EFalse, negate the test, thus checking for + * publish presence NOT being called. + * @param aDescription2 Description for negate failed test. + */ +#define COMMONASSERT( aMsg, aKey, aDescription, aModifier, aDescription2 ) \ + { \ + TBool value = aMsg->GetBoolean( aKey ); \ + if( aModifier ) \ + { \ + EUNIT_ASSERT_DESC( value, aDescription ); \ + } \ + else if( !aDescription2 ) \ + { \ + EUNIT_ASSERT_DESC( value, "Description 2 not set." ); \ + } \ + else \ + { \ + EUNIT_ASSERT_DESC( !value, aDescription2 ); \ + } \ + } + +#endif // T_PRFWTESTMESSAGING_H_ + + diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/tsrcutils/testcaseutils/prfwtestmessenger.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/tsrcutils/testcaseutils/prfwtestmessenger.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,584 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework Test Code prfwtestmessenger.cpp +* +*/ + + +#include "eunittools.h" +#include +#include +#include + +#include "prfwtestmessaging.h" +#include "prfwtestmessenger.h" + +// ============================ MEMBER FUNCTIONS =============================== + +// CONSTRUCTION +EXPORT_C CXIMPTestMessenger* CXIMPTestMessenger::NewForClientSideL( TInt aId ) + { + CXIMPTestMessenger* self = new (ELeave) CXIMPTestMessenger( aId ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); + self->DeletePubSubKeys(); + self->ResetPubSub(); + return self; + } + + +EXPORT_C CXIMPTestMessenger* CXIMPTestMessenger::NewForAdaptationSideL( TInt aId ) + { + CXIMPTestMessenger* self = new (ELeave) CXIMPTestMessenger( aId ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); + return self; + } + + + +void CXIMPTestMessenger::ConstructL() + { + iDescription.CreateL( 512 ); + } + +// reset the given pubsub keys +// and any helper variables + +_LIT_SECURITY_POLICY_PASS( KAllowReadToAll ); +_LIT_SECURITY_POLICY_PASS( KAllowWriteToAll ); + +EXPORT_C void CXIMPTestMessenger::ResetPubSub() + { + // check if we've already defined the keys. if we redefine and set + // defaults, the test logic breaks. + TInt pubSubDefined = GetValueFor( EXIMPTestMetaPubSubDefined ); + if ( pubSubDefined ) + { + // all done + return; + } + + TInt r = 0; + + // special behavioral keys + r = RProperty::Define( iMyUid, EXIMPTestMetaPubSubDefined, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll ); + + r = RProperty::Define( iMyUid, EXIMPPlgTestDeath, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll ); + r = RProperty::Define( iMyUid, EXIMPTestPlgSessionLostStrategy, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll ); + + // behavioral keys + r = RProperty::Define( iMyUid, EXIMPTestPlgBehaveLeave, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll ); + r = RProperty::Define( iMyUid, EXIMPTestPlgBehaveError, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll ); + r = RProperty::Define( iMyUid, EXIMPTestPlgBehaveCloseHandle, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll ); + r = RProperty::Define( iMyUid, EXIMPTestPlgBehaveInvalidReqId, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll ); + // TODO add more here + + // "method called" keys + r = RProperty::Define( iMyUid, EXIMPPlgTestOpenSessionCalled, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll ); + r = RProperty::Define( iMyUid, EXIMPPlgTestShareSessionCalled, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll ); + r = RProperty::Define( iMyUid, EXIMPPlgTestUnshareSessionCalled, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll ); + r = RProperty::Define( iMyUid, EXIMPPlgTestCloseSessionCalled, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll ); + r = RProperty::Define( iMyUid, EXIMPPlgTestPublishPresenceCalled, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll ); + r = RProperty::Define( iMyUid, EXIMPPlgTestUpdateInterestCalled, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll ); + r = RProperty::Define( iMyUid, EXIMPPlgTestSubscribeOwnPresenceCalled, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll ); + r = RProperty::Define( iMyUid, EXIMPPlgTestUnsubscribeOwnPresenceCalled, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll ); + r = RProperty::Define( iMyUid, EXIMPPlgTestUpdateOwnSubscriptionCalled, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll ); + r = RProperty::Define( iMyUid, EXIMPPlgTestSubscribeGroupListCalled, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll ); + r = RProperty::Define( iMyUid, EXIMPPlgTestUnsubscribeGroupListCalled, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll ); + r = RProperty::Define( iMyUid, EXIMPPlgTestCreatePresentityGroupCalled, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll ); + r = RProperty::Define( iMyUid, EXIMPPlgTestDeletePresentityGroupCalled, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll ); + r = RProperty::Define( iMyUid, EXIMPPlgTestUpdatePresentityGroupDisplayNameCalled, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll ); + r = RProperty::Define( iMyUid, EXIMPPlgTestSubscribePresentityPresesenceCalled, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll ); + r = RProperty::Define( iMyUid, EXIMPPlgTestUnsubscribePresentityPresesenceCalled, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll ); + r = RProperty::Define( iMyUid, EXIMPPlgTestUpdatePresentityPresesenceCalled, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll ); + r = RProperty::Define( iMyUid, EXIMPPlgTestSubscribePresentityGroupContentCalled, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll ); + r = RProperty::Define( iMyUid, EXIMPPlgTestUnsubscribePresentityGroupContentCalled, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll ); + r = RProperty::Define( iMyUid, EXIMPPlgTestAddPresentityGroupMemberCalled, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll ); + r = RProperty::Define( iMyUid, EXIMPPlgTestRemovePresentityGroupMemberCalled, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll ); + r = RProperty::Define( iMyUid, EXIMPPlgTestUpdatePresentityGroupMemberDisplayNameCalled, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll ); + r = RProperty::Define( iMyUid, EXIMPPlgTestSubscribePresenceWatcherListCalled, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll ); + r = RProperty::Define( iMyUid, EXIMPPlgTestUnsubscribePresenceWatcherListCalled, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll ); + r = RProperty::Define( iMyUid, EXIMPPlgTestSubscribePresentityGroupMembersPresesenceCalled, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll ); + r = RProperty::Define( iMyUid, EXIMPPlgTestUnsubscribePresentityGroupMembersPresesenceCalled, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll ); + r = RProperty::Define( iMyUid, EXIMPPlgTestUpdatePresentityGroupMembersPresesenceCalled, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll ); + r = RProperty::Define( iMyUid, EXIMPPlgTestSubscribePresenceGrantRequestListCalled, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll ); + r = RProperty::Define( iMyUid, EXIMPPlgTestUnsubscribePresenceGrantRequestListCalled, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll ); + + r = RProperty::Define( iMyUid, EXIMPPlgTestGrantPresenceForPresentityCalled, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll ); + r = RProperty::Define( iMyUid, EXIMPPlgTestGrantPresenceForPresentityGroupMembersCalled, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll ); + r = RProperty::Define( iMyUid, EXIMPPlgTestGrantPresenceForEveryoneCalled, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll ); + r = RProperty::Define( iMyUid, EXIMPPlgTestUpdateGrantPresenceForPresentityCalled, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll ); + r = RProperty::Define( iMyUid, EXIMPPlgTestUpdateGrantPresenceForPresentityGroupMembersCalled, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll ); + r = RProperty::Define( iMyUid, EXIMPPlgTestUpdateGrantPresenceForEveryoneCalled, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll ); + r = RProperty::Define( iMyUid, EXIMPPlgTestWithdrawPresenceFromPresentityCalled, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll ); + r = RProperty::Define( iMyUid, EXIMPPlgTestWithdrawPresenceFromPresentityGroupMembersCalled, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll ); + r = RProperty::Define( iMyUid, EXIMPPlgTestWithdrawPresenceFromEveryoneCalled, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll ); + + r = RProperty::Define( iMyUid, EXIMPPlgTestSubscribePresenceBlockListCalled, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll ); + r = RProperty::Define( iMyUid, EXIMPPlgTestUnsubscribePresenceBlockListCalled, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll ); + r = RProperty::Define( iMyUid, EXIMPPlgTestBlockPresenceForPresentityCalled, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll ); + r = RProperty::Define( iMyUid, EXIMPPlgTestCancelPresenceBlockFromPresentityCalled, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll ); + +//Pia + r = RProperty::Define( iMyUid, EXIMPPlgTestSubscribePresentityGroupListCalled, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll ); + r = RProperty::Define( iMyUid, EXIMPPlgTestUnsubscribePresentityGroupListCalled, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll ); + r = RProperty::Define( iMyUid, EXIMPPlgTestHandlePresentityGroupListCalled, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll ); + r = RProperty::Define( iMyUid, EXIMPPlgTestHandlePresentityPresenceCalled, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll ); + + r = RProperty::Define( iMyUid, EXIMPPlgTestExistsGroupContentInCache, RProperty::EInt, KAllowReadToAll, KAllowWriteToAll ); + + // TODO add more here + + // reset keys which have special meaning to defaults which will cause + // no actions - a happy path scenario + SetValueFor( EXIMPPlgTestDeath, EXIMPPrtValPluginDeathEmpty ); + SetValueFor( EXIMPTestPlgSessionLostStrategy, EXIMPPrtValSessionLostEmpty ); + + // set other behavioral things to "happy path" by default + SetValueFor( EXIMPTestPlgBehaveLeave, KErrNone ); + SetValueFor( EXIMPTestPlgBehaveError, KErrNone ); + SetValueFor( EXIMPTestPlgBehaveCloseHandle, 0 ); + SetValueFor( EXIMPTestPlgBehaveInvalidReqId, 0 ); + + // reset method called messages + SetValueFor( EXIMPPlgTestOpenSessionCalled, 0 ); + SetValueFor( EXIMPPlgTestShareSessionCalled, 0 ); + SetValueFor( EXIMPPlgTestUnshareSessionCalled, 0 ); + SetValueFor( EXIMPPlgTestCloseSessionCalled, 0 ); + SetValueFor( EXIMPPlgTestPublishPresenceCalled, 0 ); + SetValueFor( EXIMPPlgTestUpdateInterestCalled, 0 ); + SetValueFor( EXIMPPlgTestSubscribeOwnPresenceCalled, 0 ); + SetValueFor( EXIMPPlgTestUnsubscribeOwnPresenceCalled, 0 ); + SetValueFor( EXIMPPlgTestUpdateOwnSubscriptionCalled, 0 ); + SetValueFor( EXIMPPlgTestSubscribeGroupListCalled, 0 ); + SetValueFor( EXIMPPlgTestUnsubscribeGroupListCalled, 0 ); + SetValueFor( EXIMPPlgTestCreatePresentityGroupCalled, 0 ); + SetValueFor( EXIMPPlgTestDeletePresentityGroupCalled, 0 ); + SetValueFor( EXIMPPlgTestUpdatePresentityGroupDisplayNameCalled, 0 ); + SetValueFor( EXIMPPlgTestSubscribePresentityPresesenceCalled, 0 ); + SetValueFor( EXIMPPlgTestUnsubscribePresentityPresesenceCalled, 0 ); + SetValueFor( EXIMPPlgTestUpdatePresentityPresesenceCalled, 0 ); + SetValueFor( EXIMPPlgTestSubscribePresentityGroupContentCalled, 0 ); + SetValueFor( EXIMPPlgTestUnsubscribePresentityGroupContentCalled, 0 ); + SetValueFor( EXIMPPlgTestAddPresentityGroupMemberCalled, 0 ); + SetValueFor( EXIMPPlgTestRemovePresentityGroupMemberCalled, 0 ); + SetValueFor( EXIMPPlgTestUpdatePresentityGroupMemberDisplayNameCalled, 0 ); + SetValueFor( EXIMPPlgTestSubscribePresenceWatcherListCalled, 0 ); + SetValueFor( EXIMPPlgTestUnsubscribePresenceWatcherListCalled, 0 ); + SetValueFor( EXIMPPlgTestSubscribePresentityGroupMembersPresesenceCalled, 0 ); + SetValueFor( EXIMPPlgTestUnsubscribePresentityGroupMembersPresesenceCalled, 0 ); + SetValueFor( EXIMPPlgTestUpdatePresentityGroupMembersPresesenceCalled, 0 ); + SetValueFor( EXIMPPlgTestSubscribePresenceGrantRequestListCalled, 0 ); + SetValueFor( EXIMPPlgTestUnsubscribePresenceGrantRequestListCalled, 0 ); + + SetValueFor( EXIMPPlgTestGrantPresenceForPresentityCalled, 0 ); + SetValueFor( EXIMPPlgTestGrantPresenceForPresentityGroupMembersCalled, 0 ); + SetValueFor( EXIMPPlgTestGrantPresenceForEveryoneCalled, 0 ); + SetValueFor( EXIMPPlgTestUpdateGrantPresenceForPresentityCalled, 0 ); + SetValueFor( EXIMPPlgTestUpdateGrantPresenceForPresentityGroupMembersCalled, 0 ); + SetValueFor( EXIMPPlgTestUpdateGrantPresenceForEveryoneCalled, 0 ); + SetValueFor( EXIMPPlgTestWithdrawPresenceFromPresentityCalled, 0 ); + SetValueFor( EXIMPPlgTestWithdrawPresenceFromPresentityGroupMembersCalled, 0 ); + SetValueFor( EXIMPPlgTestWithdrawPresenceFromEveryoneCalled, 0 ); + + SetValueFor( EXIMPPlgTestSubscribePresenceBlockListCalled, 0 ); + SetValueFor( EXIMPPlgTestUnsubscribePresenceBlockListCalled, 0 ); + SetValueFor( EXIMPPlgTestBlockPresenceForPresentityCalled, 0 ); + SetValueFor( EXIMPPlgTestCancelPresenceBlockFromPresentityCalled, 0 ); + //Pia + SetValueFor( EXIMPPlgTestSubscribePresentityGroupListCalled, 0 ); // DoSubscribePresentityGroupListL + SetValueFor( EXIMPPlgTestUnsubscribePresentityGroupListCalled, 0 ); // DoUnsubscribePresentityGroupListL + SetValueFor( EXIMPPlgTestHandlePresentityGroupListCalled, 0 ); //EXIMPPlgTestHandlePresentityGroupListCalled + SetValueFor( EXIMPPlgTestHandlePresentityPresenceCalled, 0 ); + + SetValueFor( EXIMPPlgTestExistsGroupContentInCache, 0 ); + + // TODO add any new keys also to DeletePubSubKeys!!! + + + // TODO add more here + + // TODO make the integer-valued keys and values into an array with + // default values, then loop over the array + + // pubsub things have been defined. keep this as last line! + SetValueFor( EXIMPTestMetaPubSubDefined, 1 ); + } + + +EXPORT_C void CXIMPTestMessenger::SetPluginIndex( TInt aIndex /* = KErrNotFound */ ) + { + // NOTE! Plugin index is ALWAYS set to base UID! + TInt val = 0; + TInt r = RProperty::Get( KXIMPTestPropertyCatBase,EXIMPTestMetaPluginIndex, val ); + if ( r == KErrNotFound ) + { + // value was not defined + TInt r = RProperty::Define( KXIMPTestPropertyCatBase, EXIMPTestMetaPluginIndex, RProperty::EInt ); + } + + r = RProperty::Set( KXIMPTestPropertyCatBase, EXIMPTestMetaPluginIndex, aIndex ); + + iMyUid = TUid::Uid( KXIMPTestPropertyCatBase.iUid + aIndex ); + } + + +EXPORT_C TInt CXIMPTestMessenger::GetPluginIndex() + { + TInt val = 0; + TInt r = RProperty::Get( KXIMPTestPropertyCatBase,EXIMPTestMetaPluginIndex, val ); + if ( r == KErrNotFound ) + { + val = KErrNotFound; + } + + return val; + } + + +CXIMPTestMessenger::~CXIMPTestMessenger() + { + DeletePubSubKeys(); + iDescription.Close(); + delete iReqCompleteParams; + } + + +CXIMPTestMessenger::CXIMPTestMessenger( TInt aId ) + { + iId = aId; + iMyUid = TUid::Uid( KXIMPTestPropertyCatBase.iUid + iId ); + } + + +// =========================================================================== +// PUBLIC FUNCTIONS +// =========================================================================== +// + +// +// Setters and getters for error code +// +EXPORT_C void CXIMPTestMessenger::SetNoError() + { + SetValueFor( EXIMPTestPlgBehaveError, KErrNone ); + } + +EXPORT_C void CXIMPTestMessenger::SetError( TInt aErrorCode ) + { + SetValueFor( EXIMPTestPlgBehaveError, aErrorCode ); + } + +EXPORT_C TInt CXIMPTestMessenger::GetError() + { + return GetValueFor( EXIMPTestPlgBehaveError ); + } + +// +// Setters and getters for boolean flags +// +EXPORT_C void CXIMPTestMessenger::SetBoolean( TXIMPTestPropertyKeys aKey ) + { + // aKey takes boolean value, e.g. "*BehaveInvalidReqId" + SetValueFor( aKey, 1 ); + } + +EXPORT_C TBool CXIMPTestMessenger::GetBoolean( TXIMPTestPropertyKeys aKey ) const + { + // aKey takes boolean value, e.g. "*BehaveInvalidReqId" + return GetValueFor( aKey ) == 1; + } + +// +// Setters, getters and utility methods for leave codes +// +EXPORT_C void CXIMPTestMessenger::SetLeave( TInt aLeaveCode ) + { + SetValueFor( EXIMPTestPlgBehaveLeave, aLeaveCode ); + } + +EXPORT_C TInt CXIMPTestMessenger::GetLeave() + { + return GetValueFor( EXIMPTestPlgBehaveLeave ); + } + +// call this method to automatically handle leaves +EXPORT_C void CXIMPTestMessenger::HandleLeaveL() + { + User::LeaveIfError( GetLeave() ); + } + + +// +// +// General messaging support for direct access, +// also used internally as setters and getters. +// +EXPORT_C void CXIMPTestMessenger::SetValueFor( TXIMPTestPropertyKeys aKey, TInt aValue ) + { + TXIMPTestMsg testMsg; + testMsg.iKey = aKey; + testMsg.iVal = aValue; + Send( testMsg ); + } + +EXPORT_C TInt CXIMPTestMessenger::GetValueFor( TXIMPTestPropertyKeys aKey ) const + { + TXIMPTestMsg testMsg; + testMsg.iKey = aKey; + Receive( testMsg ); + return testMsg.iVal; + } + +// +// Actual pubsub setters and getters +// +void CXIMPTestMessenger::Send( TXIMPTestMsg& aMsg ) + { + TInt r = RProperty::Set( iMyUid, aMsg.iKey, aMsg.iVal ); + // TODO handle error in r + } + +void CXIMPTestMessenger::Receive( TXIMPTestMsg& aMsg ) const + { + TInt val = 0; + TInt r = RProperty::Get( iMyUid, + aMsg.iKey, val ); + aMsg.iVal = val; + // TODO handle error in r, set val appropriately (0)? + } + +// ---------------------------------------------------------------- +// +// assert helpers +// +void CXIMPTestMessenger::CommonAssert( TXIMPTestPropertyKeys aKey, + TBool aCompareState, + const TDesC8& aTrueDesc, + const TDesC8& aFalseDesc ) const + { + iDescription.Zero(); + TBool value = GetBoolean( aKey ); + + if ( aCompareState ) + { + // the true case means success here + iDescription = aFalseDesc; + PRFW_ASSERT_DESC( value, iDescription.PtrZ() ); + } + else + { + // the false case means success here + iDescription = aTrueDesc; + PRFW_ASSERT_DESC( ! value, iDescription.PtrZ() ); + } + } + +// +// One Assert-method for each boolean-value (see prfwtestmessaging.h) +// +EXPORT_C void CXIMPTestMessenger::AssertPluginDied( TBool aState ) + { + // ETrue == Yes, plugin died. +/* CommonAssert( EXIMPPlgTestDeath, aState, + _L8( "Plugin was destroyed" ), + _L8( "Plugin was not destroyed" ) );*/ + } + +EXPORT_C void CXIMPTestMessenger::AssertOpenSessionCalled( TBool aState ) + { + CommonAssert( EXIMPPlgTestOpenSessionCalled, aState, + _L8( "OpenSession called" ), + _L8( "OpenSession not called" ) ); + } + +EXPORT_C void CXIMPTestMessenger::AssertShareSessionCalled( TBool aState ) + { + CommonAssert( EXIMPPlgTestShareSessionCalled, aState, + _L8( "ShareSession called" ), + _L8( "ShareSession not called" ) ); + } + +EXPORT_C void CXIMPTestMessenger::AssertCloseSessionCalled( TBool aState ) + { + CommonAssert( EXIMPPlgTestCloseSessionCalled, aState, + _L8( "CloseSession called" ), + _L8( "CloseSession not called" ) ); + } + +EXPORT_C void CXIMPTestMessenger::AssertUnshareSessionCalled( TBool aState ) + { + CommonAssert( EXIMPPlgTestUnshareSessionCalled, aState, + _L8( "UnshareSession called" ), + _L8( "UnshareSession not called" ) ); + } + +EXPORT_C void CXIMPTestMessenger::AssertSubscribePresentityGroupContentCalled( TBool aState ) + { + CommonAssert( EXIMPPlgTestSubscribePresentityGroupContentCalled, aState, + _L8( "DoSubscribePresentityGroupContentL called" ), + _L8( "DoSubscribePresentityGroupContentL not called" ) ); + } + +EXPORT_C void CXIMPTestMessenger::AssertSubscribePresentityGroupListCalled( TBool aState ) + { + CommonAssert( EXIMPPlgTestSubscribeGroupListCalled, aState, + _L8( "DoSubscribePresentityGroupListL called" ), + _L8( "DoSubscribePresentityGroupListL not called" ) ); + } + +EXPORT_C void CXIMPTestMessenger::AssertUnsubscribePresentityGroupContentCalled( TBool aState ) + { + CommonAssert( EXIMPPlgTestUnsubscribePresentityGroupContentCalled, aState, + _L8( "DoUnsubscribePresentityGroupContentL called" ), + _L8( "DoUnsubscribePresentityGroupContentL not called" ) ); + } + +EXPORT_C void CXIMPTestMessenger::AssertUnsubscribePresentityGroupListCalled( TBool aState ) + { + CommonAssert( EXIMPPlgTestUnsubscribeGroupListCalled, aState, + _L8( "DoUnsubscribePresentityGroupListL called" ), + _L8( "DoUnsubscribePresentityGroupListL not called" ) ); + } + +EXPORT_C void CXIMPTestMessenger::AssertAddPresentityGroupMemberCalled( TBool aState ) + { + CommonAssert( EXIMPPlgTestAddPresentityGroupMemberCalled, aState, + _L8( "DoAddPresentityGroupMemberL called" ), + _L8( "DoAddPresentityGroupMemberL not called" ) ); + } + +EXPORT_C void CXIMPTestMessenger::AssertRemovePresentityGroupMemberCalled( TBool aState ) + { + CommonAssert( EXIMPPlgTestRemovePresentityGroupMemberCalled, aState, + _L8( "DoRemovePresentityGroupMemberL called" ), + _L8( "DoRemovePresentityGroupMemberL not called" ) ); + } + +EXPORT_C void CXIMPTestMessenger::AssertUpdatePresentityGroupMemberDisplayNameCalled( TBool aState ) + { + CommonAssert( EXIMPPlgTestUpdatePresentityGroupMemberDisplayNameCalled, aState, + _L8( "DoUpdatePresentityGroupMemberDisplayNameL called" ), + _L8( "DoUpdatePresentityGroupMemberDisplayNameL not called" ) ); + } + +EXPORT_C void CXIMPTestMessenger::AssertUpdatePresentityGroupDisplayNameCalled( TBool aState ) + { + CommonAssert( EXIMPPlgTestUpdatePresentityGroupDisplayNameCalled, aState, + _L8( "DoUpdatePresentityGroupDisplayNameL called" ), + _L8( "DoUpdatePresentityGroupDisplayNameL not called" ) ); + } + +EXPORT_C void CXIMPTestMessenger::AssertCreatePresentityGroupCalled( TBool aState ) + { + CommonAssert( EXIMPPlgTestCreatePresentityGroupCalled, aState, + _L8( "DoCreatePresentityGroupL called" ), + _L8( "DoCreatePresentityGroupL not called" ) ); + } + +EXPORT_C void CXIMPTestMessenger::SetReqCompleteParams( MXIMPRestrictedObjectCollection* aParams ) + { + delete iReqCompleteParams; + iReqCompleteParams = aParams; + } +EXPORT_C MXIMPRestrictedObjectCollection* CXIMPTestMessenger::GetReqCompleteParams() + { + MXIMPRestrictedObjectCollection* retParam = iReqCompleteParams; + iReqCompleteParams = NULL; + return retParam; + } + +// TODO add more + +EXPORT_C void CXIMPTestMessenger::DeletePubSubKeys() + { + TInt r = RProperty::Delete( iMyUid, EXIMPPlgTestDeath ); + r = RProperty::Delete( iMyUid, EXIMPTestPlgSessionLostStrategy ); + + // behavioral keys + r = RProperty::Delete( iMyUid, EXIMPTestPlgBehaveLeave ); + r = RProperty::Delete( iMyUid, EXIMPTestPlgBehaveError ); + r = RProperty::Delete( iMyUid, EXIMPTestPlgBehaveCloseHandle ); + r = RProperty::Delete( iMyUid, EXIMPTestPlgBehaveInvalidReqId ); + // TODO add more here + + // "method called" keys + r = RProperty::Delete( iMyUid, EXIMPPlgTestOpenSessionCalled ); + r = RProperty::Delete( iMyUid, EXIMPPlgTestShareSessionCalled ); + r = RProperty::Delete( iMyUid, EXIMPPlgTestUnshareSessionCalled ); + r = RProperty::Delete( iMyUid, EXIMPPlgTestCloseSessionCalled ); + r = RProperty::Delete( iMyUid, EXIMPPlgTestPublishPresenceCalled ); + r = RProperty::Delete( iMyUid, EXIMPPlgTestUpdateInterestCalled ); + r = RProperty::Delete( iMyUid, EXIMPPlgTestSubscribeOwnPresenceCalled ); + r = RProperty::Delete( iMyUid, EXIMPPlgTestUnsubscribeOwnPresenceCalled ); + r = RProperty::Delete( iMyUid, EXIMPPlgTestUpdateOwnSubscriptionCalled ); + r = RProperty::Delete( iMyUid, EXIMPPlgTestSubscribeGroupListCalled ); + r = RProperty::Delete( iMyUid, EXIMPPlgTestUnsubscribeGroupListCalled ); + r = RProperty::Delete( iMyUid, EXIMPPlgTestCreatePresentityGroupCalled ); + r = RProperty::Delete( iMyUid, EXIMPPlgTestDeletePresentityGroupCalled ); + r = RProperty::Delete( iMyUid, EXIMPPlgTestUpdatePresentityGroupDisplayNameCalled ); + r = RProperty::Delete( iMyUid, EXIMPPlgTestSubscribePresentityPresesenceCalled ); + r = RProperty::Delete( iMyUid, EXIMPPlgTestUnsubscribePresentityPresesenceCalled ); + r = RProperty::Delete( iMyUid, EXIMPPlgTestUpdatePresentityPresesenceCalled ); + r = RProperty::Delete( iMyUid, EXIMPPlgTestSubscribePresentityGroupMembersPresesenceCalled ); + r = RProperty::Delete( iMyUid, EXIMPPlgTestUnsubscribePresentityGroupMembersPresesenceCalled ); + r = RProperty::Delete( iMyUid, EXIMPPlgTestUpdatePresentityGroupMembersPresesenceCalled ); + + r = RProperty::Delete( iMyUid, EXIMPPlgTestSubscribePresentityGroupContentCalled ); + r = RProperty::Delete( iMyUid, EXIMPPlgTestUnsubscribePresentityGroupContentCalled ); + r = RProperty::Delete( iMyUid, EXIMPPlgTestAddPresentityGroupMemberCalled ); + r = RProperty::Delete( iMyUid, EXIMPPlgTestRemovePresentityGroupMemberCalled ); + r = RProperty::Delete( iMyUid, EXIMPPlgTestUpdatePresentityGroupMemberDisplayNameCalled ); + + r = RProperty::Delete( iMyUid, EXIMPPlgTestSubscribePresenceWatcherListCalled ); + r = RProperty::Delete( iMyUid, EXIMPPlgTestUnsubscribePresenceWatcherListCalled ); + + r = RProperty::Delete( iMyUid, EXIMPPlgTestSubscribePresenceGrantRequestListCalled ); + r = RProperty::Delete( iMyUid, EXIMPPlgTestUnsubscribePresenceGrantRequestListCalled ); + + r = RProperty::Delete( iMyUid, EXIMPPlgTestGrantPresenceForPresentityCalled ); + r = RProperty::Delete( iMyUid, EXIMPPlgTestGrantPresenceForPresentityGroupMembersCalled ); + r = RProperty::Delete( iMyUid, EXIMPPlgTestGrantPresenceForEveryoneCalled ); + r = RProperty::Delete( iMyUid, EXIMPPlgTestUpdateGrantPresenceForPresentityCalled ); + r = RProperty::Delete( iMyUid, EXIMPPlgTestUpdateGrantPresenceForPresentityGroupMembersCalled ); + r = RProperty::Delete( iMyUid, EXIMPPlgTestUpdateGrantPresenceForEveryoneCalled ); + r = RProperty::Delete( iMyUid, EXIMPPlgTestWithdrawPresenceFromPresentityCalled ); + r = RProperty::Delete( iMyUid, EXIMPPlgTestWithdrawPresenceFromPresentityGroupMembersCalled ); + r = RProperty::Delete( iMyUid, EXIMPPlgTestWithdrawPresenceFromEveryoneCalled ); + + r = RProperty::Delete( iMyUid, EXIMPPlgTestSubscribePresenceBlockListCalled ); + r = RProperty::Delete( iMyUid, EXIMPPlgTestUnsubscribePresenceBlockListCalled ); + r = RProperty::Delete( iMyUid, EXIMPPlgTestBlockPresenceForPresentityCalled ); + r = RProperty::Delete( iMyUid, EXIMPPlgTestCancelPresenceBlockFromPresentityCalled ); + + + //Pia + r = RProperty::Delete( iMyUid, EXIMPPlgTestSubscribePresentityGroupListCalled ); // DoSubscribePresentityGroupListL + r = RProperty::Delete( iMyUid, EXIMPPlgTestUnsubscribePresentityGroupListCalled ); // DoUnsubscribePresentityGroupListL + r = RProperty::Delete( iMyUid, EXIMPPlgTestHandlePresentityGroupListCalled); //EXIMPPlgTestHandle + r = RProperty::Delete( iMyUid, EXIMPPlgTestHandlePresentityPresenceCalled); // + + + r = RProperty::Delete( iMyUid, EXIMPTestMetaPubSubDefined ); + + r = RProperty::Delete( iMyUid, EXIMPPlgTestExistsGroupContentInCache ); + } + + +// end of file + + diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/tsrcutils/testcaseutils/prfwtestmessenger.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/tsrcutils/testcaseutils/prfwtestmessenger.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,221 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framewor Test code prfwtestmessenger.h +* +*/ + + +#ifndef CPRFWTESTMESSENGER_H +#define CPRFWTESTMESSENGER_H + +// INCLUDES +#include +#include +#include +#include "prfwtestmessaging.h" + +// CLASS DESCRIPTION + +class TXIMPTestMsg; +class MXIMPRestrictedObjectCollection; + +/** + * Asynchronous protocol for PRFW testing. + * Implementation class and helper routines. + * Done using Publish and Subscribe, although it's used as a collection of + * "flags". + * + * RMsgQueue is not good, because we do not know the length of the array in + * advance: there is often 1 in the array, but there could be 2 or 3 or more. + * Each time someone writes, the array should be read. This becomes a bit + * problematic, an easier and more robust way is to use pubsub. + * + * The descriptions of API methods rely on the protocol implementation, thus + * the descriptions are meant to document what kind of effects the clients and + * users of this class expect this class to cause. + */ +class CXIMPTestMessenger : public CBase + { + public: + + /** + * @param aMsgQName The name for the queue + */ + IMPORT_C static CXIMPTestMessenger* NewForClientSideL( TInt aId ); + IMPORT_C static CXIMPTestMessenger* NewForAdaptationSideL( TInt aId ); + ~CXIMPTestMessenger(); + + private: + + CXIMPTestMessenger( TInt aId ); + + void ConstructL(); + + public: + + /** + * Define and reset pubsub keys. + */ + IMPORT_C void ResetPubSub(); + + /** + * Delete all pubsub keys. + */ + IMPORT_C void DeletePubSubKeys(); + + /** + * Set index for plugin. Call before Bind-operation. + * Default of KErrNotFound (-1) will set the key to + * unused. + */ + IMPORT_C void SetPluginIndex( TInt aIndex = KErrNotFound ); + + /** + * Get index for plugin. + * @return Plugin index, or KErrNotFound if not found. + */ + IMPORT_C static TInt GetPluginIndex(); + + /** + * Clears the error behavior. + */ + IMPORT_C void SetNoError(); + + /** + * Setup for general error. Next operation will fail with this error + * code. + * @param aErrorCode The error code e.g. KErrNotFound + */ + IMPORT_C void SetError( TInt aErrorCode ); + + /** + * @return The currently set error code. + */ + IMPORT_C TInt GetError(); + + /** + * Setup a specialized error which has a boolean value. + * Next operation will do the given specialized error, e.g. complete request + * with invalid request id (EXIMPTestPlgBehaveInvalidReqId) + * @param aKey The type defining the error, e.g. EXIMPTestPlgBehaveInvalidReqId + */ + IMPORT_C void SetBoolean( TXIMPTestPropertyKeys aKey ); + + /** + * @param aKey The type defining the error, e.g. EXIMPTestPlgBehaveInvalidReqId + * @return The value of the boolean-valued specialized error + */ + IMPORT_C TBool GetBoolean( TXIMPTestPropertyKeys aKey ) const; + + /** + * Setup for leave. Next operation will leave with given leave code. + * @param aLeaveCode Code with which to leave + */ + IMPORT_C void SetLeave( TInt aLeaveCode ); + + /** + * @return The currently set leave code + */ + IMPORT_C TInt GetLeave(); + + /** + * Leaves if leave has been requested. Uses value obtained from pubsub. + */ + IMPORT_C void HandleLeaveL(); + + /** + * General messaging support for direct access. + * @param aKey The key to set + * @param aValue The value to set to given key + */ + IMPORT_C void SetValueFor( TXIMPTestPropertyKeys aKey, TInt aValue ); + + /** + * General messaging support for direct access. + * @param aKey The key to set + * @return The value in the given key + */ + IMPORT_C TInt GetValueFor( TXIMPTestPropertyKeys aKey ) const; + + /** + * Assert-methods. + * @param aState ETrue, if successful case is expected. + * + * E.g. in the case of AssertPluginDied, + * ETrue means: + * "I expect the plugin to have died, check that it did" + * and EFalse means: + * "I expect the plugin to NOT have died, check that it didn't". + */ + IMPORT_C void AssertPluginDied( TBool aState ); + IMPORT_C void AssertOpenSessionCalled( TBool aState ); + IMPORT_C void AssertCloseSessionCalled( TBool aState ); + IMPORT_C void AssertShareSessionCalled( TBool aState ); + IMPORT_C void AssertUnshareSessionCalled( TBool aState ); + IMPORT_C void AssertSubscribePresentityGroupContentCalled( TBool aState ); + IMPORT_C void AssertSubscribePresentityGroupListCalled( TBool aState ); + IMPORT_C void AssertUnsubscribePresentityGroupContentCalled( TBool aState ); + IMPORT_C void AssertUnsubscribePresentityGroupListCalled( TBool aState ); + IMPORT_C void AssertAddPresentityGroupMemberCalled( TBool aState ); + IMPORT_C void AssertCreatePresentityGroupCalled( TBool aState ); + IMPORT_C void AssertRemovePresentityGroupMemberCalled( TBool aState ); + IMPORT_C void AssertUpdatePresentityGroupMemberDisplayNameCalled( TBool aState ); + IMPORT_C void AssertUpdatePresentityGroupDisplayNameCalled( TBool aState ); + + IMPORT_C void SetReqCompleteParams( MXIMPRestrictedObjectCollection* aParams ); + IMPORT_C MXIMPRestrictedObjectCollection* GetReqCompleteParams(); + + private: + + /** + * Send the given message. + * @param aMessage The message to send with the key and value fields set + */ + void Send( TXIMPTestMsg& aMsg ); + + /** + * Receive message. + * Returns the message with the value field set, using the same + * message parameter which was given as input. + * @param aMsg [inout] The message with the key field set + */ + void Receive( TXIMPTestMsg& aMsg ) const; + + /** + * Common internal assert method for all Assert* methods. + * @param aKey The key to assert + * @param aCompareState The expected state (ETrue for success) + * @param aTrueDesc Description for success case failing + * @param aFalseDesc Description for failure case failing + */ + IMPORT_C void CommonAssert( TXIMPTestPropertyKeys aKey, + TBool aCompareState, + const TDesC8& aTrueDesc, + const TDesC8& aFalseDesc ) const; + private: + + // id number for this message queue + TInt iId; + TUid iMyUid; + + //OWN: Description buffer to hold the failure description + mutable RBuf8 iDescription; + + // Params for next reqcomplete + MXIMPRestrictedObjectCollection* iReqCompleteParams; + }; + +#endif // CPRFWTESTMESSENGER_H + + diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/tsrcutils/testcaseutils/prfwtestpresencedatautils.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/tsrcutils/testcaseutils/prfwtestpresencedatautils.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,129 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework Test Code prfwtestpresencedatautils.cpp +* +*/ + +#include "prfwtestpresencedatautils.h" +#include "prfwtestcaseutilspanics.h" +#include + +#include "ximprbufhelpers.h" + +// ============================ MEMBER FUNCTIONS =============================== + + +// Generation +// ----------------------------------------------------------------------------- +// XIMPTestPresenceDataUtils::GenerateIdentityLC() +// ----------------------------------------------------------------------------- +// +EXPORT_C CXIMPIdentityImp* + XIMPTestPresenceDataUtils::GenerateIdentityLC( + const TDesC8* aPrefix, + TPresenceDataGroup aGroup ) + { + // According to Group: + // Generate uri + _LIT16( KUri, "http://google.com" ); + + // Generate protocolAddr + _LIT16( KProtocolAddress, "protocollll" ); + + CXIMPIdentityImp* pres = CXIMPIdentityImp::NewLC( KUri ); + return pres; + } + + + +// ----------------------------------------------------------------------------- +// XIMPTestPresenceDataUtils::GenerateInfoLC() +// ----------------------------------------------------------------------------- +// +EXPORT_C CPresenceInfoImp* + XIMPTestPresenceDataUtils::GenerateInfoLC( + const TDesC8* aPrefix, + TPresenceDataGroup aGroup ) + { + CPresenceInfoImp* doc = CPresenceInfoImp::NewLC(); + return doc; + } + +// ----------------------------------------------------------------------------- +// XIMPTestPresenceDataUtils::GenerateInfoFilterLC() +// ----------------------------------------------------------------------------- +// +EXPORT_C CPresenceInfoFilterImp* + XIMPTestPresenceDataUtils::GenerateInfoFilterLC( const TDesC8* aPrefix, + TPresenceDataGroup aGroup ) + { + CPresenceInfoFilterImp* pif = CPresenceInfoFilterImp::NewLC(); + return pif; + } + + + + +// ----------------------------------------------------------------------------- +// XIMPTestPresenceDataUtils::InsertPrefixL +// ----------------------------------------------------------------------------- +// +EXPORT_C void XIMPTestPresenceDataUtils::InsertPrefixL( const TDesC8* aPrefix, RBuf8& buf ) + { + if ( aPrefix ) + { + XIMPRBuf8Helper::GrowIfNeededL( buf, aPrefix->Length() + buf.Length() ); + buf.Insert( 0, *aPrefix ); + } + } + +// ----------------------------------------------------------------------------- +// XIMPTestPresenceDataUtils::Contains() +// ----------------------------------------------------------------------------- +// +EXPORT_C TBool XIMPTestPresenceDataUtils::Contains( MPresenceInfo& a1, + MPresenceInfo& a2 ) const + { + return ETrue; + } + + + +// ----------------------------------------------------------------------------- +// XIMPTestPresenceDataUtils::Equals() +// ----------------------------------------------------------------------------- +// +EXPORT_C TBool XIMPTestPresenceDataUtils::Equals( CPresenceInfoImp& a1, + CPresenceInfoImp& a2 ) const + { + return ETrue; + } + + + +// ----------------------------------------------------------------------------- +// XIMPTestPresenceDataUtils::AssertEquality() +// ----------------------------------------------------------------------------- +// +EXPORT_C void XIMPTestPresenceDataUtils::AssertEquality( + MPresenceInfo& a1, + MPresenceInfo& a2 ) + { + } + + + + +// end of file + diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/tsrcutils/testcaseutils/prfwtestpresencedatautils.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/tsrcutils/testcaseutils/prfwtestpresencedatautils.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,81 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework Test Code prfwtestpresencedatautils.h +* +*/ + +#ifndef PRFWTESTPRESENCEDATAUTILS_H +#define PRFWTESTPRESENCEDATAUTILS_H + + +#include +#include "presenceinfoimp.h" +#include "presenceinfofilterimp.h" +#include "ximpidentityimp.h" + + +// CLASS DESCRIPTION +/** + * Helper class presence data comparison and generation. + */ +class XIMPTestPresenceDataUtils + { + +public: +/** + * Enumeration defining the supported + * test data groups. + * A, B and C have unique values. + * The combinations are unions of those. + */ +enum TPresenceDataGroup + { + Group_None, + Group_A, + Group_B, + Group_C, + Group_AB, + Group_AC, + Group_BC, + Group_ABC, + }; + +// TODO Add the defined names here (if needed for verification). + +public: //Generator functions + IMPORT_C static CXIMPIdentityImp* GenerateIdentityLC( const TDesC8* aPrefix, TPresenceDataGroup aGroup = Group_None ); + IMPORT_C static CPresenceInfoImp* GenerateInfoLC( const TDesC8* aPrefix, TPresenceDataGroup aGroup = Group_None ); + IMPORT_C static CPresenceInfoFilterImp* GenerateInfoFilterLC( const TDesC8* aPrefix, TPresenceDataGroup aGroup = Group_None ); + +public: //Comparator functions + + // Contains. All a1 info are in a2 + IMPORT_C TBool Contains( MPresenceInfo& a1, MPresenceInfo& a2 ) const; + + + // Equality comparison + IMPORT_C TBool Equals( CPresenceInfoImp& a1, CPresenceInfoImp& a2 ) const; + + // Equality assertion + // TODO these are containment currently. Used by t_dmattrobjs. Modify... + IMPORT_C static void AssertEquality( MPresenceInfo& a1, + MPresenceInfo& a2 ); + +//private: // Helpers + IMPORT_C static void InsertPrefixL( const TDesC8* aPrefix, RBuf8& buf ); + }; + +#endif //PRFWTESTPRESENCEDATAUTILS_H + + diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/tsrcutils/testcaseutils/prfwtestrobustnesstools.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/tsrcutils/testcaseutils/prfwtestrobustnesstools.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,93 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Tools to increase Presence Engine tests robustness. + * +*/ + +#ifndef PENGTSTROBUSTNESSTOOLS_H__ +#define PENGTSTROBUSTNESSTOOLS_H__ + + +// INCLUDES +#include +#include +#include "prfwtestprocessmaster.h" +#include "userafter.h" +#include "prfwtestfiletool.h" + +//MACROS + + +// CLASS DESCRIPTION + +/** + * PE test robustness handler. + */ +class PrfwTestRobustness + { + public: //Robustness handling + static inline void DoPreCleaning(); + + private: //Helpers + static inline void HandleKill( TInt aErr, + TInt aWaitTime, + const TDesC& aDescription ); + + private: //Prohibited constructor / destructor + PrfwTestRobustness() {} + ~PrfwTestRobustness() {} + }; + + + +// ----------------------------------------------------------------------------- +// PrfwTestRobustness public functions +// ----------------------------------------------------------------------------- +// +inline void PrfwTestRobustness::DoPreCleaning() + { + TInt err = PrfwTestProcessMaster::KillPscServers(); + HandleKill( err, 0, _L("PSC srv processes - Pre") ); + + err = PrfwTestProcessMaster::KillRootServer(); + HandleKill( err, 0, _L("ROOT srv processes - pre") ); + + TRAPD( ignore, CXIMPTestFileTool::CleanAllL() ); + } + + +// ----------------------------------------------------------------------------- +// PrfwTestRobustness functions +// ----------------------------------------------------------------------------- +// +inline void PrfwTestRobustness::HandleKill( TInt aErr, + TInt aWaitTime, + const TDesC& aDescription ) + { + if( aErr > 0 ) + { + if( aWaitTime > 0 ) + { + TRAPD( ignore, CUserAfter::AfterL( aWaitTime ) ); + } + + EUNIT_PRINT( _L("ProcessKill: %S, %d instance(s)"), &aDescription, aErr ); + } + } + + +#endif // PRWFWTESTROBUSTNESSTOOLS_H__ + +// End of File + diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/tsrcutils/testcaseutils/prfwteststatuseventlistener.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/tsrcutils/testcaseutils/prfwteststatuseventlistener.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,1049 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework Test Code prfwteststatuseventlistener.cpp +* +*/ + +#include "prfwteststatuseventlistener.h" +#include "prfwtestcaseutilspanics.h" +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +using namespace NXIMPTestCaseUtilsPanic; +EUNIT_DECLARE_PRINTABLE_AS_TINT( MXIMPContextState::TState ) + + + // ============================ MEMBER FUNCTIONS =============================== +EXPORT_C TXIMPTestStatusEventSnapshot::TXIMPTestStatusEventSnapshot() + { + iEventType = TXIMPTestStatusEventSnapshot::EStateValueNotPresent; + iCtxState = (MXIMPContextState::TState) TXIMPTestStatusEventSnapshot::EStateValueNotPresent; + iReqId = TXIMPRequestId(); + iResultCode = TXIMPTestStatusEventSnapshot::EStateValueNotPresent; + } + + +EXPORT_C TXIMPTestStatusEventSnapshot::TXIMPTestStatusEventSnapshot( + TInt aEventType, + TInt aCtxState, + TInt aResultCode ) + { + iEventType = aEventType; + iCtxState = (MXIMPContextState::TState) aCtxState; + iResultCode = aResultCode; + } + +EXPORT_C TBool TXIMPTestStatusEventSnapshot::Equals( + const TXIMPTestStatusEventSnapshot& aOther ) const + { + TBool equals = ETrue; + + if( iEventType != aOther.iEventType ) + { + equals = EFalse; + } + + if( iCtxState != aOther.iCtxState ) + { + equals = EFalse; + } + + if( iResultCode != aOther.iResultCode ) + { + equals = EFalse; + } + + return equals; + } + + + + + +// ============================ MEMBER FUNCTIONS =============================== +EXPORT_C CXIMPTestStatusEventListener* CXIMPTestStatusEventListener::NewL( + TInt aStackSize, + MXIMPContext* aEventSource ) + { + CXIMPTestStatusEventListener* self = + new (ELeave) CXIMPTestStatusEventListener( aStackSize, aEventSource ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + + +CXIMPTestStatusEventListener::~CXIMPTestStatusEventListener() + { + User::Free( iSnapshots ); + if( iEventSource ) + { + iEventSource->UnregisterObserver( *this ); + } + + iAcceptedEventTypes.Reset(); + iDescription.Close(); + } + + +CXIMPTestStatusEventListener::CXIMPTestStatusEventListener( + TInt aStackSize, + MXIMPContext* aEventSource ) +: iSnapshotMaxCount( aStackSize ), + iEventSource( aEventSource ) + { + } + + +void CXIMPTestStatusEventListener::ConstructL() + { + __ASSERT_ALWAYS( iSnapshotMaxCount > 0, + Panic( EStatusEventListenerBadMaxCount ) ); + + TInt allocSize = iSnapshotMaxCount * sizeof( TXIMPTestStatusEventSnapshot ); + iSnapshots = (TXIMPTestStatusEventSnapshot*) User::AllocL( allocSize ); + ResetEventStack(); + ResetEventTypeStack(); + + if( iEventSource ) + { + TArray< TInt32 > eventFilterArray = iAcceptedEventTypes.Array(); + iEventSource->RegisterObserverL( *this, &eventFilterArray ); + } + + iDescription.CreateL( 512 ); + } + + + + +// =========================================================================== +// PUBLIC FUNCTIONS +// =========================================================================== +// +EXPORT_C void CXIMPTestStatusEventListener::SetEventSourceL( + MXIMPContext* aEventSource ) + { + if( iEventSource ) + { + iEventSource->UnregisterObserver( *this ); + } + + if( aEventSource ) + { + TArray< TInt32 > eventFilterArray = iAcceptedEventTypes.Array(); + aEventSource->RegisterObserverL( *this, &eventFilterArray ); + } + + iEventSource = aEventSource; + } + + + +EXPORT_C void CXIMPTestStatusEventListener::ReRegisterEventFilterL() + { + if( iEventSource ) + { + TArray< TInt32 > eventFilterArray = iAcceptedEventTypes.Array(); + iEventSource->RegisterObserverL( *this, &eventFilterArray ); + } + } + + + +EXPORT_C RArray< TInt32 >& CXIMPTestStatusEventListener::AcceptedEventTypes() + { + return iAcceptedEventTypes; + } + + + +EXPORT_C void CXIMPTestStatusEventListener::GetEventTemplateL( + RArray< TXIMPTestStatusEventSnapshot >& aArray, + TXIMPTestStatusEventTemplate aTemplate ) + { + switch( aTemplate ) + { + // session handling + case EXIMPTestStatusEvents_BindingOk: + { + TXIMPTestStatusEventSnapshot event; + event.iEventType = MXIMPContextStateEvent::KInterfaceId; + event.iCtxState = MXIMPContextState::EBinding; + event.iResultCode = TXIMPTestStatusEventSnapshot::EStatusObjNotPresent; + aArray.AppendL( event ); + + event.iEventType = MXIMPContextStateEvent::KInterfaceId; + event.iCtxState = MXIMPContextState::EActive; + event.iResultCode = TXIMPTestStatusEventSnapshot::EStatusObjNotPresent; + aArray.AppendL( event ); + + event.iEventType = MXIMPRequestCompleteEvent::KInterfaceId; + event.iCtxState = (MXIMPContextState::TState) TXIMPTestStatusEventSnapshot::EStateValueNotPresent; + event.iResultCode = KErrNone; + aArray.AppendL( event ); + + break; + } + + case EXIMPTestStatusEvents_BindingFailKErrAbort: + { + TXIMPTestStatusEventSnapshot event; + event.iEventType = MXIMPContextStateEvent::KInterfaceId; + event.iCtxState = MXIMPContextState::EBinding; + event.iResultCode = TXIMPTestStatusEventSnapshot::EStatusObjNotPresent; + aArray.AppendL( event ); + + event.iEventType = MXIMPContextStateEvent::KInterfaceId; + event.iCtxState = MXIMPContextState::EInactive; + event.iResultCode = TXIMPTestStatusEventSnapshot::EStatusObjNotPresent; + aArray.AppendL( event ); + + event.iEventType = MXIMPRequestCompleteEvent::KInterfaceId; + event.iCtxState = (MXIMPContextState::TState) TXIMPTestStatusEventSnapshot::EStateValueNotPresent; + event.iResultCode = KErrAbort; + aArray.AppendL( event ); + break; + } + + case EXIMPTestStatusEvents_BindingFailInvalidReqId: + { + TXIMPTestStatusEventSnapshot event; + event.iEventType = MXIMPContextStateEvent::KInterfaceId; + event.iCtxState = MXIMPContextState::EBinding; + event.iResultCode = TXIMPTestStatusEventSnapshot::EStatusObjNotPresent; + aArray.AppendL( event ); + + event.iEventType = MXIMPRequestCompleteEvent::KInterfaceId; + event.iCtxState = (MXIMPContextState::TState) TXIMPTestStatusEventSnapshot::EStateValueNotPresent, + event.iResultCode = KErrServerTerminated; + aArray.AppendL( event ); + + event.iEventType = MXIMPContextStateEvent::KInterfaceId; + event.iCtxState = MXIMPContextState::EInactive; + event.iResultCode = KErrServerTerminated; + + aArray.AppendL( event ); + break; + } + + + case EXIMPTestStatusEvents_BindingFailServerTermination: + { + TXIMPTestStatusEventSnapshot event; + event.iEventType = MXIMPContextStateEvent::KInterfaceId; + event.iCtxState = MXIMPContextState::EUnbinding; + event.iResultCode = KErrServerTerminated; + aArray.AppendL( event ); + + event.iEventType = MXIMPContextStateEvent::KInterfaceId; + event.iCtxState = MXIMPContextState::EInactive; + event.iResultCode = KErrServerTerminated; + aArray.AppendL( event ); + + event.iEventType = MXIMPRequestCompleteEvent::KInterfaceId; + event.iCtxState = (MXIMPContextState::TState) TXIMPTestStatusEventSnapshot::EStateValueNotPresent; + event.iResultCode = KErrServerTerminated; + aArray.AppendL( event ); + + break; + } + + case EXIMPTestStatusEvents_UnbindingOk: + { + TXIMPTestStatusEventSnapshot event; + event.iEventType = MXIMPContextStateEvent::KInterfaceId; + event.iCtxState = MXIMPContextState::EUnbinding; + event.iResultCode = TXIMPTestStatusEventSnapshot::EStatusObjNotPresent; + aArray.AppendL( event ); + + event.iEventType = MXIMPContextStateEvent::KInterfaceId; + event.iCtxState = MXIMPContextState::EInactive; + event.iResultCode = TXIMPTestStatusEventSnapshot::EStatusObjNotPresent; + aArray.AppendL( event ); + + event.iEventType = MXIMPRequestCompleteEvent::KInterfaceId; + event.iCtxState = (MXIMPContextState::TState) TXIMPTestStatusEventSnapshot::EStateValueNotPresent; + event.iResultCode = KErrNone; + aArray.AppendL( event ); + break; + } + + + case EXIMPTestStatusEvents_RequestOk: + { + TXIMPTestStatusEventSnapshot event; + event.iEventType = MXIMPRequestCompleteEvent::KInterfaceId; + event.iCtxState = (MXIMPContextState::TState) TXIMPTestStatusEventSnapshot::EStateValueNotPresent; + event.iResultCode = KErrNone; + aArray.AppendL( event ); + break; + } + + + case EXIMPTestStatusEvents_RequestOOM: + { + TXIMPTestStatusEventSnapshot event; + event.iEventType = MXIMPRequestCompleteEvent::KInterfaceId; + event.iCtxState = (MXIMPContextState::TState) TXIMPTestStatusEventSnapshot::EStateValueNotPresent; + event.iResultCode = KErrNoMemory; + aArray.AppendL( event ); + break; + } + + + + // own presence + case EXIMPTestStatusEvents_SubscribeOwnPresenceSingleCtx: + { + TXIMPTestStatusEventSnapshot event; + event.iEventType = MOwnPresenceEvent::KInterfaceId; + event.iCtxState = (MXIMPContextState::TState) ( MXIMPDataSubscriptionState::EDataUnavailable + MXIMPDataSubscriptionState::ESubscriptionActive ); + event.iResultCode = TXIMPTestStatusEventSnapshot::EStateValueNotPresent; + aArray.AppendL( event ); + break; + } + + case EXIMPTestStatusEvents_UnsubscribeOwnPresenceSingleCtx: + { + TXIMPTestStatusEventSnapshot event; + event.iEventType = MOwnPresenceEvent::KInterfaceId; + event.iCtxState = (MXIMPContextState::TState) ( MXIMPDataSubscriptionState::EDataUnavailable + MXIMPDataSubscriptionState::ESubscriptionInactive ); + event.iResultCode = TXIMPTestStatusEventSnapshot::EStateValueNotPresent; + aArray.AppendL( event ); + break; + } + + // presentity presence + case EXIMPTestStatusEvents_SubscribePresentityPresenceSingleCtx: + { + TXIMPTestStatusEventSnapshot event; + event.iEventType = MPresentityPresenceEvent::KInterfaceId; + event.iCtxState = (MXIMPContextState::TState) ( MXIMPDataSubscriptionState::EDataUnavailable + MXIMPDataSubscriptionState::ESubscriptionActive ); + event.iResultCode = TXIMPTestStatusEventSnapshot::EStateValueNotPresent; + aArray.AppendL( event ); + break; + } + + case EXIMPTestStatusEvents_UnsubscribePresentityPresenceSingleCtx: + { + TXIMPTestStatusEventSnapshot event; + event.iEventType = MPresentityPresenceEvent::KInterfaceId; + event.iCtxState = (MXIMPContextState::TState) ( MXIMPDataSubscriptionState::EDataUnavailable + MXIMPDataSubscriptionState::ESubscriptionInactive ); + event.iResultCode = TXIMPTestStatusEventSnapshot::EStateValueNotPresent; + aArray.AppendL( event ); + break; + } + + // group lists + case EXIMPTestStatusEvents_SubscribePresentityGroupListCtx: + { + // TODO check this + TXIMPTestStatusEventSnapshot event; + event.iEventType = MPresentityGroupListEvent::KInterfaceId; + event.iCtxState = (MXIMPContextState::TState) TXIMPTestStatusEventSnapshot::EStateValueNotPresent; + event.iResultCode = KErrNone; + aArray.AppendL( event ); + + event.iEventType = MXIMPRequestCompleteEvent::KInterfaceId; + event.iCtxState = (MXIMPContextState::TState) TXIMPTestStatusEventSnapshot::EStateValueNotPresent; + event.iResultCode = KErrNone; + aArray.AppendL( event ); + break; + } + + case EXIMPTestStatusEvents_UnsubscribePresentityGroupListCtx: + { + TXIMPTestStatusEventSnapshot event; + event.iEventType = MPresentityGroupListEvent::KInterfaceId; + // TODO check this + event.iCtxState = (MXIMPContextState::TState) TXIMPTestStatusEventSnapshot::EStateValueNotPresent; + event.iResultCode = TXIMPTestStatusEventSnapshot::EStateValueNotPresent; + aArray.AppendL( event ); + break; + } + + case EXIMPTestStatusEvents_CreatePresentityGroup: + { + TXIMPTestStatusEventSnapshot event; + event.iEventType = MPresentityGroupListEvent::KInterfaceId; + // TODO check this + event.iCtxState = (MXIMPContextState::TState) TXIMPTestStatusEventSnapshot::EStateValueNotPresent; + event.iResultCode = TXIMPTestStatusEventSnapshot::EStateValueNotPresent; + aArray.AppendL( event ); + + event.iEventType = MXIMPRequestCompleteEvent::KInterfaceId; + event.iCtxState = (MXIMPContextState::TState) TXIMPTestStatusEventSnapshot::EStateValueNotPresent; + event.iResultCode = KErrNone; + aArray.AppendL( event ); + + break; + } + + case EXIMPTestStatusEvents_HandlePresentityGroupList: + { + TXIMPTestStatusEventSnapshot event; + event.iEventType = MPresentityGroupListEvent::KInterfaceId; + // TODO check this + event.iCtxState = (MXIMPContextState::TState) TXIMPTestStatusEventSnapshot::EStateValueNotPresent; + event.iResultCode = TXIMPTestStatusEventSnapshot::EStateValueNotPresent; + aArray.AppendL( event ); + break; + } + + // group content + case EXIMPTestStatusEvents_SubscribePresentityGroupContentSingleCtx: + { + // TODO check this + TXIMPTestStatusEventSnapshot event; + event.iEventType = MPresentityGroupContentEvent::KInterfaceId; + event.iCtxState = (MXIMPContextState::TState) TXIMPTestStatusEventSnapshot::EStateValueNotPresent; + event.iResultCode = KErrNone; + aArray.AppendL( event ); + + event.iEventType = MXIMPRequestCompleteEvent::KInterfaceId; + event.iCtxState = (MXIMPContextState::TState) TXIMPTestStatusEventSnapshot::EStateValueNotPresent; + event.iResultCode = KErrNone; + aArray.AppendL( event ); + break; + } + + case EXIMPTestStatusEvents_UnsubscribePresentityGroupContentSingleCtx: + { + TXIMPTestStatusEventSnapshot event; + event.iEventType = MPresentityGroupContentEvent::KInterfaceId; + event.iCtxState = (MXIMPContextState::TState) TXIMPTestStatusEventSnapshot::EStateValueNotPresent; + event.iResultCode = TXIMPTestStatusEventSnapshot::EStateValueNotPresent; + aArray.AppendL( event ); + + event.iEventType = MXIMPRequestCompleteEvent::KInterfaceId; + event.iCtxState = (MXIMPContextState::TState) TXIMPTestStatusEventSnapshot::EStateValueNotPresent; + event.iResultCode = KErrNone; + aArray.AppendL( event ); + break; + } + + // watcher list + case EXIMPTestStatusEvents_SubscribePresenceWatcherListCtx: + { + TXIMPTestStatusEventSnapshot event; + event.iEventType = MPresenceWatcherListEvent::KInterfaceId; + event.iCtxState = (MXIMPContextState::TState) TXIMPTestStatusEventSnapshot::EStateValueNotPresent; + event.iResultCode = KErrNone; + aArray.AppendL( event ); + + event.iEventType = MXIMPRequestCompleteEvent::KInterfaceId; + event.iCtxState = (MXIMPContextState::TState) TXIMPTestStatusEventSnapshot::EStateValueNotPresent; + event.iResultCode = KErrNone; + aArray.AppendL( event ); + break; + } + + case EXIMPTestStatusEvents_UnsubscribePresenceWatcherListCtx: + { + TXIMPTestStatusEventSnapshot event; + event.iEventType = MPresenceWatcherListEvent::KInterfaceId; + event.iCtxState = (MXIMPContextState::TState) TXIMPTestStatusEventSnapshot::EStateValueNotPresent; + event.iResultCode = TXIMPTestStatusEventSnapshot::EStateValueNotPresent; + aArray.AppendL( event ); + break; + } + + case EXIMPTestStatusEvents_HandlePresenceWatcherList: + { + TXIMPTestStatusEventSnapshot event; + event.iEventType = MPresenceWatcherListEvent::KInterfaceId; + event.iCtxState = (MXIMPContextState::TState) TXIMPTestStatusEventSnapshot::EStateValueNotPresent; + event.iResultCode = TXIMPTestStatusEventSnapshot::EStateValueNotPresent; + aArray.AppendL( event ); + break; + } + + case EXIMPTestStatusEvents_HandlePresentityPresence: + { + TXIMPTestStatusEventSnapshot event; + event.iEventType = MPresentityPresenceEvent::KInterfaceId; + event.iCtxState = (MXIMPContextState::TState) ( MXIMPDataSubscriptionState::EDataAvailable + MXIMPDataSubscriptionState::ESubscriptionActive ); + event.iResultCode = TXIMPTestStatusEventSnapshot::EStateValueNotPresent; + aArray.AppendL( event ); + break; + } + + + case EXIMPTestStatusEvents_HandlePresentityPresencePending: + { + TXIMPTestStatusEventSnapshot event; + event.iEventType = MPresentityPresenceEvent::KInterfaceId; + event.iCtxState = (MXIMPContextState::TState) ( MXIMPDataSubscriptionState::EDataUnavailable + MXIMPDataSubscriptionState::ESubscriptionActive ); + event.iResultCode = TXIMPTestStatusEventSnapshot::EStateValueNotPresent; + aArray.AppendL( event ); + break; + } + + case EXIMPTestStatusEvents_PresentitySubscribeFailKErrAbort: + { + TXIMPTestStatusEventSnapshot event; + event.iEventType = MXIMPRequestCompleteEvent::KInterfaceId; + event.iCtxState = (MXIMPContextState::TState) TXIMPTestStatusEventSnapshot::EStateValueNotPresent; + event.iResultCode = KErrAbort; + aArray.AppendL( event ); + break; + } + + // misc + case EXIMPTestStatusEvents_PublishOk: + { + TXIMPTestStatusEventSnapshot event; + + // request complete with KErrNone + event.iEventType = MXIMPRequestCompleteEvent::KInterfaceId; + event.iCtxState = (MXIMPContextState::TState) TXIMPTestStatusEventSnapshot::EStateValueNotPresent; + event.iResultCode = KErrNone; + aArray.AppendL( event ); + + // OwnPresenceEvent + event.iEventType = MOwnPresenceEvent::KInterfaceId; + event.iCtxState = (MXIMPContextState::TState) TXIMPTestStatusEventSnapshot::EStateValueNotPresent; + event.iResultCode = TXIMPTestStatusEventSnapshot::EStatusObjNotPresent; + aArray.AppendL( event ); + + break; + } + + case EXIMPTestStatusEvents_PublishFailKErrAbort: + { + TXIMPTestStatusEventSnapshot event; + + // Request completed with KErrAbort + event.iEventType = MXIMPRequestCompleteEvent::KInterfaceId; + event.iCtxState = (MXIMPContextState::TState) TXIMPTestStatusEventSnapshot::EStateValueNotPresent; + event.iResultCode = KErrAbort; + aArray.AppendL( event ); + + break; + } + + default: + { + Panic( EStatusEventListenerUnknownEventTemplate ); + } + } + } + + + +EXPORT_C void CXIMPTestStatusEventListener::WaitRequestAndStackEvents( + const TXIMPRequestId& aReqToWait, TBool aAnyReq /* = EFalse */ ) + { + __ASSERT_ALWAYS( !iWait.IsStarted(), + Panic( EStatusEventListenerAlreadyWaiting ) ); + + iWaitForAnyReq = aAnyReq; + iReqToWait = aReqToWait; + iWaitForAnyEvent = EFalse; + + iWait.Start(); + } + +EXPORT_C void CXIMPTestStatusEventListener::WaitAnyEvent() + { + iWaitForAnyEvent = ETrue; + iWait.Start(); + } + + +EXPORT_C void CXIMPTestStatusEventListener::VerifyEventStackL( + const TArray< TXIMPTestStatusEventSnapshot >& aEventTraits, + const TDesC8& aErrorTitle ) const + { + iDescription.Zero(); + TInt ix = 0; + + //Dumb event lists if there is some mismatches + if( !HasSameEvents( aEventTraits ) ) + { + iDescription = aErrorTitle; + iDescription += _L8("Mismatches in event stack"); + EUNIT_PRINT( iDescription ); + + iDescription = _L8("Received: "); + for( ix = 0; ix < iSnapshotCount; ix++ ) + { + GetNameForEvent( iDescription, SnapshotFromStack( ix ).iEventType ); + } + EUNIT_PRINT( iDescription ); + + + iDescription = _L8("Expected: "); + const TInt traitCount = aEventTraits.Count(); + for( ix = 0; ix < traitCount; ix++ ) + { + GetNameForEvent( iDescription, aEventTraits[ ix ].iEventType ); + } + EUNIT_PRINT( iDescription ); + } + + + //Now do the actual verification + iDescription = aErrorTitle; + iDescription += _L8("Event count mismatch"); + EUNIT_ASSERT_EQUALS_DESC( iSnapshotCount, aEventTraits.Count(), iDescription.PtrZ() ); + + + for( TInt ix = 0; ix < iSnapshotCount; ix++ ) + { + const TXIMPTestStatusEventSnapshot& expected = aEventTraits[ ix ]; + const TXIMPTestStatusEventSnapshot& received = SnapshotFromStack( ix ); + + { + iDescription = aErrorTitle; + iDescription.AppendFormat( _L8("Event type mismatch on event [%d]"), ix ); + EUNIT_ASSERT_EQUALS_DESC( expected.iEventType, expected.iEventType, iDescription.PtrZ() ); + } + + { + const TInt type = received.iEventType; + + iDescription = aErrorTitle; + iDescription += _L8("Content mismatch on "); + GetNameForEvent( iDescription, type ); + iDescription.AppendFormat( _L8("event on position [%d]"), ix ); + switch( type ) + { + case MXIMPRequestCompleteEvent::KInterfaceId: + { + EUNIT_ASSERT_EQUALS_DESC( expected.iResultCode, received.iResultCode, iDescription.PtrZ() ); + break; + } + + + case MXIMPContextStateEvent::KInterfaceId: + { + EUNIT_ASSERT_EQUALS_DESC( expected.iCtxState, received.iCtxState, iDescription.PtrZ() ); + EUNIT_ASSERT_EQUALS_DESC( expected.iResultCode, received.iResultCode, iDescription.PtrZ() ); + break; + } + + case MOwnPresenceEvent::KInterfaceId: + case MPresentityPresenceEvent::KInterfaceId: + { + EUNIT_ASSERT_EQUALS_DESC( expected.iCtxState, received.iCtxState, iDescription.PtrZ() ); + break; + } + + case MPresentityGroupListEvent::KInterfaceId: + { + EUNIT_ASSERT_EQUALS_DESC( expected.iCtxState, received.iCtxState, iDescription.PtrZ() ); + EUNIT_ASSERT_EQUALS_DESC( expected.iResultCode, received.iResultCode, iDescription.PtrZ() ); + break; + } + + case MPresentityGroupContentEvent::KInterfaceId: + { + EUNIT_ASSERT_EQUALS_DESC( expected.iCtxState, received.iCtxState, iDescription.PtrZ() ); + EUNIT_ASSERT_EQUALS_DESC( expected.iResultCode, received.iResultCode, iDescription.PtrZ() ); + break; + } + + case MPresenceWatcherListEvent::KInterfaceId: + { + EUNIT_ASSERT_EQUALS_DESC( expected.iCtxState, received.iCtxState, iDescription.PtrZ() ); + EUNIT_ASSERT_EQUALS_DESC( expected.iResultCode, received.iResultCode, iDescription.PtrZ() ); + break; + } + + + default: + { + Panic( EUnsupportedEventTypeInVerification ); + break; + } + } + } + } + } + + + + +EXPORT_C TInt CXIMPTestStatusEventListener::GetReqCompletionErrL( + const TXIMPRequestId& aReqId ) const + { + for( TInt ix = 0; ix < iSnapshotCount; ix++ ) + { + const TXIMPTestStatusEventSnapshot& received = SnapshotFromStack( ix ); + const TInt type = received.iEventType; + + if( type == MXIMPRequestCompleteEvent::KInterfaceId ) + { + if( received.iReqId == aReqId ) + { + return received.iResultCode; + } + } + } + + User::Leave( KErrNotFound ); + return KErrNotFound; + } + + +EXPORT_C void CXIMPTestStatusEventListener::ResetEventStack() + { + for( TInt ix = 0; ix < iSnapshotMaxCount; ix++ ) + { + new( &iSnapshots[ ix ] ) TXIMPTestStatusEventSnapshot(); + } + + iSnapshotCount = 0; + } + +EXPORT_C void CXIMPTestStatusEventListener::ResetEventTypeStack() + { + iAcceptedEventTypes.Reset(); + iAcceptedEventTypes.AppendL( MXIMPRequestCompleteEvent::KInterfaceId ); + iAcceptedEventTypes.AppendL( MXIMPContextStateEvent::KInterfaceId ); + iAcceptedEventTypes.AppendL( MOwnPresenceEvent::KInterfaceId ); + iAcceptedEventTypes.AppendL( MPresentityPresenceEvent::KInterfaceId ); + } + +EXPORT_C void CXIMPTestStatusEventListener::SetEventObserver( MXIMPContextObserver* aObserver ) + { + iObserver = aObserver; + } + + + + + + + + +// =========================================================================== +// FROM MPRFWPRESENCECONTEXTOBSERVER +// =========================================================================== +// +void CXIMPTestStatusEventListener::HandlePresenceContextEvent( + const MXIMPContext& aContext, + const MXIMPBase& aEvent ) + { + const TInt32 eventType = aEvent.GetInterfaceId(); + + __ASSERT_ALWAYS( iEventSource == &aContext, + Panic( EReceivingEventFromWrongContext ) ); + + __ASSERT_ALWAYS( IsAcceptedEventType( eventType ), + Panic( EReceivedNotAcceptedEventType ) ); + + TXIMPTestStatusEventSnapshot snapShot; + switch( eventType ) + { + case MXIMPRequestCompleteEvent::KInterfaceId: + { + const MXIMPRequestCompleteEvent* event = + TXIMPGetInterface< const MXIMPRequestCompleteEvent >::From( aEvent, MXIMPBase::EPanicIfUnknown ); + { + snapShot.iEventType = event->GetInterfaceId(); + snapShot.iCtxState = (MXIMPContextState::TState) TXIMPTestStatusEventSnapshot::EStateValueNotPresent; + snapShot.iReqId = event->RequestId(); + snapShot.iResultCode = event->CompletionResult().ResultCode(); + + AddSnapshotToStack( snapShot ); + } + + if( iWaitForAnyReq || event->RequestId() == iReqToWait ) + { + HandleRequestCompleteReceived(); + } + + break; + } + + case MXIMPContextStateEvent::KInterfaceId: + { + const MXIMPContextStateEvent& event = + *TXIMPGetInterface< const MXIMPContextStateEvent >::From( aEvent, + MXIMPBase::EPanicIfUnknown ); + { + TXIMPTestStatusEventSnapshot snapShot; + snapShot.iEventType = event.GetInterfaceId(); + snapShot.iCtxState = event.ContextState().ContextState(); + if( event.StateChangeReason() ) + { + snapShot.iResultCode = event.StateChangeReason()->ResultCode(); + } + else + { + snapShot.iResultCode = TXIMPTestStatusEventSnapshot::EStatusObjNotPresent; + } + + AddSnapshotToStack( snapShot ); + } + break; + } + + case MOwnPresenceEvent::KInterfaceId: + { + const MOwnPresenceEvent& event = + *TXIMPGetInterface< const MOwnPresenceEvent >::From( aEvent, + MXIMPBase::EPanicIfUnknown ); + { + TXIMPTestStatusEventSnapshot snapShot; + snapShot.iEventType = event.GetInterfaceId(); + snapShot.iCtxState = ( MXIMPContextState::TState ) ( event.DataSubscriptionState().DataState() + event.DataSubscriptionState().SubscriptionState() ); + AddSnapshotToStack( snapShot ); + } + break; + } + + case MPresentityPresenceEvent::KInterfaceId: + { + const MPresentityPresenceEvent& event = + *TXIMPGetInterface< const MPresentityPresenceEvent >::From( aEvent, + MXIMPBase::EPanicIfUnknown ); + { + TXIMPTestStatusEventSnapshot snapShot; + snapShot.iEventType = event.GetInterfaceId(); + snapShot.iCtxState = ( MXIMPContextState::TState ) ( event.DataSubscriptionState().DataState() + event.DataSubscriptionState().SubscriptionState() ); + AddSnapshotToStack( snapShot ); + } + break; + } + + case MPresentityGroupListEvent::KInterfaceId: + { + const MPresentityGroupListEvent& event = + *TXIMPGetInterface< const MPresentityGroupListEvent >::From( aEvent, + MXIMPBase::EPanicIfUnknown ); + { + TXIMPTestStatusEventSnapshot snapShot; + snapShot.iEventType = event.GetInterfaceId(); + AddSnapshotToStack( snapShot ); + } + break; + } + + case MPresentityGroupContentEvent::KInterfaceId: + { + const MPresentityGroupContentEvent& event = + *TXIMPGetInterface< const MPresentityGroupContentEvent >::From( aEvent, + MXIMPBase::EPanicIfUnknown ); + { + TXIMPTestStatusEventSnapshot snapShot; + snapShot.iEventType = event.GetInterfaceId(); + AddSnapshotToStack( snapShot ); + } + break; + } + + + case MPresenceWatcherListEvent::KInterfaceId: + { + const MPresenceWatcherListEvent& event = + *TXIMPGetInterface< const MPresenceWatcherListEvent >::From( aEvent, + MXIMPBase::EPanicIfUnknown ); + { + TXIMPTestStatusEventSnapshot snapShot; + snapShot.iEventType = event.GetInterfaceId(); + AddSnapshotToStack( snapShot ); + } + break; + } + + + default: + { + break; + } + } + + if( iObserver ) + { + iObserver->HandlePresenceContextEvent( aContext, aEvent ); + } + + if( iWaitForAnyEvent ) + { + HandleRequestCompleteReceived(); + } + } + + + +// =========================================================================== +// HELPERS +// =========================================================================== +// +void CXIMPTestStatusEventListener::HandleRequestCompleteReceived() + { + if( iWait.IsStarted() ) + { + iWait.AsyncStop(); + } + } + + + +TBool CXIMPTestStatusEventListener::IsAcceptedEventType( TInt32 aEventType ) const + { + TInt index = iAcceptedEventTypes.Find( aEventType ); + if( index == KErrNotFound ) + { + return EFalse; + } + return ETrue; + } + + + +void CXIMPTestStatusEventListener::AddSnapshotToStack( + TXIMPTestStatusEventSnapshot aSnapshot ) + { + __ASSERT_ALWAYS( iSnapshotCount < iSnapshotMaxCount, + Panic( EAddSnapshotOverflow ) ); + + iSnapshots[ iSnapshotCount ] = aSnapshot; + iSnapshotCount++; + } + + + +const TXIMPTestStatusEventSnapshot& CXIMPTestStatusEventListener::SnapshotFromStack( TInt aIndex ) const + { + __ASSERT_ALWAYS( aIndex < iSnapshotCount, + Panic( ESnapshotIndexOutOfBounds ) ); + + return iSnapshots[ aIndex ]; + } + + + +TBool CXIMPTestStatusEventListener::HasSameEvents( + const TArray< TXIMPTestStatusEventSnapshot >& aEventTraits ) const + { + TBool hasSameEvents = ETrue; + + if( iSnapshotCount != aEventTraits.Count() ) + { + hasSameEvents = EFalse; + } + else + { + for( TInt ix = 0; ix < iSnapshotCount; ix++ ) + { + const TXIMPTestStatusEventSnapshot& eventTrait = aEventTraits[ ix ]; + const TXIMPTestStatusEventSnapshot& receivedEvent = SnapshotFromStack( ix ); + + if( !receivedEvent.Equals( eventTrait ) ) + { + hasSameEvents = EFalse; + } + } + } + + return hasSameEvents; + } + + + +void CXIMPTestStatusEventListener::GetNameForEvent( + TDes8& aTarget, + TInt aEventType ) const + { + switch( aEventType ) + { + case MXIMPRequestCompleteEvent::KInterfaceId: + { + SafeAppendEventName( aTarget, _L8("[ReqComplete] ") ); + break; + } + + case MXIMPContextStateEvent::KInterfaceId: + { + SafeAppendEventName( aTarget, _L8("[PresCtx] ") ); + break; + } + + case MOwnPresenceEvent::KInterfaceId: + { + SafeAppendEventName( aTarget, _L8("[OwnPres] ") ); + break; + } + + case MPresentityGroupListEvent::KInterfaceId: + { + SafeAppendEventName( aTarget, _L8("[GroupList] ") ); + break; + } + + case MPresentityGroupContentEvent::KInterfaceId: + { + SafeAppendEventName( aTarget, _L8("[GroupContent] ") ); + break; + } + + case MPresentityPresenceEvent::KInterfaceId: + { + SafeAppendEventName( aTarget, _L8("[Presentity] ") ); + break; + } + + default: + { + SafeAppendEventName( aTarget, _L8("[Unknown] ") ); + break; + } + } + } + + + +void CXIMPTestStatusEventListener::SafeAppendEventName( + TDes8& aTarget, + const TDesC8& aName ) const + { + const TInt sizeAvailable = aTarget.MaxLength() - aTarget.Length(); + + if( sizeAvailable > aName.Size() ) + { + aTarget += aName; + } + else + { + _LIT8( KEllipsis, "..." ); + if( sizeAvailable > KEllipsis().Size() ) + { + aTarget += KEllipsis; + } + } + } + + + + +// end of file + diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/tsrcutils/testcaseutils/prfwteststatuseventlistener.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/tsrcutils/testcaseutils/prfwteststatuseventlistener.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,284 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework Test Code prfwteststatuseventlistener.h +* +*/ + +#ifndef CPRFWTESTSTATUSEVENTLISTENER_H__ +#define CPRFWTESTSTATUSEVENTLISTENER_H__ + + +#include +#include +#include + + + +// CLASS DESCRIPTION +/** + * Helper class to store snapshot from + * received status events: + * - MXIMPRequestCompleteEvent + * - MXIMPContextStateEvent + */ +class TXIMPTestStatusEventSnapshot + { +public: //Value enums + enum + { + EStatusObjNotPresent = 100, + EStateValueNotPresent = 101 + }; + +public: //Constructors + + //Default c++ constructor + IMPORT_C TXIMPTestStatusEventSnapshot(); + + //Constructor accepting integer fields + IMPORT_C TXIMPTestStatusEventSnapshot( TInt aEventType, + TInt aCtxState, + TInt aResultCode ); + +public: //Comparator functions + + IMPORT_C TBool Equals( const TXIMPTestStatusEventSnapshot& aOther ) const; + + +public: //Data + TInt iEventType; + MXIMPContextState::TState iCtxState; + TXIMPRequestId iReqId; + TInt iResultCode; + TBuf< 24 > iPrtResultDescription; + }; + + +/** + * Enumeration defining supported + * status event templates. + */ +enum TXIMPTestStatusEventTemplate + { + EXIMPTestStatusEvents_BindingOk, + EXIMPTestStatusEvents_BindingFailKErrAbort, + EXIMPTestStatusEvents_BindingFailInvalidReqId, + EXIMPTestStatusEvents_BindingFailServerTermination, + + EXIMPTestStatusEvents_UnbindingOk, + + EXIMPTestStatusEvents_RequestOk, + EXIMPTestStatusEvents_RequestOOM, + + EXIMPTestStatusEvents_PublishOk, + EXIMPTestStatusEvents_PublishFailKErrAbort, + + EXIMPTestStatusEvents_SubscribeOwnPresenceSingleCtx, + EXIMPTestStatusEvents_UnsubscribeOwnPresenceSingleCtx, + + EXIMPTestStatusEvents_SubscribePresentityPresenceSingleCtx, + EXIMPTestStatusEvents_UnsubscribePresentityPresenceSingleCtx, + + EXIMPTestStatusEvents_SubscribePresentityGroupListCtx, + EXIMPTestStatusEvents_UnsubscribePresentityGroupListCtx, + + EXIMPTestStatusEvents_SubscribePresentityGroupContentSingleCtx, + EXIMPTestStatusEvents_UnsubscribePresentityGroupContentSingleCtx, + + EXIMPTestStatusEvents_HandlePresentityGroupList, + + EXIMPTestStatusEvents_CreatePresentityGroup, + + EXIMPTestStatusEvents_SubscribePresenceWatcherListCtx, + EXIMPTestStatusEvents_UnsubscribePresenceWatcherListCtx, + EXIMPTestStatusEvents_HandlePresenceWatcherList, + + EXIMPTestStatusEvents_HandlePresentityPresence, + EXIMPTestStatusEvents_HandlePresentityPresencePending, + EXIMPTestStatusEvents_PresentitySubscribeFailKErrAbort, + }; + + +/** + * Presence context listener to record status events + * and to wait request completion + * Handles following event types: + * - MXIMPRequestCompleteEvent + * - MXIMPContextStateEvent + * + * For other XIMP event types, see other + * test listeners. + */ +class CXIMPTestStatusEventListener : public CBase, + public MXIMPContextObserver + { +public: + + /** + * Instantiates new listener object. + * + * If valid event source is given, reqisters this object as + * event observer to it. + */ + IMPORT_C static CXIMPTestStatusEventListener* CXIMPTestStatusEventListener::NewL( + TInt aStackSize, + MXIMPContext* aEventSource ); + + ~CXIMPTestStatusEventListener(); + +private: + CXIMPTestStatusEventListener( TInt aStackSize, + MXIMPContext* aEventSource ); + void ConstructL(); + + +public: + + /** + * Sets new event source from where to listen events. + * Unregisters from previous one. + * Can be NULL, in wich case just performs the + * unregistration. + */ + IMPORT_C void SetEventSourceL( MXIMPContext* aEventSource ); + + /** + * Access to accepted event types list. + * Client can alter the list. + * + * By default list has: + * - MXIMPRequestCompleteEvent + * - MXIMPContextStateEvent + * + * NOTE: remember to push edited list to event source with + * ReRegisterEventFilterL() + */ + IMPORT_C RArray< TInt32 >& AcceptedEventTypes(); + + + /** + * ReRegisters this listener to event source. + * In practice, takes new event filter in use. + */ + IMPORT_C void ReRegisterEventFilterL(); + + + /** + * Fills the given array with event templates. + * + * Given enumeration defines which template to retrieve. + */ + IMPORT_C void GetEventTemplateL( RArray< TXIMPTestStatusEventSnapshot >& aArray, + TXIMPTestStatusEventTemplate aTemplate ); + + /** + * Method to wait with CActiveSchedulerWait + * the given request completion. + * NOTE: Only one request can be waited at time. + * Stacks received MXIMPRequestCompleteEvent and + * MXIMPContextStateEvent details to + * event stack. + * + * @param aReqToWait The request to wait. + */ + IMPORT_C void WaitRequestAndStackEvents( const TXIMPRequestId& aReqToWait, TBool aAnyReq = EFalse ); + IMPORT_C void WaitAnyEvent(); + + + /** + * Verifies event stack contents against the given traits. + * + * NOTE: You can use GetEventTemplateL() to retrieve a + * common event traits. + * + * Error title is printed in the error assertion description. + */ + IMPORT_C void VerifyEventStackL( const TArray< TXIMPTestStatusEventSnapshot >& aEventTraits, + const TDesC8& aErrorTitle ) const; + + + + IMPORT_C TInt GetReqCompletionErrL( const TXIMPRequestId& aReqId ) const; + + + + /** + * Resets the event stack contents. + */ + IMPORT_C void ResetEventStack(); + IMPORT_C void ResetEventTypeStack(); + + /** + * Set event observer when needed. + */ + IMPORT_C void SetEventObserver( MXIMPContextObserver* aObserver ); + + +private: //From MXIMPContextObserver + + void HandlePresenceContextEvent( + const MXIMPContext& aContext, + const MXIMPBase& aEvent ); + + +private: //Helpers + void HandleRequestCompleteReceived(); + TBool IsAcceptedEventType( TInt32 aEventType ) const; + void AddSnapshotToStack( TXIMPTestStatusEventSnapshot aSnapshot ); + const TXIMPTestStatusEventSnapshot& SnapshotFromStack( TInt aIndex ) const; + + TBool HasSameEvents( const TArray< TXIMPTestStatusEventSnapshot >& aEventTraits ) const; + void GetNameForEvent( TDes8& aTarget, TInt aEventType ) const; + void SafeAppendEventName( TDes8& aTarget, const TDesC8& aName ) const; + + + + +private: //Data + + //OWN: Active scheduler wait for waiting the completion + CActiveSchedulerWait iWait; + + + //OWN: Request ID identifying request which completion event to wait + TXIMPRequestId iReqToWait; + + + //REF: Context from where receiving events + MXIMPContext* iEventSource; + + + //OWN: Accepted event types + RArray< TInt32 > iAcceptedEventTypes; + + + //OWN: Variables to maintain event snapshot stack + const TInt iSnapshotMaxCount; + TInt iSnapshotCount; + TXIMPTestStatusEventSnapshot* iSnapshots; + + //OWN: Description buffer to hold the failure description + mutable RBuf8 iDescription; + + TBool iWaitForAnyReq; + + TBool iWaitForAnyEvent; + + // To handle event by observer. + MXIMPContextObserver* iObserver; + }; + +#endif //CPRFWTESTSTATUSEVENTLISTENER_H__ + + diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/tsrcutils/testcaseutils/prfwtestwaithelper.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/tsrcutils/testcaseutils/prfwtestwaithelper.cpp Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,56 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework TestGeneralWaiter +* +*/ + + + +#include + +#include "prfwtestwaithelper.h" + +// ======== LOCAL FUNCTIONS ======== + + +// ======== MEMBER FUNCTIONS ======== + + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +EXPORT_C CXIMPTestWaitHelper* CXIMPTestWaitHelper::NewL() + { + CXIMPTestWaitHelper* self = new ( ELeave ) CXIMPTestWaitHelper; + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +void CXIMPTestWaitHelper::ConstructL() + { + } + +CXIMPTestWaitHelper::~CXIMPTestWaitHelper() + { + } + +EXPORT_C void CXIMPTestWaitHelper::WaitForL( TInt aSeconds ) + { + User::After( aSeconds * 1000000 ); + } + +// End of file diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/tsrcutils/testcaseutils/prfwtestwaithelper.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/tsrcutils/testcaseutils/prfwtestwaithelper.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,48 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework TestGeneralWaiter +* +*/ + + + +#ifndef CPRFWTESTWAITHELPER_H +#define CPRFWTESTWAITHELPER_H + + +#include + +class CXIMPTestGeneralWaiter; + +class CXIMPTestWaitHelper : public CBase + { + public: + + IMPORT_C static CXIMPTestWaitHelper* NewL(); + + IMPORT_C void WaitForL( TInt aSeconds ); + + ~CXIMPTestWaitHelper(); + + private: + + /** + * + */ + void ConstructL(); + + private: // data + }; + +#endif // CPRFWTESTWAITHELPER_H diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/tsrcutils/testcaseutils/prfwwaitobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/tsrcutils/testcaseutils/prfwwaitobserver.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,62 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XIMP Framework Test Code prfwwaitobserver.h +* +*/ + + + +#ifndef T_PRFWWAITOBSERVER +#define T_PRFWWAITOBSERVER + + +/** + * ?one_line_short_description + * + * ?more_complete_description + * + * @lib ?library + * @since S60 v4.0 + */ +class T_MWaitObserver + { + +public: + + /** + * ?description + * + * @since S60 ?S60_version + * @param ?arg1 ?description + * @param ?arg2 ?description + * @return ?description + */ + virtual void WaitCompleted( TInt aRetVal ) = 0; + + +protected: + + /** + * Protected destructor. + * Instancies can't be destroyed via this interface. + */ + virtual ~T_MWaitObserver() {}; + + }; + + + +#endif // T_PRFWWAITOBSERVER + + diff -r 000000000000 -r e6b17d312c8b ximpfw/tsrc/tsrcutils/testcaseutils/userafter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ximpfw/tsrc/tsrcutils/testcaseutils/userafter.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,151 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Active object based wait. +* +*/ + +#ifndef CUSERAFTER_H__ +#define CUSERAFTER_H__ + +// INCLUDES +#include + + +// CLASS DESCRIPTION + +/** + * Active object based wait. + * + * Similar like User::After() but doesn't block + * whole thread, but current RunL() with + * CActiveSchedulerWait. + */ +class CUserAfter : public CTimer + { + public: //Construction + static inline CUserAfter* NewL(); + static inline CUserAfter* NewLC(); + ~CUserAfter(); + + + public: //Wait support + + /** + * Static "one shot" wait method. + */ + static inline void AfterL( TInt aWaitTimeMicroSeconds ); + static inline void AfterSecondsL( TInt aWaitTimeSeconds ); + + /** + * Member wait method. + */ + inline void After( TInt aWaitTimeMicroSeconds ); + + + private: + CUserAfter(); + + void RunL(); + void RunError(); + void DoCancel(); + + + private: //data + CActiveSchedulerWait iWait; + + }; + + + + +// ----------------------------------------------------------------------------- +// CUserAfter public functions +// ----------------------------------------------------------------------------- +// +inline CUserAfter* CUserAfter::NewL() + { + CUserAfter* self = CUserAfter::NewLC(); + CleanupStack::Pop( self ); + return self; + } + +inline CUserAfter* CUserAfter::NewLC() + { + CUserAfter* self = new (ELeave) CUserAfter(); + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + + +inline CUserAfter::~CUserAfter() + { + CTimer::Cancel(); + } + +inline void CUserAfter::After( TInt aWaitTimeMicroSeconds ) + { + CTimer::After( aWaitTimeMicroSeconds ); + iWait.Start(); + } + + +inline void CUserAfter::AfterL( TInt aWaitTimeMicroSeconds ) + { + CUserAfter* after = CUserAfter::NewL(); + after->After( aWaitTimeMicroSeconds ); + delete after; + } + + +inline void CUserAfter::AfterSecondsL( TInt aWaitTimeSeconds ) + { + CUserAfter* after = CUserAfter::NewL(); + after->After( aWaitTimeSeconds * 1000000 ); + delete after; + } + + +// ----------------------------------------------------------------------------- +// CUserAfter private functions +// ----------------------------------------------------------------------------- +// +inline CUserAfter::CUserAfter() + : CTimer( CActive::EPriorityStandard ) + { + CActiveScheduler::Add( this ); + } + + +inline void CUserAfter::RunL() + { + iWait.AsyncStop(); + Cancel(); + } + +inline void CUserAfter::RunError() + { + } + +inline void CUserAfter::DoCancel() + { + iWait.AsyncStop(); + CTimer::DoCancel(); + } + + +#endif // CUSERAFTER_H__ + +// End of File +