# HG changeset patch # User jake # Date 1268988456 -7200 # Node ID 66e84aa0ed46925783fccae6b992ebdc07b96558 # Parent 2f40063dfb5cba337ab3d765dd441908b22e87a2 start v5backport diff -r 2f40063dfb5c -r 66e84aa0ed46 backsteppingsrv/data/bs_config.xml --- a/backsteppingsrv/data/bs_config.xml Wed Mar 03 15:38:34 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,17 +0,0 @@ - - - - - - - - - diff -r 2f40063dfb5c -r 66e84aa0ed46 backsteppingsrv/group/bld.inf --- a/backsteppingsrv/group/bld.inf Wed Mar 03 15:38:34 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +0,0 @@ -/* -* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Build information file for project -* -*/ - -// MW_LAYER_PLATFORM_EXPORT_PATH macro definitions -#include - -PRJ_PLATFORMS -WINSCW ARMV5 - -PRJ_MMPFILES -bsengine.mmp - -PRJ_EXPORTS -../rom/backsteppingservice.iby CORE_MW_LAYER_IBY_EXPORT_PATH(backsteppingservice.iby) - -../data/bs_config.xml Z:/private/2000F83E/bs_config.xml - -../inc/bsclient.h |../../inc/bsclient.h -../inc/bsengineglobals.h |../../inc/bsengineglobals.h -../inc/bsserviceconstants.h |../../inc/bsserviceconstants.h - -// End of file diff -r 2f40063dfb5c -r 66e84aa0ed46 backsteppingsrv/group/bsengine.mmp --- a/backsteppingsrv/group/bsengine.mmp Wed Mar 03 15:38:34 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,56 +0,0 @@ -/* -* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Project definition file for project -* -*/ - -#include - -TARGET bsengine.exe -TARGETTYPE exe -CAPABILITY CAP_SERVER -VENDORID VID_DEFAULT - -UID 0x1000008d 0x2000F83E - -LANG SC - -SOURCEPATH ../src -SOURCE bsserver.cpp -SOURCE bsengine.cpp -SOURCE bsserversession.cpp -SOURCE bsconfiguration.cpp -SOURCE bsapplicationinfo.cpp - -USERINCLUDE ../inc - -// APP layer system include is needed here because xcfw_api has -// dependency to app layer -APP_LAYER_SYSTEMINCLUDE - -LIBRARY euser.lib -LIBRARY efsrv.lib -LIBRARY ecom.lib - -LIBRARY eikcore.lib -LIBRARY cone.lib -LIBRARY ws32.lib -LIBRARY apgrfx.lib -LIBRARY bafl.lib - -LIBRARY xcfw.lib - -DEBUGLIBRARY flogger.lib - -//end of file diff -r 2f40063dfb5c -r 66e84aa0ed46 backsteppingsrv/inc/bsapplicationinfo.h --- a/backsteppingsrv/inc/bsapplicationinfo.h Wed Mar 03 15:38:34 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,118 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Class stores basic information about application - * -*/ - - -#ifndef BSAPPLICATIONINFO_H -#define BSAPPLICATIONINFO_H - -/** - * Simple helper class used for keeping basic information in back stepping stack - * - * @since S60 3.2 - */ -class CBSApplicationInfo : public CBase - { -public: - - static CBSApplicationInfo* NewL(); - static CBSApplicationInfo* NewLC(); - - /** - * Destructor. - */ - ~CBSApplicationInfo(); - - /** - * Set application UID - * - * @since S60 3.2 - * @param aApp application UID - */ - void SetAppUid( const TUid& aApp ); - - /** - * Get application UID - * - * @since S60 3.2 - * @return application UID - */ - TUid AppUid(); - - /** - * Set previous application UID - * It is application that started application in question - * - * @since S60 3.2 - * @param aApp previous application UID - */ - void SetPrevAppUid( const TUid& aApp ); - - /** - * Get previous application UID - * - * @since S60 3.2 - * @return previous application UID - */ - TUid PrevAppUid(); - - /** - * Set item state of application. - * It is a state that was activated when application gained focus - * Item state is encoded in simple descriptor - * - * @since S60 3.2 - * @param aState application item state - */ - void SetItemStateL( const TDesC8& aState ); - - /** - * Get item state of application. - * It is a state that was activated when application gained focus - * Item state is encoded in simple descriptor - * - * @since S60 3.2 - * @return application item state - */ - const TDesC8& ItemState(); - -private: - - CBSApplicationInfo(); - - void ConstructL(); - -private: - // data - /** - * Applicatin UID - */ - TUid iAppUid; - - /** - * Previous applicatin UID - */ - TUid iPrevAppUid; - - /** - * Item State of application - * Own. - */ - HBufC8* iItemState; - - }; - -#endif // BSAPPLICATIONINFO_H diff -r 2f40063dfb5c -r 66e84aa0ed46 backsteppingsrv/inc/bsclient.h --- a/backsteppingsrv/inc/bsclient.h Wed Mar 03 15:38:34 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,88 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Client session for BS engine - * -*/ - - -#ifndef C_CBSCLIENT_H -#define C_CBSCLIENT_H - -#include - -/** - * Client-side interface to BS Engine - * - * This class provides the client-side interface to the BS server session, - * it just passes requests to the server. - * - * @since S60 v3.2 - */ -class RBSClient : public RSessionBase - { -public: - - /** - * Constructor. - * @since S60 v3.2 - */ - RBSClient(); - - /** - * Connects to the server and create a session. - * When the server is not running, the function starts the server. - * - * @since S60 v3.2 - * @return error code - */ - TInt Connect(); - - /** - * Initialize session with given application UID. - * - * @since S60 v3.2 - * @return error code - */ - TInt Initialize( TUid aApp ); - - /** - * Forwards activation event. - * - * @since S60 v3.2 - * @param aState state of application like view ids - * @param aIsItem indicate if it is item/exit activation - * @return error code - */ - TInt ForwardActivationEvent( const TDesC8& aState, TBool aIsItem ); - - /** - * Handle back command. - * - * @since S60 v3.2 - * @param aState state of application - * @param aCheckOnly indicates if only checking should be done (no actual action) - * @return error code - */ - TInt HandleBackCommand( const TDesC8& aState, TBool aCheckOnly ); - - /** - * Returns the version number. - * - * @return the version - */ - TVersion Version() const; - }; - -#endif // C_CBSCLIENT_H -// End of File diff -r 2f40063dfb5c -r 66e84aa0ed46 backsteppingsrv/inc/bsconfiguration.h --- a/backsteppingsrv/inc/bsconfiguration.h Wed Mar 03 15:38:34 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,170 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Class keeps BS configuration - * -*/ - - -#ifndef BSCONFIGURATION_H -#define BSCONFIGURATION_H - -#include - -class CXCFWTree; -class MXCFWNode; -class CGECODefaultObject; - -/** - * Class keeps configuration of BS. - * Configuration is stored in XML in private folder of Back Stepping engine. - * This class is responsible for reading the XML - * @since S60 3.2 - */ -class CBSConfiguration : public CBase, public MXCFWEngineObserver - { -public: - - static CBSConfiguration* NewL(); - static CBSConfiguration* NewLC(); - - /** - * Destructor. - */ - ~CBSConfiguration(); - - // from base class MXCFWEngineObserver - - /** - * From MXCFWEngineObserver. - * Called when Engine parsing / saving state changes - * User can do desired actions on corresponding events. - * - * @param aEvent Engine event. - */ - virtual void HandleEngineEventL( TXCFWEngineEvent aEvent ); - - /** - * From MXCFWEngineObserver. - * Called when there's an error during parsing / saving - * - * @param aErrorCode Error code from engine - */ - virtual void HandleEngineErrorL( TInt aErrorCode ); - - /** - * Check if application with given UID is in reset list. - * Application from that the list should reset BS stack - * - * @since S60 3.2 - * @param aApp - * @return ETrue if application is in the list, otherwise EFalse - */ - TBool IsReset( TUid aApp ); - - /** - * Check if application with given UID is in ignored list. - * Application from that the list should be ignored in BS - * - * @since S60 3.2 - * @param aApp - * @return ETrue if application is in the list, otherwise EFalse - */ - TBool IsIgnored( TUid aApp ); - - /** - * Check if application with given UID is in additional ignored list. - * Application that is started from applicaton from the list - * should ignore BS stack - * - * @since S60 3.2 - * @param aApp - * @return ETrue if application is in the list, otherwise EFalse - */ - TBool IsIgnoredIfStartedFrom( TUid aApp ); - - /** - * Returns list of application that should reset BS stack, - * if any application was stated thru them (i.e. FastSwap) - * - * @since S60 3.2 - * @return list of UIDs - */ - RArray& ResetIfThruList(); - -private: - - CBSConfiguration(); - - void ConstructL(); - - /** - * Convert descriptor to integer. - * It detects if format is hexadecimal - * - * @since S60 3.2 - * @param aStr descriptor to convert - * @return converted intereger, - * if there will be problem wiht convertion return is KErrArgument - */ - TInt Str2Int( const TDesC& aStr ); - - /** - * Loads configuration from XML file - * Read file from private folder, parse the file and - * fill in internal structures. - * - * @since S60 3.2 - */ - void LoadConfigurationL(); - -private: - // data - - /** - * List of application that should reset BS stack - */ - RArray iResetApps; - - /** - * List of application that should be ignoresd from BS stack - */ - RArray iIgnoredApps; - - /** - * List of application that should deactive BS - * if application was started/activated from them - */ - RArray iIgnoredIfStartedFrom; - - /** - * List of application that should reset BS - * if any application was started/activated thu them - */ - RArray iResetIfThru; - - /** - * Content tree - * Own. - */ - CXCFWTree* iContentTree; - - /** - * Content parsing engine - * Own. - */ - CXCFWEngine* iContentEngine; - - }; - -#endif // BSCONFIGURATION_H diff -r 2f40063dfb5c -r 66e84aa0ed46 backsteppingsrv/inc/bsdebug.h --- a/backsteppingsrv/inc/bsdebug.h Wed Mar 03 15:38:34 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,149 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Debug printing to a log file - * -*/ - - -#ifndef C_BSDEBUG_H -#define C_BSDEBUG_H - -// INCLUDES -#include - -#ifdef _DEBUG -#include -#include "bsmydebug.h" - -// Take care that the correct adatmydebug.h will be included -// In adatmydebug.h in your module inc directory, -// define your application-specific configuration like this: -// ---------------------------------------------------------- -// Debug file - debug output is disabled if the parent dir does not exist -// _LIT(KDebugFileName, "C:\\logs\\bs\\bsengine.txt" ); - -// Replace the current debug file - if not defined appends to the file -#ifndef APPEND_TO_DEBUG_FILE -#define REPLACE_DEBUG_FILE -#endif - -// Maximum formatted size resulting from a single DEBUG* call -#ifndef MAX_DEBUG_STRING_LENGTH -#define MAX_DEBUG_STRING_LENGTH 4096 -#endif -// ---------------------------------------------------------- - - -// FORWARD DECLARATIONS -static void DoOutput( TDesC8& aData ); - -static void DebugStringNarrowL( const char* aFmt, ... ) - { - VA_LIST args; - VA_START(args, aFmt); - - TPtrC8 fmt(reinterpret_cast(aFmt)); - HBufC8* buf = HBufC8::NewLC( MAX_DEBUG_STRING_LENGTH ); - buf->Des().FormatList( fmt, args ); - buf->Des().Append( '\n' ); - DoOutput( *buf ); - CleanupStack::PopAndDestroy( buf ); // buf - - VA_END(args); - } - -static void DebugStringWideL( const char* aFmt, ... ) - { - VA_LIST args; - VA_START(args, aFmt); - - TPtrC8 fmt(reinterpret_cast(aFmt)); - HBufC* fmt16 = HBufC::NewLC( fmt.Length( ) ); - fmt16->Des().Copy( fmt ); - HBufC* buf = HBufC::NewLC( MAX_DEBUG_STRING_LENGTH ); - buf->Des().FormatList( *fmt16, args ); - buf->Des().Append( '\n' ); - HBufC8* buf8 = HBufC8::NewLC( buf->Length( ) ); - buf8->Des().Copy( *buf ); - DoOutput( *buf8 ); - CleanupStack::PopAndDestroy( 3 ); // fmt16, buf, buf8 - - VA_END(args); - } - -static void DebugBufferL( const TDesC8& aBuf ) - { - DebugStringNarrowL( "\"%S\"", &aBuf ); - } - -static void DebugBufferL( const TDesC& aBuf ) - { - DebugStringWideL( "\"%S\"", &aBuf ); - } - -static void DebugTimeL( const TTime& aTime ) - { - TBuf<64> dateTimeString; - _LIT(KDateString, "%E%D%X%N%Y %1 %2 %3" ); - aTime.FormatL( dateTimeString, KDateString ); - DebugBufferL( dateTimeString ); - _LIT(KTimeString, "%-B%:0%J%:1%T%:2%S%.%*C4%:3%+B" ); - aTime.FormatL( dateTimeString, KTimeString ); - DebugBufferL( dateTimeString ); - } - -static void DoOutput( TDesC8& aData ) - { - RFileLogger::Write( KDebugDirName, KDebugFileName, - EFileLoggingModeAppend, aData ); - } -#endif - -// MACROS -// If you output one or more narrow descriptors by using '%S', -// use DEBUGSTRING8 -// else if you output one or more unicode descriptors by using '%S', -// use DEBUGSTRING16 -// else -// use DEBUGSTRING -// -// Narrow and unicode cannot be mixed in a single DEBUGSTRINGx call. - -#ifdef _DEBUG -#define DEBUGINIT() DebugInit() -#define DEBUGINITSUSPENDED() DebugInit(ETrue) -#define DEBUGENABLE() SetDebugEnabled(ETrue) -#define DEBUGDISABLE() SetDebugEnabled(EFalse) -#define DEBUGSUSPEND() SetDebugSuspended(ETrue) -#define DEBUGCONTINUE() SetDebugSuspended(EFalse) -#define DEBUG(x) DebugStringNarrowL x -#define DEBUG8(x) DebugStringNarrowL x -#define DEBUG16(x) DebugStringWideL x -#define DEBUGBUFFER(x) DebugBufferL x -#define DEBUGTIME(x) DebugTimeL x -#else -#define DEBUGINIT() -#define DEBUGINITSUSPENDED() -#define DEBUGENABLE() -#define DEBUGDISABLE() -#define DEBUGSUSPEND() -#define DEBUGCONTINUE() -#define DEBUG(x) -#define DEBUG8(x) -#define DEBUG16(x) -#define DEBUGBUFFER(x) -#define DEBUGTIME(x) -#endif - -#endif // C_BSDEBUG_H diff -r 2f40063dfb5c -r 66e84aa0ed46 backsteppingsrv/inc/bsengine.h --- a/backsteppingsrv/inc/bsengine.h Wed Mar 03 15:38:34 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,154 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Engine for BS Engine - * -*/ - - -#ifndef C_CBSENGINE_H -#define C_CBSENGINE_H - -#include - -class CBSConfiguration; -class CBSApplicationInfo; -class CEikonEnv; - -/** - * Engine for BS solution - * It is the place when whole BS logic is implemented. - * - * @since S60 v3.2 - */ -class CBSEngine : public CBase - { -public: - - static CBSEngine* NewL(); - static CBSEngine* NewLC(); - - /** - * Destructor - */ - virtual ~CBSEngine(); - - /* - * This method is notified when new application gain focus - * - * @since S60 3.2 - * @param aApp application UID - */ - void HandleFocusChangeL( const TUid& aApp ); - - /** - * Invoked when activation event appeared - * appliction state changed or focus state changed - * - * @since S60 3.2 - * @param aApp application UID - * @param aState state of application (like view ids) - * @param aFocused indicate if it was item/exit state - * @return EBSEngineCommandWasConsumed if event was consumed, - * else EBSEngineCommandWasNotConsumed - */ - TInt HandleActivationEventL( const TUid& aApp, const TDesC8& aState, - TBool aFocused ); - - /** - * Invoked when back event appeared - * - * @since S60 3.2 - * @param aApp application UID - * @param aState state of application (like view ids) - * @param aCheckOnly indicates if only checking should be done (no actual action) - * @return EBSEngineCommandWasConsumed if event was consumed, - * else EBSEngineCommandWasNotConsumed - */ - TInt HandleBackEventL( const TUid& aApp, const TDesC8& aState, - TBool aCheckOnly ); - - /** - * Remove information about given application from BS stack - */ - void RemoveAppRecord( const TUid& aApp ); - - /** - * Marks that application was pressed - */ - void ApplicationKeyWasPressed(); - -private: - - CBSEngine(); - - void ConstructL(); - - /** - * Returns previous application in focus stack for given application. - * - * @since S60 3.2 - * @param aApp application UID - * @return UID of previous application, - * if information is missing returns TUid::Null - */ - TUid FindPreviousApp( const TUid& aApp ); - - /** - * Sends given appliction to background - * @since S60 3.2 - * @param aApp application UID - */ - void SendToBackground( const TUid& aApp ); - /** - * Resets BS history - */ - void ResetHistory(); - -private: - // data - - /** - * list of application in BS stact - */ - RPointerArray iAppsStack; - - /** - * focus stack - */ - RArray iFocusHistory; - - /** - * flag for handling fast swap events - */ - TBool swap; - - /** - * flag for application key state - */ - TBool wasPressed; - - /** - * Configuration of BS - * Own. - */ - CBSConfiguration* iConfiguration; - - /** - * Eikon environment - * Not own. - */ - CEikonEnv* iEnv; - }; - -#endif // C_CBSENGINE_H diff -r 2f40063dfb5c -r 66e84aa0ed46 backsteppingsrv/inc/bsengineglobals.h --- a/backsteppingsrv/inc/bsengineglobals.h Wed Mar 03 15:38:34 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,52 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Globals for BS engine - * -*/ - - -#ifndef C_BSENGINEGLOBALS_H -#define C_BSENGINEGLOBALS_H - -// CONSTANTS -const TUint KBSEngineMajorVersionNumber = 0; -const TUint KBSEngineMinorVersionNumber = 1; -const TUint KBSEngineBuildVersionNumber = 1; - -_LIT( KBSEngineThreadName, "bsengine" ); -_LIT( KBSEngineName, "bsengine" ); -_LIT( KBSEngineFilename, "bsengine" ); - -const TUid KServerUid3 = - { - 0x2000F83E - }; - -// ENUMERATIONS -// Opcodes used in message passing between client and server -enum TBSEngineRqst - { - EBSEngineInitialize = 100, - EBSEngineHandleActivationEvent = 101, - EBSEngineHandleBackCommand = 102 - }; - -enum TBSEngineRsp - { - EBSEngineCommandWasNotConsumed, - EBSEngineCommandWasConsumed - }; - -#endif // C_BSENGINEGLOBALS_H -// End of File diff -r 2f40063dfb5c -r 66e84aa0ed46 backsteppingsrv/inc/bsmydebug.h --- a/backsteppingsrv/inc/bsmydebug.h Wed Mar 03 15:38:34 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Debug definitions for BS Engine - * -*/ - - -#ifndef C_BSMYDEBUG_H -#define C_BSMYDEBUG_H - -// MACROS -#define APPEND_TO_DEBUG_FILE - -// CONSTANTS -_LIT( KDebugDirName, "bs" ); -_LIT( KDebugFileName, "bsengine.txt" ); - -#endif // C_BSMYDEBUG_H -// End of File diff -r 2f40063dfb5c -r 66e84aa0ed46 backsteppingsrv/inc/bspanic.h --- a/backsteppingsrv/inc/bspanic.h Wed Mar 03 15:38:34 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,34 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Panic enumeration - * -*/ - - -#ifndef __BSPANIC_H__ -#define __BSPANIC_H__ - -/** Panic Category */ - -/** Active Data Server panic codes */ -enum TBSEnginePanic - { - EBSEngineBadRequest = 1, - EBSEngineBadDescriptor = 2, - EBSEngineSrvCreateServer = 3, - EBSEngineCreateTrapCleanup = 4, - EBSEngineEIkonEnv = 5 - }; - -#endif // __BSPANIC_H__ diff -r 2f40063dfb5c -r 66e84aa0ed46 backsteppingsrv/inc/bsserver.h --- a/backsteppingsrv/inc/bsserver.h Wed Mar 03 15:38:34 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,179 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: BS Server - implemenration of CServer2 - * -*/ - - -#ifndef C_CBSSERVER_H -#define C_CBSSERVER_H - -// INCLUDES -#include -#include - -#include "bspanic.h" - -class CBSEngine; - -/** - * Back Stepping server implementation - * - * @since Series 60 3.2 - */ - -class CBSServer : public CServer2 - { - /** - * EIkonEnv for the server process. - * - * @since Series 60 3.2 - */ - class CBSEikonEnv : public CEikonEnv - { - public: - void DestroyEnvironment(); - void ConstructL(); - }; - - /** - * EikAppUi for the server process. - * Inform engine if focused application was changed - * - * @since Series 60 3.2 - */ - class CBSAppUi : public CEikAppUi - { - public: - ~CBSAppUi(); - void ConstructL(); - void HandleWsEventL( const TWsEvent& aEvent, - CCoeControl* aDestination ); - void ForwardEventL( const TWsEvent& aEvent ); - CBSEngine* iEngine; - }; - -public: - - static CBSServer* NewLC(); - - /** - * Destructor. - */ - virtual ~CBSServer(); - - /** - * Return the reference to the engine. - * - * @since Series 60 3.2 - * @return engine reference - */ - CBSEngine& Engine(); - - /** - * Increment session count - * - * @since Series 60 3.2 - */ - void IncrementSessions(); - - /** - * Decrement session count - * Stops server if last session was closed - * @since Series 60 3.2 - */ - void DecrementSessions(); - - /** - * First stage startup for the server thread. - * - * @since Series 60 3.2 - * @return return KErrNone or panics thread - */ - static TInt ThreadFunction(); - - /** - * Panic client. - * - * @since Series 60 3.2 - * @param aMessage RMessage2 - * @param aPanic panic code - */ - static void PanicClient( const RMessage2& aMessage, - TBSEnginePanic aPanic ); - -protected: - - // from base class CActive - /** - * From CActive. - * Process any errors. - * - * @since Series 60 3.2 - * @param aError the leave code reported - * @return return KErrNone if leave is handled - */ - TInt RunError( TInt aError ); - -private: - - /** - * Constructs the server. - * - * @since Series 60 3.2 - * @param aPriority CServer2 input parameter - */ - CBSServer( TInt aPriority ); - - void ConstructL(); - - /** - * Panic the server. - * - * @since Series 60 3.2 - * @param aPanic the panic code - */ - static void PanicServer( TBSEnginePanic aPanic ); - - /** - * Second stage startup for the server thread. - * - * @since Series 60 3.2 - */ - static void ThreadFunctionL(); - - /** - * Create a server session, and return a pointer to the created object. - * @param aVersion the client version - * @param aMessage RMessage2 - * @return pointer to new session - */ - CSession2* NewSessionL( const TVersion& aVersion, - const RMessage2& aMessage ) const; - -private: - // data - /** - * Instance of engine - * Own. - */ - CBSEngine* iEngine; - - /* - * Session count - */ - TInt iSessionCount; - }; - -#endif // C_CBSSERVER_H diff -r 2f40063dfb5c -r 66e84aa0ed46 backsteppingsrv/inc/bsserversession.h --- a/backsteppingsrv/inc/bsserversession.h Wed Mar 03 15:38:34 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,97 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Server session for BS engine - * -*/ - - -#ifndef C_CBSSERVERSESSION_H -#define C_CBSSERVERSESSION_H - -class CBSServer; - -/** - * Server session. - * An instance of class CBSServerSession is created for each client - */ -class CBSServerSession : public CSession2 - { -public: - /** - * Create a CBSServerSession object using two phase construction, - * and return a pointer to the created object - * - * @since S60 3.2 - * @param aServer CBSServer - * @return pointer to new session - */ - static CBSServerSession* NewL( CBSServer* aServer ); - - /** - * Create a CBSServerSession object using two phase construction, - * and return a pointer to the created object - * - * @since S60 3.2 - * @param aServer CBSServer - * @return pointer to new session - */ - static CBSServerSession* NewLC( CBSServer* aServer ); - - /** - * Destructor. - */ - virtual ~CBSServerSession(); - - // from base class CSession - - /** - * From CSession. - * Called after a service request from client; from class CSession - * - * @since S60 3.2 - * @param aMessage message from client (containing requested operation and any data) - */ - void ServiceL( const RMessage2& aMessage ); - -private: - - CBSServerSession( CBSServer* aServer ); - - void ConstructL(); - - /** - * Read text from message from given slot - * - * @since S60 3.2 - * @param aMessage message - * @param aSlot slot number - * @return descriptor - */ - HBufC8* ReadTextLC( const RMessage2& aMessage, TInt aSlot ); - -private: - // data - - /** - * Pointer to server - * Not own. - */ - CBSServer* iBSServer; - /** - * UID of application assigned to the session - */ - TUid iAppUid; - }; - -#endif // C_CADATSERVERSESSION_H diff -r 2f40063dfb5c -r 66e84aa0ed46 backsteppingsrv/inc/bsserviceconstants.h --- a/backsteppingsrv/inc/bsserviceconstants.h Wed Mar 03 15:38:34 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,46 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Constants for Back Stepping Service Provider - * -*/ - - -#ifndef BS_SERVICE_CONSTANTS_H -#define BS_SERVICE_CONSTANTS_H - -// BS Service implementation UID -const TInt KBSServiceImplUid( 0x2000F840); - -// from LIW -_LIT8( KGenericParamServiceCmdIDStr, "cmd" ); - -// BSS Service and Interface ID -_LIT8( KBSServiceID, "Service.BackStepping" ); -_LIT8( KBSInterface, "IBackStepping" ); - -// BSS commands -_LIT8( KBSCmdInitialize, "Initialize" ); -_LIT8( KBSCmdForwardActivationEvent, "ForwardActivationEvent" ); -_LIT8( KBSCmdHandleBackCommand, "HandleBackCommand" ); - -// BSS in param names -_LIT8( KBSInParamAppUid, "AppUid" ); -_LIT8( KBSInParamState, "State" ); -_LIT8( KBSInParamEnter, "Enter" ); -_LIT8( KBSInParamCheckOnly, "CheckOnly" ); - -// BSS out param names -_LIT8( KBSOutParamStatusInfo, "StatusInfo" ); - -#endif // BS_SERVICE_CONSTANTS_H diff -r 2f40063dfb5c -r 66e84aa0ed46 backsteppingsrv/rom/backsteppingservice.iby --- a/backsteppingsrv/rom/backsteppingservice.iby Wed Mar 03 15:38:34 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - - -#ifndef BACKSTEPPINGSERVICE_IBY -#define BACKSTEPPINGSERVICE_IBY - -file=ABI_DIR\BUILD_DIR\bsengine.exe SHARED_LIB_DIR\bsengine.exe -data=\epoc32\data\Z\private\2000F83E\bs_config.xml private\2000F83E\bs_config.xml - -#endif // BACKSTEPPINGSERVICE_IBY - -// End of File \ No newline at end of file diff -r 2f40063dfb5c -r 66e84aa0ed46 backsteppingsrv/src/bsapplicationinfo.cpp --- a/backsteppingsrv/src/bsapplicationinfo.cpp Wed Mar 03 15:38:34 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,131 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Class stores basic information about application - * -*/ - - -#include - -#include "bsapplicationinfo.h" - -// ================= MEMBER FUNCTIONS ======================= - -// ----------------------------------------------------------------------------- -// Constructor -// ----------------------------------------------------------------------------- -// -CBSApplicationInfo::CBSApplicationInfo() - { - // No implementation required - } - -// ----------------------------------------------------------------------------- -// Destructor. -// ----------------------------------------------------------------------------- -// -CBSApplicationInfo::~CBSApplicationInfo() - { - delete iItemState; - } - -// ----------------------------------------------------------------------------- -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -CBSApplicationInfo* CBSApplicationInfo::NewLC() - { - CBSApplicationInfo* self = new (ELeave)CBSApplicationInfo(); - CleanupStack::PushL( self ); - self->ConstructL( ); - return self; - } - -// ----------------------------------------------------------------------------- -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -CBSApplicationInfo* CBSApplicationInfo::NewL() - { - CBSApplicationInfo* self = CBSApplicationInfo::NewLC( ); - CleanupStack::Pop( self ); - return self; - } - -// ----------------------------------------------------------------------------- -// Symbian 2nd phase constructor can leave. -// ----------------------------------------------------------------------------- -// -void CBSApplicationInfo::ConstructL() - { - } - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -void CBSApplicationInfo::SetAppUid( const TUid& aApp ) - { - iAppUid = aApp; - } - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -TUid CBSApplicationInfo::AppUid() - { - return iAppUid; - } - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -void CBSApplicationInfo::SetPrevAppUid( const TUid& aApp ) - { - iPrevAppUid = aApp; - } - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -TUid CBSApplicationInfo::PrevAppUid() - { - return iPrevAppUid; - } - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -void CBSApplicationInfo::SetItemStateL( const TDesC8& aState ) - { - delete iItemState; - iItemState = NULL; - iItemState = aState.AllocL( ); - } - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -const TDesC8& CBSApplicationInfo::ItemState() - { - if ( iItemState ) - return *iItemState; - else - return KNullDesC8; - } diff -r 2f40063dfb5c -r 66e84aa0ed46 backsteppingsrv/src/bsconfiguration.cpp --- a/backsteppingsrv/src/bsconfiguration.cpp Wed Mar 03 15:38:34 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,279 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Class keeps BS configuration - * -*/ - - -#include //FileExists -#include -#include -#include -#include - -#include "bsdebug.h" -#include "bsconfiguration.h" - -_LIT(KConfigurationFile, "bs_config.xml" ); -_LIT(KCDrive, "C"); -_LIT(KZDrive, "Z"); - -_LIT(KDelimiter, ":"); -_LIT(KTrueValue, "1"); -_LIT(KHexStart,"0x"); - -_LIT(KAppNode, "app"); - -_LIT(KUidAttribute, "uid"); -_LIT(KResetAttribute, "reset"); -_LIT(KIgnoredAttribute, "ignored"); -_LIT(KIgnoredIfStartedFromAttribute, "ignoredIfStartedFrom"); -_LIT(KResetIfThruAttribute, "resetIfThru"); - -// ================= MEMBER FUNCTIONS ======================= - -// ----------------------------------------------------------------------------- -// C++ default constructor can NOT contain any code, that might leave. -// ----------------------------------------------------------------------------- -// -CBSConfiguration::CBSConfiguration() - { - // No implementation required - } - -// ----------------------------------------------------------------------------- -// Destructor. -// ----------------------------------------------------------------------------- -// -CBSConfiguration::~CBSConfiguration() - { - delete iContentTree; - delete iContentEngine; - - iResetApps.Close( ); - iIgnoredApps.Close( ); - iIgnoredIfStartedFrom.Close( ); - iResetIfThru.Close( ); - } - -// ----------------------------------------------------------------------------- -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -CBSConfiguration* CBSConfiguration::NewLC() - { - CBSConfiguration* self = new (ELeave)CBSConfiguration(); - CleanupStack::PushL( self ); - self->ConstructL( ); - return self; - } - -// ----------------------------------------------------------------------------- -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -CBSConfiguration* CBSConfiguration::NewL() - { - CBSConfiguration* self = CBSConfiguration::NewLC( ); - CleanupStack::Pop( self ); - return self; - } - -// ----------------------------------------------------------------------------- -// Symbian 2nd phase constructor can leave. -// ----------------------------------------------------------------------------- -// -void CBSConfiguration::ConstructL() - { - iContentTree = CXCFWTree::NewL( ); - iContentEngine = CXCFWEngine::NewL( this ); - - RFs fileSession; - - User::LeaveIfError( fileSession.Connect( ) ); - CleanupClosePushL( fileSession ); - - TFileName configPath; - - User::LeaveIfError( fileSession.PrivatePath( configPath ) ); - configPath.Insert( 0, KDelimiter ); - configPath.Insert( 0, KCDrive ); - configPath.Append( KConfigurationFile ); - - // first check if file exists on c drive - if ( !BaflUtils::FileExists( fileSession, configPath ) ) - { - // read from z drive - configPath[0] = KZDrive()[0]; - } - - CleanupStack::PopAndDestroy( &fileSession ); - - iContentEngine->LoadL( *iContentTree, configPath ); - } - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -TBool CBSConfiguration::IsReset( TUid aApp ) - { - return iResetApps.Find( aApp.iUid ) != KErrNotFound; - } - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -TBool CBSConfiguration::IsIgnored( TUid aApp ) - { - return iIgnoredApps.Find( aApp.iUid ) != KErrNotFound; - } - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -TBool CBSConfiguration::IsIgnoredIfStartedFrom( TUid aApp ) - { - return iIgnoredIfStartedFrom.Find( aApp.iUid ) != KErrNotFound; - } - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -RArray& CBSConfiguration::ResetIfThruList() - { - return iResetIfThru; - } - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -void CBSConfiguration::LoadConfigurationL() - { - // get root node - MXCFWNode* root = iContentTree->Root( ); - - // list of fetched nodes - RNodeArray nodes; - CleanupClosePushL( nodes ); - - // handle entries - iContentTree->GetNodesOfTypeL( KAppNode, nodes, root, ETrue ); - - for ( TInt i = 0; i < nodes.Count( ); i++ ) - { - CGECODefaultObject* object = - static_cast(nodes[i]->Data( )); - TPtrC uidVal; - TPtrC resetVal; - TPtrC ignoredVal; - TPtrC ignoredIfStartedFromVal; - TPtrC resetIfThruVal; - object->GetAttribute( KUidAttribute, uidVal ); - object->GetAttribute( KResetAttribute, resetVal ); - object->GetAttribute( KIgnoredAttribute, ignoredVal ); - object->GetAttribute( KIgnoredIfStartedFromAttribute, - ignoredIfStartedFromVal ); - object->GetAttribute( KResetIfThruAttribute, resetIfThruVal ); - - TInt uid = Str2Int( uidVal ); - - if ( resetVal.Compare( KTrueValue ) == 0 ) - iResetApps.AppendL( uid ); - - if ( ignoredVal.Compare( KTrueValue ) == 0 ) - iIgnoredApps.AppendL( uid ); - - if ( ignoredIfStartedFromVal.Compare( KTrueValue ) == 0 ) - iIgnoredIfStartedFrom.AppendL( uid ); - - if ( resetIfThruVal.Compare( KTrueValue ) == 0 ) - iResetIfThru.AppendL( uid ); - } - -#ifdef _DEBUG - - for ( TInt i = 0; i< iResetApps.Count( ); i++ ) - DEBUG(("\tiResetApps[%d] = %X)", i, iResetApps[i])); - - for ( TInt i = 0; i< iIgnoredApps.Count( ); i++ ) - DEBUG(("\tiIgnoredApps[%d] = %X)", i, iIgnoredApps[i])); - - for ( TInt i = 0; i< iIgnoredIfStartedFrom.Count( ); i++ ) - DEBUG(("\tiIgnoredIfStartedFrom[%d] = %X)", i, iIgnoredIfStartedFrom[i])); - - for ( TInt i = 0; i< iResetIfThru.Count( ); i++ ) - DEBUG(("\tiResetIfThru[%d] = %X)", i, iResetIfThru[i])); - -#endif - - // clean up - CleanupStack::PopAndDestroy( &nodes ); - } - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -TInt CBSConfiguration::Str2Int( const TDesC& aStr ) - { - // if a string starts from '0x' then convert aStr from hex to int. - // else send aStr to the StrDec2Uint - - TInt position(aStr.Find( KHexStart ) ); - TInt ret(KErrArgument); - if ( position == 0 ) - { - // is hex - TPtrC string(aStr.Mid( KHexStart().Length( ) ) ); - - TLex lexer(string); - TUint val; - lexer.Val( val, EHex ); - ret = val; - } - else - { - TLex lexer(aStr); - lexer.Val( ret ); - } - return ret; - } - -// ----------------------------------------------------------------------------- -// From class MXCFWEngineObserver -// -// ----------------------------------------------------------------------------- -// -void CBSConfiguration::HandleEngineEventL( TXCFWEngineEvent aEvent ) - { - // handle completion - if ( aEvent == EEvtParsingComplete ) - { - LoadConfigurationL( ); - } - } - -// ----------------------------------------------------------------------------- -// From class MXCFWEngineObserver -// -// ----------------------------------------------------------------------------- -// -void CBSConfiguration::HandleEngineErrorL( TInt /*aErrorCode*/) - { - } diff -r 2f40063dfb5c -r 66e84aa0ed46 backsteppingsrv/src/bsengine.cpp --- a/backsteppingsrv/src/bsengine.cpp Wed Mar 03 15:38:34 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,348 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Engine for BS Engine - * -*/ - - -#include -#include -#include -#include - -#include "bsengineglobals.h" -#include "bsdebug.h" -#include "bsengine.h" -#include "bsapplicationinfo.h" -#include "bsconfiguration.h" - -// CONSTANTS -const TInt KSecondTaskIndex( 1); - -// ================= MEMBER FUNCTIONS ======================= - -// ----------------------------------------------------------------------------- -// C++ default constructor can NOT contain any code, that might leave. -// ----------------------------------------------------------------------------- -// -CBSEngine::CBSEngine() - { - iEnv = CEikonEnv::Static( ); - swap = EFalse; - wasPressed = EFalse; - } - -// ----------------------------------------------------------------------------- -// Symbian 2nd phase constructor can leave. -// ----------------------------------------------------------------------------- -// -void CBSEngine::ConstructL() - { - DEBUG(("Create Engine")); - iConfiguration = CBSConfiguration::NewL( ); - } - -// ----------------------------------------------------------------------------- -// Destructor. -// ----------------------------------------------------------------------------- -// -CBSEngine::~CBSEngine() - { - DEBUG(("~CBSEngine")); - iAppsStack.ResetAndDestroy( ); - iFocusHistory.Close( ); - - delete iConfiguration; - } - -// ----------------------------------------------------------------------------- -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -CBSEngine* CBSEngine::NewL() - { - CBSEngine* self = CBSEngine::NewLC( ); - CleanupStack::Pop( self ) ; - return self; - } - -// ----------------------------------------------------------------------------- -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -CBSEngine* CBSEngine::NewLC() - { - CBSEngine* self = new ( ELeave ) CBSEngine(); - CleanupStack::PushL( self ); - self->ConstructL( ) ; - return self; - } - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -void CBSEngine::ApplicationKeyWasPressed() - { - wasPressed = ETrue; - } - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -void CBSEngine::HandleFocusChangeL( const TUid& aApp ) - { - DEBUG(("-> HandleFocusChangeL(0x%X)", aApp.iUid )); - // check if application is not in ignored list - if ( iConfiguration->IsIgnored( aApp ) ) - { - DEBUG(("\tIgnore the event - application in ignored list")); - return; - } - - TInt fsCount = iFocusHistory.Count( ); - if ( fsCount > 0 && iFocusHistory[fsCount - 1] == aApp.iUid ) - { - DEBUG(("\tIgnore the event - application already on top")); - swap = EFalse; - wasPressed = EFalse; - return; - } - - // check if we should not reset back stepping stack - if ( iConfiguration->IsReset( aApp ) ) - { - swap = EFalse; - wasPressed = EFalse; - ResetHistory( ); - } - - // check if we should reset if application was started tru - RArray& thuApps = iConfiguration->ResetIfThruList( ); - - for ( TInt i = 0; i < thuApps.Count( ); i++ ) - { - // position of application - i.e. fast swap - if ( aApp.iUid == thuApps[i] ) - { - //mark that there is a fast swap or dialog - swap = ETrue; - return; - } - else - { - if ( swap ) - { - swap = EFalse; - TInt currentApp = aApp.iUid; - TInt pos = iFocusHistory.Count( ) - 1; - if ( pos >= 0 ) - { - TInt prevApp = iFocusHistory[pos]; - if ( currentApp != prevApp && wasPressed ) - { - //we are here as the result of the fast swap - ResetHistory( ); - iFocusHistory.AppendL( thuApps[i] ); - wasPressed = EFalse; - } - } - } - } - } - // add application to focus history list, - iFocusHistory.AppendL( aApp.iUid ); - } - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -TInt CBSEngine::HandleActivationEventL( const TUid& aApp, - const TDesC8& aState, TBool aItem ) - { - DEBUG(("-> HandleActivationEventL(0x%X, %S, 0x%X)", - aApp.iUid, &aState, aItem)); - TInt result(EBSEngineCommandWasNotConsumed); - -#ifdef _DEBUG - // check from which application it was started - for ( TInt i = 0; i< iFocusHistory.Count( ); i++ ) - { - DEBUG(("\tiFocusHistory[%d] = %X)", i, iFocusHistory[i])); - } -#endif - - // is it the same application - i.e. internal state change - ignore - CBSApplicationInfo* last(NULL); - if ( iAppsStack.Count( ) ) - last = iAppsStack[iAppsStack.Count() - 1]; - - if ( last && last->AppUid( ) == aApp ) - { - DEBUG(("\tIgnore the event, application is already on stack")); - } - else if ( aItem ) // store only item events - { - CBSApplicationInfo* newApp = CBSApplicationInfo::NewLC(); - newApp->SetPrevAppUid( FindPreviousApp( aApp ) ); - newApp->SetAppUid( aApp ); - newApp->SetItemStateL( aState ); - - DEBUG(("\tAdd to BS stack app:0x%X, state:%S, prevapp:0x%X)", - newApp->AppUid().iUid, - &newApp->ItemState(), - newApp->PrevAppUid().iUid)); - iAppsStack.AppendL( newApp ); - CleanupStack::Pop( newApp ); - result = EBSEngineCommandWasConsumed; - } - - return result; - } - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -TInt CBSEngine::HandleBackEventL( const TUid& aApp, const TDesC8& aState, - TBool aCheckOnly ) - { - DEBUG(("-> HandleBackEventL(0x%X, %S, 0x%X )", - aApp.iUid, &aState, aCheckOnly )); - TInt result(EBSEngineCommandWasNotConsumed); - // get last application at stack - CBSApplicationInfo* info(NULL); - if ( iAppsStack.Count( ) ) - { - info = iAppsStack[iAppsStack.Count() - 1]; - - DEBUG(("\tcheck UIDs (0x%X-0x%X)", aApp.iUid, info->AppUid() )); - DEBUG(("\tcheck states (%S-%S)", &aState, &info->ItemState())); - if ( info && info->AppUid( ) == aApp && info->ItemState().Compare( aState ) == 0 ) - { - DEBUG(("\tcheck prev app, if BS to be ignored = %d)", - iConfiguration->IsIgnoredIfStartedFrom( info->PrevAppUid() ) )); - - // check what application activated the application in question - if ( !iConfiguration->IsIgnoredIfStartedFrom( info->PrevAppUid( ) ) ) - { - // find the task which is directly below the current one - // in window group Z-order hierarchy - TApaTaskList taskList(iEnv->WsSession( ) ); - // current task is in "0" position, next one is "1" - // NOTE: FindByPos doesn't return hidden tasks - TApaTask lowerTask = taskList.FindByPos( KSecondTaskIndex ); - CApaWindowGroupName* apaWGName = CApaWindowGroupName::NewLC( - iEnv->WsSession( ), lowerTask.WgId( ) ); - TUid lowerTaskUid = apaWGName->AppUid( ); - CleanupStack::PopAndDestroy( apaWGName ); - - DEBUG(("\tcheck task below (0x%X-0x%X)", - lowerTaskUid.iUid, info->PrevAppUid().iUid)); - // if the lower task is the one that activated the current one - // send the current one to background. - // the condition is false if i.e. the previous active task - // has been closed or sent to background (no explicit - // activation of the current task occured) - if ( lowerTaskUid == info->PrevAppUid( ) ) - { - if ( !aCheckOnly ) - { - SendToBackground( aApp ); - // remove history for the application - RemoveAppRecord( aApp ); - } - result = EBSEngineCommandWasConsumed; - } - } - } - } - return result; - } - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -void CBSEngine::SendToBackground( const TUid& aApp ) - { - DEBUG(("-> SendToBackgroundL(0x%X)", aApp.iUid )); - - TApaTaskList taskList(iEnv->WsSession( )); - - TApaTask task = taskList.FindApp( aApp ); - if ( task.Exists( ) ) - { - // Request window server to send application to background - task.SendToBackground( ); - } - } - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -TUid CBSEngine::FindPreviousApp( const TUid& aApp ) - { - TUid result(TUid::Null( )); - - for ( TInt i = iFocusHistory.Count( ) - 1; i >= 0; i-- ) - { - if ( iFocusHistory[i] != aApp.iUid ) - { - result = TUid::Uid( iFocusHistory[i] ); - break; - } - } - - return result; - } - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -void CBSEngine::RemoveAppRecord( const TUid& aApp ) - { - DEBUG(("-> RemoveRecord(0x%X)", aApp.iUid )); - - for ( TInt i = iAppsStack.Count( ) - 1; i >= 0; i-- ) - { - CBSApplicationInfo* info = iAppsStack[i]; - if ( info->AppUid( ) == aApp ) - { - DEBUG(("\tRemove item - [%d]", i)); - iAppsStack.Remove( i ); - delete info; - break; - } - } - } - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -void CBSEngine::ResetHistory() - { - DEBUG(("-> ResetHistory")); - iAppsStack.ResetAndDestroy( ); - iFocusHistory.Reset( ); - } - -// End of File - - diff -r 2f40063dfb5c -r 66e84aa0ed46 backsteppingsrv/src/bsserver.cpp --- a/backsteppingsrv/src/bsserver.cpp Wed Mar 03 15:38:34 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,326 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: BS Server - implemenration of CServer2 - * -*/ - - -#include -#include -#include -#include - -#include "bsengineglobals.h" -#include "bsengine.h" -#include "bsserversession.h" -#include "bsdebug.h" -#include "bsserver.h" - -const TInt idsArrayGranularity = 30; - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// C++ default constructor can NOT contain any code, that might leave. -// ----------------------------------------------------------------------------- -// -CBSServer::CBSServer( TInt aPriority ) : - CServer2(aPriority) - { - } - -// ----------------------------------------------------------------------------- -// Symbian 2nd phase constructor can leave. -// ----------------------------------------------------------------------------- -// -void CBSServer::ConstructL() - { - DEBUG(("Start BS Server" )); - iEngine = CBSEngine::NewL( ); - StartL( KBSEngineName ); - } - -// ----------------------------------------------------------------------------- -// Two-phased constructor. -// -------------------------------------- --------------------------------------- -// -CBSServer* CBSServer::NewLC() - { - CBSServer* self = new( ELeave ) CBSServer( EPriorityNormal ); - CleanupStack::PushL( self ); - self->ConstructL( ); - return self; - } - -// ----------------------------------------------------------------------------- -// Destructor. -// -------------------------------------- --------------------------------------- -// -CBSServer::~CBSServer() - { - DEBUG(("Destroy BS Server" )); - delete iEngine; - } - -// ----------------------------------------------------------------------------- -// Create new session. -// ----------------------------------------------------------------------------- -// -CSession2* CBSServer::NewSessionL( const TVersion& aVersion, - const RMessage2& /*aMessage*/ ) const - { - // Check we're the right version - if ( !User::QueryVersionSupported( TVersion( KBSEngineMajorVersionNumber, - KBSEngineMinorVersionNumber, KBSEngineBuildVersionNumber ), aVersion ) ) - { - User::Leave( KErrNotSupported ); - } - - return CBSServerSession::NewL( ( CBSServer* ) this ); - } - -// ----------------------------------------------------------------------------- -// Increment sessions. -// ----------------------------------------------------------------------------- -// -void CBSServer::IncrementSessions() - { - iSessionCount++; - } - -// ----------------------------------------------------------------------------- -// Decrement sessions. -// ----------------------------------------------------------------------------- -// -void CBSServer::DecrementSessions() - { - iSessionCount--; - } -// ----------------------------------------------------------------------------- -// RunError is called when RunL leaves. -// ----------------------------------------------------------------------------- -// -TInt CBSServer::RunError( TInt aError ) - { - DEBUG(("CBSServer::RunError %d", aError )); - if ( aError == KErrBadDescriptor ) - { - PanicClient( Message( ), EBSEngineBadDescriptor ); - } - else - { - Message().Complete( aError ); - } - - // The leave will result in an early return from CServer::RunL(), skipping - // the call to request another message. So do that now in order to keep the - // server running. - ReStart( ); - // Handled the error fully - return KErrNone; - } - -// ----------------------------------------------------------------------------- -// Panic client. -// ----------------------------------------------------------------------------- -// -void CBSServer::PanicClient( const RMessage2& aMessage, TBSEnginePanic aPanic ) - { - aMessage.Panic( KBSEngineName, aPanic ); - } - -// ----------------------------------------------------------------------------- -// Panic server. -// ----------------------------------------------------------------------------- -// -void CBSServer::PanicServer( TBSEnginePanic aPanic ) - { - User::Panic( KBSEngineName, aPanic ); - } - -// ----------------------------------------------------------------------------- -// Create and start the server. -// ----------------------------------------------------------------------------- -// -void CBSServer::ThreadFunctionL() - { - CBSAppUi* ui = new (ELeave) CBSAppUi; - ui->ConstructL( ); - - // Construct our server - CBSServer* server = CBSServer::NewLC( ); - - // set engine to AppUI to get notification about focus changes - ui->iEngine = &(server->Engine( )); - - RProcess::Rendezvous( KErrNone ); - - // Start handling requests - CActiveScheduler::Start( ); - - CleanupStack::PopAndDestroy( server ); - - ui->PrepareToExit( ); - - } -// ----------------------------------------------------------------------------- -// Create and start the server. -// ----------------------------------------------------------------------------- -// -TInt CBSServer::ThreadFunction() - { - __UHEAP_MARK; - - User::RenameThread( KBSEngineThreadName ); - - CBSEikonEnv* env = new CBSEikonEnv; - __ASSERT_ALWAYS( env, PanicServer( EBSEngineEIkonEnv ) ); - - TRAPD(error, env->ConstructL();); - __ASSERT_ALWAYS( !error, PanicServer( EBSEngineEIkonEnv ) ); - - TRAPD( err, ThreadFunctionL() ); - if ( err != KErrNone ) - { - PanicServer( EBSEngineSrvCreateServer ); - } - - env->DestroyEnvironment( ); - - __UHEAP_MARKEND; - return KErrNone; - } - -// ----------------------------------------------------------------------------- -// Getter of engine -// ----------------------------------------------------------------------------- -// -CBSEngine& CBSServer::Engine() - { - return *iEngine; - } - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -void CBSServer::CBSEikonEnv::DestroyEnvironment() - { - CEikonEnv::DestroyEnvironment( ); - } - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -void CBSServer::CBSEikonEnv::ConstructL() - { - CEikonEnv::ConstructL( EFalse ); - SetAutoForwarding(ETrue); - User::SetPriorityControl(EFalse); - } -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -CBSServer::CBSAppUi::~CBSAppUi() - { - } - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -void CBSServer::CBSAppUi::HandleWsEventL( const TWsEvent& aEvent, - CCoeControl* /*aDestination*/) - { - if ( aEvent.Type( ) == EEventFocusGroupChanged - || aEvent.Type( ) == EEventWindowGroupsChanged ) - { - - TInt windowsGroupID = iCoeEnv->WsSession().GetFocusWindowGroup( ); - CApaWindowGroupName* apaWGName = CApaWindowGroupName::NewLC( - iCoeEnv->WsSession( ), windowsGroupID ); - TUid uid = apaWGName->AppUid( ); - CleanupStack::PopAndDestroy( apaWGName ); - // if UID is 0, ignore event. - // Next event should bring correct information - if ( uid.iUid ) - { - iEngine->HandleFocusChangeL( uid ); - } - } - else if( aEvent.Type( ) == EEventKeyDown ) - { - iEngine->ApplicationKeyWasPressed( ); - ForwardEventL( aEvent ); - } - else if( aEvent.Type( ) == EEventKeyUp ) - { - ForwardEventL( aEvent ); - } - } - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -void CBSServer::CBSAppUi::ForwardEventL( const TWsEvent& aEvent ) - { - CArrayFixFlat* idArray = - new (ELeave) CArrayFixFlat( idsArrayGranularity ); - iCoeEnv->WsSession().WindowGroupList( idArray ); - - TInt ownId = iCoeEnv->RootWin().Identifier(); - for( TInt x(0); x < idArray->Count(); x++ ) - { - if( (*idArray)[x] != ownId ) - { - iCoeEnv->WsSession().SendEventToWindowGroup( - (*idArray)[x], aEvent ); - } - } - delete idArray; - } - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -void CBSServer::CBSAppUi::ConstructL() - { - CEikAppUi::BaseConstructL( ENoAppResourceFile | ENoScreenFurniture ); - //get notifications about focus change events - iCoeEnv->RootWin().EnableFocusChangeEvents( ); - //get notifications about windows group change events - iCoeEnv->RootWin().EnableGroupChangeEvents( ); - //disable notifications about layout change - iCoeEnv->RootWin().DisableScreenChangeEvents(); - //get notifications about application key event - iCoeEnv->RootWin().CaptureKeyUpAndDowns( EStdKeyApplication0, 0, 0 ); - } - -// ============================= LOCAL FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// E32Main item point. -// ----------------------------------------------------------------------------- -// -TInt E32Main() - { - return CBSServer::ThreadFunction( ); - } - -// End of File - diff -r 2f40063dfb5c -r 66e84aa0ed46 backsteppingsrv/src/bsserversession.cpp --- a/backsteppingsrv/src/bsserversession.cpp Wed Mar 03 15:38:34 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,152 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Server session for BS engine - * -*/ - - -// INCLUDE FILES -#include "bsserver.h" -#include "bsengine.h" -#include "bsengineglobals.h" - -#include "bsserversession.h" -#include "bspanic.h" -#include "bsdebug.h" - -// ================= MEMBER FUNCTIONS ======================= - -// ----------------------------------------------------------------------------- -// CBSServerSession::NewL -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -CBSServerSession* CBSServerSession::NewL( CBSServer* aServer ) - { - CBSServerSession* self = CBSServerSession::NewLC( aServer ); - CleanupStack::Pop( self ) ; - return self; - } - -// ----------------------------------------------------------------------------- -// CBSServerSession::NewLC -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -CBSServerSession* CBSServerSession::NewLC( CBSServer* aServer ) - { - CBSServerSession* self = new ( ELeave ) CBSServerSession(aServer); - CleanupStack::PushL( self ); - self->ConstructL( ) ; - return self; - } - -// ----------------------------------------------------------------------------- -// CBSServerSession::~CBSServerSession -// Destructor. -// ----------------------------------------------------------------------------- -// -CBSServerSession::~CBSServerSession() - { - if ( iBSServer ) - { - iBSServer->Engine().RemoveAppRecord( iAppUid ); - iBSServer->DecrementSessions( ); - } - } - -// ----------------------------------------------------------------------------- -// CBSServerSession::ReadTextL -// -// ----------------------------------------------------------------------------- -// -HBufC8* CBSServerSession::ReadTextLC( const RMessage2& aMessage, TInt aSlot ) - { - TInt length = aMessage.GetDesMaxLength( aSlot ); - HBufC8* result = HBufC8::NewLC( length ); - TPtr8 ptr(result->Des( )); - User::LeaveIfError( aMessage.Read( aSlot, ptr ) ); - - DEBUG(("ReadTextL slot (%d) - %S", aSlot, result)); - return result; - } - -// ----------------------------------------------------------------------------- -// CBSServerSession::ServiceL -// Handle client requests. -// ----------------------------------------------------------------------------- -// -void CBSServerSession::ServiceL( const RMessage2& aMessage ) - { - DEBUG(("CBSServerSession::ServiceL")); - HBufC8* state(NULL); - TInt result(0); - switch ( aMessage.Function( ) ) - { - case EBSEngineInitialize: - iAppUid = TUid::Uid( aMessage.Int0( ) ); - DEBUG(("EBSEngineInitialize %x", iAppUid.iUid)); - aMessage.Complete( EBSEngineCommandWasConsumed ); - break; - case EBSEngineHandleActivationEvent: - state = ReadTextLC( aMessage, 0 ); - DEBUG(("EBSEngineHandleActivationEvent 0x%X, %S, 0x%X", - iAppUid.iUid, state, aMessage.Int1() )); - result = iBSServer->Engine(). - HandleActivationEventL( iAppUid, *state, aMessage.Int1( ) ); - CleanupStack::PopAndDestroy( state ); - aMessage.Complete( result ); - break; - case EBSEngineHandleBackCommand: - state = ReadTextLC( aMessage, 0 ); - - DEBUG(("EBSEngineHandleBackCommand 0x%X, %S", - iAppUid.iUid, state)); - result = iBSServer->Engine(). - HandleBackEventL( iAppUid, *state, aMessage.Int1( ) ); - CleanupStack::PopAndDestroy( state ); - aMessage.Complete( result ); - break; - default: - TBSEnginePanic tmp = EBSEngineBadRequest; - iBSServer->PanicClient( aMessage, tmp ); - break; - } - } - -// ----------------------------------------------------------------------------- -// CBSServerSession::CBSServerSession -// C++ default constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// -CBSServerSession::CBSServerSession( CBSServer* aServer ) : - CSession2() - { - iBSServer = aServer; - iBSServer->IncrementSessions( ); - } - -// ----------------------------------------------------------------------------- -// CBSServerSession::ConstructL -// Symbian 2nd phase constructor can leave. -// ----------------------------------------------------------------------------- -// -void CBSServerSession::ConstructL() - { - DEBUG(("CBSServerSession::ConstructL")); - - } - -// End of File diff -r 2f40063dfb5c -r 66e84aa0ed46 contextutility/bwins/hgcontextutilityu.def --- a/contextutility/bwins/hgcontextutilityu.def Wed Mar 03 15:38:34 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,31 +0,0 @@ -EXPORTS - ?PublishServiceIdL@CHgContextUtility@@QAEXABVTDesC16@@0ABVTTimeIntervalMicroSeconds32@@@Z @ 1 NONAME ; void CHgContextUtility::PublishServiceIdL(class TDesC16 const &, class TDesC16 const &, class TTimeIntervalMicroSeconds32 const &) - ?PublishMusicContextL@CHgContextUtility@@QAEXABVTTimeIntervalMicroSeconds32@@@Z @ 2 NONAME ; void CHgContextUtility::PublishMusicContextL(class TTimeIntervalMicroSeconds32 const &) - ?PublishContactContextL@CHgContextUtility@@QAEXABV?$RPointerArray@VMVPbkStoreContact@@@@ABVTTimeIntervalMicroSeconds32@@@Z @ 3 NONAME ; void CHgContextUtility::PublishContactContextL(class RPointerArray const &, class TTimeIntervalMicroSeconds32 const &) - ?SplitCombinedStringL@CHgContextUtility@@SAXABVTDesC16@@AAVCDesC16Array@@@Z @ 4 NONAME ; void CHgContextUtility::SplitCombinedStringL(class TDesC16 const &, class CDesC16Array &) - ?PublishContactContextL@CHgContextUtility@@QAEXABVTDesC16@@ABVTTimeIntervalMicroSeconds32@@@Z @ 5 NONAME ; void CHgContextUtility::PublishContactContextL(class TDesC16 const &, class TTimeIntervalMicroSeconds32 const &) - ??1CHgContextUtility@@UAE@XZ @ 6 NONAME ; CHgContextUtility::~CHgContextUtility(void) - ?NewLC@CHgContextUtility@@SAPAV1@XZ @ 7 NONAME ; class CHgContextUtility * CHgContextUtility::NewLC(void) - ?RePublishWhenFgL@CHgContextUtility@@QAEXH@Z @ 8 NONAME ; void CHgContextUtility::RePublishWhenFgL(int) - ?PublishPhotoContextL@CHgContextUtility@@QAEXABVTDesC16@@ABVTTimeIntervalMicroSeconds32@@@Z @ 9 NONAME ; void CHgContextUtility::PublishPhotoContextL(class TDesC16 const &, class TTimeIntervalMicroSeconds32 const &) - ?BuildCombinedStringL@CHgContextUtility@@SAPAVHBufC16@@ABVMDesC16Array@@@Z @ 10 NONAME ; class HBufC16 * CHgContextUtility::BuildCombinedStringL(class MDesC16Array const &) - ?PublishContextDelayedL@CHgContextUtilityBase@@QAEXABVTDesC16@@ABVMDesC16Array@@ABVTTimeIntervalMicroSeconds32@@@Z @ 11 NONAME ; void CHgContextUtilityBase::PublishContextDelayedL(class TDesC16 const &, class MDesC16Array const &, class TTimeIntervalMicroSeconds32 const &) - ?PublishContactContextL@CHgContextUtility@@QAEXABVMVPbkContactLink@@ABVTTimeIntervalMicroSeconds32@@@Z @ 12 NONAME ; void CHgContextUtility::PublishContactContextL(class MVPbkContactLink const &, class TTimeIntervalMicroSeconds32 const &) - ?PublishUrlContextL@CHgContextUtility@@QAEXABVTDesC16@@ABVTTimeIntervalMicroSeconds32@@@Z @ 13 NONAME ; void CHgContextUtility::PublishUrlContextL(class TDesC16 const &, class TTimeIntervalMicroSeconds32 const &) - ?PublishTvContextL@CHgContextUtility@@QAEXABVTDesC16@@000@Z @ 14 NONAME ; void CHgContextUtility::PublishTvContextL(class TDesC16 const &, class TDesC16 const &, class TDesC16 const &, class TDesC16 const &) - ?PublishContextL@CHgContextUtilityBase@@QAEXABVTDesC16@@ABVMDesC16Array@@@Z @ 15 NONAME ; void CHgContextUtilityBase::PublishContextL(class TDesC16 const &, class MDesC16Array const &) - ?AllowPublishFromBackground@CHgContextUtility@@QAEXH@Z @ 16 NONAME ; void CHgContextUtility::AllowPublishFromBackground(int) - ?PublishContactContextL@CHgContextUtility@@QAEXABVMVPbkStoreContact@@ABVTTimeIntervalMicroSeconds32@@@Z @ 17 NONAME ; void CHgContextUtility::PublishContactContextL(class MVPbkStoreContact const &, class TTimeIntervalMicroSeconds32 const &) - ?AddMusicContextInfoL@CHgContextUtility@@QAEXABVTDesC16@@0@Z @ 18 NONAME ; void CHgContextUtility::AddMusicContextInfoL(class TDesC16 const &, class TDesC16 const &) - ?GetContextL@CHgContextUtilityBase@@QAEPAVHBufC16@@ABVTDesC16@@@Z @ 19 NONAME ; class HBufC16 * CHgContextUtilityBase::GetContextL(class TDesC16 const &) - ?NewL@CHgContextUtility@@SAPAV1@XZ @ 20 NONAME ; class CHgContextUtility * CHgContextUtility::NewL(void) - ?PublishContextDelayedL@CHgContextUtilityBase@@QAEXABVTDesC16@@0ABVTTimeIntervalMicroSeconds32@@@Z @ 21 NONAME ; void CHgContextUtilityBase::PublishContextDelayedL(class TDesC16 const &, class TDesC16 const &, class TTimeIntervalMicroSeconds32 const &) - ?PublishTextContextL@CHgContextUtility@@QAEXABVTDesC16@@ABVTTimeIntervalMicroSeconds32@@@Z @ 22 NONAME ; void CHgContextUtility::PublishTextContextL(class TDesC16 const &, class TTimeIntervalMicroSeconds32 const &) - ?PublishContextL@CHgContextUtilityBase@@QAEXABVTDesC16@@0@Z @ 23 NONAME ; void CHgContextUtilityBase::PublishContextL(class TDesC16 const &, class TDesC16 const &) - ?GetContextL@CHgContextUtilityBase@@QAEPAVHBufC16@@ABVTDesC16@@0@Z @ 24 NONAME ; class HBufC16 * CHgContextUtilityBase::GetContextL(class TDesC16 const &, class TDesC16 const &) - ?PublishRadioContextL@CHgContextUtility@@QAEXABVTDesC16@@000@Z @ 25 NONAME ; void CHgContextUtility::PublishRadioContextL(class TDesC16 const &, class TDesC16 const &, class TDesC16 const &, class TDesC16 const &) - ?PublishPhotoContextL@CHgContextUtility@@QAEXKAAVCMdESession@@ABVTTimeIntervalMicroSeconds32@@@Z @ 26 NONAME ; void CHgContextUtility::PublishPhotoContextL(unsigned long, class CMdESession &, class TTimeIntervalMicroSeconds32 const &) - ?PublishContactContextL@CHgContextUtility@@QAEXABVCVPbkContactLinkArray@@ABVTTimeIntervalMicroSeconds32@@@Z @ 27 NONAME ; void CHgContextUtility::PublishContactContextL(class CVPbkContactLinkArray const &, class TTimeIntervalMicroSeconds32 const &) - ?PublishTimeContextL@CHgContextUtility@@QAEXABVTTime@@ABVTTimeIntervalMicroSeconds32@@@Z @ 28 NONAME ; void CHgContextUtility::PublishTimeContextL(class TTime const &, class TTimeIntervalMicroSeconds32 const &) - ?PublishContactContextL@CHgContextUtility@@QAEXABVMDesC16Array@@ABVTTimeIntervalMicroSeconds32@@@Z @ 29 NONAME ; void CHgContextUtility::PublishContactContextL(class MDesC16Array const &, class TTimeIntervalMicroSeconds32 const &) - diff -r 2f40063dfb5c -r 66e84aa0ed46 contextutility/eabi/hgcontextutilityu.def --- a/contextutility/eabi/hgcontextutilityu.def Wed Mar 03 15:38:34 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,35 +0,0 @@ -EXPORTS - _ZN17CHgContextUtility16RePublishWhenFgLEi @ 1 NONAME - _ZN17CHgContextUtility17PublishServiceIdLERK7TDesC16S2_RK27TTimeIntervalMicroSeconds32 @ 2 NONAME - _ZN17CHgContextUtility17PublishTvContextLERK7TDesC16S2_S2_S2_ @ 3 NONAME - _ZN17CHgContextUtility18PublishUrlContextLERK7TDesC16RK27TTimeIntervalMicroSeconds32 @ 4 NONAME - _ZN17CHgContextUtility19PublishTextContextLERK7TDesC16RK27TTimeIntervalMicroSeconds32 @ 5 NONAME - _ZN17CHgContextUtility19PublishTimeContextLERK5TTimeRK27TTimeIntervalMicroSeconds32 @ 6 NONAME - _ZN17CHgContextUtility20AddMusicContextInfoLERK7TDesC16S2_ @ 7 NONAME - _ZN17CHgContextUtility20BuildCombinedStringLERK12MDesC16Array @ 8 NONAME - _ZN17CHgContextUtility20PublishMusicContextLERK27TTimeIntervalMicroSeconds32 @ 9 NONAME - _ZN17CHgContextUtility20PublishPhotoContextLERK7TDesC16RK27TTimeIntervalMicroSeconds32 @ 10 NONAME - _ZN17CHgContextUtility20PublishPhotoContextLEmR11CMdESessionRK27TTimeIntervalMicroSeconds32 @ 11 NONAME - _ZN17CHgContextUtility20PublishRadioContextLERK7TDesC16S2_S2_S2_ @ 12 NONAME - _ZN17CHgContextUtility20SplitCombinedStringLERK7TDesC16R12CDesC16Array @ 13 NONAME - _ZN17CHgContextUtility22PublishContactContextLERK12MDesC16ArrayRK27TTimeIntervalMicroSeconds32 @ 14 NONAME - _ZN17CHgContextUtility22PublishContactContextLERK13RPointerArrayI17MVPbkStoreContactERK27TTimeIntervalMicroSeconds32 @ 15 NONAME - _ZN17CHgContextUtility22PublishContactContextLERK16MVPbkContactLinkRK27TTimeIntervalMicroSeconds32 @ 16 NONAME - _ZN17CHgContextUtility22PublishContactContextLERK17MVPbkStoreContactRK27TTimeIntervalMicroSeconds32 @ 17 NONAME - _ZN17CHgContextUtility22PublishContactContextLERK21CVPbkContactLinkArrayRK27TTimeIntervalMicroSeconds32 @ 18 NONAME - _ZN17CHgContextUtility22PublishContactContextLERK7TDesC16RK27TTimeIntervalMicroSeconds32 @ 19 NONAME - _ZN17CHgContextUtility26AllowPublishFromBackgroundEi @ 20 NONAME - _ZN17CHgContextUtility4NewLEv @ 21 NONAME - _ZN17CHgContextUtility5NewLCEv @ 22 NONAME - _ZN17CHgContextUtilityD0Ev @ 23 NONAME - _ZN17CHgContextUtilityD1Ev @ 24 NONAME - _ZN17CHgContextUtilityD2Ev @ 25 NONAME - _ZN21CHgContextUtilityBase11GetContextLERK7TDesC16 @ 26 NONAME - _ZN21CHgContextUtilityBase11GetContextLERK7TDesC16S2_ @ 27 NONAME - _ZN21CHgContextUtilityBase15PublishContextLERK7TDesC16RK12MDesC16Array @ 28 NONAME - _ZN21CHgContextUtilityBase15PublishContextLERK7TDesC16S2_ @ 29 NONAME - _ZN21CHgContextUtilityBase22PublishContextDelayedLERK7TDesC16RK12MDesC16ArrayRK27TTimeIntervalMicroSeconds32 @ 30 NONAME - _ZN21CHgContextUtilityBase22PublishContextDelayedLERK7TDesC16S2_RK27TTimeIntervalMicroSeconds32 @ 31 NONAME - _ZTI21CHgContextUtilityBase @ 32 NONAME - _ZTV21CHgContextUtilityBase @ 33 NONAME - diff -r 2f40063dfb5c -r 66e84aa0ed46 contextutility/group/bld.inf --- a/contextutility/group/bld.inf Wed Mar 03 15:38:34 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ -/* -* 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 info file for Context publishing helper DLL. -* -*/ - - -#include - -PRJ_EXPORTS -../rom/hgcontextutility.iby CORE_MW_LAYER_IBY_EXPORT_PATH(hgcontextutility.iby) - - -PRJ_MMPFILES -hgcontextutility.mmp - -PRJ_TESTMMPFILES - - diff -r 2f40063dfb5c -r 66e84aa0ed46 contextutility/group/hgcontextutility.mmp --- a/contextutility/group/hgcontextutility.mmp Wed Mar 03 15:38:34 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,46 +0,0 @@ -/* -* 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: Context publishing helper dll -* -*/ - - -#include -#include - -TARGETTYPE DLL -TARGET hgcontextutility.dll -UID 0x1000008d -CAPABILITY CAP_GENERAL_DLL - -SOURCEPATH ../src -SOURCE hgcontextutilitybase.cpp -SOURCE hgcontextutility.cpp -SOURCE hgcontextutilityimpl.cpp - -USERINCLUDE ../inc -USERINCLUDE ../../inc - -APP_LAYER_SYSTEMINCLUDE - -LIBRARY euser.lib -LIBRARY estor.lib -LIBRARY bafl.lib -LIBRARY cfclient.lib -LIBRARY cfservices.lib -LIBRARY cone.lib -LIBRARY ws32.lib -LIBRARY mdeclient.lib -LIBRARY vpbkeng.lib - diff -r 2f40063dfb5c -r 66e84aa0ed46 contextutility/inc/hgcontexttypes.h --- a/contextutility/inc/hgcontexttypes.h Wed Mar 03 15:38:34 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,39 +0,0 @@ -/* -* 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: CFW source and type names -* -*/ - -#ifndef HGCONTEXTTYPES_H -#define HGCONTEXTTYPES_H - -#include -#include // pull in the public part - -_LIT( KHgCFTypeFgApp, "FgApp" ); // published by fswserver - -_LIT( KHgCFTypeUpdateAvail, "UpdateAvail" ); // for iad source plug-in - -_LIT( KHgCFTypeMdsObjChanged, "MdsObjChanged" ); -_LIT( KHgCFTypeMdsRelChanged, "MdsRelChanged" ); - -_LIT( KHgCFValueDuplicateMarker, "" ); // may be used in PbkContactMulti - -const TInt KHgCFValueLinkMarker = 2; // prefix when Contact holds a vpbk contact link - -_LIT( KHgCFTypeCallState, "CallState" ); -_LIT( KHgCFTypeCallSusp, "CallSusp" ); // see hgcfcallsourceplugin -_LIT( KHgCFTypeContactFromCall, "ContactFromCall" ); // contains "1" if contact is coming from a voice/video call - -#endif // HGCONTEXTTYPES_H diff -r 2f40063dfb5c -r 66e84aa0ed46 contextutility/inc/hgcontextutilityimpl.h --- a/contextutility/inc/hgcontextutilityimpl.h Wed Mar 03 15:38:34 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,434 +0,0 @@ -/* -* 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: Context publishing helper dll -* -*/ - - -#ifndef HGCONTEXTUTILITYIMPL_H -#define HGCONTEXTUTILITYIMPL_H - -#include -#include -#include -#include -#include -#include -#include - -class CCFClient; -class MVPbkContactLink; -class MVPbkStoreContact; -class CVPbkContactLinkArray; -class CMdESession; - -/** - * Utility class offering static and non-static functions for - * publishing and accessing context through the Context Framework. - */ -NONSHARABLE_CLASS( CHgContextUtilityImpl ) : - public CTimer, - public MCFListener, - public MCoeForegroundObserver - { -public: - static CHgContextUtilityImpl* NewL(); - static CHgContextUtilityImpl* NewLC(); - virtual ~CHgContextUtilityImpl(); - - /** - * Publishes context. - * Also defines the context if it has not been defined. - * Publishing empty value is not allowed, however such errors are ignored - * here so the function will not leave when CFW responds with KErrArgument. - * The security policy for the context will be set to require - * LocalServices capability. - * @param aContextType context type, source is always KHgCFSource - * @param aContextData value for the context - */ - void PublishContextL( const TDesC& aContextType, - const TDesC& aContextData ); - - /** - * Publishes context, the value will contain all the strings - * from the given array, typically by using some separator character. - * @see PublishContextL - * @param aContextType context type, source is always KHgCFSource - * @param aContextData value for the context will be a combined - * version of all the strings from this array - */ - void PublishContextL( const TDesC& aContextType, - const MDesCArray& aContextData ); - - /** - * Static version that uses the given CCFClient instance. - * @param aCFClient a CCFClient instance - * @param aContextType context type, source is always KHgCFSource - * @param aContextData value for the context - */ - static void PublishContextL( CCFClient& aCFClient, - const TDesC& aContextType, const TDesC& aContextData ); - - /** - * Publishes context but only after a short interval, using a timer. - * If it is called again before the timer expires then the timer - * is restarted (and so the previous pending value is never published). - * @param aContextType context type, source is always KHgCFSource - * @param aContextData value for the context - * @param aDelay delay for the timer - */ - void PublishContextDelayedL( const TDesC& aContextType, - const TDesC& aContextData, TTimeIntervalMicroSeconds32 aDelay ); - - /** - * Overload for delayed publishing of a value combined from multiple strings. - * @param aContextType context type - * @param aContextData string array - * @param aDelay delay for the timer, in microseconds - */ - void PublishContextDelayedL( const TDesC& aContextType, - const MDesCArray& aContextData, TTimeIntervalMicroSeconds32 aDelay ); - - /** - * Requests the given context and returns the value for the - * first result. Returns NULL if not found. - * @param aContextType context type, the source is always KHgCFSource - */ - HBufC* GetContextL( const TDesC& aContextType ); - - /** - * Requests the given context and returns the value for the - * first result. Returns NULL if not found. - * @param aContextSource context source - * @param aContextType context type - */ - HBufC* GetContextL( const TDesC& aContextSource, - const TDesC& aContextType ); - - /** - * Creates a combined string from the elements of the given array. - * Returns NULL if the array has less than 2 elements. - * @param aArray string array - * @return combined string or NULL, ownership transferred to caller - */ - static HBufC* BuildCombinedStringL( const MDesCArray& aArray ); - - /** - * Splits the given combined string and appends the components to - * the given array. The initial content of the array is not modified. - * If aString does not seem to be a string combined from multiple entries - * then aString is appended to aArray without any changes. - * @param aString combined string, input - * @param aArray array, output - */ - static void SplitCombinedStringL( const TDesC& aString, - CDesCArray& aArray ); - - /** - * Gets a string that can be published straight via PublishContextL. - * The pointer is left on the cleanup stack. - * Returned & pushed pointer may also be NULL is something goes wrong. - */ - HBufC* MakeLinkPublishableLC( const MVPbkContactLink& aLink ); - - /** - * Publishes contact context. - * @param aContact contact - * @param aDelay if non-zero then context is published only after - * a short delay. If a new publish call is made before the timer fires the - * pending value will not be published. - */ - void PublishContactContextL( const MVPbkStoreContact& aContact, - const TTimeIntervalMicroSeconds32& aDelay ); - - /** - * Publishes contact context. - * This may include async operations and therefore the actual publishing may happen - * only after this function returns. - * @param aContactLink contact link - * @param aDelay if non-zero then context is published only after - * a short delay. If a new publish call is made before the timer fires the - * pending value will not be published. - */ - void PublishContactContextL( const MVPbkContactLink& aContactLink, - const TTimeIntervalMicroSeconds32& aDelay ); - - /** - * Publishes contact context. - * Attempts to publish an empty value will be ignored. - * - * Prefer using the overloads taking vpbk contact or link, whenever possible. - * Use this in case of unknown contacts only, that is, a name, phone number, - * or email address that does not belong to a phonebook contact. - * - * @param aContactName formatted name, phone number, or email address, - * or a combination of them, e.g. "firstname lastname", "+12345678", - * "lastname firstname ", "firstname, lastname <0501234567>". - * @param aDelay if non-zero then context is published only after - * a short delay. If a new publish call is made before the timer fires the - * pending value will not be published. - */ - void PublishContactContextL( const TDesC& aContactName, - const TTimeIntervalMicroSeconds32& aDelay ); - - /** - * Overload for publishing multiple contacts. - * @param aContacts contact array - * @param aDelay if non-zero then context is published only after - * a short delay. If a new publish call is made before the timer fires the - * pending value will not be published. - */ - void PublishContactContextL( - const RPointerArray& aContacts, - const TTimeIntervalMicroSeconds32& aDelay ); - - /** - * Overload for publishing multiple contacts. - * This may include async operations and therefore the actual publishing may happen - * only after this function returns. - * @param aContactLinks contact link array - * @param aDelay if non-zero then context is published only after - * a short delay. If a new publish call is made before the timer fires the - * pending value will not be published. - */ - void PublishContactContextL( - const CVPbkContactLinkArray& aContactLinks, - const TTimeIntervalMicroSeconds32& aDelay ); - - /** - * Overload for publishing multiple contacts. - * @param aContactNames string array, for element format - * see PublishContactContextL(const TDesC&) - * @param aDelay if non-zero then context is published only after - * a short delay. If a new publish call is made before the timer fires the - * pending value will not be published. - */ - void PublishContactContextL( const MDesCArray& aContactNames, - const TTimeIntervalMicroSeconds32& aDelay ); - - /** - * Publishes freetext context. - * Not to be used for bulk text (e.g. full content of some text viewer component). - * @param aText some text, typically the highlighted substring - * from a viewer or editor control - * @param aDelay if non-zero then context is published only after - * a short delay. If a new publish call is made before the timer fires the - * pending value will not be published. - */ - void PublishTextContextL( const TDesC& aText, - const TTimeIntervalMicroSeconds32& aDelay ); - - /** - * Publishes URL context. - * @param aUrl URL - * @param aDelay if non-zero then context is published only after - * a short delay. If a new publish call is made before the timer fires the - * pending value will not be published. - */ - void PublishUrlContextL( const TDesC& aUrl, - const TTimeIntervalMicroSeconds32& aDelay ); - - /** - * Publishes date/time context. - * @param aTime time - * @param aDelay if non-zero then context is published only after - * a short delay. If a new publish call is made before the timer fires the - * pending value will not be published. - */ - void PublishTimeContextL( const TTime& aTime, - const TTimeIntervalMicroSeconds32& aDelay ); - - /** - * Publishes photo context. - * @param aFilename name of image file, with full path - * @param aDelay if non-zero then context is published only after - * a short delay. If a new publish call is made before the timer fires the - * pending value will not be published. - */ - void PublishPhotoContextL( const TDesC& aFilename, - const TTimeIntervalMicroSeconds32& aDelay ); - - /** - * Publishes photo context. - * @param aMdeItemId item id for the Image object in MDS - * @param aMdeSession opened metadata engine session - * @param aDelay if non-zero then context is published only after - * a short delay. If a new publish call is made before the timer fires the - * pending value will not be published. - */ - void PublishPhotoContextL( TItemId aMdeItemId, - CMdESession& aMdeSession, - const TTimeIntervalMicroSeconds32& aDelay ); - - /** - * Publishes TV context. - * Pass KNullDesC if some of the needed data is not available. - * @param aChannelName channel name - * @param aProgramName program name - * @param aProgramDescription program description - * @param aGenre genre - */ - void PublishTvContextL( const TDesC& aChannelName, - const TDesC& aProgramName, const TDesC& aProgramDescription, - const TDesC& aGenre ); - - /** - * Publishes an account id as contact context. - * - * @param aServiceId the service prefix, e.g. "Ovi" - * @param aAccountId the account id - * @param aDelay if non-zero then context is published only after - * a short delay. If a new publish call is made before the timer fires the - * pending value will not be published. - */ - void PublishServiceIdL( const TDesC& aServiceId, - const TDesC& aAccountId, - const TTimeIntervalMicroSeconds32& aDelay = 0 ); - - /** - * Enables or disables automatic re-publishing of the latest - * context (published via this context utility instance) whenever - * the application comes to foreground. - * - * It is DISABLED by default. - * - * By enabling this the applications do not have to care about - * context publishing in HandleForegroundEventL etc. - * - * The feature needs CCoeEnv and calls will be ignored if the - * environment is not available. - * - * @param aEnable flag to turn the feature on/off - */ - void RePublishWhenFgL( TBool aEnable ); - - /** - * Enables or disables context publishing when being in background. - * Applies to all PublishContextL variants. - * If disabled then no context will be published if it seems that the - * caller application is not in foreground. - * Has no effect if there is no CCoeEnv available, publishing is always - * allowed in that case. - * - * It is DISABLED by default, that is, publishing is not allowed - * from applications that are not in foreground. - * - * @param aAllow flag to turn the feature on/off - */ - void AllowPublishFromBackground( TBool aAllow ); - - /** - * @see CHgContextUtility::AddMusicContextInfo - */ - void AddMusicContextInfoL( const TDesC& aKey, const TDesC& aData ); - - /** - * @see CHgContextUtility::AddMusicContextInfo - */ - void PublishMusicContextL( - const TTimeIntervalMicroSeconds32& aDelay = 0 ); - - /** - * @see CHgContextUtility::PublishRadioContextL - */ - void PublishRadioContextL( - const TDesC& aRadioName, - const TDesC& aRadioUrl, - const TDesC& aRadioFrequency, - const TDesC& aRadioRDSPI ); - -private: // from MCFListener - void ContextIndicationL( const CCFContextIndication& aChangedContext ); - void ActionIndicationL( const CCFActionIndication& aActionToExecute ); - void HandleContextFrameworkError( TCFError aError, - const TDesC& aSource, const TDesC& aType ); - TAny* Extension( const TUid& aExtensionUid ) const; - -private: // from MCoeForegroundObserver - void HandleGainingForeground(); - void HandleLosingForeground(); - -private: // from CTimer - void RunL(); - TInt RunError( TInt aError ); - -private: - /** - * Constructor. - */ - CHgContextUtilityImpl(); - - /** - * 2nd phase constructor. - */ - void ConstructL(); - - /** - * Creates CCFClient instance if not yet done. - * Does not leave if creation fails. - * Returns ETrue if iCFClient is usable. - */ - TBool CFReady(); - - /** - * Returns ETrue if the root window's wgid is same as - * the focused window group's wgid. - * Always returns ETrue if CCoeEnv is not available. - */ - TBool IsForeground(); - - /** - * Returns ETrue if publishing context is allowed at the moment. - * Uses IsForeground and the allow-publish-from-background setting. - */ - TBool AllowedToPublish(); - - /** - * Makes sure the specific key contains valid data and publishes it. - * - * @param aKey Key to be checked and published. - * @param aDelay Delay for publishing the context data. - */ - void VerifyAndPublishMusicContextL( - const TDesC& aKey, - const TTimeIntervalMicroSeconds32& aDelay ); - - /** - * Simple wrapper to handle between delayed and instant publish. - * @see PublishContextL - * @see PublishContextDelayedL - */ - void PublishContextL( - const TDesC& aContextType, - const TDesC& aContextData, - const TTimeIntervalMicroSeconds32& aDelay ); - - CCFClient* iCFClient; - HBufC* iPendingContextType; - HBufC* iPendingContextData; - CDesCArray* iPendingContextDataArray; - - HBufC* iLastContextType; - HBufC* iLastContextData; - TBool iFgWatchEnabled; - CCoeEnv* iEnv; // not own - TBool iAllowPublishFromBackground; - - /** - * List of parameters to be published. Owns pointers. - */ - RPtrHashMap iMusicContextInfo; - }; - -#endif /* HGCONTEXTUTILITYIMPL_H */ diff -r 2f40063dfb5c -r 66e84aa0ed46 contextutility/inc/hgctxutilslogging.h --- a/contextutility/inc/hgctxutilslogging.h Wed Mar 03 15:38:34 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,25 +0,0 @@ -/* -* 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: Logging utils -* -*/ - - -#ifdef _DEBUG -_LIT( KHgLogFile, "hgctxutils.txt" ); -_LIT( KHgLogPath, "teleport" ); -#define _HGLOG_LOG_COMPONENT_ID 0x1000008d - -#endif -#include "hglogging.h" diff -r 2f40063dfb5c -r 66e84aa0ed46 contextutility/inc/hglogging.h --- a/contextutility/inc/hglogging.h Wed Mar 03 15:38:34 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,218 +0,0 @@ -/* -* 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: Logging utils -* -*/ - - -#ifndef HGLOGLOGUTILS_H -#define HGLOGLOGUTILS_H - -/** - * @file - * - * TAKING LOGGING INTO USE: - * - * This step is needed to do once per component. - * - * For each component that uses these common logging macros should specify - * their own logging configuration file, which includes this file. In that - * configuration file, following constants and macros must be defined. - * For example: - * @code - * - * _LIT( KHgLogFile, "text_file_for_logging.txt" ); - * _LIT( KHgLogPath, "folder_for_text_file" ); - * #define _HGLOG_LOG_COMPONENT_ID - * - * #include "hglogging.h" - * - * @/code - * - * KHgLogFile : This is the name of the file, where all the logs for - * this components are being written. - * - * KHgLogPath : This is the folder name under c:\logs, where the file - * is to be stored. For example, if KHgLogPath is "test", - * log file is created into folder c:\logs\test. - * - * _HGLOG_LOG_COMPONENT_ID : Unique number id of the component. This is - * for filtering purposes. - * - * _HGLOG_RDEBUG : When defined tracing instead of file logging. - * Default is for file logging. - * - * -------------------------------------------------------------------------- - * - * USING LOGGING: - * - * Basically the use is simple, register function use with HGLOG_CONTEXT, - * then log function enter by any HGLOG_IN -macro, then possibly use HGLOG - * -macros for function logging and finally HGLOG_OUT -macros for returning - * from the function. - * - * @code - * TInt CGood::Example( TInt aSomething ) - * { - * // Create log context class, which is maintained for lifetime of the - * // method. - * HGLOG_CONTEXT( Example, HGLOG_LOCAL ); - * - * // Indicate we are entering the function. - * HGLOG_IN1( "aSomething contains value %d", aSomething ); - * - * // Your buggy code... - * - * // Before leaving, indicate function execution has ended. - * HGLOG_OUT(); - * - * return 0; - * } - * @/code - */ - -#include -#include - -#include "hglogutils.h" - -#define HGLOG_API 0 -#define HGLOG_LOCAL 1 - -#define HGLOG_INFO 0 -#define HGLOG_WARNING 1 -#define HGLOG_ERROR 2 - -#define HGLOG_ASSERT(_assertion) __HGLOG_ASSERT_DBG(_assertion) -#define HGLOG_TRACE_ASSERT(_assertion) __ASSERT_DEBUG((_assertion), User::Invariant() ) - -#ifdef _DEBUG - -/***************************************************************************** - LOGGING MACROS - LOGGING ON -*****************************************************************************/ - - /** - * Context initialization - * NOTE: HGLOG_STATIC_CONTEXT is meant for static methods. - * - * @param _fn Name of the function. - * @param _vis Visibility for the client, use values HGLOG_API or HGLOG_LOCAL - * @param _thdId For static functions, thread id can be given here. - */ - #define HGLOG_CONTEXT(_fn, _vis ) _THgLogContext _dc((TText*)L ## #_fn, _HGLOG_LOG_COMPONENT_ID, _vis, (TUint)this, RProcess().SecureId().iId ) - #define HGLOG_STATIC_CONTEXT(_fn, _vis, _thdId) _THgLogContext _dc((TText*)L ## #_fn, _HGLOG_LOG_COMPONENT_ID, _vis, _thdId, RProcess().SecureId().iId ) - - /** - * Entering function - * - * @param string Custom text. Example: HGLOG_IN0( "Yeah!!!" ); - * @param p1 - p5 For multiple variables in same string. - */ - #define HGLOG_IN() do { _CHK_MULTIIN(); _HGLOGPRINTER(_IT(L ## "%s%d[%x:%x:%x]>%s "), _dc.iVis, _dc.iCategory, _dc.iId, _dc.iThdId, _dc.iAddr, _dc.iFn); _MARK_ENTRY(); } while(0) - #define HGLOG0_IN(string) do { _CHK_MULTIIN(); _HGLOGPRINTER(_IT(L ## "%s%d[%x:%x:%x]>%s " L ## string), _dc.iVis, _dc.iCategory, _dc.iId, _dc.iThdId, _dc.iAddr, _dc.iFn); _MARK_ENTRY(); } while(0) - #define HGLOG1_IN(string, p1) do { _CHK_MULTIIN(); _HGLOGPRINTER(_IT(L ## "%s%d[%x:%x:%x]>%s " L ## string), _dc.iVis, _dc.iCategory, _dc.iId, _dc.iThdId, _dc.iAddr, _dc.iFn, p1); _MARK_ENTRY(); } while(0) - #define HGLOG2_IN(string, p1, p2) do { _CHK_MULTIIN(); _HGLOGPRINTER(_IT(L ## "%s%d[%x:%x:%x]>%s " L ## string), _dc.iVis, _dc.iCategory, _dc.iId, _dc.iThdId, _dc.iAddr, _dc.iFn, p1, p2); _MARK_ENTRY(); } while(0) - #define HGLOG3_IN(string, p1, p2, p3) do { _CHK_MULTIIN(); _HGLOGPRINTER(_IT(L ## "%s%d[%x:%x:%x]>%s " L ## string), _dc.iVis, _dc.iCategory, _dc.iId, _dc.iThdId, _dc.iAddr, _dc.iFn, p1, p2, p3); _MARK_ENTRY(); } while(0) - #define HGLOG4_IN(string, p1, p2, p3, p4) do { _CHK_MULTIIN(); _HGLOGPRINTER(_IT(L ## "%s%d[%x:%x:%x]>%s " L ## string), _dc.iVis, _dc.iCategory, _dc.iId, _dc.iThdId, _dc.iAddr, _dc.iFn, p1, p2, p3, p4); _MARK_ENTRY(); } while(0) - #define HGLOG5_IN(string, p1, p2, p3, p4, p5) do { _CHK_MULTIIN(); _HGLOGPRINTER(_IT(L ## "%s%d[%x:%x:%x]>%s " L ## string), _dc.iVis, _dc.iCategory, _dc.iId, _dc.iThdId, _dc.iAddr, _dc.iFn, p1, p2, p3, p4, p5); _MARK_ENTRY(); } while(0) - - /** Leaving function */ - #define HGLOG_OUT() do { _DOINCHK(); _CHK_MULTIOUT(); _HGLOGPRINTER(_IT(L ## "%s%d[%x:%x:%x]<%s "), _dc.iVis, _dc.iCategory, _dc.iId, _dc.iThdId, _dc.iAddr, _dc.iFn); _MARK_EXIT(); } while(0) - #define HGLOG0_OUT(string) do { _DOINCHK(); _CHK_MULTIOUT(); _HGLOGPRINTER(_IT(L ## "%s%d[%x:%x:%x]<%s " L ## string), _dc.iVis, _dc.iCategory, _dc.iId, _dc.iThdId, _dc.iAddr, _dc.iFn); _MARK_EXIT(); } while(0) - #define HGLOG1_OUT(string, p1) do { _DOINCHK(); _CHK_MULTIOUT(); _HGLOGPRINTER(_IT(L ## "%s%d[%x:%x:%x]<%s " L ## string), _dc.iVis, _dc.iCategory, _dc.iId, _dc.iThdId, _dc.iAddr, _dc.iFn, p1); _MARK_EXIT(); } while(0) - #define HGLOG2_OUT(string, p1, p2) do { _DOINCHK(); _CHK_MULTIOUT(); _HGLOGPRINTER(_IT(L ## "%s%d[%x:%x:%x]<%s " L ## string), _dc.iVis, _dc.iCategory, _dc.iId, _dc.iThdId, _dc.iAddr, _dc.iFn, p1, p2); _MARK_EXIT(); } while(0) - #define HGLOG3_OUT(string, p1, p2, p3) do { _DOINCHK(); _CHK_MULTIOUT(); _HGLOGPRINTER(_IT(L ## "%s%d[%x:%x:%x]<%s " L ## string), _dc.iVis, _dc.iCategory, _dc.iId, _dc.iThdId, _dc.iAddr, _dc.iFn, p1, p2, p3); _MARK_EXIT(); } while(0) - #define HGLOG4_OUT(string, p1, p2, p3, p4) do { _DOINCHK(); _CHK_MULTIOUT(); _HGLOGPRINTER(_IT(L ## "%s%d[%x:%x:%x]<%s " L ## string), _dc.iVis, _dc.iCategory, _dc.iId, _dc.iThdId, _dc.iAddr, _dc.iFn, p1, p2, p3, p4); _MARK_EXIT(); } while(0) - #define HGLOG5_OUT(string, p1, p2, p3, p4, p5) do { _DOINCHK(); _CHK_MULTIOUT(); _HGLOGPRINTER(_IT(L ## "%s%d[%x:%x:%x]<%s " L ## string), _dc.iVis, _dc.iCategory, _dc.iId, _dc.iThdId, _dc.iAddr, _dc.iFn, p1, p2, p3, p4, p5); _MARK_EXIT(); } while(0) - - /** Leaving function with return value */ - #define HGLOG0_RET(val, fmtstr) do { do { _DOINCHK(); _CHK_MULTIOUT(); _HGLOGPRINTER(_IT(L ## "%s%d[%x:%x:%x]<%s " L ## fmtstr), _dc.iVis, _dc.iCategory, _dc.iId, _dc.iThdId, _dc.iAddr, _dc.iFn, val); _MARK_EXIT(); } while(0); return val;} while(0) - #define HGLOG1_RET(val, fmtstr, p1) do { do { _DOINCHK(); _CHK_MULTIOUT(); _HGLOGPRINTER(_IT(L ## "%s%d[%x:%x:%x]<%s " L ## fmtstr), _dc.iVis, _dc.iCategory, _dc.iId, _dc.iThdId, _dc.iAddr, _dc.iFn, val, p1); _MARK_EXIT(); } while(0); return val;} while(0) - #define HGLOG2_RET(val, fmtstr, p1, p2) do { do { _DOINCHK(); _CHK_MULTIOUT(); _HGLOGPRINTER(_IT(L ## "%s%d[%x:%x:%x]<%s " L ## fmtstr), _dc.iVis, _dc.iCategory, _dc.iId, _dc.iThdId, _dc.iAddr, _dc.iFn, val, p1, p2); _MARK_EXIT(); } while(0); return val;} while(0) - #define HGLOG3_RET(val, fmtstr, p1, p2, p3) do { do { _DOINCHK(); _CHK_MULTIOUT(); _HGLOGPRINTER(_IT(L ## "%s%d[%x:%x:%x]<%s " L ## fmtstr), _dc.iVis, _dc.iCategory, _dc.iId, _dc.iThdId, _dc.iAddr, _dc.iFn, val, p1, p2, p3); _MARK_EXIT(); } while(0); return val;} while(0) - #define HGLOG4_RET(val, fmtstr, p1, p2, p3, p4) do { do { _DOINCHK(); _CHK_MULTIOUT(); _HGLOGPRINTER(_IT(L ## "%s%d[%x:%x:%x]<%s " L ## fmtstr), _dc.iVis, _dc.iCategory, _dc.iId, _dc.iThdId, _dc.iAddr, _dc.iFn, val, p1, p2, p3, p4); _MARK_EXIT(); } while(0); return val;} while(0) - #define HGLOG5_RET(val, fmtstr, p1, p2, p3, p4, p5) do { do { _DOINCHK(); _CHK_MULTIOUT(); _HGLOGPRINTER(_IT(L ## "%s%d[%x:%x:%x]<%s " L ## fmtstr), _dc.iVis, _dc.iCategory, _dc.iId, _dc.iThdId, _dc.iAddr, _dc.iFn, val, p1, p2, p3, p4, p5); _MARK_EXIT(); } while(0); return val;} while(0) - - /** - * General log lines - * - * @param level This can be used as internal information - * field, such as info, error, warning etc. - * @param string Custom string - * @param p1 - p5 For multiple variables in same string. - */ - #define HGLOG0(level, string) do { _DOINCHK(); _HGLOGPRINTER(_IT(L ## "%s%d[%x:%x:%x]%s " L ## string), _dc.iVis, level, _dc.iId, _dc.iThdId, _dc.iAddr, _dc.iFn); } while(0) - #define HGLOG1(level, string, p1) do { _DOINCHK(); _HGLOGPRINTER(_IT(L ## "%s%d[%x:%x:%x]%s " L ## string), _dc.iVis, level, _dc.iId, _dc.iThdId, _dc.iAddr, _dc.iFn, p1); } while(0) - #define HGLOG2(level, string, p1, p2) do { _DOINCHK(); _HGLOGPRINTER(_IT(L ## "%s%d[%x:%x:%x]%s " L ## string), _dc.iVis, level, _dc.iId, _dc.iThdId, _dc.iAddr, _dc.iFn, p1, p2); } while(0) - #define HGLOG3(level, string, p1, p2, p3) do { _DOINCHK(); _HGLOGPRINTER(_IT(L ## "%s%d[%x:%x:%x]%s " L ## string), _dc.iVis, level, _dc.iId, _dc.iThdId, _dc.iAddr, _dc.iFn, p1, p2, p3); } while(0) - #define HGLOG4(level, string, p1, p2, p3, p4) do { _DOINCHK(); _HGLOGPRINTER(_IT(L ## "%s%d[%x:%x:%x]%s " L ## string), _dc.iVis, level, _dc.iId, _dc.iThdId, _dc.iAddr, _dc.iFn, p1, p2, p3, p4); } while(0) - #define HGLOG5(level, string, p1, p2, p3, p4, p5) do { _DOINCHK(); _HGLOGPRINTER(_IT(L ## "%s%d[%x:%x:%x]%s " L ## string), _dc.iVis, level, _dc.iId, _dc.iThdId, _dc.iAddr, _dc.iFn, p1, p2, p3, p4, p5); } while(0) - - /** Error logging */ - #define __HGLOG_ASSERT_DBG( _assertion ) do { if( _assertion ) { break; } TFileName file; file.Copy( _L8( __FILE__ ) ); _HGLOGPRINTER(_IT(L ## "%s%d[%x:%x:%x]<%s Assert:%S:%d:" L ## #_assertion) , _dc.iVis, _dc.iCategory, _dc.iId, _dc.iThdId, _dc.iAddr, _dc.iFn, &file, __LINE__ ); User::Invariant(); } while( 0 ) - #define __HGLOG_TRACE_ASSERT_DBG(_assertion, _textToPrint, _panicCode) do { if (_assertion) { break; } _HGLOGPRINTER(_IT(L ## "%s%d[%x:%x:%x]<%s ASSERTION FAILED!!! %s file: %s, line: %s"), _dc.iVis, _dc.iCategory, _dc.iId, _dc.iThdId, _dc.iAddr, _dc.iFn, _textToPrint, __FILE__, __LINE__); User::Panic(_L("AssertionFailed"), _panicCode} while(0) - #define HGLOG_TRAPHANDLER() _THgLogTrapHandler _traceTrapHandler; _traceTrapHandler.oldHandler = User::SetTrapHandler(&_traceTrapHandler) - -/***************************************************************************** - LOGGING MACROS - NO LOGGING -*****************************************************************************/ -#else // _DEBUG - - #define HGLOG_CONTEXT(_fn, _vis ) - #define HGLOG_STATIC_CONTEXT(_fn, _vis, _thdId) - - #define HGLOG_IN() - #define HGLOG0_IN(string) - #define HGLOG1_IN(string, p1) - #define HGLOG2_IN(string, p1, p2) - #define HGLOG3_IN(string, p1, p2, p3) - #define HGLOG4_IN(string, p1, p2, p3, p4) - #define HGLOG5_IN(string, p1, p2, p3, p4, p5) - - #define HGLOG_OUT() - #define HGLOG0_OUT(string) - #define HGLOG1_OUT(string, p1) - #define HGLOG2_OUT(string, p1, p2) - #define HGLOG3_OUT(string, p1, p2, p3) - #define HGLOG4_OUT(string, p1, p2, p3, p4) - #define HGLOG5_OUT(string, p1, p2, p3, p4, p5) - - #define HGLOG0_RET(val, fmtstr) return val - #define HGLOG1_RET(val, fmtstr, p1) return val - #define HGLOG2_RET(val, fmtstr, p1, p2) return val - #define HGLOG3_RET(val, fmtstr, p1, p2, p3) return val - #define HGLOG4_RET(val, fmtstr, p1, p2, p3, p4) return val - #define HGLOG5_RET(val, fmtstr, p1, p2, p3, p4, p5) return val - - #define HGLOG0(level, string) - #define HGLOG1(level, string, p1) - #define HGLOG2(level, string, p1, p2) - #define HGLOG3(level, string, p1, p2, p3) - #define HGLOG4(level, string, p1, p2, p3, p4) - #define HGLOG5(level, string, p1, p2, p3, p4, p5) - - #define BIND_TRACE_TRAPHANDLER() - #define TRACE_DECL() TInt _iTraceThreadId - #define TRACE_FAST_CREATE(_thdId) _thdId++; - #define TRACE_CREATE() - - #define __HGLOG_ASSERT_DBG(_assertion) - #define __TRACE_ASSERT_DBG(_assertion, _message, _panicCode ) - -#endif // _DEBUG - -#endif // HGLOGLOGUTILS_H - -// End of File diff -r 2f40063dfb5c -r 66e84aa0ed46 contextutility/inc/hglogutils.h --- a/contextutility/inc/hglogutils.h Wed Mar 03 15:38:34 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,211 +0,0 @@ -/* -* 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: Logging utils -* -*/ - - -#ifndef HGLOGUTILS_H -#define HGLOGUTILS_H - -/** - * NOTE: This file contains the logic related to logging. Change only if you - * know what you're doing. - */ - - - - - - - - - - -#ifdef _DEBUG - -#include -#include - -static const TUint HGLOGERR = 2; /**< Used to create an error message */ - -// These macros are real macros, that should be used. For temporary purposes, these -// are left out and the logging is done by simple entry logging -#define _HGLOG_UNCONTROLLED_INPUT_MSG L"%s%d[%x:%x:%x]>%s UNCONTROLLED ENTRY!" -#define _HGLOG_MULTIPLE_ENTRY_MSG L"%s%d[%x:%x:%x]%s ADDITIONAL ENTRY!" -#define _HGLOG_UNCONTROLLER_EXIT_MSG L"%s%d[%x:%x:%x]<%s UNCONTROLLED EXIT!" -#define _HGLOG_MULTIPLE_EXIT_MSG L"%s%d[%x:%x:%x]%s ADDITIONAL EXIT!" -#define _HGLOG_TRAP_HARNESS_ENTRY L"_D%d[%x:%x:%x]TraceFramework: Entering trap harness" -#define _HGLOG_TRAP_HARNESS_EXIT L"_D%d[%x:%x:%x]TraceFramework: Exiting trap harness" -#define _HGLOG_TRAP_HARNESS_LEAVE L"_D%d[%x:%x:%x]TraceFramework: ---------- LEAVE OCCURRED !!! ---------- " -#define _HGLOG_API_PREFIX L"_A" -#define _HGLOG_LOCAL_PREFIX L"_L" - -/** -* @file -* trace_utils.h contains definitions needed for advanced tracing features. -* Tracing can be customized using the following compile time flags: -* - _DEBUG -* - With this flag undefined, all traces are disabled -* - __KERNEL_MODE__ -* - if kernel mode flag is defined, kernel macro variants are used (no unicode or shared heap related stuff, faster) -* - DISABLE_SYNTAX_CHECK -* - If this flag is defined, runtime syntax checking features are disabled from traces -*/ -#ifndef DISABLE_SYNTAX_CHECK - #define _MARK_ENTRY() _dc.inOk=ETrue - #define _DOINCHK() _dc.DoInChk() - #define _CHK_MULTIIN() _dc.ChkMultiIn() - #define _CHK_MULTIOUT() _dc.ChkMultiOut() - #define _MARK_EXIT() _dc.outOk=ETrue -#else - #define _MARK_ENTRY() - #define _DOINCHK() - #define _CHK_MULTIIN() - #define _CHK_MULTIOUT() - #define _MARK_EXIT() -#endif // DISABLE_SYNTAX_CHECK - -/** For tracing */ -#ifdef _HGLOG_RDEBUG - #define _IT(a) (TPtrC((const TText *)(a))) - #define _HGLOGPRINTER RDebug::Print - -/** For filedebug */ -#else // _HGLOG_RDEBUG - - /** Includes */ - #include - #include - #include - #include - -// both of headers defines KLogBufferSize -#ifndef __COMMSDEBUGUTILITY_H__ - #include -#endif - - #define _IT(a) KHgLogPath, KHgLogFile, EFileLoggingModeAppend, (TPtrC((const TText *)(a))) - #define _HGLOGPRINTER RFileLogger::WriteFormat -#endif // _HGLOG_RDEBUG - -class _THgLogContext - { - public: - _THgLogContext( - const TText* _fn, - const TUint _id, - const TUint _vis, - const TUint _addr, - const TUint _thdId, - const TUint _category=0 ) - : - iFn(_fn), - iId(_id), - iApi((TBool)_vis), - iAddr(_addr), - iThdId(_thdId), - iVis((_vis == 0 ? (TText*)_HGLOG_API_PREFIX : (TText*)_HGLOG_LOCAL_PREFIX)), - iCategory(_category) - #ifndef DISABLE_SYNTAX_CHECK - ,outOk(EFalse), inOk(EFalse) - #endif - { - } - ~_THgLogContext() - { - #ifndef DISABLE_SYNTAX_CHECK - do - { - DoInChk(); - if (!outOk) - { - _HGLOGPRINTER(_IT(_HGLOG_UNCONTROLLER_EXIT_MSG), iVis, iCategory, iId, iThdId, iAddr, iFn); - } - } while (0); - #endif // DISABLE_SYNTAX_CHECK - } - - const TText* iFn; - const TUint iId; - const TText* iVis; - const TUint iAddr; - const TInt iThdId; - const TBool iApi; - const TUint iCategory; - - #ifndef DISABLE_SYNTAX_CHECK - inline void DoInChk() - { - if (!inOk) - { - _HGLOGPRINTER(_IT(_HGLOG_UNCONTROLLED_INPUT_MSG), iVis, iCategory, iId, iThdId, iAddr, iFn); - inOk = ETrue; - } - } - - inline void ChkMultiIn() - { - if (inOk) - { - _HGLOGPRINTER(_IT(_HGLOG_MULTIPLE_ENTRY_MSG), iVis, iCategory, iId, iThdId, iAddr, iFn); - } - } - - inline void ChkMultiOut() - { - if (outOk) - { - _HGLOGPRINTER(_IT(_HGLOG_MULTIPLE_EXIT_MSG), iVis, iCategory, iId, iThdId, iAddr, iFn); - } - } - - TBool inOk; - TBool outOk; - #endif // DISABLE_SYNTAX_CHECK - }; - -class _THgLogTrapHandler: public TTrapHandler - { - public: - - _THgLogTrapHandler(_THgLogContext& _context) : _dc( _context ) - { - RThread me; - iThdId = (TInt)me.Id(); - } - void Trap() - { - _HGLOGPRINTER(_IT(_HGLOG_TRAP_HARNESS_ENTRY), 0, HGLOGERR, iThdId, this); - oldHandler->Trap(); - } - void UnTrap() - { - _HGLOGPRINTER(_IT(_HGLOG_TRAP_HARNESS_EXIT), 0, HGLOGERR, iThdId, this); - oldHandler->UnTrap(); - } - void Leave(TInt aValue) - { - _HGLOGPRINTER(_IT(_HGLOG_TRAP_HARNESS_LEAVE), 0, HGLOGERR, iThdId, this); - oldHandler->Leave(aValue); - } - TTrapHandler* oldHandler; - private: - _THgLogContext& _dc; - TInt iThdId; - }; - -#endif // _DEBUG - -#endif // HGLOGUTILS_H \ No newline at end of file diff -r 2f40063dfb5c -r 66e84aa0ed46 contextutility/rom/hgcontextutility.iby --- a/contextutility/rom/hgcontextutility.iby Wed Mar 03 15:38:34 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,26 +0,0 @@ -/* -* 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: Iby file -* -*/ - - -#ifndef HGCONTEXTUTILITY_IBY -#define HGCONTEXTUTILITY_IBY - -#include - -file=ABI_DIR\BUILD_DIR\hgcontextutility.dll SHARED_LIB_DIR\hgcontextutility.dll - -#endif // HGCONTEXTUTILITY_IBY diff -r 2f40063dfb5c -r 66e84aa0ed46 contextutility/src/hgcontextutility.cpp --- a/contextutility/src/hgcontextutility.cpp Wed Mar 03 15:38:34 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,281 +0,0 @@ -/* -* 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: Context publishing helper dll -* -*/ - - -#include -#include "hgcontextutilityimpl.h" - -// ----------------------------------------------------------------------------- -// CHgContextUtility::NewL -// ----------------------------------------------------------------------------- -// -EXPORT_C CHgContextUtility* CHgContextUtility::NewL() - { - CHgContextUtility* self = NewLC(); - CleanupStack::Pop( self ); - return self; - } - -// ----------------------------------------------------------------------------- -// CHgContextUtility::NewLC -// ----------------------------------------------------------------------------- -// -EXPORT_C CHgContextUtility* CHgContextUtility::NewLC() - { - CHgContextUtility* self = new ( ELeave ) CHgContextUtility; - CleanupStack::PushL( self ); - self->ConstructL(); - return self; - } - -// ----------------------------------------------------------------------------- -// CHgContextUtility::CHgContextUtility -// ----------------------------------------------------------------------------- -// -CHgContextUtility::CHgContextUtility() - { - } - -// ----------------------------------------------------------------------------- -// CHgContextUtility::ConstructL -// ----------------------------------------------------------------------------- -// -void CHgContextUtility::ConstructL() - { - BaseConstructL(); - } - -// ----------------------------------------------------------------------------- -// CHgContextUtility::~CHgContextUtility -// ----------------------------------------------------------------------------- -// -EXPORT_C CHgContextUtility::~CHgContextUtility() - { - } - -// ----------------------------------------------------------------------------- -// CHgContextUtility::PublishContactContextL -// ----------------------------------------------------------------------------- -// -EXPORT_C void CHgContextUtility::PublishContactContextL( - const MVPbkStoreContact& aContact, - const TTimeIntervalMicroSeconds32& aDelay ) - { - iImpl->PublishContactContextL( aContact, aDelay ); - } - -// ----------------------------------------------------------------------------- -// CHgContextUtility::PublishContactContextL -// ----------------------------------------------------------------------------- -// -EXPORT_C void CHgContextUtility::PublishContactContextL( - const MVPbkContactLink& aContactLink, - const TTimeIntervalMicroSeconds32& aDelay ) - { - iImpl->PublishContactContextL( aContactLink, aDelay ); - } - -// ----------------------------------------------------------------------------- -// CHgContextUtility::PublishContactContextL -// ----------------------------------------------------------------------------- -// -EXPORT_C void CHgContextUtility::PublishContactContextL( - const TDesC& aContactName, - const TTimeIntervalMicroSeconds32& aDelay ) - { - iImpl->PublishContactContextL( aContactName, aDelay ); - } - -// ----------------------------------------------------------------------------- -// CHgContextUtility::PublishContactContextL -// ----------------------------------------------------------------------------- -// -EXPORT_C void CHgContextUtility::PublishContactContextL( - const RPointerArray& aContacts, - const TTimeIntervalMicroSeconds32& aDelay ) - { - iImpl->PublishContactContextL( aContacts, aDelay ); - } - -// ----------------------------------------------------------------------------- -// CHgContextUtility::PublishContactContextL -// ----------------------------------------------------------------------------- -// -EXPORT_C void CHgContextUtility::PublishContactContextL( - const CVPbkContactLinkArray& aContactLinks, - const TTimeIntervalMicroSeconds32& aDelay ) - { - iImpl->PublishContactContextL( aContactLinks, aDelay ); - } - -// ----------------------------------------------------------------------------- -// CHgContextUtility::PublishContactContextL -// ----------------------------------------------------------------------------- -// -EXPORT_C void CHgContextUtility::PublishContactContextL( - const MDesCArray& aContactNames, - const TTimeIntervalMicroSeconds32& aDelay ) - { - iImpl->PublishContactContextL( aContactNames, aDelay ); - } - -// ----------------------------------------------------------------------------- -// CHgContextUtility::PublishTextContextL -// ----------------------------------------------------------------------------- -// -EXPORT_C void CHgContextUtility::PublishTextContextL( const TDesC& aText, - const TTimeIntervalMicroSeconds32& aDelay ) - { - iImpl->PublishTextContextL( aText, aDelay ); - } - -// ----------------------------------------------------------------------------- -// CHgContextUtility::PublishUrlContextL -// ----------------------------------------------------------------------------- -// -EXPORT_C void CHgContextUtility::PublishUrlContextL( const TDesC& aUrl, - const TTimeIntervalMicroSeconds32& aDelay ) - { - iImpl->PublishUrlContextL( aUrl, aDelay ); - } - -// ----------------------------------------------------------------------------- -// CHgContextUtility::PublishTimeContextL -// ----------------------------------------------------------------------------- -// -EXPORT_C void CHgContextUtility::PublishTimeContextL( const TTime& aTime, - const TTimeIntervalMicroSeconds32& aDelay ) - { - iImpl->PublishTimeContextL( aTime, aDelay ); - } - -// ----------------------------------------------------------------------------- -// CHgContextUtility::PublishPhotoContextL -// ----------------------------------------------------------------------------- -// -EXPORT_C void CHgContextUtility::PublishPhotoContextL( - const TDesC& aFilename, - const TTimeIntervalMicroSeconds32& aDelay ) - { - iImpl->PublishPhotoContextL( aFilename, aDelay ); - } - -// ----------------------------------------------------------------------------- -// CHgContextUtility::PublishPhotoContextL -// ----------------------------------------------------------------------------- -// -EXPORT_C void CHgContextUtility::PublishPhotoContextL( - TItemId aMdeItemId, - CMdESession& aMdeSession, - const TTimeIntervalMicroSeconds32& aDelay ) - { - iImpl->PublishPhotoContextL( aMdeItemId, aMdeSession, aDelay ); - } - -// ----------------------------------------------------------------------------- -// CHgContextUtility::PublishTvContextL -// ----------------------------------------------------------------------------- -// -EXPORT_C void CHgContextUtility::PublishTvContextL( const TDesC& aChannelName, - const TDesC& aProgramName, const TDesC& aProgramDescription, - const TDesC& aGenre ) - { - iImpl->PublishTvContextL( aChannelName, aProgramName, - aProgramDescription, aGenre ); - } - -// ----------------------------------------------------------------------------- -// CHgContextUtility::PublishServiceIdL -// ----------------------------------------------------------------------------- -// -EXPORT_C void CHgContextUtility::PublishServiceIdL( const TDesC& aServiceId, - const TDesC& aAccountId, - const TTimeIntervalMicroSeconds32& aDelay ) - { - iImpl->PublishServiceIdL( aServiceId, aAccountId, aDelay ); - } - -// ----------------------------------------------------------------------------- -// CHgContextUtility::RePublishWhenFgL -// ----------------------------------------------------------------------------- -// -EXPORT_C void CHgContextUtility::RePublishWhenFgL( TBool aEnable ) - { - iImpl->RePublishWhenFgL( aEnable ); - } - -// ----------------------------------------------------------------------------- -// CHgContextUtility::AllowPublishFromBackground -// ----------------------------------------------------------------------------- -// -EXPORT_C void CHgContextUtility::AllowPublishFromBackground( TBool aAllow ) - { - iImpl->AllowPublishFromBackground( aAllow ); - } - -// ----------------------------------------------------------------------------- -// CHgContextUtility::AddMusicContextInfoL -// ----------------------------------------------------------------------------- -// -EXPORT_C void CHgContextUtility::AddMusicContextInfoL( - const TDesC& aKey, const TDesC& aData ) - { - iImpl->AddMusicContextInfoL( aKey, aData ); - } - -// ----------------------------------------------------------------------------- -// CHgContextUtility::PublishMusicContextL -// ----------------------------------------------------------------------------- -// -EXPORT_C void CHgContextUtility::PublishMusicContextL( - const TTimeIntervalMicroSeconds32& aDelay ) - { - iImpl->PublishMusicContextL( aDelay ); - } - -// ----------------------------------------------------------------------------- -// CHgContextUtility::PublishRadioContextL -// ----------------------------------------------------------------------------- -// -EXPORT_C void CHgContextUtility::PublishRadioContextL( - const TDesC& aRadioName, - const TDesC& aRadioUrl, - const TDesC& aRadioFrequency, - const TDesC& aRadioRDSPI ) - { - iImpl->PublishRadioContextL( aRadioName, aRadioUrl, - aRadioFrequency, aRadioRDSPI ); - } - -// ----------------------------------------------------------------------------- -// CHgContextUtility::BuildCombinedStringL -// ----------------------------------------------------------------------------- -EXPORT_C HBufC* CHgContextUtility::BuildCombinedStringL( const MDesCArray& aArray ) -{ - return CHgContextUtilityImpl::BuildCombinedStringL(aArray); -} - -// ----------------------------------------------------------------------------- -// CHgContextUtility::SplitCombinedStringL -// ----------------------------------------------------------------------------- -EXPORT_C void CHgContextUtility::SplitCombinedStringL( const TDesC& aString, - CDesCArray& aArray ) -{ - CHgContextUtilityImpl::SplitCombinedStringL(aString, aArray); -} -// -// end of file diff -r 2f40063dfb5c -r 66e84aa0ed46 contextutility/src/hgcontextutilitybase.cpp --- a/contextutility/src/hgcontextutilitybase.cpp Wed Mar 03 15:38:34 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,114 +0,0 @@ -/* -* 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: Context publishing helper dll -* -*/ - - -#include -#include "hgcontextutilityimpl.h" - -// ----------------------------------------------------------------------------- -// CHgContextUtilityBase::CHgContextUtilityBase -// ----------------------------------------------------------------------------- -// -CHgContextUtilityBase::CHgContextUtilityBase() - { - } - -// ----------------------------------------------------------------------------- -// CHgContextUtilityBase::BaseConstructL -// ----------------------------------------------------------------------------- -// -void CHgContextUtilityBase::BaseConstructL() - { - iImpl = CHgContextUtilityImpl::NewL(); - } - -// ----------------------------------------------------------------------------- -// CHgContextUtilityBase::~CHgContextUtilityBase -// ----------------------------------------------------------------------------- -// -CHgContextUtilityBase::~CHgContextUtilityBase() - { - delete iImpl; - } - -// ----------------------------------------------------------------------------- -// CHgContextUtilityBase::PublishContextL -// ----------------------------------------------------------------------------- -// -EXPORT_C void CHgContextUtilityBase::PublishContextL( const TDesC& aContextType, - const TDesC& aContextData ) - { - iImpl->PublishContextL( aContextType, aContextData ); - } - -// ----------------------------------------------------------------------------- -// CHgContextUtilityBase::PublishContextL -// Array version -// ----------------------------------------------------------------------------- -// -EXPORT_C void CHgContextUtilityBase::PublishContextL( const TDesC& aContextType, - const MDesCArray& aContextData ) - { - iImpl->PublishContextL( aContextType, aContextData ); - } - -// ----------------------------------------------------------------------------- -// CHgContextUtilityBase::GetContextL -// ----------------------------------------------------------------------------- -// -EXPORT_C HBufC* CHgContextUtilityBase::GetContextL( const TDesC& aContextSource, - const TDesC& aContextType ) - { - return iImpl->GetContextL( aContextSource, aContextType ); - } - -// ----------------------------------------------------------------------------- -// CHgContextUtilityBase::GetContextL -// Version using a fixed context source -// ----------------------------------------------------------------------------- -// -EXPORT_C HBufC* CHgContextUtilityBase::GetContextL( const TDesC& aContextType ) - { - return iImpl->GetContextL( aContextType ); - } - -// ----------------------------------------------------------------------------- -// CHgContextUtilityBase::PublishContextDelayedL -// ----------------------------------------------------------------------------- -// -EXPORT_C void CHgContextUtilityBase::PublishContextDelayedL( - const TDesC& aContextType, - const TDesC& aContextData, - const TTimeIntervalMicroSeconds32& aDelay ) - { - iImpl->PublishContextDelayedL( aContextType, aContextData, aDelay ); - } - -// ----------------------------------------------------------------------------- -// CHgContextUtilityBase::PublishContextDelayedL -// ----------------------------------------------------------------------------- -// -EXPORT_C void CHgContextUtilityBase::PublishContextDelayedL( - const TDesC& aContextType, - const MDesCArray& aContextData, - const TTimeIntervalMicroSeconds32& aDelay ) - { - iImpl->PublishContextDelayedL( aContextType, aContextData, aDelay ); - } - - -// end of file diff -r 2f40063dfb5c -r 66e84aa0ed46 contextutility/src/hgcontextutilityimpl.cpp --- a/contextutility/src/hgcontextutilityimpl.cpp Wed Mar 03 15:38:34 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,972 +0,0 @@ -/* -* 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: Context publishing helper dll -* -*/ - - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "hgcontextutilityimpl.h" -#include "hgcontexttypes.h" - -// max number of entries processed when aContextData is an array in PublishContextL -const TInt KMaxEntriesInMulti = 20; - -// separator character in combined string for multiple entries -const TInt KMultiSepChar = 0x0001; - -// granularity for string array -const TInt KArrayGranularity = 4; - -// argument for CBufFlat ctor when serializing contact links -const TInt KBufGranularity = 64; - -// default security policy (use LocalServices cap) for contexts -_LIT_SECURITY_POLICY_C1( KContextSecurity, ECapabilityLocalServices ); - -// ----------------------------------------------------------------------------- -// CHgContextUtilityImpl::NewL -// ----------------------------------------------------------------------------- -// -CHgContextUtilityImpl* CHgContextUtilityImpl::NewL() - { - CHgContextUtilityImpl* self = NewLC(); - CleanupStack::Pop( self ); - return self; - } - -// ----------------------------------------------------------------------------- -// CHgContextUtilityImpl::NewLC -// ----------------------------------------------------------------------------- -// -CHgContextUtilityImpl* CHgContextUtilityImpl::NewLC() - { - CHgContextUtilityImpl* self = new ( ELeave ) CHgContextUtilityImpl; - CleanupStack::PushL( self ); - self->ConstructL(); - return self; - } - -// ----------------------------------------------------------------------------- -// CHgContextUtilityImpl::CHgContextUtilityImpl -// ----------------------------------------------------------------------------- -// -CHgContextUtilityImpl::CHgContextUtilityImpl() - : CTimer( CActive::EPriorityStandard ) - { - CActiveScheduler::Add( this ); - } - -// ----------------------------------------------------------------------------- -// CHgContextUtilityImpl::ConstructL -// ----------------------------------------------------------------------------- -// -void CHgContextUtilityImpl::ConstructL() - { - CTimer::ConstructL(); - - iEnv = CCoeEnv::Static(); // may be NULL - - // Do not create iCFClient here as cf server may not be available yet - // if we are early in the boot phase. - - // set defaults - RePublishWhenFgL( EFalse ); - AllowPublishFromBackground( EFalse ); - } - -// ----------------------------------------------------------------------------- -// CHgContextUtilityImpl::~CHgContextUtilityImpl -// ----------------------------------------------------------------------------- -// -CHgContextUtilityImpl::~CHgContextUtilityImpl() - { - Cancel(); - delete iPendingContextType; - delete iPendingContextData; - delete iPendingContextDataArray; - delete iCFClient; - delete iLastContextType; - delete iLastContextData; - if ( iFgWatchEnabled && iEnv ) - { - iEnv->RemoveForegroundObserver( *this ); - } - - iMusicContextInfo.ResetAndDestroy(); - } - -// ----------------------------------------------------------------------------- -// CHgContextUtilityImpl::CFReady -// ----------------------------------------------------------------------------- -// -TBool CHgContextUtilityImpl::CFReady() - { - if ( !iCFClient ) - { - TRAPD( err, iCFClient = CCFClient::NewL( *this ) ); - if ( err != KErrNone ) - { - RDebug::Printf( "[hgctxutil] cfw not ready" ); - return EFalse; - } - } - return ETrue; - } - -// ----------------------------------------------------------------------------- -// CHgContextUtilityImpl::PublishContextL -// All other non-static versions of this function will fall back to this one. -// ----------------------------------------------------------------------------- -// -void CHgContextUtilityImpl::PublishContextL( const TDesC& aContextType, - const TDesC& aContextData ) - { - RDebug::Print( _L("[hgctxutil] PublishContextL [%S] [%S]"), - &aContextType, &aContextData ); - // create cf client instance if not yet done - // and check foreground status if needed - if ( CFReady() && AllowedToPublish() ) - { - // call static version with our cf client instance - PublishContextL( *iCFClient, aContextType, aContextData ); - } - // store type and value for later use - // (even when cfserver is not available yet, the data may still be - // used later when the app comes to foreground, for example) - if ( iLastContextType != &aContextType ) - { - delete iLastContextType; iLastContextType = 0; - iLastContextType = aContextType.AllocL(); - } - if ( iLastContextData != &aContextData ) - { - delete iLastContextData; iLastContextData = 0; - iLastContextData = aContextData.AllocL(); - } - } - -// ----------------------------------------------------------------------------- -// AppendCharL -// Appends a char to aDst, calls ReAllocL when needed, assumes that aDst -// is also on cleanupstack (at top position) so it updates that pointer too. -// ----------------------------------------------------------------------------- -// -LOCAL_C void AppendCharL( HBufC*& aDst, TChar aChar ) - { - TPtr des( aDst->Des() ); - if ( des.Length() == des.MaxLength() ) - { - HBufC* oldDst = aDst; - aDst = aDst->ReAllocL( des.MaxLength() * 2 ); - CleanupStack::Pop( oldDst ); // pop the old pointer - CleanupStack::PushL( aDst ); // and push the new (possibly different) one - des.Set( aDst->Des() ); - } - des.Append( aChar ); - } - -// ----------------------------------------------------------------------------- -// CHgContextUtilityImpl::BuildCombinedStringL -// ----------------------------------------------------------------------------- -// -HBufC* CHgContextUtilityImpl::BuildCombinedStringL( - const MDesCArray& aArray ) - { - TInt arrayCount = aArray.MdcaCount(); - if ( arrayCount >= 2 ) - { - // Rules: - // 1. escape all separator chars in the input with a preceeding \ - // 2. escape all \ chars in the input with \\ - // 3. take only the first KMaxEntriesInMulti elements from the array - // 4. append a separator also after last entry - // 5. prepend two separators to the combined string - TInt processedEntryCount = Min( arrayCount, KMaxEntriesInMulti ); - // calculate a big enough size so we can avoid ReAllocL calls later - TInt sz = 0; - for ( TInt i = 0; i < processedEntryCount; ++i ) - { - sz += aArray.MdcaPoint( i ).Length() + 1; - } - sz += 2; // for the magic prefix - HBufC* value = HBufC::NewLC( sz ); - AppendCharL( value, KMultiSepChar ); - AppendCharL( value, KMultiSepChar ); - for ( TInt i = 0; i < processedEntryCount; ++i ) - { - TPtrC entry( aArray.MdcaPoint( i ) ); - // append, also do the escaping - for ( TInt j = 0, je = entry.Length(); j != je; ++j ) - { - TChar c = entry[j]; - if ( c == KMultiSepChar || c == '\\' ) - { - AppendCharL( value, '\\' ); - } - AppendCharL( value, c ); - } - AppendCharL( value, KMultiSepChar ); - } - CleanupStack::Pop( value ); - return value; - } - return 0; - } - -// ----------------------------------------------------------------------------- -// CHgContextUtilityImpl::SplitCombinedStringL -// ----------------------------------------------------------------------------- -// -void CHgContextUtilityImpl::SplitCombinedStringL( - const TDesC& aString, CDesCArray& aArray ) - { - TInt inputLength = aString.Length(); - TBool isMulti = inputLength > 2 - && aString[0] == KMultiSepChar && aString[1] == KMultiSepChar; - if ( isMulti ) - { - // allocate a work buffer that is big enough for sure - HBufC* buf = HBufC::NewLC( inputLength ); - TPtr des( buf->Des() ); - TBool esc = EFalse; - // go through the string, find entries, and add them to output array - for ( TInt i = 2; i < inputLength; ++i ) // start from 2 because of the magic prefix - { - TChar c = aString[i]; - if ( c == '\\' && !esc ) - { - esc = ETrue; - } - else if ( c == KMultiSepChar && !esc ) - { - // found separator: append to output array, clear buffer, and continue - aArray.AppendL( des ); - des.Zero(); - } - else - { - esc = EFalse; - des.Append( c ); - } - } - CleanupStack::PopAndDestroy( buf ); - } - else - { - // not a combined string: append to array as it is - aArray.AppendL( aString ); - } - } - -// ----------------------------------------------------------------------------- -// CHgContextUtilityImpl::PublishContextL -// ----------------------------------------------------------------------------- -// -void CHgContextUtilityImpl::PublishContextL( const TDesC& aContextType, - const MDesCArray& aContextData ) - { - TInt entryCount = aContextData.MdcaCount(); - // do nothing if array is empty - if ( !entryCount ) - { - return; - } - // nothing special when having only 1 item - if ( entryCount == 1 ) - { - PublishContextL( aContextType, aContextData.MdcaPoint( 0 ) ); - return; - } - // at least two items: create the special combined string - HBufC* value = BuildCombinedStringL( aContextData ); - CleanupStack::PushL( value ); - // publish the combined string - PublishContextL( aContextType, *value ); - CleanupStack::PopAndDestroy( value ); - } - -// ----------------------------------------------------------------------------- -// CHgContextUtilityImpl::PublishContextL -// This is the version of the function where the real work is performed. -// ----------------------------------------------------------------------------- -// -void CHgContextUtilityImpl::PublishContextL( CCFClient& aCFClient, - const TDesC& aContextType, const TDesC& aContextData ) - { - CCFContextObject* context = CCFContextObject::NewLC(); - context->SetSourceL( KHgCFSource ); - context->SetTypeL( aContextType ); - context->SetValueL( aContextData ); - TInt err = aCFClient.PublishContext( *context ); - if ( err == KErrNotFound ) - { - User::LeaveIfError( aCFClient.DefineContext( KHgCFSource, - aContextType, KContextSecurity ) ); - err = aCFClient.PublishContext( *context ); - if ( err != KErrArgument ) // ignore -6 which comes e.g. when trying to publish an empty value - { - User::LeaveIfError( err ); - } - } - else if ( err != KErrArgument ) - { - User::LeaveIfError( err ); - } - CleanupStack::PopAndDestroy( context ); - } - -// ----------------------------------------------------------------------------- -// CHgContextUtilityImpl::GetContextL -// ----------------------------------------------------------------------------- -// -HBufC* CHgContextUtilityImpl::GetContextL( const TDesC& aContextSource, - const TDesC& aContextType ) - { - HBufC* ret = 0; - if ( CFReady() ) - { - CCFContextQuery* query = CCFContextQuery::NewLC(); - query->SetSourceL( aContextSource ); - query->SetTypeL( aContextType ); - RContextObjectArray result; - TInt err = iCFClient->RequestContext( *query, result ); - if ( err == KErrNone && result.Count() ) - { - ret = result[0]->Value().Alloc(); - } - result.ResetAndDestroy(); - CleanupStack::PopAndDestroy( query ); - } - return ret; - } - -// ----------------------------------------------------------------------------- -// CHgContextUtilityImpl::GetContextL -// ----------------------------------------------------------------------------- -// -HBufC* CHgContextUtilityImpl::GetContextL( const TDesC& aContextType ) - { - return GetContextL( KHgCFSource, aContextType ); - } - -// ----------------------------------------------------------------------------- -// CHgContextUtilityImpl::PublishContextDelayedL -// ----------------------------------------------------------------------------- -// -void CHgContextUtilityImpl::PublishContextDelayedL( const TDesC& aContextType, - const TDesC& aContextData, TTimeIntervalMicroSeconds32 aDelay ) - { - Cancel(); - delete iPendingContextType; iPendingContextType = 0; - iPendingContextType = aContextType.AllocL(); - delete iPendingContextData; iPendingContextData = 0; - iPendingContextData = aContextData.AllocL(); - delete iPendingContextDataArray; iPendingContextDataArray = 0; - After( aDelay ); - } - -// ----------------------------------------------------------------------------- -// CHgContextUtilityImpl::PublishContextDelayedL -// ----------------------------------------------------------------------------- -// -void CHgContextUtilityImpl::PublishContextDelayedL( const TDesC& aContextType, - const MDesCArray& aContextData, TTimeIntervalMicroSeconds32 aDelay ) - { - Cancel(); - delete iPendingContextType; iPendingContextType = 0; - iPendingContextType = aContextType.AllocL(); - delete iPendingContextData; iPendingContextData = 0; - if ( iPendingContextDataArray ) - { - iPendingContextDataArray->Reset(); - } - else - { - iPendingContextDataArray = new ( ELeave ) CDesC16ArrayFlat( KArrayGranularity ); - } - for ( TInt i = 0, ie = aContextData.MdcaCount(); i != ie; ++i ) - { - iPendingContextDataArray->AppendL( aContextData.MdcaPoint( i ) ); - } - After( aDelay ); - } - -// ----------------------------------------------------------------------------- -// CHgContextUtilityImpl::RunL -// ----------------------------------------------------------------------------- -// -void CHgContextUtilityImpl::RunL() - { - if ( iPendingContextType ) - { - if ( iPendingContextData ) - { - PublishContextL( *iPendingContextType, *iPendingContextData ); - } - else if ( iPendingContextDataArray ) - { - PublishContextL( *iPendingContextType, *iPendingContextDataArray ); - } - } - } - -// ----------------------------------------------------------------------------- -// CHgContextUtilityImpl::RunError -// ----------------------------------------------------------------------------- -// -TInt CHgContextUtilityImpl::RunError( TInt /*aError*/ ) - { - return KErrNone; - } - -// empty implementations for cfw - -// ----------------------------------------------------------------------------- -// CHgContextUtilityImpl::ContextIndicationL -// ----------------------------------------------------------------------------- -// -void CHgContextUtilityImpl::ContextIndicationL( - const CCFContextIndication& /*aChangedContext*/ ) - { - // empty - } - -// ----------------------------------------------------------------------------- -// CHgContextUtilityImpl::ActionIndicationL -// ----------------------------------------------------------------------------- -// -void CHgContextUtilityImpl::ActionIndicationL( - const CCFActionIndication& /*aActionToExecute*/ ) - { - // empty - } - -// ----------------------------------------------------------------------------- -// CHgContextUtilityImpl::HandleContextFrameworkError -// ----------------------------------------------------------------------------- -// -void CHgContextUtilityImpl::HandleContextFrameworkError( TCFError /*aError*/, - const TDesC& /*aSource*/, - const TDesC& /*aType*/ ) - { - // empty - } - -// ----------------------------------------------------------------------------- -// CHgContextUtilityImpl::Extension -// ----------------------------------------------------------------------------- -// -TAny* CHgContextUtilityImpl::Extension( const TUid& /*aExtensionUid*/ ) const - { - return 0; - } - -// ----------------------------------------------------------------------------- -// CHgContextUtilityImpl::MakeLinkPublishableLC -// ----------------------------------------------------------------------------- -// -HBufC* CHgContextUtilityImpl::MakeLinkPublishableLC( - const MVPbkContactLink& aLink ) - { - HBufC* ret = 0; - // serialize the link and place it into a 16-bit descriptor - // prefixed with one special mark character - const MVPbkStreamable* strm = aLink.Streamable(); - User::LeaveIfNull(strm); - CBufFlat* buf = CBufFlat::NewL( KBufGranularity ); - CleanupStack::PushL( buf ); - RBufWriteStream ws; - CleanupClosePushL( ws ); - ws.Open( *buf ); - strm->ExternalizeL( ws ); - CleanupStack::PopAndDestroy( &ws ); - TPtr8 p( buf->Ptr( 0 ) ); - ret = HBufC::NewLC( p.Length() + 1 ); - TPtr des( ret->Des() ); - des.Copy( p ); - _LIT( KTemp, " " ); - des.Insert( 0, KTemp ); - des[0] = KHgCFValueLinkMarker; // codescanner::accessArrayElementWithoutCheck2 - CleanupStack::Pop( ret ); - CleanupStack::PopAndDestroy( buf ); - CleanupStack::PushL( ret ); - return ret; - } - -// ----------------------------------------------------------------------------- -// CHgContextUtilityImpl::PublishContactContextL -// ----------------------------------------------------------------------------- -// -void CHgContextUtilityImpl::PublishContactContextL( - const MVPbkStoreContact& aContact, - const TTimeIntervalMicroSeconds32& aDelay ) - { - MVPbkContactLink* link = aContact.CreateLinkLC(); - if ( link ) - { - HBufC* pubstr = MakeLinkPublishableLC( *link ); - PublishContactContextL( *pubstr, aDelay ); - CleanupStack::PopAndDestroy( pubstr ); - } - CleanupStack::PopAndDestroy( );//link - } - -// ----------------------------------------------------------------------------- -// CHgContextUtilityImpl::PublishContactContextL -// ----------------------------------------------------------------------------- -// -void CHgContextUtilityImpl::PublishContactContextL( - const MVPbkContactLink& aContactLink, - const TTimeIntervalMicroSeconds32& aDelay ) - { - HBufC* pubstr = MakeLinkPublishableLC( aContactLink ); - PublishContactContextL( *pubstr, aDelay ); - CleanupStack::PopAndDestroy( pubstr ); - } - -// ----------------------------------------------------------------------------- -// CHgContextUtilityImpl::PublishContactContextL -// ----------------------------------------------------------------------------- -// -void CHgContextUtilityImpl::PublishContactContextL( - const TDesC& aContactName, - const TTimeIntervalMicroSeconds32& aDelay ) - { - if ( !aDelay.Int() ) - { - PublishContextL( KHgCFTypeContact, aContactName ); - } - else - { - PublishContextDelayedL( KHgCFTypeContact, aContactName, aDelay ); - } - } - -// ----------------------------------------------------------------------------- -// CHgContextUtilityImpl::PublishContactContextL -// ----------------------------------------------------------------------------- -// -void CHgContextUtilityImpl::PublishContactContextL( - const RPointerArray& aContacts, - const TTimeIntervalMicroSeconds32& aDelay ) - { - CDesCArray* arr = new ( ELeave ) CDesCArrayFlat( KArrayGranularity ); - CleanupStack::PushL( arr ); - for ( TInt i = 0, ie = aContacts.Count(); i != ie; ++i ) - { - MVPbkContactLink* link = aContacts[i]->CreateLinkLC(); - if ( link ) - { - HBufC* pubstr = MakeLinkPublishableLC( *link ); - arr->AppendL( *pubstr ); - CleanupStack::PopAndDestroy( pubstr ); - } - CleanupStack::PopAndDestroy( );//link - } - PublishContactContextL( *arr, aDelay ); - CleanupStack::PopAndDestroy( arr ); - } - -// ----------------------------------------------------------------------------- -// CHgContextUtilityImpl::PublishContactContextL -// ----------------------------------------------------------------------------- -// -void CHgContextUtilityImpl::PublishContactContextL( - const CVPbkContactLinkArray& aContactLinks, - const TTimeIntervalMicroSeconds32& aDelay ) - { - CDesCArray* arr = new ( ELeave ) CDesCArrayFlat( KArrayGranularity ); - CleanupStack::PushL( arr ); - for ( TInt i = 0, ie = aContactLinks.Count(); i != ie; ++i ) - { - HBufC* pubstr = MakeLinkPublishableLC( aContactLinks.At( i ) ); - arr->AppendL( *pubstr ); - CleanupStack::PopAndDestroy( pubstr ); - } - PublishContactContextL( *arr, aDelay ); - CleanupStack::PopAndDestroy( arr ); - } - -// ----------------------------------------------------------------------------- -// CHgContextUtilityImpl::PublishContactContextL -// ----------------------------------------------------------------------------- -// -void CHgContextUtilityImpl::PublishContactContextL( - const MDesCArray& aContactNames, - const TTimeIntervalMicroSeconds32& aDelay ) - { - if ( !aDelay.Int() ) - { - PublishContextL( KHgCFTypeContact, aContactNames ); - } - else - { - PublishContextDelayedL( KHgCFTypeContact, aContactNames, aDelay ); - } - } - -// ----------------------------------------------------------------------------- -// CHgContextUtilityImpl::PublishTextContextL -// ----------------------------------------------------------------------------- -// -void CHgContextUtilityImpl::PublishTextContextL( const TDesC& aText, - const TTimeIntervalMicroSeconds32& aDelay ) - { - if ( !aDelay.Int() ) - { - PublishContextL( KHgCFTypeText, aText ); - } - else - { - PublishContextDelayedL( KHgCFTypeText, aText, aDelay ); - } - } - -// ----------------------------------------------------------------------------- -// CHgContextUtilityImpl::PublishUrlContextL -// ----------------------------------------------------------------------------- -// -void CHgContextUtilityImpl::PublishUrlContextL( const TDesC& aUrl, - const TTimeIntervalMicroSeconds32& aDelay ) - { - if ( !aDelay.Int() ) - { - PublishContextL( KHgCFTypeUrl, aUrl ); - } - else - { - PublishContextDelayedL( KHgCFTypeUrl, aUrl, aDelay ); - } - } - -// ----------------------------------------------------------------------------- -// CHgContextUtilityImpl::PublishTimeContextL -// ----------------------------------------------------------------------------- -// -void CHgContextUtilityImpl::PublishTimeContextL( const TTime& aTime, - const TTimeIntervalMicroSeconds32& aDelay ) - { - // YYYYMMDD:HHMMSS.MMMMMM - const TInt KDateTimeLength = 22; - const TInt KYearLength = 4; - const TInt KMonthLength = 2; - const TInt KDayLength = 2; - _LIT( KTimeZero, ":010101.000000"); - - TDateTime dt = aTime.DateTime(); - TBuf buf; - buf.AppendNumFixedWidth( dt.Year(), EDecimal, KYearLength ); - buf.AppendNumFixedWidth( dt.Month(), EDecimal, KMonthLength ); - buf.AppendNumFixedWidth( dt.Day(), EDecimal, KDayLength ); - buf.Append( KTimeZero ); - if ( !aDelay.Int() ) - { - PublishContextL( KHgCFTypeActiveDate, buf ); - } - else - { - PublishContextDelayedL( KHgCFTypeActiveDate, buf, aDelay ); - } - } - -// ----------------------------------------------------------------------------- -// CHgContextUtilityImpl::PublishPhotoContextL -// ----------------------------------------------------------------------------- -// -void CHgContextUtilityImpl::PublishPhotoContextL( - const TDesC& aFilename, - const TTimeIntervalMicroSeconds32& aDelay ) - { - if ( !aDelay.Int() ) - { - PublishContextL( KHgCFTypePhoto, aFilename ); - } - else - { - PublishContextDelayedL( KHgCFTypePhoto, aFilename, aDelay ); - } - } - -// ----------------------------------------------------------------------------- -// CHgContextUtilityImpl::PublishPhotoContextL -// ----------------------------------------------------------------------------- -// -void CHgContextUtilityImpl::PublishPhotoContextL( - TItemId aMdeItemId, - CMdESession& aMdeSession, - const TTimeIntervalMicroSeconds32& aDelay ) - { - CMdEObject* obj = aMdeSession.GetObjectL( aMdeItemId ); - if ( obj ) - { - CleanupStack::PushL( obj ); - PublishPhotoContextL( obj->Uri(), aDelay ); - CleanupStack::PopAndDestroy( obj ); - } - else - { - User::Leave( KErrNotFound ); - } - } - -// ----------------------------------------------------------------------------- -// CHgContextUtilityImpl::PublishTvContextL -// ----------------------------------------------------------------------------- -// -void CHgContextUtilityImpl::PublishTvContextL( const TDesC& aChannelName, - const TDesC& aProgramName, const TDesC& aProgramDescription, - const TDesC& aGenre ) - { - TPtrC channelName( aChannelName.Length() ? aChannelName - : KHgCFValueUnknownInfo ); - TPtrC programName( aProgramName.Length() ? aProgramName - : KHgCFValueUnknownInfo ); - TPtrC programDesc( aProgramDescription.Length() ? aProgramDescription - : KHgCFValueUnknownInfo ); - TPtrC programGenre( aGenre.Length() ? aGenre : KHgCFValueUnknownInfo ); - - // Publish description/genre first because it is unlikely to have those - // in rules so their content will be available for sure when an action - // is triggered. - PublishContextL( KHgCFTypeTvProgramDesc, programDesc ); - PublishContextL( KHgCFTypeTvProgramGenre, programGenre ); - PublishContextL( KHgCFTypeTvChannelName, channelName ); - PublishContextL( KHgCFTypeTvProgramName, programName ); - } - -// ----------------------------------------------------------------------------- -// CHgContextUtilityImpl::PublishServiceIdL -// ----------------------------------------------------------------------------- -// -void CHgContextUtilityImpl::PublishServiceIdL( const TDesC& aServiceId, - const TDesC& aAccountId, - const TTimeIntervalMicroSeconds32& aDelay ) - { - HBufC* combinedIdBuf = HBufC::NewLC( aServiceId.Length() - + aAccountId.Length() + 1 ); - TPtr combinedId( combinedIdBuf->Des() ); - _LIT( KCombinedFormat, "%S:%S" ); - combinedId.Format( KCombinedFormat, &aServiceId, &aAccountId ); - PublishContactContextL( combinedId, aDelay ); - CleanupStack::PopAndDestroy( combinedIdBuf ); - } - -// ----------------------------------------------------------------------------- -// CHgContextUtilityImpl::RePublishWhenFgL -// ----------------------------------------------------------------------------- -// -void CHgContextUtilityImpl::RePublishWhenFgL( TBool aEnable ) - { - if ( iEnv ) - { - if ( iFgWatchEnabled ) - { - iEnv->RemoveForegroundObserver( *this ); - } - iFgWatchEnabled = aEnable; - if ( iFgWatchEnabled ) - { - iEnv->AddForegroundObserverL( *this ); - } - } - } - -// callbacks from CCoeEnv - -// ----------------------------------------------------------------------------- -// CHgContextUtilityImpl::HandleGainingForeground -// ----------------------------------------------------------------------------- -// -void CHgContextUtilityImpl::HandleGainingForeground() - { - if ( iLastContextType && iLastContextData ) - { - TRAP_IGNORE( PublishContextL( *iLastContextType, *iLastContextData ) ); - } - } - -// ----------------------------------------------------------------------------- -// CHgContextUtilityImpl::HandleLosingForeground -// ----------------------------------------------------------------------------- -// -void CHgContextUtilityImpl::HandleLosingForeground() - { - // nothing to do here - } - -// ----------------------------------------------------------------------------- -// CHgContextUtilityImpl::IsForeground -// ----------------------------------------------------------------------------- -// -TBool CHgContextUtilityImpl::IsForeground() - { - if ( iEnv ) - { - TInt rootWgId = iEnv->RootWin().WindowGroupId(); - TInt focusWgId = iEnv->WsSession().GetFocusWindowGroup(); - return rootWgId == focusWgId; - } - else - { - return ETrue; - } - } - -// ----------------------------------------------------------------------------- -// CHgContextUtilityImpl::AllowedToPublish -// ----------------------------------------------------------------------------- -// -TBool CHgContextUtilityImpl::AllowedToPublish() - { - TBool result = !iEnv || iAllowPublishFromBackground || IsForeground(); - RDebug::Printf( "[hgctxutil] AllowedToPublish = %d", result ); - return result; - } - -// ----------------------------------------------------------------------------- -// CHgContextUtilityImpl::AllowPublishFromBackground -// ----------------------------------------------------------------------------- -// -void CHgContextUtilityImpl::AllowPublishFromBackground( TBool aAllow ) - { - iAllowPublishFromBackground = aAllow; - } - -// ----------------------------------------------------------------------------- -// CHgContextUtilityImpl::AddMusicContextInfoL -// ----------------------------------------------------------------------------- -// -void CHgContextUtilityImpl::AddMusicContextInfoL( - const TDesC& aKey, const TDesC& aData ) - { - // Key needs to be provided and also it shouldn't exist in the table. - // Latter case is simple safe measure, as RPtrHasMap won't delete existing - // objects in InsertL, so adding same key twice would cause memory leak. - // The use case of adding same key twice is not 'real world' case, so - // this method can simply leave, when same key is offered again. - __ASSERT_ALWAYS( aKey.Length(), User::Leave( KErrNotFound ) ); - __ASSERT_ALWAYS( - !iMusicContextInfo.Find( aKey ), User::Leave( KErrAlreadyExists ) ); - - // Hash table needs pointers and it should own the pointers, so allocate - // key and data, and add them to table. In case the data is empty, add - // unknown information, since some data needs to be in the action field. - HBufC* key = aKey.AllocLC(); - HBufC* data = aData.Length() ? - aData.AllocLC() : KHgCFValueUnknownInfo().AllocLC(); - iMusicContextInfo.InsertL( key, data ); - CleanupStack::Pop( 2, key ); - } - -// ----------------------------------------------------------------------------- -// CHgContextUtilityImpl::PublishMusicContextL -// ----------------------------------------------------------------------------- -// -void CHgContextUtilityImpl::PublishMusicContextL( - const TTimeIntervalMicroSeconds32& aDelay ) - { - // If nothing has been done, just leave. No point of publishing entirely - // empty music context. - __ASSERT_ALWAYS( iMusicContextInfo.Count(), User::Leave( KErrNotReady ) ); - - // Before publishing anything, make sure all keys contain at least some - // data. - VerifyAndPublishMusicContextL( KHgCFTypeMusicState, aDelay ); - VerifyAndPublishMusicContextL( KHgCFTypeMusicArtist, aDelay ); - VerifyAndPublishMusicContextL( KHgCFTypeMusicTitle, aDelay ); - VerifyAndPublishMusicContextL( KHgCFTypeMusicAlbum, aDelay ); - VerifyAndPublishMusicContextL( KHgCFTypeMusicAlbumArt, aDelay ); - VerifyAndPublishMusicContextL( KHgCFTypeMusicUri, aDelay ); - VerifyAndPublishMusicContextL( KHgCFTypeMusicGenre, aDelay ); - VerifyAndPublishMusicContextL( KHgCFTypeMusicType, aDelay ); - - // Clear all data from hash table, so new music context can be published. - iMusicContextInfo.ResetAndDestroy(); - } - -// ----------------------------------------------------------------------------- -// CHgContextUtilityImpl::VerifyAndPublishMusicContextL -// ----------------------------------------------------------------------------- -// -void CHgContextUtilityImpl::VerifyAndPublishMusicContextL( - const TDesC& aKey, - const TTimeIntervalMicroSeconds32& aDelay ) - { - TDesC* data = iMusicContextInfo.Find( aKey ); - if ( !data ) - { - // Key didn't contain any data, just create the key with empty info. - AddMusicContextInfoL( aKey, KNullDesC ); - data = iMusicContextInfo.Find( aKey ); - } - - PublishContextL( aKey, *data, aDelay ); - } - -// ----------------------------------------------------------------------------- -// CHgContextUtilityImpl::PublishContextL -// ----------------------------------------------------------------------------- -// -void CHgContextUtilityImpl::PublishContextL( - const TDesC & aContextType, - const TDesC & aContextData, - const TTimeIntervalMicroSeconds32& aDelay ) - { - if ( !aDelay.Int() ) - { - PublishContextL( aContextType, aContextData ); - } - else - { - PublishContextDelayedL( aContextType, aContextData, aDelay ); - } - } - -// ----------------------------------------------------------------------------- -// CHgContextUtilityImpl::PublishRadioContextL -// ----------------------------------------------------------------------------- -// -void CHgContextUtilityImpl::PublishRadioContextL( - const TDesC& aRadioName, - const TDesC& aRadioUrl, - const TDesC& aRadioFrequency, - const TDesC& aRadioRDSPI ) - { - TPtrC radioName( aRadioName.Length() ? aRadioName - : KHgCFValueUnknownInfo ); - TPtrC radioUrl( aRadioUrl.Length() ? aRadioUrl - : KHgCFValueUnknownInfo ); - TPtrC radioFrequency( aRadioFrequency.Length() ? aRadioFrequency - : KHgCFValueUnknownInfo ); - TPtrC radioRDSPI( aRadioRDSPI.Length() ? aRadioRDSPI - : KHgCFValueUnknownInfo ); - - PublishContextL( KHgCFTypeMusicRadioRDSPI, radioRDSPI ); - PublishContextL( KHgCFTypeMusicRadioFrequency, radioFrequency ); - PublishContextL( KHgCFTypeMusicRadioUrl, radioUrl ); - PublishContextL( KHgCFTypeMusicRadioName, radioName ); - } - -// end of file diff -r 2f40063dfb5c -r 66e84aa0ed46 group/bld.inf --- a/group/bld.inf Wed Mar 03 15:38:34 2010 +0200 +++ b/group/bld.inf Fri Mar 19 10:47:36 2010 +0200 @@ -24,7 +24,7 @@ #include "../homescreenpluginsrv/group/bld.inf" #include "../idlefw/group/bld.inf" #include "../menucontentsrv/group/bld.inf" -#include "../backsteppingsrv/group/bld.inf" +//#include "../backsteppingsrv/group/bld.inf" #include "../contentpublishingsrv/group/bld.inf" #include "../homescreensrv_plat/group/bld.inf" #include "../contextutility/group/bld.inf" diff -r 2f40063dfb5c -r 66e84aa0ed46 homescreensrv_plat/group/bld.inf --- a/homescreensrv_plat/group/bld.inf Wed Mar 03 15:38:34 2010 +0200 +++ b/homescreensrv_plat/group/bld.inf Fri Mar 19 10:47:36 2010 +0200 @@ -31,7 +31,7 @@ #include "../external_home_screen_api/group/bld.inf" #include "../menu_content_service_api/group/bld.inf" #include "../sapi_contentpublishing/group/bld.inf" -#include "../sapi_backstepping/group/bld.inf" +//#include "../sapi_backstepping/group/bld.inf" #include "../sapi_actionhandler/group/bld.inf" #include "../sapi_homescreenplugin/group/bld.inf" #include "../sapi_menucontent/group/bld.inf" diff -r 2f40063dfb5c -r 66e84aa0ed46 homescreensrv_plat/sapi_backstepping/data/bsservice.rss --- a/homescreensrv_plat/sapi_backstepping/data/bsservice.rss Wed Mar 03 15:38:34 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Resource definitions for project Back Stepping Service -* -*/ - - -#include -#include - -// --------------------------------------------------------------------------- -// theInfo -// ECOM plug-in registration info -// --------------------------------------------------------------------------- -// -RESOURCE REGISTRY_INFO theInfo - { - resource_format_version = RESOURCE_FORMAT_VERSION_2; - dll_uid = 0x2000F83F; - interfaces = - { - INTERFACE_INFO - { - // Base service class - interface_uid = KLiwClassBase; - implementations = - { - IMPLEMENTATION_INFO - { - implementation_uid = 0x2000F840; - version_no = 1; - display_name = "Back Stepping Service Provider"; - default_data = "Service.BackStepping"; - opaque_data = "IBackStepping"; - } - }; - } - }; - } diff -r 2f40063dfb5c -r 66e84aa0ed46 homescreensrv_plat/sapi_backstepping/group/bld.inf --- a/homescreensrv_plat/sapi_backstepping/group/bld.inf Wed Mar 03 15:38:34 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Build information file for project Back Stepping Service -* -*/ - -// MW_LAYER_PLATFORM_EXPORT_PATH macro definitions -#include - -PRJ_PLATFORMS -WINSCW ARMV5 - -PRJ_MMPFILES -bsservice.mmp - -PRJ_EXPORTS -../rom/sapi_backstepping.iby CORE_MW_LAYER_IBY_EXPORT_PATH(sapi_backstepping.iby) - -// End of file diff -r 2f40063dfb5c -r 66e84aa0ed46 homescreensrv_plat/sapi_backstepping/group/bsservice.mmp --- a/homescreensrv_plat/sapi_backstepping/group/bsservice.mmp Wed Mar 03 15:38:34 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,48 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Project definition file for project Back Stepping Service -* -*/ - - -#include -#include - -TARGET bsservice.dll -TARGETTYPE PLUGIN -UID 0x10009D8D 0x2000F83F - -CAPABILITY CAP_ECOM_PLUGIN -VENDORID VID_DEFAULT - -SOURCEPATH ../src -SOURCE bsclient.cpp -SOURCE bsserviceprovider.cpp -SOURCE bsserviceinterface.cpp - -SOURCEPATH ../data -START RESOURCE bsservice.rss -HEADER -TARGET bsservice.rsc -TARGETPATH ECOM_RESOURCE_DIR -END // RESOURCE - -USERINCLUDE ../inc -USERINCLUDE ../../../inc - -MW_LAYER_SYSTEMINCLUDE - - -LIBRARY euser.lib -LIBRARY liwservicehandler.lib diff -r 2f40063dfb5c -r 66e84aa0ed46 homescreensrv_plat/sapi_backstepping/inc/bsserviceinterface.h --- a/homescreensrv_plat/sapi_backstepping/inc/bsserviceinterface.h Wed Mar 03 15:38:34 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,174 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Back Stepping Service Interface - * -*/ - - -#ifndef C_BS_SERVICE_INTERFACE_H -#define C_BS_SERVICE_INTERFACE_H - -#include - -#include "bsclient.h" - -/** - * Back Stepping Service Interface. - * LIW interface for communication with BS Server. - * - * @since S60 v3.2 - */ -class CBSServiceInterface : public CBase, public MLiwInterface - { - -public: - - /** - * Two-phase constructor. - */ - static CBSServiceInterface* NewLC(); - - /** - * Destructor. - */ - ~CBSServiceInterface(); - - // from base class MLiwInterface - /** - * The consumer application should call this method to execute a service - * command directly on the interface. - * - * @param aCmdName the name of the service command to invoke - * @param aInParamList the input parameter list, can be empty list - * @param [in,out] aOutParamList the output parameter list, can be empty. - * @param aCmdOptions Options for the command - * @param aCallback callback to be registered by consumer application - * - */ - void ExecuteCmdL( const TDesC8& aCmdName, - const CLiwGenericParamList& aInParamList, - CLiwGenericParamList& aOutParamList, TUint aCmdOptions = 0, - MLiwNotifyCallback* aCallback = 0 ); - - /** - * The consumer application should call this method if there - * are no more service commands to be executed on the interface. - */ - void Close(); - -private: - - // construction - /** - * Constructor. - */ - CBSServiceInterface(); - - /** - * Symbian 2nd phace constructor. - */ - void ConstructL(); - - // service handling methods - /** - * Handles Initialize command. - * - * @param aInParamList input parameter list - * @param aOutParamList output parameter list - */ - void InitializeL( const CLiwGenericParamList& aInParamList, - CLiwGenericParamList& aOutParamList ); - - /** - * Handles ForwardActivationEvent command. - * - * @param aInParamList input parameter list - * @param aOutParamList output parameter list - */ - void ForwardActivationEventL( const CLiwGenericParamList& aInParamList, - CLiwGenericParamList& aOutParamList ); - - /** - * Handles HandleBackCommand command. - * - * @param aInParamList input parameter list - * @param aOutParamList output parameter list - */ - void HandleBackCommandL( const CLiwGenericParamList& aInParamList, - CLiwGenericParamList& aOutParamList ); - - // result handling - /** - * Appends error code to output parameter list. - * - * @param aOutParamList output parameter list - * @param aError error code - */ - void HandleErrorL( CLiwGenericParamList& aOutParamList, - const TInt aError ); - - /** - * Appends service result to output parameter list. - * - * @param aOutParamList output parameter list - * @param aError error code - */ - void HandleResultL( CLiwGenericParamList& aOutParamList, - const TInt aResult ); - - // utility methods - /** - * Extracts a TPtrC8 param from input parameter list. - * - * @param aInParamList input parameter list - * @param aParamName param name - * @param aPtr returned value - * @retutn Symbian error code - */ - TInt GetParam( const CLiwGenericParamList& aInParamList, - const TDesC8& aParamName, TPtrC8& aPtr ) const; - - /** - * Extracts a TInt32 param from input parameter list. - * - * @param aInParamList input parameter list - * @param aParamName param name - * @param aNumber returned value - * @retutn Symbian error code - */ - TInt GetParam( const CLiwGenericParamList& aInParamList, - const TDesC8& aParamName, TInt32& aNumber ) const; - - /** - * Extracts a TBool param from input parameter list. - * - * @param aInParamList input parameter list - * @param aParamName param name - * @param aBool returned value - * @retutn Symbian error code - */ - TInt GetParam( const CLiwGenericParamList& aInParamList, - const TDesC8& aParamName, TBool& aBool ) const; - -private: - // data - - /** - * BS Server client. - */ - RBSClient iBSClient; - - }; - -#endif // C_BS_SERVICE_INTERFACE_H diff -r 2f40063dfb5c -r 66e84aa0ed46 homescreensrv_plat/sapi_backstepping/inc/bsserviceprovider.h --- a/homescreensrv_plat/sapi_backstepping/inc/bsserviceprovider.h Wed Mar 03 15:38:34 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,94 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Back Stepping Service Provider - * -*/ - - -#ifndef C_BS_SERVICE_PROVIDER_H -#define C_BS_SERVICE_PROVIDER_H - -#include - -/** - * Back Stepping Service Provider - * Serves as a LIW provider for the BS Service Interface. - * - * @since S60 v3.2 - */ -class CBSServiceProvider : public CLiwServiceIfBase - { - -public: - - /** - * Two-phase constructor. - */ - static CBSServiceProvider* NewL(); - - /** - * Destructor. - */ - ~CBSServiceProvider(); - - // from CLiwServiceIfBase - /** - * Called by the LIW framework to initialise necessary information - * from the Service Handler. This method is called when the consumer makes - * the attach operation. - * - * @since S60 v3.2 - * @param aFrameworkCallback Framework provided callback - * @param aInterest List of criteria items which invoked the provider - */ - void InitialiseL( MLiwNotifyCallback& aFrameworkCallback, - const RCriteriaArray& aInterest ); - - /** - * Executes generic service commands included in criteria. - * - * @param aCmdId Command to be executed - * @param aInParamList Input parameters, can be an empty list - * @param aOutParamList Output parameters, can be an empty list - * @param aCmdOptions Options for the command - * @param aCallback Callback for asynchronous command handling - */ - void HandleServiceCmdL( const TInt& aCmdId, - const CLiwGenericParamList& aInParamList, - CLiwGenericParamList& aOutParamList, TUint aCmdOptions = 0, - const MLiwNotifyCallback* aCallback = NULL ); - -private: - - /** - * Constructor. - */ - CBSServiceProvider(); - - // error handling - /** - * Appends error code to output parameter list. - * - * @param aOutParamList output parameter list - * @param aError error code - */ - void HandleErrorL( CLiwGenericParamList& aOutParamList, - const TInt aError ); - -private: - // data - - }; - -#endif // C_BS_SERVICE_PROVIDER_H diff -r 2f40063dfb5c -r 66e84aa0ed46 homescreensrv_plat/sapi_backstepping/rom/sapi_backstepping.iby --- a/homescreensrv_plat/sapi_backstepping/rom/sapi_backstepping.iby Wed Mar 03 15:38:34 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,26 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - - -#ifndef SAPI_BACKSTEPPING_IBY -#define SAPI_BACKSTEPPING_IBY - -ECOM_PLUGIN(bsservice.dll,bsservice.rsc) - -#endif // SAPI_BACKSTEPPING_IBY - -// End of File \ No newline at end of file diff -r 2f40063dfb5c -r 66e84aa0ed46 homescreensrv_plat/sapi_backstepping/sapi_backstepping.metaxml --- a/homescreensrv_plat/sapi_backstepping/sapi_backstepping.metaxml Wed Mar 03 15:38:34 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,13 +0,0 @@ - - -sapi_backstepping -Back Stepping Service API -c++ -backsteppingsrv - - - -no -no - - diff -r 2f40063dfb5c -r 66e84aa0ed46 homescreensrv_plat/sapi_backstepping/src/bsclient.cpp --- a/homescreensrv_plat/sapi_backstepping/src/bsclient.cpp Wed Mar 03 15:38:34 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,151 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Client session for BS engine - * -*/ - - -#include "bsclient.h" -#include "bsengineglobals.h" - -// Number of message slots to reserve for this client server session. -const TUint KDefaultMessageSlots( 5); - -// Function prototypes -static TInt StartServer(); -static TInt CreateServerProcess(); - -// ======== MEMBER FUNCTIONS ======== - -// ----------------------------------------------------------------------------- -// C++ default constructor can NOT contain any code, that might leave. -// ----------------------------------------------------------------------------- -// -RBSClient::RBSClient() : - RSessionBase() - { - // No implementation required - } - -// ----------------------------------------------------------------------------- -// Connect to Active Data Server session. -// ----------------------------------------------------------------------------- -// -TInt RBSClient::Connect() - { - TInt error =:: StartServer(); - - if ( error == KErrNone ) - { - error = CreateSession( KBSEngineName, - Version(), - KDefaultMessageSlots ); - } - return error; - } - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- - -TInt RBSClient::Initialize( TUid aApp ) - { - return SendReceive( EBSEngineInitialize, TIpcArgs( aApp.iUid ) ); - } - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- - -TInt RBSClient::ForwardActivationEvent( const TDesC8& aState, TBool aIsItem ) - { - TPtr8 state( (TUint8*) aState.Ptr( ), aState.Size( ), aState.Size( )); - return SendReceive( EBSEngineHandleActivationEvent, TIpcArgs( &state, - aIsItem ) ); - } - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- - -TInt RBSClient::HandleBackCommand( const TDesC8& aState, TBool aCheckOnly ) - { - TPtr8 state( (TUint8*) aState.Ptr( ), aState.Size( ), aState.Size( )); - return SendReceive( EBSEngineHandleBackCommand, TIpcArgs( &state, - aCheckOnly ) ); - } - -// ----------------------------------------------------------------------------- -// Version information. -// ----------------------------------------------------------------------------- -// -TVersion RBSClient::Version() const - { - return (TVersion( KBSEngineMajorVersionNumber, - KBSEngineMinorVersionNumber, KBSEngineBuildVersionNumber ) ); - } - -// ----------------------------------------------------------------------------- -// Static method to start the server. -// ----------------------------------------------------------------------------- -// -static TInt StartServer() - { - TInt result; - - TFindServer findServer( KBSEngineName ); - TFullName name; - - result = findServer.Next( name ); - if ( result != KErrNone ) - { - // Server not running - result = CreateServerProcess( ); - } - return result; - } - -// ----------------------------------------------------------------------------- -// Static method to create the server process. -// ----------------------------------------------------------------------------- -// -static TInt CreateServerProcess() - { - const TUidType serverUid( KNullUid, KNullUid, KServerUid3); - RProcess server; - TInt result; - result = server.Create( KBSEngineFilename, KNullDesC, serverUid ); - if ( result == KErrNone ) - { - TRequestStatus stat = KRequestPending; - server.Rendezvous( stat ); - if ( stat != KRequestPending ) - { - server.Kill( 0 ); // abort startup - } - else - { - server.Resume( ); // logon OK - start the server - } - - User::WaitForRequest( stat ); // wait for start or death - // we can't use the 'exit reason' if the server panicked as this - // is the panic 'reason' and may be '0' which cannot be distinguished - // from KErrNone - result = (server.ExitType( ) == EExitPanic ) ? KErrGeneral - : stat.Int( ); - } - server.Close( ); - return result; - } diff -r 2f40063dfb5c -r 66e84aa0ed46 homescreensrv_plat/sapi_backstepping/src/bsserviceinterface.cpp --- a/homescreensrv_plat/sapi_backstepping/src/bsserviceinterface.cpp Wed Mar 03 15:38:34 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,271 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Back Stepping Service Interface - * -*/ - - -#include "bsserviceinterface.h" -#include "bsserviceconstants.h" - -using namespace LIW; - -// ======== MEMBER FUNCTIONS ======== - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -CBSServiceInterface::CBSServiceInterface() - { - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CBSServiceInterface::ConstructL() - { - User::LeaveIfError( iBSClient.Connect( ) ); - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -CBSServiceInterface* CBSServiceInterface::NewLC() - { - CBSServiceInterface* self = new( ELeave ) CBSServiceInterface; - CleanupStack::PushL( self ); - self->ConstructL( ); - return self; - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -CBSServiceInterface::~CBSServiceInterface() - { - iBSClient.Close( ); - } - -// --------------------------------------------------------------------------- -// Executes the SAPI as per params -// --------------------------------------------------------------------------- -// -void CBSServiceInterface::ExecuteCmdL( const TDesC8& aCmdName, - const CLiwGenericParamList& aInParamList, - CLiwGenericParamList& aOutParamList, TUint aCmdOptions, - MLiwNotifyCallback* aCallback ) - { - if ( !aCallback && !aCmdOptions ) - { - if ( !aCmdName.Compare( KBSCmdInitialize ) ) - { - InitializeL( aInParamList, aOutParamList ); - } - else if ( !aCmdName.Compare( KBSCmdForwardActivationEvent ) ) - { - ForwardActivationEventL( aInParamList, aOutParamList ); - } - else if ( !aCmdName.Compare( KBSCmdHandleBackCommand ) ) - { - HandleBackCommandL( aInParamList, aOutParamList ); - } - else - { - HandleErrorL( aOutParamList, KErrNotSupported ); - } - } - else - { - HandleErrorL( aOutParamList, KErrNotSupported ); - } - } - -// --------------------------------------------------------------------------- -// Closes the interface -// --------------------------------------------------------------------------- -// -void CBSServiceInterface::Close() - { - delete this; - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CBSServiceInterface::InitializeL( - const CLiwGenericParamList& aInParamList, - CLiwGenericParamList& aOutParamList ) - { - TInt32 appUid; - TInt err = GetParam( aInParamList, KBSInParamAppUid, appUid ); - if ( err == KErrNone ) - { - TInt retVal = iBSClient.Initialize( TUid::Uid( appUid ) ); - HandleResultL( aOutParamList, retVal ); - return; - } - - HandleErrorL( aOutParamList, err ); - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CBSServiceInterface::ForwardActivationEventL( - const CLiwGenericParamList& aInParamList, - CLiwGenericParamList& aOutParamList ) - { - TPtrC8 state; - TInt err = GetParam( aInParamList, KBSInParamState, state ); - if ( err == KErrNone ) - { - TBool enter; - err = GetParam( aInParamList, KBSInParamEnter, enter ); - if ( err == KErrNone ) - { - TInt retVal = iBSClient.ForwardActivationEvent( state, enter ); - HandleResultL( aOutParamList, retVal ); - return; - } - } - - HandleErrorL( aOutParamList, err ); - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CBSServiceInterface::HandleBackCommandL( - const CLiwGenericParamList& aInParamList, - CLiwGenericParamList& aOutParamList ) - { - TPtrC8 state; - TInt err = GetParam( aInParamList, KBSInParamState, state ); - - TBool checkOnly(EFalse); - if ( GetParam( aInParamList, KBSInParamCheckOnly, checkOnly ) != KErrNone ) - { - // use default value if parameter isn't correct - checkOnly = EFalse; - } - - if ( err == KErrNone ) - { - TInt retVal = iBSClient.HandleBackCommand( state, checkOnly ); - HandleResultL( aOutParamList, retVal ); - return; - } - - HandleErrorL( aOutParamList, err ); - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CBSServiceInterface::HandleErrorL( CLiwGenericParamList& aOutParamList, - const TInt aError ) - { - aOutParamList.AppendL( TLiwGenericParam( EGenericParamError, - TLiwVariant( aError ) ) ); - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CBSServiceInterface::HandleResultL( CLiwGenericParamList& aOutParamList, - const TInt aResult ) - { - TLiwGenericParam statusInfo; - statusInfo.SetNameAndValueL( KBSOutParamStatusInfo, TLiwVariant( aResult ) ); - aOutParamList.AppendL( statusInfo ); - statusInfo.Reset( ); - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -TInt CBSServiceInterface::GetParam( const CLiwGenericParamList& aInParamList, - const TDesC8& aParamName, TPtrC8& aPtr ) const - { - TInt errCode(KErrArgument); - - const TLiwGenericParam* param= NULL; - TInt pos( 0); - param = aInParamList.FindFirst( pos, aParamName ); - if ( param && (pos != KErrNotFound ) ) - { - if ( param->Value().Get( aPtr ) ) - { - errCode = KErrNone; - } - } - - return errCode; - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -TInt CBSServiceInterface::GetParam( const CLiwGenericParamList& aInParamList, - const TDesC8& aParamName, TInt32& aNumber ) const - { - TInt errCode(KErrArgument); - - const TLiwGenericParam* param= NULL; - TInt pos( 0); - param = aInParamList.FindFirst( pos, aParamName ); - if ( param && (pos != KErrNotFound ) ) - { - if ( param->Value().Get( aNumber ) ) - { - errCode = KErrNone; - } - } - - return errCode; - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -TInt CBSServiceInterface::GetParam( const CLiwGenericParamList& aInParamList, - const TDesC8& aParamName, TBool& aBool ) const - { - TInt errCode(KErrArgument); - - const TLiwGenericParam* param= NULL; - TInt pos( 0); - param = aInParamList.FindFirst( pos, aParamName ); - if ( param && (pos != KErrNotFound ) ) - { - if ( param->Value().Get( aBool ) ) - { - errCode = KErrNone; - } - } - - return errCode; - } diff -r 2f40063dfb5c -r 66e84aa0ed46 homescreensrv_plat/sapi_backstepping/src/bsserviceprovider.cpp --- a/homescreensrv_plat/sapi_backstepping/src/bsserviceprovider.cpp Wed Mar 03 15:38:34 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,147 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Back Stepping Service Provider - * -*/ - - -#include -#include - -#include "bsserviceprovider.h" -#include "bsserviceconstants.h" -#include "bsserviceinterface.h" - -using namespace LIW; - -// ======== LOCAL FUNCTIONS ========= - -// --------------------------------------------------------------------------- -// Map the interface UIDs to implementation factory functions -// --------------------------------------------------------------------------- -// -const TImplementationProxy ImplementationTable[] = - { - IMPLEMENTATION_PROXY_ENTRY( KBSServiceImplUid, CBSServiceProvider::NewL ) - }; - -// --------------------------------------------------------------------------- -// Exported proxy for instantiation method resolution -// --------------------------------------------------------------------------- -// -EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) - { - aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); - return ImplementationTable; - } - -// ======== MEMBER FUNCTIONS ======== - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -CBSServiceProvider::CBSServiceProvider() - { - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -CBSServiceProvider* CBSServiceProvider::NewL() - { - return new (ELeave) CBSServiceProvider(); - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -CBSServiceProvider::~CBSServiceProvider() - { - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CBSServiceProvider::InitialiseL( - MLiwNotifyCallback& /*aFrameworkCallback*/, const RCriteriaArray& /*aInterest*/) - { - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CBSServiceProvider::HandleServiceCmdL( const TInt& aCmdId, - const CLiwGenericParamList& aInParamList, - CLiwGenericParamList& aOutParamList, TUint aCmdOptions, - const MLiwNotifyCallback* aCallback ) - - { - if ( (aCallback ) || (aCmdOptions ) ) - { - // report error if request is anything other than synchronous - // or user sends a callback parameter - HandleErrorL( aOutParamList, KErrNotSupported ); - return; - } - - TPtrC8 cmdName; - const TLiwGenericParam* cmd= NULL; - if ( aCmdId == KLiwCmdAsStr ) - { - TInt pos( 0); - cmd = aInParamList.FindFirst( pos, KGenericParamServiceCmdIDStr ); - if ( cmd ) - { - cmdName.Set( cmd->Value().AsData( ) ); - } - else - { - HandleErrorL( aOutParamList, KErrArgument ); - } - } - else - { - HandleErrorL( aOutParamList, KErrNotSupported ); - } - - if ( !cmdName.CompareF( KBSInterface ) ) - { - // create interface pointer and return the output param - CBSServiceInterface* ifp = CBSServiceInterface::NewLC( ); - aOutParamList.AppendL( TLiwGenericParam( KBSInterface, - TLiwVariant( ifp ) ) ); - CleanupStack::Pop( ifp ); - return; - } - else - { - HandleErrorL( aOutParamList, KErrNotSupported ); - } - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CBSServiceProvider::HandleErrorL( CLiwGenericParamList& aOutParamList, - const TInt aError ) - { - aOutParamList.AppendL( TLiwGenericParam( EGenericParamError, - TLiwVariant( aError ) ) ); - }